QScintilla/MiniEditor.py

branch
Py2 comp.
changeset 3060
5883ce99ee12
parent 3058
0a02c433f52d
parent 3039
8dd0165d805d
child 3080
6c0a430b19df
equal deleted inserted replaced
3058:0a02c433f52d 3060:5883ce99ee12
1308 act.triggered[()].connect(self.esm.map) 1308 act.triggered[()].connect(self.esm.map)
1309 self.editActions.append(act) 1309 self.editActions.append(act)
1310 1310
1311 act = E5Action( 1311 act = E5Action(
1312 QApplication.translate('ViewManager', 'Formfeed'), 1312 QApplication.translate('ViewManager', 'Formfeed'),
1313 QApplication.translate('ViewManager', 'Formfeed'), 1313 QApplication.translate('ViewManager', 'Formfeed'),
1314 0, 0, 1314 0, 0,
1315 self.editorActGrp, 'vm_edit_formfeed') 1315 self.editorActGrp, 'vm_edit_formfeed')
1316 self.esm.setMapping(act, QsciScintilla.SCI_FORMFEED) 1316 self.esm.setMapping(act, QsciScintilla.SCI_FORMFEED)
1317 act.triggered[()].connect(self.esm.map) 1317 act.triggered[()].connect(self.esm.map)
1318 self.editActions.append(act) 1318 self.editActions.append(act)
1319 1319
1320 act = E5Action( 1320 act = E5Action(
1989 self.trUtf8('&What\'s This?'), 1989 self.trUtf8('&What\'s This?'),
1990 QKeySequence(self.trUtf8("Shift+F1", "Help|What's This?'")), 1990 QKeySequence(self.trUtf8("Shift+F1", "Help|What's This?'")),
1991 0, self, 'help_help_whats_this') 1991 0, self, 'help_help_whats_this')
1992 self.whatsThisAct.setStatusTip(self.trUtf8('Context sensitive help')) 1992 self.whatsThisAct.setStatusTip(self.trUtf8('Context sensitive help'))
1993 self.whatsThisAct.setWhatsThis(self.trUtf8( 1993 self.whatsThisAct.setWhatsThis(self.trUtf8(
1994 """<b>Display context sensitive help</b>""" 1994 """<b>Display context sensitive help</b>"""
1995 """<p>In What's This? mode, the mouse cursor shows an arrow""" 1995 """<p>In What's This? mode, the mouse cursor shows an arrow"""
1996 """ with a question mark, and you can click on the interface""" 1996 """ with a question mark, and you can click on the interface"""
1997 """ elements to get a short description of what they do and""" 1997 """ elements to get a short description of what they do and"""
1998 """ how to use them. In dialogs, this feature can be""" 1998 """ how to use them. In dialogs, this feature can be"""
1999 """ accessed using the context help button in the titlebar.""" 1999 """ accessed using the context help button in the titlebar."""
2000 """</p>""" 2000 """</p>"""
2001 )) 2001 ))
2002 self.whatsThisAct.triggered[()].connect(self.__whatsThis) 2002 self.whatsThisAct.triggered[()].connect(self.__whatsThis)
2003 self.helpActions.append(self.whatsThisAct) 2003 self.helpActions.append(self.whatsThisAct)
2004 2004
2005 def __createMenus(self): 2005 def __createMenus(self):
2157 QApplication.restoreOverrideCursor() 2157 QApplication.restoreOverrideCursor()
2158 E5MessageBox.critical( 2158 E5MessageBox.critical(
2159 self, self.trUtf8('Open File'), 2159 self, self.trUtf8('Open File'),
2160 self.trUtf8('<p>The file <b>{0}</b> could not be opened.</p>' 2160 self.trUtf8('<p>The file <b>{0}</b> could not be opened.</p>'
2161 '<p>Reason: {1}</p>') 2161 '<p>Reason: {1}</p>')
2162 .format(fileName, str(why))) 2162 .format(fileName, str(why)))
2163 QApplication.restoreOverrideCursor() 2163 QApplication.restoreOverrideCursor()
2164 return 2164 return
2165 2165
2166 self.__textEdit.setText(txt) 2166 self.__textEdit.setText(txt)
2167 QApplication.restoreOverrideCursor() 2167 QApplication.restoreOverrideCursor()
2192 except (IOError, Utilities.CodingError, UnicodeError) as why: 2192 except (IOError, Utilities.CodingError, UnicodeError) as why:
2193 E5MessageBox.critical( 2193 E5MessageBox.critical(
2194 self, self.trUtf8('Save File'), 2194 self, self.trUtf8('Save File'),
2195 self.trUtf8('<p>The file <b>{0}</b> could not be saved.<br/>' 2195 self.trUtf8('<p>The file <b>{0}</b> could not be saved.<br/>'
2196 'Reason: {1}</p>') 2196 'Reason: {1}</p>')
2197 .format(fileName, str(why))) 2197 .format(fileName, str(why)))
2198 QApplication.restoreOverrideCursor() 2198 QApplication.restoreOverrideCursor()
2199 2199
2200 self.__checkActions() 2200 self.__checkActions()
2201 2201
2202 return False 2202 return False
2222 if not self.__curFile: 2222 if not self.__curFile:
2223 shownName = self.trUtf8("Untitled") 2223 shownName = self.trUtf8("Untitled")
2224 else: 2224 else:
2225 shownName = self.__strippedName(self.__curFile) 2225 shownName = self.__strippedName(self.__curFile)
2226 2226
2227 self.setWindowTitle(self.trUtf8("{0}[*] - {1}")\ 2227 self.setWindowTitle(self.trUtf8("{0}[*] - {1}")
2228 .format(shownName, self.trUtf8("Mini Editor"))) 2228 .format(shownName, self.trUtf8("Mini Editor")))
2229 2229
2230 self.__textEdit.setModified(False) 2230 self.__textEdit.setModified(False)
2231 self.setWindowModified(False) 2231 self.setWindowModified(False)
2232 2232
2794 return True 2794 return True
2795 2795
2796 if self.filetype == "": 2796 if self.filetype == "":
2797 line0 = self.__textEdit.text(0) 2797 line0 = self.__textEdit.text(0)
2798 if line0.startswith("#!") and \ 2798 if line0.startswith("#!") and \
2799 ("python2" in line0 or \ 2799 ("python2" in line0 or
2800 ("python" in line0 and not "python3" in line0)): 2800 ("python" in line0 and not "python3" in line0)):
2801 return True 2801 return True
2802 2802
2803 if self.__curFile is not None: 2803 if self.__curFile is not None:
2804 exts = [] 2804 exts = []
2805 for ext in Preferences.getDebugger("PythonExtensions").split(): 2805 for ext in Preferences.getDebugger("PythonExtensions").split():

eric ide

mercurial