mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 02:23:34 +00:00
IfcGitData update to ifcgit operators poll() methods
Added loading IfcGitData to ifcgit operator's poll() methods because it was getting a bit spammy in console if you don't use git.
Traceback (most recent call last):
File "\scripts\addons\blenderbim\bim\module\ifcgit\operator.py", line 255, in poll
if IfcGitData.data["ifcmerge_exe"]:
KeyError: 'ifcmerge_exe'
Traceback (most recent call last):
File "\scripts\addons\blenderbim\bim\module\ifcgit\operator.py", line 147, in poll
repo = IfcGitData.data["repo"]
KeyError: 'repo'
Traceback (most recent call last):
File "\scripts\addons\blenderbim\bim\module\ifcgit\operator.py", line 18, in poll
path_ifc = IfcGitData.data["path_ifc"]
KeyError: 'path_ifc'
Traceback (most recent call last):
File "\scripts\addons\blenderbim\bim\module\ifcgit\operator.py", line 45, in poll
path_ifc = IfcGitData.data["path_ifc"]
KeyError: 'path_ifc'
Traceback (most recent call last):
File "\scripts\addons\blenderbim\bim\module\ifcgit\operator.py", line 190, in poll
repo = IfcGitData.data["repo"]
KeyError: 'repo'
Traceback (most recent call last):
File "\scripts\addons\blenderbim\bim\module\ifcgit\operator.py", line 111, in poll
repo = IfcGitData.data["repo"]
KeyError: 'repo'
This commit is contained in:
@@ -15,6 +15,11 @@ class IfcGitData:
|
||||
data = {}
|
||||
is_loaded = False
|
||||
|
||||
@classmethod
|
||||
def make_sure_is_loaded(cls):
|
||||
if not cls.is_loaded:
|
||||
cls.load()
|
||||
|
||||
@classmethod
|
||||
def load(cls):
|
||||
cls.data = {
|
||||
|
||||
@@ -15,6 +15,7 @@ class CreateRepo(bpy.types.Operator):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
IfcGitData.make_sure_is_loaded()
|
||||
path_ifc = IfcGitData.data["path_ifc"]
|
||||
if not os.path.isfile(path_ifc):
|
||||
return False
|
||||
@@ -42,6 +43,7 @@ class AddFileToRepo(bpy.types.Operator):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
IfcGitData.make_sure_is_loaded()
|
||||
path_ifc = IfcGitData.data["path_ifc"]
|
||||
if not os.path.isfile(path_ifc):
|
||||
return False
|
||||
@@ -107,6 +109,7 @@ class CommitChanges(bpy.types.Operator):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
IfcGitData.make_sure_is_loaded()
|
||||
props = context.scene.IfcGitProperties
|
||||
repo = IfcGitData.data["repo"]
|
||||
if props.commit_message == "":
|
||||
@@ -143,6 +146,7 @@ class AddTag(bpy.types.Operator):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
IfcGitData.make_sure_is_loaded()
|
||||
props = context.scene.IfcGitProperties
|
||||
repo = IfcGitData.data["repo"]
|
||||
if repo and (
|
||||
@@ -187,6 +191,7 @@ class RefreshGit(bpy.types.Operator):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
IfcGitData.make_sure_is_loaded()
|
||||
repo = IfcGitData.data["repo"]
|
||||
if repo != None and repo.heads:
|
||||
return True
|
||||
@@ -252,6 +257,7 @@ class Merge(bpy.types.Operator):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
IfcGitData.make_sure_is_loaded()
|
||||
if IfcGitData.data["ifcmerge_exe"]:
|
||||
return True
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user