コード例 #1
0
ファイル: a2p_constraintDialog.py プロジェクト: luzpaz/A2plus
    def onTimer(self):
        if a2plib.getConstraintEditorRef(): # is not None
            # the editor box is active, do not show self
            self.hide()
        else:
            if not self.isVisible():
                self.show()
                self.resize(200,250)
            # calculate window center position and save it
            # self.rect().center() does not work here somehow
            frame = QtGui.QDockWidget.frameGeometry(self)
            x = frame.x()
            y = frame.y()

            global CONSTRAINT_DIALOG_STORED_POSITION
            CONSTRAINT_DIALOG_STORED_POSITION = QtCore.QPoint(x,y)

        self.timer.start(100)
コード例 #2
0
ファイル: a2p_constraintDialog.py プロジェクト: luzpaz/A2plus
    def parseSelections(self):
        #constraint editor command is active, do not allow defining constraints
        if a2plib.getConstraintEditorRef():
            for btn in self.constraintButtons:
                btn.setEnabled(False)
            return

        selection = FreeCADGui.Selection.getSelectionEx()
        if len(selection) != 2:
            for btn in self.constraintButtons:
                btn.setEnabled(False)
        elif self.activeConstraint is not None:
            for btn in self.constraintButtons:
                btn.setEnabled(False)
        else:
            if a2p_constraints.PointIdentityConstraint.isValidSelection(selection):
                self.pointIdentityButton.setEnabled(True)
            if a2p_constraints.SphericalConstraint.isValidSelection(selection):
                self.sphericalConstraintButton.setEnabled(True)
            if a2p_constraints.PointOnLineConstraint.isValidSelection(selection):
                self.pointOnLineButton.setEnabled(True)
            if a2p_constraints.PointOnPlaneConstraint.isValidSelection(selection):
                self.pointOnPlaneButton.setEnabled(True)
            if a2p_constraints.AxisParallelConstraint.isValidSelection(selection):
                self.axisParallelButton.setEnabled(True)
            if a2p_constraints.AxialConstraint.isValidSelection(selection):
                self.axialButton.setEnabled(True)
            if a2p_constraints.AxisPlaneParallelConstraint.isValidSelection(selection):
                self.axisPlaneParallelButton.setEnabled(True)
            if a2p_constraints.AxisPlaneAngleConstraint.isValidSelection(selection):
                self.axisPlaneAngleButton.setEnabled(True)
            if a2p_constraints.AxisPlaneNormalConstraint.isValidSelection(selection):
                self.axisPlaneNormalButton.setEnabled(True)
            if a2p_constraints.CircularEdgeConstraint.isValidSelection(selection):
                self.circularEdgeButton.setEnabled(True)
            if a2p_constraints.PlanesParallelConstraint.isValidSelection(selection):
                self.planesParallelButton.setEnabled(True)
            if a2p_constraints.AngledPlanesConstraint.isValidSelection(selection):
                self.angledPlanesButton.setEnabled(True)
            if a2p_constraints.PlaneConstraint.isValidSelection(selection):
                self.planeCoincidentButton.setEnabled(True)
            if a2p_constraints.CenterOfMassConstraint.isValidSelection(selection):
                self.centerOfMassButton.setEnabled(True)
コード例 #3
0
ファイル: a2p_constraintDialog.py プロジェクト: luzpaz/A2plus
 def IsActive(self):
     if a2plib.getConstraintEditorRef(): return False
     return True