[Python-checkins] r65415 - sandbox/trunk/ttk-gsoc/src/idlelib/ScriptBinding.py

guilherme.polo python-checkins at python.org
Sat Aug 2 20:10:05 CEST 2008


Author: guilherme.polo
Date: Sat Aug  2 20:10:04 2008
New Revision: 65415

Log:
Removed dependence on self.text and self.io from editor window

Modified:
   sandbox/trunk/ttk-gsoc/src/idlelib/ScriptBinding.py

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/ScriptBinding.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/ScriptBinding.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/ScriptBinding.py	Sat Aug  2 20:10:04 2008
@@ -70,7 +70,7 @@
             msgtxt, (lineno, start) = msg
             self.editwin.gotoline(lineno)
             self.errorbox("Tabnanny Tokenizing Error",
-                          "Token Error: %s" % msgtxt)
+                "Token Error: %s" % msgtxt)
             return False
         except tabnanny.NannyNag, nag:
             # The error messages from tabnanny are too confusing...
@@ -91,7 +91,7 @@
             source = re.sub(r"\r", "\n", source)
         if source and source[-1] != '\n':
             source = source + '\n'
-        text = self.editwin.text
+        text = self.editwin.current_page.text # XXX check this!
         text.tag_remove("ERROR", "1.0", "end")
         try:
             try:
@@ -113,7 +113,7 @@
             shell.set_warning_stream(saved_stream)
 
     def colorize_syntax_error(self, msg, lineno, offset):
-        text = self.editwin.text
+        text = self.editwin.current_page.text # XXX check this!
         pos = "0.0 + %d lines + %d chars" % (lineno-1, offset-1)
         text.tag_add("ERROR", pos)
         char = text.get(pos)
@@ -175,20 +175,20 @@
 
         If the user has configured IDLE for Autosave, the file will be
         silently saved if it already exists and is dirty.
-
         """
-        filename = self.editwin.io.filename
-        if not self.editwin.get_saved():
+        page = self.editwin.current_page
+        filename = page.io.filename
+        if not page.get_saved():
             autosave = idleConf.GetOption('main', 'General',
                                           'autosave', type='bool')
             if autosave and filename:
-                self.editwin.io.save(None)
+                page.io.save(None)
             else:
                 reply = self.ask_save_dialog()
-                self.editwin.text.focus_set()
+                page.text.focus_set()
                 if reply == "ok":
-                    self.editwin.io.save(None)
-                    filename = self.editwin.io.filename
+                    page.io.save(None)
+                    filename = page.io.filename
                 else:
                     filename = None
         return filename
@@ -196,14 +196,13 @@
     def ask_save_dialog(self):
         msg = "Source Must Be Saved\n" + 5*' ' + "OK to Save?"
         mb = tkMessageBox.Message(title="Save Before Run or Check",
-                                  message=msg,
-                                  icon=tkMessageBox.QUESTION,
-                                  type=tkMessageBox.OKCANCEL,
-                                  default=tkMessageBox.OK,
-                                  master=self.editwin.text)
+            message=msg, icon=tkMessageBox.QUESTION,
+            type=tkMessageBox.OKCANCEL, default=tkMessageBox.OK,
+            master=self.editwin.text_notebook)
         return mb.show()
 
     def errorbox(self, title, message):
         # XXX This should really be a function of EditorWindow...
-        tkMessageBox.showerror(title, message, master=self.editwin.text)
-        self.editwin.text.focus_set()
+        tkMessageBox.showerror(title, message,
+            master=self.editwin.text_notebook)
+        self.editwin.current_page.text.focus_set()


More information about the Python-checkins mailing list