class ReportStepWidget(QWidget): reportStepTimeSelected = pyqtSignal(int) def __init__(self): QWidget.__init__(self) layout = QHBoxLayout() layout.setMargin(0) self.setLayout(layout) label = QLabel("Report step:") layout.addWidget(label) layout.addStretch() def converter(item): return "%s" % (str(item.date())) self.__items = ReportStepsModel().getList() self.__time_spinner = ListSpinBox(self.__items) self.__time_spinner.valueChanged[int].connect(self.valueSelected) self.__time_spinner.setStringConverter(converter) layout.addWidget(self.__time_spinner) def valueSelected(self, index): self.reportStepTimeSelected.emit(self.__items[index]) def getSelectedValue(self): """ @rtype: ctime """ index = self.__time_spinner.value() return self.__items[index]
def createTimeSpinner(self, min_value): def converter(item): return "%s" % (str(item.date())) spinner = ListSpinBox(self.__time_map) spinner.setEnabled(False) spinner.setMinimumWidth(75) spinner.valueChanged[int].connect(self.spinning) spinner.setStringConverter(converter) if min_value: spinner.setValue(0) return spinner
def __init__(self): QWidget.__init__(self) layout = QVBoxLayout() self.setLayout(layout) def converter(item): return "%s" % (str(item.date())) self.__items = ReportStepsModel().getList() self.__time_spinner = ListSpinBox(self.__items) self.__time_spinner.valueChanged[int].connect(self.valueSelected) self.__time_spinner.setStringConverter(converter) layout.addWidget(self.__time_spinner) self.__label = QLabel("Report Step") layout.addWidget(self.__label, 0, Qt.AlignHCenter) layout.addStretch()
def createTimeSpinner(self, select_minimum_value): def converter(item): return "%s" % (str(item.date())) spinner = ListSpinBox(self.__time_map) spinner.setEnabled(False) spinner.setMinimumWidth(75) if select_minimum_value: spinner.setValue(0) spinner.valueChanged[int].connect(self.plotScaleChanged) spinner.editingFinished.connect(self.plotScaleChanged) spinner.setStringConverter(converter) return spinner
def createTimeSpinner(self, select_minimum_value): def converter(item): return "%s" % (str(item.date())) spinner = ListSpinBox(self.__time_map) spinner.setMinimumWidth(75) if select_minimum_value: spinner.setValue(0) spinner.valueChanged[int].connect(self.plotScaleChanged) spinner.editingFinished.connect(self.plotScaleChanged) spinner.setStringConverter(converter) return spinner
class ReportStepWidget(QWidget): reportStepTimeSelected = pyqtSignal(int) def __init__(self): QWidget.__init__(self) layout = QVBoxLayout() self.setLayout(layout) def converter(item): return "%s" % (str(item.date())) self.__items = ReportStepsModel().getList() self.__time_spinner = ListSpinBox(self.__items) self.__time_spinner.valueChanged[int].connect(self.valueSelected) self.__time_spinner.setStringConverter(converter) layout.addWidget(self.__time_spinner) self.__label = QLabel("Report Step") layout.addWidget(self.__label, 0, Qt.AlignHCenter) layout.addStretch() def valueSelected(self, index): self.reportStepTimeSelected.emit(self.__items[index]) def getSelectedValue(self): """ @rtype: CTime """ index = self.__time_spinner.value() return self.__items[index] def setFontSize(self, size): font = self.__time_spinner.font() font.setPointSize(size) self.__time_spinner.setFont(font) font = self.__label.font() font.setPointSize(size) self.__label.setFont(font)