103 Protected overloaded method to generate the popup menu. |
103 Protected overloaded method to generate the popup menu. |
104 """ |
104 """ |
105 ProjectBaseBrowser._createPopupMenus(self) |
105 ProjectBaseBrowser._createPopupMenus(self) |
106 self.sourceMenuActions = {} |
106 self.sourceMenuActions = {} |
107 |
107 |
108 if self.project.pdata["PROGLANGUAGE"][0] in \ |
108 if self.project.isPythonProject(): |
109 ["Python", "Python2", "Python3"]: |
|
110 self.__createPythonPopupMenus() |
109 self.__createPythonPopupMenus() |
111 elif self.project.pdata["PROGLANGUAGE"][0] == "Ruby": |
110 elif self.project.isRubyProject(): |
112 self.__createRubyPopupMenus() |
111 self.__createRubyPopupMenus() |
113 elif self.project.pdata["PROGLANGUAGE"][0] == "JavaScript": |
112 elif self.project.isJavaScriptProject(): |
114 self.__createJavaScriptPopupMenus() |
113 self.__createJavaScriptPopupMenus() |
115 |
114 |
116 def __createPythonPopupMenus(self): |
115 def __createPythonPopupMenus(self): |
117 """ |
116 """ |
118 Privat method to generate the popup menus for a Python project. |
117 Privat method to generate the popup menus for a Python project. |
358 self.gotoMenu.triggered.connect(self._gotoAttribute) |
357 self.gotoMenu.triggered.connect(self._gotoAttribute) |
359 |
358 |
360 self.attributeMenu = QMenu(self) |
359 self.attributeMenu = QMenu(self) |
361 self.attributeMenu.addMenu(self.gotoMenu) |
360 self.attributeMenu.addMenu(self.gotoMenu) |
362 self.attributeMenu.addSeparator() |
361 self.attributeMenu.addSeparator() |
363 self.attributeMenu.addAction( |
|
364 self.tr('New package...'), self.__addNewPackage) |
|
365 self.attributeMenu.addAction( |
362 self.attributeMenu.addAction( |
366 self.tr('Add source files...'), self.project.addSourceFiles) |
363 self.tr('Add source files...'), self.project.addSourceFiles) |
367 self.attributeMenu.addAction( |
364 self.attributeMenu.addAction( |
368 self.tr('Add source directory...'), self.project.addSourceDir) |
365 self.tr('Add source directory...'), self.project.addSourceDir) |
369 self.attributeMenu.addSeparator() |
366 self.attributeMenu.addSeparator() |
619 if cnt == 1 and index.isValid(): |
616 if cnt == 1 and index.isValid(): |
620 if bfcnt == 1 or cmcnt == 1: |
617 if bfcnt == 1 or cmcnt == 1: |
621 itm = self.model().item(index) |
618 itm = self.model().item(index) |
622 if isinstance(itm, ProjectBrowserFileItem): |
619 if isinstance(itm, ProjectBrowserFileItem): |
623 fn = itm.fileName() |
620 fn = itm.fileName() |
624 if self.project.pdata["PROGLANGUAGE"][0] in \ |
621 if self.project.isPythonProject(): |
625 ["Python", "Python2", "Python3"]: |
|
626 if fn.endswith('.ptl'): |
622 if fn.endswith('.ptl'): |
627 for act in self.sourceMenuActions.values(): |
623 for act in self.sourceMenuActions.values(): |
628 act.setEnabled(False) |
624 act.setEnabled(False) |
629 self.classDiagramAction.setEnabled(True) |
625 self.classDiagramAction.setEnabled(True) |
630 self.importsDiagramAction.setEnabled(True) |
626 self.importsDiagramAction.setEnabled(True) |
637 act.setEnabled(False) |
633 act.setEnabled(False) |
638 self.classDiagramAction.setEnabled(True) |
634 self.classDiagramAction.setEnabled(True) |
639 self.importsDiagramAction.setEnabled(False) |
635 self.importsDiagramAction.setEnabled(False) |
640 self.unittestAction.setEnabled(False) |
636 self.unittestAction.setEnabled(False) |
641 self.checksMenu.menuAction().setEnabled( |
637 self.checksMenu.menuAction().setEnabled( |
|
638 False) |
|
639 elif fn.endswith('.js'): # entry for mixed |
|
640 # mode programs |
|
641 for act in self.sourceMenuActions.values(): |
|
642 act.setEnabled(False) |
|
643 self.unittestAction.setEnabled(False) |
|
644 self.checksMenu.menuAction().setEnabled( |
|
645 False) |
|
646 self.graphicsMenu.menuAction().setEnabled( |
642 False) |
647 False) |
643 else: # assume the source file is a |
648 else: # assume the source file is a |
644 # Python file |
649 # Python file |
645 for act in self.sourceMenuActions.values(): |
650 for act in self.sourceMenuActions.values(): |
646 act.setEnabled(True) |
651 act.setEnabled(True) |