296 .getProjectBrowser("forms")) |
296 .getProjectBrowser("forms")) |
297 self.__formsBrowser.addHookMethodAndMenuEntry( |
297 self.__formsBrowser.addHookMethodAndMenuEntry( |
298 "newForm", self.newForm, self.tr("New template...")) |
298 "newForm", self.newForm, self.tr("New template...")) |
299 |
299 |
300 self.__determineCapabilities() |
300 self.__determineCapabilities() |
|
301 self.__setDebugEnvironment() |
301 |
302 |
302 self.__pybabelProject.projectOpenedHooks() |
303 self.__pybabelProject.projectOpenedHooks() |
303 |
304 |
304 self.__hooksInstalled = True |
305 self.__hooksInstalled = True |
305 |
306 |
411 @return path of the Python interpreter |
412 @return path of the Python interpreter |
412 @rtype str |
413 @rtype str |
413 """ |
414 """ |
414 return self.getFullCommand("python") |
415 return self.getFullCommand("python") |
415 |
416 |
416 def getFullCommand(self, command): |
417 def getFullCommand(self, command, virtualEnvPath=None): |
417 """ |
418 """ |
418 Public method to get the full command for a given command name. |
419 Public method to get the full command for a given command name. |
419 |
420 |
420 @param command command name |
421 @param command command name |
|
422 @type str |
|
423 @param virtualEnvPath path of the virtual environment |
421 @type str |
424 @type str |
422 @return full command |
425 @return full command |
423 @rtype str |
426 @rtype str |
424 """ |
427 """ |
425 virtualEnv = self.getVirtualEnvironment() |
428 virtualEnv = virtualEnvPath or self.getVirtualEnvironment() |
426 if isWindowsPlatform(): |
429 if isWindowsPlatform(): |
427 fullCmds = [ |
430 fullCmds = [ |
428 os.path.join(virtualEnv, "Scripts", command + '.exe'), |
431 os.path.join(virtualEnv, "Scripts", command + '.exe'), |
429 os.path.join(virtualEnv, "bin", command + '.exe'), |
432 os.path.join(virtualEnv, "bin", command + '.exe'), |
430 command # fall back to just cmd |
433 command # fall back to just cmd |
718 Private slot to configure the project specific flask parameters. |
721 Private slot to configure the project specific flask parameters. |
719 """ |
722 """ |
720 from .FlaskConfigDialog import FlaskConfigDialog |
723 from .FlaskConfigDialog import FlaskConfigDialog |
721 |
724 |
722 config = self.getData("flask", "") |
725 config = self.getData("flask", "") |
723 dlg = FlaskConfigDialog(config) |
726 dlg = FlaskConfigDialog(config, self) |
724 if dlg.exec() == QDialog.Accepted: |
727 if dlg.exec() == QDialog.Accepted: |
725 config = dlg.getConfiguration() |
728 config = dlg.getConfiguration() |
726 self.setData("flask", "", config) |
729 self.setData("flask", "", config) |
|
730 self.__setIgnoreVirtualEnvironment() |
|
731 self.__setDebugEnvironment() |
727 |
732 |
728 self.__migrateProject.determineCapability() |
733 self.__migrateProject.determineCapability() |
729 |
734 |
730 self.__pybabelProject.determineCapability() |
735 self.__pybabelProject.determineCapability() |
731 self.projectClosedHooks() |
736 self.projectClosedHooks() |
732 self.projectOpenedHooks() |
737 self.projectOpenedHooks() |
|
738 |
|
739 def __setIgnoreVirtualEnvironment(self): |
|
740 """ |
|
741 Private method to add an embedded project specific virtual environment |
|
742 to the list of ignore files/directories. |
|
743 """ |
|
744 virtenvName = self.getData("flask", "virtual_environment_name") |
|
745 if virtenvName: |
|
746 virtenvPath = self.getVirtualEnvironment() |
|
747 if self.__e5project.startswithProjectPath(virtenvPath): |
|
748 relVirtenvPath = self.__e5project.getRelativeUniversalPath( |
|
749 virtenvPath) |
|
750 if relVirtenvPath not in self.__e5project.pdata["FILETYPES"]: |
|
751 self.__e5project.pdata["FILETYPES"][relVirtenvPath] = ( |
|
752 "__IGNORE__" |
|
753 ) |
|
754 self.__e5project.setDirty(True) |
|
755 |
|
756 def __setDebugEnvironment(self): |
|
757 """ |
|
758 Private method to set the virtual environment as the selected debug |
|
759 environment. |
|
760 """ |
|
761 language = self.__e5project.getProjectLanguage() |
|
762 if language == "Python3": |
|
763 # get project specific virtual environment name |
|
764 venvName = self.getData("flask", "virtual_environment_name") |
|
765 if not venvName: |
|
766 venvName = self.__plugin.getPreferences( |
|
767 "VirtualEnvironmentNamePy3") |
|
768 if venvName: |
|
769 self.__e5project.debugProperties["VIRTUALENV"] = venvName |
733 |
770 |
734 ################################################################## |
771 ################################################################## |
735 ## slot below implements documentation function |
772 ## slot below implements documentation function |
736 ################################################################## |
773 ################################################################## |
737 |
774 |