当前位置: 首页>>代码示例>>Python>>正文


Python QtWidgets.QDialog类代码示例

本文整理汇总了Python中AnyQt.QtWidgets.QDialog的典型用法代码示例。如果您正苦于以下问题:Python QDialog类的具体用法?Python QDialog怎么用?Python QDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: keyPressEvent

 def keyPressEvent(self, e):
     """Handle default key actions or pass the event to the inherited method
     """
     if (int(e.modifiers()), e.key()) in OWWidget.defaultKeyActions:
         OWWidget.defaultKeyActions[int(e.modifiers()), e.key()](self)
     else:
         QDialog.keyPressEvent(self, e)
开发者ID:cheral,项目名称:orange3,代码行数:7,代码来源:widget.py

示例2: __init__

    def __init__(self, parent=None, flags=Qt.WindowFlags(0),
                 model=None, **kwargs):
        QDialog.__init__(self, parent, flags, **kwargs)

        self.__setupUi()
        if model is not None:
            self.setModel(model)
开发者ID:PrimozGodec,项目名称:orange3,代码行数:7,代码来源:previewdialog.py

示例3: __init__

    def __init__(self, parent=None, **kwargs):
        QDialog.__init__(self, parent, **kwargs)

        if sys.platform == "darwin":
            self.setAttribute(Qt.WA_MacSmallSize, True)

        self.__setupUi()
开发者ID:RachitKansal,项目名称:orange3,代码行数:7,代码来源:aboutdialog.py

示例4: test_escape_hides

 def test_escape_hides(self):
     window = QDialog()
     w = WebviewWidget(window)
     window.show()
     w.setFocus(Qt.OtherFocusReason)
     self.assertFalse(window.isHidden())
     QTest.keyClick(w, Qt.Key_Escape)
     self.assertTrue(window.isHidden())
开发者ID:cheral,项目名称:orange3,代码行数:8,代码来源:test_webview.py

示例5: showEvent

 def showEvent(self, event):
     """Overloaded to restore the geometry when the widget is shown
     """
     QDialog.showEvent(self, event)
     if self.save_position and not self.__was_restored:
         # Restore saved geometry on show
         self.__restoreWidgetGeometry()
         self.__was_restored = True
     self.__quicktipOnce()
开发者ID:cheral,项目名称:orange3,代码行数:9,代码来源:widget.py

示例6: showEvent

 def showEvent(self, event):
     """Overloaded to restore the geometry when the widget is shown
     """
     QDialog.showEvent(self, event)
     if self.save_position and not self.__was_restored:
         # Restore saved geometry on (first) show
         if self.__splitter is not None:
             self.__splitter.setControlAreaVisible(self.controlAreaVisible)
         self.__restoreWidgetGeometry()
         self.__was_restored = True
     self.__quicktipOnce()
开发者ID:randxie,项目名称:orange3,代码行数:11,代码来源:widget.py

示例7: resizeEvent

 def resizeEvent(self, event):
     """Overloaded to save the geometry (width and height) when the widget
     is resized.
     """
     QDialog.resizeEvent(self, event)
     # Don't store geometry if the widget is not visible
     # (the widget receives a resizeEvent (with the default sizeHint)
     # before first showEvent and we must not overwrite the the
     # savedGeometry with it)
     if self.save_position and self.isVisible():
         self.__updateSavedGeometry()
开发者ID:cheral,项目名称:orange3,代码行数:11,代码来源:widget.py

示例8: __new__

    def __new__(cls, *args, captionTitle=None, **kwargs):
        self = super().__new__(cls, None, cls.get_flags())
        QDialog.__init__(self, None, self.get_flags())
        OWComponent.__init__(self)
        WidgetMessagesMixin.__init__(self)
        WidgetSignalsMixin.__init__(self)

        stored_settings = kwargs.get('stored_settings', None)
        if self.settingsHandler:
            self.settingsHandler.initialize(self, stored_settings)

        self.signalManager = kwargs.get('signal_manager', None)
        self.__env = _asmappingproxy(kwargs.get("env", {}))

        self.graphButton = None
        self.report_button = None

        OWWidget.widget_id += 1
        self.widget_id = OWWidget.widget_id

        captionTitle = self.name if captionTitle is None else captionTitle

        # must be set without invoking setCaption
        self.captionTitle = captionTitle
        self.setWindowTitle(captionTitle)

        self.setFocusPolicy(Qt.StrongFocus)

        self.__blocking = False

        # flag indicating if the widget's position was already restored
        self.__was_restored = False

        self.__statusMessage = ""

        self.__msgwidget = None
        self.__msgchoice = 0

        self.left_side = None
        self.controlArea = self.mainArea = self.buttonsArea = None
        self.splitter = None
        if self.want_basic_layout:
            self.set_basic_layout()

        sc = QShortcut(QKeySequence(Qt.ShiftModifier | Qt.Key_F1), self)
        sc.activated.connect(self.__quicktip)

        sc = QShortcut(QKeySequence.Copy, self)
        sc.activated.connect(self.copy_to_clipboard)
        if self.controlArea is not None:
            # Otherwise, the first control has focus
            self.controlArea.setFocus(Qt.ActiveWindowFocusReason)
        return self
开发者ID:benzei,项目名称:orange3,代码行数:53,代码来源:widget.py

示例9: __init__

    def __init__(self, master):
        """Initialize the attributes and set up the interface"""
        QDialog.__init__(self, master, windowTitle=self.captionTitle)
        WidgetMessagesMixin.__init__(self)
        self.setLayout(QVBoxLayout())

        self.insert_message_bar()
        self.layout().insertWidget(0, self.message_bar)
        self.master = master

        self.keep_running = False
        self.scheduled_call = None
        self.saved_state = None
        self.saved_progress = 0
        self.scores = []
        self.add_to_model = queue.Queue()

        self.update_timer = QTimer(self)
        self.update_timer.timeout.connect(self._update)
        self.update_timer.setInterval(200)

        self._thread = None
        self._worker = None

        self.filter = QLineEdit()
        self.filter.setPlaceholderText("Filter ...")
        self.filter.textChanged.connect(self.filter_changed)
        self.layout().addWidget(self.filter)
        # Remove focus from line edit
        self.setFocus(Qt.ActiveWindowFocusReason)

        self.rank_model = QStandardItemModel(self)
        self.model_proxy = QSortFilterProxyModel(
            self, filterCaseSensitivity=False)
        self.model_proxy.setSourceModel(self.rank_model)
        self.rank_table = view = QTableView(
            selectionBehavior=QTableView.SelectRows,
            selectionMode=QTableView.SingleSelection,
            showGrid=False,
            editTriggers=gui.TableView.NoEditTriggers)
        if self._has_bars:
            view.setItemDelegate(TableBarItem())
        else:
            view.setItemDelegate(HorizontalGridDelegate())
        view.setModel(self.model_proxy)
        view.selectionModel().selectionChanged.connect(
            self.on_selection_changed)
        view.horizontalHeader().setStretchLastSection(True)
        view.horizontalHeader().hide()
        self.layout().addWidget(view)

        self.button = gui.button(
            self, self, "Start", callback=self.toggle, default=True)
开发者ID:lanzagar,项目名称:orange3,代码行数:53,代码来源:__init__.py

示例10: __init__

 def __init__(self, parent=None):
     QDialog.__init__(self, parent)
     self.setupUi(self)
     self.hotkey_screen.setText(settings['hotkey/screenshot'])
     self.hotkey_clip.setText(settings['hotkey/clipboard'])
     self.autostart.setChecked(self.is_autostart_enabled())
     self.buttons.clicked.connect(self.save_or_close)
     if os.name == 'nt':
         # Windows hijacks PrintScreen button for it's screenshotting functionality therefore hotkey widget can not
         # capture this key. We must bind it manually.
         self.printscreen.setChecked(self.hotkey_screen.text() == 'Print')
         self.hotkey_screen.setEnabled(not self.printscreen.isChecked())
         self.printscreen.toggled.connect(self._windows_print_screen)
         self.clear_hotkey_screen.pressed.connect(lambda: self.printscreen.setChecked(False))
     else:
         self.printscreen.setVisible(False)
     self.qt_version.setText('{} ({})'.format(QT_VERSION_STR, AnyQt.USED_API))
     self.resize(self.width(), 0)
开发者ID:rokups,项目名称:paste2box,代码行数:18,代码来源:settings.py

示例11: __init__

    def __init__(self, master, model):
        QDialog.__init__(self)

        self.master = master

        self.setWindowFlags(Qt.Tool)
        self.setLayout(QVBoxLayout())
        self.setWindowTitle("Hidden Axes")

        btns_area = gui.widgetBox(
            self, addSpace=0, spacing=9, orientation=Qt.Horizontal,
            sizePolicy=QSizePolicy(*SIZE_POLICY_FIXED)
        )
        self.btn_add = QPushButton(
            "Add", autoDefault=False, sizePolicy=QSizePolicy(*SIZE_POLICY_FIXED)
        )
        self.btn_add.clicked.connect(self._add)
        self.btn_cancel = QPushButton(
            "Cancel", autoDefault=False, sizePolicy=QSizePolicy(*SIZE_POLICY_FIXED)
        )
        self.btn_cancel.clicked.connect(self._cancel)

        btns_area.layout().addWidget(self.btn_add)
        btns_area.layout().addWidget(self.btn_cancel)

        filter_edit, view = variables_filter(model=model)
        self.view_other = view
        view.setMinimumSize(QSize(30, 60))
        view.setSizePolicy(*SIZE_POLICY_ADAPTING)
        view.viewport().setAcceptDrops(True)

        self.layout().addWidget(filter_edit)
        self.layout().addWidget(view)
        self.layout().addWidget(btns_area)

        master = self.master
        box = master.box
        master.master.setEnabled(False)
        self.move(box.mapToGlobal(QPoint(0, box.pos().y() + box.height())))
        self.setFixedWidth(master.master.controlArea.width())
        self.setMinimumHeight(300)
        self.show()
        self.raise_()
        self.activateWindow()
开发者ID:PrimozGodec,项目名称:orange3,代码行数:44,代码来源:owplotgui_obsolete.py

示例12: showEvent

    def showEvent(self, event):
        """Overloaded to restore the geometry when the widget is shown
        """
        QDialog.showEvent(self, event)
        if self.save_position and not self.__was_restored:
            # Restore saved geometry on (first) show
            if self.__splitter is not None:
                self.__setControlAreaVisible(self.controlAreaVisible)
            if self.savedWidgetGeometry is not None:
                self.__restoreWidgetGeometry(bytes(self.savedWidgetGeometry))
            self.__was_restored = True

        if not self.__was_shown:
            # Mark as explicitly moved/resized if not already. QDialog would
            # otherwise adjust position/size on subsequent hide/show
            # (move/resize events coming from the window manager do not set
            # these flags).
            self.setAttribute(Qt.WA_Moved, True)
            self.setAttribute(Qt.WA_Resized, True)
            self.__was_shown = True
        self.__quicktipOnce()
开发者ID:lanzagar,项目名称:orange3,代码行数:21,代码来源:widget.py

示例13: __init__

    def __init__(self, parent, windowTitle='Date picker'):
        super().__init__(parent, windowTitle=windowTitle)

        self.parent = parent

        self.setLayout(QVBoxLayout())
        self.mainArea = gui.widgetBox(self)
        self.layout().addWidget(self.mainArea)

        self.cal = QCalendarWidget(self)
        self.cal.setGridVisible(True)
        self.cal.move(20, 20)
        self.cal.clicked[QDate].connect(self.set_date)
        self.mainArea.layout().addWidget(self.cal)

        # Set the default date.
        self.picked_date = self.cal.selectedDate().toString('yyyy/MM/dd')

        gui.button(self.mainArea, self, 'OK', lambda: QDialog.accept(self))
开发者ID:biolab,项目名称:orange3-text,代码行数:19,代码来源:owpubmed.py

示例14: acceptChanges

 def acceptChanges(self):
     state = self.getCurrentState()
     oldState = self.colorSchemas[self.selectedSchemaIndex][1]
     if state == oldState:
         QDialog.accept(self)
     else:
         # if we change the default schema, we must save it under a new name
         if self.colorSchemas[self.selectedSchemaIndex][0] == "Default":
             if QMessageBox.information(
                     self, 'Question',
                     'The color schema has changed. Save?',
                     QMessageBox.Yes | QMessageBox.Discard) == QMessageBox.Discard:
                 QDialog.reject(self)
             else:
                 self.selectedSchemaIndex = self.schemaCombo.count() - 1
                 self.schemaCombo.setCurrentIndex(self.selectedSchemaIndex)
                 self.paletteSelected()
                 QDialog.accept(self)
         # simply save the new users schema
         else:
             self.colorSchemas[self.selectedSchemaIndex] = \
                 [self.colorSchemas[self.selectedSchemaIndex][0], state]
             QDialog.accept(self)
开发者ID:,项目名称:,代码行数:23,代码来源:

示例15: __init__

    def __init__(self, *args, **kwargs):
        QDialog.__init__(self, *args, **kwargs)
        self.scheme = None
        self.__autoCommit = True

        self.__setupUi()
开发者ID:PrimozGodec,项目名称:orange3,代码行数:6,代码来源:schemeinfo.py


注:本文中的AnyQt.QtWidgets.QDialog类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。