Project/ProjectFormsBrowser.py

branch
5_3_x
changeset 2728
2d1140b6f1e2
parent 2302
f29e9405c851
child 2777
2a81ccaa5a95
equal deleted inserted replaced
2715:bf64950a357e 2728:2d1140b6f1e2
135 self.__generateDialogCode) 135 self.__generateDialogCode)
136 if self.hooks["compileForm"] is not None or \ 136 if self.hooks["compileForm"] is not None or \
137 self.hooks["compileAllForms"] is not None or \ 137 self.hooks["compileAllForms"] is not None or \
138 self.hooks["generateDialogCode"] is not None: 138 self.hooks["generateDialogCode"] is not None:
139 self.menu.addSeparator() 139 self.menu.addSeparator()
140 if self.hooks["open"] is not None:
141 self.menu.addAction(
142 self.hooksMenuEntries.get("open", self.trUtf8('Open')),
143 self.__openFile)
140 self.menu.addAction(self.trUtf8('Open'), self.__openFileInEditor) 144 self.menu.addAction(self.trUtf8('Open'), self.__openFileInEditor)
141 self.menu.addSeparator() 145 self.menu.addSeparator()
142 act = self.menu.addAction(self.trUtf8('Rename file'), self._renameFile) 146 act = self.menu.addAction(self.trUtf8('Rename file'), self._renameFile)
143 self.menuActions.append(act) 147 self.menuActions.append(act)
144 act = self.menu.addAction(self.trUtf8('Remove from project'), self._removeFile) 148 act = self.menu.addAction(self.trUtf8('Remove from project'), self._removeFile)
209 act = self.multiMenu.addAction( 213 act = self.multiMenu.addAction(
210 self.hooksMenuEntries.get("compileSelectedForms", 214 self.hooksMenuEntries.get("compileSelectedForms",
211 self.trUtf8('Compile forms')), 215 self.trUtf8('Compile forms')),
212 self.__compileSelectedForms) 216 self.__compileSelectedForms)
213 self.multiMenu.addSeparator() 217 self.multiMenu.addSeparator()
218 if self.hooks["open"] is not None:
219 self.multiMenu.addAction(
220 self.hooksMenuEntries.get("open", self.trUtf8('Open')),
221 self.__openFile)
214 self.multiMenu.addAction(self.trUtf8('Open'), self.__openFileInEditor) 222 self.multiMenu.addAction(self.trUtf8('Open'), self.__openFileInEditor)
215 self.multiMenu.addSeparator() 223 self.multiMenu.addSeparator()
216 act = self.multiMenu.addAction(self.trUtf8('Remove from project'), 224 act = self.multiMenu.addAction(self.trUtf8('Remove from project'),
217 self._removeFile) 225 self._removeFile)
218 self.multiMenuActions.append(act) 226 self.multiMenuActions.append(act)
408 """ 416 """
409 itmList = self.getSelectedItems() 417 itmList = self.getSelectedItems()
410 for itm in itmList[:]: 418 for itm in itmList[:]:
411 try: 419 try:
412 if isinstance(itm, ProjectBrowserFileItem): 420 if isinstance(itm, ProjectBrowserFileItem):
413 self.designerFile.emit(itm.fileName()) 421 # hook support
422 if self.hooks["open"] is not None:
423 self.hooks["open"](itm.fileName())
424 else:
425 self.designerFile.emit(itm.fileName())
414 except: 426 except:
415 pass 427 pass
416 428
417 def __openFileInEditor(self): 429 def __openFileInEditor(self):
418 """ 430 """
904 <li>compileAllForms: takes list of filenames as parameter</li> 916 <li>compileAllForms: takes list of filenames as parameter</li>
905 <li>compileSelectedForms: takes list of filenames as parameter</li> 917 <li>compileSelectedForms: takes list of filenames as parameter</li>
906 <li>compileChangedForms: takes list of filenames as parameter</li> 918 <li>compileChangedForms: takes list of filenames as parameter</li>
907 <li>generateDialogCode: takes filename as parameter</li> 919 <li>generateDialogCode: takes filename as parameter</li>
908 <li>newForm: takes full directory path of new file as parameter</li> 920 <li>newForm: takes full directory path of new file as parameter</li>
921 <li>open: takes a filename as parameter</li>
909 </ul> 922 </ul>
910 923
911 <b>Note</b>: Filenames are relative to the project directory, if not 924 <b>Note</b>: Filenames are relative to the project directory, if not
912 specified differently. 925 specified differently.
913 """ 926 """
916 "compileAllForms": None, 929 "compileAllForms": None,
917 "compileChangedForms": None, 930 "compileChangedForms": None,
918 "compileSelectedForms": None, 931 "compileSelectedForms": None,
919 "generateDialogCode": None, 932 "generateDialogCode": None,
920 "newForm": None, 933 "newForm": None,
934 "open": None,
921 } 935 }

eric ide

mercurial