mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Revert changes to window showing/hiding logic as they break starting of GUI
This commit is contained in:
parent
ad78fd2a68
commit
5adfd154bf
@ -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_windows)
|
self.show)
|
||||||
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()'),
|
||||||
@ -317,7 +317,6 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
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)
|
||||||
@ -403,9 +402,9 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
self.card_a_view.connect_dirtied_signal(self.upload_booklists)
|
self.card_a_view.connect_dirtied_signal(self.upload_booklists)
|
||||||
self.card_b_view.connect_dirtied_signal(self.upload_booklists)
|
self.card_b_view.connect_dirtied_signal(self.upload_booklists)
|
||||||
|
|
||||||
self.show_windows()
|
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_windows()
|
self.hide()
|
||||||
self.stack.setCurrentIndex(0)
|
self.stack.setCurrentIndex(0)
|
||||||
try:
|
try:
|
||||||
db = LibraryDatabase2(self.library_path)
|
db = LibraryDatabase2(self.library_path)
|
||||||
@ -522,22 +521,16 @@ 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()
|
for window in QApplication.topLevelWidgets():
|
||||||
|
if isinstance(window, (MainWindow, QDialog)) and \
|
||||||
|
window.isVisible():
|
||||||
|
window.hide()
|
||||||
|
setattr(window, '__systray_minimized', True)
|
||||||
else:
|
else:
|
||||||
self.show_windows()
|
for window in QApplication.topLevelWidgets():
|
||||||
|
if getattr(window, '__systray_minimized', False):
|
||||||
def hide_windows(self):
|
window.show()
|
||||||
for window in QApplication.topLevelWidgets():
|
setattr(window, '__systray_minimized', False)
|
||||||
if isinstance(window, (MainWindow, QDialog)) and \
|
|
||||||
window.isVisible():
|
|
||||||
window.hide()
|
|
||||||
setattr(window, '__systray_minimized', True)
|
|
||||||
|
|
||||||
def show_windows(self):
|
|
||||||
for window in QApplication.topLevelWidgets():
|
|
||||||
if getattr(window, '__systray_minimized', False):
|
|
||||||
window.show()
|
|
||||||
setattr(window, '__systray_minimized', False)
|
|
||||||
|
|
||||||
def test_server(self, *args):
|
def test_server(self, *args):
|
||||||
if self.content_server.exception is not None:
|
if self.content_server.exception is not None:
|
||||||
@ -648,7 +641,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_windows()
|
self.show()
|
||||||
self.raise_()
|
self.raise_()
|
||||||
self.activateWindow()
|
self.activateWindow()
|
||||||
elif msg.startswith('refreshdb:'):
|
elif msg.startswith('refreshdb:'):
|
||||||
@ -1665,7 +1658,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_windows()
|
self.hide()
|
||||||
self.cover_cache.terminate()
|
self.cover_cache.terminate()
|
||||||
self.emailer.stop()
|
self.emailer.stop()
|
||||||
try:
|
try:
|
||||||
@ -1677,7 +1670,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
self.hide_windows()
|
self.hide()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def run_wizard(self, *args):
|
def run_wizard(self, *args):
|
||||||
@ -1701,7 +1694,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_windows()
|
self.hide()
|
||||||
e.ignore()
|
e.ignore()
|
||||||
else:
|
else:
|
||||||
if self.confirm_quit():
|
if self.confirm_quit():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user