From a39f268a53c848dc4c092b2c4d6d9a31cbff0723 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Perdig=C3=A3o?= Date: Sat, 22 Apr 2023 16:25:47 -0300 Subject: [PATCH] changed imports to integrate with blenderbim --- src/blenderbim/blenderbim/bim/__init__.py | 1 + .../blenderbim/bim/module/ifcgit/data.py | 24 +++++++-------- .../blenderbim/bim/module/ifcgit/operator.py | 29 +++++++++---------- .../blenderbim/bim/module/ifcgit/prop.py | 2 -- .../blenderbim/bim/module/ifcgit/ui.py | 1 - 5 files changed, 27 insertions(+), 30 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/__init__.py b/src/blenderbim/blenderbim/bim/__init__.py index 1c4c03fbff..9b8e5bc70a 100644 --- a/src/blenderbim/blenderbim/bim/__init__.py +++ b/src/blenderbim/blenderbim/bim/__init__.py @@ -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, diff --git a/src/blenderbim/blenderbim/bim/module/ifcgit/data.py b/src/blenderbim/blenderbim/bim/module/ifcgit/data.py index 73857c2e8a..e2d0236049 100644 --- a/src/blenderbim/blenderbim/bim/module/ifcgit/data.py +++ b/src/blenderbim/blenderbim/bim/module/ifcgit/data.py @@ -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 diff --git a/src/blenderbim/blenderbim/bim/module/ifcgit/operator.py b/src/blenderbim/blenderbim/bim/module/ifcgit/operator.py index 628f1e01ba..279eeabff4 100644 --- a/src/blenderbim/blenderbim/bim/module/ifcgit/operator.py +++ b/src/blenderbim/blenderbim/bim/module/ifcgit/operator.py @@ -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: diff --git a/src/blenderbim/blenderbim/bim/module/ifcgit/prop.py b/src/blenderbim/blenderbim/bim/module/ifcgit/prop.py index 8e312d7062..551933fdbe 100644 --- a/src/blenderbim/blenderbim/bim/module/ifcgit/prop.py +++ b/src/blenderbim/blenderbim/bim/module/ifcgit/prop.py @@ -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 diff --git a/src/blenderbim/blenderbim/bim/module/ifcgit/ui.py b/src/blenderbim/blenderbim/bim/module/ifcgit/ui.py index c2f0adafee..690f2f2c64 100644 --- a/src/blenderbim/blenderbim/bim/module/ifcgit/ui.py +++ b/src/blenderbim/blenderbim/bim/module/ifcgit/ui.py @@ -1,4 +1,3 @@ - import bpy import time from data import IfcGitData