Login | Register
My pages Projects Community openCollabNet

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

newedit
Discussion topic

Back to topic list

CVS update: /newedit/src/mixins/

Reply

Author limodou
Full name limodou
Date 2005-03-12 07:15:09 PST
Message User: limodou
Date: 05/03/12 07:15:09

Modified:
 /newedit/src/mixins/
  Import.py

Log:
 fix bug

File Changes:

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

File [changed]: Import.py
Url: http://newedit.tigri​s.org/source/browse/​newedit/src/mixins/I​mport.py?r1=1.76​&r2=1.77
Delta lines: +9 -1
-------------------
--- Import.py 12 Mar 2005 14:53:46 -0000 1.76
+++ Import.py 12 Mar 2005 15:15:08 -0000 1.77
@@ -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.76 2005/03/12 14:53:46 limodou Exp $
+# $Id: Import.py,v 1.77 2005/03/12 15:15:08 limodou Exp $
 
 
 #----------------------- mPreference.py ------------------
@@ -5456,6 +5456,7 @@
 Mixin.setMixin('editor', 'popmenulist', popmenulist)
 
 def OnViewOpenModuleFile(win, event):
+ print getword(win)
     openmodulefile(win, getword(win))
 Mixin.setMixin('mainframe', 'OnViewOpenModuleFile', OnViewOpenModuleFile)
 
@@ -5465,13 +5466,20 @@
 
 def openmodulefile(mainframe, module):
     try:
- mod = __import__(module)
+ mod = my_import(module)
         f, ext = os.path.splitext(mod.__file__)
         filename = f + '.py'
         if os.path.exists(filename):
             mainframe.editctrl.n​ew(filename)
     except:
         pass
+
+def my_import(name):
+ mod = __import__(name)
+ components = name.split('.')
+ for comp in components[1:]:
+ mod = getattr(mod, comp)
+ return mod
 
 def getword(mainframe):
     pos = mainframe.document.G​etCurrentPos()




--------------------​--------------------​--------------------​---------
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/mixins/ limodou limodou 2005-03-12 07:15:09 PST
Messages per page: