2015-05-28 13:32:09 +12:00
|
|
|
#!/usr/bin/env python
|
|
|
|
#--!-- coding: utf8 --!--
|
|
|
|
|
2015-06-08 08:06:57 +12:00
|
|
|
|
|
|
|
|
2015-05-28 13:32:09 +12:00
|
|
|
|
2015-06-04 04:40:19 +12:00
|
|
|
from qt import *
|
2015-05-28 13:32:09 +12:00
|
|
|
|
|
|
|
from ui.sldImportance_ui import *
|
|
|
|
|
|
|
|
class sldImportance(QWidget, Ui_sldImportance):
|
2015-05-31 16:03:07 +12:00
|
|
|
|
|
|
|
importanceChanged = pyqtSignal(str)
|
|
|
|
|
2015-05-28 13:32:09 +12:00
|
|
|
def __init__(self, parent=None):
|
|
|
|
QWidget.__init__(self)
|
|
|
|
self.setupUi(self)
|
|
|
|
|
2015-05-31 16:03:07 +12:00
|
|
|
self.lastValue = -1
|
2015-05-28 13:32:09 +12:00
|
|
|
self.sld.valueChanged.connect(self.changed)
|
|
|
|
self.setValue(0)
|
|
|
|
|
2015-05-31 16:03:07 +12:00
|
|
|
def getImportance(self):
|
|
|
|
return str(self.sld.value())
|
|
|
|
|
2015-05-28 13:32:09 +12:00
|
|
|
def changed(self, v):
|
|
|
|
val = [
|
2015-06-08 22:01:45 +12:00
|
|
|
self.tr("Minor"),
|
|
|
|
self.tr("Secondary"),
|
|
|
|
self.tr("Main"),
|
2015-05-28 13:32:09 +12:00
|
|
|
]
|
|
|
|
self.lbl.setText(val[v])
|
|
|
|
|
2015-05-31 16:03:07 +12:00
|
|
|
self.importanceChanged.emit(str(v))
|
|
|
|
|
2015-05-28 13:32:09 +12:00
|
|
|
def setValue(self, v):
|
2015-06-08 08:06:57 +12:00
|
|
|
if v != self.lastValue:
|
2015-06-01 08:41:32 +12:00
|
|
|
self.sld.setValue(int(v) if v else 0)
|
|
|
|
self.changed(int(v) if v else 0)
|
2015-05-31 16:03:07 +12:00
|
|
|
self.lastValue = v
|
|
|
|
|
|
|
|
def setProperty():
|
|
|
|
pass
|
|
|
|
|
|
|
|
importance = pyqtProperty(str, fget=getImportance, fset=setValue, notify=importanceChanged)
|