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


Python QMainWindow.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from PyQt5.Qt import QMainWindow [as 别名]
# 或者: from PyQt5.Qt.QMainWindow import __init__ [as 别名]
    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,代码行数:36,代码来源:isnipdom.py

示例2: __init__

# 需要导入模块: from PyQt5.Qt import QMainWindow [as 别名]
# 或者: from PyQt5.Qt.QMainWindow import __init__ [as 别名]
    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,代码行数:48,代码来源:window.py

示例3: __init__

# 需要导入模块: from PyQt5.Qt import QMainWindow [as 别名]
# 或者: from PyQt5.Qt.QMainWindow import __init__ [as 别名]
 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,代码行数:19,代码来源:MainWindow.py

示例4: __init__

# 需要导入模块: from PyQt5.Qt import QMainWindow [as 别名]
# 或者: from PyQt5.Qt.QMainWindow import __init__ [as 别名]
    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,代码行数:20,代码来源:image.py

示例5: __init__

# 需要导入模块: from PyQt5.Qt import QMainWindow [as 别名]
# 或者: from PyQt5.Qt.QMainWindow import __init__ [as 别名]
 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,代码行数:24,代码来源:widget.py

示例6: __init__

# 需要导入模块: from PyQt5.Qt import QMainWindow [as 别名]
# 或者: from PyQt5.Qt.QMainWindow import __init__ [as 别名]
 def __init__(self, opts, parent=None, disable_automatic_gc=False):
     QMainWindow.__init__(self, parent)
     if disable_automatic_gc:
         self._gc = GarbageCollector(self, debug=False)
开发者ID:Aliminator666,项目名称:calibre,代码行数:6,代码来源:main_window.py

示例7: __init__

# 需要导入模块: from PyQt5.Qt import QMainWindow [as 别名]
# 或者: from PyQt5.Qt.QMainWindow import __init__ [as 别名]
 def __init__(self):
     QMainWindow.__init__(self)
     f = factory()
     self.setMinimumWidth(400)
     self.setWindowTitle('Demo of DBUS menu exporter and systray integration')
     self.statusBar().showMessage(self.windowTitle())
     w = QWidget(self)
     self.setCentralWidget(w)
     self.l = l = QVBoxLayout(w)
     mb = self.menu_bar = f.create_window_menubar(self)
     m = self.menu_one = mb.addMenu('&One')
     m.aboutToShow.connect(self.about_to_show_one)
     s = self.style()
     self.q = q = QAction('&Quit', self)
     q.setShortcut(QKeySequence.Quit), q.setIcon(s.standardIcon(s.SP_DialogCancelButton))
     q.triggered.connect(QApplication.quit)
     self.addAction(q)
     QApplication.instance().setWindowIcon(s.standardIcon(s.SP_ComputerIcon))
     for i, icon in zip(xrange(3), map(s.standardIcon, (s.SP_DialogOkButton, s.SP_DialogHelpButton, s.SP_ArrowUp))):
         ac = m.addAction('One - &%d' % (i + 1))
         ac.setShortcut(QKeySequence(Qt.CTRL | (Qt.Key_1 + i), Qt.SHIFT | (Qt.Key_1 + i)))
         ac.setIcon(icon)
     m.addSeparator()
     self.menu_two = m2 = m.addMenu('A &submenu')
     for i, icon in zip(xrange(3), map(s.standardIcon, (s.SP_DialogOkButton, s.SP_DialogCancelButton, s.SP_ArrowUp))):
         ac = m2.addAction('Two - &%d' % (i + 1))
         ac.setShortcut(QKeySequence(Qt.CTRL | (Qt.Key_A + i)))
         ac.setIcon(icon)
     m2.aboutToShow.connect(self.about_to_show_two)
     m2.addSeparator(), m.addSeparator()
     m.addAction('&Disabled action').setEnabled(False)
     ac = m.addAction('A checkable action')
     make_checkable(ac)
     g = QActionGroup(self)
     make_checkable(g.addAction(m.addAction('Exclusive 1')))
     make_checkable(g.addAction(m.addAction('Exclusive 2')), False)
     m.addSeparator()
     self.about_to_show_sentinel = m.addAction('This action\'s text should change before menu is shown')
     self.as_count = 0
     for ac in mb.findChildren(QAction):
         ac.triggered.connect(self.action_triggered)
     for m in mb.findChildren(QMenu):
         m.aboutToShow.connect(self.about_to_show)
     self.systray = f.create_system_tray_icon(parent=self, title=self.windowTitle())
     if self.systray is not None:
         self.systray.activated.connect(self.tray_activated)
         self.sm = m = QMenu()
         m.addAction('Show/hide main window').triggered.connect(self.tray_activated)
         m.addAction(q)
         self.systray.setContextMenu(m)
         self.update_tray_toggle_action()
         self.cib = b = QPushButton('Change system tray icon')
         l.addWidget(b), b.clicked.connect(self.change_icon)
         self.hib = b = QPushButton('Show/Hide system tray icon')
         l.addWidget(b), b.clicked.connect(self.systray.toggle)
         self.update_tooltip_timer = t = QTimer(self)
         t.setInterval(1000), t.timeout.connect(self.update_tooltip), t.start()
     self.ab = b = QPushButton('Add a new menu')
     b.clicked.connect(self.add_menu), l.addWidget(b)
     self.rb = b = QPushButton('Remove a created menu')
     b.clicked.connect(self.remove_menu), l.addWidget(b)
     self.sd = b = QPushButton('Show modal dialog')
     b.clicked.connect(self.show_dialog), l.addWidget(b)
     print('DBUS connection unique name:', f.bus.get_unique_name())
开发者ID:artbycrunk,项目名称:calibre,代码行数:66,代码来源:demo.py

示例8: __init__

# 需要导入模块: from PyQt5.Qt import QMainWindow [as 别名]
# 或者: from PyQt5.Qt.QMainWindow import __init__ [as 别名]
 def __init__(self, parent=None):
     QMainWindow.__init__(self, parent)
     self.create_main_frame()       
开发者ID:idealist1508,项目名称:Recoll-Full-Text-Search-For-Calibre,代码行数:5,代码来源:main.py

示例9: __init__

# 需要导入模块: from PyQt5.Qt import QMainWindow [as 别名]
# 或者: from PyQt5.Qt.QMainWindow import __init__ [as 别名]
    def __init__(self, gui, initial_plugin=None, close_after_initial=False):
        QMainWindow.__init__(self, gui)
        self.gui = gui
        self.must_restart = False
        self.committed = False
        self.close_after_initial = close_after_initial

        self.resize(930, 720)
        nh, nw = min_available_height()-25, available_width()-10
        if nh < 0:
            nh = 800
        if nw < 0:
            nw = 600
        nh = min(self.height(), nh)
        nw = min(self.width(), nw)
        self.resize(nw, nh)
        self.esc_action = QAction(self)
        self.addAction(self.esc_action)
        self.esc_action.setShortcut(QKeySequence(Qt.Key_Escape))
        self.esc_action.triggered.connect(self.esc)

        geom = gprefs.get('preferences_window_geometry', None)
        if geom is not None:
            self.restoreGeometry(geom)

        # Center
        if islinux:
            self.move(gui.rect().center() - self.rect().center())

        self.setWindowModality(Qt.WindowModal)
        self.setWindowTitle(__appname__ + ' - ' + _('Preferences'))
        self.setWindowIcon(QIcon(I('config.png')))

        self.status_bar = StatusBar(self)
        self.setStatusBar(self.status_bar)

        self.stack = QStackedWidget(self)
        self.cw = QWidget(self)
        self.cw.setLayout(QVBoxLayout())
        self.cw.layout().addWidget(self.stack)
        self.bb = QDialogButtonBox(QDialogButtonBox.Close)
        self.wizard_button = self.bb.addButton(_('Run welcome wizard'),
                self.bb.ActionRole)
        self.wizard_button.setIcon(QIcon(I('wizard.png')))
        self.wizard_button.clicked.connect(self.run_wizard,
                type=Qt.QueuedConnection)
        self.cw.layout().addWidget(self.bb)
        self.bb.button(self.bb.Close).setDefault(True)
        self.bb.rejected.connect(self.close, type=Qt.QueuedConnection)
        self.setCentralWidget(self.cw)
        self.browser = Browser(self)
        self.browser.show_plugin.connect(self.show_plugin)
        self.stack.addWidget(self.browser)
        self.scroll_area = QScrollArea(self)
        self.stack.addWidget(self.scroll_area)
        self.scroll_area.setWidgetResizable(True)

        self.setContextMenuPolicy(Qt.NoContextMenu)
        self.bar = QToolBar(self)
        self.addToolBar(self.bar)
        self.bar.setVisible(False)
        self.bar.setIconSize(QSize(ICON_SIZE, ICON_SIZE))
        self.bar.setMovable(False)
        self.bar.setFloatable(False)
        self.bar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
        self.apply_action = self.bar.addAction(QIcon(I('ok.png')), _('&Apply'),
                self.commit)
        self.cancel_action = self.bar.addAction(QIcon(I('window-close.png')),
                _('&Cancel'),                self.cancel)
        self.bar_title = BarTitle(self.bar)
        self.bar.addWidget(self.bar_title)
        self.restore_action = self.bar.addAction(QIcon(I('clear_left.png')),
                _('Restore &defaults'), self.restore_defaults)
        for ac, tt in [('apply', _('Save changes')),
                ('cancel', _('Cancel and return to overview'))]:
            ac = getattr(self, ac+'_action')
            ac.setToolTip(tt)
            ac.setWhatsThis(tt)
            ac.setStatusTip(tt)

        for ch in self.bar.children():
            if isinstance(ch, QToolButton):
                ch.setCursor(Qt.PointingHandCursor)
                ch.setAutoRaise(True)

        self.stack.setCurrentIndex(0)

        if initial_plugin is not None:
            category, name = initial_plugin
            plugin = get_plugin(category, name)
            if plugin is not None:
                self.show_plugin(plugin)
开发者ID:GaryMMugford,项目名称:calibre,代码行数:94,代码来源:main.py


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