13 import contextlib |
13 import contextlib |
14 |
14 |
15 from PyQt6.QtCore import QThread, pyqtSignal, QProcess |
15 from PyQt6.QtCore import QThread, pyqtSignal, QProcess |
16 from PyQt6.QtWidgets import QDialog, QApplication, QMenu |
16 from PyQt6.QtWidgets import QDialog, QApplication, QMenu |
17 |
17 |
18 from E5Gui.E5Application import e5App |
18 from E5Gui.EricApplication import ericApp |
19 from E5Gui import E5MessageBox |
19 from E5Gui import EricMessageBox |
20 from E5Gui.E5ProgressDialog import E5ProgressDialog |
20 from E5Gui.EricProgressDialog import EricProgressDialog |
21 |
21 |
22 from .ProjectBrowserModel import ( |
22 from .ProjectBrowserModel import ( |
23 ProjectBrowserFileItem, ProjectBrowserSimpleDirectoryItem, |
23 ProjectBrowserFileItem, ProjectBrowserSimpleDirectoryItem, |
24 ProjectBrowserDirectoryItem, ProjectBrowserInterfaceType |
24 ProjectBrowserDirectoryItem, ProjectBrowserInterfaceType |
25 ) |
25 ) |
512 |
512 |
513 @param exitCode exit code of the process (integer) |
513 @param exitCode exit code of the process (integer) |
514 @param exitStatus exit status of the process (QProcess.ExitStatus) |
514 @param exitStatus exit status of the process (QProcess.ExitStatus) |
515 """ |
515 """ |
516 self.compileRunning = False |
516 self.compileRunning = False |
517 ui = e5App().getObject("UserInterface") |
517 ui = ericApp().getObject("UserInterface") |
518 if exitStatus == QProcess.ExitStatus.NormalExit and exitCode == 0: |
518 if exitStatus == QProcess.ExitStatus.NormalExit and exitCode == 0: |
519 path = os.path.dirname(self.idlFile) |
519 path = os.path.dirname(self.idlFile) |
520 poaList = glob.glob(os.path.join(path, "*__POA")) |
520 poaList = glob.glob(os.path.join(path, "*__POA")) |
521 npoaList = [f.replace("__POA", "") for f in poaList] |
521 npoaList = [f.replace("__POA", "") for f in poaList] |
522 fileList = glob.glob(os.path.join(path, "*_idl.py")) |
522 fileList = glob.glob(os.path.join(path, "*_idl.py")) |
544 """ |
544 """ |
545 Private method to compile a .idl file to python. |
545 Private method to compile a .idl file to python. |
546 |
546 |
547 @param fn filename of the .idl file to be compiled (string) |
547 @param fn filename of the .idl file to be compiled (string) |
548 @param noDialog flag indicating silent operations (boolean) |
548 @param noDialog flag indicating silent operations (boolean) |
549 @param progress reference to the progress dialog (E5ProgressDialog) |
549 @param progress reference to the progress dialog (EricProgressDialog) |
550 @return reference to the compile process (QProcess) |
550 @return reference to the compile process (QProcess) |
551 """ |
551 """ |
552 params = self.project.pdata["IDLPARAMS"] |
552 params = self.project.pdata["IDLPARAMS"] |
553 |
553 |
554 self.compileProc = QProcess() |
554 self.compileProc = QProcess() |
581 return self.compileProc |
581 return self.compileProc |
582 else: |
582 else: |
583 self.compileRunning = False |
583 self.compileRunning = False |
584 if progress is not None: |
584 if progress is not None: |
585 progress.cancel() |
585 progress.cancel() |
586 E5MessageBox.critical( |
586 EricMessageBox.critical( |
587 self, |
587 self, |
588 self.tr('Process Generation Error'), |
588 self.tr('Process Generation Error'), |
589 self.tr( |
589 self.tr( |
590 '<p>Could not start {0}.<br>' |
590 '<p>Could not start {0}.<br>' |
591 'Ensure that it is in the search path.</p>' |
591 'Ensure that it is in the search path.</p>' |
606 """ |
606 """ |
607 Private method to compile all interfaces to python. |
607 Private method to compile all interfaces to python. |
608 """ |
608 """ |
609 if self.omniidl is not None: |
609 if self.omniidl is not None: |
610 numIDLs = len(self.project.pdata["INTERFACES"]) |
610 numIDLs = len(self.project.pdata["INTERFACES"]) |
611 progress = E5ProgressDialog( |
611 progress = EricProgressDialog( |
612 self.tr("Compiling interfaces..."), |
612 self.tr("Compiling interfaces..."), |
613 self.tr("Abort"), 0, numIDLs, |
613 self.tr("Abort"), 0, numIDLs, |
614 self.tr("%v/%m Interfaces"), self) |
614 self.tr("%v/%m Interfaces"), self) |
615 progress.setModal(True) |
615 progress.setModal(True) |
616 progress.setMinimumDuration(0) |
616 progress.setMinimumDuration(0) |
638 items = self.getSelectedItems() |
638 items = self.getSelectedItems() |
639 |
639 |
640 files = [self.project.getRelativePath(itm.fileName()) |
640 files = [self.project.getRelativePath(itm.fileName()) |
641 for itm in items] |
641 for itm in items] |
642 numIDLs = len(files) |
642 numIDLs = len(files) |
643 progress = E5ProgressDialog( |
643 progress = EricProgressDialog( |
644 self.tr("Compiling interfaces..."), |
644 self.tr("Compiling interfaces..."), |
645 self.tr("Abort"), 0, numIDLs, |
645 self.tr("Abort"), 0, numIDLs, |
646 self.tr("%v/%m Interfaces"), self) |
646 self.tr("%v/%m Interfaces"), self) |
647 progress.setModal(True) |
647 progress.setModal(True) |
648 progress.setMinimumDuration(0) |
648 progress.setMinimumDuration(0) |