changed imports to integrate with blenderbim

This commit is contained in:
Bruno Perdigão
2023-04-22 16:25:47 -03:00
parent dff4c178e7
commit a39f268a53
5 changed files with 27 additions and 30 deletions
@@ -71,6 +71,7 @@ modules = {
"covetool": None,
"augin": None,
"debug": None,
"ifcgit": None,
# Uncomment this line to enable loading of the demo module. Happy hacking!
# The name "demo" must correlate to a folder name in `bim/module/`.
# "demo": None,
@@ -1,8 +1,8 @@
import bpy
import os
import shutil
import tool
import blenderbim.tool as btool
# import tool
import blenderbim.tool as tool
def refresh():
@@ -35,8 +35,8 @@ class IfcGitData:
@classmethod
def repo(cls):
if bool(btool.Ifc.get()):
path_ifc = btool.Ifc.get_path()
if bool(tool.Ifc.get()):
path_ifc = tool.Ifc.get_path()
if not os.path.isfile(path_ifc):
return None
return tool.IfcGit.repo_from_path(path_ifc)
@@ -49,7 +49,7 @@ class IfcGitData:
@classmethod
def path_ifc(cls):
return btool.Ifc.get_path()
return tool.Ifc.get_path()
@classmethod
def branches_by_hexsha(cls):
@@ -67,8 +67,8 @@ class IfcGitData:
@classmethod
def name_ifc(cls):
if bool(btool.Ifc.get()):
path_ifc = btool.Ifc.get_path()
if bool(tool.Ifc.get()):
path_ifc = tool.Ifc.get_path()
if tool.IfcGitRepo.repo:
working_dir = tool.IfcGitRepo.repo.working_dir
return os.path.relpath(path_ifc, working_dir)
@@ -76,8 +76,8 @@ class IfcGitData:
@classmethod
def dir_name(cls):
if bool(btool.Ifc.get()):
path_ifc = btool.Ifc.get_path()
if bool(tool.Ifc.get()):
path_ifc = tool.Ifc.get_path()
if not os.path.isfile(path_ifc):
return None
return os.path.dirname(path_ifc)
@@ -85,15 +85,15 @@ class IfcGitData:
@classmethod
def base_name(cls):
if bool(btool.Ifc.get()):
path_ifc = btool.Ifc.get_path()
if bool(tool.Ifc.get()):
path_ifc = tool.Ifc.get_path()
return os.path.basename(path_ifc)
return None
@classmethod
def is_dirty(cls):
if tool.IfcGitRepo.repo and cls.git_exe():
path_ifc = btool.Ifc.get_path()
path_ifc = tool.Ifc.get_path()
return tool.IfcGitRepo.repo.is_dirty(path=path_ifc)
return False
@@ -1,15 +1,14 @@
import os
import re
import bpy
import core
from tool import IfcGit as tool
import blenderbim.core.ifcgit as core
import blenderbim.tool as tool
# from tool import IfcGit as tool
from data import IfcGitData
# TODO Remove all handler elements once in the correct folder structure
import handler
# import handler
import blenderbim.tool as btool
# import blenderbim.tool as tool
class CreateRepo(bpy.types.Operator):
@@ -34,7 +33,7 @@ class CreateRepo(bpy.types.Operator):
def execute(self, context):
core.create_repo(tool, btool.Ifc)
core.create_repo(tool.IfcGit, tool.Ifc)
handler.refresh_ui_data()
return {"FINISHED"}
@@ -58,7 +57,7 @@ class AddFileToRepo(bpy.types.Operator):
def execute(self, context):
core.add_file(tool, btool.Ifc)
core.add_file(tool.IfcGit, tool.Ifc)
handler.refresh_ui_data()
return {"FINISHED"}
@@ -72,7 +71,7 @@ class DiscardUncommitted(bpy.types.Operator):
def execute(self, context):
core.discard_uncomitted(tool, btool.Ifc)
core.discard_uncomitted(tool.IfcGit, tool.Ifc)
handler.refresh_ui_data()
return {"FINISHED"}
@@ -107,7 +106,7 @@ class CommitChanges(bpy.types.Operator):
def execute(self, context):
repo = IfcGitData.data["repo"]
core.commit_changes(tool, btool.Ifc, repo, context)
core.commit_changes(tool.IfcGit, tool.Ifc, repo, context)
handler.refresh_ui_data()
return {"FINISHED"}
@@ -129,7 +128,7 @@ class RefreshGit(bpy.types.Operator):
def execute(self, context):
repo = IfcGitData.data["repo"]
core.refresh_revision_list(tool, repo, btool.Ifc)
core.refresh_revision_list(tool.IfcGit, repo, tool.Ifc)
handler.refresh_ui_data()
return {"FINISHED"}
@@ -143,7 +142,7 @@ class DisplayRevision(bpy.types.Operator):
def execute(self, context):
core.colourise_revision(tool, context)
core.colourise_revision(tool.IfcGit, context)
handler.refresh_ui_data()
return {"FINISHED"}
@@ -158,7 +157,7 @@ class DisplayUncommitted(bpy.types.Operator):
def execute(self, context):
repo = IfcGitData.data["repo"]
core.colourise_uncommitted(tool, btool.Ifc, repo)
core.colourise_uncommitted(tool.IfcGit, tool.Ifc, repo)
handler.refresh_ui_data()
return {"FINISHED"}
@@ -172,7 +171,7 @@ class SwitchRevision(bpy.types.Operator):
def execute(self, context):
core.switch_revision(tool, btool.Ifc)
core.switch_revision(tool.IfcGit, tool.Ifc)
handler.refresh_ui_data()
return {"FINISHED"}
@@ -192,7 +191,7 @@ class Merge(bpy.types.Operator):
def execute(self, context):
if core.merge_branch(tool, btool.Ifc, self):
if core.merge_branch(tool.IfcGit, tool.Ifc, self):
handler.refresh_ui_data()
return {"FINISHED"}
else:
@@ -1,6 +1,5 @@
import bpy
from bpy.types import PropertyGroup
from bpy.props import (
StringProperty,
BoolProperty,
@@ -8,7 +7,6 @@ from bpy.props import (
IntProperty,
EnumProperty,
)
from data import IfcGitData
@@ -1,4 +1,3 @@
import bpy
import time
from data import IfcGitData