mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 18:21:59 +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 = {}
|
data = {}
|
||||||
is_loaded = False
|
is_loaded = False
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def make_sure_is_loaded(cls):
|
||||||
|
if not cls.is_loaded:
|
||||||
|
cls.load()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def load(cls):
|
def load(cls):
|
||||||
cls.data = {
|
cls.data = {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ class CreateRepo(bpy.types.Operator):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
|
IfcGitData.make_sure_is_loaded()
|
||||||
path_ifc = IfcGitData.data["path_ifc"]
|
path_ifc = IfcGitData.data["path_ifc"]
|
||||||
if not os.path.isfile(path_ifc):
|
if not os.path.isfile(path_ifc):
|
||||||
return False
|
return False
|
||||||
@@ -42,6 +43,7 @@ class AddFileToRepo(bpy.types.Operator):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
|
IfcGitData.make_sure_is_loaded()
|
||||||
path_ifc = IfcGitData.data["path_ifc"]
|
path_ifc = IfcGitData.data["path_ifc"]
|
||||||
if not os.path.isfile(path_ifc):
|
if not os.path.isfile(path_ifc):
|
||||||
return False
|
return False
|
||||||
@@ -107,6 +109,7 @@ class CommitChanges(bpy.types.Operator):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
|
IfcGitData.make_sure_is_loaded()
|
||||||
props = context.scene.IfcGitProperties
|
props = context.scene.IfcGitProperties
|
||||||
repo = IfcGitData.data["repo"]
|
repo = IfcGitData.data["repo"]
|
||||||
if props.commit_message == "":
|
if props.commit_message == "":
|
||||||
@@ -143,6 +146,7 @@ class AddTag(bpy.types.Operator):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
|
IfcGitData.make_sure_is_loaded()
|
||||||
props = context.scene.IfcGitProperties
|
props = context.scene.IfcGitProperties
|
||||||
repo = IfcGitData.data["repo"]
|
repo = IfcGitData.data["repo"]
|
||||||
if repo and (
|
if repo and (
|
||||||
@@ -187,6 +191,7 @@ class RefreshGit(bpy.types.Operator):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
|
IfcGitData.make_sure_is_loaded()
|
||||||
repo = IfcGitData.data["repo"]
|
repo = IfcGitData.data["repo"]
|
||||||
if repo != None and repo.heads:
|
if repo != None and repo.heads:
|
||||||
return True
|
return True
|
||||||
@@ -252,6 +257,7 @@ class Merge(bpy.types.Operator):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
|
IfcGitData.make_sure_is_loaded()
|
||||||
if IfcGitData.data["ifcmerge_exe"]:
|
if IfcGitData.data["ifcmerge_exe"]:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|||||||
Reference in New Issue
Block a user