#1941 HIGH Update.: Search key does nothing

Zarro Boogs per Child bugtracker at laptop.org
Thu Nov 1 07:42:46 EDT 2007


#1941: Search key does nothing
--------------------------+-------------------------------------------------
  Reporter:  Candy Lu     |       Owner:  rwh     
      Type:  enhancement  |      Status:  new     
  Priority:  high         |   Milestone:  Update.1
 Component:  sugar        |     Version:          
Resolution:               |    Keywords:  killjoy?
  Verified:  0            |  
--------------------------+-------------------------------------------------
Changes (by tomeu):

 * cc: marcopg (removed)
 * cc: marco, smcv (added)


Comment:

 {{{
 diff --git a/shell/view/keyhandler.py b/shell/view/keyhandler.py
 index 26a9fd5..dbb5caa 100644
 --- a/shell/view/keyhandler.py
 +++ b/shell/view/keyhandler.py

 @@ -78,6 +84,7 @@ class KeyHandler(object):
      def _change_volume(self, step=None, value=None):
          hw_manager = hardwaremanager.get_manager()

 +        self.journal_search('')
          if step is not None:
              volume = hw_manager.get_volume() + step
          elif value is not None:
 }}}

 I guess this is a leftover from some test, right?


 {{{
 @@ -173,6 +180,15 @@ class KeyHandler(object):
              pid = int(os.environ['SUGAR_EMULATOR_PID'])
              os.kill(pid, signal.SIGTERM)

 +    def journal_search(self, search_str):
 +        bus = dbus.SessionBus()
 +        journal = dbus.Interface(bus.get_object(J_DBUS_SERVICE,
 +            J_DBUS_PATH), J_DBUS_INTERFACE)
 +        journal.focus_search(search_str)
 +
 +    def handle_open_search(self):
 +        self.journal_search('')
 +
      def _key_pressed_cb(self, grabber, keycode, state):
          key = grabber.get_key(keycode, state)
          logging.debug('_key_pressed_cb: %i %i %s' % (keycode, state,
 key))
 }}}

 I'm not sure the best way to pass the filter is by using a string. Perhaps
 we should pass a dict and only accept the keywords 'query', 'activity',
 'mime_type' and 'mtime'?

 'query' would be a string that can contain *.
 'activity' another string that can contain a bundle id.
 'mime_type' a list of strings.
 'mtime' a dict of the form {'start': 1193917107.9856629, 'end':
 1193917107.9856629}

 This doesn't matter much by now, but will be needed for #4275. For this
 ticket we just need to change it to be a dictionary instead of a string.

 Style nitpick: what about this instead?

 {{{
 obj = bus.get_object(J_DBUS_SERVICE, J_DBUS_PATH)
 journal = dbus.Interface(obj, J_DBUS_INTERFACE)
 }}}

 {{{
 diff --git a/journalactivity.py b/journalactivity.py
 index 8d7df00..58907de 100755
 --- a/journalactivity.py
 +++ b/journalactivity.py
 @@ -38,6 +38,25 @@ DS_DBUS_SERVICE = 'org.laptop.sugar.DataStore'
  DS_DBUS_INTERFACE = 'org.laptop.sugar.DataStore'
  DS_DBUS_PATH = '/org/laptop/sugar/DataStore'

 +J_DBUS_SERVICE = 'org.laptop.Journal'
 +J_DBUS_INTERFACE = 'org.laptop.Journal'
 +J_DBUS_PATH = '/org/laptop/Journal'
 }}}

 I'm not sure creating a new dbus service is the right thing here, as every
 activity is already a dbus service. Simon, could you comment on this,
 please?

 The rest of the patch looks pretty good to me.

-- 
Ticket URL: <https://dev.laptop.org/ticket/1941#comment:21>
One Laptop Per Child <https://dev.laptop.org>
OLPC bug tracking system



More information about the Bugs mailing list