Changeset 1439
- Timestamp:
- 07/01/08 21:49:42 (5 months ago)
- Location:
- trunk
- Files:
-
- 4 modified
-
peppy/major.py (modified) (5 diffs)
-
peppy/plugins/error_log.py (modified) (2 diffs)
-
peppy/sidebar.py (modified) (2 diffs)
-
tests/samples/job-control.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/peppy/major.py
r1429 r1439 42 42 from peppy.debug import * 43 43 from peppy.minor import * 44 from peppy.sidebar import * 44 45 from peppy.yapsy.plugins import * 45 46 from peppy.editra import * … … 949 950 PathParam('interpreter_exe', '', 'Program that can interpret this text and return results on standard output', fullwidth=True), 950 951 BoolParam('autosave_before_run', True, 'Automatically save without prompting before running script'), 952 IndexChoiceParam('output_log', 953 ['use minor mode', 'use sidebar'], 954 1, 'Does the output stay in the tab (minor mode) or visible to all tabs in the frame (major mode)'), 951 955 ) 952 956 … … 1052 1056 else: 1053 1057 cmd = self.getCommandLine(bangpath) 1054 ProcessManager().run(cmd, self.buffer.cwd(), self) 1055 1058 if self.classprefs.output_log == 0: 1059 output = self 1060 else: 1061 output = JobOutputSidebarController(self.frame, self.registerProcess, self.deregisterProcess) 1062 ProcessManager().run(cmd, self.buffer.cwd(), output) 1063 1064 def registerProcess(self, job): 1065 self.process = job 1066 1067 def deregisterProcess(self, job): 1068 del self.process 1069 1056 1070 def stopInterpreter(self): 1057 1071 """Interface used by actions to kill the currently running job. … … 1071 1085 self.log = self.findMinorMode("OutputLog") 1072 1086 if self.log: 1073 self.log.showMessage("\n" + _("Started %s on %s") % 1074 (job.cmd, 1075 time.asctime(time.localtime(time.time()))) + 1076 "\n") 1087 text = "\n" + _("Started %s on %s") % (job.cmd, time.asctime(time.localtime(time.time()))) + "\n" 1088 self.log.showMessage(text) 1077 1089 1078 1090 def stdoutCallback(self, job, text): … … 1091 1103 del self.process 1092 1104 if self.log: 1093 self.log.showMessage(_("Finished %s on %s") % 1094 (job.cmd, 1095 time.asctime(time.localtime(time.time()))) + 1096 "\n") 1105 text = "\n" + _("Finished %s on %s") % (job.cmd, time.asctime(time.localtime(time.time()))) + "\n" 1106 self.log.showMessage(text) 1097 1107 1098 1108 -
trunk/peppy/plugins/error_log.py
r1393 r1439 140 140 141 141 def showError(self, message=None): 142 if self.frame == wx.GetApp().GetTopWindow(): 143 paneinfo = self.frame._mgr.GetPane(self) 142 data = message.data 143 if isinstance(data, tuple) or isinstance(data, list): 144 frame = data[0] 145 text = data[1] 146 else: 147 frame = wx.GetApp().GetTopWindow() 148 text = data 149 if self.frame == frame: 150 paneinfo = frame._mgr.GetPane(self) 144 151 if self.classprefs.unhide_on_message: 145 152 if not paneinfo.IsShown(): 146 153 paneinfo.Show(True) 147 self.frame._mgr.Update() 148 text = message.data 154 frame._mgr.Update() 149 155 if message.topic[-1] == 'wrap': 150 156 columns = 72 … … 177 183 IntParam('min_height', 20), 178 184 ) 179 185 186 180 187 class OutputLogMinorMode(MinorMode, LoggingSTC): 181 188 """An error log using message passing. -
trunk/peppy/sidebar.py
r1049 r1439 21 21 from peppy.debug import * 22 22 from peppy.lib.userparams import * 23 23 from peppy.lib.processmanager import * 24 24 25 25 class Sidebar(ClassPrefs, debugmixin): … … 85 85 """ 86 86 pass 87 88 89 class JobOutputSidebarController(JobOutputMixin): 90 """Simple wrapper around the JobOutputMixin interface to direct all output 91 to the Information sidebar. 92 """ 93 def __init__(self, frame, startCallback, finishCallback): 94 self.frame = frame 95 self.startCallback = startCallback 96 self.finishCallback = finishCallback 97 98 def startupCallback(self, job): 99 """Callback from the JobOutputMixin when a job is successfully 100 started. 101 """ 102 self.startCallback(job) 103 text = "\n" + _("Started %s on %s") % (job.cmd, time.asctime(time.localtime(time.time()))) + "\n" 104 Publisher().sendMessage('peppy.log.info', (self.frame, text)) 105 106 def stdoutCallback(self, job, text): 107 """Callback from the JobOutputMixin for a block of text on stdout.""" 108 Publisher().sendMessage('peppy.log.info', (self.frame, text)) 109 110 def stderrCallback(self, job, text): 111 """Callback from the JobOutputMixin for a block of text on stderr.""" 112 Publisher().sendMessage('peppy.log.info', (self.frame, text)) 113 114 def finishedCallback(self, job): 115 """Callback from the JobOutputMixin when the job terminates.""" 116 self.finishCallback(job) 117 text = "\n" + _("Finished %s on %s") % (job.cmd, time.asctime(time.localtime(time.time()))) + "\n" 118 Publisher().sendMessage('peppy.log.info', (self.frame, text)) -
trunk/tests/samples/job-control.py
r1393 r1439 3 3 import time 4 4 5 import euaoeu5 #import euaoeu 6 6 7 7 for x in range(100):
