コード例 #1
0
ファイル: PathSetupSheetGui.py プロジェクト: ycho98/FreeCAD
        self.globalEditor.getFields()
        self.opsEditor.getFields()

    def updateUI(self):
        self.globalEditor.updateUI()
        self.opsEditor.updateUI()

    def updateModel(self):
        self.globalEditor.updateModel(False)
        self.opsEditor.updateModel(False)
        FreeCAD.ActiveDocument.recompute()

    def setFields(self):
        self.globalEditor.setFields()
        self.opsEditor.setFields()

    def setupUi(self):
        self.globalEditor.setupUi()
        self.opsEditor.setupUi()


def Create(name='SetupSheet'):
    '''Create(name = 'SetupSheet') ... creates a new setup sheet'''
    FreeCAD.ActiveDocument.openTransaction(translate("Path_Job", "Create Job"))
    ssheet = PathSetupSheet.Create(name)
    PathIconViewProvider.Attach(ssheet, name)
    return ssheet


PathIconViewProvider.RegisterViewProvider('SetupSheet', ViewProvider)
コード例 #2
0
        # then remove them in reverse order so the indexes of the remaining rows
        # to delete are still valid
        for row in reversed(sorted(rows)):
            self.obj.removeProperty(self.model.item(row).data(QtCore.Qt.EditRole))
            self.model.removeRow(row)


def Create(name = 'PropertyBag'):
    '''Create(name = 'PropertyBag') ... creates a new setup sheet'''
    FreeCAD.ActiveDocument.openTransaction(translate("PathPropertyBag", "Create PropertyBag"))
    pcont = PathPropertyBag.Create(name)
    PathIconViewProvider.Attach(pcont.ViewObject, name)
    return pcont

PathIconViewProvider.RegisterViewProvider('PropertyBag', ViewProvider)

class PropertyBagCreateCommand(object):
    '''Command to create a property container object'''

    def __init__(self):
        pass

    def GetResources(self):
        return {'MenuText': translate('PathPropertyBag', 'PropertyBag'),
                'ToolTip': translate('PathPropertyBag', 'Creates an object which can be used to store reference properties.')}

    def IsActive(self):
        return not FreeCAD.ActiveDocument is None

    def Activated(self):
コード例 #3
0
        # to delete are still valid
        for row in reversed(sorted(rows)):
            self.obj.removeProperty(
                self.model.item(row).data(QtCore.Qt.EditRole))
            self.model.removeRow(row)


def Create(name="PropertyBag"):
    """Create(name = 'PropertyBag') ... creates a new setup sheet"""
    FreeCAD.ActiveDocument.openTransaction("Create PropertyBag")
    pcont = PathPropertyBag.Create(name)
    PathIconViewProvider.Attach(pcont.ViewObject, name)
    return pcont


PathIconViewProvider.RegisterViewProvider("PropertyBag", ViewProvider)


class PropertyBagCreateCommand(object):
    """Command to create a property container object"""
    def __init__(self):
        pass

    def GetResources(self):
        return {
            "MenuText":
            translate("Path_PropertyBag", "PropertyBag"),
            "ToolTip":
            translate(
                "Path_PropertyBag",
                "Creates an object which can be used to store reference properties.",
コード例 #4
0
ファイル: PathToolBitGui.py プロジェクト: serpahimor/FreeCAD
        parent = QtGui.QApplication.activeWindow()
    foo = QtGui.QFileDialog.getOpenFileName(parent, 'Tool', PathPreferences.lastPathToolBit(), '*.fctb')
    if foo and foo[0]:
        PathPreferences.setLastPathToolBit(os.path.dirname(foo[0]))
        return foo[0]
    return None

def GetToolFiles(parent = None):
    if parent is None:
        parent = QtGui.QApplication.activeWindow()
    foo = QtGui.QFileDialog.getOpenFileNames(parent, 'Tool', PathPreferences.lastPathToolBit(), '*.fctb')
    if foo and foo[0]:
        PathPreferences.setLastPathToolBit(os.path.dirname(foo[0][0]))
        return foo[0]
    return []


def LoadTool(parent = None):
    '''LoadTool(parent=None) ... Open a file dialog to load a tool from a file.'''
    foo = GetToolFile(parent)
    return PathToolBit.Factory.CreateFrom(foo) if foo else foo

def LoadTools(parent = None):
    '''LoadTool(parent=None) ... Open a file dialog to load a tool from a file.'''
    return [PathToolBit.Factory.CreateFrom(foo) for foo in GetToolFiles(parent)]

# Set the factory so all tools are created with UI
PathToolBit.Factory = ToolBitGuiFactory()

PathIconViewProvider.RegisterViewProvider('ToolBit', ViewProvider)
コード例 #5
0
    if fname and fname[0]:
        if fname != location:
            newloc = os.path.dirname(fname[0])
            PathPreferences.setLastPathToolShape(newloc)
        return fname[0]
    else:
        return None


def LoadTool(parent=None):
    """
    LoadTool(parent=None) ... Open a file dialog to load a tool from a file.
    """
    foo = GetToolFile(parent)
    return PathToolBit.Factory.CreateFrom(foo) if foo else foo


def LoadTools(parent=None):
    """
    LoadTool(parent=None) ... Open a file dialog to load a tool from a file.
    """
    return [
        PathToolBit.Factory.CreateFrom(foo) for foo in GetToolFiles(parent)
    ]


# Set the factory so all tools are created with UI
PathToolBit.Factory = ToolBitGuiFactory()

PathIconViewProvider.RegisterViewProvider("ToolBit", ViewProvider)
コード例 #6
0
        self.globalEditor.getFields()
        self.opsEditor.getFields()

    def updateUI(self):
        self.globalEditor.updateUI()
        self.opsEditor.updateUI()

    def updateModel(self):
        self.globalEditor.updateModel(False)
        self.opsEditor.updateModel(False)
        FreeCAD.ActiveDocument.recompute()

    def setFields(self):
        self.globalEditor.setFields()
        self.opsEditor.setFields()

    def setupUi(self):
        self.globalEditor.setupUi()
        self.opsEditor.setupUi()


def Create(name="SetupSheet"):
    """Create(name='SetupSheet') ... creates a new setup sheet"""
    FreeCAD.ActiveDocument.openTransaction("Create Job")
    ssheet = PathSetupSheet.Create(name)
    PathIconViewProvider.Attach(ssheet, name)
    return ssheet


PathIconViewProvider.RegisterViewProvider("SetupSheet", ViewProvider)