From: Christian Caremoli <> Date: Mon, 19 Nov 2007 14:19:14 +0000 (+0000) Subject: CCAR: correction problemes d'import (comploader.py) X-Git-Tag: V1_13b2~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=341a442c03c62462216b2b1d96fee68e5782d15a;p=tools%2Feficas.git CCAR: correction problemes d'import (comploader.py) --- diff --git a/Editeur/Objecttreeitem.py b/Editeur/Objecttreeitem.py index 3540343c..0882abb5 100644 --- a/Editeur/Objecttreeitem.py +++ b/Editeur/Objecttreeitem.py @@ -27,7 +27,6 @@ from copy import copy,deepcopy # import du chargeur de composants from comploader import make_objecttreeitem -from InterfaceTK import treewidget from Ihm import CONNECTOR myrepr = Repr() @@ -51,7 +50,7 @@ class TreeItem: # ou treeOrNode est le noeud parent, item est l'item associé # command est une fonction python appelée sur sélection graphique # du noeud et rmenu est une fonction python appelée sur click droit sur le noeud - itemNode=treewidget.Node + itemNode=None def __init__(self): """Constructor. Do whatever you need to do.""" diff --git a/Editeur/comploader.py b/Editeur/comploader.py index e49bc50a..b20bfa9f 100644 --- a/Editeur/comploader.py +++ b/Editeur/comploader.py @@ -47,12 +47,15 @@ def charger_composants(Ihm="TK"): reper=os.path.dirname(__file__) if Ihm == "TK" : repertoire=reper+"/../InterfaceTK" + package="InterfaceTK" else : repertoire=reper+"/../InterfaceQT" + package="InterfaceQT" listfich=glob.glob(os.path.join(repertoire, "compo*.py")) for fichier in listfich: m= os.path.basename(fichier)[:-3] - module=__import__(m,globals(),locals()) + module=__import__(package,globals(),locals(),[m]) + module = getattr(module, m) composants[module.objet]=module.treeitem return composants diff --git a/InterfaceTK/appli.py b/InterfaceTK/appli.py index 787e74f1..ccb65047 100644 --- a/InterfaceTK/appli.py +++ b/InterfaceTK/appli.py @@ -38,7 +38,7 @@ import splash import prefs import styles from styles import style -from InterfaceTK import fontes +import fontes import tooltip import properties import convert,generator @@ -176,26 +176,7 @@ class APPLI: self.load_appli_composant(mname) def load_appli_composant(self,mname): - if mname=="bureau" : - mnameTK="InterfaceTK."+mname - moduleTK=__import__(mnameTK,globals(),locals()) - module=getattr(moduleTK,mname) - factory=getattr(module,mname.upper()) - appli_composant=factory(self,self.top) - setattr(self,mname,appli_composant) - self.fill_menus(appli_composant,appli_composant.menu_defs) - self.toolbar.creer_boutons_appli_composant(appli_composant.button_defs,appli_composant) - return - - - try : - mnameTK="InterfaceTK."+mname - moduleTK=__import__(mnameTK,globals(),locals()) - module=getattr(moduleTK,mname) - except : - mnameEditeur="Editeur."+mname - moduleEditeur=__import__(mnameEditeur,globals(),locals()) - module=getattr(moduleEditeur,mname) + module=__import__(mname,globals(),locals()) factory=getattr(module,mname.upper()) appli_composant=factory(self,self.top) setattr(self,mname,appli_composant) @@ -370,7 +351,7 @@ class STANDALONE(APPLI): self.message='' # Avant la creation du bureau qui lit le catalogue self.version_code=version - from InterfaceTK import readercata + import readercata self.readercata=readercata.READERCATA(self,None) self.dir=None diff --git a/InterfaceTK/bureau.py b/InterfaceTK/bureau.py index 5b05a5b0..eb9feae8 100644 --- a/InterfaceTK/bureau.py +++ b/InterfaceTK/bureau.py @@ -113,11 +113,14 @@ class BUREAU: self.JDCDisplay_courant=None self.fileName=None self.liste_JDCDisplay=[] - comploader.charger_composants() + self.charger_composants() self.cree_cataitem() self.text_reel="" self.initialdir = self.appli.CONFIGURATION.initialdir + def charger_composants(self): + comploader.charger_composants() + def cree_cataitem(self): """ On récupère dans l'appli_composant readercata les variables diff --git a/InterfaceTK/catabrowser.py b/InterfaceTK/catabrowser.py index c315398f..a4ec7ff1 100644 --- a/InterfaceTK/catabrowser.py +++ b/InterfaceTK/catabrowser.py @@ -27,7 +27,7 @@ import Pmw from Tkinter import * # Modules Eficas -from InterfaceTK import fontes +import fontes from treewidget import Tree from Editeur.Objecttreeitem import TreeItem from Accas import AsException @@ -36,8 +36,8 @@ from Accas import OPER,PROC,MACRO,FORM from Accas import FACT,BLOC,SIMP # -__version__="$Name: $" -__Id__="$Id: catabrowser.py,v 1.1.2.1 2007-08-10 13:59:00 pnoyret Exp $" +__version__="$Name: BR_dev_V1_13 $" +__Id__="$Id: catabrowser.py,v 1.1.4.2 2007-10-23 09:07:33 pnoyret Exp $" # class Tableau: incr = 10 diff --git a/InterfaceTK/cataediteur.py b/InterfaceTK/cataediteur.py index 8f11af5e..6203ba77 100644 --- a/InterfaceTK/cataediteur.py +++ b/InterfaceTK/cataediteur.py @@ -28,7 +28,7 @@ from widgets import showinfo from Tkinter import * # Modules Eficas -from InterfaceTK import fontes +import fontes from widgets import * from treewidget import Tree from Editeur.Objecttreeitem import TreeItem @@ -39,8 +39,8 @@ from Accas import ASSD,GEOM import definition_cata # -__version__="$Name: $" -__Id__="$Id: cataediteur.py,v 1.1.2.1 2007-08-10 13:59:00 pnoyret Exp $" +__version__="$Name: BR_dev_V1_13 $" +__Id__="$Id: cataediteur.py,v 1.1.4.2 2007-10-23 09:07:33 pnoyret Exp $" # Fonte_Niveau = fontes.canvas_gras_italique diff --git a/InterfaceTK/compocomm.py b/InterfaceTK/compocomm.py index 9843dc08..949014c6 100644 --- a/InterfaceTK/compocomm.py +++ b/InterfaceTK/compocomm.py @@ -24,7 +24,7 @@ import string from Editeur import Objecttreeitem import panels -from InterfaceTK import fontes +import fontes Fonte_Commentaire = fontes.standard_italique diff --git a/InterfaceTK/compocommandecomm.py b/InterfaceTK/compocommandecomm.py index e51705c2..c7e55d78 100644 --- a/InterfaceTK/compocommandecomm.py +++ b/InterfaceTK/compocommandecomm.py @@ -26,7 +26,7 @@ from widgets import showerror from Editeur import Objecttreeitem import panels -from InterfaceTK import fontes +import fontes Fonte_Commentaire = fontes.standard_italique diff --git a/InterfaceTK/compoformule.py b/InterfaceTK/compoformule.py index 9a656736..e6f22793 100644 --- a/InterfaceTK/compoformule.py +++ b/InterfaceTK/compoformule.py @@ -32,7 +32,7 @@ import string # import modules EFICAS import widgets import panels -from InterfaceTK import fontes +import fontes import compooper Fonte_TITRE = fontes.standard_gras_souligne diff --git a/InterfaceTK/compomacro.py b/InterfaceTK/compomacro.py index 485e6116..cc927fa2 100644 --- a/InterfaceTK/compomacro.py +++ b/InterfaceTK/compomacro.py @@ -28,7 +28,7 @@ import traceback # Modules Eficas from Editeur import Objecttreeitem import panels -from InterfaceTK import fontes +import fontes import compooper import convert from widgets import askopenfilename @@ -36,8 +36,8 @@ from widgets import Fenetre,FenetreYesNo from widgets import showinfo,showerror # -__version__="$Name: $" -__Id__="$Id: compomacro.py,v 1.1.4.2 2007-10-23 09:07:33 pnoyret Exp $" +__version__="$Name: BR_dev_V1_13 $" +__Id__="$Id: compomacro.py,v 1.1.4.3 2007-10-29 12:42:18 pnoyret Exp $" # class MACROPanel(panels.OngletPanel): diff --git a/InterfaceTK/componiveau.py b/InterfaceTK/componiveau.py index e96fea45..175a3e89 100644 --- a/InterfaceTK/componiveau.py +++ b/InterfaceTK/componiveau.py @@ -24,7 +24,7 @@ import Pmw from Editeur import Objecttreeitem import panels -from InterfaceTK import fontes +import fontes from Extensions import commentaire Fonte_Niveau = fontes.canvas_gras_italique diff --git a/InterfaceTK/compooper.py b/InterfaceTK/compooper.py index ce7c7b5f..0575053d 100644 --- a/InterfaceTK/compooper.py +++ b/InterfaceTK/compooper.py @@ -23,7 +23,7 @@ import Pmw import traceback from Editeur import Objecttreeitem import panels -from InterfaceTK import fontes +import fontes class OPERPanel(panels.OngletPanel): diff --git a/InterfaceTK/compoparam.py b/InterfaceTK/compoparam.py index f842f44c..80094ad3 100644 --- a/InterfaceTK/compoparam.py +++ b/InterfaceTK/compoparam.py @@ -32,7 +32,7 @@ import string # import modules EFICAS from Editeur import Objecttreeitem import panels -from InterfaceTK import fontes +import fontes Fonte_PARAMETRE = fontes.standard_italique diff --git a/InterfaceTK/compoparameval.py b/InterfaceTK/compoparameval.py index 23deafa3..009473d4 100644 --- a/InterfaceTK/compoparameval.py +++ b/InterfaceTK/compoparameval.py @@ -33,7 +33,7 @@ import string import widgets from Editeur import Objecttreeitem import panels -from InterfaceTK import fontes +import fontes Fonte_PARAMETRE = fontes.standard_italique diff --git a/InterfaceTK/compoproc.py b/InterfaceTK/compoproc.py index 63fb490d..3d3e906e 100644 --- a/InterfaceTK/compoproc.py +++ b/InterfaceTK/compoproc.py @@ -23,7 +23,7 @@ import Pmw from Editeur import Objecttreeitem import panels -from InterfaceTK import fontes +import fontes import compooper class PROCPanel(panels.OngletPanel): diff --git a/InterfaceTK/eficas_go.py b/InterfaceTK/eficas_go.py index c0d54ecc..ab4bc3bb 100644 --- a/InterfaceTK/eficas_go.py +++ b/InterfaceTK/eficas_go.py @@ -38,7 +38,7 @@ if hasattr(prefs,'encoding'): import styles from Editeur import import_code -from InterfaceTK import splash +import splash from Editeur import session def lance_eficas(code=None,fichier=None): diff --git a/InterfaceTK/faq.py b/InterfaceTK/faq.py index 34358e2f..30764b53 100644 --- a/InterfaceTK/faq.py +++ b/InterfaceTK/faq.py @@ -29,7 +29,7 @@ from Tkinter import END # Modules Eficas import prefs -from InterfaceTK import fontes +import fontes class FAQ: def __init__(self,parent): diff --git a/InterfaceTK/images.py b/InterfaceTK/images.py index 18d8c9ce..a6f0a74e 100644 --- a/InterfaceTK/images.py +++ b/InterfaceTK/images.py @@ -63,6 +63,5 @@ def get_image(name): return image def update_cache(): - global dico_images - dico_images={} + dico_images.clear() diff --git a/InterfaceTK/plusieursbasepanel.py b/InterfaceTK/plusieursbasepanel.py index dde20a8d..34af53e9 100644 --- a/InterfaceTK/plusieursbasepanel.py +++ b/InterfaceTK/plusieursbasepanel.py @@ -44,7 +44,7 @@ from Editeur.utils import substract_list from plusieurspanel import PLUSIEURS_Panel from uniqueassdpanel import UNIQUE_ASSD_Panel -from InterfaceTK import fontes +import fontes import math class PLUSIEURS_BASE_Panel(PLUSIEURS_Panel): diff --git a/InterfaceTK/prefsTK.py b/InterfaceTK/prefsTK.py deleted file mode 100644 index 6590c55f..00000000 --- a/InterfaceTK/prefsTK.py +++ /dev/null @@ -1,66 +0,0 @@ -# -*- coding: utf-8 -*- -# CONFIGURATION MANAGEMENT OF EDF VERSION -# ====================================================================== -# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG -# THIS PROGRAM 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 EDF R&D CODE_ASTER, -# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE. -# -# -# ====================================================================== - - -labels= ('Fichier','Edition','Jeu de commandes', - 'Options', - 'Aide', - 'Traduction', - ) - -appli_composants=['readercata','bureau', - 'options', - ] - -menu_defs={ 'bureau': [ - ('Fichier',[ - ('Nouveau','newJDC','','Ctrl+N'), - ('Nouvel INCLUDE','newJDC_include'), - ('Ouvrir','openJDC','','Ctrl+O'), - ('Enregistrer','saveJDC','','Ctrl+S'), - ('Enregistrer sous','saveasJDC','','Ctrl+E'), - None, - ('Fermer','closeJDC','','Ctrl+W'), - ('Quitter','exitEFICAS','','Ctrl+Q'), - ] - ), - ('Edition',[ - ('Copier','copy','','Ctrl+C'), - ('Couper','cut','','Ctrl+X'), - ('Coller','paste','','Ctrl+V'), - ] - ), - ('Jeu de commandes',[ - ('Rapport de validation','visuCRJDC','','Ctrl+R'), - ('Fichier source','visu_txt_brut_JDC','','Ctrl+B'), - #('Paramètres Eficas','affichage_fichier_ini'), - ] - ), - ('Traduction',[ - ('Traduction v7 en v8','TraduitFichier','','Ctrl+T'), - ] - ), - ('Aide',[ - ('Aide EFICAS','aideEFICAS','','Ctrl+A'), - ] - ), - ] - } diff --git a/InterfaceTK/readercata.py b/InterfaceTK/readercata.py index 07c5ebf5..9812a27f 100644 --- a/InterfaceTK/readercata.py +++ b/InterfaceTK/readercata.py @@ -36,9 +36,9 @@ from Editeur import analyse_catalogue from Editeur import autre_analyse_cata from Editeur import uiinfo from Noyau.N_CR import CR -from InterfaceTK.widgets import showinfo,showerror -from InterfaceTK.widgets import Fenetre -from InterfaceTK import fontes +from widgets import showinfo,showerror +from widgets import Fenetre +import fontes from utils import init_rep_cata_dev @@ -71,7 +71,7 @@ class READERCATA: dans le répertoire Cata """ if self.appli.ihm == "TK" : - from InterfaceTK import splash + import splash message1 = "Compilation des fichiers Eficas \n\n Veuillez patienter ..." if self.appli.test == 0 and self.appli.ihm=="TK" : splash._splash.configure(text = message1) @@ -193,7 +193,7 @@ class READERCATA: Réalise l'import du catalogue dont le chemin d'accès est donné par cata """ if self.appli.test == 0 and self.appli.ihm=="TK" : - from InterfaceTK import splash + import splash splash._splash.configure(text = "Chargement du catalogue") nom_cata = os.path.splitext(os.path.basename(cata))[0] rep_cata = os.path.dirname(cata) @@ -326,7 +326,7 @@ class READERCATA: self.version_code = liste_choix[0] return # création d'une boîte de dialogue modale - from InterfaceTK import splash + import splash self.fenetre_choix_cata = Pmw.Dialog(splash._splash, #avec self.parent, ne marche pas sous Windows buttons=('OK','ANNULER'), defaultbutton = 'OK', diff --git a/InterfaceTK/splash.py b/InterfaceTK/splash.py index f1deca69..2918ddfe 100644 --- a/InterfaceTK/splash.py +++ b/InterfaceTK/splash.py @@ -26,7 +26,7 @@ from Tkinter import * from centerwindow import centerwindow from Tools.foztools.foztools import Slider -from InterfaceTK import fontes +import fontes import images _splash=None diff --git a/InterfaceTK/styles.py b/InterfaceTK/styles.py index 4d89ef6f..2d5fc4a2 100644 --- a/InterfaceTK/styles.py +++ b/InterfaceTK/styles.py @@ -12,7 +12,7 @@ userstylefile=os.path.expanduser("~/Eficas_install/style.py") if os.path.isfile(userstylefile): execfile(userstylefile) -from InterfaceTK import fontes +import fontes for attr in dir(style): if attr[0]=='_':continue if not hasattr(fontes,attr):continue diff --git a/InterfaceTK/treeitemincanvas.py b/InterfaceTK/treeitemincanvas.py index 05239c94..db38e98f 100644 --- a/InterfaceTK/treeitemincanvas.py +++ b/InterfaceTK/treeitemincanvas.py @@ -26,6 +26,7 @@ import Tkinter,Pmw # Modules Eficas from Editeur import Objecttreeitem import treewidget +Objecttreeitem.TreeItem.itemNode=treewidget.Node class TREEITEMINCANVAS: def __init__(self,object,nom="",parent=None,appli=None,sel=None,rmenu=None): diff --git a/InterfaceTK/treewidget.py b/InterfaceTK/treewidget.py index a5cd49d3..830108c7 100644 --- a/InterfaceTK/treewidget.py +++ b/InterfaceTK/treewidget.py @@ -22,13 +22,13 @@ import os,sys,string,re,types,traceback from Tkinter import * -from InterfaceTK import fontes +import fontes import images from Ihm import CONNECTOR # -__version__="$Name: BR_dev_V1_13 $" -__Id__="$Id: treewidget.py,v 1.1.4.2 2007-10-23 09:07:35 pnoyret Exp $" +__version__="$Name: $" +__Id__="$Id: treewidget.py,v 1.1.4.3 2007-11-16 08:56:03 cchris Exp $" # Fonte_Standard = fontes.standard diff --git a/InterfaceTK/widgets.py b/InterfaceTK/widgets.py index 8edc5ec4..c0dda777 100644 --- a/InterfaceTK/widgets.py +++ b/InterfaceTK/widgets.py @@ -32,8 +32,8 @@ import traceback from tkFileDialog import * from tkMessageBox import showinfo,askyesno,showerror,askretrycancel -from InterfaceTK import fontes -from Aster import prefs +import fontes +import prefs from Editeur.utils import save_in_file from centerwindow import centerwindow