本文整理汇总了Python中PathScripts.PathUtil.getPublicObject方法的典型用法代码示例。如果您正苦于以下问题:Python PathUtil.getPublicObject方法的具体用法?Python PathUtil.getPublicObject怎么用?Python PathUtil.getPublicObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PathScripts.PathUtil
的用法示例。
在下文中一共展示了PathUtil.getPublicObject方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addBase
# 需要导入模块: from PathScripts import PathUtil [as 别名]
# 或者: from PathScripts.PathUtil import getPublicObject [as 别名]
def addBase(self, obj, base, sub):
PathLog.track()
base = PathUtil.getPublicObject(base)
if self._setBaseAndStock(obj):
if base == self.job.Proxy.baseObject(self.job):
base = self.baseobject
baselist = obj.Base
if baselist is None:
baselist = []
item = (base, sub)
if item in baselist:
PathLog.notice(translate("Path", "this object already in the list" + "\n"))
else:
baselist.append(item)
obj.Base = baselist
示例2: addBase
# 需要导入模块: from PathScripts import PathUtil [as 别名]
# 或者: from PathScripts.PathUtil import getPublicObject [as 别名]
def addBase(self, obj, base, sub):
PathLog.track(obj, base, sub)
base = PathUtil.getPublicObject(base)
if self._setBaseAndStock(obj):
if base == self.job.Proxy.baseObject(self.job):
base = self.baseobject
baselist = obj.Base
if baselist is None:
baselist = []
for p, el in baselist:
if p == base and sub in el:
PathLog.notice((translate("Path", "Base object %s.%s already in the list")+"\n") % (base.Label, sub))
return
baselist.append((base, sub))
obj.Base = baselist
示例3: addBase
# 需要导入模块: from PathScripts import PathUtil [as 别名]
# 或者: from PathScripts.PathUtil import getPublicObject [as 别名]
def addBase(self, obj, base, sub):
PathLog.track(obj, base, sub)
base = PathUtil.getPublicObject(base)
if self._setBaseAndStock(obj):
for model in self.job.Model.Group:
if base == self.job.Proxy.baseObject(self.job, model):
base = model
break
baselist = obj.Base
if baselist is None:
baselist = []
for p, el in baselist:
if p == base and sub in el:
PathLog.notice((translate("Path", "Base object %s.%s already in the list")+"\n") % (base.Label, sub))
return
if not self.opRejectAddBase(obj, base, sub):
baselist.append((base, sub))
obj.Base = baselist
else:
PathLog.notice((translate("Path", "Base object %s.%s rejected by operation")+"\n") % (base.Label, sub))
示例4: baseObjectViewObject
# 需要导入模块: from PathScripts import PathUtil [as 别名]
# 或者: from PathScripts.PathUtil import getPublicObject [as 别名]
def baseObjectViewObject(self, obj):
return PathUtil.getPublicObject(self.obj.Proxy.baseObject(obj)).ViewObject
示例5: setupModel
# 需要导入模块: from PathScripts import PathUtil [as 别名]
# 或者: from PathScripts.PathUtil import getPublicObject [as 别名]
def setupModel(self, job = None):
if job:
sel = [PathUtil.getPublicObject(job.Proxy.baseObject(job, obj)) for obj in job.Model.Group]
xxx = job.Model.Group + [job.Stock]
else:
sel = FreeCADGui.Selection.getSelection()
xxx = []
if sel:
selected = [s.Label for s in sel]
else:
selected = []
PathLog.track('selected', selected)
expandSolids = False
expandTwoDs = False
expandJobs = False
index = 0
candidates = sorted(PathJob.ObjectJob.baseCandidates(), key=lambda o: o.Label)
for base in candidates:
PathLog.track(base.Label)
if not base in xxx and not PathJob.isResourceClone(job, base, None) and not hasattr(base, 'StockType'):
PathLog.track('base', base.Label)
item = QtGui.QTreeWidgetItem([base.Label])
item.setData(0, self.DataObject, base)
sel = base.Label in selected
if sel or (1 == len(candidates) and not selected):
item.setCheckState(0, QtCore.Qt.CheckState.Checked)
else:
item.setCheckState(0, QtCore.Qt.CheckState.Unchecked)
if PathUtil.isSolid(base):
self.itemsSolid.addChild(item)
if sel:
expandSolids = True
else:
self.itemsTwoD.addChild(item)
if sel:
expandTwoDs = True
for j in sorted(PathJob.Instances(), key=lambda x: x.Label):
if j != job:
item = QtGui.QTreeWidgetItem([j.Label])
item.setData(0, self.DataObject, j)
if j.Label in selected:
expandJobs = True
item.setCheckState(0, QtCore.Qt.CheckState.Checked)
else:
item.setCheckState(0, QtCore.Qt.CheckState.Unchecked)
self.itemsJob.addChild(item)
if self.itemsSolid.childCount() > 0:
self.dialog.modelTree.addTopLevelItem(self.itemsSolid)
if expandSolids or not (expandTwoDs or expandJobs):
PathLog.track()
self.itemsSolid.setExpanded(True)
expandSolids = True
if self.itemsTwoD.childCount() > 0:
self.dialog.modelTree.addTopLevelItem(self.itemsTwoD)
if expandTwoDs:
self.itemsTwoD.setExpanded(True)
if self.itemsJob.childCount() > 0:
self.dialog.modelTree.addTopLevelItem(self.itemsJob)
if expandJobs:
self.itemsJob.setExpanded(True)
self.dialog.modelGroup.show()