diff --git a/src/blenderbim/blenderbim/bim/module/ifcgit/__init__.py b/src/blenderbim/blenderbim/bim/module/ifcgit/__init__.py index cea1660c64..41e5886336 100644 --- a/src/blenderbim/blenderbim/bim/module/ifcgit/__init__.py +++ b/src/blenderbim/blenderbim/bim/module/ifcgit/__init__.py @@ -15,44 +15,29 @@ # 2023 Bruno Postle , Bruno Perdigão , # Massimo Fabbro -# import os -# import sys import bpy from . import ui, prop, operator -# sys.path.insert(0, "/home/bruno/src/ifc-git") -# sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) - -# bl_info = { -# "name": "IFC Git", -# "author": "Bruno Postle", -# "location": "Scene > IFC Git", -# "description": "Manage IFC files in Git repositories", -# "blender": (2, 80, 0), -# "category": "Import-Export", -# } classes = ( - operator.AddFileToRepo, - operator.CommitChanges, - operator.CreateRepo, - operator.DiscardUncommitted, - operator.DisplayRevision, - operator.DisplayUncommitted, - operator.Merge, - operator.RefreshGit, - operator.SwitchRevision, - prop.IfcGitListItem, - prop.IfcGitProperties, - ui.IFCGIT_PT_panel, - ui.COMMIT_UL_List, - ) - - + operator.AddFileToRepo, + operator.CommitChanges, + operator.CreateRepo, + operator.DiscardUncommitted, + operator.DisplayRevision, + operator.DisplayUncommitted, + operator.Merge, + operator.RefreshGit, + operator.SwitchRevision, + prop.IfcGitListItem, + prop.IfcGitProperties, + ui.IFCGIT_PT_panel, + ui.COMMIT_UL_List, +) def register(): - bpy.types.Scene.IfcGitProperties = bpy.props.PointerProperty(type=prop.IfcGitProperties) + bpy.types.Scene.IfcGitProperties = bpy.props.PointerProperty(type=prop.IfcGitProperties) def unregister(): diff --git a/src/blenderbim/blenderbim/bim/module/ifcgit/data.py b/src/blenderbim/blenderbim/bim/module/ifcgit/data.py index e2d0236049..bdf876bfda 100644 --- a/src/blenderbim/blenderbim/bim/module/ifcgit/data.py +++ b/src/blenderbim/blenderbim/bim/module/ifcgit/data.py @@ -1,6 +1,7 @@ import bpy import os import shutil + # import tool import blenderbim.tool as tool diff --git a/src/blenderbim/blenderbim/bim/module/ifcgit/prop.py b/src/blenderbim/blenderbim/bim/module/ifcgit/prop.py index bbee8084c9..28b98e07c4 100644 --- a/src/blenderbim/blenderbim/bim/module/ifcgit/prop.py +++ b/src/blenderbim/blenderbim/bim/module/ifcgit/prop.py @@ -15,9 +15,7 @@ def git_branches(self, context): # NOTE "Python must keep a reference to the strings returned by # the callback or Blender will misbehave or even crash" - IfcGitData.data["branch_names"] = sorted( - [branch.name for branch in IfcGitData.data["repo"].heads] - ) + IfcGitData.data["branch_names"] = sorted([branch.name for branch in IfcGitData.data["repo"].heads]) if "main" in IfcGitData.data["branch_names"]: IfcGitData.data["branch_names"].remove("main") diff --git a/src/blenderbim/blenderbim/bim/module/ifcgit/ui.py b/src/blenderbim/blenderbim/bim/module/ifcgit/ui.py index 35a289f338..75c68cd270 100644 --- a/src/blenderbim/blenderbim/bim/module/ifcgit/ui.py +++ b/src/blenderbim/blenderbim/bim/module/ifcgit/ui.py @@ -71,9 +71,7 @@ class IFCGIT_PT_panel(bpy.types.Panel): if IfcGitData.data["repo"].head.is_detached: row = layout.row() - row.label( - text="HEAD is detached, commit will create a branch", icon="ERROR" - ) + row.label(text="HEAD is detached, commit will create a branch", icon="ERROR") row.prop(props, "new_branch_name") row = layout.row() @@ -83,9 +81,7 @@ class IFCGIT_PT_panel(bpy.types.Panel): if IfcGitData.data["repo"].head.is_detached: row.label(text="Working branch: Detached HEAD") else: - row.label( - text="Working branch: " + IfcGitData.data["repo"].active_branch.name - ) + row.label(text="Working branch: " + IfcGitData.data["repo"].active_branch.name) grouped = layout.row() column = grouped.column() @@ -141,9 +137,7 @@ class IFCGIT_PT_panel(bpy.types.Panel): class COMMIT_UL_List(bpy.types.UIList): """List of Git commits""" - def draw_item( - self, context, layout, data, item, icon, active_data, active_propname, index - ): + def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): props = context.scene.IfcGitProperties @@ -166,9 +160,7 @@ class COMMIT_UL_List(bpy.types.UIList): refs += "{" + tag.name + "} " if commit == current_revision: - layout.label( - text="[HEAD] " + refs + commit.message, icon="DECORATE_KEYFRAME" - ) + layout.label(text="[HEAD] " + refs + commit.message, icon="DECORATE_KEYFRAME") else: layout.label(text=refs + commit.message, icon="DECORATE_ANIMATE") layout.label(text=time.strftime("%c", time.localtime(commit.committed_date))) diff --git a/src/blenderbim/blenderbim/tool/ifcgit.py b/src/blenderbim/blenderbim/tool/ifcgit.py index 416cc05e52..b30b5b6292 100644 --- a/src/blenderbim/blenderbim/tool/ifcgit.py +++ b/src/blenderbim/blenderbim/tool/ifcgit.py @@ -47,9 +47,7 @@ class IfcGit: @classmethod def add_file_to_repo(cls, repo, path_file): repo.index.add(path_file) - repo.index.commit( - message="Added " + os.path.relpath(path_file, repo.working_dir) - ) + repo.index.commit(message="Added " + os.path.relpath(path_file, repo.working_dir)) bpy.ops.ifcgit.refresh() @classmethod @@ -63,7 +61,6 @@ class IfcGit: repo.index.add(path_file) repo.index.commit(message=props.commit_message) props.commit_message = "" - return repo @classmethod def create_new_branch(cls): @@ -209,9 +206,7 @@ class IfcGit: current_revision = repo.commit() if selected_revision == current_revision: - area = next( - area for area in bpy.context.screen.areas if area.type == "VIEW_3D" - ) + area = next(area for area in bpy.context.screen.areas if area.type == "VIEW_3D") area.spaces[0].shading.color_type = "MATERIAL" return @@ -249,9 +244,7 @@ class IfcGit: final_step_ids = {} final_step_ids["added"] = step_ids["added"] final_step_ids["removed"] = step_ids["removed"] - final_step_ids["modified"] = step_ids["modified"].union( - modified_shape_object_step_ids["modified"] - ) + final_step_ids["modified"] = step_ids["modified"].union(modified_shape_object_step_ids["modified"]) return final_step_ids @classmethod @@ -311,9 +304,7 @@ class IfcGit: section = 'mergetool "ifcmerge"' if not config_reader.has_section(section): config_writer = IfcGitRepo.repo.config_writer() - config_writer.set_value( - section, "cmd", "ifcmerge $BASE $LOCAL $REMOTE $MERGED" - ) + config_writer.set_value(section, "cmd", "ifcmerge $BASE $LOCAL $REMOTE $MERGED") config_writer.set_value(section, "trustExitCode", True) @classmethod