Python PyQt5.QtCore.Qt 模块,WA_DeleteOnClose() 实例源码

我们从Python开源项目中,提取了以下29个代码示例,用于说明如何使用PyQt5.QtCore.Qt.WA_DeleteOnClose()

项目:gui_tool    作者:UAVCAN    | 项目源码 | 文件源码
def _show_data_type_definition(self, row):
        try:
            data_type_name = self._log_widget.table.item(row, self._log_widget.table.columnCount() - 1).text()
            definition = uavcan.TYPENAMES[data_type_name].source_text
        except Exception as ex:
            show_error('Data type lookup error', 'Could not load data type definition', ex, self)
            return

        win = QDialog(self)
        win.setAttribute(Qt.WA_DeleteOnClose)
        view = QPlainTextEdit(win)
        view.setReadOnly(True)
        view.setFont(get_monospace_font())
        view.setPlainText(definition)
        view.setLineWrapMode(QPlainTextEdit.NoWrap)
        layout = QVBoxLayout(win)
        layout.addWidget(view)
        win.setWindowTitle('Data type definition [%s]' % data_type_name)
        win.setLayout(layout)
        win.resize(600, 300)
        win.show()
项目:mpvQC    作者:Frechdachs    | 项目源码 | 文件源码
def __init__(self, parent, relativeconfpath):
        super(TextEditOptionDialog, self).__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose, True)
        self.setWindowFlags(dialogwindowflags)
        self.setWindowTitle(relativeconfpath)
        self.conf = path.join(configlocation, relativeconfpath)
        with open(self.conf, "r", encoding="utf-8") as configfile:
            config = configfile.read()
        self.resize(640, 480)
        self.layout = QVBoxLayout()
        self.editor = RegularTextEdit()
        self.button = QPushButton(_("OK"))
        self.editor.setPlainText(config)
        self.editor.setWordWrapMode(QTextOption.NoWrap)
        self.layout.addWidget(self.editor)
        self.layout.addWidget(self.button)
        self.layout.setAlignment(self.button, Qt.AlignHCenter)
        self.button.clicked.connect(self.accept)
        self.setLayout(self.layout)
项目:mpvQC    作者:Frechdachs    | 项目源码 | 文件源码
def __init__(self, parent):
        super(CheckForUpdatesMessageBox, self).__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose, True)
        self.addButton(_("OK"), QMessageBox.AcceptRole)
        try:
            r = requests.get("https://mpvqc.rekt.cc/download/latest.txt", timeout=5)
            if v.split(" ")[-1] != r.text.split("\n")[0].strip():
                self.setText(
                        _("There is a new version of {} available ({}).<br>"
                        "Visit <a href='https://mpvqc.rekt.cc/'>"
                        "https://mpvqc.rekt.cc/</a> to download it.")
                        .format(v.split(" ")[0], r.text.strip())
                        )
            else:
                self.setText(
                            _("You are already using the most "
                            "recent version of {}. {}").format(v.split(" ")[0], "??")
                            )
        except requests.exceptions.ConnectionError:
            self.setText(_("A connection to the server could not be established."))
        except requests.exceptions.Timeout:
            self.setText(_("The server did not respond quickly enough."))
项目:mpvQC    作者:Frechdachs    | 项目源码 | 文件源码
def __init__(self, parent, index):
        super(CommentTypeDialog, self).__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose, True)
        self.setWindowFlags(dialogwindowflags)
        self.setWindowTitle(_("Comment Type"))
        self.index = index
        self.commenttypedialoglayout = QVBoxLayout()
        self.commenttypedialoglayout.setContentsMargins(0, 0, 0, 0)
        self.commenttypebuttons = []
        for x in commenttypeoptions:
            self.button = QPushButton(x, self)
            self.button.setFlat(True)
            self.commenttypebuttons.append(self.button)
        for i in range(len(self.commenttypebuttons)):
            self.commenttypebuttons[i].clicked.connect(partial(self.clickedDialogButton, i))
        for x in self.commenttypebuttons:
            self.commenttypedialoglayout.addWidget(x)
        self.setLayout(self.commenttypedialoglayout)
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def __init__(self):
        super(MainWindow, self).__init__()

        self.recentFileActs = []

        self.setAttribute(Qt.WA_DeleteOnClose)

        self.textEdit = QTextEdit()
        self.setCentralWidget(self.textEdit)

        self.createActions()
        self.createMenus()
        self.statusBar()

        self.setWindowTitle("Recent Files")
        self.resize(400, 300)
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def __init__(self):
        super(MainWindow, self).__init__()

        self.recentFileActs = []

        self.setAttribute(Qt.WA_DeleteOnClose)

        self.textEdit = QTextEdit()
        self.setCentralWidget(self.textEdit)

        self.createActions()
        self.createMenus()
        self.statusBar()

        self.setWindowTitle("Recent Files")
        self.resize(400, 300)
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def __init__(self, filename="", parent=None):
        super().__init__(parent)
        self.ui = Ui_DialogCSVImport()
        self.ui.setupUi(self)
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.ui.btnAutoDefault.hide()

        completer = QCompleter()
        completer.setModel(QDirModel(completer))
        self.ui.lineEditFilename.setCompleter(completer)

        self.filename = None  # type: str
        self.ui.lineEditFilename.setText(filename)
        self.update_file()

        self.ui.tableWidgetPreview.setColumnHidden(self.COLUMNS["T"], True)
        self.update_preview()

        self.create_connects()
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def dialog_ui(self) -> QDialog:
        if self.__dialog_ui is None:
            dir_name = os.path.dirname(os.readlink(__file__)) if os.path.islink(__file__) else os.path.dirname(__file__)
            self.__dialog_ui = uic.loadUi(os.path.realpath(os.path.join(dir_name, "insert_sine_dialog.ui")))
            self.__dialog_ui.setAttribute(Qt.WA_DeleteOnClose)
            self.__dialog_ui.setModal(True)
            self.__dialog_ui.doubleSpinBoxAmplitude.setValue(self.__amplitude)
            self.__dialog_ui.doubleSpinBoxFrequency.setValue(self.__frequency)
            self.__dialog_ui.doubleSpinBoxPhase.setValue(self.__phase)
            self.__dialog_ui.doubleSpinBoxSampleRate.setValue(self.__sample_rate)
            self.__dialog_ui.doubleSpinBoxNSamples.setValue(self.__num_samples)
            self.__dialog_ui.lineEditTime.setValidator(
                QRegExpValidator(QRegExp("[0-9]+([nmµ]*|([\.,][0-9]{1,3}[nmµ]*))?$")))

            scene_manager = SceneManager(self.dialog_ui.graphicsViewSineWave)
            self.__dialog_ui.graphicsViewSineWave.scene_manager = scene_manager
            self.insert_indicator = scene_manager.scene.addRect(0, -2, 0, 4,
                                                                QPen(QColor(Qt.transparent), Qt.FlatCap),
                                                                QBrush(self.INSERT_INDICATOR_COLOR))
            self.insert_indicator.stackBefore(scene_manager.scene.selection_area)

            self.set_time()

        return self.__dialog_ui
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def __init__(self):
        super(MainWindow, self).__init__()

        self.recentFileActs = []

        self.setAttribute(Qt.WA_DeleteOnClose)

        self.textEdit = QTextEdit()
        self.setCentralWidget(self.textEdit)

        self.createActions()
        self.createMenus()
        self.statusBar()

        self.setWindowTitle("Recent Files")
        self.resize(400, 300)
项目:gui_tool    作者:UAVCAN    | 项目源码 | 文件源码
def __init__(self, parent, node, target_node_id, file_server_widget, node_monitor,
                 dynamic_node_id_allocator_widget):
        super(NodePropertiesWindow, self).__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose)              # This is required to stop background timers!
        self.setWindowTitle('Node Properties [%d]' % target_node_id)
        self.setMinimumWidth(640)

        self._target_node_id = target_node_id
        self._node = node
        self._file_server_widget = file_server_widget

        self._info_box = InfoBox(self, target_node_id, node_monitor)
        self._controls = Controls(self, node, target_node_id, file_server_widget, dynamic_node_id_allocator_widget)
        self._config_params = ConfigParams(self, node, target_node_id)

        self._status_bar = QStatusBar(self)
        self._status_bar.setSizeGripEnabled(False)

        layout = QVBoxLayout(self)
        layout.addWidget(self._info_box)
        layout.addWidget(self._controls)
        layout.addWidget(self._config_params)
        layout.addWidget(self._status_bar)

        left, top, right, bottom = layout.getContentsMargins()
        bottom = 0
        layout.setContentsMargins(left, top, right, bottom)

        self.setLayout(layout)
项目:gui_tool    作者:UAVCAN    | 项目源码 | 文件源码
def __init__(self, parent, cli_iface, iface_name):
        super(ControlPanelWindow, self).__init__(parent)
        self.setWindowTitle('SLCAN Adapter Control Panel')
        self.setAttribute(Qt.WA_DeleteOnClose)              # This is required to stop background timers!

        self._cli_iface = cli_iface
        self._iface_name = iface_name

        self._state_widget = StateWidget(self, self._cli_iface)
        self._config_widget = ConfigWidget(self, self._cli_iface)
        self._cli_widget = CLIWidget(self, self._cli_iface)

        self._tab_widget = QTabWidget(self)
        self._tab_widget.addTab(self._state_widget, get_icon('dashboard'), 'Adapter State')
        self._tab_widget.addTab(self._config_widget, get_icon('wrench'), 'Configuration')
        self._tab_widget.addTab(self._cli_widget, get_icon('terminal'), 'Command Line')

        self._status_bar = QStatusBar(self)
        self._status_bar.setSizeGripEnabled(False)

        iface_name_label = QLabel(iface_name.split('/')[-1], self)
        iface_name_label.setFont(get_monospace_font())

        layout = QVBoxLayout(self)
        layout.addWidget(iface_name_label)
        layout.addWidget(self._tab_widget)
        layout.addWidget(self._status_bar)

        left, top, right, bottom = layout.getContentsMargins()
        bottom = 0
        layout.setContentsMargins(left, top, right, bottom)

        self.setLayout(layout)
        self.resize(400, 400)
项目:Qyoutube-dl    作者:lzambella    | 项目源码 | 文件源码
def on_actionAbout_triggered(self):
        dialog = QDialog()
        dialog.ui = Ui_About()
        dialog.ui.setupUi(dialog)
        dialog.setAttribute(Qt.WA_DeleteOnClose)
        dialog.exec_()
项目:mpvQC    作者:Frechdachs    | 项目源码 | 文件源码
def __init__(self, parent, title, message, question=False):
        super(WarningMessageBox, self).__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose, True)
        self.setIcon(QMessageBox.Warning)
        self.setWindowTitle(title)
        self.setText(message)
        if question:
            self.addButton(_("Yes"), QMessageBox.YesRole)
            self.addButton(_("No"), QMessageBox.NoRole)
        else:
            self.addButton(_("OK"), QMessageBox.AcceptRole)
项目:mpvQC    作者:Frechdachs    | 项目源码 | 文件源码
def __init__(self, parent, title, message):
        super(InformationMessageBox, self).__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose, True)
        self.setIcon(QMessageBox.Information)
        self.setWindowTitle(title)
        self.setText(message)
        self.addButton(_("OK"), QMessageBox.AcceptRole)
项目:defconQt    作者:trufont    | 项目源码 | 文件源码
def __init__(self, parent=None, flags=Qt.Window):
        super(BaseMainWindow, self).__init__(parent, flags)
        self.setAttribute(Qt.WA_DeleteOnClose)
        _bootstrapGCCache(self)
项目:defconQt    作者:trufont    | 项目源码 | 文件源码
def __init__(self, parent=None, flags=Qt.Window):
        super(BaseWindow, self).__init__(parent, flags)
        self.setAttribute(Qt.WA_DeleteOnClose)
        _bootstrapGCCache(self)
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def slotSourceDownloaded(self):
        reply = self.sender()
        self.textEdit = QTextEdit()
        self.textEdit.setAttribute(Qt.WA_DeleteOnClose)
        self.textEdit.show()
        self.textEdit.setPlainText(QTextStream(reply).readAll())
        self.textEdit.resize(600, 400)
        reply.deleteLater()
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def slotSourceDownloaded(self):
        reply = self.sender()
        self.textEdit = QTextEdit()
        self.textEdit.setAttribute(Qt.WA_DeleteOnClose)
        self.textEdit.show()
        self.textEdit.setPlainText(QTextStream(reply).readAll())
        self.textEdit.resize(600, 400)
        reply.deleteLater()
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def __init__(self, signal, parent=None):
        super().__init__(parent)
        self.signal = signal
        self.ui = Ui_SignalDetails()
        self.ui.setupUi(self)
        self.setAttribute(Qt.WA_DeleteOnClose)

        file = self.signal.filename

        self.ui.lblName.setText(self.signal.name)

        if os.path.isfile(file):
            self.ui.lblFile.setText(file)
            self.ui.lblFileSize.setText(locale.format_string("%.2fMB", os.path.getsize(file) / (1024 ** 2)))
            self.ui.lFileCreated.setText(time.ctime(os.path.getctime(file)))
        else:
            self.ui.lblFile.setText(self.tr("signal file not found"))
            self.ui.lblFileSize.setText("-")
            self.ui.lFileCreated.setText("-")

        self.ui.lblSamplesTotal.setText("{0:n}".format(self.signal.num_samples).replace(",", " "))
        self.ui.dsb_sample_rate.setValue(self.signal.sample_rate)
        self.set_duration()

        self.ui.dsb_sample_rate.valueChanged.connect(self.on_dsb_sample_rate_value_changed)

        try:
            self.restoreGeometry(constants.SETTINGS.value("{}/geometry".format(self.__class__.__name__)))
        except TypeError:
            pass
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def __init__(self, message_type: MessageType, parent=None):
        super().__init__(parent)
        self.ui = Ui_DialogMessageType()
        self.ui.setupUi(self)
        self.setAttribute(Qt.WA_DeleteOnClose)

        operator_descriptions = list(OPERATION_DESCRIPTION.values())
        operator_descriptions.sort()

        self.setWindowTitle(message_type.name)
        self.orig_message_type = copy.deepcopy(message_type)
        self.message_type = message_type
        self.ruleset_table_model = RulesetTableModel(message_type.ruleset, operator_descriptions, parent=self)
        self.ui.tblViewRuleset.setModel(self.ruleset_table_model)

        self.ui.btnRemoveRule.setEnabled(len(message_type.ruleset) > 0)
        self.set_ruleset_ui_status()

        self.ui.rbAssignAutomatically.setChecked(self.message_type.assigned_by_ruleset)
        self.ui.rbAssignManually.setChecked(self.message_type.assign_manually)

        self.ui.tblViewRuleset.setItemDelegateForColumn(2, ComboBoxDelegate(["Bit", "Hex", "ASCII"], parent=self))
        self.ui.tblViewRuleset.setItemDelegateForColumn(3, ComboBoxDelegate(operator_descriptions, parent=self))

        for i in range(len(message_type.ruleset)):
            self.open_editors(i)

        self.ui.cbRulesetMode.setCurrentIndex(self.message_type.ruleset.mode.value)

        self.create_connects()

        try:
            self.restoreGeometry(constants.SETTINGS.value("{}/geometry".format(self.__class__.__name__)))
        except TypeError:
            pass
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def __init__(self, pause_threshold: int, message_length_divisor: int, parent=None):
        super().__init__(parent)
        self.ui = Ui_DialogAdvancedModSettings()
        self.ui.setupUi(self)
        self.setAttribute(Qt.WA_DeleteOnClose)

        self.pause_threshold = pause_threshold
        self.message_length_divisor = message_length_divisor

        self.ui.spinBoxPauseThreshold.setValue(pause_threshold)
        self.ui.spinBoxMessageLengthDivisor.setValue(message_length_divisor)

        self.create_connects()
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def slotSourceDownloaded(self):
        reply = self.sender()
        self.textEdit = QTextEdit()
        self.textEdit.setAttribute(Qt.WA_DeleteOnClose)
        self.textEdit.show()
        self.textEdit.setPlainText(QTextStream(reply).readAll())
        self.textEdit.resize(600, 400)
        reply.deleteLater()
项目:face-identification-tpe    作者:meownoid    | 项目源码 | 文件源码
def __init__(self, scores, comp):
        super().__init__()
        self.initUI(scores, comp)
        self.setAttribute(Qt.WA_DeleteOnClose)
项目:gui_tool    作者:UAVCAN    | 项目源码 | 文件源码
def __init__(self, parent, kernel_manager, banner=None):
        super(JupyterConsoleWindow, self).__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setWindowTitle('Jupyter console')

        self._jupyter_widget = JupyterWidget(self, kernel_manager, banner)

        self.on_close = lambda *_: None

        self._log_handler = _make_jupyter_log_handler(self._jupyter_widget)
        logging.root.addHandler(self._log_handler)

        self._log_level_selector = QComboBox(self)
        self._log_level_selector.setToolTip('Log entries of this severity and higher will appear in the console')
        self._log_level_selector.setEditable(False)
        self._log_level_selector.addItems(['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'])
        self._log_level_selector.currentTextChanged.connect(
            lambda: self._log_handler.setLevel(self._log_level_selector.currentText()))
        self._log_level_selector.setCurrentIndex(1)

        self._style_selector = QComboBox(self)
        self._style_selector.setToolTip('Select standard color theme')
        self._style_selector.setEditable(False)
        self._style_selector.addItems(['lightbg', 'linux'])
        self._style_selector.currentTextChanged.connect(
            lambda: self._jupyter_widget.set_default_style(self._style_selector.currentText()))
        self._style_selector.setCurrentIndex(0)

        self._redirect_stdout_checkbox = QCheckBox('Redirect stdout', self)
        self._redirect_stdout_checkbox.setToolTip('Show stdout output in this console')
        self._redirect_stdout_checkbox.stateChanged.connect(self._update_stdout_redirection)
        self._redirect_stdout_checkbox.setChecked(True)

        layout = QVBoxLayout(self)
        controls_layout = QHBoxLayout(self)
        controls_layout.addWidget(QLabel('Log level:', self))
        controls_layout.addWidget(self._log_level_selector)
        controls_layout.addWidget(QLabel('Color theme:', self))
        controls_layout.addWidget(self._style_selector)
        controls_layout.addWidget(self._redirect_stdout_checkbox)
        controls_layout.addStretch(1)

        layout.addLayout(controls_layout)
        layout.addWidget(self._jupyter_widget)
        self.setLayout(layout)
        self.resize(1000, 600)
项目:gui_tool    作者:UAVCAN    | 项目源码 | 文件源码
def __init__(self, parent, model, cli_iface, store_callback):
        super(ConfigParamEditWindow, self).__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setWindowTitle('Edit Parameter')
        self.setModal(True)

        self._model = model
        self._cli_iface = cli_iface
        self._store_callback = store_callback

        name_label = QLabel(model.name, self)
        name_label.setFont(get_monospace_font())

        if model.type is bool:
            self._value = QCheckBox(self)
            self._value.setChecked(model.value)
        elif model.type is int:
            self._value = QSpinBox(self)
            if model.minimum is not None:
                self._value.setRange(model.minimum,
                                     model.maximum)
            else:
                self._value.setRange(-0x80000000,
                                     +0x7FFFFFFF)
            self._value.setValue(model.value)
        elif model.type is float:
            self._value = QDoubleSpinBox(self)
            if model.minimum is not None:
                self._value.setRange(model.minimum,
                                     model.maximum)
            else:
                self._value.setRange(-3.4028235e+38,
                                     +3.4028235e+38)
            self._value.setValue(model.value)
        elif model.type is str:
            self._value = QLineEdit(self)
            self._value.setText(model.value)
        else:
            raise ValueError('Unsupported value type %r' % model.type)

        self._ok_button = make_icon_button('check', 'Send changes to the device', self,
                                           text='OK', on_clicked=self._do_ok)

        self._cancel_button = make_icon_button('remove', 'Discard changes and close this window', self,
                                               text='Cancel', on_clicked=self.close)

        layout = QVBoxLayout(self)

        value_layout = QHBoxLayout(self)
        value_layout.addWidget(name_label)
        value_layout.addWidget(self._value, 1)

        controls_layout = QHBoxLayout(self)
        controls_layout.addWidget(self._cancel_button)
        controls_layout.addWidget(self._ok_button)

        layout.addLayout(value_layout)
        layout.addLayout(controls_layout)
        self.setLayout(layout)
项目:gui_tool    作者:UAVCAN    | 项目源码 | 文件源码
def __init__(self, parent, plot_area_class, active_data_types):
        super(PlotContainerWidget, self).__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose)              # This is required to stop background timers!

        self.on_close = lambda: None

        self._plot_area = plot_area_class(self, display_measurements=self.setWindowTitle)

        self.update = self._plot_area.update
        self.reset = self._plot_area.reset

        self._active_data_types = active_data_types
        self._extractors = []

        self._new_extractor_button = make_icon_button('plus', 'Add new value extractor', self,
                                                      on_clicked=self._do_new_extractor)

        self._how_to_label = QLabel('\u27F5 Click to configure plotting', self)

        widget = QWidget(self)

        layout = QVBoxLayout(widget)
        layout.addWidget(self._plot_area, 1)

        footer_layout = QHBoxLayout(self)

        controls_layout = QVBoxLayout(widget)
        controls_layout.addWidget(self._new_extractor_button)
        controls_layout.addStretch(1)
        controls_layout.setContentsMargins(0, 0, 0, 0)
        footer_layout.addLayout(controls_layout)
        footer_layout.addWidget(self._how_to_label)

        self._extractors_layout = QVBoxLayout(widget)
        self._extractors_layout.setContentsMargins(0, 0, 0, 0)
        footer_layout.addLayout(self._extractors_layout, 1)

        footer_layout.setContentsMargins(0, 0, 0, 0)
        layout.addLayout(footer_layout)
        widget.setLayout(layout)

        self.setWidget(widget)
        self.setFeatures(QDockWidget.DockWidgetFloatable |
                         QDockWidget.DockWidgetClosable |
                         QDockWidget.DockWidgetMovable)

        self.setMinimumWidth(700)
        self.setMinimumHeight(400)
项目:mpvQC    作者:Frechdachs    | 项目源码 | 文件源码
def __init__(self, parent, index):
        super(TimestampDialog, self).__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose, True)
        self.setWindowFlags(dialogwindowflags)
        self.setWindowTitle(_("Timestamp"))
        self.index = index
        self.timestampdialoglayout = QVBoxLayout()
        self.groupboxlayout = QHBoxLayout()
        self.layout_h = QHBoxLayout()
        self.layout_h.setContentsMargins(1, 1, 1, 1)
        self.layout_m = QHBoxLayout()
        self.layout_m.setContentsMargins(1, 1, 1, 1)
        self.layout_s = QHBoxLayout()
        self.layout_s.setContentsMargins(1, 1, 1, 1)
        self.groupbox_h = QGroupBox(_("Hours"), self)
        self.groupbox_m = QGroupBox(_("Minutes"), self)
        self.groupbox_s = QGroupBox(_("Seconds"), self)
        self.spinbox_h = QSpinBox(self)
        self.spinbox_h.setMinimum(0)
        self.spinbox_h.setMaximum(99)
        self.spinbox_m = QSpinBox(self)
        self.spinbox_m.setMinimum(0)
        self.spinbox_m.setMaximum(59)
        self.spinbox_s = QSpinBox(self)
        self.spinbox_s.setMinimum(0)
        self.spinbox_s.setMaximum(59)
        self.layout_h.addWidget(self.spinbox_h)
        self.layout_m.addWidget(self.spinbox_m)
        self.layout_s.addWidget(self.spinbox_s)
        self.groupbox_h.setLayout(self.layout_h)
        self.groupbox_m.setLayout(self.layout_m)
        self.groupbox_s.setLayout(self.layout_s)
        self.groupboxlayout.addWidget(self.groupbox_h)
        self.groupboxlayout.addWidget(self.groupbox_m)
        self.groupboxlayout.addWidget(self.groupbox_s)
        self.acceptbutton = QPushButton(_("OK"), self)
        self.acceptbutton.clicked.connect(self.clickedAcceptButton)
        self.timestampdialoglayout.addLayout(self.groupboxlayout)
        self.timestampdialoglayout.addWidget(self.acceptbutton)
        self.timestampdialoglayout.setAlignment(self.groupboxlayout, Qt.AlignHCenter)
        self.timestampdialoglayout.setAlignment(self.acceptbutton, Qt.AlignHCenter)
        self.setLayout(self.timestampdialoglayout)
        timestamp = commentmodel.item(commentlistview.selectedIndexes()[0].row(), 0).text()
        str_h, str_m, str_s = timestamp.split(":")
        self.spinbox_h.setValue(int(str_h))
        self.spinbox_m.setValue(int(str_m))
        self.spinbox_s.setValue(int(str_s))
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def __init__(self, preselected_index, message: Message, viewtype: int, parent=None):
        super().__init__(parent)
        self.ui = Ui_DialogLabels()
        self.ui.setupUi(self)
        field_types = FieldType.load_from_xml()
        self.model = PLabelTableModel(message, field_types)
        self.preselected_index = preselected_index

        self.ui.tblViewProtoLabels.setItemDelegateForColumn(0, ComboBoxDelegate([ft.caption for ft in field_types],
                                                                                is_editable=True,
                                                                                return_index=False, parent=self))
        self.ui.tblViewProtoLabels.setItemDelegateForColumn(1, SpinBoxDelegate(1, len(message), self))
        self.ui.tblViewProtoLabels.setItemDelegateForColumn(2, SpinBoxDelegate(1, len(message), self))
        self.ui.tblViewProtoLabels.setItemDelegateForColumn(3,
                                                            ComboBoxDelegate([""] * len(constants.LABEL_COLORS),
                                                                             colors=constants.LABEL_COLORS,
                                                                             parent=self))
        self.ui.tblViewProtoLabels.setItemDelegateForColumn(4, CheckBoxDelegate(self))
        self.ui.tblViewProtoLabels.setModel(self.model)
        self.ui.tblViewProtoLabels.selectRow(preselected_index)
        self.ui.tblViewProtoLabels.setEditTriggers(QAbstractItemView.AllEditTriggers)

        self.ui.tblViewProtoLabels.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)

        self.ui.tblViewProtoLabels.resizeColumnsToContents()
        self.setWindowFlags(Qt.Window)
        self.setWindowTitle(self.tr("Edit Protocol Labels from message type %s") % message.message_type.name)

        self.configure_special_config_tabs()
        self.ui.splitter.setSizes([self.height() / 2, self.height() / 2])

        self.create_connects()
        self.ui.cbProtoView.setCurrentIndex(viewtype)
        self.setAttribute(Qt.WA_DeleteOnClose)

        try:
            self.restoreGeometry(constants.SETTINGS.value("{}/geometry".format(self.__class__.__name__)))
        except TypeError:
            pass

        for i in range(self.model.rowCount()):
            self.open_editors(i)
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def __init__(self, modulators, parent=None):
        """
        :type modulators: list of Modulator
        """
        super().__init__(parent)

        self.ui = Ui_DialogModulation()
        self.ui.setupUi(self)
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.lock_samples_in_view = False

        self.ui.comboBoxCustomModulations.clear()
        for modulator in modulators:
            self.ui.comboBoxCustomModulations.addItem(modulator.name)
        if len(modulators) == 1:
            self.ui.btnRemoveModulation.setDisabled(True)

        self.modulators = modulators

        for graphic_view in (self.ui.gVCarrier, self.ui.gVData, self.ui.gVModulated):
            graphic_view.scene_y_min = -1
            graphic_view.scene_y_max = 1
            graphic_view.scene_x_zoom_stretch = 1.1

        self.set_ui_for_current_modulator()

        self.ui.cbShowDataBitsOnly.setText(self.tr("Show Only Data Sequence\n"))
        self.ui.cbShowDataBitsOnly.setEnabled(False)
        self.protocol = None  # type: ProtocolAnalyzer
        self.search_results = []
        self.ui.cbShowDataBitsOnly.setEnabled(False)
        self.ui.btnSearchNext.setEnabled(False)
        self.ui.btnSearchPrev.setEnabled(False)

        self.ui.chkBoxLockSIV.setDisabled(True)

        self.original_bits = ""
        self.ui.btnRestoreBits.setEnabled(False)

        self.create_connects()

        try:
            self.restoreGeometry(constants.SETTINGS.value("{}/geometry".format(self.__class__.__name__)))
        except TypeError:
            pass

        self.set_modulation_profile_status()