41 """ |
41 """ |
42 A class used to display the forms part of the project. |
42 A class used to display the forms part of the project. |
43 |
43 |
44 @signal appendStderr(str) emitted after something was received from |
44 @signal appendStderr(str) emitted after something was received from |
45 a QProcess on stderr |
45 a QProcess on stderr |
46 @signal sourceFile(str) emitted to open a forms file in an editor |
|
47 @signal uipreview(str) emitted to preview a forms file |
46 @signal uipreview(str) emitted to preview a forms file |
48 @signal trpreview(list of str) emitted to preview form files in the |
|
49 translations previewer |
|
50 @signal closeSourceWindow(str) emitted after a file has been |
|
51 removed/deleted from the project |
|
52 @signal showMenu(str, QMenu) emitted when a menu is about to be shown. The |
47 @signal showMenu(str, QMenu) emitted when a menu is about to be shown. The |
53 name of the menu and a reference to the menu are given. |
48 name of the menu and a reference to the menu are given. |
54 @signal menusAboutToBeCreated() emitted when the context menus are about to |
49 @signal menusAboutToBeCreated() emitted when the context menus are about to |
55 be created. This is the right moment to add or remove hook methods. |
50 be created. This is the right moment to add or remove hook methods. |
56 """ |
51 """ |
640 ########################################################################### |
635 ########################################################################### |
641 |
636 |
642 def __readStdout(self): |
637 def __readStdout(self): |
643 """ |
638 """ |
644 Private slot to handle the readyReadStandardOutput signal of the |
639 Private slot to handle the readyReadStandardOutput signal of the |
645 pyuic/rbuic process. |
640 pyuic4/pyuic5/pyside-uic/rbuic4 process. |
646 """ |
641 """ |
647 if self.compileProc is None: |
642 if self.compileProc is None: |
648 return |
643 return |
649 self.compileProc.setReadChannel(QProcess.StandardOutput) |
644 self.compileProc.setReadChannel(QProcess.StandardOutput) |
650 |
645 |
748 self.buf = "" |
743 self.buf = "" |
749 |
744 |
750 if self.project.getProjectLanguage() in \ |
745 if self.project.getProjectLanguage() in \ |
751 ["Python", "Python2", "Python3"]: |
746 ["Python", "Python2", "Python3"]: |
752 if self.project.getProjectType() in ["Qt4", ]: |
747 if self.project.getProjectType() in ["Qt4", ]: |
753 self.uicompiler = 'pyuic4' |
748 self.uicompiler = Utilities.generatePyQtToolPath('pyuic4') |
754 if Utilities.isWindowsPlatform(): |
|
755 uic = Utilities.getWindowsExecutablePath(self.uicompiler) |
|
756 else: |
|
757 uic = self.uicompiler |
|
758 elif self.project.getProjectType() in ["PyQt5"]: |
749 elif self.project.getProjectType() in ["PyQt5"]: |
759 self.uicompiler = 'pyuic5' |
750 self.uicompiler = Utilities.generatePyQtToolPath('pyuic5') |
760 if Utilities.isWindowsPlatform(): |
|
761 uic = Utilities.getWindowsExecutablePath(self.uicompiler) |
|
762 else: |
|
763 uic = self.uicompiler |
|
764 elif self.project.getProjectType() in ["E6Plugin"]: |
751 elif self.project.getProjectType() in ["E6Plugin"]: |
765 if PYQT_VERSION < 0x050000: |
752 if PYQT_VERSION < 0x050000: |
766 self.uicompiler = 'pyuic4' |
753 self.uicompiler = Utilities.generatePyQtToolPath('pyuic4') |
767 else: |
754 else: |
768 self.uicompiler = 'pyuic5' |
755 self.uicompiler = Utilities.generatePyQtToolPath('pyuic5') |
769 if Utilities.isWindowsPlatform(): |
|
770 uic = Utilities.getWindowsExecutablePath(self.uicompiler) |
|
771 else: |
|
772 uic = self.uicompiler |
|
773 elif self.project.getProjectType() == "PySide": |
756 elif self.project.getProjectType() == "PySide": |
774 self.uicompiler = 'pyside-uic' |
757 self.uicompiler = \ |
775 uic = Utilities.generatePySideToolPath(self.uicompiler) |
758 Utilities.generatePySideToolPath('pyside-uic') |
776 else: |
759 else: |
777 return None |
760 return None |
778 elif self.project.getProjectLanguage() == "Ruby": |
761 elif self.project.getProjectLanguage() == "Ruby": |
779 if self.project.getProjectType() == "Qt4": |
762 if self.project.getProjectType() == "Qt4": |
780 self.uicompiler = 'rbuic4' |
763 self.uicompiler = 'rbuic4' |
781 if Utilities.isWindowsPlatform(): |
764 if Utilities.isWindowsPlatform(): |
782 uic = Utilities.getWindowsExecutablePath(self.uicompiler) |
765 self.uicompiler = \ |
783 else: |
766 Utilities.getWindowsExecutablePath(self.uicompiler) |
784 uic = self.uicompiler |
|
785 else: |
767 else: |
786 return None |
768 return None |
787 else: |
769 else: |
788 return None |
770 return None |
789 |
771 |
808 self.compileProc.finished.connect(self.__compileUIDone) |
790 self.compileProc.finished.connect(self.__compileUIDone) |
809 self.compileProc.readyReadStandardOutput.connect(self.__readStdout) |
791 self.compileProc.readyReadStandardOutput.connect(self.__readStdout) |
810 self.compileProc.readyReadStandardError.connect(self.__readStderr) |
792 self.compileProc.readyReadStandardError.connect(self.__readStderr) |
811 |
793 |
812 self.noDialog = noDialog |
794 self.noDialog = noDialog |
813 self.compileProc.start(uic, args) |
795 self.compileProc.start(self.uicompiler, args) |
814 procStarted = self.compileProc.waitForStarted(5000) |
796 procStarted = self.compileProc.waitForStarted(5000) |
815 if procStarted: |
797 if procStarted: |
816 self.compileRunning = True |
798 self.compileRunning = True |
817 e5App().getObject("ViewManager").enableEditorsCheckFocusIn(False) |
799 e5App().getObject("ViewManager").enableEditorsCheckFocusIn(False) |
818 return self.compileProc |
800 return self.compileProc |