src/eric7/QScintilla/ShellWindow.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
7 Module implementing a stand alone shell window. 7 Module implementing a stand alone shell window.
8 """ 8 """
9 9
10 import os 10 import os
11 11
12 from PyQt6.QtCore import ( 12 from PyQt6.QtCore import Qt, QCoreApplication, QPoint, QSize, QSignalMapper, QProcess
13 Qt, QCoreApplication, QPoint, QSize, QSignalMapper, QProcess
14 )
15 from PyQt6.QtGui import QKeySequence, QAction 13 from PyQt6.QtGui import QKeySequence, QAction
16 from PyQt6.QtWidgets import ( 14 from PyQt6.QtWidgets import QWidget, QVBoxLayout, QApplication, QWhatsThis, QDialog
17 QWidget, QVBoxLayout, QApplication, QWhatsThis, QDialog
18 )
19 from PyQt6.Qsci import QsciScintilla 15 from PyQt6.Qsci import QsciScintilla
20 16
21 from EricWidgets.EricMainWindow import EricMainWindow 17 from EricWidgets.EricMainWindow import EricMainWindow
22 from EricGui.EricAction import EricAction, createActionGroup 18 from EricGui.EricAction import EricAction, createActionGroup
23 from EricWidgets.EricApplication import ericApp 19 from EricWidgets.EricApplication import ericApp
42 38
43 class ShellWindow(EricMainWindow): 39 class ShellWindow(EricMainWindow):
44 """ 40 """
45 Class implementing a stand alone shell window. 41 Class implementing a stand alone shell window.
46 """ 42 """
43
47 def __init__(self, originalPathString, parent=None, name=None): 44 def __init__(self, originalPathString, parent=None, name=None):
48 """ 45 """
49 Constructor 46 Constructor
50 47
51 @param originalPathString original PATH environment variable 48 @param originalPathString original PATH environment variable
52 @type str 49 @type str
53 @param parent reference to the parent widget 50 @param parent reference to the parent widget
54 @type QWidget 51 @type QWidget
55 @param name object name of the window 52 @param name object name of the window
58 super().__init__(parent) 55 super().__init__(parent)
59 if name is not None: 56 if name is not None:
60 self.setObjectName(name) 57 self.setObjectName(name)
61 self.setWindowIcon(UI.PixmapCache.getIcon("shell")) 58 self.setWindowIcon(UI.PixmapCache.getIcon("shell"))
62 self.setWindowTitle(self.tr("eric Shell")) 59 self.setWindowTitle(self.tr("eric Shell"))
63 60
64 self.setStyle(Preferences.getUI("Style"), 61 self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet"))
65 Preferences.getUI("StyleSheet")) 62
66
67 self.__lastDebuggerId = "" 63 self.__lastDebuggerId = ""
68 64
69 # initialize the APIs manager 65 # initialize the APIs manager
70 self.__apisManager = APIsManager(parent=self) 66 self.__apisManager = APIsManager(parent=self)
71 67
72 # initialize the debug server and shell widgets 68 # initialize the debug server and shell widgets
73 self.__debugServer = DebugServer(originalPathString, 69 self.__debugServer = DebugServer(
74 preventPassiveDebugging=True, 70 originalPathString, preventPassiveDebugging=True, parent=self
75 parent=self) 71 )
76 self.__debugServer.clientDebuggerId.connect(self.__clientDebuggerId) 72 self.__debugServer.clientDebuggerId.connect(self.__clientDebuggerId)
77 73
78 self.__shell = Shell(self.__debugServer, self, None, True, self) 74 self.__shell = Shell(self.__debugServer, self, None, True, self)
79 self.__shell.registerDebuggerIdMethod(self.getDebuggerId) 75 self.__shell.registerDebuggerIdMethod(self.getDebuggerId)
80 76
81 self.__searchWidget = SearchWidget(self.__shell, self, showLine=True) 77 self.__searchWidget = SearchWidget(self.__shell, self, showLine=True)
82 78
83 centralWidget = QWidget() 79 centralWidget = QWidget()
84 layout = QVBoxLayout() 80 layout = QVBoxLayout()
85 layout.setContentsMargins(1, 1, 1, 1) 81 layout.setContentsMargins(1, 1, 1, 1)
86 layout.addWidget(self.__shell) 82 layout.addWidget(self.__shell)
87 layout.addWidget(self.__searchWidget) 83 layout.addWidget(self.__searchWidget)
88 centralWidget.setLayout(layout) 84 centralWidget.setLayout(layout)
89 self.setCentralWidget(centralWidget) 85 self.setCentralWidget(centralWidget)
90 self.__searchWidget.hide() 86 self.__searchWidget.hide()
91 87
92 self.__searchWidget.searchNext.connect(self.__shell.searchNext) 88 self.__searchWidget.searchNext.connect(self.__shell.searchNext)
93 self.__searchWidget.searchPrevious.connect(self.__shell.searchPrev) 89 self.__searchWidget.searchPrevious.connect(self.__shell.searchPrev)
94 self.__shell.searchStringFound.connect( 90 self.__shell.searchStringFound.connect(self.__searchWidget.searchStringFound)
95 self.__searchWidget.searchStringFound) 91
96
97 self.__shell.zoomValueChanged.connect(self.__zoomValueChanged) 92 self.__shell.zoomValueChanged.connect(self.__zoomValueChanged)
98 93
99 self.__createActions() 94 self.__createActions()
100 self.__createMenus() 95 self.__createMenus()
101 self.__createToolBars() 96 self.__createToolBars()
102 self.__createStatusBar() 97 self.__createStatusBar()
103 98
104 self.__readSettings() 99 self.__readSettings()
105 100
106 self.__shell.historyStyleChanged.connect(self.__historyStyleChanged) 101 self.__shell.historyStyleChanged.connect(self.__historyStyleChanged)
107 102
108 # Generate the virtual environment manager and register it 103 # Generate the virtual environment manager and register it
109 self.virtualenvManager = VirtualenvManager(self) 104 self.virtualenvManager = VirtualenvManager(self)
110 ericApp().registerObject("VirtualEnvManager", self.virtualenvManager) 105 ericApp().registerObject("VirtualEnvManager", self.virtualenvManager)
111 106
112 self.__shell.virtualEnvironmentChanged.connect( 107 self.__shell.virtualEnvironmentChanged.connect(self.__virtualEnvironmentChanged)
113 self.__virtualEnvironmentChanged) 108
114
115 # now start the debug client with the most recently used virtual 109 # now start the debug client with the most recently used virtual
116 # environment 110 # environment
117 self.__debugServer.startClient( 111 self.__debugServer.startClient(
118 False, venvName=Preferences.getShell("LastVirtualEnvironment") 112 False, venvName=Preferences.getShell("LastVirtualEnvironment")
119 ) 113 )
120 114
121 # set the keyboard input interval 115 # set the keyboard input interval
122 interval = Preferences.getUI("KeyboardInputInterval") 116 interval = Preferences.getUI("KeyboardInputInterval")
123 if interval > 0: 117 if interval > 0:
124 QApplication.setKeyboardInputInterval(interval) 118 QApplication.setKeyboardInputInterval(interval)
125 119
126 def closeEvent(self, event): 120 def closeEvent(self, event):
127 """ 121 """
128 Protected method to handle the close event. 122 Protected method to handle the close event.
129 123
130 @param event close event 124 @param event close event
131 @type QCloseEvent 125 @type QCloseEvent
132 """ 126 """
133 self.__writeSettings() 127 self.__writeSettings()
134 self.__debugServer.shutdownServer() 128 self.__debugServer.shutdownServer()
135 self.__shell.closeShell() 129 self.__shell.closeShell()
136 Preferences.syncPreferences() 130 Preferences.syncPreferences()
137 131
138 event.accept() 132 event.accept()
139 133
140 def __clientDebuggerId(self, debuggerId): 134 def __clientDebuggerId(self, debuggerId):
141 """ 135 """
142 Private slot to receive the ID of a newly connected debugger backend. 136 Private slot to receive the ID of a newly connected debugger backend.
143 137
144 @param debuggerId ID of a newly connected debugger backend 138 @param debuggerId ID of a newly connected debugger backend
145 @type str 139 @type str
146 """ 140 """
147 self.__lastDebuggerId = debuggerId 141 self.__lastDebuggerId = debuggerId
148 142
149 def getDebuggerId(self): 143 def getDebuggerId(self):
150 """ 144 """
151 Public method to get the most recently registered debugger ID. 145 Public method to get the most recently registered debugger ID.
152 146
153 @return debugger ID 147 @return debugger ID
154 @rtype str 148 @rtype str
155 """ 149 """
156 return self.__lastDebuggerId 150 return self.__lastDebuggerId
157 151
158 ################################################################## 152 ##################################################################
159 ## Below are API handling methods 153 ## Below are API handling methods
160 ################################################################## 154 ##################################################################
161 155
162 def getAPIsManager(self): 156 def getAPIsManager(self):
163 """ 157 """
164 Public method to get a reference to the APIs manager. 158 Public method to get a reference to the APIs manager.
165 159
166 @return the APIs manager object (eric7.QScintilla.APIsManager) 160 @return the APIs manager object (eric7.QScintilla.APIsManager)
167 """ 161 """
168 return self.__apisManager 162 return self.__apisManager
169 163
170 ################################################################## 164 ##################################################################
171 ## Below are action related methods 165 ## Below are action related methods
172 ################################################################## 166 ##################################################################
173 167
174 def __readShortcut(self, act, category): 168 def __readShortcut(self, act, category):
175 """ 169 """
176 Private function to read a single keyboard shortcut from the settings. 170 Private function to read a single keyboard shortcut from the settings.
177 171
178 @param act reference to the action object 172 @param act reference to the action object
179 @type EricAction 173 @type EricAction
180 @param category category the action belongs to 174 @param category category the action belongs to
181 @type str 175 @type str
182 """ 176 """
183 if act.objectName(): 177 if act.objectName():
184 accel = Preferences.getSettings().value( 178 accel = Preferences.getSettings().value(
185 "Shortcuts/{0}/{1}/Accel".format(category, act.objectName())) 179 "Shortcuts/{0}/{1}/Accel".format(category, act.objectName())
180 )
186 if accel is not None: 181 if accel is not None:
187 act.setShortcut(QKeySequence(accel)) 182 act.setShortcut(QKeySequence(accel))
188 accel = Preferences.getSettings().value( 183 accel = Preferences.getSettings().value(
189 "Shortcuts/{0}/{1}/AltAccel".format( 184 "Shortcuts/{0}/{1}/AltAccel".format(category, act.objectName())
190 category, act.objectName())) 185 )
191 if accel is not None: 186 if accel is not None:
192 act.setAlternateShortcut(QKeySequence(accel), removeEmpty=True) 187 act.setAlternateShortcut(QKeySequence(accel), removeEmpty=True)
193 188
194 def __createActions(self): 189 def __createActions(self):
195 """ 190 """
196 Private method to create the actions. 191 Private method to create the actions.
197 """ 192 """
198 self.fileActions = [] 193 self.fileActions = []
199 self.editActions = [] 194 self.editActions = []
200 self.searchActions = [] 195 self.searchActions = []
201 self.viewActions = [] 196 self.viewActions = []
202 self.helpActions = [] 197 self.helpActions = []
203 198
204 self.viewActGrp = createActionGroup(self) 199 self.viewActGrp = createActionGroup(self)
205 200
206 self.__createFileActions() 201 self.__createFileActions()
207 self.__createEditActions() 202 self.__createEditActions()
208 self.__createSearchActions() 203 self.__createSearchActions()
209 self.__createViewActions() 204 self.__createViewActions()
210 self.__createHelpActions() 205 self.__createHelpActions()
211 self.__createHistoryActions() 206 self.__createHistoryActions()
212 207
213 # read the keyboard shortcuts and make them identical to the main 208 # read the keyboard shortcuts and make them identical to the main
214 # eric shortcuts 209 # eric shortcuts
215 for act in self.helpActions: 210 for act in self.helpActions:
216 self.__readShortcut(act, "General") 211 self.__readShortcut(act, "General")
217 for act in self.editActions: 212 for act in self.editActions:
218 self.__readShortcut(act, "Edit") 213 self.__readShortcut(act, "Edit")
219 for act in self.fileActions: 214 for act in self.fileActions:
220 self.__readShortcut(act, "View") 215 self.__readShortcut(act, "View")
221 for act in self.searchActions: 216 for act in self.searchActions:
222 self.__readShortcut(act, "Search") 217 self.__readShortcut(act, "Search")
223 218
224 def __createFileActions(self): 219 def __createFileActions(self):
225 """ 220 """
226 Private method defining the user interface actions for the file 221 Private method defining the user interface actions for the file
227 commands. 222 commands.
228 """ 223 """
229 self.exitAct = EricAction( 224 self.exitAct = EricAction(
230 self.tr('Quit'), 225 self.tr("Quit"),
231 UI.PixmapCache.getIcon("exit"), 226 UI.PixmapCache.getIcon("exit"),
232 self.tr('&Quit'), 227 self.tr("&Quit"),
233 QKeySequence(self.tr("Ctrl+Q", "File|Quit")), 228 QKeySequence(self.tr("Ctrl+Q", "File|Quit")),
234 0, self, 'quit') 229 0,
235 self.exitAct.setStatusTip(self.tr('Quit the Shell')) 230 self,
236 self.exitAct.setWhatsThis(self.tr( 231 "quit",
237 """<b>Quit the Shell</b>""" 232 )
238 """<p>This quits the Shell window.</p>""" 233 self.exitAct.setStatusTip(self.tr("Quit the Shell"))
239 )) 234 self.exitAct.setWhatsThis(
235 self.tr(
236 """<b>Quit the Shell</b>""" """<p>This quits the Shell window.</p>"""
237 )
238 )
240 self.exitAct.triggered.connect(self.quit) 239 self.exitAct.triggered.connect(self.quit)
241 self.exitAct.setMenuRole(QAction.MenuRole.QuitRole) 240 self.exitAct.setMenuRole(QAction.MenuRole.QuitRole)
242 self.fileActions.append(self.exitAct) 241 self.fileActions.append(self.exitAct)
243 242
244 self.newWindowAct = EricAction( 243 self.newWindowAct = EricAction(
245 self.tr('New Window'), 244 self.tr("New Window"),
246 UI.PixmapCache.getIcon("newWindow"), 245 UI.PixmapCache.getIcon("newWindow"),
247 self.tr('New &Window'), 246 self.tr("New &Window"),
248 QKeySequence(self.tr("Ctrl+Shift+N", "File|New Window")), 247 QKeySequence(self.tr("Ctrl+Shift+N", "File|New Window")),
249 0, self, 'new_window') 248 0,
250 self.newWindowAct.setStatusTip(self.tr( 249 self,
251 'Open a new Shell window')) 250 "new_window",
252 self.newWindowAct.setWhatsThis(self.tr( 251 )
253 """<b>New Window</b>""" 252 self.newWindowAct.setStatusTip(self.tr("Open a new Shell window"))
254 """<p>This opens a new instance of the Shell window.</p>""" 253 self.newWindowAct.setWhatsThis(
255 )) 254 self.tr(
255 """<b>New Window</b>"""
256 """<p>This opens a new instance of the Shell window.</p>"""
257 )
258 )
256 self.newWindowAct.triggered.connect(self.__newWindow) 259 self.newWindowAct.triggered.connect(self.__newWindow)
257 self.fileActions.append(self.newWindowAct) 260 self.fileActions.append(self.newWindowAct)
258 261
259 self.restartAct = EricAction( 262 self.restartAct = EricAction(
260 self.tr('Restart'), 263 self.tr("Restart"),
261 UI.PixmapCache.getIcon("restart"), 264 UI.PixmapCache.getIcon("restart"),
262 self.tr('Restart'), 265 self.tr("Restart"),
263 0, 0, self, 'shell_restart') 266 0,
264 self.restartAct.setStatusTip(self.tr( 267 0,
265 'Restart the shell')) 268 self,
266 self.restartAct.setWhatsThis(self.tr( 269 "shell_restart",
267 """<b>Restart</b>""" 270 )
268 """<p>Restart the shell for the currently selected""" 271 self.restartAct.setStatusTip(self.tr("Restart the shell"))
269 """ environment.</p>""" 272 self.restartAct.setWhatsThis(
270 )) 273 self.tr(
274 """<b>Restart</b>"""
275 """<p>Restart the shell for the currently selected"""
276 """ environment.</p>"""
277 )
278 )
271 self.restartAct.triggered.connect(self.__shell.doRestart) 279 self.restartAct.triggered.connect(self.__shell.doRestart)
272 self.fileActions.append(self.restartAct) 280 self.fileActions.append(self.restartAct)
273 281
274 self.clearRestartAct = EricAction( 282 self.clearRestartAct = EricAction(
275 self.tr('Restart and Clear'), 283 self.tr("Restart and Clear"),
276 UI.PixmapCache.getIcon("restartDelete"), 284 UI.PixmapCache.getIcon("restartDelete"),
277 self.tr('Restart and Clear'), 285 self.tr("Restart and Clear"),
278 Qt.Key.Key_F4, 0, self, 'shell_clear_restart') 286 Qt.Key.Key_F4,
279 self.clearRestartAct.setStatusTip(self.tr( 287 0,
280 'Clear the window and restart the shell')) 288 self,
281 self.clearRestartAct.setWhatsThis(self.tr( 289 "shell_clear_restart",
282 """<b>Restart and Clear</b>""" 290 )
283 """<p>Clear the shell window and restart the shell for the""" 291 self.clearRestartAct.setStatusTip(
284 """ currently selected environment.</p>""" 292 self.tr("Clear the window and restart the shell")
285 )) 293 )
294 self.clearRestartAct.setWhatsThis(
295 self.tr(
296 """<b>Restart and Clear</b>"""
297 """<p>Clear the shell window and restart the shell for the"""
298 """ currently selected environment.</p>"""
299 )
300 )
286 self.clearRestartAct.triggered.connect(self.__shell.doClearRestart) 301 self.clearRestartAct.triggered.connect(self.__shell.doClearRestart)
287 self.fileActions.append(self.clearRestartAct) 302 self.fileActions.append(self.clearRestartAct)
288 303
289 self.saveContentsAct = EricAction( 304 self.saveContentsAct = EricAction(
290 self.tr('Save Contents'), 305 self.tr("Save Contents"),
291 UI.PixmapCache.getIcon("fileSave"), 306 UI.PixmapCache.getIcon("fileSave"),
292 self.tr('Save Contents...'), 307 self.tr("Save Contents..."),
293 QKeySequence(QCoreApplication.translate( 308 QKeySequence(
294 'ViewManager', "Ctrl+S", "File|Save")), 309 QCoreApplication.translate("ViewManager", "Ctrl+S", "File|Save")
295 0, self, 'vm_file_save') 310 ),
296 self.saveContentsAct.setStatusTip(self.tr( 311 0,
297 'Save the current contents of the shell to a file')) 312 self,
298 self.saveContentsAct.setWhatsThis(self.tr( 313 "vm_file_save",
299 """<b>Save Contents</b>""" 314 )
300 """<p>Save the current contents of the shell to a file.</p>""" 315 self.saveContentsAct.setStatusTip(
301 )) 316 self.tr("Save the current contents of the shell to a file")
317 )
318 self.saveContentsAct.setWhatsThis(
319 self.tr(
320 """<b>Save Contents</b>"""
321 """<p>Save the current contents of the shell to a file.</p>"""
322 )
323 )
302 self.saveContentsAct.triggered.connect(self.__shell.saveContents) 324 self.saveContentsAct.triggered.connect(self.__shell.saveContents)
303 self.fileActions.append(self.saveContentsAct) 325 self.fileActions.append(self.saveContentsAct)
304 326
305 def __createEditActions(self): 327 def __createEditActions(self):
306 """ 328 """
307 Private method defining the user interface actions for the edit 329 Private method defining the user interface actions for the edit
308 commands. 330 commands.
309 """ 331 """
310 self.editActGrp = createActionGroup(self) 332 self.editActGrp = createActionGroup(self)
311 self.copyActGrp = createActionGroup(self.editActGrp) 333 self.copyActGrp = createActionGroup(self.editActGrp)
312 334
313 self.cutAct = EricAction( 335 self.cutAct = EricAction(
314 QCoreApplication.translate('ViewManager', 'Cut'), 336 QCoreApplication.translate("ViewManager", "Cut"),
315 UI.PixmapCache.getIcon("editCut"), 337 UI.PixmapCache.getIcon("editCut"),
316 QCoreApplication.translate('ViewManager', 'Cu&t'), 338 QCoreApplication.translate("ViewManager", "Cu&t"),
317 QKeySequence(QCoreApplication.translate( 339 QKeySequence(
318 'ViewManager', "Ctrl+X", "Edit|Cut")), 340 QCoreApplication.translate("ViewManager", "Ctrl+X", "Edit|Cut")
319 QKeySequence(QCoreApplication.translate( 341 ),
320 'ViewManager', "Shift+Del", "Edit|Cut")), 342 QKeySequence(
321 self.copyActGrp, 'vm_edit_cut') 343 QCoreApplication.translate("ViewManager", "Shift+Del", "Edit|Cut")
322 self.cutAct.setStatusTip(QCoreApplication.translate( 344 ),
323 'ViewManager', 'Cut the selection')) 345 self.copyActGrp,
324 self.cutAct.setWhatsThis(self.tr( 346 "vm_edit_cut",
325 """<b>Cut</b>""" 347 )
326 """<p>Cut the selected text to the clipboard.</p>""" 348 self.cutAct.setStatusTip(
327 )) 349 QCoreApplication.translate("ViewManager", "Cut the selection")
350 )
351 self.cutAct.setWhatsThis(
352 self.tr(
353 """<b>Cut</b>""" """<p>Cut the selected text to the clipboard.</p>"""
354 )
355 )
328 self.cutAct.triggered.connect(self.__shell.cut) 356 self.cutAct.triggered.connect(self.__shell.cut)
329 self.editActions.append(self.cutAct) 357 self.editActions.append(self.cutAct)
330 358
331 self.copyAct = EricAction( 359 self.copyAct = EricAction(
332 QCoreApplication.translate('ViewManager', 'Copy'), 360 QCoreApplication.translate("ViewManager", "Copy"),
333 UI.PixmapCache.getIcon("editCopy"), 361 UI.PixmapCache.getIcon("editCopy"),
334 QCoreApplication.translate('ViewManager', '&Copy'), 362 QCoreApplication.translate("ViewManager", "&Copy"),
335 QKeySequence(QCoreApplication.translate( 363 QKeySequence(
336 'ViewManager', "Ctrl+C", "Edit|Copy")), 364 QCoreApplication.translate("ViewManager", "Ctrl+C", "Edit|Copy")
337 QKeySequence(QCoreApplication.translate( 365 ),
338 'ViewManager', "Ctrl+Ins", "Edit|Copy")), 366 QKeySequence(
339 self.copyActGrp, 'vm_edit_copy') 367 QCoreApplication.translate("ViewManager", "Ctrl+Ins", "Edit|Copy")
340 self.copyAct.setStatusTip(QCoreApplication.translate( 368 ),
341 'ViewManager', 'Copy the selection')) 369 self.copyActGrp,
342 self.copyAct.setWhatsThis(self.tr( 370 "vm_edit_copy",
343 """<b>Copy</b>""" 371 )
344 """<p>Copy the selected text to the clipboard.</p>""" 372 self.copyAct.setStatusTip(
345 )) 373 QCoreApplication.translate("ViewManager", "Copy the selection")
374 )
375 self.copyAct.setWhatsThis(
376 self.tr(
377 """<b>Copy</b>""" """<p>Copy the selected text to the clipboard.</p>"""
378 )
379 )
346 self.copyAct.triggered.connect(self.__shell.copy) 380 self.copyAct.triggered.connect(self.__shell.copy)
347 self.editActions.append(self.copyAct) 381 self.editActions.append(self.copyAct)
348 382
349 self.pasteAct = EricAction( 383 self.pasteAct = EricAction(
350 QCoreApplication.translate('ViewManager', 'Paste'), 384 QCoreApplication.translate("ViewManager", "Paste"),
351 UI.PixmapCache.getIcon("editPaste"), 385 UI.PixmapCache.getIcon("editPaste"),
352 QCoreApplication.translate('ViewManager', '&Paste'), 386 QCoreApplication.translate("ViewManager", "&Paste"),
353 QKeySequence(QCoreApplication.translate( 387 QKeySequence(
354 'ViewManager', "Ctrl+V", "Edit|Paste")), 388 QCoreApplication.translate("ViewManager", "Ctrl+V", "Edit|Paste")
355 QKeySequence(QCoreApplication.translate( 389 ),
356 'ViewManager', "Shift+Ins", "Edit|Paste")), 390 QKeySequence(
357 self.copyActGrp, 'vm_edit_paste') 391 QCoreApplication.translate("ViewManager", "Shift+Ins", "Edit|Paste")
358 self.pasteAct.setStatusTip(QCoreApplication.translate( 392 ),
359 'ViewManager', 'Paste the last cut/copied text')) 393 self.copyActGrp,
360 self.pasteAct.setWhatsThis(self.tr( 394 "vm_edit_paste",
361 """<b>Paste</b>""" 395 )
362 """<p>Paste the last cut/copied text from the clipboard.</p>""" 396 self.pasteAct.setStatusTip(
363 )) 397 QCoreApplication.translate("ViewManager", "Paste the last cut/copied text")
398 )
399 self.pasteAct.setWhatsThis(
400 self.tr(
401 """<b>Paste</b>"""
402 """<p>Paste the last cut/copied text from the clipboard.</p>"""
403 )
404 )
364 self.pasteAct.triggered.connect(self.__shell.paste) 405 self.pasteAct.triggered.connect(self.__shell.paste)
365 self.editActions.append(self.pasteAct) 406 self.editActions.append(self.pasteAct)
366 407
367 self.clearAct = EricAction( 408 self.clearAct = EricAction(
368 QCoreApplication.translate('ViewManager', 'Clear'), 409 QCoreApplication.translate("ViewManager", "Clear"),
369 UI.PixmapCache.getIcon("editDelete"), 410 UI.PixmapCache.getIcon("editDelete"),
370 QCoreApplication.translate('ViewManager', 'Clear'), 411 QCoreApplication.translate("ViewManager", "Clear"),
371 QKeySequence(QCoreApplication.translate( 412 QKeySequence(
372 'ViewManager', "Alt+Shift+C", "Edit|Clear")), 413 QCoreApplication.translate("ViewManager", "Alt+Shift+C", "Edit|Clear")
373 0, 414 ),
374 self.copyActGrp, 'vm_edit_clear') 415 0,
375 self.clearAct.setStatusTip(QCoreApplication.translate( 416 self.copyActGrp,
376 'ViewManager', 'Clear all text')) 417 "vm_edit_clear",
377 self.clearAct.setWhatsThis(self.tr( 418 )
378 """<b>Clear</b>""" 419 self.clearAct.setStatusTip(
379 """<p>Delete all text.</p>""" 420 QCoreApplication.translate("ViewManager", "Clear all text")
380 )) 421 )
422 self.clearAct.setWhatsThis(
423 self.tr("""<b>Clear</b>""" """<p>Delete all text.</p>""")
424 )
381 self.clearAct.triggered.connect(self.__shell.clear) 425 self.clearAct.triggered.connect(self.__shell.clear)
382 self.editActions.append(self.clearAct) 426 self.editActions.append(self.clearAct)
383 427
384 self.cutAct.setEnabled(False) 428 self.cutAct.setEnabled(False)
385 self.copyAct.setEnabled(False) 429 self.copyAct.setEnabled(False)
386 self.__shell.copyAvailable.connect(self.cutAct.setEnabled) 430 self.__shell.copyAvailable.connect(self.cutAct.setEnabled)
387 self.__shell.copyAvailable.connect(self.copyAct.setEnabled) 431 self.__shell.copyAvailable.connect(self.copyAct.setEnabled)
388 432
389 #################################################################### 433 ####################################################################
390 ## Below follow the actions for QScintilla standard commands. 434 ## Below follow the actions for QScintilla standard commands.
391 #################################################################### 435 ####################################################################
392 436
393 self.esm = QSignalMapper(self) 437 self.esm = QSignalMapper(self)
394 try: 438 try:
395 self.esm.mappedInt.connect(self.__shell.editorCommand) 439 self.esm.mappedInt.connect(self.__shell.editorCommand)
396 except AttributeError: 440 except AttributeError:
397 # pre Qt 5.15 441 # pre Qt 5.15
398 self.esm.mapped[int].connect(self.__shell.editorCommand) 442 self.esm.mapped[int].connect(self.__shell.editorCommand)
399 443
400 self.editorActGrp = createActionGroup(self) 444 self.editorActGrp = createActionGroup(self)
401 445
402 act = EricAction( 446 act = EricAction(
403 QCoreApplication.translate('ViewManager', 'Delete current line'), 447 QCoreApplication.translate("ViewManager", "Delete current line"),
404 QCoreApplication.translate('ViewManager', 'Delete current line'), 448 QCoreApplication.translate("ViewManager", "Delete current line"),
405 QKeySequence(QCoreApplication.translate( 449 QKeySequence(QCoreApplication.translate("ViewManager", "Ctrl+Shift+L")),
406 'ViewManager', 'Ctrl+Shift+L')), 450 0,
407 0, 451 self.editorActGrp,
408 self.editorActGrp, 'vm_edit_delete_current_line') 452 "vm_edit_delete_current_line",
453 )
409 self.esm.setMapping(act, QsciScintilla.SCI_LINEDELETE) 454 self.esm.setMapping(act, QsciScintilla.SCI_LINEDELETE)
410 act.triggered.connect(self.esm.map) 455 act.triggered.connect(self.esm.map)
411 self.editActions.append(act) 456 self.editActions.append(act)
412 457
413 act = EricAction( 458 act = EricAction(
414 QCoreApplication.translate('ViewManager', 'Indent one level'), 459 QCoreApplication.translate("ViewManager", "Indent one level"),
415 QCoreApplication.translate('ViewManager', 'Indent one level'), 460 QCoreApplication.translate("ViewManager", "Indent one level"),
416 QKeySequence(QCoreApplication.translate('ViewManager', 'Tab')), 0, 461 QKeySequence(QCoreApplication.translate("ViewManager", "Tab")),
417 self.editorActGrp, 'vm_edit_indent_one_level') 462 0,
463 self.editorActGrp,
464 "vm_edit_indent_one_level",
465 )
418 self.esm.setMapping(act, QsciScintilla.SCI_TAB) 466 self.esm.setMapping(act, QsciScintilla.SCI_TAB)
419 act.triggered.connect(self.esm.map) 467 act.triggered.connect(self.esm.map)
420 self.editActions.append(act) 468 self.editActions.append(act)
421 469
422 act = EricAction( 470 act = EricAction(
423 QCoreApplication.translate('ViewManager', 'Insert new line'), 471 QCoreApplication.translate("ViewManager", "Insert new line"),
424 QCoreApplication.translate('ViewManager', 'Insert new line'), 472 QCoreApplication.translate("ViewManager", "Insert new line"),
425 QKeySequence(QCoreApplication.translate('ViewManager', 'Return')), 473 QKeySequence(QCoreApplication.translate("ViewManager", "Return")),
426 QKeySequence(QCoreApplication.translate('ViewManager', 'Enter')), 474 QKeySequence(QCoreApplication.translate("ViewManager", "Enter")),
427 self.editorActGrp, 'vm_edit_insert_line') 475 self.editorActGrp,
476 "vm_edit_insert_line",
477 )
428 self.esm.setMapping(act, QsciScintilla.SCI_NEWLINE) 478 self.esm.setMapping(act, QsciScintilla.SCI_NEWLINE)
429 act.triggered.connect(self.esm.map) 479 act.triggered.connect(self.esm.map)
430 self.editActions.append(act) 480 self.editActions.append(act)
431 481
432 act = EricAction( 482 act = EricAction(
433 QCoreApplication.translate('ViewManager', 483 QCoreApplication.translate("ViewManager", "Delete previous character"),
434 'Delete previous character'), 484 QCoreApplication.translate("ViewManager", "Delete previous character"),
435 QCoreApplication.translate('ViewManager', 485 QKeySequence(QCoreApplication.translate("ViewManager", "Backspace")),
436 'Delete previous character'), 486 0,
437 QKeySequence(QCoreApplication.translate('ViewManager', 487 self.editorActGrp,
438 'Backspace')), 488 "vm_edit_delete_previous_char",
439 0, self.editorActGrp, 'vm_edit_delete_previous_char') 489 )
440 if isMacPlatform(): 490 if isMacPlatform():
441 act.setAlternateShortcut(QKeySequence( 491 act.setAlternateShortcut(
442 QCoreApplication.translate('ViewManager', 'Meta+H'))) 492 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+H"))
493 )
443 else: 494 else:
444 act.setAlternateShortcut(QKeySequence( 495 act.setAlternateShortcut(
445 QCoreApplication.translate('ViewManager', 'Shift+Backspace'))) 496 QKeySequence(
497 QCoreApplication.translate("ViewManager", "Shift+Backspace")
498 )
499 )
446 self.esm.setMapping(act, QsciScintilla.SCI_DELETEBACK) 500 self.esm.setMapping(act, QsciScintilla.SCI_DELETEBACK)
447 act.triggered.connect(self.esm.map) 501 act.triggered.connect(self.esm.map)
448 self.editActions.append(act) 502 self.editActions.append(act)
449 503
450 act = EricAction( 504 act = EricAction(
451 QCoreApplication.translate('ViewManager', 505 QCoreApplication.translate("ViewManager", "Delete current character"),
452 'Delete current character'), 506 QCoreApplication.translate("ViewManager", "Delete current character"),
453 QCoreApplication.translate('ViewManager', 507 QKeySequence(QCoreApplication.translate("ViewManager", "Del")),
454 'Delete current character'), 508 0,
455 QKeySequence(QCoreApplication.translate('ViewManager', 'Del')), 509 self.editorActGrp,
456 0, self.editorActGrp, 'vm_edit_delete_current_char') 510 "vm_edit_delete_current_char",
511 )
457 if isMacPlatform(): 512 if isMacPlatform():
458 act.setAlternateShortcut(QKeySequence( 513 act.setAlternateShortcut(
459 QCoreApplication.translate('ViewManager', 'Meta+D'))) 514 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+D"))
515 )
460 self.esm.setMapping(act, QsciScintilla.SCI_CLEAR) 516 self.esm.setMapping(act, QsciScintilla.SCI_CLEAR)
461 act.triggered.connect(self.esm.map) 517 act.triggered.connect(self.esm.map)
462 self.editActions.append(act) 518 self.editActions.append(act)
463 519
464 act = EricAction( 520 act = EricAction(
465 QCoreApplication.translate('ViewManager', 'Delete word to left'), 521 QCoreApplication.translate("ViewManager", "Delete word to left"),
466 QCoreApplication.translate('ViewManager', 'Delete word to left'), 522 QCoreApplication.translate("ViewManager", "Delete word to left"),
467 QKeySequence(QCoreApplication.translate( 523 QKeySequence(QCoreApplication.translate("ViewManager", "Ctrl+Backspace")),
468 'ViewManager', 'Ctrl+Backspace')), 524 0,
469 0, 525 self.editorActGrp,
470 self.editorActGrp, 'vm_edit_delete_word_left') 526 "vm_edit_delete_word_left",
527 )
471 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDLEFT) 528 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDLEFT)
472 act.triggered.connect(self.esm.map) 529 act.triggered.connect(self.esm.map)
473 self.editActions.append(act) 530 self.editActions.append(act)
474 531
475 act = EricAction( 532 act = EricAction(
476 QCoreApplication.translate('ViewManager', 'Delete word to right'), 533 QCoreApplication.translate("ViewManager", "Delete word to right"),
477 QCoreApplication.translate('ViewManager', 'Delete word to right'), 534 QCoreApplication.translate("ViewManager", "Delete word to right"),
478 QKeySequence(QCoreApplication.translate('ViewManager', 535 QKeySequence(QCoreApplication.translate("ViewManager", "Ctrl+Del")),
479 'Ctrl+Del')), 536 0,
480 0, self.editorActGrp, 'vm_edit_delete_word_right') 537 self.editorActGrp,
538 "vm_edit_delete_word_right",
539 )
481 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDRIGHT) 540 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDRIGHT)
482 act.triggered.connect(self.esm.map) 541 act.triggered.connect(self.esm.map)
483 self.editActions.append(act) 542 self.editActions.append(act)
484 543
485 act = EricAction( 544 act = EricAction(
486 QCoreApplication.translate('ViewManager', 'Delete line to left'), 545 QCoreApplication.translate("ViewManager", "Delete line to left"),
487 QCoreApplication.translate('ViewManager', 'Delete line to left'), 546 QCoreApplication.translate("ViewManager", "Delete line to left"),
488 QKeySequence(QCoreApplication.translate( 547 QKeySequence(
489 'ViewManager', 'Ctrl+Shift+Backspace')), 548 QCoreApplication.translate("ViewManager", "Ctrl+Shift+Backspace")
490 0, 549 ),
491 self.editorActGrp, 'vm_edit_delete_line_left') 550 0,
551 self.editorActGrp,
552 "vm_edit_delete_line_left",
553 )
492 self.esm.setMapping(act, QsciScintilla.SCI_DELLINELEFT) 554 self.esm.setMapping(act, QsciScintilla.SCI_DELLINELEFT)
493 act.triggered.connect(self.esm.map) 555 act.triggered.connect(self.esm.map)
494 self.editActions.append(act) 556 self.editActions.append(act)
495 557
496 act = EricAction( 558 act = EricAction(
497 QCoreApplication.translate('ViewManager', 'Delete line to right'), 559 QCoreApplication.translate("ViewManager", "Delete line to right"),
498 QCoreApplication.translate('ViewManager', 'Delete line to right'), 560 QCoreApplication.translate("ViewManager", "Delete line to right"),
499 0, 0, 561 0,
500 self.editorActGrp, 'vm_edit_delete_line_right') 562 0,
563 self.editorActGrp,
564 "vm_edit_delete_line_right",
565 )
501 if isMacPlatform(): 566 if isMacPlatform():
502 act.setShortcut(QKeySequence( 567 act.setShortcut(
503 QCoreApplication.translate('ViewManager', 'Meta+K'))) 568 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+K"))
569 )
504 else: 570 else:
505 act.setShortcut(QKeySequence( 571 act.setShortcut(
506 QCoreApplication.translate('ViewManager', 'Ctrl+Shift+Del'))) 572 QKeySequence(
573 QCoreApplication.translate("ViewManager", "Ctrl+Shift+Del")
574 )
575 )
507 self.esm.setMapping(act, QsciScintilla.SCI_DELLINERIGHT) 576 self.esm.setMapping(act, QsciScintilla.SCI_DELLINERIGHT)
508 act.triggered.connect(self.esm.map) 577 act.triggered.connect(self.esm.map)
509 self.editActions.append(act) 578 self.editActions.append(act)
510 579
511 act = EricAction( 580 act = EricAction(
512 QCoreApplication.translate('ViewManager', 581 QCoreApplication.translate("ViewManager", "Move left one character"),
513 'Move left one character'), 582 QCoreApplication.translate("ViewManager", "Move left one character"),
514 QCoreApplication.translate('ViewManager', 583 QKeySequence(QCoreApplication.translate("ViewManager", "Left")),
515 'Move left one character'), 584 0,
516 QKeySequence(QCoreApplication.translate('ViewManager', 'Left')), 0, 585 self.editorActGrp,
517 self.editorActGrp, 'vm_edit_move_left_char') 586 "vm_edit_move_left_char",
587 )
518 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFT) 588 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFT)
519 if isMacPlatform(): 589 if isMacPlatform():
520 act.setAlternateShortcut(QKeySequence( 590 act.setAlternateShortcut(
521 QCoreApplication.translate('ViewManager', 'Meta+B'))) 591 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+B"))
522 act.triggered.connect(self.esm.map) 592 )
523 self.editActions.append(act) 593 act.triggered.connect(self.esm.map)
524 594 self.editActions.append(act)
525 act = EricAction( 595
526 QCoreApplication.translate('ViewManager', 596 act = EricAction(
527 'Move right one character'), 597 QCoreApplication.translate("ViewManager", "Move right one character"),
528 QCoreApplication.translate('ViewManager', 598 QCoreApplication.translate("ViewManager", "Move right one character"),
529 'Move right one character'), 599 QKeySequence(QCoreApplication.translate("ViewManager", "Right")),
530 QKeySequence(QCoreApplication.translate('ViewManager', 'Right')), 600 0,
531 0, self.editorActGrp, 'vm_edit_move_right_char') 601 self.editorActGrp,
602 "vm_edit_move_right_char",
603 )
532 if isMacPlatform(): 604 if isMacPlatform():
533 act.setAlternateShortcut(QKeySequence( 605 act.setAlternateShortcut(
534 QCoreApplication.translate('ViewManager', 'Meta+F'))) 606 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+F"))
607 )
535 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHT) 608 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHT)
536 act.triggered.connect(self.esm.map) 609 act.triggered.connect(self.esm.map)
537 self.editActions.append(act) 610 self.editActions.append(act)
538 611
539 act = EricAction( 612 act = EricAction(
540 QCoreApplication.translate('ViewManager', 'Move left one word'), 613 QCoreApplication.translate("ViewManager", "Move left one word"),
541 QCoreApplication.translate('ViewManager', 'Move left one word'), 614 QCoreApplication.translate("ViewManager", "Move left one word"),
542 0, 0, 615 0,
543 self.editorActGrp, 'vm_edit_move_left_word') 616 0,
617 self.editorActGrp,
618 "vm_edit_move_left_word",
619 )
544 if isMacPlatform(): 620 if isMacPlatform():
545 act.setShortcut(QKeySequence( 621 act.setShortcut(
546 QCoreApplication.translate('ViewManager', 'Alt+Left'))) 622 QKeySequence(QCoreApplication.translate("ViewManager", "Alt+Left"))
623 )
547 else: 624 else:
548 act.setShortcut(QKeySequence( 625 act.setShortcut(
549 QCoreApplication.translate('ViewManager', 'Ctrl+Left'))) 626 QKeySequence(QCoreApplication.translate("ViewManager", "Ctrl+Left"))
627 )
550 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFT) 628 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFT)
551 act.triggered.connect(self.esm.map) 629 act.triggered.connect(self.esm.map)
552 self.editActions.append(act) 630 self.editActions.append(act)
553 631
554 act = EricAction( 632 act = EricAction(
555 QCoreApplication.translate('ViewManager', 'Move right one word'), 633 QCoreApplication.translate("ViewManager", "Move right one word"),
556 QCoreApplication.translate('ViewManager', 'Move right one word'), 634 QCoreApplication.translate("ViewManager", "Move right one word"),
557 0, 0, 635 0,
558 self.editorActGrp, 'vm_edit_move_right_word') 636 0,
637 self.editorActGrp,
638 "vm_edit_move_right_word",
639 )
559 if not isMacPlatform(): 640 if not isMacPlatform():
560 act.setShortcut(QKeySequence( 641 act.setShortcut(
561 QCoreApplication.translate('ViewManager', 'Ctrl+Right'))) 642 QKeySequence(QCoreApplication.translate("ViewManager", "Ctrl+Right"))
643 )
562 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHT) 644 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHT)
563 act.triggered.connect(self.esm.map) 645 act.triggered.connect(self.esm.map)
564 self.editActions.append(act) 646 self.editActions.append(act)
565 647
566 act = EricAction( 648 act = EricAction(
567 QCoreApplication.translate( 649 QCoreApplication.translate(
568 'ViewManager', 650 "ViewManager", "Move to first visible character in document line"
569 'Move to first visible character in document line'), 651 ),
570 QCoreApplication.translate( 652 QCoreApplication.translate(
571 'ViewManager', 653 "ViewManager", "Move to first visible character in document line"
572 'Move to first visible character in document line'), 654 ),
573 0, 0, 655 0,
574 self.editorActGrp, 'vm_edit_move_first_visible_char') 656 0,
657 self.editorActGrp,
658 "vm_edit_move_first_visible_char",
659 )
575 if not isMacPlatform(): 660 if not isMacPlatform():
576 act.setShortcut(QKeySequence( 661 act.setShortcut(
577 QCoreApplication.translate('ViewManager', 'Home'))) 662 QKeySequence(QCoreApplication.translate("ViewManager", "Home"))
663 )
578 self.esm.setMapping(act, QsciScintilla.SCI_VCHOME) 664 self.esm.setMapping(act, QsciScintilla.SCI_VCHOME)
579 act.triggered.connect(self.esm.map) 665 act.triggered.connect(self.esm.map)
580 self.editActions.append(act) 666 self.editActions.append(act)
581 667
582 act = EricAction( 668 act = EricAction(
583 QCoreApplication.translate( 669 QCoreApplication.translate("ViewManager", "Move to end of document line"),
584 'ViewManager', 'Move to end of document line'), 670 QCoreApplication.translate("ViewManager", "Move to end of document line"),
585 QCoreApplication.translate( 671 0,
586 'ViewManager', 'Move to end of document line'), 672 0,
587 0, 0, 673 self.editorActGrp,
588 self.editorActGrp, 'vm_edit_move_end_line') 674 "vm_edit_move_end_line",
675 )
589 if isMacPlatform(): 676 if isMacPlatform():
590 act.setShortcut(QKeySequence( 677 act.setShortcut(
591 QCoreApplication.translate('ViewManager', 'Meta+E'))) 678 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+E"))
679 )
592 else: 680 else:
593 act.setShortcut(QKeySequence( 681 act.setShortcut(
594 QCoreApplication.translate('ViewManager', 'End'))) 682 QKeySequence(QCoreApplication.translate("ViewManager", "End"))
683 )
595 self.esm.setMapping(act, QsciScintilla.SCI_LINEEND) 684 self.esm.setMapping(act, QsciScintilla.SCI_LINEEND)
596 act.triggered.connect(self.esm.map) 685 act.triggered.connect(self.esm.map)
597 self.editActions.append(act) 686 self.editActions.append(act)
598 687
599 act = EricAction( 688 act = EricAction(
600 QCoreApplication.translate('ViewManager', 'Move up one line'), 689 QCoreApplication.translate("ViewManager", "Move up one line"),
601 QCoreApplication.translate('ViewManager', 'Move up one line'), 690 QCoreApplication.translate("ViewManager", "Move up one line"),
602 QKeySequence(QCoreApplication.translate('ViewManager', 'Up')), 0, 691 QKeySequence(QCoreApplication.translate("ViewManager", "Up")),
603 self.editorActGrp, 'vm_edit_move_up_line') 692 0,
693 self.editorActGrp,
694 "vm_edit_move_up_line",
695 )
604 if isMacPlatform(): 696 if isMacPlatform():
605 act.setAlternateShortcut(QKeySequence( 697 act.setAlternateShortcut(
606 QCoreApplication.translate('ViewManager', 'Meta+P'))) 698 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+P"))
699 )
607 self.esm.setMapping(act, QsciScintilla.SCI_LINEUP) 700 self.esm.setMapping(act, QsciScintilla.SCI_LINEUP)
608 act.triggered.connect(self.esm.map) 701 act.triggered.connect(self.esm.map)
609 self.editActions.append(act) 702 self.editActions.append(act)
610 703
611 act = EricAction( 704 act = EricAction(
612 QCoreApplication.translate('ViewManager', 'Move down one line'), 705 QCoreApplication.translate("ViewManager", "Move down one line"),
613 QCoreApplication.translate('ViewManager', 'Move down one line'), 706 QCoreApplication.translate("ViewManager", "Move down one line"),
614 QKeySequence(QCoreApplication.translate('ViewManager', 'Down')), 0, 707 QKeySequence(QCoreApplication.translate("ViewManager", "Down")),
615 self.editorActGrp, 'vm_edit_move_down_line') 708 0,
709 self.editorActGrp,
710 "vm_edit_move_down_line",
711 )
616 if isMacPlatform(): 712 if isMacPlatform():
617 act.setAlternateShortcut(QKeySequence( 713 act.setAlternateShortcut(
618 QCoreApplication.translate('ViewManager', 'Meta+N'))) 714 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+N"))
715 )
619 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWN) 716 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWN)
620 act.triggered.connect(self.esm.map) 717 act.triggered.connect(self.esm.map)
621 self.editActions.append(act) 718 self.editActions.append(act)
622 719
623 act = EricAction( 720 act = EricAction(
624 self.tr('Move forward one history entry'), 721 self.tr("Move forward one history entry"),
625 self.tr('Move forward one history entry'), 722 self.tr("Move forward one history entry"),
626 QKeySequence(QCoreApplication.translate('ViewManager', 723 QKeySequence(QCoreApplication.translate("ViewManager", "Ctrl+Down")),
627 'Ctrl+Down')), 724 0,
628 0, self.editorActGrp, 'vm_edit_scroll_down_line') 725 self.editorActGrp,
726 "vm_edit_scroll_down_line",
727 )
629 self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLDOWN) 728 self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLDOWN)
630 act.triggered.connect(self.esm.map) 729 act.triggered.connect(self.esm.map)
631 self.editActions.append(act) 730 self.editActions.append(act)
632 731
633 act = EricAction( 732 act = EricAction(
634 self.tr('Move back one history entry'), 733 self.tr("Move back one history entry"),
635 self.tr('Move back one history entry'), 734 self.tr("Move back one history entry"),
636 QKeySequence(QCoreApplication.translate('ViewManager', 'Ctrl+Up')), 735 QKeySequence(QCoreApplication.translate("ViewManager", "Ctrl+Up")),
637 0, self.editorActGrp, 'vm_edit_scroll_up_line') 736 0,
737 self.editorActGrp,
738 "vm_edit_scroll_up_line",
739 )
638 self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLUP) 740 self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLUP)
639 act.triggered.connect(self.esm.map) 741 act.triggered.connect(self.esm.map)
640 self.editActions.append(act) 742 self.editActions.append(act)
641 743
642 act = EricAction( 744 act = EricAction(
643 QCoreApplication.translate('ViewManager', 'Move up one page'), 745 QCoreApplication.translate("ViewManager", "Move up one page"),
644 QCoreApplication.translate('ViewManager', 'Move up one page'), 746 QCoreApplication.translate("ViewManager", "Move up one page"),
645 QKeySequence(QCoreApplication.translate('ViewManager', 'PgUp')), 0, 747 QKeySequence(QCoreApplication.translate("ViewManager", "PgUp")),
646 self.editorActGrp, 'vm_edit_move_up_page') 748 0,
749 self.editorActGrp,
750 "vm_edit_move_up_page",
751 )
647 self.esm.setMapping(act, QsciScintilla.SCI_PAGEUP) 752 self.esm.setMapping(act, QsciScintilla.SCI_PAGEUP)
648 act.triggered.connect(self.esm.map) 753 act.triggered.connect(self.esm.map)
649 self.editActions.append(act) 754 self.editActions.append(act)
650 755
651 act = EricAction( 756 act = EricAction(
652 QCoreApplication.translate('ViewManager', 'Move down one page'), 757 QCoreApplication.translate("ViewManager", "Move down one page"),
653 QCoreApplication.translate('ViewManager', 'Move down one page'), 758 QCoreApplication.translate("ViewManager", "Move down one page"),
654 QKeySequence(QCoreApplication.translate('ViewManager', 'PgDown')), 759 QKeySequence(QCoreApplication.translate("ViewManager", "PgDown")),
655 0, self.editorActGrp, 'vm_edit_move_down_page') 760 0,
761 self.editorActGrp,
762 "vm_edit_move_down_page",
763 )
656 if isMacPlatform(): 764 if isMacPlatform():
657 act.setAlternateShortcut(QKeySequence( 765 act.setAlternateShortcut(
658 QCoreApplication.translate('ViewManager', 'Meta+V'))) 766 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+V"))
767 )
659 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWN) 768 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWN)
660 act.triggered.connect(self.esm.map) 769 act.triggered.connect(self.esm.map)
661 self.editActions.append(act) 770 self.editActions.append(act)
662 771
663 act = EricAction( 772 act = EricAction(
664 QCoreApplication.translate('ViewManager', 'Escape'), 773 QCoreApplication.translate("ViewManager", "Escape"),
665 QCoreApplication.translate('ViewManager', 'Escape'), 774 QCoreApplication.translate("ViewManager", "Escape"),
666 QKeySequence(QCoreApplication.translate('ViewManager', 'Esc')), 0, 775 QKeySequence(QCoreApplication.translate("ViewManager", "Esc")),
667 self.editorActGrp, 'vm_edit_escape') 776 0,
777 self.editorActGrp,
778 "vm_edit_escape",
779 )
668 self.esm.setMapping(act, QsciScintilla.SCI_CANCEL) 780 self.esm.setMapping(act, QsciScintilla.SCI_CANCEL)
669 act.triggered.connect(self.esm.map) 781 act.triggered.connect(self.esm.map)
670 self.editActions.append(act) 782 self.editActions.append(act)
671 783
672 act = EricAction( 784 act = EricAction(
673 QCoreApplication.translate( 785 QCoreApplication.translate(
674 'ViewManager', 'Extend selection left one character'), 786 "ViewManager", "Extend selection left one character"
675 QCoreApplication.translate( 787 ),
676 'ViewManager', 'Extend selection left one character'), 788 QCoreApplication.translate(
677 QKeySequence(QCoreApplication.translate('ViewManager', 789 "ViewManager", "Extend selection left one character"
678 'Shift+Left')), 790 ),
679 0, self.editorActGrp, 'vm_edit_extend_selection_left_char') 791 QKeySequence(QCoreApplication.translate("ViewManager", "Shift+Left")),
792 0,
793 self.editorActGrp,
794 "vm_edit_extend_selection_left_char",
795 )
680 if isMacPlatform(): 796 if isMacPlatform():
681 act.setAlternateShortcut(QKeySequence( 797 act.setAlternateShortcut(
682 QCoreApplication.translate('ViewManager', 'Meta+Shift+B'))) 798 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+Shift+B"))
799 )
683 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFTEXTEND) 800 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFTEXTEND)
684 act.triggered.connect(self.esm.map) 801 act.triggered.connect(self.esm.map)
685 self.editActions.append(act) 802 self.editActions.append(act)
686 803
687 act = EricAction( 804 act = EricAction(
688 QCoreApplication.translate( 805 QCoreApplication.translate(
689 'ViewManager', 'Extend selection right one character'), 806 "ViewManager", "Extend selection right one character"
690 QCoreApplication.translate( 807 ),
691 'ViewManager', 'Extend selection right one character'), 808 QCoreApplication.translate(
692 QKeySequence(QCoreApplication.translate('ViewManager', 809 "ViewManager", "Extend selection right one character"
693 'Shift+Right')), 810 ),
694 0, self.editorActGrp, 'vm_edit_extend_selection_right_char') 811 QKeySequence(QCoreApplication.translate("ViewManager", "Shift+Right")),
812 0,
813 self.editorActGrp,
814 "vm_edit_extend_selection_right_char",
815 )
695 if isMacPlatform(): 816 if isMacPlatform():
696 act.setAlternateShortcut(QKeySequence( 817 act.setAlternateShortcut(
697 QCoreApplication.translate('ViewManager', 'Meta+Shift+F'))) 818 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+Shift+F"))
819 )
698 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHTEXTEND) 820 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHTEXTEND)
699 act.triggered.connect(self.esm.map) 821 act.triggered.connect(self.esm.map)
700 self.editActions.append(act) 822 self.editActions.append(act)
701 823
702 act = EricAction( 824 act = EricAction(
703 QCoreApplication.translate( 825 QCoreApplication.translate("ViewManager", "Extend selection left one word"),
704 'ViewManager', 'Extend selection left one word'), 826 QCoreApplication.translate("ViewManager", "Extend selection left one word"),
705 QCoreApplication.translate( 827 0,
706 'ViewManager', 'Extend selection left one word'), 828 0,
707 0, 0, 829 self.editorActGrp,
708 self.editorActGrp, 'vm_edit_extend_selection_left_word') 830 "vm_edit_extend_selection_left_word",
831 )
709 if isMacPlatform(): 832 if isMacPlatform():
710 act.setShortcut(QKeySequence( 833 act.setShortcut(
711 QCoreApplication.translate('ViewManager', 'Alt+Shift+Left'))) 834 QKeySequence(
835 QCoreApplication.translate("ViewManager", "Alt+Shift+Left")
836 )
837 )
712 else: 838 else:
713 act.setShortcut(QKeySequence( 839 act.setShortcut(
714 QCoreApplication.translate('ViewManager', 'Ctrl+Shift+Left'))) 840 QKeySequence(
841 QCoreApplication.translate("ViewManager", "Ctrl+Shift+Left")
842 )
843 )
715 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTEXTEND) 844 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTEXTEND)
716 act.triggered.connect(self.esm.map) 845 act.triggered.connect(self.esm.map)
717 self.editActions.append(act) 846 self.editActions.append(act)
718 847
719 act = EricAction( 848 act = EricAction(
720 QCoreApplication.translate( 849 QCoreApplication.translate(
721 'ViewManager', 'Extend selection right one word'), 850 "ViewManager", "Extend selection right one word"
722 QCoreApplication.translate( 851 ),
723 'ViewManager', 'Extend selection right one word'), 852 QCoreApplication.translate(
724 0, 0, 853 "ViewManager", "Extend selection right one word"
725 self.editorActGrp, 'vm_edit_extend_selection_right_word') 854 ),
855 0,
856 0,
857 self.editorActGrp,
858 "vm_edit_extend_selection_right_word",
859 )
726 if isMacPlatform(): 860 if isMacPlatform():
727 act.setShortcut(QKeySequence( 861 act.setShortcut(
728 QCoreApplication.translate('ViewManager', 'Alt+Shift+Right'))) 862 QKeySequence(
863 QCoreApplication.translate("ViewManager", "Alt+Shift+Right")
864 )
865 )
729 else: 866 else:
730 act.setShortcut(QKeySequence( 867 act.setShortcut(
731 QCoreApplication.translate('ViewManager', 'Ctrl+Shift+Right'))) 868 QKeySequence(
869 QCoreApplication.translate("ViewManager", "Ctrl+Shift+Right")
870 )
871 )
732 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHTEXTEND) 872 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHTEXTEND)
733 act.triggered.connect(self.esm.map) 873 act.triggered.connect(self.esm.map)
734 self.editActions.append(act) 874 self.editActions.append(act)
735 875
736 act = EricAction( 876 act = EricAction(
737 QCoreApplication.translate( 877 QCoreApplication.translate(
738 'ViewManager', 878 "ViewManager",
739 'Extend selection to first visible character in document' 879 "Extend selection to first visible character in document" " line",
740 ' line'), 880 ),
741 QCoreApplication.translate( 881 QCoreApplication.translate(
742 'ViewManager', 882 "ViewManager",
743 'Extend selection to first visible character in document' 883 "Extend selection to first visible character in document" " line",
744 ' line'), 884 ),
745 0, 0, 885 0,
746 self.editorActGrp, 'vm_edit_extend_selection_first_visible_char') 886 0,
887 self.editorActGrp,
888 "vm_edit_extend_selection_first_visible_char",
889 )
747 if not isMacPlatform(): 890 if not isMacPlatform():
748 act.setShortcut(QKeySequence( 891 act.setShortcut(
749 QCoreApplication.translate('ViewManager', 'Shift+Home'))) 892 QKeySequence(QCoreApplication.translate("ViewManager", "Shift+Home"))
893 )
750 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEEXTEND) 894 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEEXTEND)
751 act.triggered.connect(self.esm.map) 895 act.triggered.connect(self.esm.map)
752 self.editActions.append(act) 896 self.editActions.append(act)
753 897
754 act = EricAction( 898 act = EricAction(
755 QCoreApplication.translate( 899 QCoreApplication.translate(
756 'ViewManager', 'Extend selection to end of document line'), 900 "ViewManager", "Extend selection to end of document line"
757 QCoreApplication.translate( 901 ),
758 'ViewManager', 'Extend selection to end of document line'), 902 QCoreApplication.translate(
759 0, 0, 903 "ViewManager", "Extend selection to end of document line"
760 self.editorActGrp, 'vm_edit_extend_selection_end_line') 904 ),
905 0,
906 0,
907 self.editorActGrp,
908 "vm_edit_extend_selection_end_line",
909 )
761 if isMacPlatform(): 910 if isMacPlatform():
762 act.setShortcut(QKeySequence( 911 act.setShortcut(
763 QCoreApplication.translate('ViewManager', 'Meta+Shift+E'))) 912 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+Shift+E"))
913 )
764 else: 914 else:
765 act.setShortcut(QKeySequence( 915 act.setShortcut(
766 QCoreApplication.translate('ViewManager', 'Shift+End'))) 916 QKeySequence(QCoreApplication.translate("ViewManager", "Shift+End"))
917 )
767 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDEXTEND) 918 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDEXTEND)
768 act.triggered.connect(self.esm.map) 919 act.triggered.connect(self.esm.map)
769 self.editActions.append(act) 920 self.editActions.append(act)
770 921
771 def __createSearchActions(self): 922 def __createSearchActions(self):
772 """ 923 """
773 Private method defining the user interface actions for the search 924 Private method defining the user interface actions for the search
774 commands. 925 commands.
775 """ 926 """
776 self.searchActGrp = createActionGroup(self) 927 self.searchActGrp = createActionGroup(self)
777 928
778 self.searchAct = EricAction( 929 self.searchAct = EricAction(
779 QCoreApplication.translate('ViewManager', 'Search'), 930 QCoreApplication.translate("ViewManager", "Search"),
780 UI.PixmapCache.getIcon("find"), 931 UI.PixmapCache.getIcon("find"),
781 QCoreApplication.translate('ViewManager', '&Search...'), 932 QCoreApplication.translate("ViewManager", "&Search..."),
782 QKeySequence(QCoreApplication.translate( 933 QKeySequence(
783 'ViewManager', "Ctrl+F", "Search|Search")), 934 QCoreApplication.translate("ViewManager", "Ctrl+F", "Search|Search")
784 0, 935 ),
785 self, 'vm_search') 936 0,
786 self.searchAct.setStatusTip(QCoreApplication.translate( 937 self,
787 'ViewManager', 'Search for a text')) 938 "vm_search",
788 self.searchAct.setWhatsThis(QCoreApplication.translate( 939 )
789 'ViewManager', 940 self.searchAct.setStatusTip(
790 """<b>Search</b>""" 941 QCoreApplication.translate("ViewManager", "Search for a text")
791 """<p>Search for some text in the shell window. A""" 942 )
792 """ dialog is shown to enter the search text and options""" 943 self.searchAct.setWhatsThis(
793 """ for the search.</p>""" 944 QCoreApplication.translate(
794 )) 945 "ViewManager",
946 """<b>Search</b>"""
947 """<p>Search for some text in the shell window. A"""
948 """ dialog is shown to enter the search text and options"""
949 """ for the search.</p>""",
950 )
951 )
795 self.searchAct.triggered.connect(self.__showFind) 952 self.searchAct.triggered.connect(self.__showFind)
796 self.searchActions.append(self.searchAct) 953 self.searchActions.append(self.searchAct)
797 954
798 self.searchNextAct = EricAction( 955 self.searchNextAct = EricAction(
799 QCoreApplication.translate( 956 QCoreApplication.translate("ViewManager", "Search next"),
800 'ViewManager', 'Search next'),
801 UI.PixmapCache.getIcon("findNext"), 957 UI.PixmapCache.getIcon("findNext"),
802 QCoreApplication.translate('ViewManager', 'Search &next'), 958 QCoreApplication.translate("ViewManager", "Search &next"),
803 QKeySequence(QCoreApplication.translate( 959 QKeySequence(
804 'ViewManager', "F3", "Search|Search next")), 960 QCoreApplication.translate("ViewManager", "F3", "Search|Search next")
805 0, 961 ),
806 self, 'vm_search_next') 962 0,
807 self.searchNextAct.setStatusTip(QCoreApplication.translate( 963 self,
808 'ViewManager', 'Search next occurrence of text')) 964 "vm_search_next",
809 self.searchNextAct.setWhatsThis(QCoreApplication.translate( 965 )
810 'ViewManager', 966 self.searchNextAct.setStatusTip(
811 """<b>Search next</b>""" 967 QCoreApplication.translate("ViewManager", "Search next occurrence of text")
812 """<p>Search the next occurrence of some text in the shell""" 968 )
813 """ window. The previously entered search text and options are""" 969 self.searchNextAct.setWhatsThis(
814 """ reused.</p>""" 970 QCoreApplication.translate(
815 )) 971 "ViewManager",
972 """<b>Search next</b>"""
973 """<p>Search the next occurrence of some text in the shell"""
974 """ window. The previously entered search text and options are"""
975 """ reused.</p>""",
976 )
977 )
816 self.searchNextAct.triggered.connect( 978 self.searchNextAct.triggered.connect(
817 self.__searchWidget.on_findNextButton_clicked) 979 self.__searchWidget.on_findNextButton_clicked
980 )
818 self.searchActions.append(self.searchNextAct) 981 self.searchActions.append(self.searchNextAct)
819 982
820 self.searchPrevAct = EricAction( 983 self.searchPrevAct = EricAction(
821 QCoreApplication.translate('ViewManager', 'Search previous'), 984 QCoreApplication.translate("ViewManager", "Search previous"),
822 UI.PixmapCache.getIcon("findPrev"), 985 UI.PixmapCache.getIcon("findPrev"),
823 QCoreApplication.translate('ViewManager', 'Search &previous'), 986 QCoreApplication.translate("ViewManager", "Search &previous"),
824 QKeySequence(QCoreApplication.translate( 987 QKeySequence(
825 'ViewManager', "Shift+F3", "Search|Search previous")), 988 QCoreApplication.translate(
826 0, 989 "ViewManager", "Shift+F3", "Search|Search previous"
827 self, 'vm_search_previous') 990 )
828 self.searchPrevAct.setStatusTip(QCoreApplication.translate( 991 ),
829 'ViewManager', 'Search previous occurrence of text')) 992 0,
830 self.searchPrevAct.setWhatsThis(QCoreApplication.translate( 993 self,
831 'ViewManager', 994 "vm_search_previous",
832 """<b>Search previous</b>""" 995 )
833 """<p>Search the previous occurrence of some text in the shell""" 996 self.searchPrevAct.setStatusTip(
834 """ window. The previously entered search text and options are""" 997 QCoreApplication.translate(
835 """ reused.</p>""" 998 "ViewManager", "Search previous occurrence of text"
836 )) 999 )
1000 )
1001 self.searchPrevAct.setWhatsThis(
1002 QCoreApplication.translate(
1003 "ViewManager",
1004 """<b>Search previous</b>"""
1005 """<p>Search the previous occurrence of some text in the shell"""
1006 """ window. The previously entered search text and options are"""
1007 """ reused.</p>""",
1008 )
1009 )
837 self.searchPrevAct.triggered.connect( 1010 self.searchPrevAct.triggered.connect(
838 self.__searchWidget.on_findPrevButton_clicked) 1011 self.__searchWidget.on_findPrevButton_clicked
1012 )
839 self.searchActions.append(self.searchPrevAct) 1013 self.searchActions.append(self.searchPrevAct)
840 1014
841 def __createViewActions(self): 1015 def __createViewActions(self):
842 """ 1016 """
843 Private method defining the user interface actions for the view 1017 Private method defining the user interface actions for the view
844 commands. 1018 commands.
845 """ 1019 """
846 self.viewActGrp = createActionGroup(self) 1020 self.viewActGrp = createActionGroup(self)
847 1021
848 self.zoomInAct = EricAction( 1022 self.zoomInAct = EricAction(
849 QCoreApplication.translate('ViewManager', 'Zoom in'), 1023 QCoreApplication.translate("ViewManager", "Zoom in"),
850 UI.PixmapCache.getIcon("zoomIn"), 1024 UI.PixmapCache.getIcon("zoomIn"),
851 QCoreApplication.translate('ViewManager', 'Zoom &in'), 1025 QCoreApplication.translate("ViewManager", "Zoom &in"),
852 QKeySequence(QCoreApplication.translate( 1026 QKeySequence(
853 'ViewManager', "Ctrl++", "View|Zoom in")), 1027 QCoreApplication.translate("ViewManager", "Ctrl++", "View|Zoom in")
854 QKeySequence(QCoreApplication.translate( 1028 ),
855 'ViewManager', "Zoom In", "View|Zoom in")), 1029 QKeySequence(
856 self.viewActGrp, 'vm_view_zoom_in') 1030 QCoreApplication.translate("ViewManager", "Zoom In", "View|Zoom in")
857 self.zoomInAct.setStatusTip(QCoreApplication.translate( 1031 ),
858 'ViewManager', 'Zoom in on the text')) 1032 self.viewActGrp,
859 self.zoomInAct.setWhatsThis(QCoreApplication.translate( 1033 "vm_view_zoom_in",
860 'ViewManager', 1034 )
861 """<b>Zoom in</b>""" 1035 self.zoomInAct.setStatusTip(
862 """<p>Zoom in on the text. This makes the text bigger.</p>""" 1036 QCoreApplication.translate("ViewManager", "Zoom in on the text")
863 )) 1037 )
1038 self.zoomInAct.setWhatsThis(
1039 QCoreApplication.translate(
1040 "ViewManager",
1041 """<b>Zoom in</b>"""
1042 """<p>Zoom in on the text. This makes the text bigger.</p>""",
1043 )
1044 )
864 self.zoomInAct.triggered.connect(self.__zoomIn) 1045 self.zoomInAct.triggered.connect(self.__zoomIn)
865 self.viewActions.append(self.zoomInAct) 1046 self.viewActions.append(self.zoomInAct)
866 1047
867 self.zoomOutAct = EricAction( 1048 self.zoomOutAct = EricAction(
868 QCoreApplication.translate('ViewManager', 'Zoom out'), 1049 QCoreApplication.translate("ViewManager", "Zoom out"),
869 UI.PixmapCache.getIcon("zoomOut"), 1050 UI.PixmapCache.getIcon("zoomOut"),
870 QCoreApplication.translate('ViewManager', 'Zoom &out'), 1051 QCoreApplication.translate("ViewManager", "Zoom &out"),
871 QKeySequence(QCoreApplication.translate( 1052 QKeySequence(
872 'ViewManager', "Ctrl+-", "View|Zoom out")), 1053 QCoreApplication.translate("ViewManager", "Ctrl+-", "View|Zoom out")
873 QKeySequence(QCoreApplication.translate( 1054 ),
874 'ViewManager', "Zoom Out", "View|Zoom out")), 1055 QKeySequence(
875 self.viewActGrp, 'vm_view_zoom_out') 1056 QCoreApplication.translate("ViewManager", "Zoom Out", "View|Zoom out")
876 self.zoomOutAct.setStatusTip(QCoreApplication.translate( 1057 ),
877 'ViewManager', 'Zoom out on the text')) 1058 self.viewActGrp,
878 self.zoomOutAct.setWhatsThis(QCoreApplication.translate( 1059 "vm_view_zoom_out",
879 'ViewManager', 1060 )
880 """<b>Zoom out</b>""" 1061 self.zoomOutAct.setStatusTip(
881 """<p>Zoom out on the text. This makes the text smaller.</p>""" 1062 QCoreApplication.translate("ViewManager", "Zoom out on the text")
882 )) 1063 )
1064 self.zoomOutAct.setWhatsThis(
1065 QCoreApplication.translate(
1066 "ViewManager",
1067 """<b>Zoom out</b>"""
1068 """<p>Zoom out on the text. This makes the text smaller.</p>""",
1069 )
1070 )
883 self.zoomOutAct.triggered.connect(self.__zoomOut) 1071 self.zoomOutAct.triggered.connect(self.__zoomOut)
884 self.viewActions.append(self.zoomOutAct) 1072 self.viewActions.append(self.zoomOutAct)
885 1073
886 self.zoomResetAct = EricAction( 1074 self.zoomResetAct = EricAction(
887 QCoreApplication.translate('ViewManager', 'Zoom reset'), 1075 QCoreApplication.translate("ViewManager", "Zoom reset"),
888 UI.PixmapCache.getIcon("zoomReset"), 1076 UI.PixmapCache.getIcon("zoomReset"),
889 QCoreApplication.translate('ViewManager', 'Zoom &reset'), 1077 QCoreApplication.translate("ViewManager", "Zoom &reset"),
890 QKeySequence(QCoreApplication.translate( 1078 QKeySequence(
891 'ViewManager', "Ctrl+0", "View|Zoom reset")), 1079 QCoreApplication.translate("ViewManager", "Ctrl+0", "View|Zoom reset")
892 0, 1080 ),
893 self.viewActGrp, 'vm_view_zoom_reset') 1081 0,
894 self.zoomResetAct.setStatusTip(QCoreApplication.translate( 1082 self.viewActGrp,
895 'ViewManager', 'Reset the zoom of the text')) 1083 "vm_view_zoom_reset",
896 self.zoomResetAct.setWhatsThis(QCoreApplication.translate( 1084 )
897 'ViewManager', 1085 self.zoomResetAct.setStatusTip(
898 """<b>Zoom reset</b>""" 1086 QCoreApplication.translate("ViewManager", "Reset the zoom of the text")
899 """<p>Reset the zoom of the text. """ 1087 )
900 """This sets the zoom factor to 100%.</p>""" 1088 self.zoomResetAct.setWhatsThis(
901 )) 1089 QCoreApplication.translate(
1090 "ViewManager",
1091 """<b>Zoom reset</b>"""
1092 """<p>Reset the zoom of the text. """
1093 """This sets the zoom factor to 100%.</p>""",
1094 )
1095 )
902 self.zoomResetAct.triggered.connect(self.__zoomReset) 1096 self.zoomResetAct.triggered.connect(self.__zoomReset)
903 self.viewActions.append(self.zoomResetAct) 1097 self.viewActions.append(self.zoomResetAct)
904 1098
905 self.zoomToAct = EricAction( 1099 self.zoomToAct = EricAction(
906 QCoreApplication.translate('ViewManager', 'Zoom'), 1100 QCoreApplication.translate("ViewManager", "Zoom"),
907 UI.PixmapCache.getIcon("zoomTo"), 1101 UI.PixmapCache.getIcon("zoomTo"),
908 QCoreApplication.translate('ViewManager', '&Zoom'), 1102 QCoreApplication.translate("ViewManager", "&Zoom"),
909 0, 0, 1103 0,
910 self.viewActGrp, 'vm_view_zoom') 1104 0,
911 self.zoomToAct.setStatusTip(QCoreApplication.translate( 1105 self.viewActGrp,
912 'ViewManager', 'Zoom the text')) 1106 "vm_view_zoom",
913 self.zoomToAct.setWhatsThis(QCoreApplication.translate( 1107 )
914 'ViewManager', 1108 self.zoomToAct.setStatusTip(
915 """<b>Zoom</b>""" 1109 QCoreApplication.translate("ViewManager", "Zoom the text")
916 """<p>Zoom the text. This opens a dialog where the""" 1110 )
917 """ desired size can be entered.</p>""" 1111 self.zoomToAct.setWhatsThis(
918 )) 1112 QCoreApplication.translate(
1113 "ViewManager",
1114 """<b>Zoom</b>"""
1115 """<p>Zoom the text. This opens a dialog where the"""
1116 """ desired size can be entered.</p>""",
1117 )
1118 )
919 self.zoomToAct.triggered.connect(self.__zoom) 1119 self.zoomToAct.triggered.connect(self.__zoom)
920 self.viewActions.append(self.zoomToAct) 1120 self.viewActions.append(self.zoomToAct)
921 1121
922 def __createHistoryActions(self): 1122 def __createHistoryActions(self):
923 """ 1123 """
924 Private method defining the user interface actions for the history 1124 Private method defining the user interface actions for the history
925 commands. 1125 commands.
926 """ 1126 """
927 self.showHistoryAct = EricAction( 1127 self.showHistoryAct = EricAction(
928 self.tr('Show History'), 1128 self.tr("Show History"),
929 UI.PixmapCache.getIcon("history"), 1129 UI.PixmapCache.getIcon("history"),
930 self.tr('&Show History...'), 1130 self.tr("&Show History..."),
931 0, 0, 1131 0,
932 self, 'shell_show_history') 1132 0,
933 self.showHistoryAct.setStatusTip(self.tr( 1133 self,
934 "Show the shell history in a dialog")) 1134 "shell_show_history",
1135 )
1136 self.showHistoryAct.setStatusTip(self.tr("Show the shell history in a dialog"))
935 self.showHistoryAct.triggered.connect(self.__shell.showHistory) 1137 self.showHistoryAct.triggered.connect(self.__shell.showHistory)
936 1138
937 self.clearHistoryAct = EricAction( 1139 self.clearHistoryAct = EricAction(
938 self.tr('Clear History'), 1140 self.tr("Clear History"),
939 UI.PixmapCache.getIcon("historyClear"), 1141 UI.PixmapCache.getIcon("historyClear"),
940 self.tr('&Clear History...'), 1142 self.tr("&Clear History..."),
941 0, 0, 1143 0,
942 self, 'shell_clear_history') 1144 0,
943 self.clearHistoryAct.setStatusTip(self.tr( 1145 self,
944 "Clear the shell history")) 1146 "shell_clear_history",
1147 )
1148 self.clearHistoryAct.setStatusTip(self.tr("Clear the shell history"))
945 self.clearHistoryAct.triggered.connect(self.__shell.clearHistory) 1149 self.clearHistoryAct.triggered.connect(self.__shell.clearHistory)
946 1150
947 self.selectHistoryAct = EricAction( 1151 self.selectHistoryAct = EricAction(
948 self.tr('Select History Entry'), 1152 self.tr("Select History Entry"),
949 self.tr('Select History &Entry'), 1153 self.tr("Select History &Entry"),
950 0, 0, 1154 0,
951 self, 'shell_select_history') 1155 0,
952 self.selectHistoryAct.setStatusTip(self.tr( 1156 self,
953 "Select an entry of the shell history")) 1157 "shell_select_history",
1158 )
1159 self.selectHistoryAct.setStatusTip(
1160 self.tr("Select an entry of the shell history")
1161 )
954 self.selectHistoryAct.triggered.connect(self.__shell.selectHistory) 1162 self.selectHistoryAct.triggered.connect(self.__shell.selectHistory)
955 1163
956 def __createHelpActions(self): 1164 def __createHelpActions(self):
957 """ 1165 """
958 Private method to create the Help actions. 1166 Private method to create the Help actions.
959 """ 1167 """
960 self.aboutAct = EricAction( 1168 self.aboutAct = EricAction(
961 self.tr('About'), 1169 self.tr("About"), self.tr("&About"), 0, 0, self, "about_eric"
962 self.tr('&About'), 1170 )
963 0, 0, self, 'about_eric') 1171 self.aboutAct.setStatusTip(self.tr("Display information about this software"))
964 self.aboutAct.setStatusTip(self.tr( 1172 self.aboutAct.setWhatsThis(
965 'Display information about this software')) 1173 self.tr(
966 self.aboutAct.setWhatsThis(self.tr( 1174 """<b>About</b>"""
967 """<b>About</b>""" 1175 """<p>Display some information about this software.</p>"""
968 """<p>Display some information about this software.</p>""")) 1176 )
1177 )
969 self.aboutAct.triggered.connect(self.__about) 1178 self.aboutAct.triggered.connect(self.__about)
970 self.helpActions.append(self.aboutAct) 1179 self.helpActions.append(self.aboutAct)
971 1180
972 self.aboutQtAct = EricAction( 1181 self.aboutQtAct = EricAction(
973 self.tr('About Qt'), 1182 self.tr("About Qt"), self.tr("About &Qt"), 0, 0, self, "about_qt"
974 self.tr('About &Qt'), 1183 )
975 0, 0, self, 'about_qt')
976 self.aboutQtAct.setStatusTip( 1184 self.aboutQtAct.setStatusTip(
977 self.tr('Display information about the Qt toolkit')) 1185 self.tr("Display information about the Qt toolkit")
978 self.aboutQtAct.setWhatsThis(self.tr( 1186 )
979 """<b>About Qt</b>""" 1187 self.aboutQtAct.setWhatsThis(
980 """<p>Display some information about the Qt toolkit.</p>""" 1188 self.tr(
981 )) 1189 """<b>About Qt</b>"""
1190 """<p>Display some information about the Qt toolkit.</p>"""
1191 )
1192 )
982 self.aboutQtAct.triggered.connect(self.__aboutQt) 1193 self.aboutQtAct.triggered.connect(self.__aboutQt)
983 self.helpActions.append(self.aboutQtAct) 1194 self.helpActions.append(self.aboutQtAct)
984 1195
985 self.whatsThisAct = EricAction( 1196 self.whatsThisAct = EricAction(
986 self.tr('What\'s This?'), 1197 self.tr("What's This?"),
987 UI.PixmapCache.getIcon("whatsThis"), 1198 UI.PixmapCache.getIcon("whatsThis"),
988 self.tr('&What\'s This?'), 1199 self.tr("&What's This?"),
989 QKeySequence(self.tr("Shift+F1", "Help|What's This?'")), 1200 QKeySequence(self.tr("Shift+F1", "Help|What's This?'")),
990 0, self, 'help_help_whats_this') 1201 0,
991 self.whatsThisAct.setStatusTip(self.tr('Context sensitive help')) 1202 self,
992 self.whatsThisAct.setWhatsThis(self.tr( 1203 "help_help_whats_this",
993 """<b>Display context sensitive help</b>""" 1204 )
994 """<p>In What's This? mode, the mouse cursor shows an arrow""" 1205 self.whatsThisAct.setStatusTip(self.tr("Context sensitive help"))
995 """ with a question mark, and you can click on the interface""" 1206 self.whatsThisAct.setWhatsThis(
996 """ elements to get a short description of what they do and""" 1207 self.tr(
997 """ how to use them. In dialogs, this feature can be""" 1208 """<b>Display context sensitive help</b>"""
998 """ accessed using the context help button in the titlebar.""" 1209 """<p>In What's This? mode, the mouse cursor shows an arrow"""
999 """</p>""" 1210 """ with a question mark, and you can click on the interface"""
1000 )) 1211 """ elements to get a short description of what they do and"""
1212 """ how to use them. In dialogs, this feature can be"""
1213 """ accessed using the context help button in the titlebar."""
1214 """</p>"""
1215 )
1216 )
1001 self.whatsThisAct.triggered.connect(self.__whatsThis) 1217 self.whatsThisAct.triggered.connect(self.__whatsThis)
1002 self.helpActions.append(self.whatsThisAct) 1218 self.helpActions.append(self.whatsThisAct)
1003 1219
1004 def __showFind(self): 1220 def __showFind(self):
1005 """ 1221 """
1006 Private method to display the search widget. 1222 Private method to display the search widget.
1007 """ 1223 """
1008 txt = self.__shell.selectedText() 1224 txt = self.__shell.selectedText()
1009 self.showFind(txt) 1225 self.showFind(txt)
1010 1226
1011 def showFind(self, txt=""): 1227 def showFind(self, txt=""):
1012 """ 1228 """
1013 Public method to display the search widget. 1229 Public method to display the search widget.
1014 1230
1015 @param txt text to be shown in the combo 1231 @param txt text to be shown in the combo
1016 @type str 1232 @type str
1017 """ 1233 """
1018 self.__searchWidget.showFind(txt) 1234 self.__searchWidget.showFind(txt)
1019 1235
1020 def activeWindow(self): 1236 def activeWindow(self):
1021 """ 1237 """
1022 Public method to get a reference to the active shell. 1238 Public method to get a reference to the active shell.
1023 1239
1024 @return reference to the shell widget 1240 @return reference to the shell widget
1025 @rtype Shell 1241 @rtype Shell
1026 """ 1242 """
1027 return self.__shell 1243 return self.__shell
1028 1244
1029 def __readSettings(self): 1245 def __readSettings(self):
1030 """ 1246 """
1031 Private method to read the settings remembered last time. 1247 Private method to read the settings remembered last time.
1032 """ 1248 """
1033 settings = Preferences.getSettings() 1249 settings = Preferences.getSettings()
1034 pos = settings.value("ShellWindow/Position", QPoint(0, 0)) 1250 pos = settings.value("ShellWindow/Position", QPoint(0, 0))
1035 size = settings.value("ShellWindow/Size", QSize(800, 600)) 1251 size = settings.value("ShellWindow/Size", QSize(800, 600))
1036 self.resize(size) 1252 self.resize(size)
1037 self.move(pos) 1253 self.move(pos)
1038 1254
1039 def __writeSettings(self): 1255 def __writeSettings(self):
1040 """ 1256 """
1041 Private method to write the settings for reuse. 1257 Private method to write the settings for reuse.
1042 """ 1258 """
1043 settings = Preferences.getSettings() 1259 settings = Preferences.getSettings()
1044 settings.setValue("ShellWindow/Position", self.pos()) 1260 settings.setValue("ShellWindow/Position", self.pos())
1045 settings.setValue("ShellWindow/Size", self.size()) 1261 settings.setValue("ShellWindow/Size", self.size())
1046 1262
1047 def quit(self): 1263 def quit(self):
1048 """ 1264 """
1049 Public method to quit the application. 1265 Public method to quit the application.
1050 """ 1266 """
1051 ericApp().closeAllWindows() 1267 ericApp().closeAllWindows()
1052 1268
1053 def __newWindow(self): 1269 def __newWindow(self):
1054 """ 1270 """
1055 Private slot to start a new instance of eric. 1271 Private slot to start a new instance of eric.
1056 """ 1272 """
1057 program = getPythonExecutable() 1273 program = getPythonExecutable()
1058 eric7 = os.path.join(getConfig("ericDir"), "eric7_shell.py") 1274 eric7 = os.path.join(getConfig("ericDir"), "eric7_shell.py")
1059 args = [eric7] 1275 args = [eric7]
1060 QProcess.startDetached(program, args) 1276 QProcess.startDetached(program, args)
1061 1277
1062 def __virtualEnvironmentChanged(self, venvName): 1278 def __virtualEnvironmentChanged(self, venvName):
1063 """ 1279 """
1064 Private slot handling a change of the shell's virtual environment. 1280 Private slot handling a change of the shell's virtual environment.
1065 1281
1066 @param venvName name of the virtual environment of the shell 1282 @param venvName name of the virtual environment of the shell
1067 @type str 1283 @type str
1068 """ 1284 """
1069 if venvName: 1285 if venvName:
1070 self.setWindowTitle(self.tr("eric Shell [{0}]").format(venvName)) 1286 self.setWindowTitle(self.tr("eric Shell [{0}]").format(venvName))
1071 else: 1287 else:
1072 self.setWindowTitle(self.tr("eric Shell")) 1288 self.setWindowTitle(self.tr("eric Shell"))
1073 1289
1074 ################################################################## 1290 ##################################################################
1075 ## Below are the action methods for the view menu 1291 ## Below are the action methods for the view menu
1076 ################################################################## 1292 ##################################################################
1077 1293
1078 def __zoomIn(self): 1294 def __zoomIn(self):
1079 """ 1295 """
1080 Private method to handle the zoom in action. 1296 Private method to handle the zoom in action.
1081 """ 1297 """
1082 self.__shell.zoomIn() 1298 self.__shell.zoomIn()
1083 self.__sbZoom.setValue(self.__shell.getZoom()) 1299 self.__sbZoom.setValue(self.__shell.getZoom())
1084 1300
1085 def __zoomOut(self): 1301 def __zoomOut(self):
1086 """ 1302 """
1087 Private method to handle the zoom out action. 1303 Private method to handle the zoom out action.
1088 """ 1304 """
1089 self.__shell.zoomOut() 1305 self.__shell.zoomOut()
1090 self.__sbZoom.setValue(self.__shell.getZoom()) 1306 self.__sbZoom.setValue(self.__shell.getZoom())
1091 1307
1092 def __zoomReset(self): 1308 def __zoomReset(self):
1093 """ 1309 """
1094 Private method to reset the zoom factor. 1310 Private method to reset the zoom factor.
1095 """ 1311 """
1096 self.__shell.zoomTo(0) 1312 self.__shell.zoomTo(0)
1097 self.__sbZoom.setValue(self.__shell.getZoom()) 1313 self.__sbZoom.setValue(self.__shell.getZoom())
1098 1314
1099 def __zoom(self): 1315 def __zoom(self):
1100 """ 1316 """
1101 Private method to handle the zoom action. 1317 Private method to handle the zoom action.
1102 """ 1318 """
1103 from QScintilla.ZoomDialog import ZoomDialog 1319 from QScintilla.ZoomDialog import ZoomDialog
1320
1104 dlg = ZoomDialog(self.__shell.getZoom(), self, None, True) 1321 dlg = ZoomDialog(self.__shell.getZoom(), self, None, True)
1105 if dlg.exec() == QDialog.DialogCode.Accepted: 1322 if dlg.exec() == QDialog.DialogCode.Accepted:
1106 value = dlg.getZoomSize() 1323 value = dlg.getZoomSize()
1107 self.__zoomTo(value) 1324 self.__zoomTo(value)
1108 1325
1109 def __zoomTo(self, value): 1326 def __zoomTo(self, value):
1110 """ 1327 """
1111 Private slot to zoom to a given value. 1328 Private slot to zoom to a given value.
1112 1329
1113 @param value zoom value to be set 1330 @param value zoom value to be set
1114 @type int 1331 @type int
1115 """ 1332 """
1116 self.__shell.zoomTo(value) 1333 self.__shell.zoomTo(value)
1117 self.__sbZoom.setValue(self.__shell.getZoom()) 1334 self.__sbZoom.setValue(self.__shell.getZoom())
1118 1335
1119 def __zoomValueChanged(self, value): 1336 def __zoomValueChanged(self, value):
1120 """ 1337 """
1121 Private slot to handle changes of the zoom value. 1338 Private slot to handle changes of the zoom value.
1122 1339
1123 @param value new zoom value 1340 @param value new zoom value
1124 @type int 1341 @type int
1125 """ 1342 """
1126 self.__sbZoom.setValue(value) 1343 self.__sbZoom.setValue(value)
1127 1344
1128 ################################################################## 1345 ##################################################################
1129 ## Below are the action methods for the help menu 1346 ## Below are the action methods for the help menu
1130 ################################################################## 1347 ##################################################################
1131 1348
1132 def __about(self): 1349 def __about(self):
1133 """ 1350 """
1134 Private slot to show a little About message. 1351 Private slot to show a little About message.
1135 """ 1352 """
1136 EricMessageBox.about( 1353 EricMessageBox.about(
1137 self, 1354 self,
1138 self.tr("About eric Shell Window"), 1355 self.tr("About eric Shell Window"),
1139 self.tr( 1356 self.tr(
1140 "The eric Shell is a standalone shell window." 1357 "The eric Shell is a standalone shell window."
1141 " It uses the same backend as the debugger of" 1358 " It uses the same backend as the debugger of"
1142 " the full IDE, but is executed independently.")) 1359 " the full IDE, but is executed independently."
1143 1360 ),
1361 )
1362
1144 def __aboutQt(self): 1363 def __aboutQt(self):
1145 """ 1364 """
1146 Private slot to handle the About Qt dialog. 1365 Private slot to handle the About Qt dialog.
1147 """ 1366 """
1148 EricMessageBox.aboutQt(self, "eric Shell Window") 1367 EricMessageBox.aboutQt(self, "eric Shell Window")
1149 1368
1150 def __whatsThis(self): 1369 def __whatsThis(self):
1151 """ 1370 """
1152 Private slot called in to enter Whats This mode. 1371 Private slot called in to enter Whats This mode.
1153 """ 1372 """
1154 QWhatsThis.enterWhatsThisMode() 1373 QWhatsThis.enterWhatsThisMode()
1155 1374
1156 ################################################################## 1375 ##################################################################
1157 ## Below are the main menu handling methods 1376 ## Below are the main menu handling methods
1158 ################################################################## 1377 ##################################################################
1159 1378
1160 def __createMenus(self): 1379 def __createMenus(self):
1161 """ 1380 """
1162 Private method to create the menus of the menu bar. 1381 Private method to create the menus of the menu bar.
1163 """ 1382 """
1164 self.__fileMenu = self.menuBar().addMenu(self.tr("&File")) 1383 self.__fileMenu = self.menuBar().addMenu(self.tr("&File"))
1169 self.__fileMenu.addAction(self.clearRestartAct) 1388 self.__fileMenu.addAction(self.clearRestartAct)
1170 self.__fileMenu.addSeparator() 1389 self.__fileMenu.addSeparator()
1171 self.__fileMenu.addAction(self.saveContentsAct) 1390 self.__fileMenu.addAction(self.saveContentsAct)
1172 self.__fileMenu.addSeparator() 1391 self.__fileMenu.addSeparator()
1173 self.__fileMenu.addAction(self.exitAct) 1392 self.__fileMenu.addAction(self.exitAct)
1174 1393
1175 self.__editMenu = self.menuBar().addMenu(self.tr("&Edit")) 1394 self.__editMenu = self.menuBar().addMenu(self.tr("&Edit"))
1176 self.__editMenu.setTearOffEnabled(True) 1395 self.__editMenu.setTearOffEnabled(True)
1177 self.__editMenu.addAction(self.cutAct) 1396 self.__editMenu.addAction(self.cutAct)
1178 self.__editMenu.addAction(self.copyAct) 1397 self.__editMenu.addAction(self.copyAct)
1179 self.__editMenu.addAction(self.pasteAct) 1398 self.__editMenu.addAction(self.pasteAct)
1180 self.__editMenu.addAction(self.clearAct) 1399 self.__editMenu.addAction(self.clearAct)
1181 self.__editMenu.addSeparator() 1400 self.__editMenu.addSeparator()
1182 self.__editMenu.addAction(self.searchAct) 1401 self.__editMenu.addAction(self.searchAct)
1183 self.__editMenu.addAction(self.searchNextAct) 1402 self.__editMenu.addAction(self.searchNextAct)
1184 self.__editMenu.addAction(self.searchPrevAct) 1403 self.__editMenu.addAction(self.searchPrevAct)
1185 1404
1186 self.__viewMenu = self.menuBar().addMenu(self.tr("&View")) 1405 self.__viewMenu = self.menuBar().addMenu(self.tr("&View"))
1187 self.__viewMenu.setTearOffEnabled(True) 1406 self.__viewMenu.setTearOffEnabled(True)
1188 self.__viewMenu.addAction(self.zoomInAct) 1407 self.__viewMenu.addAction(self.zoomInAct)
1189 self.__viewMenu.addAction(self.zoomOutAct) 1408 self.__viewMenu.addAction(self.zoomOutAct)
1190 self.__viewMenu.addAction(self.zoomResetAct) 1409 self.__viewMenu.addAction(self.zoomResetAct)
1191 self.__viewMenu.addAction(self.zoomToAct) 1410 self.__viewMenu.addAction(self.zoomToAct)
1192 1411
1193 self.__historyMenu = self.menuBar().addMenu(self.tr("Histor&y")) 1412 self.__historyMenu = self.menuBar().addMenu(self.tr("Histor&y"))
1194 self.__historyMenu.setTearOffEnabled(True) 1413 self.__historyMenu.setTearOffEnabled(True)
1195 self.__historyMenu.addAction(self.selectHistoryAct) 1414 self.__historyMenu.addAction(self.selectHistoryAct)
1196 self.__historyMenu.addAction(self.showHistoryAct) 1415 self.__historyMenu.addAction(self.showHistoryAct)
1197 self.__historyMenu.addAction(self.clearHistoryAct) 1416 self.__historyMenu.addAction(self.clearHistoryAct)
1198 self.__historyMenu.setEnabled(self.__shell.isHistoryEnabled()) 1417 self.__historyMenu.setEnabled(self.__shell.isHistoryEnabled())
1199 1418
1200 self.__startMenu = self.menuBar().addMenu(self.tr("&Start")) 1419 self.__startMenu = self.menuBar().addMenu(self.tr("&Start"))
1201 self.__startMenu.aboutToShow.connect(self.__showStartMenu) 1420 self.__startMenu.aboutToShow.connect(self.__showStartMenu)
1202 self.__startMenu.triggered.connect(self.__startShell) 1421 self.__startMenu.triggered.connect(self.__startShell)
1203 1422
1204 self.menuBar().addSeparator() 1423 self.menuBar().addSeparator()
1205 1424
1206 self.__helpMenu = self.menuBar().addMenu(self.tr("&Help")) 1425 self.__helpMenu = self.menuBar().addMenu(self.tr("&Help"))
1207 self.__helpMenu.setTearOffEnabled(True) 1426 self.__helpMenu.setTearOffEnabled(True)
1208 self.__helpMenu.addAction(self.aboutAct) 1427 self.__helpMenu.addAction(self.aboutAct)
1209 self.__helpMenu.addAction(self.aboutQtAct) 1428 self.__helpMenu.addAction(self.aboutQtAct)
1210 self.__helpMenu.addSeparator() 1429 self.__helpMenu.addSeparator()
1211 self.__helpMenu.addAction(self.whatsThisAct) 1430 self.__helpMenu.addAction(self.whatsThisAct)
1212 1431
1213 def __showStartMenu(self): 1432 def __showStartMenu(self):
1214 """ 1433 """
1215 Private slot to prepare the language menu. 1434 Private slot to prepare the language menu.
1216 """ 1435 """
1217 self.__startMenu.clear() 1436 self.__startMenu.clear()
1218 for venvName in sorted(self.virtualenvManager.getVirtualenvNames()): 1437 for venvName in sorted(self.virtualenvManager.getVirtualenvNames()):
1219 self.__startMenu.addAction(venvName) 1438 self.__startMenu.addAction(venvName)
1220 1439
1221 def __startShell(self, action): 1440 def __startShell(self, action):
1222 """ 1441 """
1223 Private slot to start a shell according to the action triggered. 1442 Private slot to start a shell according to the action triggered.
1224 1443
1225 @param action menu action that was triggered (QAction) 1444 @param action menu action that was triggered (QAction)
1226 """ 1445 """
1227 venvName = action.text() 1446 venvName = action.text()
1228 self.__debugServer.startClient(False, venvName=venvName) 1447 self.__debugServer.startClient(False, venvName=venvName)
1229 self.__debugServer.remoteBanner() 1448 self.__debugServer.remoteBanner()
1230 1449
1231 ################################################################## 1450 ##################################################################
1232 ## Below are the toolbar handling methods 1451 ## Below are the toolbar handling methods
1233 ################################################################## 1452 ##################################################################
1234 1453
1235 def __createToolBars(self): 1454 def __createToolBars(self):
1236 """ 1455 """
1237 Private method to create the various toolbars. 1456 Private method to create the various toolbars.
1238 """ 1457 """
1239 filetb = self.addToolBar(self.tr("File")) 1458 filetb = self.addToolBar(self.tr("File"))
1244 filetb.addAction(self.clearRestartAct) 1463 filetb.addAction(self.clearRestartAct)
1245 filetb.addSeparator() 1464 filetb.addSeparator()
1246 filetb.addAction(self.saveContentsAct) 1465 filetb.addAction(self.saveContentsAct)
1247 filetb.addSeparator() 1466 filetb.addSeparator()
1248 filetb.addAction(self.exitAct) 1467 filetb.addAction(self.exitAct)
1249 1468
1250 edittb = self.addToolBar(self.tr("Edit")) 1469 edittb = self.addToolBar(self.tr("Edit"))
1251 edittb.setIconSize(UI.Config.ToolBarIconSize) 1470 edittb.setIconSize(UI.Config.ToolBarIconSize)
1252 edittb.addAction(self.cutAct) 1471 edittb.addAction(self.cutAct)
1253 edittb.addAction(self.copyAct) 1472 edittb.addAction(self.copyAct)
1254 edittb.addAction(self.pasteAct) 1473 edittb.addAction(self.pasteAct)
1255 edittb.addAction(self.clearAct) 1474 edittb.addAction(self.clearAct)
1256 1475
1257 findtb = self.addToolBar(self.tr("Find")) 1476 findtb = self.addToolBar(self.tr("Find"))
1258 findtb.setIconSize(UI.Config.ToolBarIconSize) 1477 findtb.setIconSize(UI.Config.ToolBarIconSize)
1259 findtb.addAction(self.searchAct) 1478 findtb.addAction(self.searchAct)
1260 findtb.addAction(self.searchNextAct) 1479 findtb.addAction(self.searchNextAct)
1261 findtb.addAction(self.searchPrevAct) 1480 findtb.addAction(self.searchPrevAct)
1262 1481
1263 viewtb = self.addToolBar(self.tr("View")) 1482 viewtb = self.addToolBar(self.tr("View"))
1264 viewtb.setIconSize(UI.Config.ToolBarIconSize) 1483 viewtb.setIconSize(UI.Config.ToolBarIconSize)
1265 viewtb.addAction(self.zoomInAct) 1484 viewtb.addAction(self.zoomInAct)
1266 viewtb.addAction(self.zoomOutAct) 1485 viewtb.addAction(self.zoomOutAct)
1267 viewtb.addAction(self.zoomResetAct) 1486 viewtb.addAction(self.zoomResetAct)
1268 viewtb.addAction(self.zoomToAct) 1487 viewtb.addAction(self.zoomToAct)
1269 1488
1270 self.__historyToolbar = self.addToolBar(self.tr("History")) 1489 self.__historyToolbar = self.addToolBar(self.tr("History"))
1271 self.__historyToolbar.setIconSize(UI.Config.ToolBarIconSize) 1490 self.__historyToolbar.setIconSize(UI.Config.ToolBarIconSize)
1272 self.__historyToolbar.addAction(self.showHistoryAct) 1491 self.__historyToolbar.addAction(self.showHistoryAct)
1273 self.__historyToolbar.addAction(self.clearHistoryAct) 1492 self.__historyToolbar.addAction(self.clearHistoryAct)
1274 self.__historyToolbar.setEnabled(self.__shell.isHistoryEnabled()) 1493 self.__historyToolbar.setEnabled(self.__shell.isHistoryEnabled())
1275 1494
1276 helptb = self.addToolBar(self.tr("Help")) 1495 helptb = self.addToolBar(self.tr("Help"))
1277 helptb.setIconSize(UI.Config.ToolBarIconSize) 1496 helptb.setIconSize(UI.Config.ToolBarIconSize)
1278 helptb.addAction(self.whatsThisAct) 1497 helptb.addAction(self.whatsThisAct)
1279 1498
1280 ################################################################## 1499 ##################################################################
1281 ## Below are the status bar handling methods 1500 ## Below are the status bar handling methods
1282 ################################################################## 1501 ##################################################################
1283 1502
1284 def __createStatusBar(self): 1503 def __createStatusBar(self):
1285 """ 1504 """
1286 Private slot to set up the status bar. 1505 Private slot to set up the status bar.
1287 """ 1506 """
1288 self.__statusBar = self.statusBar() 1507 self.__statusBar = self.statusBar()
1290 1509
1291 self.__sbZoom = EricZoomWidget( 1510 self.__sbZoom = EricZoomWidget(
1292 UI.PixmapCache.getPixmap("zoomOut"), 1511 UI.PixmapCache.getPixmap("zoomOut"),
1293 UI.PixmapCache.getPixmap("zoomIn"), 1512 UI.PixmapCache.getPixmap("zoomIn"),
1294 UI.PixmapCache.getPixmap("zoomReset"), 1513 UI.PixmapCache.getPixmap("zoomReset"),
1295 self.__statusBar) 1514 self.__statusBar,
1515 )
1296 self.__statusBar.addPermanentWidget(self.__sbZoom) 1516 self.__statusBar.addPermanentWidget(self.__sbZoom)
1297 self.__sbZoom.setWhatsThis(self.tr( 1517 self.__sbZoom.setWhatsThis(
1298 """<p>This part of the status bar allows zooming the shell.</p>""" 1518 self.tr("""<p>This part of the status bar allows zooming the shell.</p>""")
1299 )) 1519 )
1300 1520
1301 self.__sbZoom.valueChanged.connect(self.__zoomTo) 1521 self.__sbZoom.valueChanged.connect(self.__zoomTo)
1302 self.__sbZoom.setValue(0) 1522 self.__sbZoom.setValue(0)
1303 1523
1304 def __historyStyleChanged(self, historyStyle): 1524 def __historyStyleChanged(self, historyStyle):
1305 """ 1525 """
1306 Private slot to handle a change of the shell history style. 1526 Private slot to handle a change of the shell history style.
1307 1527
1308 @param historyStyle style to be used for the history 1528 @param historyStyle style to be used for the history
1309 @type ShellHistoryStyle 1529 @type ShellHistoryStyle
1310 """ 1530 """
1311 enabled = self.__shell.isHistoryEnabled() 1531 enabled = self.__shell.isHistoryEnabled()
1312 self.__historyMenu.setEnabled(enabled) 1532 self.__historyMenu.setEnabled(enabled)

eric ide

mercurial