dabo Commit
Revision 4341
Date: 2008-08-02 18:25:32 -0700 (Sat, 02 Aug 2008)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/4341

Changed:
U   trunk/ide/Editor.py

Log:
Added code to check if a file on disk has been updated since it was opened in 
the editor. If so, and the editor version is not modified, the editor is 
refreshed with the current disk version.


Diff:
Modified: trunk/ide/Editor.py
===================================================================
--- trunk/ide/Editor.py 2008-08-03 01:22:04 UTC (rev 4340)
+++ trunk/ide/Editor.py 2008-08-03 01:25:32 UTC (rev 4341)
@@ -355,8 +355,23 @@
 
        def onPrint(self, evt):
                self.CurrentEditor.onPrint()
-       
-       
+
+
+       def onActivate(self, evt):
+               """Check the files to see if any have been updated on disk."""
+               self.checkForUpdatedFiles()
+
+
+       def checkForUpdatedFiles(self):
+               """If any file being edited has not been modified, and there is 
a more recent version
+               on disk, update the file with the version on disk.
+               """
+               for pg in self.pgfEditor.Pages:
+                       ed = pg.editor
+                       if not ed.isChanged() and ed.checkForDiskUpdate():
+                               ed.openFile(ed._fileName)
+
+
        def onLexSelect(self, evt):
                self.CurrentEditor.Language = self.lexSelector.Value
 
@@ -471,6 +486,7 @@
                
 
        def onEditorPageChanged(self, evt):
+               self.checkForUpdatedFiles()
                self.onTitleChanged(evt)
                self.setCheckedMenus()
                self.updateLex()
@@ -485,9 +501,12 @@
        
        def setCheckedMenus(self):
                ed = self.CurrentEditor
-               self._autoAutoItem.Checked = ed.AutoAutoComplete
-               self._wrapItem.Checked = ed.WordWrap
-               self._synColorItem.Checked = ed.SyntaxColoring
+               if ed is None:
+                       self._autoAutoItem.Checked = self._wrapItem.Checked = 
self._synColorItem.Checked = False
+               else:
+                       self._autoAutoItem.Checked = ed.AutoAutoComplete
+                       self._wrapItem.Checked = ed.WordWrap
+                       self._synColorItem.Checked = ed.SyntaxColoring
                self._showOutItem.Checked = 
self.Application.getUserSetting("visibleOutput", False)
                
                




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]

Reply via email to