42 QCustomEvent.__init__(self,8888)
46 QMessageBox.warning(parent,self.
caption,self.
msg)
50 threading.Thread.__init__(self)
57 self.executor.RunW(self.
proc,0)
60 QApplication.postEvent(self.
parent,
ErrorEvent(
'YACS execution error',str(ex)))
64 QVBox.__init__(self,parent)
70 self.objectBrowser.additem(pp)
72 self.panelManager.setRootItem(pp)
74 self.boxManager.setRootItem(pp)
82 self.log.text.setText(self.proc.getLogger(
"parser").getStr())
100 if self.
thr and self.thr.isAlive():
103 self.executor.setExecMode(0)
107 self.thr.setDaemon(1)
114 """Suspend or resume an executing schema"""
117 if not self.thr.isAlive():
122 self.executor.setExecMode(0)
124 self.executor.resumeCurrentBreakPoint()
128 self.executor.setExecMode(1)
132 """Step on a paused schema"""
134 self.
executor = pilot.ExecutorSwig()
135 if not self.
thr or not self.thr.isAlive():
137 self.executor.setExecMode(1)
139 self.thr.setDaemon(1)
146 self.executor.setExecMode(1)
148 self.executor.resumeCurrentBreakPoint()
151 """Stop the schema"""
154 if not self.thr.isAlive():
156 self.executor.setExecMode(1)
157 self.executor.waitPause()
158 self.executor.resumeCurrentBreakPoint()
164 Cree la fenetre principale de l'interface utilisateur
167 QMainWindow.__init__(self)
188 self.
newAct=QAction(
'New', QIconSet(Icons.get_image(
"new")),
'&New',
189 QKeySequence(
"CTRL+N"),self)
190 self.newAct.setStatusTip(
'Open an empty editor window')
191 self.newAct.setWhatsThis(
"""<b>New</b>"""
192 """<p>An empty editor window will be created.</p>""")
193 self.newAct.connect(self.
newAct,SIGNAL(
'activated()'), self.
newProc)
194 self.actions.append(self.
newAct)
196 self.
prefAct=QAction(
'Preferences',QIconSet(Icons.get_image(
"configure.png")),
'&Preferences...',
198 self.prefAct.setStatusTip(
'Set the prefered configuration')
199 self.prefAct.setWhatsThis(
"""<b>Preferences</b>"""
200 """<p>Set the configuration items of the application"""
201 """ with your prefered values.</p>""")
203 self.actions.append(self.
prefAct)
205 self.
runAct=QAction(
'Run',QIconSet(Icons.get_image(
"run.png")),
'&Run',0,self)
206 self.runAct.connect(self.
runAct,SIGNAL(
'activated()'), self.
run)
207 self.runAct.setStatusTip(
'Run the selected schema')
208 self.actions.append(self.
runAct)
210 self.
suspAct=QAction(
'Suspend/resume',QIconSet(Icons.get_image(
"suspend-resume.gif")),
'&Suspend/resume',0,self)
211 self.suspAct.connect(self.
suspAct,SIGNAL(
'activated()'), self.
susp)
212 self.suspAct.setStatusTip(
'Suspend/resume the selected schema')
213 self.actions.append(self.
suspAct)
215 self.
stepAct=QAction(
'Step',QIconSet(Icons.get_image(
"steps.png")),
'&Step',0,self)
216 self.stepAct.connect(self.
stepAct,SIGNAL(
'activated()'), self.
step)
217 self.stepAct.setStatusTip(
'Step the selected schema')
218 self.actions.append(self.
stepAct)
220 self.
stopAct=QAction(
'Stop',QIconSet(Icons.get_image(
"kill.png")),
'&Stop',0,self)
221 self.stopAct.connect(self.
stopAct,SIGNAL(
'activated()'), self.
stop)
222 self.stopAct.setStatusTip(
'Stop the selected schema')
223 self.actions.append(self.
stopAct)
230 menubar = self.menuBar()
235 self.fileMenu.insertItem(
"&Open", self.
openFile)
238 self.fileMenu.insertItem(
"Loaders", self.
loadersMenu)
240 for file
in glob.glob(
"/local/chris/SALOME2/SUPERV/YACS/BR_CC/YACS_SRC/src/pyqt/*loader.py"):
241 d,f=os.path.split(file)
243 def call_loader(event,obj=self,file=file):
244 obj.openFileWithLoader(file)
245 self.loaders.append(call_loader)
246 self.loadersMenu.insertItem(name, call_loader)
247 menubar.insertItem(
'&File',self.
fileMenu)
252 self.settingsMenu.insertTearOffHandle()
257 self.editMenu.insertItem(
"&Add node", self.
addNode)
258 menubar.insertItem(
'&Edit', self.
editMenu)
263 self.layoutMenu.insertItem(
"&Left Right", self.
LR)
264 self.layoutMenu.insertItem(
"Right Left", self.
RL)
265 self.layoutMenu.insertItem(
"Top Bottom", self.
TB)
266 self.layoutMenu.insertItem(
"Bottom Top", self.
BT)
268 self.canvasMenu.insertItem(
"&Zoom in", self.
zoomIn)
269 self.canvasMenu.insertItem(
"Zoom &out", self.
zoomOut)
270 self.canvasMenu.insertItem(
"Layout", self.
layoutMenu)
271 self.canvasMenu.insertItem(
"Ortholinks", self.
orthoLinks)
272 self.canvasMenu.insertItem(
"Clearlinks", self.
clearLinks)
273 self.canvasMenu.insertItem(
"&Update", self.
updateCanvas)
274 menubar.insertItem(
'&Canvas', self.
canvasMenu)
279 self.windowMenu.insertItem(
"&Log", self.
view_log)
280 menubar.insertItem(
'&Window', self.
windowMenu)
285 menubar.insertItem(
'&Help',self.
help)
286 self.help.insertItem(
'&About',self.
about,Qt.Key_F1)
287 self.help.insertItem(
'About &Qt',self.
aboutQt)
297 self.loader.registerProcCataLoader()
300 fn = QFileDialog.getOpenFileName(QString.null,QString.null,self)
302 self.statusBar().message(
'Loading aborted',2000)
305 proc=self.salomeloader.load(fileName)
306 logger=proc.getLogger(
"parser")
307 if logger.hasErrors():
309 self.logFile.text.setText(logger.getStr())
314 self.tabWidget.addTab( panel,os.path.basename(fileName))
315 self.tabWidget.showPage(panel)
318 fn = QFileDialog.getOpenFileName(QString.null,QString.null,self)
320 self.statusBar().message(
'Loading aborted',2000)
323 proc=self.loader.load(fileName)
324 logger=proc.getLogger(
"parser")
325 if logger.hasErrors():
327 self.logFile.text.setText(logger.getStr())
332 self.tabWidget.addTab( panel,os.path.basename(fileName))
333 self.tabWidget.showPage(panel)
337 proc=r.createProc(
"pr")
340 self.tabWidget.addTab( panel,proc.getName())
341 self.tabWidget.showPage(panel)
344 d,f=os.path.split(file)
346 module=__import__(os.path.splitext(f)[0])
348 loader=module.Loader()
350 fn = QFileDialog.getOpenFileName(QString.null,QString.null,self)
352 self.statusBar().message(
'Loading aborted',2000)
355 proc=loader.load(fileName)
356 logger=proc.getLogger(
"parser")
357 if logger.hasErrors():
359 self.logFile.text.setText(logger.getStr())
364 self.tabWidget.addTab( panel,os.path.basename(fileName))
365 self.tabWidget.showPage(panel)
369 self.catalogTool.show()
374 self.currentPanel.view_log()
382 if self.
currentPanel and self.currentPanel.panelManager.visible:
383 self.currentPanel.panelManager.visible.layout(orient)
386 if self.currentPanel.selected:
389 self.currentPanel.selected.graph.editor.updateCanvas()
395 self.currentPanel.selected.addNode(node)
398 if self.
currentPanel and self.currentPanel.panelManager.visible:
401 self.currentPanel.panelManager.visible.graph.editor.zoomIn()
404 if self.
currentPanel and self.currentPanel.panelManager.visible:
407 self.currentPanel.panelManager.visible.graph.editor.zoomOut()
410 if self.
currentPanel and self.currentPanel.panelManager.visible:
413 self.currentPanel.panelManager.visible.graph.orthoLinks()
416 if self.
currentPanel and self.currentPanel.panelManager.visible:
419 self.currentPanel.panelManager.visible.graph.clearLinks()
428 QMessageBox.about(self,
'YACS browser GUI',
'YACS browser GUI')
431 QMessageBox.aboutQt(self,
'YACS browser GUI')
435 self.currentPanel.run()
439 self.currentPanel.susp()
443 self.currentPanel.step()
447 self.currentPanel.stop()
451 self.newAct.addTo(tb)
452 self.runAct.addTo(tb)
453 self.suspAct.addTo(tb)
454 self.stepAct.addTo(tb)
455 self.stopAct.addTo(tb)
460 sb = self.statusBar()
463 QWhatsThis.add(self.
SBfile,
464 """<p>Partie de la statusbar qui donne le nom"""
465 """du fichier courant. </p>""")
466 self.SBfile.setText(
"")
469 if __name__ ==
"__main__":
470 from Item
import Item
471 app = QApplication(sys.argv)
473 t.objectBrowser.additem(Item(
"item1"))
474 n=t.objectBrowser.additem(Item(
"item2"))
475 n.additem(Item(
"item3"))