Trees | Indices | Help |
|
---|
|
1 #!/usr/bin/env python 2 3 ### BITPIM 4 ### 5 ### Copyright (C) 2006-2006 Simon Capper <skyjnky@sbcglobal.net> 6 ### 7 ### This program is free software; you can redistribute it and/or modify 8 ### it under the terms of the BitPim license as detailed in the LICENSE file. 9 ### 10 ### $Id: widgets.py 3890 2007-01-11 03:28:43Z djpham $ 11 12 ### base class for all widgets 13 14 import wx 15 import re 16 17 import helpids 18 import bphtml 1921 MENU_NORMAL=wx.ITEM_NORMAL 22 MENU_SPACER=wx.ITEM_SEPARATOR 23 MENU_CHECK=wx.ITEM_CHECK 24 2717829 self.id=id 30 self._tree=tree 31 self.root=root 32 self.config=config 33 self.OnInit() 34 if help_id==None: 35 try: 36 id_name=re.sub("[^A-Za-z]", "",self.GetWidgetName().upper()) 37 self.help_id=getattr(helpids, "ID_TAB_"+id_name) 38 except: 39 self.help_id=helpids.ID_WELCOME 40 else: 41 self.help_id=help_id42 45 48 5153 """Default does nothing, override to provide specific functionality. 54 node equals value returned from AddNode. 55 """ 56 pass5759 menu=self.GetRightClickMenuItems(node) 60 if len(menu): 61 popup_menu=wx.Menu() 62 for menu_item in menu: 63 type, id, name, tooltip=menu_item 64 if type==self.MENU_SPACER: 65 # using append with a type of separator does not work for some reason? 66 popup_menu.AppendSeparator() 67 else: 68 popup_menu.Append(id, name, tooltip, type) 69 parent.PopupMenu(popup_menu, pt) 70 self.OnRightClickMenuExit()7173 return self._tree.GetItemText(self.id)7476 return self.help_id77 82 83 # override these functions to access menu/toolbar items 84 # each command has a "Can" function, this controls greying 85 # out options that are not supported by the widget 8688 """Default does nothing, override to provide specific functionality. 89 node equals value returned from AddNode. 90 Return array of (type, ID, name, tootltip) tuples to be used in the popup menu 91 Valid types are "menu", 92 """ 93 result=[] 94 return result95 98 101 104 107 110 113 116 119 122 125 128 131 134 137 140 143 146 149 152 155 158 161 164 167 170 173180 # This page is copied out of the welcome.htm page of the BitPim help 181 # Obviously, it needs to be in sync with the BitPim help. 182 welcome_text=""" 183 <html> 184 <head><title>Welcome</title> 185 </head> 186 <body> 187 <h1>Welcome</h1> 188 189 <p>Welcome to BitPim. 190 191 <p>If you are new to BitPim, please take the <a href="tour-master.htm">tour</a>. 192 <p>BitPim's homepage is <a href="http://www.bitpim.org" target="bitpimhelpexternallink">www.bitpim.org</a>. 193 The project page is <a href="http://www.sourceforge.net/projects/bitpim" target="bitpimhelpexternallink">www.sourceforge.net/projects/bitpim</a>. 194 195 <p>You may be interested in <a href="upgrading.htm">upgrade information</a> or the 196 <a href="versionhistory.htm">version history</a>. 197 198 <p>If you have any problems or questions please read the <a href="support.htm">information about support</a>. 199 200 <p>Praise and <a href="contributing.htm">contributions</a> are always welcome! 201 202 <hr> 203 </body></html> 204 """ 205217210 _ref=link.GetHref() 211 if _ref.startswith('http'): 212 # web link 213 super(RootWidget, self).OnLinkClicked(link) 214 else: 215 # Help topic 216 wx.GetApp().displayhelpid(str(_ref))
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sun Jan 24 16:21:51 2010 | http://epydoc.sourceforge.net |