mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Pull from driver-dev
This commit is contained in:
commit
f8f4a0fbe3
@ -55,7 +55,7 @@ class Writer(FormatWriter):
|
|||||||
out_stream.write(item)
|
out_stream.write(item)
|
||||||
|
|
||||||
def _text(self, oeb_book):
|
def _text(self, oeb_book):
|
||||||
pmlmlizer = PMLMLizer(ignore_tables=self.opts.linearize_tables)
|
pmlmlizer = PMLMLizer(self.log)
|
||||||
pml = unicode(pmlmlizer.extract_content(oeb_book, self.opts)).encode('cp1252', 'replace')
|
pml = unicode(pmlmlizer.extract_content(oeb_book, self.opts)).encode('cp1252', 'replace')
|
||||||
|
|
||||||
pml_pages = []
|
pml_pages = []
|
||||||
|
@ -167,7 +167,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
self.connect(self.quit_action, SIGNAL('triggered(bool)'), self.quit)
|
self.connect(self.quit_action, SIGNAL('triggered(bool)'), self.quit)
|
||||||
self.connect(self.donate_action, SIGNAL('triggered(bool)'), self.donate)
|
self.connect(self.donate_action, SIGNAL('triggered(bool)'), self.donate)
|
||||||
self.connect(self.restore_action, SIGNAL('triggered()'),
|
self.connect(self.restore_action, SIGNAL('triggered()'),
|
||||||
self.show)
|
self.show_windows)
|
||||||
self.connect(self.action_show_book_details,
|
self.connect(self.action_show_book_details,
|
||||||
SIGNAL('triggered(bool)'), self.show_book_info)
|
SIGNAL('triggered(bool)'), self.show_book_info)
|
||||||
self.connect(self.action_restart, SIGNAL('triggered()'),
|
self.connect(self.action_restart, SIGNAL('triggered()'),
|
||||||
@ -314,15 +314,14 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
QObject.connect(self.action_convert,
|
QObject.connect(self.action_convert,
|
||||||
SIGNAL('triggered(bool)'), self.convert_single)
|
SIGNAL('triggered(bool)'), self.convert_single)
|
||||||
self.convert_menu = cm
|
self.convert_menu = cm
|
||||||
|
|
||||||
pm = QMenu()
|
pm = QMenu()
|
||||||
ap = self.action_preferences
|
ap = self.action_preferences
|
||||||
pm.addAction(ap.icon(), ap.text())
|
pm.addAction(ap.icon(), ap.text())
|
||||||
|
pm.addAction(self.preferences_action)
|
||||||
pm.addAction(_('Run welcome wizard'))
|
pm.addAction(_('Run welcome wizard'))
|
||||||
self.connect(pm.actions()[1], SIGNAL('triggered(bool)'),
|
self.connect(pm.actions()[1], SIGNAL('triggered(bool)'),
|
||||||
self.run_wizard)
|
self.run_wizard)
|
||||||
self.connect(pm.actions()[0], SIGNAL('triggered(bool)'),
|
|
||||||
self.do_config)
|
|
||||||
|
|
||||||
self.action_preferences.setMenu(pm)
|
self.action_preferences.setMenu(pm)
|
||||||
self.preferences_menu = pm
|
self.preferences_menu = pm
|
||||||
|
|
||||||
@ -404,7 +403,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
|
|
||||||
self.show()
|
self.show()
|
||||||
if self.system_tray_icon.isVisible() and opts.start_in_tray:
|
if self.system_tray_icon.isVisible() and opts.start_in_tray:
|
||||||
self.hide()
|
self.hide_windows()
|
||||||
self.stack.setCurrentIndex(0)
|
self.stack.setCurrentIndex(0)
|
||||||
try:
|
try:
|
||||||
db = LibraryDatabase2(self.library_path)
|
db = LibraryDatabase2(self.library_path)
|
||||||
@ -521,12 +520,18 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
def system_tray_icon_activated(self, r):
|
def system_tray_icon_activated(self, r):
|
||||||
if r == QSystemTrayIcon.Trigger:
|
if r == QSystemTrayIcon.Trigger:
|
||||||
if self.isVisible():
|
if self.isVisible():
|
||||||
|
self.hide_windows()
|
||||||
|
else:
|
||||||
|
self.show_windows()
|
||||||
|
|
||||||
|
def hide_windows(self):
|
||||||
for window in QApplication.topLevelWidgets():
|
for window in QApplication.topLevelWidgets():
|
||||||
if isinstance(window, (MainWindow, QDialog)) and \
|
if isinstance(window, (MainWindow, QDialog)) and \
|
||||||
window.isVisible():
|
window.isVisible():
|
||||||
window.hide()
|
window.hide()
|
||||||
setattr(window, '__systray_minimized', True)
|
setattr(window, '__systray_minimized', True)
|
||||||
else:
|
|
||||||
|
def show_windows(self):
|
||||||
for window in QApplication.topLevelWidgets():
|
for window in QApplication.topLevelWidgets():
|
||||||
if getattr(window, '__systray_minimized', False):
|
if getattr(window, '__systray_minimized', False):
|
||||||
window.show()
|
window.show()
|
||||||
@ -641,7 +646,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
self.add_filesystem_book(path)
|
self.add_filesystem_book(path)
|
||||||
self.setWindowState(self.windowState() & \
|
self.setWindowState(self.windowState() & \
|
||||||
~Qt.WindowMinimized|Qt.WindowActive)
|
~Qt.WindowMinimized|Qt.WindowActive)
|
||||||
self.show()
|
self.show_windows()
|
||||||
self.raise_()
|
self.raise_()
|
||||||
self.activateWindow()
|
self.activateWindow()
|
||||||
elif msg.startswith('refreshdb:'):
|
elif msg.startswith('refreshdb:'):
|
||||||
@ -1658,7 +1663,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
self.spare_servers.pop().close()
|
self.spare_servers.pop().close()
|
||||||
self.device_manager.keep_going = False
|
self.device_manager.keep_going = False
|
||||||
self.cover_cache.stop()
|
self.cover_cache.stop()
|
||||||
self.hide()
|
self.hide_windows()
|
||||||
self.cover_cache.terminate()
|
self.cover_cache.terminate()
|
||||||
self.emailer.stop()
|
self.emailer.stop()
|
||||||
try:
|
try:
|
||||||
@ -1670,7 +1675,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
self.hide()
|
self.hide_windows()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def run_wizard(self, *args):
|
def run_wizard(self, *args):
|
||||||
@ -1694,7 +1699,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
'choose <b>Quit</b> in the context menu of the '
|
'choose <b>Quit</b> in the context menu of the '
|
||||||
'system tray.')).exec_()
|
'system tray.')).exec_()
|
||||||
dynamic['systray_msg'] = True
|
dynamic['systray_msg'] = True
|
||||||
self.hide()
|
self.hide_windows()
|
||||||
e.ignore()
|
e.ignore()
|
||||||
else:
|
else:
|
||||||
if self.confirm_quit():
|
if self.confirm_quit():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user