Esempio n. 1
0
 def evaljs(self, js):
     if not self.workers:
         self.create_worker()
     w = self.workers[0]
     self.evaljs_result = None
     w.runJavaScript(js, self.evaljs_callback)
     QApplication.exec_()
     return self.evaljs_result
Esempio n. 2
0
def launch_editor(path_to_edit, path_is_raw=False):
    app = QApplication([])
    if path_is_raw:
        raw = path_to_edit
    else:
        with open(path_to_edit, 'rb') as f:
            raw = f.read()
    t = Editor('raster_image')
    t.data = raw
    t.show()
    app.exec_()
Esempio n. 3
0
def test():
    setup_for_cli_run()
    app = QApplication([])
    bus = dbus.SessionBus()
    dbus_name = BusName('com.calibre-ebook.TestDBusMenu',
                        bus=bus,
                        do_not_queue=True)
    m = QMenu()
    ac = m.addAction(QIcon(I('window-close.png')), 'Quit', app.quit)
    ac.setShortcut(QKeySequence('Ctrl+Q'))
    menu = DBusMenu('/Menu', bus=bus)
    menu.publish_new_menu(m)
    app.exec_()
    del dbus_name
Esempio n. 4
0
def test():
    from qt.core import 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.FocusReason.OtherFocusReason)
    sys.exit(app.exec_())
Esempio n. 5
0
 def run_loop(self):
     self.block_signal_handlers()
     try:
         return QApplication.exec_()
     finally:
         self.restore_signal_handlers()
Esempio n. 6
0
        self.statusBar().showMessage(text)

    def about_to_show(self):
        self.statusBar().showMessage('About to show menu: %s' % self.sender().title())

    def about_to_show_one(self):
        self.as_count += 1
        self.about_to_show_sentinel.setText('About to show handled: %d' % self.as_count)

    def about_to_show_two(self):
        self.menu_two.addAction('Action added by about to show')

    def show_dialog(self):
        QMessageBox.information(self, 'A test dialog', 'While this dialog is shown, the global menu should be hidden')

    def event(self, ev):
        if ev.type() in (QEvent.Type.WindowBlocked, QEvent.Type.WindowUnblocked):
            if ev.type() == QEvent.Type.WindowBlocked:
                self.window_blocked.emit()
            else:
                self.window_unblocked.emit()
        return QMainWindow.event(self, ev)


app=QApplication([])
app.setAttribute(Qt.ApplicationAttribute.AA_DontUseNativeMenuBar, False)
app.setApplicationName('com.calibre-ebook.DBusExportDemo')
mw=MainWindow()
mw.show()
app.exec_()
Esempio n. 7
0
    model = DummyImageList()
    cf.setImages(model)
    cf.setCurrentSlide(39000)
    w.setCentralWidget(cf)

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


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


if __name__ == '__main__':
    from qt.core import 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.FocusReason.OtherFocusReason)
    sys.exit(app.exec_())