95 self.__plugin = plugin |
95 self.__plugin = plugin |
96 self.__ui = parent |
96 self.__ui = parent |
97 self.__e5project = e5App().getObject("Project") |
97 self.__e5project = e5App().getObject("Project") |
98 self.__hooksInstalled = False |
98 self.__hooksInstalled = False |
99 |
99 |
100 self.__mainMenu = None |
100 self.__menus = {} # dictionary with references to menus |
101 |
101 |
102 self.__serverProc = None |
102 self.__serverProc = None |
103 self.__testServerProc = None |
103 self.__testServerProc = None |
104 |
104 |
105 self.__recentApplications = [] |
105 self.__recentApplications = [] |
640 """ |
640 """ |
641 Public slot to initialize the Django menu. |
641 Public slot to initialize the Django menu. |
642 |
642 |
643 @return the menu generated (QMenu) |
643 @return the menu generated (QMenu) |
644 """ |
644 """ |
|
645 self.__menus = {} # clear menus references |
|
646 |
645 menu = QMenu(self.trUtf8('D&jango'), self.__ui) |
647 menu = QMenu(self.trUtf8('D&jango'), self.__ui) |
646 menu.setTearOffEnabled(True) |
648 menu.setTearOffEnabled(True) |
647 |
649 |
648 menu.addAction(self.selectSiteAct) |
650 menu.addAction(self.selectSiteAct) |
649 menu.addSeparator() |
651 menu.addSeparator() |
713 menu.addAction(self.databaseSqlDropTablesAct) |
717 menu.addAction(self.databaseSqlDropTablesAct) |
714 menu.addSeparator() |
718 menu.addSeparator() |
715 menu.addAction(self.databaseSqlFlushAct) |
719 menu.addAction(self.databaseSqlFlushAct) |
716 menu.addAction(self.databaseSqlResetSeqAct) |
720 menu.addAction(self.databaseSqlResetSeqAct) |
717 |
721 |
|
722 self.__menus["sql"] = menu |
|
723 |
718 return menu |
724 return menu |
719 |
725 |
720 def __initToolsMenu(self): |
726 def __initToolsMenu(self): |
721 """ |
727 """ |
722 Private slot to initialize the tools menu. |
728 Private slot to initialize the tools menu. |
730 menu.addAction(self.cleanupAct) |
736 menu.addAction(self.cleanupAct) |
731 menu.addAction(self.validateAct) |
737 menu.addAction(self.validateAct) |
732 menu.addSeparator() |
738 menu.addSeparator() |
733 menu.addAction(self.runPythonShellAct) |
739 menu.addAction(self.runPythonShellAct) |
734 |
740 |
|
741 self.__menus["tools"] = menu |
|
742 |
735 return menu |
743 return menu |
736 |
744 |
737 def __initTestingMenu(self): |
745 def __initTestingMenu(self): |
738 """ |
746 """ |
739 Private slot to initialize the testing menu. |
747 Private slot to initialize the testing menu. |
747 menu.addAction(self.loadDataAct) |
755 menu.addAction(self.loadDataAct) |
748 menu.addSeparator() |
756 menu.addSeparator() |
749 menu.addAction(self.runTestAct) |
757 menu.addAction(self.runTestAct) |
750 menu.addAction(self.runTestServerAct) |
758 menu.addAction(self.runTestServerAct) |
751 |
759 |
|
760 self.__menus["testing"] = menu |
|
761 |
752 return menu |
762 return menu |
753 |
763 |
754 def __initAuthorizationMenu(self): |
764 def __initAuthorizationMenu(self): |
755 """ |
765 """ |
756 Private slot to initialize the authorization menu. |
766 Private slot to initialize the authorization menu. |
761 menu.setTearOffEnabled(True) |
771 menu.setTearOffEnabled(True) |
762 |
772 |
763 menu.addAction(self.changePasswordAct) |
773 menu.addAction(self.changePasswordAct) |
764 menu.addAction(self.createSuperUserAct) |
774 menu.addAction(self.createSuperUserAct) |
765 |
775 |
|
776 self.__menus["authorization"] = menu |
|
777 |
766 return menu |
778 return menu |
767 |
779 |
768 def __initSessionMenu(self): |
780 def __initSessionMenu(self): |
769 """ |
781 """ |
770 Private slot to initialize the authorization menu. |
782 Private slot to initialize the authorization menu. |
774 menu = QMenu(self.trUtf8("&Session"), self.__ui) |
786 menu = QMenu(self.trUtf8("&Session"), self.__ui) |
775 menu.setTearOffEnabled(True) |
787 menu.setTearOffEnabled(True) |
776 |
788 |
777 menu.addAction(self.clearSessionsAct) |
789 menu.addAction(self.clearSessionsAct) |
778 |
790 |
|
791 self.__menus["session"] = menu |
|
792 |
779 return menu |
793 return menu |
|
794 |
|
795 def getMenu(self, name): |
|
796 """ |
|
797 Public method to get a reference to the requested menu. |
|
798 |
|
799 @param name name of the menu (string) |
|
800 @return reference to the menu (QMenu) or None, if no |
|
801 menu with the given name exists |
|
802 """ |
|
803 if name in self.__menus: |
|
804 return self.__menus[name] |
|
805 else: |
|
806 return None |
|
807 |
|
808 def getMenuNames(self): |
|
809 """ |
|
810 Public method to get the names of all menus. |
|
811 |
|
812 @return menu names (list of string) |
|
813 """ |
|
814 return list(self.__menus.keys()) |
780 |
815 |
781 ################################################################## |
816 ################################################################## |
782 ## methods below implement the various hook related functions |
817 ## methods below implement the various hook related functions |
783 ################################################################## |
818 ################################################################## |
784 |
819 |