本文整理汇总了Python中calibre.gui2.Application.load_builtin_fonts方法的典型用法代码示例。如果您正苦于以下问题:Python Application.load_builtin_fonts方法的具体用法?Python Application.load_builtin_fonts怎么用?Python Application.load_builtin_fonts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类calibre.gui2.Application
的用法示例。
在下文中一共展示了Application.load_builtin_fonts方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from calibre.gui2 import Application [as 别名]
# 或者: from calibre.gui2.Application import load_builtin_fonts [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_()
示例2: main
# 需要导入模块: from calibre.gui2 import Application [as 别名]
# 或者: from calibre.gui2.Application import load_builtin_fonts [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
示例3: _run
# 需要导入模块: from calibre.gui2 import Application [as 别名]
# 或者: from calibre.gui2.Application import load_builtin_fonts [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)
示例4: main
# 需要导入模块: from calibre.gui2 import Application [as 别名]
# 或者: from calibre.gui2.Application import load_builtin_fonts [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
示例5: _run
# 需要导入模块: from calibre.gui2 import Application [as 别名]
# 或者: from calibre.gui2.Application import load_builtin_fonts [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)
示例6: main
# 需要导入模块: from calibre.gui2 import Application [as 别名]
# 或者: from calibre.gui2.Application import load_builtin_fonts [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_()
示例7: keyPressEvent
# 需要导入模块: from calibre.gui2 import Application [as 别名]
# 或者: from calibre.gui2.Application import load_builtin_fonts [as 别名]
if not self.is_half_star:
val //= 2
self.setCurrentIndex(val)
def keyPressEvent(self, ev):
if ev == QKeySequence.Undo:
self.undo()
return ev.accept()
if ev == QKeySequence.Redo:
self.redo()
return ev.accept()
k = ev.key()
num = {getattr(Qt, "Key_%d" % i): i for i in range(6)}.get(k)
if num is None:
return QComboBox.keyPressEvent(self, ev)
ev.accept()
if self.is_half_star:
num *= 2
self.setCurrentIndex(num)
if __name__ == "__main__":
from calibre.gui2 import Application
app = Application([])
app.load_builtin_fonts()
q = RatingEditor(is_half_star=True)
q.rating_value = 7
q.show()
app.exec_()