From b654b10b9933ff3f94a54b67699fc01a68ee47ae Mon Sep 17 00:00:00 2001 From: karasu Date: Wed, 26 Sep 2018 19:19:10 +0200 Subject: [PATCH] Stop slideshow when installation is finished --- README.md | 2 +- src/info.py | 2 +- src/pages/slides.py | 44 ++++++++++++++++++++++++++++---------------- update.info | 2 +- 4 files changed, 31 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index b240e5784..294d474c7 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ You are viewing the `0.17.x` branch (development). |Development Stage|Branch|Version| Code Status| ----------------- | -------------- | -------------- | -------- | -|Cnchi Stable|0.16.x|![0.16.2](https://img.shields.io/github/release/antergos/cnchi.svg)|Frozen| +|Cnchi Stable|0.16.x|![0.16.3](https://img.shields.io/github/release/antergos/cnchi.svg)|Frozen| |Cnchi Development|0.17.x|![0.17.1](https://img.shields.io/github/release/antergos/cnchi/all.svg)|Development| |Cnchi Next (UI agnostic)|master|master|Development| diff --git a/src/info.py b/src/info.py index 84e5df506..331b702c3 100755 --- a/src/info.py +++ b/src/info.py @@ -29,7 +29,7 @@ """ Set some Cnchi global constants """ -CNCHI_VERSION = "0.16.2" +CNCHI_VERSION = "0.16.3" """ Cnchi version """ CNCHI_WEBSITE = "http://www.antergos.com" diff --git a/src/pages/slides.py b/src/pages/slides.py index c5f91310f..5e379f628 100644 --- a/src/pages/slides.py +++ b/src/pages/slides.py @@ -83,6 +83,7 @@ def __init__(self, params, prev_page=None, next_page=None): self.revealer = self.gui.get_object('revealer1') self.revealer.connect('notify::child-revealed', self.image_revealed) self.slide = 0 + self.stop_slideshow = False GLib.timeout_add(Slides.MANAGE_EVENTS_TIMER, self.manage_events_from_cb_queue) @@ -116,27 +117,34 @@ def prepare(self, direction): def reveal_next_slide(self): """ Loads slide and reveals it """ - self.slide = ((self.slide + 1) % 3) + 1 - if 0 < self.slide <= 3: - data_dir = self.settings.get('data') - path = os.path.join(data_dir, 'images/slides', '{}.png'.format(self.slide)) - img = self.gui.get_object('slide1') - # img.set_from_file(path) - # 800x334 - pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(path, 820, 334, False) - # set the content of the image as the pixbuf - img.set_from_pixbuf(pixbuf) - # Reveal image - self.revealer.set_reveal_child(True) + if not self.stop_slideshow: + self.slide = ((self.slide + 1) % 3) + 1 + if 0 < self.slide <= 3: + try: + data_dir = self.settings.get('data') + path = os.path.join(data_dir, 'images/slides', + '{}.png'.format(self.slide)) + img = self.gui.get_object('slide1') + # img.set_from_file(path) + # 800x334 + pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale( + path, 820, 334, False) + # set the content of the image as the pixbuf + img.set_from_pixbuf(pixbuf) + # Reveal image + self.revealer.set_reveal_child(True) + except FileNotFoundError: + self.stop_slideshow = True def image_revealed(self, revealer, _revealed): """ Called when a image slide is shown revealer: Gtk.Revealer revealed: GParamBoolean """ - if revealer.get_child_revealed(): - GLib.timeout_add(Slides.SLIDESHOW_TIMER, self.hide_slide) - else: - self.reveal_next_slide() + if not self.stop_slideshow: + if revealer.get_child_revealed() and not self.stop_slideshow: + GLib.timeout_add(Slides.SLIDESHOW_TIMER, self.hide_slide) + else: + self.reveal_next_slide() def hide_slide(self): """ Hide image shown in slideshow, this will trigger image_revealed() @@ -269,6 +277,8 @@ def installation_finished(self): log_util = ContextFilter() log_util.send_install_result("True") + self.stop_slideshow = True + bootloader_install = self.settings.get('bootloader_install') bootloader_install_ok = self.settings.get('bootloader_installation_successful') @@ -302,6 +312,8 @@ def installation_finished(self): def install_error(self, error): """ A fatal error has been issued """ + self.stop_slideshow = True + # Empty the events queue self.empty_queue() diff --git a/update.info b/update.info index f3f44e03e..2d2533da2 100644 --- a/update.info +++ b/update.info @@ -1,2 +1,2 @@ -{"version":"0.16.2","files":[ +{"version":"0.16.3","files":[ ]}