def _addButtons(self): """initialize and add on screen buttons""" fsToggleButton = clutter.Texture('icons/view-fullscreen.png') (w, h) = fsToggleButton.get_size() fsToggleButton.set_size(2 * w, 2 * h) fsToggleButton.set_anchor_point(2 * w, 2 * h) fsToggleButton.set_reactive(True) fsToggleButton.set_opacity(0) self.layer.add(fsToggleButton) fsToggleButton.show() fsToggleButton.raise_top() (w1, h1) = self.gui.getStage().get_size() fsToggleButton.set_position(w1, h1) fsToggleButton.connect('button-release-event', self.do_button_release_event) fsToggleButton.connect('button-press-event', self.do_button_press_event) self.fsButton = fsToggleButton declutter.animate(self.fsButton, clutter.LINEAR, 100, [('opacity', 255)]) gobject.timeout_add(3000, self._hideFSButton, self.fsButton)
def _hideFSButton(self, button): self.fsButtonActive = False declutter.animate(button, clutter.LINEAR, 200, [('opacity', 0)]) #class Button(clutter.Texture): # pass
def do_button_release_event(self, button, event): if self.fsButtonLastPressTimestamp: """we only want to react on presses that start and end on the button and last a short time, so that the button does not interfere with dragging the page content""" if (event.time - self.fsButtonLastPressTimestamp) <= self.pressLength: if self.fsButtonActive: self.gui.toggleFullscreen() self.fsButtonActive = False else: self.fsButtonActive = True declutter.animate(self.fsButton,clutter.LINEAR,100,[('opacity',255)]) print("showing") timer = gobject.timeout_add(2000,self._hideFSButton, button)
def do_button_release_event(self, button, event): if self.fsButtonLastPressTimestamp: """we only want to react on presses that start and end on the button and last a short time, so that the button does not interfere with dragging the page content""" if (event.time - self.fsButtonLastPressTimestamp) <= self.pressLength: if self.fsButtonActive: self.gui.toggleFullscreen() self.fsButtonActive = False else: self.fsButtonActive = True declutter.animate(self.fsButton, clutter.LINEAR, 100, [('opacity', 255)]) print("showing") timer = gobject.timeout_add(2000, self._hideFSButton, button)
def _addButtons(self): """initialize and add on screen buttons""" fsToggleButton = clutter.Texture('icons/view-fullscreen.png') (w,h) = fsToggleButton.get_size() fsToggleButton.set_size(2*w,2*h) fsToggleButton.set_anchor_point(2*w,2*h) fsToggleButton.set_reactive(True) fsToggleButton.set_opacity(0) self.layer.add(fsToggleButton) fsToggleButton.show() fsToggleButton.raise_top() (w1,h1) = self.gui.getStage().get_size() fsToggleButton.set_position(w1,h1) fsToggleButton.connect('button-release-event',self.do_button_release_event) fsToggleButton.connect('button-press-event',self.do_button_press_event) self.fsButton = fsToggleButton declutter.animate(self.fsButton,clutter.LINEAR,100,[('opacity',255)]) gobject.timeout_add(3000,self._hideFSButton, self.fsButton)
def _hideFSButton(self, button): self.fsButtonActive = False declutter.animate(button,clutter.LINEAR,200,[('opacity',0)]) #class Button(clutter.Texture): # pass