mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Restore Jobs window if it was open when using restore system tray icon menu.
This commit is contained in:
parent
2d39bceb64
commit
3d9232b738
@ -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()'),
|
||||||
@ -517,12 +517,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()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user