Project/ProjectSourcesBrowser.py

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

eric ide

mercurial