Exemplo n.º 1
0
	def __init__(self, obj = None, parent= None):
		QWidget.__init__(self, parent)

		self.Settings = obj.Settings
		self.obj = obj

		self.Settings.beginGroup("Size")
		self.marginVar = self.Settings.value('Margin', 3).toString()
		self.thicknessVar = self.Settings.value('Thickness', 5).toString()
		self.handlerThicknessVar = self.Settings.value('HThickness', 5).toString()
		self.handlerLedgeVar = self.Settings.value('HLedge', 3).toString()
		self.Settings.endGroup()

		self.testSliders = TestSliders(obj, self)
		self.VBLayout = QGridLayout()
		
		self.marginBox = QSpinBox()
		self.marginBox.setToolTip("Margin around slider")
		self.marginBox.setMinimum(3)
		self.marginBox.setMaximum(400)
		self.marginBox.setSingleStep(1)
		self.VBLayout.addWidget(self.marginBox, 0, 0)
		
		self.thicknessBox = QSpinBox()
		self.thicknessBox.setToolTip("Thickness of slider")
		self.thicknessBox.setMinimum(5)
		self.thicknessBox.setMaximum(400)
		self.thicknessBox.setSingleStep(1)
		self.VBLayout.addWidget(self.thicknessBox, 0, 1)
		
		self.handlerThicknessBox = QSpinBox()
		self.handlerThicknessBox.setToolTip("Thickness of handler")
		self.handlerThicknessBox.setMinimum(5)
		self.handlerThicknessBox.setMaximum(100)
		self.handlerThicknessBox.setSingleStep(1)
		self.VBLayout.addWidget(self.handlerThicknessBox, 1, 0)
		
		self.handlerLedgeBox = QSpinBox()
		self.handlerLedgeBox.setToolTip("Ledge of handler")
		self.handlerLedgeBox.setMinimum(3)
		self.handlerLedgeBox.setMaximum(100)
		self.handlerLedgeBox.setSingleStep(1)
		self.VBLayout.addWidget(self.handlerLedgeBox, 1, 1)

		self.VBLayout.addWidget(self.testSliders, 2, 0, 3, 2, Qt.AlignCenter)

		self.setLayout(self.VBLayout)
		self.restoreValues()
		self.marginBox.valueChanged[int].connect(self.marginSet)
		self.thicknessBox.valueChanged[int].connect(self.thicknessSet)
		self.handlerThicknessBox.valueChanged[int].connect(self.handlerThicknessSet)
		self.handlerLedgeBox.valueChanged[int].connect(self.handlerLedgeSet)
Exemplo n.º 2
0
	def __init__(self, obj = None, parent= None):
		QWidget.__init__(self, parent)

		self.Settings = obj.Settings
		self.obj = obj
		if not parent : return

		self.colourIcon = QIcon().fromTheme('color')

		self.testSliders = TestSliders(obj, self)

		self.layout = QGridLayout()

		self.fontColourLabel = QLabel('fontColour :')
		self.layout.addWidget(self.fontColourLabel, 0, 0)
		self.fontColourButton = QPushButton(self.colourIcon, '')
		self.fontColourButton.setMaximumWidth(30)
		self.fontColourButton.setToolTip('Slider Shield Font Color')
		self.connect(self.fontColourButton, SIGNAL('clicked()'), self.fontColour)
		self.layout.addWidget(self.fontColourButton, 0, 1)

		self.sliderColour1Label = QLabel('sliderColour1 :')
		self.layout.addWidget(self.sliderColour1Label, 1, 0)
		self.sliderColour1Button = QPushButton(self.colourIcon, '')
		self.sliderColour1Button.setMaximumWidth(30)
		self.sliderColour1Button.setToolTip('Background Slider Color')
		self.connect(self.sliderColour1Button, SIGNAL('clicked()'), self.sliderColour1)
		self.layout.addWidget(self.sliderColour1Button, 1, 1)

		self.sliderColour2Label = QLabel('sliderColour2 :')
		self.layout.addWidget(self.sliderColour2Label, 2, 0)
		self.sliderColour2Button = QPushButton(self.colourIcon, '')
		self.sliderColour2Button.setMaximumWidth(30)
		self.sliderColour2Button.setToolTip('Slider Color')
		self.connect(self.sliderColour2Button, SIGNAL('clicked()'), self.sliderColour2)
		self.layout.addWidget(self.sliderColour2Button, 2, 1)

		self.handlerColourLabel = QLabel('handlerColour :')
		self.layout.addWidget(self.handlerColourLabel, 3, 0)
		self.handlerColourButton = QPushButton(self.colourIcon, '')
		self.handlerColourButton.setMaximumWidth(30)
		self.handlerColourButton.setToolTip('handler Color')
		self.connect(self.handlerColourButton, SIGNAL('clicked()'), self.handlerColour)
		self.layout.addWidget(self.handlerColourButton, 3, 1)

		self.layout.addWidget(self.testSliders, 4, 0, 6, 1)

		self.setLayout(self.layout)
		self.restoreValues()
Exemplo n.º 3
0
class SizeWidget(QWidget):
	def __init__(self, obj = None, parent= None):
		QWidget.__init__(self, parent)

		self.Settings = obj.Settings
		self.obj = obj

		self.Settings.beginGroup("Size")
		self.marginVar = self.Settings.value('Margin', 3).toString()
		self.thicknessVar = self.Settings.value('Thickness', 5).toString()
		self.handlerThicknessVar = self.Settings.value('HThickness', 5).toString()
		self.handlerLedgeVar = self.Settings.value('HLedge', 3).toString()
		self.Settings.endGroup()

		self.testSliders = TestSliders(obj, self)
		self.VBLayout = QGridLayout()
		
		self.marginBox = QSpinBox()
		self.marginBox.setToolTip("Margin around slider")
		self.marginBox.setMinimum(3)
		self.marginBox.setMaximum(400)
		self.marginBox.setSingleStep(1)
		self.VBLayout.addWidget(self.marginBox, 0, 0)
		
		self.thicknessBox = QSpinBox()
		self.thicknessBox.setToolTip("Thickness of slider")
		self.thicknessBox.setMinimum(5)
		self.thicknessBox.setMaximum(400)
		self.thicknessBox.setSingleStep(1)
		self.VBLayout.addWidget(self.thicknessBox, 0, 1)
		
		self.handlerThicknessBox = QSpinBox()
		self.handlerThicknessBox.setToolTip("Thickness of handler")
		self.handlerThicknessBox.setMinimum(5)
		self.handlerThicknessBox.setMaximum(100)
		self.handlerThicknessBox.setSingleStep(1)
		self.VBLayout.addWidget(self.handlerThicknessBox, 1, 0)
		
		self.handlerLedgeBox = QSpinBox()
		self.handlerLedgeBox.setToolTip("Ledge of handler")
		self.handlerLedgeBox.setMinimum(3)
		self.handlerLedgeBox.setMaximum(100)
		self.handlerLedgeBox.setSingleStep(1)
		self.VBLayout.addWidget(self.handlerLedgeBox, 1, 1)

		self.VBLayout.addWidget(self.testSliders, 2, 0, 3, 2, Qt.AlignCenter)

		self.setLayout(self.VBLayout)
		self.restoreValues()
		self.marginBox.valueChanged[int].connect(self.marginSet)
		self.thicknessBox.valueChanged[int].connect(self.thicknessSet)
		self.handlerThicknessBox.valueChanged[int].connect(self.handlerThicknessSet)
		self.handlerLedgeBox.valueChanged[int].connect(self.handlerLedgeSet)

	def restoreValues(self):
		self.Settings.beginGroup("Size")
		self.marginVar = self.Settings.value('Margin', 3).toString()
		self.thicknessVar = self.Settings.value('Thickness', 5).toString()
		self.handlerThicknessVar = self.Settings.value('HThickness', 5).toString()
		self.handlerLedgeVar = self.Settings.value('HLedge', 3).toString()
		self.Settings.endGroup()
		
		self.marginBox.setValue(int(self.marginVar))
		self.thicknessBox.setValue(int(self.thicknessVar))
		self.handlerThicknessBox.setValue(int(self.handlerThicknessVar))
		self.handlerLedgeBox.setValue(int(self.handlerLedgeVar))

	def marginSet(self, value = 0):
		self.marginVar = str(value)
		self._updateStyle()
	def thicknessSet(self, value = 0):
		self.thicknessVar = str(value)
		self._updateStyle()
	def handlerThicknessSet(self, value = 0):
		self.handlerThicknessVar = str(value)
		self._updateStyle()
	def handlerLedgeSet(self, value = 0):
		self.handlerLedgeVar = str(value)
		self._updateStyle()

	def _updateStyle(self):
		self.testSliders.setSlidersStyleSheet()
		self.obj.colorSelect.testSliders.setSlidersStyleSheet()

	def setSlidersSize(self, get_Style = None):
		return self.testSliders.setSlidersSize(\
			self.marginVar, self.thicknessVar, \
			self.handlerThicknessVar, \
			self.handlerLedgeVar, get_Style)

	def refreshInterfaceSettings(self):
		self.Settings.beginGroup("Size")
		self.Settings.setValue('Margin', self.marginVar)
		self.Settings.setValue('Thickness', self.thicknessVar)
		self.Settings.setValue('HThickness', self.handlerThicknessVar)
		self.Settings.setValue('HLedge', self.handlerLedgeVar)
		self.Settings.endGroup()
		self.Settings.sync()
Exemplo n.º 4
0
class ColorWidget(QWidget):
	def __init__(self, obj = None, parent= None):
		QWidget.__init__(self, parent)

		self.Settings = obj.Settings
		self.obj = obj
		if not parent : return

		self.colourIcon = QIcon().fromTheme('color')

		self.testSliders = TestSliders(obj, self)

		self.layout = QGridLayout()

		self.fontColourLabel = QLabel('fontColour :')
		self.layout.addWidget(self.fontColourLabel, 0, 0)
		self.fontColourButton = QPushButton(self.colourIcon, '')
		self.fontColourButton.setMaximumWidth(30)
		self.fontColourButton.setToolTip('Slider Shield Font Color')
		self.connect(self.fontColourButton, SIGNAL('clicked()'), self.fontColour)
		self.layout.addWidget(self.fontColourButton, 0, 1)

		self.sliderColour1Label = QLabel('sliderColour1 :')
		self.layout.addWidget(self.sliderColour1Label, 1, 0)
		self.sliderColour1Button = QPushButton(self.colourIcon, '')
		self.sliderColour1Button.setMaximumWidth(30)
		self.sliderColour1Button.setToolTip('Background Slider Color')
		self.connect(self.sliderColour1Button, SIGNAL('clicked()'), self.sliderColour1)
		self.layout.addWidget(self.sliderColour1Button, 1, 1)

		self.sliderColour2Label = QLabel('sliderColour2 :')
		self.layout.addWidget(self.sliderColour2Label, 2, 0)
		self.sliderColour2Button = QPushButton(self.colourIcon, '')
		self.sliderColour2Button.setMaximumWidth(30)
		self.sliderColour2Button.setToolTip('Slider Color')
		self.connect(self.sliderColour2Button, SIGNAL('clicked()'), self.sliderColour2)
		self.layout.addWidget(self.sliderColour2Button, 2, 1)

		self.handlerColourLabel = QLabel('handlerColour :')
		self.layout.addWidget(self.handlerColourLabel, 3, 0)
		self.handlerColourButton = QPushButton(self.colourIcon, '')
		self.handlerColourButton.setMaximumWidth(30)
		self.handlerColourButton.setToolTip('handler Color')
		self.connect(self.handlerColourButton, SIGNAL('clicked()'), self.handlerColour)
		self.layout.addWidget(self.handlerColourButton, 3, 1)

		self.layout.addWidget(self.testSliders, 4, 0, 6, 1)

		self.setLayout(self.layout)
		self.restoreValues()

	def initValue(self, key_, default = '0'):
		if self.Settings.contains(key_) :
			#print key_, Settings.value(key_).toString()
			return self.Settings.value(key_).toString()
		else :
			if default == '0' :
				default = self.getSystemColor('int')
			self.Settings.setValue(key_, QVariant(default))
			#print key_, Settings.value(key_).toString()
			return default

	def restoreValues(self):
		self.fontColourVar = self.initValue('fontColour')
		self.sliderColour1Var = self.initValue('sliderColour1', 1355022335)
		self.sliderColour2Var = self.initValue('sliderColour2', 1355022335)
		self.handlerColourVar = self.initValue('handlerColour', 1355022335)
		
		self.fontColourLabel.setStyleSheet(self.getRGBaStyle((QString(self.fontColourVar).toUInt()[0], True)))
		self.sliderColour1Label.setStyleSheet(self.getRGBaStyle((QString(self.sliderColour1Var).toUInt()[0], True)))
		self.sliderColour2Label.setStyleSheet(self.getRGBaStyle((QString(self.sliderColour2Var).toUInt()[0], True)))
		self.handlerColourLabel.setStyleSheet(self.getRGBaStyle((QString(self.handlerColourVar).toUInt()[0], True)))

	def setSlidersColor(self, get_Style = None):
		sliderColour1 = self.getRGBaStyle((QString(self.sliderColour1Var).toUInt()[0], True), 'slider')
		sliderColour2 = self.getRGBaStyle((QString(self.sliderColour2Var).toUInt()[0], True), 'slider')
		handlerColour = self.getRGBaStyle((QString(self.handlerColourVar).toUInt()[0], True), 'slider')
		
		return self.testSliders.setSlidersColor(sliderColour1, sliderColour2, handlerColour, get_Style)


	def getSystemColor(self, key_ = ''):
		currentBrush = QPalette().buttonText()
		colour = currentBrush.color()
		if key_ == 'int' :
			# print colour.rgba()
			return colour.rgba()
		else :
			return str(colour.getRgb())

	def getRGBaStyle(self, (colour, yes), str_ = 'label'):