Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: /newedit/src/modules/

newedit
Discussion topic

Back to topic list

CVS update: /newedit/src/modules/

Reply

Author limodou
Full name limodou
Date 2005-02-07 05:13:05 PST
Message User: limodou
Date: 05/02/07 05:13:05

Modified:
 /newedit/src/modules/
  Mixin.py, common.py

Log:
 bug fix

File Changes:

Directory: /newedit/src/modules/
====================​============

File [changed]: Mixin.py
Url: http://newedit.tigri​s.org/source/browse/​newedit/src/modules/​Mixin.py?r1=1.13​&r2=1.14
Delta lines: +37 -4
--------------------
--- Mixin.py 14 Oct 2004 03:27:14 -0000 1.13
+++ Mixin.py 7 Feb 2005 13:13:05 -0000 1.14
@@ -19,12 +19,30 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 #
-# $Id: Mixin.py,v 1.13 2004/10/14 03:27:14 limodou Exp $
+# $Id: Mixin.py,v 1.14 2005/02/07 13:13:05 limodou Exp $
 
 import types
-from Debug import debug
+from Debug import debug, error
+import __builtin__
+import pickle
+import os.path
+
+#receive vars from __builtin__ module tranfered by NewEdit
+reinitpickle = __builtin__.__dict__​.get('newedit_reinit​pickle', False)
+userpath = __builtin__.__dict__​.get('newedit_userpa​th', '')
+initpicklefile = os.path.join(userpath, '.mixinpickle')
 
 __mixinset__ = {} #used to collect all mixins and plugins
+if not reinitpickle:
+ if os.path.exists(initpicklefile):
+ try:
+ __mixinset__ = pickle.load(file(ini​tpicklefile, 'rb'))
+ except:
+ __mixinset__ = {}
+ reinitpickle = True
+ else:
+ reinitpickle = True
+
 HIGH = 1 #plugin high
 MIDDLE = 2
 LOW = 3
@@ -95,6 +113,7 @@
 # __import__(packagename+'.'+i)
 
 def setMixin(mixinname, name, value):
+ if not reinitpickle: return
     if __mixinset__.has_key​(mixinname):
         mixins = __mixinset__[mixinname][0]
     else:
@@ -116,6 +135,7 @@
         mixins[name] = value
 
 def setPlugin(mixinname, name, value, kind=MIDDLE, nice=-1):
+ if not reinitpickle: return
     if __mixinset__.has_key​(mixinname):
         plugins = __mixinset__[mixinname][1]
     else:
@@ -134,6 +154,19 @@
         plugins[name].sort()
     else:
         plugins[name] = [(nice, value)]
+
+def save_mixin_pickle():
+ if reinitpickle:
+ try:
+ f = file(initpicklefile, 'wb')
+ pickle.dump(__mixinset__, f)
+ f.close()
+ except:
+ error.traceback()
+ if f:
+ f.close()
+ os.remove(initpicklefile)
+ raise
 
 def setProperty(obj, name, value):
     t = type(value)

File [changed]: common.py
Url: http://newedit.tigri​s.org/source/browse/​newedit/src/modules/​common.py?r1=1.10​&r2=1.11
Delta lines: +3 -3
-------------------
--- common.py 7 Feb 2005 13:11:02 -0000 1.10
+++ common.py 7 Feb 2005 13:13:05 -0000 1.11
@@ -19,7 +19,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 #
-# $Id: common.py,v 1.10 2005/02/07 13:11:02 limodou Exp $
+# $Id: common.py,v 1.11 2005/02/07 13:13:05 limodou Exp $
 
 """Used to define commonly functions.
 """
@@ -123,6 +123,6 @@
         path3=""
 
     if os.path.exists(path1): return path1
- if not os.path.exists(path2): return path2
- if not os.path.exists(path3): return path3
+ if os.path.exists(path2): return path2
+ if os.path.exists(path3): return path3
     return os.getcwd()




--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: cvs-unsubscribe@newe​dit.tigris.org
For additional commands, e-mail: cvs-help at newedit dot tigris dot org

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: /newedit/src/modules/ limodou limodou 2005-02-07 05:13:05 PST
Messages per page: