Salome HOME
59852ca8ee5cad6337f9159196f90564269f028b
[modules/eficas.git] / src / EFICASGUI / EFICASGUI.py
1 """
2     Interface PyQt
3 """
4 import qt
5 import libSALOME_Swig
6 import SalomePyQt
7
8 # Variable globale pour stocker le Workspace de Salome
9
10 WORKSPACE=None
11 studyId=None
12
13 # -----------------------------------------------------------------------------
14
15 import notifqt
16 #import Tkinter
17 #root=Tkinter.Tk()
18 #root.withdraw()
19
20 def g():
21    print "lastWindowClosed()"
22    root.destroy()
23
24 qt.QObject.connect(qt.qApp,qt.SIGNAL("lastWindowClosed()"),g)
25
26 # -----------------------------------------------------------------------------
27
28 import salome
29
30 sg=salome.SalomeGUI()
31 sgPyQt=SalomePyQt.SalomePyQt()
32 print "EFicasGUI :: :::::::::::::::::::::::::::::::::::::::::::::::::::::"
33
34 # -----------------------------------------------------------------------------
35
36 def setWorkSpace(workSpace):
37    print "EficasGUI --- setWorkSpace"
38    global WORKSPACE
39    print workSpace
40    WORKSPACE=workSpace
41    print "WORKSPACE: ",WORKSPACE
42    # le desktop
43    d=sgPyQt.getDesktop()
44
45    # creation d'une message box
46    #qt.QMessageBox.information(d,"titre","message")
47
48    # recuperation du workspace
49    ws=sgPyQt.getMainFrame()
50    print ws
51
52 # -----------------------------------------------------------------------------
53
54 def OnGUIEvent(commandID) :
55    print "EficasGUI :: OnGUIEvent :::::::::::::::::::::::::::::::::commandID,WORKSPACE = ",commandID,WORKSPACE
56    if dict_command.has_key(commandID):
57       print "OnGUIEvent ::::::::::  commande associée  : ",commandID      
58       dict_command[commandID](WORKSPACE)
59    else:
60       print "Pas de commande associée a : ",commandID
61
62 # -----------------------------------------------------------------------------
63
64 def setSettings():
65    print "setSettings"
66    print sgPyQt.getStudyId()
67
68 # -----------------------------------------------------------------------------
69
70 def activeStudyChanged(ID):
71    global studyId
72    # ne marche pas car sg est supposé résider dans une etude
73    # studyId=sg.getActiveStudyId()
74    studyId=ID
75    print "studyId: ",sg.getActiveStudyId()
76    print "On a changé d'étude active",studyId
77    print sgPyQt.getStudyId()
78
79
80 # -----------------------------------------------------------------------------
81
82 import eficasSalome
83
84 def runEficas(ws):
85    print "runEficas"
86    eficasSalome.runEficas(ws,"ASTER")
87    
88 def runEficaspourHomard(ws):
89    print "runEficas"
90    eficasSalome.runEficas(ws,"HOMARD")
91     
92 def runEficasHomard():
93    print "runEficas"
94    eficasSalome.runEficas(None,"HOMARD")
95
96 # Partie applicative
97
98 dict_command={
99                941:runEficas,
100                946:runEficaspourHomard,
101                4041:runEficas,
102                4046:runEficaspourHomard,
103              }
104