On 01/23/2012 11:12 PM, Simon Schampijer wrote:
[...]
While thinking further about how to best solve this issue I came across
the search key (magnifier icon on the olpc keyboard or F5 on non-olpc
hardware) which we have to get to the Journal quickly. I wondered if it
would be a good idea to let that key reveal the detail view of the
Journal entry when pressed while the activity is open. This might be a
nice and quick way to write notes. You could toggle the views quickly
with the 'search' and 'activity' keys. The downside here is that you do
not see what you write about while writing and it might not be as
discoverable and with non-keyboard Sugar you don't have that option. But
it might be a nice thing to have on top of Walter's approach. (I have
hacked up a quick patch and technically it is doable).

Attached is the patch to bring up the Journal detail view when you press the "search key/F5" while having an activity focused (start Sugar, open Browse, hit "search key/F5").

For a quick toggle of the views you would expect the "activity key/F4" bring you back to the activity now. This is currently not possible because the Journal itself is considered an activity and is part of the list of activities, hence after pressing "search key/F5" the Journal is the current active activity.

In general I think the Journal should not be considered an activity and should be a view (hence neighborhood/goups/home/activity/journal) instead. That would not only make this use case easier it would as well tabbing through activities feel more right (at the moment the 'tabbing-list' includes the Journal which I always found to be confusing).

What do others think about this general change in behavior? Something that is a good path forward? Or do you feel the search key is too overloaded that way?

Walter was mentioning that he would like to see the detail view being part of the main view [1]. If that change is computationally possible, we can apply the same logic, when you hit "search key/F5" while over an activity you will be brought to the Journal and the entry is expanded, if you hit "search key/F5" in any other view (or an activity has no Journal object associated) you will get to the Journal view with no entry expanded.

Regards,
   Simon

[1] http://wiki.sugarlabs.org/go/Design_Team/Designs/Journal#02
diff --git a/src/jarabe/journal/journalactivity.py b/src/jarabe/journal/journalactivity.py
index bb1c7f6..0ec33bb 100644
--- a/src/jarabe/journal/journalactivity.py
+++ b/src/jarabe/journal/journalactivity.py
@@ -358,6 +358,16 @@ class JournalActivity(JournalWindow):
     def focus_search(self):
         """Become visible and give focus to the search entry
         """
+        from jarabe.model import shell
+        shell_model = shell.get_model()
+        if shell_model.zoom_level == shell_model.ZOOM_ACTIVITY:
+            active_activity = shell_model.get_active_activity()
+            if not active_activity.is_journal():
+                object_id = model.get_object_id(active_activity.get_activity_id())
+                if object_id:
+                    self.reveal()
+                    self.show_object(object_id)
+                    return
         self.reveal()
         self.show_main_view()
         self.search_grab_focus()
diff --git a/src/jarabe/journal/model.py b/src/jarabe/journal/model.py
index 5285a7c..8a83477 100644
--- a/src/jarabe/journal/model.py
+++ b/src/jarabe/journal/model.py
@@ -489,6 +489,17 @@ def _get_file_metadata_from_json(dir_path, filename, fetch_preview):
     return metadata
 
 
+def get_object_id(activity_id):
+    query = {}
+    properties = []
+    query['activity_id'] = activity_id
+    entries, total_count = _get_datastore().find(query, properties,
+                                                     byte_arrays=True)
+    if entries:
+        return entries[0]['uid']
+    return None
+
+
 def _get_datastore():
     global _datastore
     if _datastore is None:
_______________________________________________
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel

Reply via email to