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


Python Application.exec_方法代码示例

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


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

示例1: main

# 需要导入模块: from calibre.gui2 import Application [as 别名]
# 或者: from calibre.gui2.Application import exec_ [as 别名]
def main(args=sys.argv):
    # Ensure we can continue to function if GUI is closed
    os.environ.pop('CALIBRE_WORKER_TEMP_DIR', None)
    reset_base_dir()

    # The following two lines are needed to prevent circular imports causing
    # errors during initialization of plugins that use the polish container
    # infrastructure.
    importlib.import_module('calibre.customize.ui')
    from calibre.gui2.tweak_book.ui import Main

    parser = option_parser()
    opts, args = parser.parse_args(args)
    if getattr(opts, 'detach', False):
        detach_gui()
    override = 'calibre-tweak-book' if islinux else None
    app = Application(args, override_program_name=override)
    app.load_builtin_fonts()
    app.setWindowIcon(QIcon(I('tweak.png')))
    Application.setOrganizationName(ORG_NAME)
    Application.setApplicationName(APP_UID)
    main = Main(opts)
    sys.excepthook = main.unhandled_exception
    main.show()
    if len(args) > 1:
        main.boss.open_book(args[1])
    app.exec_()
开发者ID:Gondulf,项目名称:calibre,代码行数:29,代码来源:main.py

示例2: test

# 需要导入模块: from calibre.gui2 import Application [as 别名]
# 或者: from calibre.gui2.Application import exec_ [as 别名]
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,代码行数:32,代码来源:covers.py

示例3: main

# 需要导入模块: from calibre.gui2 import Application [as 别名]
# 或者: from calibre.gui2.Application import exec_ [as 别名]
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,代码行数:31,代码来源:proceed.py

示例4: main

# 需要导入模块: from calibre.gui2 import Application [as 别名]
# 或者: from calibre.gui2.Application import exec_ [as 别名]
def main():
    from calibre.gui2 import Application
    app = Application([])
    spl = SplashScreen(develop=True)
    spl.show()
    spl.show_message('Testing the splash screen message...')
    app.exec_()
开发者ID:MarioJC,项目名称:calibre,代码行数:9,代码来源:splash_screen.py

示例5: main

# 需要导入模块: from calibre.gui2 import Application [as 别名]
# 或者: from calibre.gui2.Application import exec_ [as 别名]
def main():
    from calibre.gui2 import Application
    from calibre.gui2.tweak_book.boss import get_container
    app = Application([])  # noqa
    path = sys.argv[-1]
    container = get_container(path)
    d = Check()
    d.run_checks(container)
    d.show()
    app.exec_()
开发者ID:MarioJC,项目名称:calibre,代码行数:12,代码来源:check.py

示例6: main

# 需要导入模块: from calibre.gui2 import Application [as 别名]
# 或者: from calibre.gui2.Application import exec_ [as 别名]
def main():
    os.closerange(3, 256)
    from calibre.gui2 import Application
    app = Application([])
    s = CalibreSplashScreen()
    s.show_message.connect(s.showMessage, type=Qt.QueuedConnection)
    s.shutdown.connect(app.quit, type=Qt.QueuedConnection)
    s.show()
    Thread(target=run_loop, args=(s,)).start()
    app.exec_()
开发者ID:AtulKumar2,项目名称:calibre,代码行数:12,代码来源:splash.py

示例7: _run

# 需要导入模块: from calibre.gui2 import Application [as 别名]
# 或者: from calibre.gui2.Application import exec_ [as 别名]
def _run(args, notify=None):
    # Ensure we can continue to function if GUI is closed
    os.environ.pop("CALIBRE_WORKER_TEMP_DIR", None)
    reset_base_dir()

    if iswindows:
        # Ensure that all ebook editor instances are grouped together in the task
        # bar. This prevents them from being grouped with viewer process when
        # launched from within calibre, as both use calibre-parallel.exe
        import ctypes

        try:
            ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID("com.calibre-ebook.edit-book")
        except:
            pass  # Only available on windows 7 and newer

    # The following two lines are needed to prevent circular imports causing
    # errors during initialization of plugins that use the polish container
    # infrastructure.
    importlib.import_module("calibre.customize.ui")
    from calibre.gui2.tweak_book import tprefs
    from calibre.gui2.tweak_book.ui import Main

    parser = option_parser()
    opts, args = parser.parse_args(args)
    decouple("edit-book-"), set_gui_prefs(tprefs)
    override = "calibre-edit-book" if islinux else None
    app = Application(args, override_program_name=override, color_prefs=tprefs)
    app.file_event_hook = EventAccumulator()
    app.load_builtin_fonts()
    app.setWindowIcon(QIcon(I("tweak.png")))
    Application.setOrganizationName(ORG_NAME)
    Application.setApplicationName(APP_UID)
    main = Main(opts, notify=notify)
    main.set_exception_handler()
    main.show()
    app.shutdown_signal_received.connect(main.boss.quit)
    if len(args) > 1:
        main.boss.open_book(args[1], edit_file=args[2:], clear_notify_data=False)
    else:
        for path in reversed(app.file_event_hook.events):
            main.boss.open_book(path)
            break
        app.file_event_hook = main.boss.open_book
    app.exec_()
    # Ensure that the parse worker has quit so that temp files can be deleted
    # on windows
    st = time.time()
    from calibre.gui2.tweak_book.preview import parse_worker

    while parse_worker.is_alive() and time.time() - st < 120:
        time.sleep(0.1)
开发者ID:Xliff,项目名称:calibre,代码行数:54,代码来源:main.py

示例8: main

# 需要导入模块: from calibre.gui2 import Application [as 别名]
# 或者: from calibre.gui2.Application import exec_ [as 别名]
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,代码行数:15,代码来源:proceed.py

示例9: main

# 需要导入模块: from calibre.gui2 import Application [as 别名]
# 或者: from calibre.gui2.Application import exec_ [as 别名]
def main(args=sys.argv):
    # Ensure viewer can continue to function if GUI is closed
    os.environ.pop('CALIBRE_WORKER_TEMP_DIR', None)
    reset_base_dir()

    parser = option_parser()
    opts, args = parser.parse_args(args)
    if getattr(opts, 'detach', False):
        detach_gui()
    try:
        open_at = float(opts.open_at)
    except:
        open_at = None
    override = 'calibre-ebook-viewer' if islinux else None
    app = Application(args, override_program_name=override)
    app.load_builtin_fonts()
    app.setWindowIcon(QIcon(I('viewer.png')))
    QApplication.setOrganizationName(ORG_NAME)
    QApplication.setApplicationName(APP_UID)
    main = EbookViewer(args[1] if len(args) > 1 else None,
            debug_javascript=opts.debug_javascript, open_at=open_at,
                       start_in_fullscreen=opts.full_screen)
    # This is needed for paged mode. Without it, the first document that is
    # loaded will have extra blank space at the bottom, as
    # turn_off_internal_scrollbars does not take effect for the first
    # rendered document
    main.view.load_path(P('viewer/blank.html', allow_user_override=False))

    sys.excepthook = main.unhandled_exception
    main.show()
    if opts.raise_window:
        main.raise_()
    with main:
        return app.exec_()
    return 0
开发者ID:089git,项目名称:calibre,代码行数:37,代码来源:main.py

示例10: _run

# 需要导入模块: from calibre.gui2 import Application [as 别名]
# 或者: from calibre.gui2.Application import exec_ [as 别名]
def _run(args, notify=None):
    # Ensure we can continue to function if GUI is closed
    os.environ.pop('CALIBRE_WORKER_TEMP_DIR', None)
    reset_base_dir()

    if iswindows:
        # Ensure that all ebook editor instances are grouped together in the task
        # bar. This prevents them from being grouped with viewer process when
        # launched from within calibre, as both use calibre-parallel.exe
        import ctypes
        try:
            ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('com.calibre-ebook.edit-book')
        except:
            pass  # Only available on windows 7 and newer

    # The following two lines are needed to prevent circular imports causing
    # errors during initialization of plugins that use the polish container
    # infrastructure.
    importlib.import_module('calibre.customize.ui')
    from calibre.gui2.tweak_book.ui import Main

    parser = option_parser()
    opts, args = parser.parse_args(args)
    if getattr(opts, 'detach', False):
        detach_gui()
    decouple('edit-book-')
    override = 'calibre-edit-book' if islinux else None
    app = Application(args, override_program_name=override)
    app.load_builtin_fonts()
    app.setWindowIcon(QIcon(I('tweak.png')))
    Application.setOrganizationName(ORG_NAME)
    Application.setApplicationName(APP_UID)
    main = Main(opts, notify=notify)
    sys.excepthook = main.unhandled_exception
    main.show()
    if len(args) > 1:
        main.boss.open_book(args[1], edit_file=opts.edit_file, clear_notify_data=False)
    app.exec_()
    # Ensure that the parse worker has quit so that temp files can be deleted
    # on windows
    st = time.time()
    from calibre.gui2.tweak_book.preview import parse_worker
    while parse_worker.is_alive() and time.time() - st < 120:
        time.sleep(0.1)
开发者ID:BatteringRam,项目名称:calibre,代码行数:46,代码来源:main.py

示例11: main

# 需要导入模块: from calibre.gui2 import Application [as 别名]
# 或者: from calibre.gui2.Application import exec_ [as 别名]
def main(args=sys.argv):
    # Ensure we can continue to function if GUI is closed
    os.environ.pop('CALIBRE_WORKER_TEMP_DIR', None)
    reset_base_dir()

    parser = option_parser()
    opts, args = parser.parse_args(args)
    override = 'calibre-tweak-book' if islinux else None
    app = Application(args, override_program_name=override)
    app.load_builtin_fonts()
    app.setWindowIcon(QIcon(I('tweak.png')))
    Application.setOrganizationName(ORG_NAME)
    Application.setApplicationName(APP_UID)
    main = Main(opts)
    sys.excepthook = main.unhandled_exception
    main.show()
    if len(args) > 1:
        main.boss.open_book(args[1])
    app.exec_()
开发者ID:BorviX,项目名称:calibre,代码行数:21,代码来源:main.py

示例12: main

# 需要导入模块: from calibre.gui2 import Application [as 别名]
# 或者: from calibre.gui2.Application import exec_ [as 别名]
def main(args=sys.argv):
    from calibre.gui2 import Application
    left, right = args[-2:]
    ext1, ext2 = left.rpartition('.')[-1].lower(), right.rpartition('.')[-1].lower()
    if ext1.startswith('original_'):
        ext1 = ext1.partition('_')[-1]
    if ext2.startswith('original_'):
        ext2 = ext2.partition('_')[-2]
    if os.path.isdir(left):
        attr = 'dir_diff'
    elif (ext1, ext2) in {('epub', 'epub'), ('azw3', 'azw3')}:
        attr = 'ebook_diff'
    else:
        attr = 'file_diff'
    app = Application([])  # noqa
    d = Diff(show_as_window=True)
    func = getattr(d, attr)
    QTimer.singleShot(0, lambda : func(left, right))
    d.show()
    app.exec_()
    return 0
开发者ID:artbycrunk,项目名称:calibre,代码行数:23,代码来源:main.py

示例13: main

# 需要导入模块: from calibre.gui2 import Application [as 别名]
# 或者: from calibre.gui2.Application import exec_ [as 别名]
def main(args=sys.argv):
    # Ensure viewer can continue to function if GUI is closed
    os.environ.pop("CALIBRE_WORKER_TEMP_DIR", None)
    reset_base_dir()

    parser = option_parser()
    opts, args = parser.parse_args(args)
    open_at = float(opts.open_at.replace(",", ".")) if opts.open_at else None
    listener = None
    override = "calibre-ebook-viewer" if islinux else None
    app = Application(args, override_program_name=override, color_prefs=vprefs)
    app.load_builtin_fonts()
    app.setWindowIcon(QIcon(I("viewer.png")))
    QApplication.setOrganizationName(ORG_NAME)
    QApplication.setApplicationName(APP_UID)

    if vprefs["singleinstance"]:
        try:
            listener = ensure_single_instance(args, open_at)
        except Exception as e:
            import traceback

            error_dialog(None, _("Failed to start viewer"), as_unicode(e), det_msg=traceback.format_exc(), show=True)
            raise SystemExit(1)

    main = EbookViewer(
        args[1] if len(args) > 1 else None,
        debug_javascript=opts.debug_javascript,
        open_at=open_at,
        continue_reading=opts.continue_reading,
        start_in_fullscreen=opts.full_screen,
        listener=listener,
    )
    app.installEventFilter(main)
    # This is needed for paged mode. Without it, the first document that is
    # loaded will have extra blank space at the bottom, as
    # turn_off_internal_scrollbars does not take effect for the first
    # rendered document
    main.view.load_path(P("viewer/blank.html", allow_user_override=False))

    sys.excepthook = main.unhandled_exception
    main.show()
    if opts.raise_window:
        main.raise_()
    with main:
        return app.exec_()
    return 0
开发者ID:sramsubbu,项目名称:calibre,代码行数:49,代码来源:main.py

示例14: main

# 需要导入模块: from calibre.gui2 import Application [as 别名]
# 或者: from calibre.gui2.Application import exec_ [as 别名]
def main(args=sys.argv, logger=None):
    parser = option_parser()
    opts, args = parser.parse_args(args)
    if hasattr(opts, 'help'):
        parser.print_help()
        return 1
    pid = os.fork() if (islinux or isbsd) else -1
    if pid <= 0:
        override = 'calibre-lrf-viewer' if islinux else None
        app = Application(args, override_program_name=override)
        app.setWindowIcon(QIcon(I('viewer.png')))
        opts = normalize_settings(parser, opts)
        stream = open(args[1], 'rb') if len(args) > 1 else None
        main = file_renderer(stream, opts, logger=logger)
        main.set_exception_handler()
        main.show()
        main.render()
        main.activateWindow()
        main.raise_()
        return app.exec_()
    return 0
开发者ID:JimmXinu,项目名称:calibre,代码行数:23,代码来源:main.py

示例15: Application

# 需要导入模块: from calibre.gui2 import Application [as 别名]
# 或者: from calibre.gui2.Application import exec_ [as 别名]
            self.model.import_rules(rules)
            self.changed.emit()
# }}}


if __name__ == '__main__':
    from calibre.gui2 import Application
    app = Application([])

    from calibre.library import db

    db = db()

    if False:
        d = RuleEditor(db.field_metadata, 'column_icon_rules')
        d.add_blank_condition()
        d.exec_()

        kind, col, r = d.rule

        print ('Column to be colored:', col)
        print ('Template:')
        print (r.template)
    else:
        d = EditRules()
        d.resize(QSize(800, 600))
        d.initialize(db.field_metadata, db.prefs, None, 'column_color_rules')
        d.show()
        app.exec_()
        d.commit(db.prefs)
开发者ID:rakyi,项目名称:calibre,代码行数:32,代码来源:coloring.py


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