Show
Ignore:
Timestamp:
07/10/08 18:14:45 (4 months ago)
Author:
rob
Message:

Added build, run, and stop project commands
* changed output log to search upwards in the history looking for working directories when double clicking on a grep-like line
* added i18n text for process start/finish messages

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/peppy/plugins/project.py

    r1480 r1483  
    160160        StrParam('build_command', '', 'shell command to build project, relative to working directory', fullwidth=True), 
    161161        DirParam('run_dir', '', 'working directory in which to execute the project', fullwidth=True), 
    162         StrParam('run_command', '', 'shell command to executee project, relative to working directory', fullwidth=True), 
     162        StrParam('run_command', '', 'shell command to execute project, absolute path needed or will search current PATH environment variable', fullwidth=True), 
    163163        ) 
    164164     
     
    169169        self.loadPrefs() 
    170170        self.loadTags() 
     171        self.process = None 
    171172     
    172173    def __str__(self): 
     
    200201            dprint("Failed writing project config file") 
    201202     
    202     def build(self): 
     203    def registerProcess(self, job): 
     204        self.process = job 
     205     
     206    def deregisterProcess(self, job): 
     207        self.process = None 
     208     
     209    def isRunning(self): 
     210        return bool(self.process) 
     211     
     212    def build(self, frame): 
    203213        dprint("Compiling %s in %s" % (self.build_command, self.build_dir)) 
    204      
    205     def run(self): 
     214        output = JobOutputSidebarController(frame, self.registerProcess, self.deregisterProcess) 
     215        ProcessManager().run(self.build_command, self.build_dir, output) 
     216     
     217    def run(self, frame): 
    206218        dprint("Running %s in %s" % (self.run_command, self.run_dir)) 
     219        output = JobOutputSidebarController(frame, self.registerProcess, self.deregisterProcess) 
     220        ProcessManager().run(self.run_command, self.run_dir, output) 
     221     
     222    def stop(self): 
     223        if self.process: 
     224            self.process.kill() 
    207225 
    208226 
     
    327345 
    328346    def isEnabled(self): 
    329         return bool(self.mode.project_info and self.mode.project_info.build_command) 
    330  
    331     def action(self, index=-1, multiplier=1): 
    332         self.mode.project_info.build() 
     347        return bool(self.mode.project_info and self.mode.project_info.build_command and not self.mode.project_info.isRunning()) 
     348 
     349    def action(self, index=-1, multiplier=1): 
     350        self.mode.project_info.build(self.frame) 
    333351 
    334352 
     
    337355    name = "Run..." 
    338356    icon = 'icons/application.png' 
    339     default_menu = ("Project", 100) 
     357    default_menu = ("Project", 101) 
    340358 
    341359    def isEnabled(self): 
    342         return bool(self.mode.project_info and self.mode.project_info.run_command) 
    343  
    344     def action(self, index=-1, multiplier=1): 
    345         self.mode.project_info.run() 
     360        return bool(self.mode.project_info and self.mode.project_info.run_command and not self.mode.project_info.isRunning()) 
     361 
     362    def action(self, index=-1, multiplier=1): 
     363        self.mode.project_info.run(self.frame) 
     364 
     365 
     366class StopProject(SelectAction): 
     367    """Stop the build or run of the project""" 
     368    name = "Stop" 
     369    icon = 'icons/stop.png' 
     370    default_menu = ("Project", 109) 
     371 
     372    def isEnabled(self): 
     373        return bool(self.mode.project_info and self.mode.project_info.run_command and self.mode.project_info.isRunning()) 
     374 
     375    def action(self, index=-1, multiplier=1): 
     376        self.mode.project_info.stop() 
    346377 
    347378 
     
    622653            actions.append(SaveGlobalTemplate) 
    623654        if mode.buffer.url in self.known_project_dirs: 
    624             actions.extend([SaveProjectTemplate, BuildProject, RunProject, 
     655            actions.extend([SaveProjectTemplate, 
     656                             
     657                            BuildProject, RunProject, StopProject, 
    625658                             
    626659                            RebuildCtags, LookupCtag])