dabo Commit
Revision 4525
Date: 2008-09-25 08:48:56 -0700 (Thu, 25 Sep 2008)
Author: Nate
Trac: http://svn.dabodev.com/trac/dabo/changeset/4525

Changed:
U   trunk/dabo/ui/uiwx/dEditor.py

Log:
Ok, this fixes the error I was getting on deletion of the editor object in 
relation to the bookmarks.  I eliminated the timer.  We didn't need it.  In 
addition, I eliminated the bookmark saves on deletion and on saving the file.  
The were irrelevant and unnecessary considering we save the bookmarks after 
every bookmark operation (clear, clear all, and set).

This solved the error, but I was still having some issues with the saving 
bookmarks.  No matter what I did, I could only get the UserSettingProvider to 
save one bookmark key.  Not sure of the problem, but the solution was to save 
the bookmarks as a list of tuples.  It works out better anyway because there is 
less database reading and writing and allowed me to eliminate some clunky code.

Tested the IDE tools with the change and they work as expected.

Diff:
Modified: trunk/dabo/ui/uiwx/dEditor.py
===================================================================
--- trunk/dabo/ui/uiwx/dEditor.py       2008-09-23 15:31:02 UTC (rev 4524)
+++ trunk/dabo/ui/uiwx/dEditor.py       2008-09-25 15:48:56 UTC (rev 4525)
@@ -328,11 +328,6 @@
                        self._bookmarks = {}
                # This holds the last saved bookmark status
                self._lastBookmarks = []
-               # Create a timer to regularly flush the bookmarks
-               self._bookmarkTimer = bmt = dTimer.dTimer(self)
-               bmt.Interval = 20000            # 20 sec.
-               bmt.bindEvent(dEvents.Hit, self._saveBookmarks)
-               bmt.start()             
 
                if self.UseStyleTimer:
                        self._styleTimer.mode = "container"
@@ -346,7 +341,6 @@
 
 
        def __del__(self):
-               self._saveBookmarks()
                self._unRegisterFunc(self)
                super(dEditor, self).__del__()
        
@@ -1424,8 +1418,6 @@
                app = self.Application
                app.setUserSetting("editor.fontsize", self._fontSize)
                app.setUserSetting("editor.fontface", self._fontFace)
-               # Save the bookmarks
-               self._saveBookmarks()
                
                #if the file extension changed, automatically set the language 
if extension is known.
                fext = os.path.splitext(fname)[1]
@@ -1435,8 +1427,6 @@
        
        
        def _saveBookmarks(self, evt=None):
-               if not self._useBookmarks:
-                       self._bookmarkTimer.stop()
                app = self.Application
                fname = self._fileName
                if not fname:
@@ -1449,15 +1439,7 @@
                        self._lastBookmarks = currBmks
                        justFname = os.path.split(fname)[1]
                        base = ".".join(("bookmark", justFname))
-                       # Clear any existing settings.
-                       app.deleteAllUserSettings(base)
-                       newsettings = {}
-                       for nm, hnd in self._bookmarks.items():
-                               ln = self.MarkerLineFromHandle(hnd)
-                               setName = ".".join((base, nm))
-                               newsettings[setName] = ln
-                       if newsettings:
-                               app.setUserSettings(newsettings)
+                       app.setUserSetting(base, currBmks)
 
 
        def isChanged(self):
@@ -1556,10 +1538,10 @@
                app = self.Application
                fname = os.path.split(fileSpec)[1]
                keyspec = ".".join(("bookmark", fname)).lower()
-               keys = app.getUserSettingKeys(keyspec)
-               for key in keys:
-                       val = app.getUserSetting(".".join((keyspec, key)))
-                       self.setBookmark(key, val)
+               bmks = app.getUserSetting(keyspec)
+               if bmks:
+                       for (nm,line) in bmks:
+                               self.setBookmark(nm, line)
                # Restore the appearance
                self._fontFace = app.getUserSetting("editor.fontface")
                self._fontSize = app.getUserSetting("editor.fontsize")
@@ -2293,10 +2275,6 @@
        def _setUseBookmarks(self, val):
                if self._constructed():
                        self._useBookmarks = val
-                       if val:
-                               self._bookmarkTimer.start()
-                       else:
-                               self._bookmarkTimer.stop()
                else:
                        self._properties["UseBookmarks"] = val
 




_______________________________________________
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