[kupfer: 31/51] Update execute_file to use display and timestamp
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [kupfer: 31/51] Update execute_file to use display and timestamp
- Date: Mon, 28 Mar 2011 15:03:40 +0000 (UTC)
commit a3b326f2cff3799ddfcf8a230ca7adf33dc0e35c
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Mon Mar 28 16:51:46 2011 +0200
Update execute_file to use display and timestamp
kupfer/core/data.py | 2 +-
kupfer/ui/browser.py | 14 +++++---------
kupfer/ui/uievents.py | 4 ++--
3 files changed, 8 insertions(+), 12 deletions(-)
---
diff --git a/kupfer/core/data.py b/kupfer/core/data.py
index 96c461e..0b9c124 100644
--- a/kupfer/core/data.py
+++ b/kupfer/core/data.py
@@ -780,7 +780,7 @@ class DataController (gobject.GObject, pretty.OutputMixin):
if panectl.browse_down(alternate=alternate):
learn.record_search_hit(sel, key)
- def activate(self, ui_ctx=None):
+ def activate(self, ui_ctx):
"""
Activate current selection
diff --git a/kupfer/ui/browser.py b/kupfer/ui/browser.py
index 4ae7480..4e62930 100644
--- a/kupfer/ui/browser.py
+++ b/kupfer/ui/browser.py
@@ -1492,8 +1492,7 @@ class Interface (gobject.GObject):
def _make_gui_ctx(self):
timestamp = uievents.current_event_time()
- return uievents.gui_context_from_toplevel(timestamp,
- self._widget.get_toplevel())
+ return uievents.gui_context_from_widget(timestamp, self._widget)
def _activate(self, widget, current):
self.data_controller.activate(ui_ctx=self._make_gui_ctx())
@@ -1502,16 +1501,15 @@ class Interface (gobject.GObject):
"""Activate current selection (Run action)"""
self._activate(None, None)
- def execute_file(self, filepath):
+ def execute_file(self, filepath, display, timestamp):
"""Execute a .kfcom file"""
def _handle_error(exc_info):
from kupfer import uiutils
etype, exc, tb = exc_info
if not uiutils.show_notification(unicode(exc), icon_name="kupfer"):
raise
- self.data_controller.execute_file(filepath, self._make_gui_ctx(),
- on_error=_handle_error)
-
+ ctxenv = uievents.gui_context_from_keyevent(timestamp, display)
+ self.data_controller.execute_file(filepath, ctxenv, _handle_error)
def _search_result(self, sender, pane, matchrankable, matches, context):
# NOTE: "Always-matching" search.
@@ -2082,7 +2080,6 @@ class WindowController (pretty.OutputMixin):
self.window.window.focus(timestamp=timestamp)
self.interface.focus()
-
def put_away(self):
self.interface.put_away()
self.window.hide()
@@ -2122,8 +2119,7 @@ class WindowController (pretty.OutputMixin):
self.interface.put_files(fileuris)
def on_execute_file(self, sender, filepath, display, timestamp):
- # FIXME
- self.interface.execute_file(filepath)
+ self.interface.execute_file(filepath, display, timestamp)
def _close_window(self, window, event):
self.put_away()
diff --git a/kupfer/ui/uievents.py b/kupfer/ui/uievents.py
index 86426af..eee72ba 100644
--- a/kupfer/ui/uievents.py
+++ b/kupfer/ui/uievents.py
@@ -6,8 +6,8 @@ import gtk
from kupfer import pretty
from kupfer.ui import keybindings
-def gui_context_from_toplevel(timestamp, toplevel):
- return GUIEnvironmentContext(timestamp, toplevel.get_screen())
+def gui_context_from_widget(timestamp, widget):
+ return GUIEnvironmentContext(timestamp, widget.get_screen())
def gui_context_from_timestamp(timestamp):
return GUIEnvironmentContext(timestamp, None)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]