Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar

This commit is contained in:
Marco Pesenti Gritti 2007-11-02 11:04:56 +01:00
commit b6422678e6
2 changed files with 18 additions and 1 deletions

2
NEWS
View File

@ -1,3 +1,5 @@
* #1941 Call FocusSearch method for popping up the journal. (rwh)
Snapshot 2df96b9af7 Snapshot 2df96b9af7
* #4552 Allow to open images in Paint (marco) * #4552 Allow to open images in Paint (marco)

View File

@ -57,9 +57,15 @@ _actions_table = {
'<ctrl><alt>Tab' : 'previous_window', '<ctrl><alt>Tab' : 'previous_window',
'<alt>p' : 'previous_window', '<alt>p' : 'previous_window',
'<ctrl>Escape' : 'close_window', '<ctrl>Escape' : 'close_window',
'<ctrl>q' : 'close_window' '<ctrl>q' : 'close_window',
'0xDC' : 'open_search',
'<ctrl>o' : 'open_search'
} }
J_DBUS_SERVICE = 'org.laptop.Journal'
J_DBUS_PATH = '/org/laptop/Journal'
J_DBUS_INTERFACE = 'org.laptop.Journal'
class KeyHandler(object): class KeyHandler(object):
def __init__(self, shell): def __init__(self, shell):
self._shell = shell self._shell = shell
@ -173,6 +179,15 @@ class KeyHandler(object):
pid = int(os.environ['SUGAR_EMULATOR_PID']) pid = int(os.environ['SUGAR_EMULATOR_PID'])
os.kill(pid, signal.SIGTERM) os.kill(pid, signal.SIGTERM)
def focus_journal_search(self):
bus = dbus.SessionBus()
obj = bus.get_object(J_DBUS_SERVICE, J_DBUS_PATH)
journal = dbus.Interface(obj, J_DBUS_INTERFACE)
journal.FocusSearch({})
def handle_open_search(self):
self.focus_journal_search()
def _key_pressed_cb(self, grabber, keycode, state): def _key_pressed_cb(self, grabber, keycode, state):
key = grabber.get_key(keycode, state) key = grabber.get_key(keycode, state)
logging.debug('_key_pressed_cb: %i %i %s' % (keycode, state, key)) logging.debug('_key_pressed_cb: %i %i %s' % (keycode, state, key))