Mercurial > libervia-web
comparison libervia/pages/_browser/slideshow.py @ 1311:9948598e7ec0
browser (slideshow): show slideshow in fullscreen
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 01 Aug 2020 16:47:24 +0200 |
parents | 9e356f8eb62c |
children | 39a87d9099c4 |
comparison
equal
deleted
inserted
replaced
1310:9e356f8eb62c | 1311:9948598e7ec0 |
---|---|
78 self.slideshow_elt.select_one(".click_to_close").bind("click", self.on_close) | 78 self.slideshow_elt.select_one(".click_to_close").bind("click", self.on_close) |
79 self.slideshow_elt.select_one(".click_to_comment").bind("click", self.on_comment) | 79 self.slideshow_elt.select_one(".click_to_comment").bind("click", self.on_comment) |
80 self.swiper.on("slideChange", self.on_slide_change) | 80 self.swiper.on("slideChange", self.on_slide_change) |
81 self.swiper.on("click", self.on_click) | 81 self.swiper.on("click", self.on_click) |
82 self.on_slide_change() | 82 self.on_slide_change() |
83 self.fullscreen(True) | |
83 | 84 |
84 def add_slide(self, slide_elt): | 85 def add_slide(self, slide_elt): |
85 self.swiper.appendSlide([slide_elt]) | 86 self.swiper.appendSlide([slide_elt]) |
86 self.swiper.update() | 87 self.swiper.update() |
87 | 88 |
92 self.hidden_elts.clear() | 93 self.hidden_elts.clear() |
93 self.slideshow_elt.remove() | 94 self.slideshow_elt.remove() |
94 self.slideshow_elt = None | 95 self.slideshow_elt = None |
95 self.swiper.destroy(True, True) | 96 self.swiper.destroy(True, True) |
96 self.swiper = None | 97 self.swiper = None |
98 | |
99 def fullscreen(self, active=None): | |
100 """Activate/desactivate fullscreen | |
101 | |
102 @param acvite: can be: | |
103 - True to activate | |
104 - False to desactivate | |
105 - Auto to switch fullscreen mode | |
106 """ | |
107 try: | |
108 fullscreen_elt = document.fullscreenElement | |
109 request_fullscreen = self.slideshow_elt.requestFullscreen | |
110 except AttributeError: | |
111 print("fullscreen is not available on this browser") | |
112 else: | |
113 if active is None: | |
114 active = fullscreen_elt != None | |
115 if active: | |
116 request_fullscreen() | |
117 else: | |
118 try: | |
119 document.exitFullscreen() | |
120 except AttributeError: | |
121 print("exitFullscreen not available on this browser") | |
97 | 122 |
98 def on_key_down(self, evt): | 123 def on_key_down(self, evt): |
99 if evt.key == 'Escape': | 124 if evt.key == 'Escape': |
100 self.quit() | 125 self.quit() |
101 else: | 126 else: |