Project/ProjectFormsBrowser.py

changeset 6291
94e0e688dcad
parent 6048
82ad8ec9548c
child 6292
e08a94e1ecdd
equal deleted inserted replaced
6290:bf4624957d2d 6291:94e0e688dcad
124 124
125 self.menusAboutToBeCreated.emit() 125 self.menusAboutToBeCreated.emit()
126 126
127 self.menu = QMenu(self) 127 self.menu = QMenu(self)
128 if self.project.getProjectType() in \ 128 if self.project.getProjectType() in \
129 ["Qt4", "PyQt5", "E6Plugin", "PySide"]: 129 ["Qt4", "PyQt5", "E6Plugin", "PySide", "PySide2"]:
130 self.menu.addAction( 130 self.menu.addAction(
131 self.tr('Compile form'), self.__compileForm) 131 self.tr('Compile form'), self.__compileForm)
132 self.menu.addAction( 132 self.menu.addAction(
133 self.tr('Compile all forms'), 133 self.tr('Compile all forms'),
134 self.__compileAllForms) 134 self.__compileAllForms)
179 self.menuActions.append(act) 179 self.menuActions.append(act)
180 act = self.menu.addAction(self.tr('Delete'), self.__deleteFile) 180 act = self.menu.addAction(self.tr('Delete'), self.__deleteFile)
181 self.menuActions.append(act) 181 self.menuActions.append(act)
182 self.menu.addSeparator() 182 self.menu.addSeparator()
183 if self.project.getProjectType() in \ 183 if self.project.getProjectType() in \
184 ["Qt4", "PyQt5", "E6Plugin", "PySide"]: 184 ["Qt4", "PyQt5", "E6Plugin", "PySide", "PySide2"]:
185 self.menu.addAction(self.tr('New form...'), self.__newForm) 185 self.menu.addAction(self.tr('New form...'), self.__newForm)
186 else: 186 else:
187 if self.hooks["newForm"] is not None: 187 if self.hooks["newForm"] is not None:
188 self.menu.addAction( 188 self.menu.addAction(
189 self.hooksMenuEntries.get( 189 self.hooksMenuEntries.get(
202 self.menu.addSeparator() 202 self.menu.addSeparator()
203 self.menu.addAction(self.tr('Configure...'), self._configure) 203 self.menu.addAction(self.tr('Configure...'), self._configure)
204 204
205 self.backMenu = QMenu(self) 205 self.backMenu = QMenu(self)
206 if self.project.getProjectType() in \ 206 if self.project.getProjectType() in \
207 ["Qt4", "PyQt5", "E6Plugin", "PySide"] or \ 207 ["Qt4", "PyQt5", "E6Plugin", "PySide", "PySide2"] or \
208 self.hooks["compileAllForms"] is not None: 208 self.hooks["compileAllForms"] is not None:
209 self.backMenu.addAction( 209 self.backMenu.addAction(
210 self.tr('Compile all forms'), self.__compileAllForms) 210 self.tr('Compile all forms'), self.__compileAllForms)
211 self.backMenu.addSeparator() 211 self.backMenu.addSeparator()
212 self.backMenu.addAction(self.tr('New form...'), self.__newForm) 212 self.backMenu.addAction(self.tr('New form...'), self.__newForm)
229 self.backMenu.setEnabled(False) 229 self.backMenu.setEnabled(False)
230 230
231 # create the menu for multiple selected files 231 # create the menu for multiple selected files
232 self.multiMenu = QMenu(self) 232 self.multiMenu = QMenu(self)
233 if self.project.getProjectType() in \ 233 if self.project.getProjectType() in \
234 ["Qt4", "PyQt5", "E6Plugin", "PySide"]: 234 ["Qt4", "PyQt5", "E6Plugin", "PySide", "PySide2"]:
235 act = self.multiMenu.addAction( 235 act = self.multiMenu.addAction(
236 self.tr('Compile forms'), self.__compileSelectedForms) 236 self.tr('Compile forms'), self.__compileSelectedForms)
237 self.multiMenu.addSeparator() 237 self.multiMenu.addSeparator()
238 self.multiMenu.addAction( 238 self.multiMenu.addAction(
239 self.tr('Open in Qt-Designer'), self.__openFile) 239 self.tr('Open in Qt-Designer'), self.__openFile)
271 self.multiMenu.addSeparator() 271 self.multiMenu.addSeparator()
272 self.multiMenu.addAction(self.tr('Configure...'), self._configure) 272 self.multiMenu.addAction(self.tr('Configure...'), self._configure)
273 273
274 self.dirMenu = QMenu(self) 274 self.dirMenu = QMenu(self)
275 if self.project.getProjectType() in \ 275 if self.project.getProjectType() in \
276 ["Qt4", "PyQt5", "E6Plugin", "PySide"]: 276 ["Qt4", "PyQt5", "E6Plugin", "PySide", "PySide2"]:
277 self.dirMenu.addAction( 277 self.dirMenu.addAction(
278 self.tr('Compile all forms'), self.__compileAllForms) 278 self.tr('Compile all forms'), self.__compileAllForms)
279 self.dirMenu.addSeparator() 279 self.dirMenu.addSeparator()
280 else: 280 else:
281 if self.hooks["compileAllForms"] is not None: 281 if self.hooks["compileAllForms"] is not None:
291 act = self.dirMenu.addAction( 291 act = self.dirMenu.addAction(
292 self.tr('Delete'), self._deleteDirectory) 292 self.tr('Delete'), self._deleteDirectory)
293 self.dirMenuActions.append(act) 293 self.dirMenuActions.append(act)
294 self.dirMenu.addSeparator() 294 self.dirMenu.addSeparator()
295 if self.project.getProjectType() in \ 295 if self.project.getProjectType() in \
296 ["Qt4", "PyQt5", "E6Plugin", "PySide"]: 296 ["Qt4", "PyQt5", "E6Plugin", "PySide", "PySide2"]:
297 self.dirMenu.addAction(self.tr('New form...'), self.__newForm) 297 self.dirMenu.addAction(self.tr('New form...'), self.__newForm)
298 else: 298 else:
299 if self.hooks["newForm"] is not None: 299 if self.hooks["newForm"] is not None:
300 self.dirMenu.addAction( 300 self.dirMenu.addAction(
301 self.hooksMenuEntries.get( 301 self.hooksMenuEntries.get(
316 self.dirMenu.addSeparator() 316 self.dirMenu.addSeparator()
317 self.dirMenu.addAction(self.tr('Configure...'), self._configure) 317 self.dirMenu.addAction(self.tr('Configure...'), self._configure)
318 318
319 self.dirMultiMenu = QMenu(self) 319 self.dirMultiMenu = QMenu(self)
320 if self.project.getProjectType() in \ 320 if self.project.getProjectType() in \
321 ["Qt4", "PyQt5", "E6Plugin", "PySide"]: 321 ["Qt4", "PyQt5", "E6Plugin", "PySide", "PySide2"]:
322 self.dirMultiMenu.addAction( 322 self.dirMultiMenu.addAction(
323 self.tr('Compile all forms'), self.__compileAllForms) 323 self.tr('Compile all forms'), self.__compileAllForms)
324 self.dirMultiMenu.addSeparator() 324 self.dirMultiMenu.addSeparator()
325 else: 325 else:
326 if self.hooks["compileAllForms"] is not None: 326 if self.hooks["compileAllForms"] is not None:
534 534
535 if self.hooks["newForm"] is not None: 535 if self.hooks["newForm"] is not None:
536 self.hooks["newForm"](path) 536 self.hooks["newForm"](path)
537 else: 537 else:
538 if self.project.getProjectType() in \ 538 if self.project.getProjectType() in \
539 ["Qt4", "PyQt5", "E6Plugin", "PySide"]: 539 ["Qt4", "PyQt5", "E6Plugin", "PySide", "PySide2"]:
540 self.__newUiForm(path) 540 self.__newUiForm(path)
541 541
542 def __newUiForm(self, path): 542 def __newUiForm(self, path):
543 """ 543 """
544 Private slot to handle the New Form menu action for Qt-related 544 Private slot to handle the New Form menu action for Qt-related
635 ########################################################################### 635 ###########################################################################
636 636
637 def __readStdout(self): 637 def __readStdout(self):
638 """ 638 """
639 Private slot to handle the readyReadStandardOutput signal of the 639 Private slot to handle the readyReadStandardOutput signal of the
640 pyuic4/pyuic5/pyside-uic/rbuic4 process. 640 pyuic4/pyuic5/pyside-uic/pyside2-uic/rbuic4 process.
641 """ 641 """
642 if self.compileProc is None: 642 if self.compileProc is None:
643 return 643 return
644 self.compileProc.setReadChannel(QProcess.StandardOutput) 644 self.compileProc.setReadChannel(QProcess.StandardOutput)
645 645
648 "utf-8", 'replace') 648 "utf-8", 'replace')
649 649
650 def __readStderr(self): 650 def __readStderr(self):
651 """ 651 """
652 Private slot to handle the readyReadStandardError signal of the 652 Private slot to handle the readyReadStandardError signal of the
653 pyuic4/pyuic5/pyside-uic/rbuic4 process. 653 pyuic4/pyuic5/pyside-uic/pyside2-uic/rbuic4 process.
654 """ 654 """
655 if self.compileProc is None: 655 if self.compileProc is None:
656 return 656 return
657 657
658 ioEncoding = Preferences.getSystem("IOEncoding") 658 ioEncoding = Preferences.getSystem("IOEncoding")
757 else: 757 else:
758 self.uicompiler = Utilities.generatePyQtToolPath( 758 self.uicompiler = Utilities.generatePyQtToolPath(
759 'pyuic5', ["py3uic5", "py2uic5"]) 759 'pyuic5', ["py3uic5", "py2uic5"])
760 elif self.project.getProjectType() == "PySide": 760 elif self.project.getProjectType() == "PySide":
761 self.uicompiler = \ 761 self.uicompiler = \
762 Utilities.generatePySideToolPath('pyside-uic') 762 Utilities.generatePySideToolPath('pyside-uic', "1")
763 # TODO: add entry for PySide2
763 else: 764 else:
764 return None 765 return None
765 elif self.project.getProjectLanguage() == "Ruby": 766 elif self.project.getProjectLanguage() == "Ruby":
766 if self.project.getProjectType() == "Qt4": 767 if self.project.getProjectType() == "Qt4":
767 self.uicompiler = 'rbuic4' 768 self.uicompiler = 'rbuic4'
930 """ 931 """
931 if self.hooks["compileChangedForms"] is not None: 932 if self.hooks["compileChangedForms"] is not None:
932 self.hooks["compileChangedForms"](self.project.pdata["FORMS"]) 933 self.hooks["compileChangedForms"](self.project.pdata["FORMS"])
933 else: 934 else:
934 if self.project.getProjectType() not in \ 935 if self.project.getProjectType() not in \
935 ["Qt4", "PyQt5", "E6Plugin", "PySide"]: 936 ["Qt4", "PyQt5", "E6Plugin", "PySide", "PySide2"]:
936 # ignore the request for non Qt GUI projects 937 # ignore the request for non Qt GUI projects
937 return 938 return
938 939
939 progress = E5ProgressDialog( 940 progress = E5ProgressDialog(
940 self.tr("Determining changed forms..."), 941 self.tr("Determining changed forms..."),

eric ide

mercurial