Changeset 1442
- Timestamp:
- 07/01/08 21:49:50 (5 months ago)
- Files:
-
- 1 modified
-
trunk/peppy/plugins/project.py (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/peppy/plugins/project.py
r1438 r1442 20 20 from peppy.actions import * 21 21 from peppy.lib.userparams import * 22 from peppy.lib.processmanager import * 22 23 23 24 … … 31 32 ) 32 33 33 def loadTags(self):34 def getTagFileURL(self): 34 35 if self.tags_file_location == 0: 35 36 base = self.project_top_dir … … 37 38 base = self.project_settings_dir 38 39 url = base.resolve2(ProjectPlugin.classprefs.ctags_tag_file_name) 40 return url 41 42 def regenerateTags(self): 43 # need to operate on the local filesystem 44 dprint(self.project_top_dir) 45 if self.project_top_dir.scheme != "file": 46 raise TypeError("Can only process ctags on local filesystem") 47 cwd = str(self.project_top_dir.path) 48 ctags_file = str(self.getTagFileURL().path) 49 wildcards = self.ctags_exclude.split() 50 excludes = " ".join(["--exclude=%s" % w for w in wildcards]) 51 args = "-o %s %s %s %s" % (ctags_file, ProjectPlugin.classprefs.ctags_args, self.ctags_extra_args, excludes) 52 cmd = "%s %s" % (ProjectPlugin.classprefs.ctags_command, args) 53 dprint(cmd) 54 55 output = JobOutputSaver(self.regenerateFinished) 56 ProcessManager().run(cmd, cwd, output) 57 58 def regenerateFinished(self, output): 59 dprint(output) 60 if output.exit_code == 0: 61 self.loadTags() 62 else: 63 Publisher().sendMessage('peppy.log.error', output.getErrorText()) 64 65 def loadTags(self): 66 url = self.getTagFileURL() 39 67 self.parseCtags(url) 40 68 … … 144 172 145 173 174 class RebuildCtags(SelectAction): 175 """Rebuild tag file""" 176 name = "Rebuild Tag File" 177 default_menu = ("Project", -500) 178 179 def action(self, index=-1, multiplier=1): 180 if self.mode.project_info: 181 info = self.mode.project_info 182 info.regenerateTags() 183 184 146 185 class SaveGlobalTemplate(OnDemandActionNameMixin, SelectAction): 147 186 """Save as the default (application-wide) template for this major mode. … … 185 224 186 225 def isEnabled(self): 187 return bool(ProjectPlugin.getProjectInfo(self.mode)) 188 189 def action(self, index=-1, multiplier=1): 190 project = ProjectPlugin.getProjectInfo(self.mode) 191 project.build() 226 return bool(self.mode.project_info and self.mode.project_info.build_command) 227 228 def action(self, index=-1, multiplier=1): 229 self.mode.project_info.build() 192 230 193 231 … … 199 237 200 238 def isEnabled(self): 201 return bool(ProjectPlugin.getProjectInfo(self.mode)) 202 203 def action(self, index=-1, multiplier=1): 204 project = ProjectPlugin.getProjectInfo(self.mode) 205 project.run() 239 return bool(self.mode.project_info and self.mode.project_info.run_command) 240 241 def action(self, index=-1, multiplier=1): 242 self.mode.project_info.run() 206 243 207 244 … … 400 437 actions.append(SaveGlobalTemplate) 401 438 if mode.buffer.url in self.known_project_dirs: 402 actions.extend([SaveProjectTemplate, BuildProject, RunProject ])439 actions.extend([SaveProjectTemplate, BuildProject, RunProject, RebuildCtags]) 403 440 actions.append(ShowProjectSettings) 404 441 return actions … … 409 446 410 447 if __name__== "__main__": 448 app = wx.PySimpleApp() 411 449 ctags = ProjectInfo(vfs.normalize("/home/rob/src/peppy-git/.peppy-project")) 412 450 print ctags.getTag('GetValue') 451 ctags.regenerateTags()
