QScintilla/MiniEditor.py

changeset 2965
d133c7edd88a
parent 2662
d28382a4b88a
child 3011
18292228c724
equal deleted inserted replaced
2964:84b65fb9e780 2965:d133c7edd88a
39 def __init__(self, parent=None): 39 def __init__(self, parent=None):
40 """ 40 """
41 Constructor 41 Constructor
42 42
43 @param parent parent widget (QWidget) 43 @param parent parent widget (QWidget)
44 @param name name of this instance (string)
45 @param flags window flags
46 """ 44 """
47 super().__init__(parent) 45 super().__init__(parent)
48 46
49 self.mw = parent 47 self.mw = parent
50 48
216 self.__checkActions() 214 self.__checkActions()
217 215
218 def __save(self): 216 def __save(self):
219 """ 217 """
220 Private slot to save a file. 218 Private slot to save a file.
219
220 @return flag indicating success (boolean)
221 """ 221 """
222 if not self.__curFile: 222 if not self.__curFile:
223 return self.__saveAs() 223 return self.__saveAs()
224 else: 224 else:
225 return self.__saveFile(self.__curFile) 225 return self.__saveFile(self.__curFile)
226 226
227 def __saveAs(self): 227 def __saveAs(self):
228 """ 228 """
229 Private slot to save a file with a new name. 229 Private slot to save a file with a new name.
230
231 @return flag indicating success (boolean)
230 """ 232 """
231 fileName = E5FileDialog.getSaveFileName(self) 233 fileName = E5FileDialog.getSaveFileName(self)
232 if not fileName: 234 if not fileName:
233 return False 235 return False
234 236
307 """ 309 """
308 Private function to read a single keyboard shortcut from the settings. 310 Private function to read a single keyboard shortcut from the settings.
309 311
310 @param act reference to the action object (E5Action) 312 @param act reference to the action object (E5Action)
311 @param category category the action belongs to (string) 313 @param category category the action belongs to (string)
312 @param prefClass preferences class used as the storage area
313 """ 314 """
314 if act.objectName(): 315 if act.objectName():
315 accel = Preferences.Prefs.settings.value( 316 accel = Preferences.Prefs.settings.value(
316 "Shortcuts/{0}/{1}/Accel".format(category, act.objectName())) 317 "Shortcuts/{0}/{1}/Accel".format(category, act.objectName()))
317 if accel is not None: 318 if accel is not None:
2313 """ 2314 """
2314 self.contextMenu.popup(self.mapToGlobal(coord)) 2315 self.contextMenu.popup(self.mapToGlobal(coord))
2315 2316
2316 def __initContextMenu(self): 2317 def __initContextMenu(self):
2317 """ 2318 """
2318 Private method used to setup the context menu 2319 Private method used to setup the context menu.
2319 """ 2320 """
2320 self.contextMenu = QMenu() 2321 self.contextMenu = QMenu()
2321 2322
2322 self.languagesMenu = self.__initContextMenuLanguages() 2323 self.languagesMenu = self.__initContextMenuLanguages()
2323 2324
2337 self.contextMenu.addAction(self.printAct) 2338 self.contextMenu.addAction(self.printAct)
2338 2339
2339 def __initContextMenuLanguages(self): 2340 def __initContextMenuLanguages(self):
2340 """ 2341 """
2341 Private method used to setup the Languages context sub menu. 2342 Private method used to setup the Languages context sub menu.
2343
2344 @return reference to the generated menu (QMenu)
2342 """ 2345 """
2343 menu = QMenu(self.trUtf8("Languages")) 2346 menu = QMenu(self.trUtf8("Languages"))
2344 2347
2345 self.languagesActGrp = QActionGroup(self) 2348 self.languagesActGrp = QActionGroup(self)
2346 self.noLanguageAct = menu.addAction(self.trUtf8("No Language")) 2349 self.noLanguageAct = menu.addAction(self.trUtf8("No Language"))
2583 2586
2584 def __bindName(self, line0): 2587 def __bindName(self, line0):
2585 """ 2588 """
2586 Private method to generate a dummy filename for binding a lexer. 2589 Private method to generate a dummy filename for binding a lexer.
2587 2590
2588 @param line0 first line of text to use in the generation process (string) 2591 @param line0 first line of text to use in the generation process
2592 (string)
2593 @return dummy file name to be used for binding a lexer (string)
2589 """ 2594 """
2590 bindName = self.__curFile 2595 bindName = self.__curFile
2591 line0 = line0.lower() 2596 line0 = line0.lower()
2592 2597
2593 # check first line if it does not start with #! 2598 # check first line if it does not start with #!

eric ide

mercurial