eric7/Project/ProjectInterfacesBrowser.py

branch
eric7
changeset 8312
800c432b34c8
parent 8265
0090cfa83159
child 8318
962bce857696
equal deleted inserted replaced
8311:4e8b98454baa 8312:800c432b34c8
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2002 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing the a class used to display the interfaces (IDL) part
8 of the project.
9 """
10
11 import os
12 import glob
13 import contextlib
14
15 from PyQt5.QtCore import QThread, pyqtSignal, QProcess
16 from PyQt5.QtWidgets import QDialog, QApplication, QMenu
17
18 from E5Gui.E5Application import e5App
19 from E5Gui import E5MessageBox
20 from E5Gui.E5ProgressDialog import E5ProgressDialog
21
22 from .ProjectBrowserModel import (
23 ProjectBrowserFileItem, ProjectBrowserSimpleDirectoryItem,
24 ProjectBrowserDirectoryItem, ProjectBrowserInterfaceType
25 )
26 from .ProjectBaseBrowser import ProjectBaseBrowser
27
28 from UI.BrowserModel import (
29 BrowserFileItem, BrowserClassItem, BrowserMethodItem,
30 BrowserClassAttributeItem
31 )
32 import UI.PixmapCache
33 from UI.NotificationWidget import NotificationTypes
34
35 import Preferences
36 import Utilities
37
38
39 class ProjectInterfacesBrowser(ProjectBaseBrowser):
40 """
41 A class used to display the interfaces (IDL) part of the project.
42
43 @signal appendStdout(str) emitted after something was received from
44 a QProcess on stdout
45 @signal appendStderr(str) emitted after something was received from
46 a QProcess on stderr
47 @signal showMenu(str, QMenu) emitted when a menu is about to be shown.
48 The name of the menu and a reference to the menu are given.
49 """
50 appendStdout = pyqtSignal(str)
51 appendStderr = pyqtSignal(str)
52 showMenu = pyqtSignal(str, QMenu)
53
54 def __init__(self, project, parent=None):
55 """
56 Constructor
57
58 @param project reference to the project object
59 @param parent parent widget of this browser (QWidget)
60 """
61 self.omniidl = Preferences.getCorba("omniidl")
62 if self.omniidl == "":
63 self.omniidl = (
64 Utilities.isWindowsPlatform() and
65 "omniidl.exe" or "omniidl"
66 )
67 if not Utilities.isinpath(self.omniidl):
68 self.omniidl = None
69
70 ProjectBaseBrowser.__init__(self, project,
71 ProjectBrowserInterfaceType, parent)
72
73 self.selectedItemsFilter = [ProjectBrowserFileItem,
74 ProjectBrowserSimpleDirectoryItem]
75
76 self.setWindowTitle(self.tr('Interfaces (IDL)'))
77
78 self.setWhatsThis(self.tr(
79 """<b>Project Interfaces Browser</b>"""
80 """<p>This allows to easily see all interfaces (CORBA IDL files)"""
81 """ contained in the current project. Several actions can be"""
82 """ executed via the context menu.</p>"""
83 ))
84
85 project.prepareRepopulateItem.connect(self._prepareRepopulateItem)
86 project.completeRepopulateItem.connect(self._completeRepopulateItem)
87
88 def _createPopupMenus(self):
89 """
90 Protected overloaded method to generate the popup menu.
91 """
92 self.menuActions = []
93 self.multiMenuActions = []
94 self.dirMenuActions = []
95 self.dirMultiMenuActions = []
96
97 self.sourceMenu = QMenu(self)
98 if self.omniidl is not None:
99 self.sourceMenu.addAction(
100 self.tr('Compile interface'), self.__compileInterface)
101 self.sourceMenu.addAction(
102 self.tr('Compile all interfaces'),
103 self.__compileAllInterfaces)
104 self.sourceMenu.addSeparator()
105 self.sourceMenu.addAction(
106 self.tr('Configure IDL compiler'),
107 self.__configureIdlCompiler)
108 self.sourceMenu.addSeparator()
109 self.sourceMenu.addAction(self.tr('Open'), self._openItem)
110 self.sourceMenu.addSeparator()
111 act = self.sourceMenu.addAction(
112 self.tr('Rename file'), self._renameFile)
113 self.menuActions.append(act)
114 act = self.sourceMenu.addAction(
115 self.tr('Remove from project'), self._removeFile)
116 self.menuActions.append(act)
117 act = self.sourceMenu.addAction(
118 self.tr('Delete'), self.__deleteFile)
119 self.menuActions.append(act)
120 self.sourceMenu.addSeparator()
121 self.sourceMenu.addAction(
122 self.tr('Add interfaces...'), self.__addInterfaceFiles)
123 self.sourceMenu.addAction(
124 self.tr('Add interfaces directory...'),
125 self.__addInterfacesDirectory)
126 self.sourceMenu.addSeparator()
127 self.sourceMenu.addAction(
128 self.tr('Copy Path to Clipboard'), self._copyToClipboard)
129 self.sourceMenu.addSeparator()
130 self.sourceMenu.addAction(
131 self.tr('Expand all directories'), self._expandAllDirs)
132 self.sourceMenu.addAction(
133 self.tr('Collapse all directories'), self._collapseAllDirs)
134 self.sourceMenu.addSeparator()
135 self.sourceMenu.addAction(self.tr('Configure...'), self._configure)
136 self.sourceMenu.addAction(
137 self.tr('Configure CORBA...'), self.__configureCorba)
138
139 self.menu = QMenu(self)
140 if self.omniidl is not None:
141 self.menu.addAction(
142 self.tr('Compile interface'), self.__compileInterface)
143 self.menu.addAction(
144 self.tr('Compile all interfaces'),
145 self.__compileAllInterfaces)
146 self.menu.addSeparator()
147 self.menu.addAction(
148 self.tr('Configure IDL compiler'),
149 self.__configureIdlCompiler)
150 self.menu.addSeparator()
151 self.menu.addAction(self.tr('Open'), self._openItem)
152 self.menu.addSeparator()
153 self.menu.addAction(
154 self.tr('Add interfaces...'), self.__addInterfaceFiles)
155 self.menu.addAction(
156 self.tr('Add interfaces directory...'),
157 self.__addInterfacesDirectory)
158 self.menu.addSeparator()
159 self.menu.addAction(
160 self.tr('Expand all directories'), self._expandAllDirs)
161 self.menu.addAction(
162 self.tr('Collapse all directories'), self._collapseAllDirs)
163 self.menu.addSeparator()
164 self.menu.addAction(self.tr('Configure...'), self._configure)
165 self.menu.addAction(
166 self.tr('Configure CORBA...'), self.__configureCorba)
167
168 self.backMenu = QMenu(self)
169 if self.omniidl is not None:
170 self.backMenu.addAction(
171 self.tr('Compile all interfaces'),
172 self.__compileAllInterfaces)
173 self.backMenu.addSeparator()
174 self.backMenu.addAction(
175 self.tr('Configure IDL compiler'),
176 self.__configureIdlCompiler)
177 self.backMenu.addSeparator()
178 self.backMenu.addAction(
179 self.tr('Add interfaces...'), self.project.addIdlFiles)
180 self.backMenu.addAction(
181 self.tr('Add interfaces directory...'), self.project.addIdlDir)
182 self.backMenu.addSeparator()
183 self.backMenu.addAction(
184 self.tr('Expand all directories'), self._expandAllDirs)
185 self.backMenu.addAction(
186 self.tr('Collapse all directories'), self._collapseAllDirs)
187 self.backMenu.addSeparator()
188 self.backMenu.addAction(self.tr('Configure...'), self._configure)
189 self.backMenu.addAction(
190 self.tr('Configure CORBA...'), self.__configureCorba)
191 self.backMenu.setEnabled(False)
192
193 # create the menu for multiple selected files
194 self.multiMenu = QMenu(self)
195 if self.omniidl is not None:
196 self.multiMenu.addAction(
197 self.tr('Compile interfaces'),
198 self.__compileSelectedInterfaces)
199 self.multiMenu.addSeparator()
200 self.multiMenu.addAction(
201 self.tr('Configure IDL compiler'),
202 self.__configureIdlCompiler)
203 self.multiMenu.addSeparator()
204 self.multiMenu.addAction(self.tr('Open'), self._openItem)
205 self.multiMenu.addSeparator()
206 act = self.multiMenu.addAction(
207 self.tr('Remove from project'), self._removeFile)
208 self.multiMenuActions.append(act)
209 act = self.multiMenu.addAction(
210 self.tr('Delete'), self.__deleteFile)
211 self.multiMenuActions.append(act)
212 self.multiMenu.addSeparator()
213 self.multiMenu.addAction(
214 self.tr('Expand all directories'), self._expandAllDirs)
215 self.multiMenu.addAction(
216 self.tr('Collapse all directories'), self._collapseAllDirs)
217 self.multiMenu.addSeparator()
218 self.multiMenu.addAction(self.tr('Configure...'), self._configure)
219 self.multiMenu.addAction(
220 self.tr('Configure CORBA...'), self.__configureCorba)
221
222 self.dirMenu = QMenu(self)
223 if self.omniidl is not None:
224 self.dirMenu.addAction(
225 self.tr('Compile all interfaces'),
226 self.__compileAllInterfaces)
227 self.dirMenu.addSeparator()
228 self.dirMenu.addAction(
229 self.tr('Configure IDL compiler'),
230 self.__configureIdlCompiler)
231 self.dirMenu.addSeparator()
232 act = self.dirMenu.addAction(
233 self.tr('Remove from project'), self._removeFile)
234 self.dirMenuActions.append(act)
235 act = self.dirMenu.addAction(
236 self.tr('Delete'), self._deleteDirectory)
237 self.dirMenuActions.append(act)
238 self.dirMenu.addSeparator()
239 self.dirMenu.addAction(
240 self.tr('Add interfaces...'), self.__addInterfaceFiles)
241 self.dirMenu.addAction(
242 self.tr('Add interfaces directory...'),
243 self.__addInterfacesDirectory)
244 self.dirMenu.addSeparator()
245 self.dirMenu.addAction(
246 self.tr('Copy Path to Clipboard'), self._copyToClipboard)
247 self.dirMenu.addSeparator()
248 self.dirMenu.addAction(
249 self.tr('Expand all directories'), self._expandAllDirs)
250 self.dirMenu.addAction(
251 self.tr('Collapse all directories'), self._collapseAllDirs)
252 self.dirMenu.addSeparator()
253 self.dirMenu.addAction(self.tr('Configure...'), self._configure)
254 self.dirMenu.addAction(
255 self.tr('Configure CORBA...'), self.__configureCorba)
256
257 self.dirMultiMenu = QMenu(self)
258 if self.omniidl is not None:
259 self.dirMultiMenu.addAction(
260 self.tr('Compile all interfaces'),
261 self.__compileAllInterfaces)
262 self.dirMultiMenu.addSeparator()
263 self.dirMultiMenu.addAction(
264 self.tr('Configure IDL compiler'),
265 self.__configureIdlCompiler)
266 self.dirMultiMenu.addSeparator()
267 self.dirMultiMenu.addAction(
268 self.tr('Add interfaces...'), self.project.addIdlFiles)
269 self.dirMultiMenu.addAction(
270 self.tr('Add interfaces directory...'), self.project.addIdlDir)
271 self.dirMultiMenu.addSeparator()
272 self.dirMultiMenu.addAction(
273 self.tr('Expand all directories'), self._expandAllDirs)
274 self.dirMultiMenu.addAction(
275 self.tr('Collapse all directories'), self._collapseAllDirs)
276 self.dirMultiMenu.addSeparator()
277 self.dirMultiMenu.addAction(
278 self.tr('Configure...'), self._configure)
279 self.dirMultiMenu.addAction(self.tr('Configure CORBA...'),
280 self.__configureCorba)
281
282 self.sourceMenu.aboutToShow.connect(self.__showContextMenu)
283 self.multiMenu.aboutToShow.connect(self.__showContextMenuMulti)
284 self.dirMenu.aboutToShow.connect(self.__showContextMenuDir)
285 self.dirMultiMenu.aboutToShow.connect(self.__showContextMenuDirMulti)
286 self.backMenu.aboutToShow.connect(self.__showContextMenuBack)
287 self.mainMenu = self.sourceMenu
288
289 def _contextMenuRequested(self, coord):
290 """
291 Protected slot to show the context menu.
292
293 @param coord the position of the mouse pointer (QPoint)
294 """
295 if not self.project.isOpen():
296 return
297
298 with contextlib.suppress(Exception):
299 categories = self.getSelectedItemsCountCategorized(
300 [ProjectBrowserFileItem, BrowserClassItem,
301 BrowserMethodItem, ProjectBrowserSimpleDirectoryItem])
302 cnt = categories["sum"]
303 if cnt <= 1:
304 index = self.indexAt(coord)
305 if index.isValid():
306 self._selectSingleItem(index)
307 categories = self.getSelectedItemsCountCategorized(
308 [ProjectBrowserFileItem, BrowserClassItem,
309 BrowserMethodItem, ProjectBrowserSimpleDirectoryItem])
310 cnt = categories["sum"]
311
312 bfcnt = categories[str(ProjectBrowserFileItem)]
313 cmcnt = (
314 categories[str(BrowserClassItem)] +
315 categories[str(BrowserMethodItem)]
316 )
317 sdcnt = categories[str(ProjectBrowserSimpleDirectoryItem)]
318 if cnt > 1 and cnt == bfcnt:
319 self.multiMenu.popup(self.mapToGlobal(coord))
320 elif cnt > 1 and cnt == sdcnt:
321 self.dirMultiMenu.popup(self.mapToGlobal(coord))
322 else:
323 index = self.indexAt(coord)
324 if cnt == 1 and index.isValid():
325 if bfcnt == 1 or cmcnt == 1:
326 itm = self.model().item(index)
327 if isinstance(itm, ProjectBrowserFileItem):
328 self.sourceMenu.popup(self.mapToGlobal(coord))
329 elif isinstance(
330 itm,
331 (BrowserClassItem, BrowserMethodItem)
332 ):
333 self.menu.popup(self.mapToGlobal(coord))
334 else:
335 self.backMenu.popup(self.mapToGlobal(coord))
336 elif sdcnt == 1:
337 self.dirMenu.popup(self.mapToGlobal(coord))
338 else:
339 self.backMenu.popup(self.mapToGlobal(coord))
340 else:
341 self.backMenu.popup(self.mapToGlobal(coord))
342
343 def __showContextMenu(self):
344 """
345 Private slot called by the menu aboutToShow signal.
346 """
347 ProjectBaseBrowser._showContextMenu(self, self.menu)
348
349 self.showMenu.emit("Main", self.menu)
350
351 def __showContextMenuMulti(self):
352 """
353 Private slot called by the multiMenu aboutToShow signal.
354 """
355 ProjectBaseBrowser._showContextMenuMulti(self, self.multiMenu)
356
357 self.showMenu.emit("MainMulti", self.multiMenu)
358
359 def __showContextMenuDir(self):
360 """
361 Private slot called by the dirMenu aboutToShow signal.
362 """
363 ProjectBaseBrowser._showContextMenuDir(self, self.dirMenu)
364
365 self.showMenu.emit("MainDir", self.dirMenu)
366
367 def __showContextMenuDirMulti(self):
368 """
369 Private slot called by the dirMultiMenu aboutToShow signal.
370 """
371 ProjectBaseBrowser._showContextMenuDirMulti(self, self.dirMultiMenu)
372
373 self.showMenu.emit("MainDirMulti", self.dirMultiMenu)
374
375 def __showContextMenuBack(self):
376 """
377 Private slot called by the backMenu aboutToShow signal.
378 """
379 ProjectBaseBrowser._showContextMenuBack(self, self.backMenu)
380
381 self.showMenu.emit("MainBack", self.backMenu)
382
383 def _openItem(self):
384 """
385 Protected slot to handle the open popup menu entry.
386 """
387 itmList = self.getSelectedItems(
388 [BrowserFileItem, BrowserClassItem, BrowserMethodItem,
389 BrowserClassAttributeItem])
390
391 for itm in itmList:
392 if isinstance(itm, BrowserFileItem):
393 self.sourceFile[str].emit(itm.fileName())
394 elif isinstance(itm, BrowserClassItem):
395 self.sourceFile[str, int].emit(
396 itm.fileName(), itm.classObject().lineno)
397 elif isinstance(itm, BrowserMethodItem):
398 self.sourceFile[str, int].emit(
399 itm.fileName(), itm.functionObject().lineno)
400 elif isinstance(itm, BrowserClassAttributeItem):
401 self.sourceFile[str, int].emit(
402 itm.fileName(), itm.attributeObject().lineno)
403
404 def __addInterfaceFiles(self):
405 """
406 Private method to add interface files to the project.
407 """
408 itm = self.model().item(self.currentIndex())
409 if isinstance(
410 itm,
411 (ProjectBrowserFileItem, BrowserClassItem, BrowserMethodItem)
412 ):
413 dn = os.path.dirname(itm.fileName())
414 elif isinstance(
415 itm,
416 (ProjectBrowserSimpleDirectoryItem, ProjectBrowserDirectoryItem)
417 ):
418 dn = itm.dirName()
419 else:
420 dn = None
421 self.project.addFiles('interface', dn)
422
423 def __addInterfacesDirectory(self):
424 """
425 Private method to add interface files of a directory to the project.
426 """
427 itm = self.model().item(self.currentIndex())
428 if isinstance(
429 itm,
430 (ProjectBrowserFileItem, BrowserClassItem, BrowserMethodItem)
431 ):
432 dn = os.path.dirname(itm.fileName())
433 elif isinstance(
434 itm,
435 (ProjectBrowserSimpleDirectoryItem, ProjectBrowserDirectoryItem)
436 ):
437 dn = itm.dirName()
438 else:
439 dn = None
440 self.project.addDirectory('interface', dn)
441
442 def __deleteFile(self):
443 """
444 Private method to delete files from the project.
445 """
446 itmList = self.getSelectedItems()
447
448 files = []
449 fullNames = []
450 for itm in itmList:
451 fn2 = itm.fileName()
452 fullNames.append(fn2)
453 fn = self.project.getRelativePath(fn2)
454 files.append(fn)
455
456 from UI.DeleteFilesConfirmationDialog import (
457 DeleteFilesConfirmationDialog
458 )
459 dlg = DeleteFilesConfirmationDialog(
460 self.parent(),
461 self.tr("Delete interfaces"),
462 self.tr("Do you really want to delete these interfaces from"
463 " the project?"),
464 files)
465
466 if dlg.exec() == QDialog.DialogCode.Accepted:
467 for fn2, fn in zip(fullNames, files):
468 self.closeSourceWindow.emit(fn2)
469 self.project.deleteFile(fn)
470
471 ###########################################################################
472 ## Methods to handle the various compile commands
473 ###########################################################################
474
475 def __readStdout(self):
476 """
477 Private slot to handle the readyReadStandardOutput signal of the
478 omniidl process.
479 """
480 if self.compileProc is None:
481 return
482
483 ioEncoding = Preferences.getSystem("IOEncoding")
484
485 self.compileProc.setReadChannel(QProcess.ProcessChannel.StandardOutput)
486 while self.compileProc and self.compileProc.canReadLine():
487 s = 'omniidl: '
488 output = str(self.compileProc.readLine(), ioEncoding, 'replace')
489 s += output
490 self.appendStdout.emit(s)
491
492 def __readStderr(self):
493 """
494 Private slot to handle the readyReadStandardError signal of the
495 omniidl process.
496 """
497 if self.compileProc is None:
498 return
499
500 ioEncoding = Preferences.getSystem("IOEncoding")
501
502 self.compileProc.setReadChannel(QProcess.ProcessChannel.StandardError)
503 while self.compileProc and self.compileProc.canReadLine():
504 s = 'omniidl: '
505 error = str(self.compileProc.readLine(), ioEncoding, 'replace')
506 s += error
507 self.appendStderr.emit(s)
508
509 def __compileIDLDone(self, exitCode, exitStatus):
510 """
511 Private slot to handle the finished signal of the omniidl process.
512
513 @param exitCode exit code of the process (integer)
514 @param exitStatus exit status of the process (QProcess.ExitStatus)
515 """
516 self.compileRunning = False
517 ui = e5App().getObject("UserInterface")
518 if exitStatus == QProcess.ExitStatus.NormalExit and exitCode == 0:
519 path = os.path.dirname(self.idlFile)
520 poaList = glob.glob(os.path.join(path, "*__POA"))
521 npoaList = [f.replace("__POA", "") for f in poaList]
522 fileList = glob.glob(os.path.join(path, "*_idl.py"))
523 for directory in poaList + npoaList:
524 fileList += Utilities.direntries(directory, True, "*.py")
525 for file in fileList:
526 self.project.appendFile(file)
527 ui.showNotification(
528 UI.PixmapCache.getPixmap("corba48"),
529 self.tr("Interface Compilation"),
530 self.tr(
531 "The compilation of the interface file was"
532 " successful."))
533 else:
534 ui.showNotification(
535 UI.PixmapCache.getPixmap("corba48"),
536 self.tr("Interface Compilation"),
537 self.tr(
538 "The compilation of the interface file failed."),
539 kind=NotificationTypes.CRITICAL,
540 timeout=0)
541 self.compileProc = None
542
543 def __compileIDL(self, fn, noDialog=False, progress=None):
544 """
545 Private method to compile a .idl file to python.
546
547 @param fn filename of the .idl file to be compiled (string)
548 @param noDialog flag indicating silent operations (boolean)
549 @param progress reference to the progress dialog (E5ProgressDialog)
550 @return reference to the compile process (QProcess)
551 """
552 params = self.project.pdata["IDLPARAMS"]
553
554 self.compileProc = QProcess()
555 args = []
556
557 args.append("-bpython")
558 args.append("-I.")
559 for directory in params["IncludeDirs"]:
560 args.append("-I{0}".format(
561 self.project.getAbsoluteUniversalPath(directory)))
562 for name in params["DefinedNames"]:
563 args.append("-D{0}".format(name))
564 for name in params["UndefinedNames"]:
565 args.append("-U{0}".format(name))
566
567 fn = self.project.getAbsoluteUniversalPath(fn)
568 self.idlFile = fn
569 args.append("-C{0}".format(os.path.dirname(fn)))
570 args.append(fn)
571
572 self.compileProc.finished.connect(self.__compileIDLDone)
573 self.compileProc.readyReadStandardOutput.connect(self.__readStdout)
574 self.compileProc.readyReadStandardError.connect(self.__readStderr)
575
576 self.noDialog = noDialog
577 self.compileProc.start(self.omniidl, args)
578 procStarted = self.compileProc.waitForStarted(5000)
579 if procStarted:
580 self.compileRunning = True
581 return self.compileProc
582 else:
583 self.compileRunning = False
584 if progress is not None:
585 progress.cancel()
586 E5MessageBox.critical(
587 self,
588 self.tr('Process Generation Error'),
589 self.tr(
590 '<p>Could not start {0}.<br>'
591 'Ensure that it is in the search path.</p>'
592 ).format(self.omniidl))
593 return None
594
595 def __compileInterface(self):
596 """
597 Private method to compile an interface to python.
598 """
599 if self.omniidl is not None:
600 itm = self.model().item(self.currentIndex())
601 fn2 = itm.fileName()
602 fn = self.project.getRelativePath(fn2)
603 self.__compileIDL(fn)
604
605 def __compileAllInterfaces(self):
606 """
607 Private method to compile all interfaces to python.
608 """
609 if self.omniidl is not None:
610 numIDLs = len(self.project.pdata["INTERFACES"])
611 progress = E5ProgressDialog(
612 self.tr("Compiling interfaces..."),
613 self.tr("Abort"), 0, numIDLs,
614 self.tr("%v/%m Interfaces"), self)
615 progress.setModal(True)
616 progress.setMinimumDuration(0)
617 progress.setWindowTitle(self.tr("Interfaces"))
618
619 for prog, fn in enumerate(self.project.pdata["INTERFACES"]):
620 progress.setValue(prog)
621 if progress.wasCanceled():
622 break
623 proc = self.__compileIDL(fn, True, progress)
624 if proc is not None:
625 while proc.state() == QProcess.ProcessState.Running:
626 QApplication.processEvents()
627 QThread.msleep(300)
628 QApplication.processEvents()
629 else:
630 break
631 progress.setValue(numIDLs)
632
633 def __compileSelectedInterfaces(self):
634 """
635 Private method to compile selected interfaces to python.
636 """
637 if self.omniidl is not None:
638 items = self.getSelectedItems()
639
640 files = [self.project.getRelativePath(itm.fileName())
641 for itm in items]
642 numIDLs = len(files)
643 progress = E5ProgressDialog(
644 self.tr("Compiling interfaces..."),
645 self.tr("Abort"), 0, numIDLs,
646 self.tr("%v/%m Interfaces"), self)
647 progress.setModal(True)
648 progress.setMinimumDuration(0)
649 progress.setWindowTitle(self.tr("Interfaces"))
650
651 for prog, fn in enumerate(files):
652 progress.setValue(prog)
653 if progress.wasCanceled():
654 break
655 proc = self.__compileIDL(fn, True, progress)
656 if proc is not None:
657 while proc.state() == QProcess.ProcessState.Running:
658 QApplication.processEvents()
659 QThread.msleep(300)
660 QApplication.processEvents()
661 else:
662 break
663 progress.setValue(numIDLs)
664
665 def __configureIdlCompiler(self):
666 """
667 Private method to show a dialog to configure some options for the
668 IDL compiler.
669 """
670 params = self.project.pdata["IDLPARAMS"]
671
672 from .IdlCompilerOptionsDialog import IdlCompilerOptionsDialog
673 dlg = IdlCompilerOptionsDialog(
674 params["IncludeDirs"][:], params["DefinedNames"][:],
675 params["UndefinedNames"][:], self.project, self)
676 if dlg.exec() == QDialog.DialogCode.Accepted:
677 include, defined, undefined = dlg.getData()
678 if include != params["IncludeDirs"]:
679 params["IncludeDirs"] = include[:]
680 self.project.setDirty(True)
681 if defined != params["DefinedNames"]:
682 params["DefinedNames"] = defined[:]
683 self.project.setDirty(True)
684 if undefined != params["UndefinedNames"]:
685 params["UndefinedNames"] = undefined[:]
686 self.project.setDirty(True)
687
688 def __configureCorba(self):
689 """
690 Private method to open the configuration dialog.
691 """
692 e5App().getObject("UserInterface").showPreferences("corbaPage")

eric ide

mercurial