class VmUpdateInfoWidget(QWidget): class VmUpdateInfoItem(QTableWidgetItem): def __init__(self, value, vm): super(VmUpdateInfoWidget.VmUpdateInfoItem, self).__init__() self.value = 0 self.vm = vm self.set_value(value) def set_value(self, value): if value in ("outdated", "to-be-outdated"): self.value = 30 elif value == "update": self.value = 20 else: self.value = 0 def __lt__(self, other): if self.vm.qid == 0: return True elif other.vm.qid == 0: return False elif self.value == other.value: return self.vm.qid < other.vm.qid else: return self.value < other.value def __init__(self, vm, show_text=True, parent=None): super(VmUpdateInfoWidget, self).__init__(parent) layout = QHBoxLayout() self.show_text = show_text if self.show_text: self.label = QLabel("") layout.addWidget(self.label, alignment=Qt.AlignCenter) else: self.icon = QLabel("") layout.addWidget(self.icon, alignment=Qt.AlignCenter) self.setLayout(layout) self.previous_outdated_state = None self.previous_update_recommended = None self.value = None self.tableItem = VmUpdateInfoWidget.VmUpdateInfoItem(self.value, vm) def update_outdated(self, vm): if vm.type == "HVM": return if vm.is_outdated(): outdated_state = "outdated" # During TemplateVM shutdown, there's an interval of a few seconds # during which vm.template.is_running() returns false but # vm.is_outdated() does not yet return true, so the icon disappears. # This looks goofy, but we've decided not to fix it at this time # (2015-02-09). elif vm.template and vm.template.is_running(): outdated_state = "to-be-outdated" else: outdated_state = None if outdated_state != self.previous_outdated_state: self.update_status_widget(outdated_state) self.previous_outdated_state = outdated_state if not vm.is_updateable(): return if vm.qid == 0: update_recommended = self.previous_update_recommended if os.path.exists(qubes_dom0_updates_stat_file): update_recommended = True else: update_recommended = False else: update_recommended = self.previous_update_recommended stat_file_path = vm.dir_path + '/' + vm_files["updates_stat_file"] if not os.path.exists(stat_file_path): update_recommended = False else: if (not hasattr(vm, "updates_stat_file_read_time") ) or vm.updates_stat_file_read_time <= os.path.getmtime( stat_file_path): stat_file = open(stat_file_path, "r") updates = stat_file.read().strip() stat_file.close() if updates.isdigit(): updates = int(updates) else: updates = 0 if updates == 0: update_recommended = False else: update_recommended = True vm.updates_stat_file_read_time = time.time() if update_recommended and not self.previous_update_recommended: self.update_status_widget("update") elif self.previous_update_recommended and not update_recommended: self.update_status_widget(None) self.previous_update_recommended = update_recommended def update_status_widget(self, state): self.value = state self.tableItem.set_value(state) if state == "update": label_text = "<font color=\"#CCCC00\">Check updates</font>" icon_path = ":/update-recommended.png" tooltip_text = self.tr("Updates pending!") elif state == "outdated": label_text = "<font color=\"red\">VM outdated</font>" icon_path = ":/outdated.png" tooltip_text = self.tr( "The VM must be restarted for its filesystem to reflect the " "template's recent committed changes.") elif state == "to-be-outdated": label_text = "<font color=\"#800000\">TemplateVM running</font>" icon_path = ":/to-be-outdated.png" tooltip_text = self.tr( "The TemplateVM must be stopped before changes from its " "current session can be picked up by this VM.") elif state is None: label_text = "" icon_path = None tooltip_text = None if self.show_text: self.label.setText(label_text) else: self.layout().removeWidget(self.icon) self.icon.deleteLater() if icon_path is not None: self.icon = VmIconWidget(icon_path, True, 0.7) self.icon.setToolTip(tooltip_text) else: self.icon = QLabel(label_text) self.layout().addWidget(self.icon, alignment=Qt.AlignCenter)
class applyFIR2PresetsDialog(QDialog): def __init__(self, parent): QDialog.__init__(self, parent) self.prm = parent.prm self.currLocale = self.parent().prm['data']['currentLocale'] self.currLocale.setNumberOptions(self.currLocale.OmitGroupSeparator | self.currLocale.RejectGroupSeparator) vbl = QVBoxLayout() self.grid = QGridLayout() filterTypeLabel = QLabel(self.tr('Filter Type: ')) self.filterChooser = QComboBox() self.filterChooser.addItems([self.tr('lowpass'), self.tr('highpass'), self.tr('bandpass'), self.tr('bandstop')]) self.filterChooser.setCurrentIndex(0) self.grid.addWidget(self.filterChooser, 0, 1) self.filterChooser.currentIndexChanged[int].connect(self.onChangeFilterType) self.filterOrderLabel = QLabel(self.tr('Filter Order: ')) self.filterOrderWidget = QLineEdit('256') self.filterOrderWidget.setValidator(QIntValidator(self)) self.grid.addWidget(self.filterOrderLabel, 0, 2) self.grid.addWidget(self.filterOrderWidget, 0, 3) self.currFilterType = self.tr('lowpass') self.cutoffLabel = QLabel(self.tr('Cutoff: ')) self.endCutoffLabel = QLabel(self.tr('End Transition Band = Cutoff *')) self.cutoffWidget = QLineEdit('') self.cutoffWidget.setValidator(QDoubleValidator(self)) endCutoff = 1.2 self.endCutoffWidget = QLineEdit(self.currLocale.toString(endCutoff)) self.endCutoffWidget.setValidator(QDoubleValidator(self)) self.grid.addWidget(self.cutoffLabel, 2, 1) self.grid.addWidget(self.cutoffWidget, 2, 2) self.grid.addWidget(self.endCutoffLabel, 2, 3) self.grid.addWidget(self.endCutoffWidget, 2, 4) buttonBox = QDialogButtonBox(QDialogButtonBox.Ok| QDialogButtonBox.Cancel) buttonBox.accepted.connect(self.accept) buttonBox.rejected.connect(self.reject) vbl.addLayout(self.grid) vbl.addWidget(buttonBox) self.setLayout(vbl) self.setWindowTitle(self.tr("Apply Filter")) def onChangeFilterType(self): prevFilterType = self.currFilterType self.currFilterType = str(self.filterChooser.currentText()) if self.currFilterType != prevFilterType: if prevFilterType == self.tr('lowpass'): self.grid.removeWidget(self.cutoffLabel) #self.cutoffLabel.setParent(None) self.cutoffLabel.deleteLater() self.grid.removeWidget(self.endCutoffLabel) #self.endCutoffLabel.setParent(None) self.endCutoffLabel.deleteLater() self.grid.removeWidget(self.cutoffWidget) #self.cutoffWidget.setParent(None) self.cutoffWidget.deleteLater() self.grid.removeWidget(self.endCutoffWidget) #self.endCutoffWidget.setParent(None) self.endCutoffWidget.deleteLater() elif prevFilterType == self.tr('highpass'): self.grid.removeWidget(self.cutoffLabel) #self.cutoffLabel.setParent(None) self.cutoffLabel.deleteLater() self.grid.removeWidget(self.startCutoffLabel) #self.startCutoffLabel.setParent(None) self.startCutoffLabel.deleteLater() self.grid.removeWidget(self.cutoffWidget) #self.cutoffWidget.setParent(None) self.cutoffWidget.deleteLater() self.grid.removeWidget(self.startCutoffWidget) #self.startCutoffWidget.setParent(None) self.startCutoffWidget.deleteLater() elif prevFilterType == self.tr('bandpass') or prevFilterType == self.tr('bandstop'): self.grid.removeWidget(self.lowerCutoffLabel) #self.lowerCutoffLabel.setParent(None) self.lowerCutoffLabel.deleteLater() self.grid.removeWidget(self.startCutoffLabel) #self.startCutoffLabel.setParent(None) self.startCutoffLabel.deleteLater() self.grid.removeWidget(self.lowerCutoffWidget) #self.lowerCutoffWidget.setParent(None) self.lowerCutoffWidget.deleteLater() self.grid.removeWidget(self.startCutoffWidget) #self.startCutoffWidget.setParent(None) self.startCutoffWidget.deleteLater() self.grid.removeWidget(self.higherCutoffLabel) #self.higherCutoffLabel.setParent(None) self.higherCutoffLabel.deleteLater() self.grid.removeWidget(self.endCutoffLabel) #self.endCutoffLabel.setParent(None) self.endCutoffLabel.deleteLater() self.grid.removeWidget(self.higherCutoffWidget) #self.higherCutoffWidget.setParent(None) self.higherCutoffWidget.deleteLater() self.grid.removeWidget(self.endCutoffWidget) #self.endCutoffWidget.setParent(None) self.endCutoffWidget.deleteLater() if self.currFilterType == self.tr('lowpass'): self.cutoffLabel = QLabel(self.tr('Cutoff: ')) self.endCutoffLabel = QLabel(self.tr('End Transition Band = Cutoff *')) self.cutoffWidget = QLineEdit('') self.cutoffWidget.setValidator(QDoubleValidator(self)) endCutoff = 1.2 self.endCutoffWidget = QLineEdit(self.currLocale.toString(endCutoff)) self.endCutoffWidget.setValidator(QDoubleValidator(self)) self.grid.addWidget(self.cutoffLabel, 2, 1) self.grid.addWidget(self.cutoffWidget, 2, 2) self.grid.addWidget(self.endCutoffLabel, 2, 3) self.grid.addWidget(self.endCutoffWidget, 2, 4) elif self.currFilterType == self.tr('highpass'): self.cutoffLabel = QLabel(self.tr('Cutoff: ')) self.startCutoffLabel = QLabel(self.tr('Start Transition Band = Cutoff *')) self.cutoffWidget = QLineEdit('') self.cutoffWidget.setValidator(QDoubleValidator(self)) startCutoff = 0.8 self.startCutoffWidget = QLineEdit(self.currLocale.toString(startCutoff)) self.startCutoffWidget.setValidator(QDoubleValidator(self)) self.grid.addWidget(self.cutoffLabel, 2, 1) self.grid.addWidget(self.cutoffWidget, 2, 2) self.grid.addWidget(self.startCutoffLabel, 2, 3) self.grid.addWidget(self.startCutoffWidget, 2, 4) elif self.currFilterType == self.tr('bandpass'): self.lowerCutoffLabel = QLabel(self.tr('Lower Cutoff: ')) self.startCutoffLabel = QLabel(self.tr('Start Transition Band = Cutoff *')) self.lowerCutoffWidget = QLineEdit('') self.lowerCutoffWidget.setValidator(QDoubleValidator(self)) startCutoff = 0.8 self.startCutoffWidget = QLineEdit(self.currLocale.toString(startCutoff)) self.startCutoffWidget.setValidator(QDoubleValidator(self)) self.grid.addWidget(self.lowerCutoffLabel, 2, 1) self.grid.addWidget(self.lowerCutoffWidget, 2, 2) self.grid.addWidget(self.startCutoffLabel, 2, 3) self.grid.addWidget(self.startCutoffWidget, 2, 4) self.higherCutoffLabel = QLabel(self.tr('Higher Cutoff: ')) self.endCutoffLabel = QLabel(self.tr('End Transition Band = Cutoff *')) self.higherCutoffWidget = QLineEdit('') self.higherCutoffWidget.setValidator(QDoubleValidator(self)) endCutoff = 1.2 self.endCutoffWidget = QLineEdit(self.currLocale.toString(endCutoff)) self.endCutoffWidget.setValidator(QDoubleValidator(self)) self.grid.addWidget(self.higherCutoffLabel, 3, 1) self.grid.addWidget(self.higherCutoffWidget, 3, 2) self.grid.addWidget(self.endCutoffLabel, 3, 3) self.grid.addWidget(self.endCutoffWidget, 3, 4) elif self.currFilterType == self.tr('bandstop'): self.lowerCutoffLabel = QLabel(self.tr('Lower Cutoff: ')) self.endCutoffLabel = QLabel(self.tr('End Transition Band = Cutoff *')) self.lowerCutoffWidget = QLineEdit('') self.lowerCutoffWidget.setValidator(QDoubleValidator(self)) endCutoff = 1.2 self.endCutoffWidget = QLineEdit(self.currLocale.toString(endCutoff)) self.endCutoffWidget.setValidator(QDoubleValidator(self)) self.grid.addWidget(self.lowerCutoffLabel, 2, 1) self.grid.addWidget(self.lowerCutoffWidget, 2, 2) self.grid.addWidget(self.endCutoffLabel, 2, 3) self.grid.addWidget(self.endCutoffWidget, 2, 4) self.higherCutoffLabel = QLabel(self.tr('Higher Cutoff: ')) self.startCutoffLabel = QLabel(self.tr('Start Transition Band = Cutoff *')) self.higherCutoffWidget = QLineEdit('') self.higherCutoffWidget.setValidator(QDoubleValidator(self)) startCutoff = 0.8 self.startCutoffWidget = QLineEdit(self.currLocale.toString(startCutoff)) self.startCutoffWidget.setValidator(QDoubleValidator(self)) self.grid.addWidget(self.higherCutoffLabel, 3, 1) self.grid.addWidget(self.higherCutoffWidget, 3, 2) self.grid.addWidget(self.startCutoffLabel, 3, 3) self.grid.addWidget(self.startCutoffWidget, 3, 4)
class VmUpdateInfoWidget(QWidget): class VmUpdateInfoItem (QTableWidgetItem): def __init__(self, value, vm): super(VmUpdateInfoWidget.VmUpdateInfoItem, self).__init__() self.value = 0 self.vm = vm self.set_value(value) def set_value(self, value): if value in ("outdated", "to-be-outdated"): self.value = 30 elif value == "update": self.value = 20 else: self.value = 0 def __lt__(self, other): if self.vm.qid == 0: return True elif other.vm.qid == 0: return False elif self.value == other.value: return self.vm.qid < other.vm.qid else: return self.value < other.value def __init__(self, vm, show_text=True, parent = None): super (VmUpdateInfoWidget, self).__init__(parent) layout = QHBoxLayout () self.show_text = show_text if self.show_text: self.label=QLabel("") layout.addWidget(self.label, alignment=Qt.AlignCenter) else: self.icon = QLabel("") layout.addWidget(self.icon, alignment=Qt.AlignCenter) self.setLayout(layout) self.previous_outdated_state = None self.previous_update_recommended = None self.value = None self.tableItem = VmUpdateInfoWidget.VmUpdateInfoItem(self.value, vm) def update_outdated(self, vm): if vm.type == "HVM": return if vm.is_outdated(): outdated_state = "outdated" # During TemplateVM shutdown, there's an interval of a few seconds # during which vm.template.is_running() returns false but # vm.is_outdated() does not yet return true, so the icon disappears. # This looks goofy, but we've decided not to fix it at this time # (2015-02-09). elif vm.template and vm.template.is_running(): outdated_state = "to-be-outdated" else: outdated_state = None if outdated_state != self.previous_outdated_state: self.update_status_widget(outdated_state) self.previous_outdated_state = outdated_state if not vm.is_updateable(): return if vm.qid == 0: update_recommended = self.previous_update_recommended if os.path.exists(qubes_dom0_updates_stat_file): update_recommended = True else: update_recommended = False else: update_recommended = self.previous_update_recommended stat_file_path = vm.dir_path + '/' + vm_files["updates_stat_file"] if not os.path.exists(stat_file_path): update_recommended = False else: if (not hasattr(vm, "updates_stat_file_read_time")) or vm.updates_stat_file_read_time <= os.path.getmtime(stat_file_path): stat_file = open(stat_file_path, "r") updates = stat_file.read().strip() stat_file.close() if updates.isdigit(): updates = int(updates) else: updates = 0 if updates == 0: update_recommended = False else: update_recommended = True vm.updates_stat_file_read_time = time.time() if update_recommended and not self.previous_update_recommended: self.update_status_widget("update") elif self.previous_update_recommended and not update_recommended: self.update_status_widget(None) self.previous_update_recommended = update_recommended def update_status_widget(self, state): self.value = state self.tableItem.set_value(state) if state == "update": label_text = "<font color=\"#CCCC00\">Check updates</font>" icon_path = ":/update-recommended.png" tooltip_text = "Updates pending!" elif state == "outdated": label_text = "<font color=\"red\">VM outdated</font>" icon_path = ":/outdated.png" tooltip_text = "The VM must be restarted for its filesystem to reflect the template's recent committed changes." elif state == "to-be-outdated": label_text = "<font color=\"#800000\">TemplateVM running</font>" icon_path = ":/to-be-outdated.png" tooltip_text = "The TemplateVM must be stopped before changes from its current session can be picked up by this VM." elif state == None: label_text = "" icon_path = None tooltip_text = None if self.show_text: self.label.setText(label_text) else: self.layout().removeWidget(self.icon) self.icon.deleteLater() if icon_path != None: self.icon = VmIconWidget(icon_path, True, 0.7) self.icon.setToolTip(tooltip_text) else: self.icon = QLabel(label_text) self.layout().addWidget(self.icon, alignment=Qt.AlignCenter)
class Window_Link(QWidget): content='' def __init__(self): super(Window_Link, self).__init__() self.waitingUI() self.thread=Worker() self.thread.finished.connect(self.initUI) self.thread.terminated.connect(self.initUI) self.thread.start() self.setWindowTitle('Onedrive Upload') def waitingUI(self): self.title= QLabel('Uploading file please wait...') lay= QtGui.QBoxLayout(2); lay.addWidget(self.title) self.setLayout(lay) self.show() def initUI(self): global upload_url self.content=upload_url title_1= QLabel('Link for the file') link_text_widget=QLineEdit() #Make font bigger font=link_text_widget.font() font.setPointSize(12) link_text_widget.setFont(font) link_text_widget.setText(self.content) link_text_widget.selectAll() link_text_widget.setReadOnly(True) #Button b=QtGui.QPushButton('Copy to clipboard') font=b.font() font.setPointSize(20) b.setFont(font) b.clicked.connect(self.click_copy_clipboard) #Layout lay= self.layout() lay.removeWidget(self.title) self.title.deleteLater() self.title= None lay.addWidget(title_1) lay.addWidget(link_text_widget) lay.addWidget(b) #Define main window self.resize(680,30) self.setLayout(lay) self.setWindowTitle('Onedrive') self.raise_() #time.sleep(5) def keyPressEvent(self, e): if e.key() == QtCore.Qt.Key_Escape: self.close() elif e.key() == QtCore.Qt.Key_C: clip=QApplication.clipboard() clip.setText(self.content) self.close() def click_copy_clipboard(self): clip=QApplication.clipboard() clip.setText(self.content) self.close()
class applyFIR2PresetsDialog(QDialog): def __init__(self, parent): QDialog.__init__(self, parent) self.prm = parent.prm self.currLocale = self.parent().prm['data']['currentLocale'] self.currLocale.setNumberOptions( self.currLocale.OmitGroupSeparator | self.currLocale.RejectGroupSeparator) vbl = QVBoxLayout() self.grid = QGridLayout() filterTypeLabel = QLabel(self.tr('Filter Type: ')) self.filterChooser = QComboBox() self.filterChooser.addItems([ self.tr('lowpass'), self.tr('highpass'), self.tr('bandpass'), self.tr('bandstop') ]) self.filterChooser.setCurrentIndex(0) self.grid.addWidget(self.filterChooser, 0, 1) self.filterChooser.currentIndexChanged[int].connect( self.onChangeFilterType) self.filterOrderLabel = QLabel(self.tr('Filter Order: ')) self.filterOrderWidget = QLineEdit('256') self.filterOrderWidget.setValidator(QIntValidator(self)) self.grid.addWidget(self.filterOrderLabel, 0, 2) self.grid.addWidget(self.filterOrderWidget, 0, 3) self.currFilterType = self.tr('lowpass') self.cutoffLabel = QLabel(self.tr('Cutoff: ')) self.endCutoffLabel = QLabel(self.tr('End Transition Band = Cutoff *')) self.cutoffWidget = QLineEdit('') self.cutoffWidget.setValidator(QDoubleValidator(self)) endCutoff = 1.2 self.endCutoffWidget = QLineEdit(self.currLocale.toString(endCutoff)) self.endCutoffWidget.setValidator(QDoubleValidator(self)) self.grid.addWidget(self.cutoffLabel, 2, 1) self.grid.addWidget(self.cutoffWidget, 2, 2) self.grid.addWidget(self.endCutoffLabel, 2, 3) self.grid.addWidget(self.endCutoffWidget, 2, 4) buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) buttonBox.accepted.connect(self.accept) buttonBox.rejected.connect(self.reject) vbl.addLayout(self.grid) vbl.addWidget(buttonBox) self.setLayout(vbl) self.setWindowTitle(self.tr("Apply Filter")) def onChangeFilterType(self): prevFilterType = self.currFilterType self.currFilterType = str(self.filterChooser.currentText()) if self.currFilterType != prevFilterType: if prevFilterType == self.tr('lowpass'): self.grid.removeWidget(self.cutoffLabel) #self.cutoffLabel.setParent(None) self.cutoffLabel.deleteLater() self.grid.removeWidget(self.endCutoffLabel) #self.endCutoffLabel.setParent(None) self.endCutoffLabel.deleteLater() self.grid.removeWidget(self.cutoffWidget) #self.cutoffWidget.setParent(None) self.cutoffWidget.deleteLater() self.grid.removeWidget(self.endCutoffWidget) #self.endCutoffWidget.setParent(None) self.endCutoffWidget.deleteLater() elif prevFilterType == self.tr('highpass'): self.grid.removeWidget(self.cutoffLabel) #self.cutoffLabel.setParent(None) self.cutoffLabel.deleteLater() self.grid.removeWidget(self.startCutoffLabel) #self.startCutoffLabel.setParent(None) self.startCutoffLabel.deleteLater() self.grid.removeWidget(self.cutoffWidget) #self.cutoffWidget.setParent(None) self.cutoffWidget.deleteLater() self.grid.removeWidget(self.startCutoffWidget) #self.startCutoffWidget.setParent(None) self.startCutoffWidget.deleteLater() elif prevFilterType == self.tr( 'bandpass') or prevFilterType == self.tr('bandstop'): self.grid.removeWidget(self.lowerCutoffLabel) #self.lowerCutoffLabel.setParent(None) self.lowerCutoffLabel.deleteLater() self.grid.removeWidget(self.startCutoffLabel) #self.startCutoffLabel.setParent(None) self.startCutoffLabel.deleteLater() self.grid.removeWidget(self.lowerCutoffWidget) #self.lowerCutoffWidget.setParent(None) self.lowerCutoffWidget.deleteLater() self.grid.removeWidget(self.startCutoffWidget) #self.startCutoffWidget.setParent(None) self.startCutoffWidget.deleteLater() self.grid.removeWidget(self.higherCutoffLabel) #self.higherCutoffLabel.setParent(None) self.higherCutoffLabel.deleteLater() self.grid.removeWidget(self.endCutoffLabel) #self.endCutoffLabel.setParent(None) self.endCutoffLabel.deleteLater() self.grid.removeWidget(self.higherCutoffWidget) #self.higherCutoffWidget.setParent(None) self.higherCutoffWidget.deleteLater() self.grid.removeWidget(self.endCutoffWidget) #self.endCutoffWidget.setParent(None) self.endCutoffWidget.deleteLater() if self.currFilterType == self.tr('lowpass'): self.cutoffLabel = QLabel(self.tr('Cutoff: ')) self.endCutoffLabel = QLabel( self.tr('End Transition Band = Cutoff *')) self.cutoffWidget = QLineEdit('') self.cutoffWidget.setValidator(QDoubleValidator(self)) endCutoff = 1.2 self.endCutoffWidget = QLineEdit( self.currLocale.toString(endCutoff)) self.endCutoffWidget.setValidator(QDoubleValidator(self)) self.grid.addWidget(self.cutoffLabel, 2, 1) self.grid.addWidget(self.cutoffWidget, 2, 2) self.grid.addWidget(self.endCutoffLabel, 2, 3) self.grid.addWidget(self.endCutoffWidget, 2, 4) elif self.currFilterType == self.tr('highpass'): self.cutoffLabel = QLabel(self.tr('Cutoff: ')) self.startCutoffLabel = QLabel( self.tr('Start Transition Band = Cutoff *')) self.cutoffWidget = QLineEdit('') self.cutoffWidget.setValidator(QDoubleValidator(self)) startCutoff = 0.8 self.startCutoffWidget = QLineEdit( self.currLocale.toString(startCutoff)) self.startCutoffWidget.setValidator(QDoubleValidator(self)) self.grid.addWidget(self.cutoffLabel, 2, 1) self.grid.addWidget(self.cutoffWidget, 2, 2) self.grid.addWidget(self.startCutoffLabel, 2, 3) self.grid.addWidget(self.startCutoffWidget, 2, 4) elif self.currFilterType == self.tr('bandpass'): self.lowerCutoffLabel = QLabel(self.tr('Lower Cutoff: ')) self.startCutoffLabel = QLabel( self.tr('Start Transition Band = Cutoff *')) self.lowerCutoffWidget = QLineEdit('') self.lowerCutoffWidget.setValidator(QDoubleValidator(self)) startCutoff = 0.8 self.startCutoffWidget = QLineEdit( self.currLocale.toString(startCutoff)) self.startCutoffWidget.setValidator(QDoubleValidator(self)) self.grid.addWidget(self.lowerCutoffLabel, 2, 1) self.grid.addWidget(self.lowerCutoffWidget, 2, 2) self.grid.addWidget(self.startCutoffLabel, 2, 3) self.grid.addWidget(self.startCutoffWidget, 2, 4) self.higherCutoffLabel = QLabel(self.tr('Higher Cutoff: ')) self.endCutoffLabel = QLabel( self.tr('End Transition Band = Cutoff *')) self.higherCutoffWidget = QLineEdit('') self.higherCutoffWidget.setValidator(QDoubleValidator(self)) endCutoff = 1.2 self.endCutoffWidget = QLineEdit( self.currLocale.toString(endCutoff)) self.endCutoffWidget.setValidator(QDoubleValidator(self)) self.grid.addWidget(self.higherCutoffLabel, 3, 1) self.grid.addWidget(self.higherCutoffWidget, 3, 2) self.grid.addWidget(self.endCutoffLabel, 3, 3) self.grid.addWidget(self.endCutoffWidget, 3, 4) elif self.currFilterType == self.tr('bandstop'): self.lowerCutoffLabel = QLabel(self.tr('Lower Cutoff: ')) self.endCutoffLabel = QLabel( self.tr('End Transition Band = Cutoff *')) self.lowerCutoffWidget = QLineEdit('') self.lowerCutoffWidget.setValidator(QDoubleValidator(self)) endCutoff = 1.2 self.endCutoffWidget = QLineEdit( self.currLocale.toString(endCutoff)) self.endCutoffWidget.setValidator(QDoubleValidator(self)) self.grid.addWidget(self.lowerCutoffLabel, 2, 1) self.grid.addWidget(self.lowerCutoffWidget, 2, 2) self.grid.addWidget(self.endCutoffLabel, 2, 3) self.grid.addWidget(self.endCutoffWidget, 2, 4) self.higherCutoffLabel = QLabel(self.tr('Higher Cutoff: ')) self.startCutoffLabel = QLabel( self.tr('Start Transition Band = Cutoff *')) self.higherCutoffWidget = QLineEdit('') self.higherCutoffWidget.setValidator(QDoubleValidator(self)) startCutoff = 0.8 self.startCutoffWidget = QLineEdit( self.currLocale.toString(startCutoff)) self.startCutoffWidget.setValidator(QDoubleValidator(self)) self.grid.addWidget(self.higherCutoffLabel, 3, 1) self.grid.addWidget(self.higherCutoffWidget, 3, 2) self.grid.addWidget(self.startCutoffLabel, 3, 3) self.grid.addWidget(self.startCutoffWidget, 3, 4)