当前位置: 首页>>代码示例>>Python>>正文


Python PathUtil.getPublicObject方法代码示例

本文整理汇总了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
开发者ID:peterl94,项目名称:FreeCAD_sf_master,代码行数:18,代码来源:PathOp.py

示例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
开发者ID:lanigb,项目名称:FreeCAD,代码行数:19,代码来源:PathOp.py

示例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))
开发者ID:frankhardy,项目名称:FreeCAD,代码行数:26,代码来源:PathOp.py

示例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
开发者ID:pgilfernandez,项目名称:FreeCAD,代码行数:4,代码来源:PathJobGui.py

示例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()
开发者ID:DevJohan,项目名称:FreeCAD_sf_master,代码行数:68,代码来源:PathJobDlg.py


注:本文中的PathScripts.PathUtil.getPublicObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。