eric6/QScintilla/Shell.py

changeset 8218
7c09585bd960
parent 8169
139bd30c52c2
child 8222
5994b80b8760
equal deleted inserted replaced
8217:385f60c94548 8218:7c09585bd960
50 @param horizontal flag indicating a horizontal layout 50 @param horizontal flag indicating a horizontal layout
51 @type bool 51 @type bool
52 @param parent parent widget 52 @param parent parent widget
53 @type QWidget 53 @type QWidget
54 """ 54 """
55 super(ShellAssembly, self).__init__(parent) 55 super().__init__(parent)
56 56
57 self.__shell = Shell(dbs, vm, project, False, self) 57 self.__shell = Shell(dbs, vm, project, False, self)
58 58
59 from UI.SearchWidget import SearchWidget 59 from UI.SearchWidget import SearchWidget
60 self.__searchWidget = SearchWidget(self.__shell, self, horizontal) 60 self.__searchWidget = SearchWidget(self.__shell, self, horizontal)
134 @param windowedVariant flag indicating the shell window variant 134 @param windowedVariant flag indicating the shell window variant
135 @type bool 135 @type bool
136 @param parent parent widget 136 @param parent parent widget
137 @type QWidget 137 @type QWidget
138 """ 138 """
139 super(Shell, self).__init__(parent) 139 super().__init__(parent)
140 self.setUtf8(True) 140 self.setUtf8(True)
141 141
142 self.vm = vm 142 self.vm = vm
143 self.__mainWindow = parent 143 self.__mainWindow = parent
144 self.__lastSearch = () 144 self.__lastSearch = ()
840 @param platform platform of the remote interpreter 840 @param platform platform of the remote interpreter
841 @type str 841 @type str
842 @param venvName name of the virtual environment 842 @param venvName name of the virtual environment
843 @type str 843 @type str
844 """ 844 """
845 super(Shell, self).clear() 845 super().clear()
846 if self.passive and not self.dbs.isConnected(): 846 if self.passive and not self.dbs.isConnected():
847 self.__write(self.tr('Passive Debug Mode')) 847 self.__write(self.tr('Passive Debug Mode'))
848 self.__write(self.tr('\nNot connected')) 848 self.__write(self.tr('\nNot connected'))
849 else: 849 else:
850 self.__currentVenv = venvName 850 self.__currentVenv = venvName
1242 self.setFocus() 1242 self.setFocus()
1243 if event.button() == Qt.MouseButton.MidButton: 1243 if event.button() == Qt.MouseButton.MidButton:
1244 lines = QApplication.clipboard().text(QClipboard.Mode.Selection) 1244 lines = QApplication.clipboard().text(QClipboard.Mode.Selection)
1245 self.paste(lines) 1245 self.paste(lines)
1246 else: 1246 else:
1247 super(Shell, self).mousePressEvent(event) 1247 super().mousePressEvent(event)
1248 1248
1249 def wheelEvent(self, evt): 1249 def wheelEvent(self, evt):
1250 """ 1250 """
1251 Protected method to handle wheel events. 1251 Protected method to handle wheel events.
1252 1252
1259 elif delta > 0: 1259 elif delta > 0:
1260 self.zoomIn() 1260 self.zoomIn()
1261 evt.accept() 1261 evt.accept()
1262 return 1262 return
1263 1263
1264 super(Shell, self).wheelEvent(evt) 1264 super().wheelEvent(evt)
1265 1265
1266 def event(self, evt): 1266 def event(self, evt):
1267 """ 1267 """
1268 Public method handling events. 1268 Public method handling events.
1269 1269
1272 """ 1272 """
1273 if evt.type() == QEvent.Type.Gesture: 1273 if evt.type() == QEvent.Type.Gesture:
1274 self.gestureEvent(evt) 1274 self.gestureEvent(evt)
1275 return True 1275 return True
1276 1276
1277 return super(Shell, self).event(evt) 1277 return super().event(evt)
1278 1278
1279 def gestureEvent(self, evt): 1279 def gestureEvent(self, evt):
1280 """ 1280 """
1281 Protected method handling gesture events. 1281 Protected method handling gesture events.
1282 1282
1334 line, col = self.__getEndPos() 1334 line, col = self.__getEndPos()
1335 self.setCursorPosition(line, col) 1335 self.setCursorPosition(line, col)
1336 self.prline, self.prcol = self.getCursorPosition() 1336 self.prline, self.prcol = self.getCursorPosition()
1337 if self.__echoInput: 1337 if self.__echoInput:
1338 ac = self.isListActive() 1338 ac = self.isListActive()
1339 super(Shell, self).keyPressEvent(ev) 1339 super().keyPressEvent(ev)
1340 self.incrementalSearchActive = True 1340 self.incrementalSearchActive = True
1341 if ac and self.racEnabled: 1341 if ac and self.racEnabled:
1342 self.dbs.remoteCompletion( 1342 self.dbs.remoteCompletion(
1343 self.__debugUI.getSelectedDebuggerId(), 1343 self.__debugUI.getSelectedDebuggerId(),
1344 self.completionText + txt 1344 self.completionText + txt
2156 event.mimeData().hasText() 2156 event.mimeData().hasText()
2157 ) 2157 )
2158 if self.inDragDrop: 2158 if self.inDragDrop:
2159 event.acceptProposedAction() 2159 event.acceptProposedAction()
2160 else: 2160 else:
2161 super(Shell, self).dragEnterEvent(event) 2161 super().dragEnterEvent(event)
2162 2162
2163 def dragMoveEvent(self, event): 2163 def dragMoveEvent(self, event):
2164 """ 2164 """
2165 Protected method to handle the drag move event. 2165 Protected method to handle the drag move event.
2166 2166
2167 @param event the drag move event (QDragMoveEvent) 2167 @param event the drag move event (QDragMoveEvent)
2168 """ 2168 """
2169 if self.inDragDrop: 2169 if self.inDragDrop:
2170 event.accept() 2170 event.accept()
2171 else: 2171 else:
2172 super(Shell, self).dragMoveEvent(event) 2172 super().dragMoveEvent(event)
2173 2173
2174 def dragLeaveEvent(self, event): 2174 def dragLeaveEvent(self, event):
2175 """ 2175 """
2176 Protected method to handle the drag leave event. 2176 Protected method to handle the drag leave event.
2177 2177
2179 """ 2179 """
2180 if self.inDragDrop: 2180 if self.inDragDrop:
2181 self.inDragDrop = False 2181 self.inDragDrop = False
2182 event.accept() 2182 event.accept()
2183 else: 2183 else:
2184 super(Shell, self).dragLeaveEvent(event) 2184 super().dragLeaveEvent(event)
2185 2185
2186 def dropEvent(self, event): 2186 def dropEvent(self, event):
2187 """ 2187 """
2188 Protected method to handle the drop event. 2188 Protected method to handle the drop event.
2189 2189
2207 if s: 2207 if s:
2208 event.acceptProposedAction() 2208 event.acceptProposedAction()
2209 self.executeLines(s) 2209 self.executeLines(s)
2210 del s 2210 del s
2211 else: 2211 else:
2212 super(Shell, self).dropEvent(event) 2212 super().dropEvent(event)
2213 2213
2214 self.inDragDrop = False 2214 self.inDragDrop = False
2215 2215
2216 def focusInEvent(self, event): 2216 def focusInEvent(self, event):
2217 """ 2217 """
2247 self.__searchNextShortcut.setEnabled(True) 2247 self.__searchNextShortcut.setEnabled(True)
2248 self.__searchPrevShortcut.setEnabled(True) 2248 self.__searchPrevShortcut.setEnabled(True)
2249 self.setCaretWidth(self.caretWidth) 2249 self.setCaretWidth(self.caretWidth)
2250 self.setCursorFlashTime(QApplication.cursorFlashTime()) 2250 self.setCursorFlashTime(QApplication.cursorFlashTime())
2251 2251
2252 super(Shell, self).focusInEvent(event) 2252 super().focusInEvent(event)
2253 2253
2254 def focusOutEvent(self, event): 2254 def focusOutEvent(self, event):
2255 """ 2255 """
2256 Protected method called when the shell loses focus. 2256 Protected method called when the shell loses focus.
2257 2257
2264 if not self.__windowed: 2264 if not self.__windowed:
2265 self.__searchShortcut.setEnabled(False) 2265 self.__searchShortcut.setEnabled(False)
2266 self.__searchNextShortcut.setEnabled(False) 2266 self.__searchNextShortcut.setEnabled(False)
2267 self.__searchPrevShortcut.setEnabled(False) 2267 self.__searchPrevShortcut.setEnabled(False)
2268 self.setCaretWidth(0) 2268 self.setCaretWidth(0)
2269 super(Shell, self).focusOutEvent(event) 2269 super().focusOutEvent(event)
2270 2270
2271 def insert(self, txt): 2271 def insert(self, txt):
2272 """ 2272 """
2273 Public slot to insert text at the current cursor position. 2273 Public slot to insert text at the current cursor position.
2274 2274

eric ide

mercurial