[Python-checkins] r74491 - in python/branches/tk_and_idle_maintenance/Lib/idlelib: PyShell.py config-main.def configDialog.py

guilherme.polo python-checkins at python.org
Mon Aug 17 20:58:26 CEST 2009


Author: guilherme.polo
Date: Mon Aug 17 20:58:20 2009
New Revision: 74491

Log:
Turned "bring shell forward on first error" into an option.

Modified:
   python/branches/tk_and_idle_maintenance/Lib/idlelib/PyShell.py
   python/branches/tk_and_idle_maintenance/Lib/idlelib/config-main.def
   python/branches/tk_and_idle_maintenance/Lib/idlelib/configDialog.py

Modified: python/branches/tk_and_idle_maintenance/Lib/idlelib/PyShell.py
==============================================================================
--- python/branches/tk_and_idle_maintenance/Lib/idlelib/PyShell.py	(original)
+++ python/branches/tk_and_idle_maintenance/Lib/idlelib/PyShell.py	Mon Aug 17 20:58:20 2009
@@ -1311,7 +1311,10 @@
 
     def write(self, s):
         if not self.signaled:
-            self.shell.top.wakeup(anystate=True)
+            signal_err = idleConf.GetOption('main', 'General',
+                    'signal-first-error', default=1, type='bool')
+            if signal_err:
+                self.shell.top.wakeup(anystate=True)
             self.signaled = True
         PseudoFile.write(self, s)
 

Modified: python/branches/tk_and_idle_maintenance/Lib/idlelib/config-main.def
==============================================================================
--- python/branches/tk_and_idle_maintenance/Lib/idlelib/config-main.def	(original)
+++ python/branches/tk_and_idle_maintenance/Lib/idlelib/config-main.def	Mon Aug 17 20:58:20 2009
@@ -47,6 +47,7 @@
 editor-on-startup= 0
 autosave= 0
 save-before-run= 1
+signal-first-error= 1
 print-command-posix=lpr %s
 print-command-win=start /min notepad /p %s
 delete-exitfunc= 1

Modified: python/branches/tk_and_idle_maintenance/Lib/idlelib/configDialog.py
==============================================================================
--- python/branches/tk_and_idle_maintenance/Lib/idlelib/configDialog.py	(original)
+++ python/branches/tk_and_idle_maintenance/Lib/idlelib/configDialog.py	Mon Aug 17 20:58:20 2009
@@ -331,6 +331,7 @@
         self.startupEdit=IntVar(self)
         self.autoSave=IntVar(self)
         self.saveBeforeRun=BooleanVar(self)
+        self.signalOnErr = BooleanVar(self)
         self.encoding=StringVar(self)
         self.userHelpBrowser=BooleanVar(self)
         self.helpBrowser=StringVar(self)
@@ -365,6 +366,12 @@
             value=0,text="Prompt to Save")
         radioSaveAuto=Radiobutton(frameRun,variable=self.autoSave,
             value=1,text="No prompt")
+        labelSignalOnErr = Label(frameRun,
+                text="On first error")
+        signalErr = Radiobutton(frameRun, variable=self.signalOnErr,
+                value=1, text="Bring shell forward")
+        noSignalErr = Radiobutton(frameRun, variable=self.signalOnErr,
+                value=0, text="Do nothing")
         #frameWinSize
         labelWinSizeTitle=Label(frameWinSize,text='Initial Window Size'+
                 '  (in characters)')
@@ -422,6 +429,9 @@
         labelAutoSave.grid(row=1, column=0, **commonOpts)
         radioSaveAsk.grid(row=1, column=1, **commonOpts)
         radioSaveAuto.grid(row=1, column=2, **commonOpts)
+        labelSignalOnErr.grid(row=2, column=0, **commonOpts)
+        signalErr.grid(row=2, column=1, **commonOpts)
+        noSignalErr.grid(row=2, column=2, **commonOpts)
         #frameWinSize
         labelWinSizeTitle.pack(side=LEFT,anchor=W,padx=5,pady=5)
         entryWinHeight.pack(side=RIGHT,anchor=E,padx=10,pady=5)
@@ -467,6 +477,7 @@
         self.autoSave.trace_variable('w',self.VarChanged_autoSave)
         self.encoding.trace_variable('w',self.VarChanged_encoding)
         self.saveBeforeRun.trace_variable('w', self.VarChanged_saveBeforeRun)
+        self.signalOnErr.trace_variable('w', self.VarChanged_signalOnErr)
 
     def VarChanged_fontSize(self,*params):
         value=self.fontSize.get()
@@ -568,6 +579,10 @@
         value = self.saveBeforeRun.get()
         self.AddChangedItem('main','General','save-before-run',value)
 
+    def VarChanged_signalOnErr(self,*params):
+        value = self.signalOnErr.get()
+        self.AddChangedItem('main','General','signal-first-error',value)
+
     def ResetChangedItems(self):
         #When any config item is changed in this dialog, an entry
         #should be made in the relevant section (config type) of this
@@ -1055,6 +1070,9 @@
         # save before run
         self.saveBeforeRun.set(idleConf.GetOption('main', 'General',
             'save-before-run', default=1, type='bool'))
+        # bring shell forward on first error
+        self.signalOnErr.set(idleConf.GetOption('main', 'General',
+            'signal-first-error', default=1, type='bool'))
         #initial window size
         self.winWidth.set(idleConf.GetOption('main','EditorWindow','width'))
         self.winHeight.set(idleConf.GetOption('main','EditorWindow','height'))


More information about the Python-checkins mailing list