Changeset 1428
- Timestamp:
- 06/28/08 08:10:10 (5 months ago)
- Files:
-
- 1 modified
-
trunk/peppy/plugins/project.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/peppy/plugins/project.py
r1424 r1428 18 18 from peppy.actions import * 19 19 from peppy.lib.userparams import * 20 21 22 class SaveGlobalTemplate(OnDemandActionNameMixin, SelectAction): 23 """Save as the default (application-wide) template for this major mode. 24 """ 25 name = "Save as Global %s Template" 26 default_menu = (("Project/Templates", -700), -100) 27 28 def getMenuItemName(self): 29 return self.__class__.name % self.mode.keyword 30 31 def action(self, index=-1, multiplier=1): 32 pathname = ProjectPlugin.getFilename(self.mode.keyword) 33 dprint(pathname) 34 self.mode.save(pathname) 35 36 20 37 21 38 def findGlobalTemplate(subdir, mode, url): … … 39 56 except: 40 57 pass 41 template = "# template for %s\n\n" % str(url)42 return template 58 return None 59 43 60 44 61 class ProjectPlugin(IPeppyPlugin): … … 57 74 def deactivateHook(self): 58 75 Publisher().unsubscribe(self.getTemplate) 59 76 77 @classmethod 78 def getFilename(self, template_name): 79 return wx.GetApp().config.fullpath("%s/%s" % (self.classprefs.template_directory, template_name)) 80 60 81 def getTemplate(self, msg): 61 82 info = msg.data … … 63 84 if template: 64 85 info['templates'].append([1, template]) 86 87 def getCompatibleActions(self, mode): 88 if hasattr(mode, 'applyTemplate'): 89 return [SaveGlobalTemplate, 90 ] 91 return []
