From 6a7df6acd6aa520b991047ce482d9130e0e1efea Mon Sep 17 00:00:00 2001 From: Cimbali Date: Tue, 16 Apr 2024 19:51:09 +0100 Subject: [PATCH] Fix deck overview Fixes #311 - Remove unused argument - Respect preference for displaying all pages - Update cached mode for deck widgets --- pympress/deck.py | 5 ++--- pympress/ui.py | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pympress/deck.py b/pympress/deck.py index c1d7d3d4..dba461e6 100644 --- a/pympress/deck.py +++ b/pympress/deck.py @@ -39,7 +39,6 @@ class Overview(builder.Builder): Args: config (:class:`~pympress.config.Config`): A config object containing preferences builder (:class:`~pympress.builder.Builder`): A builder from which to load widgets - notes_mode (`bool`): The current notes mode, i.e. whether we display the notes on second slide """ #: Whether we are displaying the deck overview on screen deck_mode = False @@ -79,7 +78,7 @@ class Overview(builder.Builder): #: The :class:`~Gtk.DrawingArea` in the content window c_da = None - def __init__(self, config, builder, notes_mode): + def __init__(self, config, builder): super(Overview, self).__init__() self.cache = builder.cache @@ -141,7 +140,7 @@ def try_cancel(self): def create_drawing_areas(self): """ Build DrawingArea and AspectFrame elements to display later on """ - pages = self.get_last_label_pages() if self.has_labels() else range(self.pages_number()) + pages = self.get_last_label_pages() if not self.all_pages and self.has_labels() else range(self.pages_number()) self.grid_size = (len(pages), 1) # Always keep the first drawing area as it is used to provide surfaces in the cache diff --git a/pympress/ui.py b/pympress/ui.py index b372980e..33e4da52 100644 --- a/pympress/ui.py +++ b/pympress/ui.py @@ -261,7 +261,7 @@ def __init__(self, app, config): self.zoom = extras.Zoom(self) self.scribbler = scribble.Scribbler(self.config, self, self.notes_mode) - self.deck = deck.Overview(self.config, self, self.notes_mode) + self.deck = deck.Overview(self.config, self) self.annotations = extras.Annotations(self) self.medias = extras.Media(self, self.config) self.laser = pointer.Pointer(self.config, self) @@ -1836,6 +1836,7 @@ def switch_mode(self, gaction, target_mode=None, force=False): self.cache.set_widget_type('p_da_cur_zoomed', page_type) self.cache.set_widget_type('scribble_p_da', page_type) self.cache.set_widget_type('p_da_notes', self.notes_mode) + self.cache.set_widget_type('deck', page_type) if self.notes_mode: self.cache.enable_prerender('p_da_notes')