Beispiel #1
0
 def __init__(self, preferenceHandler):
     Preferences.__init__(self, preferenceHandler)
     self.ui = Ui_sketcherForm()
     self.ui.setupUi(self.widget)
     self.name = "Sketcher"
     self.preferenceHandler.addPreferencePage(self.name, self.widget)
     self.fPointIcon = QtGui.QPixmap(40, 20)
     self.dConstraintIcon = QtGui.QPixmap(40, 20)
     self.angleIcon = QtGui.QPixmap(40, 20)
     self.selectionIcon = QtGui.QPixmap(40, 20)
     self.distanceIcon = QtGui.QPixmap(40, 20)
     self.backgroundIcon = QtGui.QPixmap(40, 20)
     self.pointIcon = QtGui.QPixmap(40, 20)
     self.setIcons()
     self.setValues()
     self.createTriggers()
Beispiel #2
0
	def __init__(self, preferenceHandler):	
		Preferences.__init__(self, preferenceHandler)
		self.ui = Ui_sketcherForm()
		self.ui.setupUi(self.widget)
		self.name = "Sketcher" 
		self.preferenceHandler.addPreferencePage(self.name, self.widget)
		self.fPointIcon = QtGui.QPixmap(40,20)
		self.dConstraintIcon = QtGui.QPixmap(40,20)
		self.angleIcon = QtGui.QPixmap(40,20)
		self.selectionIcon = QtGui.QPixmap(40,20)
		self.distanceIcon = QtGui.QPixmap(40,20)
		self.backgroundIcon = QtGui.QPixmap(40,20)
		self.pointIcon = QtGui.QPixmap(40,20)
		self.setIcons()
		self.setValues()
		self.createTriggers()
Beispiel #3
0
class SketcherPreferences(Preferences):
	def __init__(self, preferenceHandler):	
		Preferences.__init__(self, preferenceHandler)
		self.ui = Ui_sketcherForm()
		self.ui.setupUi(self.widget)
		self.name = "Sketcher" 
		self.preferenceHandler.addPreferencePage(self.name, self.widget)
		self.fPointIcon = QtGui.QPixmap(40,20)
		self.dConstraintIcon = QtGui.QPixmap(40,20)
		self.angleIcon = QtGui.QPixmap(40,20)
		self.selectionIcon = QtGui.QPixmap(40,20)
		self.distanceIcon = QtGui.QPixmap(40,20)
		self.backgroundIcon = QtGui.QPixmap(40,20)
		self.pointIcon = QtGui.QPixmap(40,20)
		self.setIcons()
		self.setValues()
		self.createTriggers()
	
	def setIcons(self):
		self.fPointIcon.fill(self.settings.sketcherData.fPointColor)
		self.ui.fPointClrButton.setIcon(QtGui.QIcon(self.fPointIcon))
		self.dConstraintIcon.fill(self.settings.sketcherData.distanceColor)
		self.ui.dConstraintClrButton.setIcon(QtGui.QIcon(self.dConstraintIcon))
		self.angleIcon.fill(self.settings.sketcherData.angleColor)
		self.ui.angleClrButton.setIcon(QtGui.QIcon(self.angleIcon))
		self.selectionIcon.fill(self.settings.sketcherData.selectColor)
		self.ui.selectClrButton.setIcon(QtGui.QIcon(self.selectionIcon))
		self.distanceIcon.fill(self.settings.sketcherData.lineColor)
		self.ui.distanceClrButton.setIcon(QtGui.QIcon(self.distanceIcon))
		self.backgroundIcon.fill(self.settings.sketcherData.bgColor)
		self.ui.bgClrButton.setIcon(QtGui.QIcon(self.backgroundIcon))
		self.pointIcon.fill(self.settings.sketcherData.pointColor)
		self.ui.pointClrButton.setIcon(QtGui.QIcon(self.pointIcon))
	
	def setValues(self):
		self.ui.pointSizeSpin.setValue(self.settings.sketcherData.pointRadius)
		self.ui.fPointSizeSpin.setValue(self.settings.sketcherData.fPointRadius)
		self.ui.lineSizeSpin.setValue(self.settings.sketcherData.lineRadius)
		self.ui.distanceSizeSpin.setValue(self.settings.sketcherData.distanceRadius)
		self.ui.showgridCheckBox.setChecked(self.settings.sketcherData.showGrid)
		self.ui.gridWidthSpin.setValue(self.settings.sketcherData.gridWidth)
		self.ui.gridHeightSpin.setValue(self.settings.sketcherData.gridHeight)
		
	def createTriggers(self):
		QtCore.QObject.connect(self.ui.showgridCheckBox, QtCore.SIGNAL("stateChanged(int)"), self.showGrid)
		QtCore.QObject.connect(self.ui.pointSizeSpin, QtCore.SIGNAL("valueChanged(int)"), self.updatePointSize)
		QtCore.QObject.connect(self.ui.fPointSizeSpin, QtCore.SIGNAL("valueChanged(int)"), self.updateFPointSize)
		QtCore.QObject.connect(self.ui.lineSizeSpin, QtCore.SIGNAL("valueChanged(int)"), self.updateLineSize)
		QtCore.QObject.connect(self.ui.distanceSizeSpin, QtCore.SIGNAL("valueChanged(int)"), self.updateDistanceSize)
		QtCore.QObject.connect(self.ui.gridWidthSpin, QtCore.SIGNAL("valueChanged(int)"), self.updateGridWidth)
		QtCore.QObject.connect(self.ui.gridHeightSpin, QtCore.SIGNAL("valueChanged(int)"), self.updateGridHeight)
		
		QtCore.QObject.connect(self.ui.fPointClrButton,QtCore.SIGNAL("clicked()"), self.setFPointColor)
		QtCore.QObject.connect(self.ui.dConstraintClrButton,QtCore.SIGNAL("clicked()"), self.setDistanceColor)
		QtCore.QObject.connect(self.ui.angleClrButton,QtCore.SIGNAL("clicked()"), self.setAngleColor)
		QtCore.QObject.connect(self.ui.selectClrButton,QtCore.SIGNAL("clicked()"), self.setSelectionColor)
		QtCore.QObject.connect(self.ui.distanceClrButton,QtCore.SIGNAL("clicked()"), self.setLineColor)
		QtCore.QObject.connect(self.ui.bgClrButton,QtCore.SIGNAL("clicked()"), self.setBackgroundColor)
		QtCore.QObject.connect(self.ui.pointClrButton,QtCore.SIGNAL("clicked()"), self.setPointColor)
		
	def showGrid(self, state):			
		if state == QtCore.Qt.Unchecked:
			self.settings.sketcherData.showGrid = False
		else:
			self.settings.sketcherData.showGrid = True
		self.settings.sketcherData.emit(QtCore.SIGNAL("showGridChanged"), self.settings.sketcherData.showGrid)
	
	def updatePointSize(self, size):
		self.settings.sketcherData.pointRadius = size
		self.settings.sketcherData.emit(QtCore.SIGNAL("pointSizeChanged"), size)
		
	def updateFPointSize(self, size):
		self.settings.sketcherData.fPointRadius = size
		self.settings.sketcherData.emit(QtCore.SIGNAL("fPointSizeChanged"), size)
		
	def updateLineSize(self, size):
		self.settings.sketcherData.lineRadius = size
		self.settings.sketcherData.emit(QtCore.SIGNAL("lineSizeChanged"), size)
		
	def updateDistanceSize(self, size):
		self.settings.sketcherData.distanceRadius = size
		self.settings.sketcherData.emit(QtCore.SIGNAL("distanceSizeChanged"), size)
		
	def updateGridWidth(self, width):
		self.settings.sketcherData.gridWidth= width
		self.settings.sketcherData.emit(QtCore.SIGNAL("gridWidthChanged"), width)
		
	def updateGridHeight(self, height):
		self.settings.sketcherData.gridHeight = height
		self.settings.sketcherData.emit(QtCore.SIGNAL("gridHeightChanged"), height)
		
	def setPointColor(self):
		color = QtGui.QColorDialog.getColor(self.settings.sketcherData.pointColor)
		if color.isValid():
			self.settings.sketcherData.pointColor = color
			self.updateIconColor(self.pointIcon, self.ui.pointClrButton, color)
			self.settings.sketcherData.emit(QtCore.SIGNAL("pointColorChanged"), color)
			
	def setFPointColor(self):
		color = QtGui.QColorDialog.getColor(self.settings.sketcherData.fPointColor)
		if color.isValid():
			self.settings.sketcherData.fPointColor = color
			self.updateIconColor(self.fPointIcon, self.ui.fPointClrButton, color)
			self.settings.sketcherData.emit(QtCore.SIGNAL("fPointColorChanged"), color)
			
	def setLineColor(self):
		color = QtGui.QColorDialog.getColor(self.settings.sketcherData.lineColor)
		if color.isValid():
			self.settings.sketcherData.lineColor = color
			self.updateIconColor(self.distanceIcon, self.ui.distanceClrButton, color)
			self.settings.sketcherData.emit(QtCore.SIGNAL("lineColorChanged"), color)
			
	def setAngleColor(self):
		color = QtGui.QColorDialog.getColor(self.settings.sketcherData.angleColor)
		if color.isValid():
			self.settings.sketcherData.angleColor = color
			self.updateIconColor(self.angleIcon, self.ui.angleClrButton, color)
			self.settings.sketcherData.emit(QtCore.SIGNAL("angleColorChanged"), color)
			
	def setSelectionColor(self):
		color = QtGui.QColorDialog.getColor(self.settings.sketcherData.selectColor)
		if color.isValid():
			self.settings.sketcherData.selectColor = color
			self.updateIconColor(self.selectionIcon, self.ui.selectClrButton, color)
			self.settings.sketcherData.emit(QtCore.SIGNAL("selectionColorChanged"), color)
			
	def setDistanceColor(self):
		color = QtGui.QColorDialog.getColor(self.settings.sketcherData.distanceColor)
		if color.isValid():
			self.settings.sketcherData.distanceColor = color
			self.updateIconColor(self.dConstraintIcon, self.ui.dConstraintClrButton, color)
			self.settings.sketcherData.emit(QtCore.SIGNAL("distanceColorChanged"), color)
			
	def setBackgroundColor(self):
		color = QtGui.QColorDialog.getColor(self.settings.sketcherData.bgColor)
		if color.isValid():
			self.settings.sketcherData.bgColor = color
			self.updateIconColor(self.backgroundIcon, self.ui.bgClrButton, color)
			self.settings.sketcherData.emit(QtCore.SIGNAL("backgroundColorChanged"), color)
Beispiel #4
0
class SketcherPreferences(Preferences):
    def __init__(self, preferenceHandler):
        Preferences.__init__(self, preferenceHandler)
        self.ui = Ui_sketcherForm()
        self.ui.setupUi(self.widget)
        self.name = "Sketcher"
        self.preferenceHandler.addPreferencePage(self.name, self.widget)
        self.fPointIcon = QtGui.QPixmap(40, 20)
        self.dConstraintIcon = QtGui.QPixmap(40, 20)
        self.angleIcon = QtGui.QPixmap(40, 20)
        self.selectionIcon = QtGui.QPixmap(40, 20)
        self.distanceIcon = QtGui.QPixmap(40, 20)
        self.backgroundIcon = QtGui.QPixmap(40, 20)
        self.pointIcon = QtGui.QPixmap(40, 20)
        self.setIcons()
        self.setValues()
        self.createTriggers()

    def setIcons(self):
        self.fPointIcon.fill(self.settings.sketcherData.fPointColor)
        self.ui.fPointClrButton.setIcon(QtGui.QIcon(self.fPointIcon))
        self.dConstraintIcon.fill(self.settings.sketcherData.distanceColor)
        self.ui.dConstraintClrButton.setIcon(QtGui.QIcon(self.dConstraintIcon))
        self.angleIcon.fill(self.settings.sketcherData.angleColor)
        self.ui.angleClrButton.setIcon(QtGui.QIcon(self.angleIcon))
        self.selectionIcon.fill(self.settings.sketcherData.selectColor)
        self.ui.selectClrButton.setIcon(QtGui.QIcon(self.selectionIcon))
        self.distanceIcon.fill(self.settings.sketcherData.lineColor)
        self.ui.distanceClrButton.setIcon(QtGui.QIcon(self.distanceIcon))
        self.backgroundIcon.fill(self.settings.sketcherData.bgColor)
        self.ui.bgClrButton.setIcon(QtGui.QIcon(self.backgroundIcon))
        self.pointIcon.fill(self.settings.sketcherData.pointColor)
        self.ui.pointClrButton.setIcon(QtGui.QIcon(self.pointIcon))

    def setValues(self):
        self.ui.pointSizeSpin.setValue(self.settings.sketcherData.pointRadius)
        self.ui.fPointSizeSpin.setValue(
            self.settings.sketcherData.fPointRadius)
        self.ui.lineSizeSpin.setValue(self.settings.sketcherData.lineRadius)
        self.ui.distanceSizeSpin.setValue(
            self.settings.sketcherData.distanceRadius)
        self.ui.showgridCheckBox.setChecked(
            self.settings.sketcherData.showGrid)
        self.ui.gridWidthSpin.setValue(self.settings.sketcherData.gridWidth)
        self.ui.gridHeightSpin.setValue(self.settings.sketcherData.gridHeight)

    def createTriggers(self):
        # QtCore.QObject.connect(self.ui.showgridCheckBox,
        #                        QtCore.SIGNAL("stateChanged(int)"),
        #                        self.showGrid)
        self.ui.showgridCheckBox.stateChanged.connect(self.showGrid)
        # QtCore.QObject.connect(self.ui.pointSizeSpin,
        #                        QtCore.SIGNAL("valueChanged(int)"),
        #                        self.updatePointSize)
        self.ui.pointSizeSpin.valueChanged.connect(self.updatePointSize)
        # QtCore.QObject.connect(self.ui.fPointSizeSpin,
        #                        QtCore.SIGNAL("valueChanged(int)"),
        #                        self.updateFPointSize)
        self.ui.fPointSizeSpin.valueChanged.connect(self.updateFPointSize)
        # QtCore.QObject.connect(self.ui.lineSizeSpin,
        #                        QtCore.SIGNAL("valueChanged(int)"),
        #                        self.updateLineSize)
        self.ui.lineSizeSpin.valueChanged.connect(self.updateLineSize)
        # QtCore.QObject.connect(self.ui.distanceSizeSpin,
        #                        QtCore.SIGNAL("valueChanged(int)"),
        #                        self.updateDistanceSize)
        self.ui.distanceSizeSpin.valueChanged.connect(self.updateDistanceSize)
        # QtCore.QObject.connect(self.ui.gridWidthSpin,
        #                        QtCore.SIGNAL("valueChanged(int)"),
        #                        self.updateGridWidth)
        self.ui.gridWidthSpin.valueChanged.connect(self.updateGridWidth)
        # QtCore.QObject.connect(self.ui.gridHeightSpin,
        #                        QtCore.SIGNAL("valueChanged(int)"),
        #                        self.updateGridHeight)
        self.ui.gridHeightSpin.valueChanged.connect(self.updateGridHeight)

        # QtCore.QObject.connect(self.ui.fPointClrButton,
        #                        QtCore.SIGNAL("clicked()"),
        #                        self.setFPointColor)
        self.ui.fPointClrButton.clicked.connect(self.setFPointColor)
        # QtCore.QObject.connect(self.ui.dConstraintClrButton,
        #                        QtCore.SIGNAL("clicked()"),
        #                        self.setDistanceColor)
        self.ui.dConstraintClrButton.clicked.connect(self.setDistanceColor)
        # QtCore.QObject.connect(self.ui.angleClrButton,
        #                        QtCore.SIGNAL("clicked()"),
        #                        self.setAngleColor)
        self.ui.angleClrButton.clicked.connect(self.setSelectionColor)
        # QtCore.QObject.connect(self.ui.selectClrButton,
        #                        QtCore.SIGNAL("clicked()"),
        #                        self.setSelectionColor)
        self.ui.selectClrButton.clicked.connect(self.setSelectionColor)
        # QtCore.QObject.connect(self.ui.distanceClrButton,
        #                        QtCore.SIGNAL("clicked()"),
        #                        self.setLineColor)
        self.ui.distanceClrButton.clicked.connect(self.setLineColor)
        # QtCore.QObject.connect(self.ui.bgClrButton,
        #                        QtCore.SIGNAL("clicked()"),
        #                        self.setBackgroundColor)
        self.ui.bgClrButton.clicked.connect(self.setBackgroundColor)
        # QtCore.QObject.connect(self.ui.pointClrButton,
        #                        QtCore.SIGNAL("clicked()"),
        #                        self.setPointColor)
        self.ui.pointClrButton.clicked.connect(self.setPointColor)

    def showGrid(self, state):
        if state == QtCore.Qt.Unchecked:
            self.settings.sketcherData.showGrid = False
        else:
            self.settings.sketcherData.showGrid = True
        self.settings.sketcherData.emit(QtCore.SIGNAL("showGridChanged"),
                                        self.settings.sketcherData.showGrid)

    def updatePointSize(self, size):
        self.settings.sketcherData.pointRadius = size
        self.settings.sketcherData.emit(QtCore.SIGNAL("pointSizeChanged"),
                                        size)

    def updateFPointSize(self, size):
        self.settings.sketcherData.fPointRadius = size
        self.settings.sketcherData.emit(QtCore.SIGNAL("fPointSizeChanged"),
                                        size)

    def updateLineSize(self, size):
        self.settings.sketcherData.lineRadius = size
        self.settings.sketcherData.emit(QtCore.SIGNAL("lineSizeChanged"), size)

    def updateDistanceSize(self, size):
        self.settings.sketcherData.distanceRadius = size
        self.settings.sketcherData.emit(QtCore.SIGNAL("distanceSizeChanged"),
                                        size)

    def updateGridWidth(self, width):
        self.settings.sketcherData.gridWidth = width
        self.settings.sketcherData.emit(QtCore.SIGNAL("gridWidthChanged"),
                                        width)

    def updateGridHeight(self, height):
        self.settings.sketcherData.gridHeight = height
        self.settings.sketcherData.emit(QtCore.SIGNAL("gridHeightChanged"),
                                        height)

    def setPointColor(self):
        color = QtWidgets.QColorDialog.getColor(
            self.settings.sketcherData.pointColor)
        if color.isValid():
            self.settings.sketcherData.pointColor = color
            self.updateIconColor(self.pointIcon, self.ui.pointClrButton, color)
            # self.settings.sketcherData.emit(QtCore.SIGNAL("pointColorChanged"),
            #                                 color)

            self.settings.sketcherData.pointColorChanged.emit(color)

    def setFPointColor(self):
        color = QtWidgets.QColorDialog.getColor(
            self.settings.sketcherData.fPointColor)
        if color.isValid():
            self.settings.sketcherData.fPointColor = color
            self.updateIconColor(self.fPointIcon, self.ui.fPointClrButton,
                                 color)
            # self.settings.sketcherData.emit(QtCore.SIGNAL("fPointColorChanged"),
            #                                 color)
            self.settings.sketcherData.fPointColorChanged.emit(color)

    def setLineColor(self):
        color = QtWidgets.QColorDialog.getColor(
            self.settings.sketcherData.lineColor)
        if color.isValid():
            self.settings.sketcherData.lineColor = color
            self.updateIconColor(self.distanceIcon, self.ui.distanceClrButton,
                                 color)
            # self.settings.sketcherData.emit(QtCore.SIGNAL("lineColorChanged"),
            #                                 color)
            self.settings.sketcherData.lineColorChanged.emit(color)

    def setAngleColor(self):
        color = QtWidgets.QColorDialog.getColor(
            self.settings.sketcherData.angleColor)
        if color.isValid():
            self.settings.sketcherData.angleColor = color
            self.updateIconColor(self.angleIcon, self.ui.angleClrButton, color)
            # self.settings.sketcherData.emit(QtCore.SIGNAL("angleColorChanged"),
            #                                 color)
            self.settings.sketcherData.angleColorChanged.emit(color)

    def setSelectionColor(self):
        color = QtWidgets.QColorDialog.getColor(
            self.settings.sketcherData.selectColor)
        if color.isValid():
            self.settings.sketcherData.selectColor = color
            self.updateIconColor(self.selectionIcon, self.ui.selectClrButton,
                                 color)
            # self.settings.sketcherData.emit(
            #     QtCore.SIGNAL("selectionColorChanged"), color)
            self.settings.sketcherData.selectionColorChanged.emit(color)

    def setDistanceColor(self):
        color = QtWidgets.QColorDialog.getColor(
            self.settings.sketcherData.distanceColor)
        if color.isValid():
            self.settings.sketcherData.distanceColor = color
            self.updateIconColor(self.dConstraintIcon,
                                 self.ui.dConstraintClrButton, color)
            # self.settings.sketcherData.emit(
            #     QtCore.SIGNAL("distanceColorChanged"), color)
            self.settings.sketcherData.distanceColorChanged.emit(color)

    def setBackgroundColor(self):
        color = QtWidgets.QColorDialog.getColor(
            self.settings.sketcherData.bgColor)
        if color.isValid():
            self.settings.sketcherData.bgColor = color
            self.updateIconColor(self.backgroundIcon, self.ui.bgClrButton,
                                 color)
            # self.settings.sketcherData.emit(
            #     QtCore.SIGNAL("backgroundColorChanged"), color)
            self.settings.sketcherData.backgroundColorChanged.emit(color)