diff --git a/src/calibre/gui2/cover_flow.py b/src/calibre/gui2/cover_flow.py index 67b448e7a6..5c997ca4c0 100644 --- a/src/calibre/gui2/cover_flow.py +++ b/src/calibre/gui2/cover_flow.py @@ -209,6 +209,11 @@ class CoverFlow(pictureflow.PictureFlow): else: super().paintEvent(ev) + def resizeEvent(self, ev): + if ev.oldSize() == QSize(-1, -1): + self.created_at = time.monotonic() + super().resizeEvent(ev) + def __init__(self, parent=None): pictureflow.PictureFlow.__init__(self, parent, config['cover_flow_queue_length']+1) diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py index 12b959a5f2..de2f71fbd5 100644 --- a/src/calibre/gui2/ui.py +++ b/src/calibre/gui2/ui.py @@ -428,7 +428,6 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{ QTimer.singleShot(10, self.show_gui_debug_msg) self.iactions['Connect Share'].check_smartdevice_menus() - QTimer.singleShot(1, self.start_smartdevice) QTimer.singleShot(100, self.update_toggle_to_tray_action) def post_initialize_actions(self, show_gui, do_hide_windows): @@ -452,6 +451,13 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{ # up with the wrong size. I don't know why. self.bd_splitter.repaint() + # Start the smartdevice later so that the network time doesn't affect + # the gui repaint debouncing. Wait 3 seconds before starting to be sure + # that all other initialization (plugins etc) has completed. Yes, 3 + # seconds is an arbitrary value and probably too long, but it will do + # until the underlying structure changes to make it unnecessary. + QTimer.singleShot(3000, self.start_smartdevice) + def start_quickview(self): from calibre.gui2.actions.show_quickview import get_quickview_action_plugin qv = get_quickview_action_plugin() @@ -487,13 +493,15 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{ self.focus_current_view() def start_smartdevice(self): + timed_print('Starting the smartdevice driver') message = None if self.device_manager.get_option('smartdevice', 'autostart'): try: message = self.device_manager.start_plugin('smartdevice') - except: - message = 'start smartdevice unknown exception' - prints(message) + timed_print('Finished starting smartdevice') + except Exception as e: + message = str(e) + timed_print(f'Starting smartdevice driver failed: {message}') import traceback traceback.print_exc() if message: