Login | Register
My pages Projects Community openCollabNet

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

newedit
Discussion topic

Back to topic list

CVS update: /newedit/src/, /newedit/src/mixins/, /newedit/src/modules/

Reply

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

Modified:
 /newedit/src/
  NewEdit.py
 /newedit/src/mixins/
  Import.py, Preference.py
 /newedit/src/modules/
  common.py

Log:
 bug fix

File Changes:

Directory: /newedit/src/
========================

File [changed]: NewEdit.py
Url: http://newedit.tigri​s.org/source/browse/​newedit/src/NewEdit.​py?r1=1.35&r2=1.​36
Delta lines: +11 -7
--------------------
--- NewEdit.py 10 Nov 2004 15:13:20 -0000 1.35
+++ NewEdit.py 7 Feb 2005 13:11:01 -0000 1.36
@@ -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: NewEdit.py,v 1.35 2004/11/10 15:13:20 limodou Exp $
+# $Id: NewEdit.py,v 1.36 2005/02/07 13:11:01 limodou Exp $
 
 __appname__ = 'NewEdit'
 __author__ = 'limodou'
@@ -35,7 +35,7 @@
 from modules import common
 
 def Usage():
- print """Usage %s -u|-v|-n|[-e encoding]|s files ...
+ print """Usage %s -u|-v|-n|[-e encoding]|-s|-f|-m files ...
 
     -u Show this message
     -v Show version information
@@ -43,6 +43,7 @@
     -e encoding Set default encoding which will be used in NewEdit
     -s Enable psyco speed support
     -f Skip last session files
+ -m Multi user mode, data file will be saved in user home directory
 """ % sys.argv[0]
 
 def Version():
@@ -54,7 +55,7 @@
 
 #process command line
 try:
- opts, args = getopt.getopt(sys.argv[1:], "e:vuns", [])
+ opts, args = getopt.getopt(sys.argv[1:], "e:vunsfm", [])
 except getopt.GetoptError:
     Usage()
     sys.exit(2)
@@ -63,6 +64,7 @@
 ddeflag = True
 psycoflag = False
 skipsessionfile = False
+multiuser = False
 
 for o, a in opts:
     if o == '-e': #encoding
@@ -79,16 +81,17 @@
         psycoflag = True
     elif o == '-f':
         skipsessionfile = True
+ elif o == '-m':
+ multiuser = True
 files = args
 
 files = [common.decode_strin​g(os.path.abspath(f)​) for f in files]
 
 #change wordpath
 workpath = os.path.dirname(os.p​ath.abspath(sys.argv​[0]))
-if workpath:
- os.sys.path.insert(0, workpath)
- os.sys.path.insert(0, os.path.join(workpath, 'plugins'))
- os.chdir(workpath)
+userpath = workpath
+if multiuser:
+ userpath = common.getHomeDir()
 
 #check version
 #from modules import CheckVersion
@@ -125,6 +128,7 @@
         self.appname = __appname__
         self.i18n = i18n
         self.workpath = workpath
+ self.userpath = userpath
         self.defaultencoding = encoding
         self.ddeflag = ddeflag
         self.skipsessionfile = skipsessionfile

Directory: /newedit/src/mixins/
===============================

File [changed]: Import.py
Url: http://newedit.tigri​s.org/source/browse/​newedit/src/mixins/I​mport.py?r1=1.70​&r2=1.71
Delta lines: +0 -0
-------------------
--- Import.py 7 Feb 2005 09:01:07 -0000 1.70
+++ Import.py 7 Feb 2005 13:11:01 -0000 1.71
@@ -20,7 +20,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: Import.py,v 1.70 2005/02/07 09:01:07 limodou Exp $
+# $Id: Import.py,v 1.71 2005/02/07 13:11:01 limodou Exp $
 
 
 #----------------------- mPreference.py ------------------

File [changed]: Preference.py
Url: http://newedit.tigri​s.org/source/browse/​newedit/src/mixins/P​reference.py?r1=1.3​&r2=1.4
Delta lines: +3 -3
-------------------
--- Preference.py 14 Oct 2004 03:27:12 -0000 1.3
+++ Preference.py 7 Feb 2005 13:11:02 -0000 1.4
@@ -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: Preference.py,v 1.3 2004/10/14 03:27:12 limodou Exp $
+# $Id: Preference.py,v 1.4 2005/02/07 13:11:02 limodou Exp $
 
 from modules import Mixin
 from modules.Debug import debug
@@ -52,13 +52,13 @@
     def save(self, filename=''):
         if not filename:
             filename = self.defaultfile
- pickle.dump(self, open(filename, 'w'))
+ pickle.dump(self, open(filename, 'wb'))
 
     def load(self, filename=''):
         if not filename:
             filename = self.defaultfile
         if os.path.exists(filename):
- obj = pickle.load(open(filename))
+ obj = pickle.load(open(filename, 'rb'))
             for k, v in obj.__dict__.items():
                 if hasattr(self, k):
                     setattr(self, k, v)

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

File [changed]: common.py
Url: http://newedit.tigri​s.org/source/browse/​newedit/src/modules/​common.py?r1=1.9​&r2=1.10
Delta lines: +21 -1
--------------------
--- common.py 25 Nov 2004 12:44:23 -0000 1.9
+++ common.py 7 Feb 2005 13:11:02 -0000 1.10
@@ -19,12 +19,13 @@
 # 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.9 2004/11/25 12:44:23 limodou Exp $
+# $Id: common.py,v 1.10 2005/02/07 13:11:02 limodou Exp $
 
 """Used to define commonly functions.
 """
 import locale
 import types
+import os
 import os.path
 import wx
 import sys
@@ -106,3 +107,22 @@
     """
     mainframe.SetStatusT​ext(message, 0)
 
+def getHomeDir():
+ ''' Try to find user's home directory, otherwise return current directory.'''
+ try:
+ path1=os.path.expanduser("~")
+ except:
+ path1=""
+ try:
+ path2=os.environ["HOME"]
+ except:
+ path2=""
+ try:
+ path3=os.environ["USERPROFILE"]
+ except:
+ path3=""
+
+ if os.path.exists(path1): return path1
+ if not os.path.exists(path2): return path2
+ if not 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/, /newedit/src/mixins/, /newedit/src/modules/ limodou limodou 2005-02-07 05:11:02 PST
Messages per page: