Add a library entry to the File menu

Registered by Stani

The library can point to some "editor pick" action lists and would display them in a list just like Recent.

Blueprint information

Status:
Complete
Approver:
Stani
Priority:
Low
Drafter:
Stani
Direction:
Approved
Assignee:
Stani
Definition:
Approved
Series goal:
Accepted for 0.2
Implementation:
Implemented
Milestone target:
milestone icon 0.2.1
Started by
Stani
Completed by
Stani

Related branches

Sprints

Whiteboard

TODO:
Tools>Update>actionlists or automatically

$ bzr commit -m "added library"
Committing to: /home/stani/sync/python/phatch/trunk/
modified phatch/pyWx/gui.py
Committed revision 662.

=== modified file 'phatch/data/version.py'
--- phatch/data/version.py 2009-06-05 23:57:05 +0000
+++ phatch/data/version.py 2009-06-06 01:46:25 +0000
@@ -15,5 +15,5 @@
 # along with this program. If not, see http://www.gnu.org/licenses/

 BASE = "0.2.0"
-VERSION = "0.2.0.bzr662"
-DATE = "Sat, 06 Jun 2009 01:57:03"
+VERSION = "0.2.0.bzr664"
+DATE = "Sat, 06 Jun 2009 03:46:21"

=== modified file 'phatch/pyWx/gui.py'
--- phatch/pyWx/gui.py 2009-06-05 23:56:23 +0000
+++ phatch/pyWx/gui.py 2009-06-06 01:42:47 +0000
@@ -262,8 +262,24 @@
         self._set_file_history(self.get_setting('file_history'))
         self.Bind(wx.EVT_MENU_RANGE, self.on_menu_file_history,
             id=wx.ID_FILE1, id2=wx.ID_FILE9)
- self.menu_file.AppendMenu(wx.ID_REFRESH, _("&Recent"),
+ self.menu_file.InsertMenu(2,wx.ID_REFRESH, _("Open &Recent"),
             self.menu_file_recent, "")
+ #library
+ actionlists = [(api.title(a),a)
+ for a in wx.GetApp().get_action_list_files()]
+ actionlists.sort()
+ library = self.menu_file_library = wx.Menu()
+ prefix = len(actionlists) < 10
+ self.library_files = {}
+ for index, actionlist in enumerate(actionlists):
+ id = wx.NewId()
+ label = actionlist[0]
+ if prefix:
+ label = '&%d %s'%(index+1,label)
+ item = library.Append(id,label)
+ self.library_files[id] = actionlist[1]
+ self.Bind(wx.EVT_MENU, self.on_menu_file_library, item)
+ self.menu_file.InsertMenu(3,wx.ID_EDIT, _("Open &Library"),library,"")
         #shell
         self.shell = None
         #menu_item (for enabling/disabling)
@@ -376,6 +392,9 @@
             self._open(filename)
         dlg.Destroy()

+ def on_menu_file_library(self,event):
+ self._open(self.library_files[event.GetId()])
+
     def on_menu_file_save(self, event):
         if self.filename == ct.UNKNOWN:
             self.on_menu_file_save_as()

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.