mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 15:08:51 +00:00
Fix some refresh glitches in IFC Git panel
This commit is contained in:
@@ -38,11 +38,9 @@ class IfcGitData:
|
|||||||
def repo(cls):
|
def repo(cls):
|
||||||
if bool(tool.Ifc.get()):
|
if bool(tool.Ifc.get()):
|
||||||
path_ifc = tool.Ifc.get_path()
|
path_ifc = tool.Ifc.get_path()
|
||||||
if not os.path.isfile(path_ifc):
|
if os.path.isfile(path_ifc):
|
||||||
return None
|
return tool.IfcGit.repo_from_path(path_ifc)
|
||||||
return tool.IfcGit.repo_from_path(path_ifc)
|
return None
|
||||||
else:
|
|
||||||
return tool.IfcGitRepo.repo
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def branch_names(cls):
|
def branch_names(cls):
|
||||||
@@ -50,7 +48,10 @@ class IfcGitData:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def path_ifc(cls):
|
def path_ifc(cls):
|
||||||
return tool.Ifc.get_path()
|
path_ifc = tool.Ifc.get_path()
|
||||||
|
if os.path.isfile(path_ifc):
|
||||||
|
return tool.Ifc.get_path()
|
||||||
|
return None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def branches_by_hexsha(cls):
|
def branches_by_hexsha(cls):
|
||||||
@@ -70,32 +71,33 @@ class IfcGitData:
|
|||||||
def name_ifc(cls):
|
def name_ifc(cls):
|
||||||
if bool(tool.Ifc.get()):
|
if bool(tool.Ifc.get()):
|
||||||
path_ifc = tool.Ifc.get_path()
|
path_ifc = tool.Ifc.get_path()
|
||||||
if tool.IfcGitRepo.repo:
|
if tool.IfcGitRepo.repo and os.path.isfile(path_ifc):
|
||||||
working_dir = tool.IfcGitRepo.repo.working_dir
|
working_dir = tool.IfcGitRepo.repo.working_dir
|
||||||
return os.path.relpath(path_ifc, working_dir)
|
return os.path.relpath(path_ifc, working_dir)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def dir_name(cls):
|
def dir_name(cls):
|
||||||
if bool(tool.Ifc.get()):
|
if bool(tool.Ifc.get()):
|
||||||
path_ifc = tool.Ifc.get_path()
|
path_ifc = tool.Ifc.get_path()
|
||||||
if not os.path.isfile(path_ifc):
|
if os.path.isfile(path_ifc):
|
||||||
return None
|
return os.path.dirname(path_ifc)
|
||||||
return os.path.dirname(path_ifc)
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def base_name(cls):
|
def base_name(cls):
|
||||||
if bool(tool.Ifc.get()):
|
if bool(tool.Ifc.get()):
|
||||||
path_ifc = tool.Ifc.get_path()
|
path_ifc = tool.Ifc.get_path()
|
||||||
return os.path.basename(path_ifc)
|
if os.path.isfile(path_ifc):
|
||||||
|
return os.path.basename(path_ifc)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def is_dirty(cls):
|
def is_dirty(cls):
|
||||||
if tool.IfcGitRepo.repo and cls.git_exe():
|
if cls.repo() and cls.git_exe():
|
||||||
path_ifc = tool.Ifc.get_path()
|
path_ifc = tool.Ifc.get_path()
|
||||||
return tool.IfcGitRepo.repo.is_dirty(path=path_ifc)
|
if os.path.isfile(path_ifc):
|
||||||
|
return cls.repo().is_dirty(path=path_ifc)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -103,7 +105,8 @@ class IfcGitData:
|
|||||||
props = bpy.context.scene.IfcGitProperties
|
props = bpy.context.scene.IfcGitProperties
|
||||||
if len(props.ifcgit_commits) > 0:
|
if len(props.ifcgit_commits) > 0:
|
||||||
item = props.ifcgit_commits[props.commit_index]
|
item = props.ifcgit_commits[props.commit_index]
|
||||||
return tool.IfcGitRepo.repo.commit(rev=item.hexsha)
|
if cls.repo():
|
||||||
|
return cls.repo().commit(rev=item.hexsha)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def current_revision(cls):
|
def current_revision(cls):
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ class CommitChanges(bpy.types.Operator):
|
|||||||
|
|
||||||
repo = IfcGitData.data["repo"]
|
repo = IfcGitData.data["repo"]
|
||||||
core.commit_changes(tool.IfcGit, tool.Ifc, repo, context)
|
core.commit_changes(tool.IfcGit, tool.Ifc, repo, context)
|
||||||
|
bpy.ops.ifcgit.refresh()
|
||||||
refresh()
|
refresh()
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user