Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/webactivity.py
diff options
context:
space:
mode:
authorManuel Kaufmann <humitos@gmail.com>2012-09-24 18:52:04 (GMT)
committer Manuel QuiƱones <manuq@laptop.org>2012-09-25 14:17:03 (GMT)
commit41968d61a320632cabc0dd7ad2805c9f6fedb54c (patch)
tree03cff4f363ce5509b884af68b2e379beb8501ab7 /webactivity.py
parent4d153b64f8c65f00835f6a07bc99ed768ae715b8 (diff)
Escape key stops page loading SL #3373
Allow Esc key to stop page loading. If the activity is on fullscreen mode, the first time that Esc key is pressed the page loading will stop and the second time it will call unfullscreen mode. Signed-off-by: Manuel Kaufmann <humitos@gmail.com> Acked-by: Manuel QuiƱones <manuq@laptop.org>
Diffstat (limited to 'webactivity.py')
-rw-r--r--webactivity.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/webactivity.py b/webactivity.py
index 24f3b44..cdd556f 100644
--- a/webactivity.py
+++ b/webactivity.py
@@ -204,6 +204,9 @@ class WebActivity(activity.Activity):
self.model = Model()
self.model.connect('add_link', self._add_link_model_cb)
+ # HACK to allow Escape key stop loading on fullscreen mode
+ # http://bugs.sugarlabs.org/ticket/1434
+ self.disconnect_by_func(self._Window__key_press_cb)
self.connect('key-press-event', self._key_press_cb)
if handle.uri:
@@ -426,6 +429,29 @@ class WebActivity(activity.Activity):
self._tabbed_view.load_homepage()
def _key_press_cb(self, widget, event):
+ # HACK: this is the hacked version of
+ # sugar3.graphics.Window.__key_press_cb function to allow stop
+ # loading on fullscreen
+ def __key_press_cb(widget, event):
+ status = self._tabbed_view.props.current_browser.get_load_status()
+ loading = WebKit.LoadStatus.PROVISIONAL <= status \
+ < WebKit.LoadStatus.FINISHED
+
+ key = Gdk.keyval_name(event.keyval)
+ if event.get_state() & Gdk.ModifierType.MOD1_MASK:
+ if self.tray is not None and key == 'space':
+ self.tray.props.visible = not self.tray.props.visible
+ return True
+ elif key == 'Escape' and self._is_fullscreen and \
+ self.props.enable_fullscreen_mode and \
+ not loading:
+ self.unfullscreen()
+ return True
+ return False
+
+ # Call the original sugar3.graphics.Window.__key_press_cb function
+ __key_press_cb(widget, event)
+
key_name = Gdk.keyval_name(event.keyval)
browser = self._tabbed_view.props.current_browser
@@ -482,6 +508,10 @@ class WebActivity(activity.Activity):
return True
+ elif key_name == 'Escape':
+ _logger.debug('keyboard: Stop loading')
+ browser.stop_loading()
+
return False
def _add_link(self):