def init(self, showSplash=True, load=True): #add modules path to sys.path self.workpath = workpath self.confpath = confpath self.curpath = curpath self.i18n = i18n self.processCommandLineArguments() if self.psycoflag: try: import psyco psyco.full() except: pass #change workpath self.userpath = self.workpath if self.multiuser: self.userpath = common.getHomeDir() #set globals variable Globals.userpath = self.userpath self.CheckPluginDir() Mixin.ENABLE = True try: import plugins except: Debug.error.traceback() common.showerror( None, tr('There was something wrong with importing plugins.')) #before running gui self.callplugin("beforegui", self) Mixin.ENABLE = False #----------------------------------------------------------------------------- if Debug.DEBUG: Mixin.printMixin() return self.execplugin('getmainframe', self, self.files)
def init(self, showSplash=True, load=True): #add modules path to sys.path self.workpath = workpath self.confpath = confpath self.curpath = curpath self.i18n = i18n self.processCommandLineArguments() if self.psycoflag: try: import psyco psyco.full() except: pass #change workpath self.userpath = self.workpath if self.multiuser: self.userpath = common.getHomeDir() #set globals variable Globals.userpath = self.userpath self.CheckPluginDir() Mixin.ENABLE = True try: import plugins except: Debug.error.traceback() common.showerror(None, tr('There was something wrong with importing plugins.')) #before running gui self.callplugin("beforegui", self) Mixin.ENABLE = False #----------------------------------------------------------------------------- if Debug.DEBUG: Mixin.printMixin() return self.execplugin('getmainframe', self, self.files)
def main(): text = file('../mixins/__init__.py').read() re_import = re.compile('^#import (.*)$', re.M) result = re_import.findall(text) if result: fp = file('../mixins/Import.py', 'wb') fp.write("""\ # Programmer: limodou # E-mail: [email protected] # # Copyleft 2006 limodou # # Distributed under the terms of the GPL (GNU Public License) # # UliPad is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # 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 os import pickle from modules import Globals from modules import Mixin pfile = os.path.join(Globals.workpath, 'mixins.pickls') Mixin.__mixinset__ = pickle.load(file(pfile, 'rb')) Mixin.ENABLE = False """) def _(s): return s sys.path.insert(0, os.path.abspath('../mixins')) sys.path.insert(0, os.path.abspath('..')) import __builtin__ __builtin__.__dict__['tr'] = _ for f in result: # print 'dealing ... ', f mod = __import__(f) from modules import Mixin Mixin.MUST_FUNC = True from modules import Debug Debug.debug = Debug.Debug('../debug.txt') processMixin(Mixin.__mixinset__) pfile = '../mixins.pickls' pickle.dump(Mixin.__mixinset__, file(pfile, 'wb')) Mixin.printMixin() print "Successful!"