コード例 #1
0
ファイル: covers.py プロジェクト: artbycrunk/calibre
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_()
コード例 #2
0
ファイル: widget.py プロジェクト: elonchen/calibre
 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)
コード例 #3
0
ファイル: isnipdom.py プロジェクト: marcellmars/orangecase
    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)
コード例 #4
0
ファイル: proceed.py プロジェクト: mirror/calibre
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_()
コード例 #5
0
ファイル: main.py プロジェクト: skeptycal/iv
 def __init__(self, files):
     QMainWindow.__init__(self)
     sys.excepthook = self.excepthook
     self.profile = create_profile(files)
     self.view = View(self.profile, self)
     self.profile.setParent(self.view)
     self.view.set_title.connect(self.set_title)
     self.view.refresh_all.connect(self.refresh_all)
     self.setCentralWidget(self.view)
     self.files = files
     self.directories = {os.path.dirname(f['path']) for f in files.values()}
     self.file_watcher = QFileSystemWatcher(
         [f['path'] for f in files.values()] + list(self.directories), self)
     self.file_watcher.fileChanged.connect(self.file_changed,
                                           type=Qt.QueuedConnection)
     self.file_watcher.directoryChanged.connect(self.directory_changed,
                                                type=Qt.QueuedConnection)
     self.changed_files = set()
     self.changed_dirs = set()
     self.debounce_files, self.debounce_dirs = QTimer(), QTimer()
     for t in self.debounce_files, self.debounce_dirs:
         t.setInterval(1000), t.setSingleShot(True)
     self.debounce_files.timeout.connect(self.do_file_changed)
     self.debounce_dirs.timeout.connect(self.do_dir_changed)
     self.set_title(None)
コード例 #6
0
def main():
    app = QApplication(sys.argv)
    QW = QMainWindow()
    zhu = Ui_MainWindow()
    zhu.setupUi(QW)

    # inruduction
    w1 = QWidget()
    word = text.Ui_Form()
    word.setupUi(w1)
    zhu.pushButton_2.clicked.connect(w1.show)

    # move
    w6 = QWidget()
    m = move.Ui_Form()
    m.setupUi(w6)
    zhu.pushButton_3.clicked.connect(w6.show)

    # do it
    w2 = QWidget()
    di = do_it.Ui_Form()
    di.setupUi(w2)
    zhu.pushButton_4.clicked.connect(w2.show)

    # compare
    w3 = QWidget()
    comp1 = comp.Ui_Form()
    comp1.setupUi(w3)
    zhu.pushButton_5.clicked.connect(w3.show)

    QW.show()
    sys.exit(app.exec_())
コード例 #7
0
ファイル: main.py プロジェクト: whtt/HandWritingRecognization
    def __init__(self, widget):
        QMainWindow.__init__(self)
        self.setWindowTitle("Pattern Recognition")
        self.setStyleSheet("font-size:14px; font-family:Roman Times")

        self.__widget = widget

        self.__menu = self.menuBar()
        self.__file_menu = self.__menu.addMenu("File")
        self.__view_menu = self.__menu.addMenu("View")

        save_action = QAction("Save", self)
        save_action.setShortcut("Ctrl+S")
        save_action.triggered.connect(self.save_app)

        exit_action = QAction("Exit", self)
        exit_action.setShortcut("Ctrl+Q")
        exit_action.triggered.connect(self.exit_app)

        self.__file_menu.addAction(save_action)
        self.__file_menu.addAction(exit_action)

        clear_log_action = QAction("Log_Clear", self)
        clear_log_action.setShortcut("Ctrl+E")
        clear_log_action.triggered.connect(self.clear_log_app)

        self.__view_menu.addAction(clear_log_action)

        self.setCentralWidget(widget)
コード例 #8
0
ファイル: covers.py プロジェクト: MinghuiGao/calibre
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_()
コード例 #9
0
    def __init__(self, parent=None, show=True):
        QMainWindow.__init__(self, parent)

        self.frame = QFrame()
        vlayout = QVBoxLayout()
        self.vtk_widget = QtInteractor(self.frame)
        vlayout.addWidget(self.vtk_widget)

        self.frame.setLayout(vlayout)
        self.setCentralWidget(self.frame)

        mainMenu = self.menuBar()
        fileMenu = mainMenu.addMenu('File')

        exitButton = QAction('Exit', self)
        exitButton.setShortcut('Ctrl+Q')
        exitButton.triggered.connect(self.close)

        fileMenu.addAction(exitButton)

        meshMenu = mainMenu.addMenu('Mesh')
        self.add_sphere_action = QAction('Add Sphere', self)

        self.add_sphere_action.triggered.connect(self.add_sphere)
        meshMenu.addAction(self.add_sphere_action)

        if show:
            self.show()
コード例 #10
0
ファイル: proceed.py プロジェクト: kba/calibre
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_()
コード例 #11
0
 def __init__(self):
     QMainWindow.__init__(self)
     Ui_MainWindow.__init__(self)
     self.setupUi(self)
     self.init_login_win()
     # self.init_order_dialog()
     self.init_info()
コード例 #12
0
ファイル: q3dwindow.py プロジェクト: cossatot/Qgis2threejs
    def closeEvent(self, event):
        self.iface.disconnectFromController()

        settings = QSettings()
        settings.setValue("/Qgis2threejs/wnd/geometry", self.saveGeometry())
        settings.setValue("/Qgis2threejs/wnd/state", self.saveState())
        QMainWindow.closeEvent(self, event)
コード例 #13
0
    def __init__(self, qgisIface, settings, preview=True):
        QMainWindow.__init__(self, parent=qgisIface.mainWindow())
        self.setAttribute(Qt.WA_DeleteOnClose)

        # update layer list and set map settings
        settings.updateLayerList()
        settings.setMapSettings(qgisIface.mapCanvas().mapSettings())

        self.qgisIface = qgisIface
        self.settings = settings
        self.lastDir = None

        self.thread = QThread(self) if RUN_CNTLR_IN_BKGND else None

        self.controller = Q3DController(settings, self.thread)
        self.controller.enabled = preview

        if self.thread:
            self.thread.finished.connect(self.controller.deleteLater)
            self.thread.finished.connect(self.thread.deleteLater)

            # start worker thread event loop
            self.thread.start()

        self.setWindowIcon(QIcon(pluginDir("Qgis2threejs.png")))

        self.ui = Ui_Q3DWindow()
        self.ui.setupUi(self)

        self.iface = Q3DViewerInterface(settings,
                                        self.ui.webView._page,
                                        self,
                                        self.ui.treeView,
                                        parent=self)
        self.iface.connectToController(self.controller)

        self.setupMenu()
        self.setupContextMenu()
        self.setupStatusBar(self.iface, preview)
        self.ui.treeView.setup(self.iface)
        self.ui.treeView.setLayerList(settings.getLayerList())
        self.ui.webView.setup(self.iface, self, preview)
        self.ui.dockWidgetConsole.hide()

        # signal-slot connections
        # map canvas
        self.controller.connectToMapCanvas(qgisIface.mapCanvas())

        # console
        self.ui.lineEditInputBox.returnPressed.connect(self.runInputBoxString)

        self.alwaysOnTopToggled(False)

        # restore window geometry and dockwidget layout
        settings = QSettings()
        self.restoreGeometry(settings.value("/Qgis2threejs/wnd/geometry", b""))
        self.restoreState(settings.value("/Qgis2threejs/wnd/state", b""))
コード例 #14
0
 def __init__(self, user, parent=None):
     QMainWindow.__init__(self, parent)
     self._db_manager = DatabaseManager.instance()
     self._db_manager.set_delegate(self)
     self._user = user
     self._search_type = SearchType.STUDENTS
     self.setCentralWidget(QWidget(self))
     self._set_up_ui()
     self.showMaximized()
コード例 #15
0
    def __init__(self):
        QMainWindow.__init__(self)

        self.setWindowTitle("Process Monitor")
        self.process_tree_widget = PM_ProcessTreeWidget(self)
        self.process_tree_model = PM_ProcessTreeModel(self)
        self.process_tree_widget.setModel(self.process_tree_model)
        # self.system_tree_model = SystemTreeModel(self, networks)
        self.setCentralWidget(self.process_tree_widget)
        self.show()
コード例 #16
0
    def paintEvent(self, a0):
        QMainWindow.paintEvent(self, a0)
        painter = QPainter()
        painter.begin(self)
        if len(self.labels) > 0:
            drawLabels(painter, self.labels)
        else:

            painter.drawImage(self.width() / 2 - self.logo.width() / 2,
                              self.height() / 2 - self.logo.height() / 2,
                              self.logo)
        painter.end()
コード例 #17
0
ファイル: proceed.py プロジェクト: Cykooz/calibre
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_()
コード例 #18
0
    def __init__(self):
        QMainWindow.__init__(self)

        self.window = PlotManager(self)
        self.setCentralWidget(self.window)

        self.resize(1000, 600)

        rect = self.geometry()
        rect.moveCenter(QApplication.desktop().availableGeometry().center())
        self.setGeometry(rect)

        self._init_menu()
コード例 #19
0
    def __init__(self, is_private=False, restart_state=None):
        QMainWindow.__init__(self)
        self.saved_scroll = None
        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.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.change_passthrough.connect(self.change_passthrough)
        self.status_bar.search_bar_hidden.connect(
            self.restore_state_after_popup)
        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.setVisible(False), a.run_command.connect(self.run_command)
        a.hidden.connect(self.restore_state_after_popup)
        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()
コード例 #20
0
ファイル: MainWindow.py プロジェクト: razman786/tigger
 def closeEvent(self, event):
     dprint(1, "closing")
     self._exiting = True
     self.saveSizes()
     if not self.closeFile():
         self._exiting = False
         event.ignore()
         return
     self.skyplot.close()
     self.imgman.close()
     self.closing.emit()
     dprint(1, "invoking os._exit(0)")
     os._exit(0)
     QMainWindow.closeEvent(self, event)
コード例 #21
0
    def __init__(self,
                 parent,
                 qgisIface,
                 controller,
                 isViewer=True,
                 preview=True):
        QMainWindow.__init__(self, parent)
        self.qgisIface = qgisIface
        self.isViewer = isViewer
        self.settings = controller.settings

        #if live_in_another_process:
        #  self.iface = SocketClient(serverName, self)
        #  self.iface.notified.connect(self.notified)
        #  self.iface.requestReceived.connect(self.requestReceived)
        #  self.iface.responseReceived.connect(self.responseReceived)
        #else:
        #  self.iface = Q3DConnector(self)

        self.setWindowIcon(QIcon(pluginDir("Qgis2threejs.png")))

        self.ui = Ui_Q3DWindow()
        self.ui.setupUi(self)

        self.iface = Q3DViewerInterface(qgisIface, self, self.ui.treeView,
                                        self.ui.webView, controller)

        self.setupMenu()
        self.setupContextMenu()
        self.setupStatusBar(self.iface, preview)
        self.ui.treeView.setup(self.iface)
        self.ui.webView.setup(self, self.iface, isViewer, preview)
        self.ui.dockWidgetConsole.hide()

        self.iface.fetchLayerList()

        # signal-slot connections
        # console
        self.ui.lineEditInputBox.returnPressed.connect(self.runInputBoxString)

        # to disconnect from map canvas when window is closed
        self.setAttribute(Qt.WA_DeleteOnClose)

        self.alwaysOnTopToggled(False)

        # restore window geometry and dockwidget layout
        settings = QSettings()
        self.restoreGeometry(settings.value("/Qgis2threejs/wnd/geometry", b""))
        self.restoreState(settings.value("/Qgis2threejs/wnd/state", b""))
コード例 #22
0
ファイル: q3dwindow.py プロジェクト: nsashi/Qgis2threejs
  def closeEvent(self, event):
    self.iface.disconnectFromController()

    # save export settings to a settings file
    self.settings.saveSettings()

    settings = QSettings()
    settings.setValue("/Qgis2threejs/wnd/geometry", self.saveGeometry())
    settings.setValue("/Qgis2threejs/wnd/state", self.saveState())

    # close dialogs
    for dlg in self.findChildren((PropertiesDialog, ExportToWebDialog, NorthArrowDialog, FooterLabelDialog)):
      dlg.close()

    QMainWindow.closeEvent(self, event)
コード例 #23
0
ファイル: demo.py プロジェクト: artbycrunk/calibre
 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)
コード例 #24
0
ファイル: demo.py プロジェクト: yandong2023/calibre
 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)
コード例 #25
0
ファイル: spmtApp.py プロジェクト: tgroh007/PIVX-SPMT
 def closeEvent(self, *args, **kwargs):
     sys.stdout = sys.__stdout__
     sys.stderr = sys.__stderr__
     # Terminate the running threads.
     # Set the shutdown flag on each thread to trigger a clean shutdown of each thread.
     self.mainWindow.myRpcWd.shutdown_flag.set()
     print("Saving stuff & closing...")
     if getattr(self.mainWindow.hwdevice, 'dongle', None) is not None:
         self.mainWindow.hwdevice.dongle.close()
         print("Dongle closed")
         
     # Save window/splitter size to cache file
     self.cache["window_width"] = self.width()
     self.cache["window_height"] = self.height()
     self.cache["splitter_sizes"] = self.mainWindow.splitter.sizes()
     self.cache["console_hidden"] = (self.mainWindow.btn_consoleToggle.text() == 'Show')
     
     # Save mnList order to cache file
     mnOrder = {}
     mnList = self.mainWindow.tabMain.myList
     for i in range(mnList.count()):
         mnName = mnList.itemWidget(mnList.item(i)).alias
         mnOrder[mnName] = i
     self.cache['mnList_order'] = mnOrder
     
     # Write cache file
     writeToFile(self.cache, cache_File)
     print("Bye Bye.")
     return QMainWindow.closeEvent(self, *args, **kwargs)
コード例 #26
0
    def __init__(self):
        QMainWindow.__init__(self)
        FSBase.__init__(self)

        self.progressbar = None
        self.tab_widget = None
        self.file_tree_widget = None
        self.file_tree_model = None
        self.file_scanner_thread = None

        self.movie_table_widget = None
        self.movie_table_model = None
        self.movie_scanner_thread = None

        self.build_ui()
        self.build_content()
コード例 #27
0
 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)
コード例 #28
0
ファイル: main_window.py プロジェクト: Aliminator666/calibre
 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)
コード例 #29
0
ファイル: MainWindow.py プロジェクト: mohanrex/whatsdesk
 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")
コード例 #30
0
    def __init__(self, pathToUI):
        QMainWindow.__init__(self)
        uic.loadUi(uiPathToAbs(pathToUI), self)

        tabHost = self.findChild(QTabWidget, 'tabWidget')
        # collection viewer tab
        tabWidget = self.findChild(QWidget, 'manage_items_tab')
        self.collectionTab = CollectionViewTab(tabHost, tabWidget)
        # status bar
        self.actorMoneyLabel = self.findChild(QLabel, "c_actor_money")
        self.setupStatusbar()
        # composer tab
        tabWidget = self.findChild(QWidget, 'composer_tab')
        self.composer = ComposerTab(tabHost, tabWidget)
        # quest tab
        tabWidget = self.findChild(QWidget, "quest_tab")
        self.quests = QuestTab(tabHost, tabWidget)
コード例 #31
0
ファイル: vtkviewer.py プロジェクト: sehlstrom/compas
    def __init__(self, app, parent=None):
        QMainWindow.__init__(self, parent)

        # Camera

        x, y, z = app.camera_position
        u, v, w = app.camera_target

        self.camera = camera = vtkCamera()
        camera.SetViewUp(0, 0, 1)
        camera.SetPosition(x, y, z)
        camera.SetFocalPoint(u, v, w)

        # Renderer

        self.renderer = renderer = vtkRenderer()
        renderer.SetBackground(1.0, 1.0, 1.0)
        renderer.SetBackground2(0.8, 0.8, 0.8)
        renderer.GradientBackgroundOn()
        renderer.SetActiveCamera(camera)
        renderer.ResetCamera()
        renderer.ResetCameraClippingRange()
        renderer.UseFXAAOn()

        self.window = window = vtkRenderWindow()
        window.AddRenderer(renderer)

        # Widget

        self.frame = frame = QFrame()
        self.widget = widget = QVTKRenderWindowInteractor(frame, rw=window)
        self.layout = layout = QVBoxLayout()
        layout.addWidget(widget)

        frame.setLayout(layout)

        # Interactor

        self.interactor = interactor = widget.GetRenderWindow().GetInteractor()
        interactor.SetInteractorStyle(InteractorStyle())
        interactor.AddObserver('KeyPressEvent', app.keypress)
        interactor.Initialize()
        interactor.Start()

        self.resize(app.width, app.height)
        self.setCentralWidget(frame)
コード例 #32
0
ファイル: window.py プロジェクト: kovidgoyal/vise
    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()
コード例 #33
0
 def __init__(self, parent=None):
     QMainWindow.__init__(self, parent)
     if not hasattr(sys, 'frozen'):
         uic.loadUi(
             os.path.join(os.path.dirname(os.path.realpath(__file__)),
                          'adarConfigurator.ui'), self)
     else:
         uic.loadUi(
             os.path.join(os.path.dirname(sys.executable),
                          'adarConfigurator.ui'), self)
     self.setWindowTitle("AEGIS ADAR Version Configurator")
     self.filebasename = 'aegisVersionConfig.ini'
     self.data = {}
     self.versions = [
         '', '4.0.3', '4.1.0', '5.0', 'BL9.B1', 'BL9.B2', 'BL9.C1', 'BL0.C2'
     ]
     self.makeConnections()
コード例 #34
0
 def __init__(self):
     super().__init__(argv)
     self.w = QMainWindow()
     self.w.setMinimumWidth(300)
     self.w.setMinimumHeight(300)
     # self.w.setWindowTitle(tr("Отправка запросов на ВС АУГО"))
     self.cw = QScrollArea()
     # self.__create_ui()
     self.__showed = False
     self.__wgts = {}
     self.cb = QComboBox()
     self.individuals = []
     self.entities = []
     self.documents = []
     self.doc_files = []
     self.__setupUi(self.w)
     self.w.showMaximized()
コード例 #35
0
    def __init__(self, parent, qgisIface, controller, isViewer=True):
        QMainWindow.__init__(self, parent)
        self.qgisIface = qgisIface
        self.isViewer = isViewer
        self.settings = controller.settings

        #if live_in_another_process:
        #  self.iface = SocketClient(serverName, self)
        #  self.iface.notified.connect(self.notified)
        #  self.iface.requestReceived.connect(self.requestReceived)
        #  self.iface.responseReceived.connect(self.responseReceived)
        #else:
        #  self.iface = Q3DConnector(self)

        self.ui = Ui_Q3DWindow()
        self.ui.setupUi(self)

        self.iface = Q3DViewerInterface(qgisIface, self, self.ui.treeView,
                                        self.ui.webView, controller)

        self.setupMenu()
        self.setupStatusBar(self.iface)
        self.ui.treeView.setup(self.iface)
        self.ui.webView.setup(self, self.iface, isViewer)

        self.iface.fetchLayerList()

        # signal-slot connections
        self.ui.actionExportToWeb.triggered.connect(self.exportToWeb)
        self.ui.actionSaveAsImage.triggered.connect(self.saveAsImage)
        self.ui.actionResetCameraPosition.triggered.connect(
            self.ui.webView.resetCameraPosition)
        self.ui.actionReload.triggered.connect(self.ui.webView.reloadPage)
        self.ui.actionAlwaysOnTop.toggled.connect(self.alwaysOnTopToggled)
        self.ui.lineEditInputBox.returnPressed.connect(self.runInputBoxString)

        # to disconnect from map canvas when window is closed
        self.setAttribute(Qt.WA_DeleteOnClose)

        self.alwaysOnTopToggled(False)

        # restore window geometry and dockwidget layout
        settings = QSettings()
        self.restoreGeometry(settings.value("/Qgis2threejs/wnd/geometry", b""))
        self.restoreState(settings.value("/Qgis2threejs/wnd/state", b""))
コード例 #36
0
ファイル: image.py プロジェクト: yandong2023/calibre
    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)
コード例 #37
0
ファイル: q3dwindow.py プロジェクト: cossatot/Qgis2threejs
    def __init__(self, serverName, isViewer=True, parent=None):
        QMainWindow.__init__(self, parent)
        self.isViewer = isViewer
        self.ui = Ui_Q3DWindow()
        self.ui.setupUi(self)
        self.layerManager = LayerManager(self.ui.treeView, self)
        self.ui.webView.setup(self, self.layerManager, serverName, isViewer)

        # signal-slot connections
        self.ui.actionReset_Camera_Position.triggered.connect(
            self.resetCameraPosition)
        self.ui.actionAlways_on_Top.toggled.connect(self.alwaysOnTopToggled)
        self.ui.treeView.model().itemChanged.connect(
            self.ui.webView.treeItemChanged)
        self.ui.treeView.doubleClicked.connect(
            self.ui.webView.treeItemDoubleClicked)

        self.alwaysOnTopToggled(isViewer)
コード例 #38
0
    def closeEvent(self, event):
        self.iface.abort()

        # save export settings to a settings file
        self.settings.saveSettings()

        settings = QSettings()
        settings.setValue("/Qgis2threejs/wnd/geometry", self.saveGeometry())
        settings.setValue("/Qgis2threejs/wnd/state", self.saveState())

        # stop worker thread event loop
        if self.thread:
            self.thread.quit()
            self.thread.wait()

        # close dialogs
        for dlg in self.findChildren((PropertiesDialog, ExportToWebDialog,
                                      NorthArrowDialog, HFLabelDialog)):
            dlg.close()

        QMainWindow.closeEvent(self, event)
コード例 #39
0
ファイル: spmtApp.py プロジェクト: curiumofficial/PIVX-SPMT
 def closeEvent(self, *args, **kwargs):
     sys.stdout = sys.__stdout__
     sys.stderr = sys.__stderr__
     # Terminate the running threads.
     # Set the shutdown flag on each thread to trigger a clean shutdown of each thread.
     self.mainWindow.myRpcWd.shutdown_flag.set()
     print("Saving stuff & closing...")
     if getattr(self.mainWindow.hwdevice, 'dongle', None) is not None:
         self.mainWindow.hwdevice.dongle.close()
         print("Dongle closed")
     print("Bye Bye.")
     return QMainWindow.closeEvent(self, *args, **kwargs)
コード例 #40
0
ファイル: main.py プロジェクト: GaryMMugford/calibre
    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)
コード例 #41
0
ファイル: widget.py プロジェクト: davidfor/calibre
 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)
コード例 #42
0
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()
コード例 #43
0
ファイル: cover_flow.py プロジェクト: BerZek/calibre
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_())
コード例 #44
0
ファイル: Application.py プロジェクト: all3n/mongo-pyqt
 def setupUi(self):
     self.mainWindow = QMainWindow()
     self.ui_MainWindow = Ui_MainWindow()
     self.ui_MainWindow.setupUi(self.mainWindow)
     self.mainWindow.show()
     pass
コード例 #45
0
ファイル: cover_flow.py プロジェクト: BerZek/calibre
    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_())
コード例 #46
0
 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()
コード例 #47
0
ファイル: main.py プロジェクト: GaryMMugford/calibre
    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)
コード例 #48
0
ファイル: Application.py プロジェクト: all3n/mongo-pyqt
class Application(object):
    '''
    classdocs
    '''


    def __init__(self):
        '''
        Constructor
        '''
       # logging.config.fileConfig("logging.conf")
        self.log = logging.getLogger("Application")
        
        
        
    def setupModels(self):
        self.mongoResultModel = MongoResultModel()
        pass
    
    
    def setupSlot(self):
        self.ui_MainWindow.tableview.setModel(self.mongoResultModel)
        self.ui_MainWindow.connectBtn.clicked.connect(self.appctl.connectServer)
        
        self.ui_MainWindow.querybtn.clicked.connect(self.appctl.query)
        self.ui_MainWindow.query.returnPressed.connect(self.appctl.query)
        self.ui_MainWindow.query.textChanged.connect(self.appctl.queryChange)
        
        self.ui_MainWindow.tableview.clicked.connect(self.appctl.clickTable)
        self.add_query_action = QAction("add to query",self.ui_MainWindow.tableview)
        
        self.add_query_action.triggered.connect(self.appctl.addToQuery)
        self.ui_MainWindow.tableview.setContextMenuPolicy(Qt.ActionsContextMenu)
        self.ui_MainWindow.tableview.addAction(self.add_query_action)
        self.tableHeader = self.ui_MainWindow.tableview.horizontalHeader()
        self.tableHeader.setSortIndicatorShown(True)
        self.tableHeader.sortIndicatorChanged.connect(self.appctl.columnSort)
        
        self.ui_MainWindow.treeWidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.ui_MainWindow.treeWidget.customContextMenuRequested.connect(self.appctl.showTreeMenu)
        
        self.ui_MainWindow.prevBtn.clicked.connect(self.appctl.prevPagination)
        self.ui_MainWindow.nextBtn.clicked.connect(self.appctl.nextPagination)
        
    
    
    def setupCtl(self):
        self.appctl = AppController(self)

    
    def run(self):
        self.log.info("app is start")
        
        self.qtapp = QApplication(sys.argv)
        
        self.setupUi()
        self.setupModels()
        self.setupCtl()
        self.setupSlot()
        
        
        sys.exit(self.qtapp.exec_())
        
    def setupUi(self):
        self.mainWindow = QMainWindow()
        self.ui_MainWindow = Ui_MainWindow()
        self.ui_MainWindow.setupUi(self.mainWindow)
        self.mainWindow.show()
        pass
コード例 #49
0
 def __init__(self, parent=None):
     QMainWindow.__init__(self, parent)
     self.create_main_frame()       
コード例 #50
0
ファイル: win_file_dialogs.py プロジェクト: sebaulri/calibre
            data.append(serialize_string('FOLDER', initial_folder))
    if filename:
        if isinstance(filename, bytes):
            filename = filename.decode(filesystem_encoding)
        data.append(serialize_string('FILENAME', filename))
    loop = Loop()
    h = Helper(subprocess.Popen(
        [HELPER], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE),
               data, loop.dialog_closed.emit)
    h.start()
    loop.exec_(QEventLoop.ExcludeUserInputEvents)
    if h.rc != 0:
        raise Exception('File dialog failed: ' + h.stderrdata.decode('utf-8'))
    if not h.stdoutdata:
        return ()
    return tuple(x.decode('utf-8') for x in h.stdoutdata.split(b'\0'))

if __name__ == '__main__':
    HELPER = sys.argv[-1]
    app = QApplication([])
    q = QMainWindow()

    def clicked():
        print(run_file_dialog(b, 'Testing dialogs', save_as=True, save_path='~/xxx.fdgdfg')), sys.stdout.flush()

    b = QPushButton('click me')
    b.clicked.connect(clicked)
    q.setCentralWidget(b)
    q.show()
    app.exec_()
コード例 #51
0
ファイル: main.py プロジェクト: AtulKumar2/calibre
 def event(self, ev):
     if ev.type() == ev.StatusTip:
         msg = re.sub(r'</?[a-z1-6]+>', ' ', ev.tip())
         ev = QStatusTipEvent(msg)
     return QMainWindow.event(self, ev)
コード例 #52
0
ファイル: demo.py プロジェクト: artbycrunk/calibre
 def showEvent(self, ev):
     if not ev.spontaneous():
         self.update_tray_toggle_action()
     return QMainWindow.showEvent(self, ev)
コード例 #53
0
ファイル: demo.py プロジェクト: artbycrunk/calibre
 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())
コード例 #54
0
ファイル: main_window.py プロジェクト: Aliminator666/calibre
 def __init__(self, opts, parent=None, disable_automatic_gc=False):
     QMainWindow.__init__(self, parent)
     if disable_automatic_gc:
         self._gc = GarbageCollector(self, debug=False)