本文整理汇总了Python中calibre.gui2.jobs.JobManager.has_jobs方法的典型用法代码示例。如果您正苦于以下问题:Python JobManager.has_jobs方法的具体用法?Python JobManager.has_jobs怎么用?Python JobManager.has_jobs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类calibre.gui2.jobs.JobManager
的用法示例。
在下文中一共展示了JobManager.has_jobs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Main
# 需要导入模块: from calibre.gui2.jobs import JobManager [as 别名]
# 或者: from calibre.gui2.jobs.JobManager import has_jobs [as 别名]
#.........这里部分代码省略.........
if not minz:
self.job_error_dialog.show_error(dialog_title,
_('<b>Failed</b>')+': '+unicode(job.description),
det_msg=job.details, retry_func=retry_func)
def read_settings(self):
geometry = config['main_window_geometry']
if geometry is not None:
self.restoreGeometry(geometry)
self.read_layout_settings()
def write_settings(self):
with gprefs: # Only write to gprefs once
config.set('main_window_geometry', self.saveGeometry())
dynamic.set('sort_history', self.library_view.model().sort_history)
self.save_layout_state()
def quit(self, checked=True, restart=False, debug_on_restart=False,
confirm_quit=True):
if confirm_quit and not self.confirm_quit():
return
try:
self.shutdown()
except:
pass
self.restart_after_quit = restart
self.debug_on_restart = debug_on_restart
QApplication.instance().quit()
def donate(self, *args):
open_url(QUrl('http://calibre-ebook.com/donate'))
def confirm_quit(self):
if self.job_manager.has_jobs():
msg = _('There are active jobs. Are you sure you want to quit?')
if self.job_manager.has_device_jobs():
msg = '<p>'+__appname__ + \
_(''' is communicating with the device!<br>
Quitting may cause corruption on the device.<br>
Are you sure you want to quit?''')+'</p>'
if not question_dialog(self, _('Active jobs'), msg):
return False
from calibre.db.delete_service import has_jobs
if has_jobs():
msg = _('Some deleted books are still being moved to the Recycle '
'Bin, if you quit now, they will be left behind. Are you '
'sure you want to quit?')
if not question_dialog(self, _('Active jobs'), msg):
return False
return True
def shutdown(self, write_settings=True):
self.grid_view.shutdown()
try:
db = self.library_view.model().db
cf = db.clean
except:
pass
else:
cf()
# Save the current field_metadata for applications like calibre2opds
# Goes here, because if cf is valid, db is valid.
db.new_api.set_pref('field_metadata', db.field_metadata.all_metadata())
db.commit_dirty_cache()