Project/ProjectSourcesBrowser.py

changeset 788
5b1b59777460
parent 564
b3d966393ba9
child 791
9ec2ac20e54e
equal deleted inserted replaced
786:06290d4db8ab 788:5b1b59777460
41 41
42 @signal closeSourceWindow(str) emitted after a file has been removed/deleted 42 @signal closeSourceWindow(str) emitted after a file has been removed/deleted
43 from the project 43 from the project
44 @signal showMenu(str, QMenu) emitted when a menu is about to be shown. The name 44 @signal showMenu(str, QMenu) emitted when a menu is about to be shown. The name
45 of the menu and a reference to the menu are given. 45 of the menu and a reference to the menu are given.
46 @signal sourceFile(str) emitted to open the given file.
47 @signal sourceFile(str, int) emitted to open the given file at the given line.
48 @signal sourceFile(str, int, str) emitted to open the given file as the given type
49 at the given line.
46 """ 50 """
47 closeSourceWindow = pyqtSignal(str) 51 closeSourceWindow = pyqtSignal(str)
48 showMenu = pyqtSignal(str, QMenu) 52 showMenu = pyqtSignal(str, QMenu)
49 sourceFile = pyqtSignal((str, ), (str, int), (str, int, str)) 53 sourceFile = pyqtSignal((str, ), (str, int), (str, int, str))
50 54
103 Protected overloaded method to generate the popup menu. 107 Protected overloaded method to generate the popup menu.
104 """ 108 """
105 ProjectBaseBrowser._createPopupMenus(self) 109 ProjectBaseBrowser._createPopupMenus(self)
106 self.sourceMenuActions = {} 110 self.sourceMenuActions = {}
107 111
108 if self.project.pdata["PROGLANGUAGE"][0] in ["Python", "Python3"]: 112 if self.project.pdata["PROGLANGUAGE"][0] in ["Python", "Python2", "Python3"]:
109 self.__createPythonPopupMenus() 113 self.__createPythonPopupMenus()
110 elif self.project.pdata["PROGLANGUAGE"][0] == "Ruby": 114 elif self.project.pdata["PROGLANGUAGE"][0] == "Ruby":
111 self.__createRubyPopupMenus() 115 self.__createRubyPopupMenus()
112 116
113 def __createPythonPopupMenus(self): 117 def __createPythonPopupMenus(self):
398 if bfcnt == 1 or cmcnt == 1: 402 if bfcnt == 1 or cmcnt == 1:
399 itm = self.model().item(index) 403 itm = self.model().item(index)
400 if isinstance(itm, ProjectBrowserFileItem): 404 if isinstance(itm, ProjectBrowserFileItem):
401 fn = itm.fileName() 405 fn = itm.fileName()
402 if self.project.pdata["PROGLANGUAGE"][0] in \ 406 if self.project.pdata["PROGLANGUAGE"][0] in \
403 ["Python", "Python3"]: 407 ["Python", "Python2", "Python3"]:
404 if fn.endswith('.ptl'): 408 if fn.endswith('.ptl'):
405 for act in list(self.sourceMenuActions.values()): 409 for act in list(self.sourceMenuActions.values()):
406 act.setEnabled(False) 410 act.setEnabled(False)
407 self.classDiagramAction.setEnabled(True) 411 self.classDiagramAction.setEnabled(True)
408 self.importsDiagramAction.setEnabled(True) 412 self.importsDiagramAction.setEnabled(True)
522 [BrowserFileItem, BrowserClassItem, BrowserMethodItem, 526 [BrowserFileItem, BrowserClassItem, BrowserMethodItem,
523 BrowserClassAttributeItem]) 527 BrowserClassAttributeItem])
524 528
525 for itm in itmList: 529 for itm in itmList:
526 if isinstance(itm, BrowserFileItem): 530 if isinstance(itm, BrowserFileItem):
527 if itm.isPythonFile(): 531 if itm.isPython2File():
528 self.sourceFile[str, int, str].emit(itm.fileName(), 1, "Python") 532 self.sourceFile[str, int, str].emit(itm.fileName(), 1, "Python2")
529 elif itm.isPython3File(): 533 elif itm.isPython3File():
530 self.sourceFile[str, int, str].emit(itm.fileName(), 1, "Python3") 534 self.sourceFile[str, int, str].emit(itm.fileName(), 1, "Python3")
531 elif itm.isRubyFile(): 535 elif itm.isRubyFile():
532 self.sourceFile[str, int, str].emit(itm.fileName(), 1, "Ruby") 536 self.sourceFile[str, int, str].emit(itm.fileName(), 1, "Ruby")
533 elif itm.isDFile(): 537 elif itm.isDFile():

eric ide

mercurial