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


Python Qt.QMainWindow类代码示例

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


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

示例1: test

def test(scale=0.25):
    from PyQt5.Qt import QLabel, QPixmap, QMainWindow, QWidget, QScrollArea, QGridLayout
    from calibre.gui2 import Application
    app = Application([])
    mi = Metadata('Unknown', ['Kovid Goyal', 'John & Doe', 'Author'])
    mi.series = 'A series & styles'
    m = QMainWindow()
    sa = QScrollArea(m)
    w = QWidget(m)
    sa.setWidget(w)
    l = QGridLayout(w)
    w.setLayout(l), l.setSpacing(30)
    scale *= w.devicePixelRatioF()
    labels = []
    for r, color in enumerate(sorted(default_color_themes)):
        for c, style in enumerate(sorted(all_styles())):
            mi.series_index = c + 1
            mi.title = 'An algorithmic cover [%s]' % color
            prefs = override_prefs(cprefs, override_color_theme=color, override_style=style)
            scale_cover(prefs, scale)
            img = generate_cover(mi, prefs=prefs, as_qimage=True)
            img.setDevicePixelRatio(w.devicePixelRatioF())
            la = QLabel()
            la.setPixmap(QPixmap.fromImage(img))
            l.addWidget(la, r, c)
            labels.append(la)
    m.setCentralWidget(sa)
    w.resize(w.sizeHint())
    m.show()
    app.exec_()
开发者ID:artbycrunk,项目名称:calibre,代码行数:30,代码来源:covers.py

示例2: main

def main():
    from calibre.gui2 import Application
    from PyQt5.Qt import QMainWindow, QStatusBar, QTimer

    app = Application([])
    w = QMainWindow()
    s = QStatusBar(w)
    w.setStatusBar(s)
    s.showMessage("Testing ProceedQuestion")
    w.show()
    p = ProceedQuestion(w)

    def doit():
        p.dummy_question()
        p.dummy_question(action_label="A very long button for testing relayout (indeed)")
        p(
            lambda p: None,
            None,
            "ass2",
            "ass2",
            "testing2",
            "testing2",
            det_msg="details shown first, with a long line to test wrapping of text and width layout",
            show_det=True,
            show_ok=True,
        )

    QTimer.singleShot(10, doit)
    app.exec_()
开发者ID:mirror,项目名称:calibre,代码行数:29,代码来源:proceed.py

示例3: test

def test(scale=0.5):
    from PyQt5.Qt import QLabel, QApplication, QPixmap, QMainWindow, QWidget, QScrollArea, QGridLayout
    app = QApplication([])
    mi = Metadata('xxx', ['Kovid Goyal', 'John Q. Doe', 'Author'])
    mi.series = 'A series of styles'
    m = QMainWindow()
    sa = QScrollArea(m)
    w = QWidget(m)
    sa.setWidget(w)
    l = QGridLayout(w)
    w.setLayout(l), l.setSpacing(30)
    labels = []
    for r, color in enumerate(sorted(default_color_themes)):
        for c, style in enumerate(sorted(all_styles())):
            mi.series_index = c + 1
            mi.title = 'An algorithmic cover [%s]' % color
            prefs = override_prefs(cprefs, override_color_theme=color, override_style=style)
            for x in ('cover_width', 'cover_height', 'title_font_size', 'subtitle_font_size', 'footer_font_size'):
                prefs[x] = int(scale * prefs[x])
            img = generate_cover(mi, prefs=prefs, as_qimage=True)
            la = QLabel()
            la.setPixmap(QPixmap.fromImage(img))
            l.addWidget(la, r, c)
            labels.append(la)
    m.setCentralWidget(sa)
    w.resize(w.sizeHint())
    m.show()
    app.exec_()
开发者ID:MinghuiGao,项目名称:calibre,代码行数:28,代码来源:covers.py

示例4: __init__

    def __init__(self):
        QMainWindow.__init__(self)


        self.hsplit = QSplitter()
        self.setCentralWidget(self.hsplit)

        kernel_manager = QtInProcessKernelManager()
        kernel_manager.start_kernel()
        self.kernel = kernel_manager.kernel
        self.kernel.gui = 'qt'

        self.control = RichIPythonWidget(gui_completion="droplist")

        self.kernel.shell.push({'snipdom': self})

        kernel_client = kernel_manager.client()
        kernel_client.start_channels()

        self.control.kernel_manager = kernel_manager
        self.control.kernel_client = kernel_client

        self.vsplit = QSplitter()
        self.vsplit.setOrientation(Qt.Vertical)

        self.vsplit.addWidget(self.control)
        self.hsplit.addWidget(self.vsplit)

        self.sendButton = QPushButton("send")
        #self.sendButton.clicked.connect(self.sendcode)
        self.vsplit.addWidget(self.sendButton)

        self.bridge = Js2Py()
        self.bridge.sent.connect(self.codeFromJs)
开发者ID:marcellmars,项目名称:orangecase,代码行数:34,代码来源:isnipdom.py

示例5: main

def main():
    from calibre.gui2 import Application
    from PyQt5.Qt import QMainWindow
    app = Application([])
    w = QMainWindow()
    w.show()
    p = ProceedQuestion(None)
    p(lambda p,q:None, None, 'ass', 'ass', 'testing', 'testing',
            checkbox_msg='testing the ruddy checkbox', det_msg='details')
    p(lambda p:None, None, 'ass2', 'ass2', 'testing2', 'testing2',
            det_msg='details shown first', show_det=True, show_ok=True,
            geom_pref='ProceedQuestion-unit-test')
    app.exec_()
开发者ID:Cykooz,项目名称:calibre,代码行数:13,代码来源:proceed.py

示例6: event

 def event(self, ev):
     if ev.type() in (ev.WindowBlocked, ev.WindowUnblocked):
         if ev.type() == ev.WindowBlocked:
             self.window_blocked.emit()
         else:
             self.window_unblocked.emit()
     return QMainWindow.event(self, ev)
开发者ID:artbycrunk,项目名称:calibre,代码行数:7,代码来源:demo.py

示例7: __init__

 def __init__(self):
     QMainWindow.__init__(self)
     self.db = Helper()
     self.credentials = self.db.get_credentials()
     self.setupUi(self)
     if self.credentials:
         self.form_widget = None
         self.frame_layout = QtWidgets.QVBoxLayout(self.message_frame)
         self.message_frame.setContentsMargins(0, 0, 0, 0)
         self.thread = YowsupThread(self.credentials['phone_number'], self.credentials['password'], debug=False)
         self.thread.interface.success_connection_signal.connect(self.on_success)
         self.thread.interface.message_received_signal.connect(self.on_success)
         self.thread.interface.presence_update_signal.connect(self.on_success)
         self.contact_table.clicked.connect(self.render_page)
         self.thread.render()
     else:
         print("You need to provide authentication credentials")
开发者ID:mohanrex,项目名称:whatsdesk,代码行数:17,代码来源:MainWindow.py

示例8: event

 def event(self, ev):
     # See https://bugreports.qt-project.org/browse/QTBUG-42281
     etype = ev.type()
     if etype == ev.WindowBlocked:
         self.window_blocked.emit()
     elif etype == ev.WindowUnblocked:
         self.window_unblocked.emit()
     return QMainWindow.event(self, ev)
开发者ID:Aliminator666,项目名称:calibre,代码行数:8,代码来源:main_window.py

示例9: __init__

    def __init__(self, is_private=False, restart_state=None):
        QMainWindow.__init__(self)
        self.setWindowIcon(get_icon('vise.svg'))
        self.setWindowRole('browser')
        self.current_tab = None
        self.quickmark_pending = self.choose_tab_pending = None
        self.window_id = next(window_id)
        self.is_private = is_private
        self.deleted_tabs_cache = deque(maxlen=200)
        self.setAttribute(Qt.WA_DeleteOnClose, True)

        self.downloads_indicator = Indicator(self)
        self.status_bar = StatusBar(self.downloads_indicator, self)
        self.start_search_signal.connect(self.status_bar.show_search, type=Qt.QueuedConnection)
        self.start_search = lambda forward=True: self.start_search_signal.emit(forward)
        self.status_bar.do_search.connect(self.do_search)
        self.status_bar.search_bar_hidden.connect(self.refocus)
        self.status_bar.change_passthrough.connect(self.change_passthrough)
        self.setStatusBar(self.status_bar)

        self.main_splitter = w = QSplitter(self)
        w.setChildrenCollapsible(False)
        self.setCentralWidget(w)

        self.tabs = []
        self.tab_tree = tt = TabTree(self)
        tt.tab_activated.connect(self.show_tab)
        tt.tab_close_requested.connect(self.close_tab)
        tt.delete_tabs.connect(self.delete_removed_tabs)
        w.addWidget(tt)
        self.stack = s = StackedWidget(self)
        s.currentChanged.connect(self.current_tab_changed)
        w.addWidget(s)
        w.setCollapsible(0, True), w.setCollapsible(1, False)
        self.ask = a = Ask(s)
        a.hidden.connect(self.refocus)
        a.setVisible(False), a.run_command.connect(self.run_command)
        self.profile = create_profile(private=True) if is_private else profile()

        if restart_state is None:
            self.open_url(WELCOME_URL)
        else:
            self.unserialize_state(restart_state)

        self.restore_state()
        self.current_tab_changed()
开发者ID:kovidgoyal,项目名称:vise,代码行数:46,代码来源:window.py

示例10: __init__

    def __init__(self, syntax, parent=None):
        QMainWindow.__init__(self, parent)
        if parent is None:
            self.setWindowFlags(Qt.Widget)

        self.is_synced_to_container = False
        self.syntax = syntax
        self._is_modified = False
        self.copy_available = self.cut_available = False

        self.quality = 90
        self.canvas = Canvas(self)
        self.setCentralWidget(self.canvas)
        self.create_toolbars()

        self.canvas.image_changed.connect(self.image_changed)
        self.canvas.undo_redo_state_changed.connect(self.undo_redo_state_changed)
        self.canvas.selection_state_changed.connect(self.update_clipboard_actions)
开发者ID:artbycrunk,项目名称:calibre,代码行数:18,代码来源:image.py

示例11: WeirdViewClient

class WeirdViewClient(QMainWindow):

    """
    Weird view client initializer.
    """
    def __init__(self):
        super().__init__()
        self.device_selector_window = QMainWindow()
        self.device_selector = DeviceSelector(self.device_selector_window)
        self.device_selector.device_selection_signal.connect(self.device_open)
        self.device_selector_window.show()
        
    """
    Weird view device open callback.
    """
    def device_open(self, name, address):
        
        # Close the old device selector window.
        self.device_selector_window.close()
        self.plugin_window = QWidget()
        self.plugin = PluginWindow(self.plugin_window, name, address)
        self.plugin_window.show()
开发者ID:n3rd-bugs,项目名称:weird-rtos,代码行数:22,代码来源:weird_view_client.py

示例12: closeEvent

    def closeEvent(self, *args):
        gprefs.set('preferences_window_geometry',
                bytearray(self.saveGeometry()))
        if self.committed:
            self.gui.must_restart_before_config = self.must_restart
            self.gui.tags_view.recount()
            self.gui.create_device_menu()
            self.gui.set_device_menu_items_state(bool(self.gui.device_connected))
            self.gui.bars_manager.apply_settings()
            self.gui.bars_manager.update_bars()
            self.gui.build_context_menus()

        return QMainWindow.closeEvent(self, *args)
开发者ID:GaryMMugford,项目名称:calibre,代码行数:13,代码来源:main.py

示例13: __init__

 def __init__(self, syntax, parent=None):
     QMainWindow.__init__(self, parent)
     if parent is None:
         self.setWindowFlags(Qt.Widget)
     self.is_synced_to_container = False
     self.syntax = syntax
     self.editor = TextEdit(self)
     self.editor.setContextMenuPolicy(Qt.CustomContextMenu)
     self.editor.customContextMenuRequested.connect(self.show_context_menu)
     self.setCentralWidget(self.editor)
     self.create_toolbars()
     self.undo_available = False
     self.redo_available = False
     self.copy_available = self.cut_available = False
     self.editor.modificationChanged.connect(self._modification_state_changed)
     self.editor.undoAvailable.connect(self._undo_available)
     self.editor.redoAvailable.connect(self._redo_available)
     self.editor.textChanged.connect(self._data_changed)
     self.editor.copyAvailable.connect(self._copy_available)
     self.editor.cursorPositionChanged.connect(self._cursor_position_changed)
     self.editor.link_clicked.connect(self.link_clicked)
     self.editor.smart_highlighting_updated.connect(self.smart_highlighting_updated)
开发者ID:davidfor,项目名称:calibre,代码行数:22,代码来源:widget.py

示例14: test

def test():
    from PyQt5.Qt import QApplication, QMainWindow
    app = QApplication([])
    w = QMainWindow()
    cf = CoverFlow()
    cf.resize(int(available_width()/1.5), available_height()-60)
    w.resize(cf.size()+QSize(30, 20))
    model = DummyImageList()
    cf.setImages(model)
    cf.setCurrentSlide(39000)
    w.setCentralWidget(cf)

    w.show()
    cf.setFocus(Qt.OtherFocusReason)
    sys.exit(app.exec_())
开发者ID:BerZek,项目名称:calibre,代码行数:15,代码来源:cover_flow.py

示例15: available_height

    cf.resize(int(available_width()/1.5), available_height()-60)
    w.resize(cf.size()+QSize(30, 20))
    model = DummyImageList()
    cf.setImages(model)
    cf.setCurrentSlide(39000)
    w.setCentralWidget(cf)

    w.show()
    cf.setFocus(Qt.OtherFocusReason)
    sys.exit(app.exec_())

def main(args=sys.argv):
    return 0

if __name__ == '__main__':
    from PyQt5.Qt import QApplication, QMainWindow
    app = QApplication([])
    w = QMainWindow()
    cf = CoverFlow()
    cf.resize(int(available_width()/1.5), available_height()-60)
    w.resize(cf.size()+QSize(30, 20))
    path = sys.argv[1]
    model = FileSystemImages(sys.argv[1])
    cf.currentChanged[int].connect(model.currentChanged)
    cf.setImages(model)
    w.setCentralWidget(cf)

    w.show()
    cf.setFocus(Qt.OtherFocusReason)
    sys.exit(app.exec_())
开发者ID:BerZek,项目名称:calibre,代码行数:30,代码来源:cover_flow.py


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