[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue-designer/src/base Instance.py MRUManager.py
From: |
Jason Cater |
Subject: |
gnue-designer/src/base Instance.py MRUManager.py |
Date: |
Tue, 15 Jul 2003 18:57:29 -0400 |
CVSROOT: /cvsroot/gnue
Module name: gnue-designer
Branch:
Changes by: Jason Cater <address@hidden> 03/07/15 18:57:28
Modified files:
src/base : Instance.py MRUManager.py
Log message:
fixed the MRU manager issue with dead objects remaining after a file
has been closed
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-designer/src/base/Instance.py.diff?tr1=1.116&tr2=1.117&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-designer/src/base/MRUManager.py.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
Patches:
Index: gnue-designer/src/base/Instance.py
diff -c gnue-designer/src/base/Instance.py:1.116
gnue-designer/src/base/Instance.py:1.117
*** gnue-designer/src/base/Instance.py:1.116 Tue Jul 8 12:18:02 2003
--- gnue-designer/src/base/Instance.py Tue Jul 15 18:57:27 2003
***************
*** 648,653 ****
--- 648,654 ----
return
RuntimeSettings.saveRuntimeSettings(self)
+ self._app.mru.removeMenu(self.menubar.getMenu('File|Open Recent|'), self)
self._app.removeInstance(self)
self.Destroy()
Index: gnue-designer/src/base/MRUManager.py
diff -c gnue-designer/src/base/MRUManager.py:1.8
gnue-designer/src/base/MRUManager.py:1.9
*** gnue-designer/src/base/MRUManager.py:1.8 Fri Apr 4 18:05:32 2003
--- gnue-designer/src/base/MRUManager.py Tue Jul 15 18:57:27 2003
***************
*** 47,58 ****
self.runtime_section = "MRUList"
# Load the saved MRU list
! for i in range(self._maxMRUs):
location = RuntimeSettings.get(self.runtime_section, "%s" % i, None)
! if location is None:
break
self._locations.append (location)
!
self._refreshMenuList()
--- 47,58 ----
self.runtime_section = "MRUList"
# Load the saved MRU list
! for i in range(self._maxMRUs):
location = RuntimeSettings.get(self.runtime_section, "%s" % i, None)
! if location is None:
break
self._locations.append (location)
!
self._refreshMenuList()
***************
*** 77,123 ****
def _refreshMenuList(self):
# This figures out the common prefix of all the forms and reduces
appropriately.
! # i.e., if you have /usr/home/me/form1.gfd, /usr/home/you/form2.gfd then
! # this will reduce to me/form1.gfd and you/form2.gfd.. This is to keep
the
# MRU menu list from being too wide!
commonpos=len(os.path.commonprefix(
map(lambda x: os.path.join(os.path.split(x)[0],''),self._locations)))
! if commonpos > 2:
self.menulist = map(lambda x, pos=commonpos: x[pos:], self._locations)
! else:
self.menulist = self._locations[:]
self.refreshMenus()
-
! def addMenu(self, menu, instance):
self._menus.append(menu)
menu.__instance = instance
self.refreshMenu(menu)
! def refreshMenus(self):
map(self.refreshMenu, self._menus)
! def refreshMenu(self, menu):
# Rid ourselves of old entries
! for i in menu.GetMenuItems():
menu.Delete(i.GetId())
i = 0
! for location in self.menulist:
tid = wx.wxNewId()
! menu.Append ( tid, '&%s %s' % (i+1, location),
_('Open "%s" in a new window') % self._locations[i] )
wx.EVT_MENU(menu.__instance, tid, self._app.OnOpenRecent)
self.mruMenuMap[tid] = self._locations[i]
! i += 1
!
#
# Used by RuntimeSettings
--- 77,126 ----
def _refreshMenuList(self):
# This figures out the common prefix of all the forms and reduces
appropriately.
! # i.e., if you have /usr/home/me/form1.gfd, /usr/home/you/form2.gfd then
! # this will reduce to me/form1.gfd and you/form2.gfd.. This is to keep the
# MRU menu list from being too wide!
commonpos=len(os.path.commonprefix(
map(lambda x: os.path.join(os.path.split(x)[0],''),self._locations)))
! if commonpos > 2:
self.menulist = map(lambda x, pos=commonpos: x[pos:], self._locations)
! else:
self.menulist = self._locations[:]
self.refreshMenus()
!
! def addMenu(self, menu, instance):
self._menus.append(menu)
menu.__instance = instance
self.refreshMenu(menu)
+ def removeMenu(self, menu, instance):
+ self._menus.remove(menu)
!
! def refreshMenus(self):
map(self.refreshMenu, self._menus)
! def refreshMenu(self, menu):
# Rid ourselves of old entries
! for i in menu.GetMenuItems():
menu.Delete(i.GetId())
i = 0
! for location in self.menulist:
tid = wx.wxNewId()
! menu.Append ( tid, '&%s %s' % (i+1, location),
_('Open "%s" in a new window') % self._locations[i] )
wx.EVT_MENU(menu.__instance, tid, self._app.OnOpenRecent)
self.mruMenuMap[tid] = self._locations[i]
! i += 1
!
#
# Used by RuntimeSettings
***************
*** 125,134 ****
def saveRuntimeSettings(self):
results = {}
! for i in range(len(self._locations)):
results["%s" % i] = self._locations[i]
return ( self.runtime_section, results )
-
!
--- 128,137 ----
def saveRuntimeSettings(self):
results = {}
! for i in range(len(self._locations)):
results["%s" % i] = self._locations[i]
return ( self.runtime_section, results )
!
!
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue-designer/src/base Instance.py MRUManager.py,
Jason Cater <=