eric6/QScintilla/MiniEditor.py

changeset 8218
7c09585bd960
parent 8169
139bd30c52c2
child 8222
5994b80b8760
equal deleted inserted replaced
8217:385f60c94548 8218:7c09585bd960
65 Constructor 65 Constructor
66 66
67 @param parent parent widget 67 @param parent parent widget
68 @type QWidget 68 @type QWidget
69 """ 69 """
70 super(MiniScintilla, self).__init__(parent) 70 super().__init__(parent)
71 71
72 self.mw = parent 72 self.mw = parent
73 73
74 def getFileName(self): 74 def getFileName(self):
75 """ 75 """
92 matchingPairs = ['()', '[]', '{}', '<>', "''", '""'] 92 matchingPairs = ['()', '[]', '{}', '<>', "''", '""']
93 # __IGNORE_WARNING_M613__ 93 # __IGNORE_WARNING_M613__
94 if text in matchingPairs: 94 if text in matchingPairs:
95 self.delete() 95 self.delete()
96 96
97 super(MiniScintilla, self).editorCommand(cmd) 97 super().editorCommand(cmd)
98 98
99 def keyPressEvent(self, ev): 99 def keyPressEvent(self, ev):
100 """ 100 """
101 Protected method to handle the user input a key at a time. 101 Protected method to handle the user input a key at a time.
102 102
133 if txt in MiniScintilla.EncloseChars: 133 if txt in MiniScintilla.EncloseChars:
134 encloseSelectedText(MiniScintilla.EncloseChars[txt]) 134 encloseSelectedText(MiniScintilla.EncloseChars[txt])
135 ev.accept() 135 ev.accept()
136 return 136 return
137 137
138 super(MiniScintilla, self).keyPressEvent(ev) 138 super().keyPressEvent(ev)
139 else: 139 else:
140 ev.ignore() 140 ev.ignore()
141 141
142 def focusInEvent(self, event): 142 def focusInEvent(self, event):
143 """ 143 """
157 except AttributeError: 157 except AttributeError:
158 pass 158 pass
159 159
160 self.setCursorFlashTime(QApplication.cursorFlashTime()) 160 self.setCursorFlashTime(QApplication.cursorFlashTime())
161 161
162 super(MiniScintilla, self).focusInEvent(event) 162 super().focusInEvent(event)
163 163
164 def focusOutEvent(self, event): 164 def focusOutEvent(self, event):
165 """ 165 """
166 Protected method called when the editor loses focus. 166 Protected method called when the editor loses focus.
167 167
169 @type QFocusEvent 169 @type QFocusEvent
170 """ 170 """
171 self.mw.editorActGrp.setEnabled(False) 171 self.mw.editorActGrp.setEnabled(False)
172 self.setCaretWidth(0) 172 self.setCaretWidth(0)
173 173
174 super(MiniScintilla, self).focusOutEvent(event) 174 super().focusOutEvent(event)
175 175
176 def removeTrailingWhitespace(self): 176 def removeTrailingWhitespace(self):
177 """ 177 """
178 Public method to remove trailing whitespace. 178 Public method to remove trailing whitespace.
179 """ 179 """
214 @param filename name of the file to open (string) 214 @param filename name of the file to open (string)
215 @param filetype type of the source file (string) 215 @param filetype type of the source file (string)
216 @param parent reference to the parent widget (QWidget) 216 @param parent reference to the parent widget (QWidget)
217 @param name object name of the window (string) 217 @param name object name of the window (string)
218 """ 218 """
219 super(MiniEditor, self).__init__(parent) 219 super().__init__(parent)
220 if name is not None: 220 if name is not None:
221 self.setObjectName(name) 221 self.setObjectName(name)
222 self.setWindowIcon(UI.PixmapCache.getIcon("editor")) 222 self.setWindowIcon(UI.PixmapCache.getIcon("editor"))
223 223
224 self.setStyle(Preferences.getUI("Style"), 224 self.setStyle(Preferences.getUI("Style"),
2738 @type bool 2738 @type bool
2739 """ 2739 """
2740 if "[*]" not in self.windowTitle(): 2740 if "[*]" not in self.windowTitle():
2741 self.setWindowTitle(self.tr("[*] - {0}") 2741 self.setWindowTitle(self.tr("[*] - {0}")
2742 .format(self.tr("Mini Editor"))) 2742 .format(self.tr("Mini Editor")))
2743 super(MiniEditor, self).setWindowModified(modified) 2743 super().setWindowModified(modified)
2744 2744
2745 def __setCurrentFile(self, fileName): 2745 def __setCurrentFile(self, fileName):
2746 """ 2746 """
2747 Private method to register the file name of the current file. 2747 Private method to register the file name of the current file.
2748 2748

eric ide

mercurial