Skip to content
This repository has been archived by the owner on May 22, 2019. It is now read-only.

Commit

Permalink
Stop slideshow when installation is finished
Browse files Browse the repository at this point in the history
  • Loading branch information
karasu committed Sep 26, 2018
1 parent 958c966 commit b654b10
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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|

Expand Down
2 changes: 1 addition & 1 deletion src/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
44 changes: 28 additions & 16 deletions src/pages/slides.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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')

Expand Down Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion update.info
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{"version":"0.16.2","files":[
{"version":"0.16.3","files":[
]}

0 comments on commit b654b10

Please sign in to comment.