示例#1
0
    def __init__(self, doc):
        mw = QtGui.qApp.activeWindow()
        cw = mw.centralWidget() # This is a qmdiarea widget
        self.doc = doc

        # Get active document or create a new one
        # Important because when setting the default data in WizardShaftTable() the
        # updateSketch() slot will be activated and it relies on finding a valid document
        if self.doc == None:
            self.Gui.activateWorkbench("PartDesignWorkbench")
            self.doc = self.App.newDocument()
            # Grab the newly created feature window
            featureWindow = cw.subWindowList()[-1]
        else:
            featureWindow = cw.activeSubWindow()
        
        # Buttons for diagram display
        buttonLayout = QtGui.QGridLayout() 
        bnames = [["All [x]", "All [y]", "All [z]" ], 
                           ["N [x]", "Q [y]", "Q [z]"], 
                           ["Mt [x]",  "Mb [z]", "Mb [y]"], 
                           ["",  "w [y]",  "w [z]"], 
                           ["sigma [x]", "sigma [y]", "sigma [z]"], 
                           ["tau [x]",  "sigmab [z]", "sigmab [y]"]]
        slots = [[self.slotAllx,  self.slotAlly,  self.slotAllz], 
                      [self.slotFx,  self.slotQy,  self.slotQz], 
                      [self.slotMx,  self.slotMz,  self.slotMy], 
                      [self.slotNone,  self.slotWy, self.slotWz], 
                      [self.slotSigmax,  self.slotSigmay,  self.slotSigmaz], 
                      [self.slotTaut,  self.slotSigmabz,  self.slotSigmaby]]
        self.buttons = [[None,  None,  None],  [None,  None,  None],  [None,  None,  None],  [None,  None,  None],  [None,  None,  None],  [None,  None,  None]]

        for col in range(3):
            for row in range(6):
                button = QtGui.QPushButton(bnames[row][col])
                buttonLayout.addWidget(button,  row,  col)
                self.buttons[row][col] = button
                button.clicked.connect(slots[row][col])
                
        # Create Shaft object
        self.shaft = Shaft(self)
        # Create table widget
        self.form = QtGui.QWidget()
        self.table = WizardShaftTable(self, self.shaft)        
        
        # The top layout will contain the Shaft Wizard layout plus the elements of the FEM constraints dialog
        layout = QtGui.QVBoxLayout()
        layout.setObjectName("ShaftWizard") # Do not change or translate: Required to detect whether Shaft Wizard is running in FemGui::ViewProviderFemConstraintXXX
        sublayout = QtGui.QVBoxLayout()
        sublayout.setObjectName("ShaftWizardLayout") # Do not change or translate        
        sublayout.addWidget(self.table.widget)
        sublayout.addLayout(buttonLayout)
        layout.addLayout(sublayout)
        self.form.setLayout(layout)
        
        # Switch to feature window
        mdi=QtGui.qApp.activeWindow().findChild(QtGui.QMdiArea)
        cw.setActiveSubWindow(featureWindow)
示例#2
0
    def __init__(self, doc):
        mw = QtGui.qApp.activeWindow()
        cw = mw.centralWidget()  # This is a qmdiarea widget
        self.doc = doc

        # Get active document or create a new one
        # Important because when setting the default data in WizardShaftTable() the
        # updateSketch() slot will be activated and it relies on finding a valid document
        if self.doc == None:
            self.Gui.activateWorkbench("PartDesignWorkbench")
            self.doc = self.App.newDocument()
            # Grab the newly created feature window
            featureWindow = cw.subWindowList()[-1]
        else:
            featureWindow = cw.activeSubWindow()

        # Create Shaft object
        self.shaft = Shaft(self.doc)

        # Assign a table widget to the dock window
        self.table = WizardShaftTable(self, self.shaft)
        self.form = self.table.widget
        self.form.setWindowTitle("Shaft wizard")