src/eric7/ViewManager/ViewManager.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
11 import os 11 import os
12 import pathlib 12 import pathlib
13 import contextlib 13 import contextlib
14 14
15 from PyQt6.QtCore import ( 15 from PyQt6.QtCore import (
16 pyqtSignal, pyqtSlot, Qt, QSignalMapper, QTimer, QPoint, QCoreApplication 16 pyqtSignal,
17 pyqtSlot,
18 Qt,
19 QSignalMapper,
20 QTimer,
21 QPoint,
22 QCoreApplication,
17 ) 23 )
18 from PyQt6.QtGui import QKeySequence, QPixmap 24 from PyQt6.QtGui import QKeySequence, QPixmap
19 from PyQt6.QtWidgets import ( 25 from PyQt6.QtWidgets import QToolBar, QDialog, QApplication, QMenu, QWidget
20 QToolBar, QDialog, QApplication, QMenu, QWidget
21 )
22 from PyQt6.Qsci import QsciScintilla 26 from PyQt6.Qsci import QsciScintilla
23 27
24 from EricWidgets.EricApplication import ericApp 28 from EricWidgets.EricApplication import ericApp
25 from EricWidgets import EricFileDialog, EricMessageBox 29 from EricWidgets import EricFileDialog, EricMessageBox
26 30
39 43
40 44
41 class ViewManager(QWidget): 45 class ViewManager(QWidget):
42 """ 46 """
43 Base class inherited by all specific view manager classes. 47 Base class inherited by all specific view manager classes.
44 48
45 It defines the interface to be implemented by specific 49 It defines the interface to be implemented by specific
46 view manager classes and all common methods. 50 view manager classes and all common methods.
47 51
48 @signal changeCaption(str) emitted if a change of the caption is necessary 52 @signal changeCaption(str) emitted if a change of the caption is necessary
49 @signal editorChanged(str) emitted when the current editor has changed 53 @signal editorChanged(str) emitted when the current editor has changed
50 @signal editorChangedEd(Editor) emitted when the current editor has changed 54 @signal editorChangedEd(Editor) emitted when the current editor has changed
51 @signal lastEditorClosed() emitted after the last editor window was closed 55 @signal lastEditorClosed() emitted after the last editor window was closed
52 @signal editorOpened(str) emitted after an editor window was opened 56 @signal editorOpened(str) emitted after an editor window was opened
80 @signal editorLineChangedEd(Editor,int) emitted to signal a change of an 84 @signal editorLineChangedEd(Editor,int) emitted to signal a change of an
81 editor's current line (line is given one based) 85 editor's current line (line is given one based)
82 @signal editorDoubleClickedEd(Editor, position, buttons) emitted to signal 86 @signal editorDoubleClickedEd(Editor, position, buttons) emitted to signal
83 a mouse double click in an editor 87 a mouse double click in an editor
84 """ 88 """
89
85 changeCaption = pyqtSignal(str) 90 changeCaption = pyqtSignal(str)
86 editorChanged = pyqtSignal(str) 91 editorChanged = pyqtSignal(str)
87 editorChangedEd = pyqtSignal(Editor) 92 editorChangedEd = pyqtSignal(Editor)
88 lastEditorClosed = pyqtSignal() 93 lastEditorClosed = pyqtSignal()
89 editorOpened = pyqtSignal(str) 94 editorOpened = pyqtSignal(str)
105 editorLanguageChanged = pyqtSignal(Editor) 110 editorLanguageChanged = pyqtSignal(Editor)
106 editorTextChanged = pyqtSignal(Editor) 111 editorTextChanged = pyqtSignal(Editor)
107 editorLineChanged = pyqtSignal(str, int) 112 editorLineChanged = pyqtSignal(str, int)
108 editorLineChangedEd = pyqtSignal(Editor, int) 113 editorLineChangedEd = pyqtSignal(Editor, int)
109 editorDoubleClickedEd = pyqtSignal(Editor, QPoint, int) 114 editorDoubleClickedEd = pyqtSignal(Editor, QPoint, int)
110 115
111 def __init__(self): 116 def __init__(self):
112 """ 117 """
113 Constructor 118 Constructor
114 """ 119 """
115 super().__init__() 120 super().__init__()
116 121
117 # initialize the instance variables 122 # initialize the instance variables
118 self.editors = [] 123 self.editors = []
119 self.currentEditor = None 124 self.currentEditor = None
120 self.untitledCount = 0 125 self.untitledCount = 0
121 self.srHistory = { 126 self.srHistory = {"search": [], "replace": []}
122 "search": [],
123 "replace": []
124 }
125 self.editorsCheckFocusIn = True 127 self.editorsCheckFocusIn = True
126 128
127 self.recent = [] 129 self.recent = []
128 self.__loadRecent() 130 self.__loadRecent()
129 131
130 self.bookmarked = [] 132 self.bookmarked = []
131 bs = Preferences.getSettings().value("Bookmarked/Sources") 133 bs = Preferences.getSettings().value("Bookmarked/Sources")
132 if bs is not None: 134 if bs is not None:
133 self.bookmarked = bs 135 self.bookmarked = bs
134 136
135 # initialize the autosave timer 137 # initialize the autosave timer
136 self.autosaveInterval = Preferences.getEditor("AutosaveInterval") 138 self.autosaveInterval = Preferences.getEditor("AutosaveInterval")
137 self.autosaveTimer = QTimer(self) 139 self.autosaveTimer = QTimer(self)
138 self.autosaveTimer.setObjectName("AutosaveTimer") 140 self.autosaveTimer.setObjectName("AutosaveTimer")
139 self.autosaveTimer.setSingleShot(True) 141 self.autosaveTimer.setSingleShot(True)
140 self.autosaveTimer.timeout.connect(self.__autosave) 142 self.autosaveTimer.timeout.connect(self.__autosave)
141 143
142 # initialize the APIs manager 144 # initialize the APIs manager
143 from QScintilla.APIsManager import APIsManager 145 from QScintilla.APIsManager import APIsManager
146
144 self.apisManager = APIsManager(parent=self) 147 self.apisManager = APIsManager(parent=self)
145 148
146 self.__cooperationClient = None 149 self.__cooperationClient = None
147 150
148 self.__lastFocusWidget = None 151 self.__lastFocusWidget = None
149 152
150 def setReferences(self, ui, dbs): 153 def setReferences(self, ui, dbs):
151 """ 154 """
152 Public method to set some references needed later on. 155 Public method to set some references needed later on.
153 156
154 @param ui reference to the main user interface 157 @param ui reference to the main user interface
155 @param dbs reference to the debug server object 158 @param dbs reference to the debug server object
156 """ 159 """
157 from QScintilla.SearchReplaceWidget import SearchReplaceSlidingWidget 160 from QScintilla.SearchReplaceWidget import SearchReplaceSlidingWidget
158 161
159 self.ui = ui 162 self.ui = ui
160 self.dbs = dbs 163 self.dbs = dbs
161 164
162 self.__searchWidget = SearchReplaceSlidingWidget(False, self, ui) 165 self.__searchWidget = SearchReplaceSlidingWidget(False, self, ui)
163 self.__replaceWidget = SearchReplaceSlidingWidget(True, self, ui) 166 self.__replaceWidget = SearchReplaceSlidingWidget(True, self, ui)
164 167
165 self.checkActions.connect(self.__searchWidget.updateSelectionCheckBox) 168 self.checkActions.connect(self.__searchWidget.updateSelectionCheckBox)
166 self.checkActions.connect(self.__replaceWidget.updateSelectionCheckBox) 169 self.checkActions.connect(self.__replaceWidget.updateSelectionCheckBox)
167 170
168 def searchWidget(self): 171 def searchWidget(self):
169 """ 172 """
170 Public method to get a reference to the search widget. 173 Public method to get a reference to the search widget.
171 174
172 @return reference to the search widget (SearchReplaceSlidingWidget) 175 @return reference to the search widget (SearchReplaceSlidingWidget)
173 """ 176 """
174 return self.__searchWidget 177 return self.__searchWidget
175 178
176 def replaceWidget(self): 179 def replaceWidget(self):
177 """ 180 """
178 Public method to get a reference to the replace widget. 181 Public method to get a reference to the replace widget.
179 182
180 @return reference to the replace widget (SearchReplaceSlidingWidget) 183 @return reference to the replace widget (SearchReplaceSlidingWidget)
181 """ 184 """
182 return self.__replaceWidget 185 return self.__replaceWidget
183 186
184 def __loadRecent(self): 187 def __loadRecent(self):
185 """ 188 """
186 Private method to load the recently opened filenames. 189 Private method to load the recently opened filenames.
187 """ 190 """
188 self.recent = [] 191 self.recent = []
190 rs = Preferences.Prefs.rsettings.value(recentNameFiles) 193 rs = Preferences.Prefs.rsettings.value(recentNameFiles)
191 if rs is not None: 194 if rs is not None:
192 for f in Preferences.toList(rs): 195 for f in Preferences.toList(rs):
193 if pathlib.Path(f).exists(): 196 if pathlib.Path(f).exists():
194 self.recent.append(f) 197 self.recent.append(f)
195 198
196 def __saveRecent(self): 199 def __saveRecent(self):
197 """ 200 """
198 Private method to save the list of recently opened filenames. 201 Private method to save the list of recently opened filenames.
199 """ 202 """
200 Preferences.Prefs.rsettings.setValue(recentNameFiles, self.recent) 203 Preferences.Prefs.rsettings.setValue(recentNameFiles, self.recent)
201 Preferences.Prefs.rsettings.sync() 204 Preferences.Prefs.rsettings.sync()
202 205
203 def getMostRecent(self): 206 def getMostRecent(self):
204 """ 207 """
205 Public method to get the most recently opened file. 208 Public method to get the most recently opened file.
206 209
207 @return path of the most recently opened file (string) 210 @return path of the most recently opened file (string)
208 """ 211 """
209 if len(self.recent): 212 if len(self.recent):
210 return self.recent[0] 213 return self.recent[0]
211 else: 214 else:
212 return None 215 return None
213 216
214 def setSbInfo(self, sbLine, sbPos, sbWritable, sbEncoding, sbLanguage, 217 def setSbInfo(
215 sbEol, sbZoom): 218 self, sbLine, sbPos, sbWritable, sbEncoding, sbLanguage, sbEol, sbZoom
219 ):
216 """ 220 """
217 Public method to transfer statusbar info from the user interface to 221 Public method to transfer statusbar info from the user interface to
218 viewmanager. 222 viewmanager.
219 223
220 @param sbLine reference to the line number part of the statusbar 224 @param sbLine reference to the line number part of the statusbar
221 (QLabel) 225 (QLabel)
222 @param sbPos reference to the character position part of the statusbar 226 @param sbPos reference to the character position part of the statusbar
223 (QLabel) 227 (QLabel)
224 @param sbWritable reference to the writability indicator part of 228 @param sbWritable reference to the writability indicator part of
238 self.sbLang = sbLanguage 242 self.sbLang = sbLanguage
239 self.sbEol = sbEol 243 self.sbEol = sbEol
240 self.sbZoom = sbZoom 244 self.sbZoom = sbZoom
241 self.sbZoom.valueChanged.connect(self.__zoomTo) 245 self.sbZoom.valueChanged.connect(self.__zoomTo)
242 self.__setSbFile(zoom=0) 246 self.__setSbFile(zoom=0)
243 247
244 self.sbLang.clicked.connect(self.__showLanguagesMenu) 248 self.sbLang.clicked.connect(self.__showLanguagesMenu)
245 self.sbEol.clicked.connect(self.__showEolMenu) 249 self.sbEol.clicked.connect(self.__showEolMenu)
246 self.sbEnc.clicked.connect(self.__showEncodingsMenu) 250 self.sbEnc.clicked.connect(self.__showEncodingsMenu)
247 251
248 ################################################################## 252 ##################################################################
249 ## Below are menu handling methods for status bar labels 253 ## Below are menu handling methods for status bar labels
250 ################################################################## 254 ##################################################################
251 255
252 def __showLanguagesMenu(self, pos): 256 def __showLanguagesMenu(self, pos):
253 """ 257 """
254 Private slot to show the Languages menu of the current editor. 258 Private slot to show the Languages menu of the current editor.
255 259
256 @param pos position the menu should be shown at (QPoint) 260 @param pos position the menu should be shown at (QPoint)
257 """ 261 """
258 aw = self.activeWindow() 262 aw = self.activeWindow()
259 if aw is not None: 263 if aw is not None:
260 menu = aw.getMenu("Languages") 264 menu = aw.getMenu("Languages")
261 if menu is not None: 265 if menu is not None:
262 menu.exec(pos) 266 menu.exec(pos)
263 267
264 def __showEolMenu(self, pos): 268 def __showEolMenu(self, pos):
265 """ 269 """
266 Private slot to show the EOL menu of the current editor. 270 Private slot to show the EOL menu of the current editor.
267 271
268 @param pos position the menu should be shown at (QPoint) 272 @param pos position the menu should be shown at (QPoint)
269 """ 273 """
270 aw = self.activeWindow() 274 aw = self.activeWindow()
271 if aw is not None: 275 if aw is not None:
272 menu = aw.getMenu("Eol") 276 menu = aw.getMenu("Eol")
273 if menu is not None: 277 if menu is not None:
274 menu.exec(pos) 278 menu.exec(pos)
275 279
276 def __showEncodingsMenu(self, pos): 280 def __showEncodingsMenu(self, pos):
277 """ 281 """
278 Private slot to show the Encodings menu of the current editor. 282 Private slot to show the Encodings menu of the current editor.
279 283
280 @param pos position the menu should be shown at (QPoint) 284 @param pos position the menu should be shown at (QPoint)
281 """ 285 """
282 aw = self.activeWindow() 286 aw = self.activeWindow()
283 if aw is not None: 287 if aw is not None:
284 menu = aw.getMenu("Encodings") 288 menu = aw.getMenu("Encodings")
285 if menu is not None: 289 if menu is not None:
286 menu.exec(pos) 290 menu.exec(pos)
287 291
288 ########################################################################### 292 ###########################################################################
289 ## methods below need to be implemented by a subclass 293 ## methods below need to be implemented by a subclass
290 ########################################################################### 294 ###########################################################################
291 295
292 def canCascade(self): 296 def canCascade(self):
293 """ 297 """
294 Public method to signal if cascading of managed windows is available. 298 Public method to signal if cascading of managed windows is available.
295 299
296 @return flag indicating cascading of windows is available 300 @return flag indicating cascading of windows is available
297 @exception RuntimeError Not implemented 301 @exception RuntimeError Not implemented
298 """ 302 """
299 raise RuntimeError('Not implemented') 303 raise RuntimeError("Not implemented")
300 304
301 return False 305 return False
302 306
303 def canTile(self): 307 def canTile(self):
304 """ 308 """
305 Public method to signal if tiling of managed windows is available. 309 Public method to signal if tiling of managed windows is available.
306 310
307 @return flag indicating tiling of windows is available 311 @return flag indicating tiling of windows is available
308 @exception RuntimeError Not implemented 312 @exception RuntimeError Not implemented
309 """ 313 """
310 raise RuntimeError('Not implemented') 314 raise RuntimeError("Not implemented")
311 315
312 return False 316 return False
313 317
314 def tile(self): 318 def tile(self):
315 """ 319 """
316 Public method to tile the managed windows. 320 Public method to tile the managed windows.
317 321
318 @exception RuntimeError Not implemented 322 @exception RuntimeError Not implemented
319 """ 323 """
320 raise RuntimeError('Not implemented') 324 raise RuntimeError("Not implemented")
321 325
322 def cascade(self): 326 def cascade(self):
323 """ 327 """
324 Public method to cascade the managed windows. 328 Public method to cascade the managed windows.
325 329
326 @exception RuntimeError Not implemented 330 @exception RuntimeError Not implemented
327 """ 331 """
328 raise RuntimeError('Not implemented') 332 raise RuntimeError("Not implemented")
329 333
330 def activeWindow(self): 334 def activeWindow(self):
331 """ 335 """
332 Public method to return the active (i.e. current) window. 336 Public method to return the active (i.e. current) window.
333 337
334 @return reference to the active editor 338 @return reference to the active editor
335 @exception RuntimeError Not implemented 339 @exception RuntimeError Not implemented
336 """ 340 """
337 raise RuntimeError('Not implemented') 341 raise RuntimeError("Not implemented")
338 342
339 return None # __IGNORE_WARNING_M831__ 343 return None # __IGNORE_WARNING_M831__
340 344
341 def _removeAllViews(self): 345 def _removeAllViews(self):
342 """ 346 """
343 Protected method to remove all views (i.e. windows). 347 Protected method to remove all views (i.e. windows).
344 348
345 @exception RuntimeError Not implemented 349 @exception RuntimeError Not implemented
346 """ 350 """
347 raise RuntimeError('Not implemented') 351 raise RuntimeError("Not implemented")
348 352
349 def _removeView(self, win): 353 def _removeView(self, win):
350 """ 354 """
351 Protected method to remove a view (i.e. window). 355 Protected method to remove a view (i.e. window).
352 356
353 @param win editor window to be removed 357 @param win editor window to be removed
354 @exception RuntimeError Not implemented 358 @exception RuntimeError Not implemented
355 """ 359 """
356 raise RuntimeError('Not implemented') 360 raise RuntimeError("Not implemented")
357 361
358 def _addView(self, win, fn=None, noName="", addNext=False, indexes=None): 362 def _addView(self, win, fn=None, noName="", addNext=False, indexes=None):
359 """ 363 """
360 Protected method to add a view (i.e. window). 364 Protected method to add a view (i.e. window).
361 365
362 @param win editor assembly to be added 366 @param win editor assembly to be added
363 @type EditorAssembly 367 @type EditorAssembly
364 @param fn filename of this editor 368 @param fn filename of this editor
365 @type str 369 @type str
366 @param noName name to be used for an unnamed editor 370 @param noName name to be used for an unnamed editor
371 @param indexes of the editor, first the split view index, second the 375 @param indexes of the editor, first the split view index, second the
372 index within the view 376 index within the view
373 @type tuple of two int 377 @type tuple of two int
374 @exception RuntimeError Not implemented 378 @exception RuntimeError Not implemented
375 """ 379 """
376 raise RuntimeError('Not implemented') 380 raise RuntimeError("Not implemented")
377 381
378 def _showView(self, win, fn=None): 382 def _showView(self, win, fn=None):
379 """ 383 """
380 Protected method to show a view (i.e. window). 384 Protected method to show a view (i.e. window).
381 385
382 @param win editor assembly to be shown 386 @param win editor assembly to be shown
383 @param fn filename of this editor 387 @param fn filename of this editor
384 @exception RuntimeError Not implemented 388 @exception RuntimeError Not implemented
385 """ 389 """
386 raise RuntimeError('Not implemented') 390 raise RuntimeError("Not implemented")
387 391
388 def showWindowMenu(self, windowMenu): 392 def showWindowMenu(self, windowMenu):
389 """ 393 """
390 Public method to set up the viewmanager part of the Window menu. 394 Public method to set up the viewmanager part of the Window menu.
391 395
392 @param windowMenu reference to the window menu 396 @param windowMenu reference to the window menu
393 @exception RuntimeError Not implemented 397 @exception RuntimeError Not implemented
394 """ 398 """
395 raise RuntimeError('Not implemented') 399 raise RuntimeError("Not implemented")
396 400
397 def _initWindowActions(self): 401 def _initWindowActions(self):
398 """ 402 """
399 Protected method to define the user interface actions for window 403 Protected method to define the user interface actions for window
400 handling. 404 handling.
401 405
402 @exception RuntimeError Not implemented 406 @exception RuntimeError Not implemented
403 """ 407 """
404 raise RuntimeError('Not implemented') 408 raise RuntimeError("Not implemented")
405 409
406 def setEditorName(self, editor, newName): 410 def setEditorName(self, editor, newName):
407 """ 411 """
408 Public method to change the displayed name of the editor. 412 Public method to change the displayed name of the editor.
409 413
410 @param editor editor window to be changed 414 @param editor editor window to be changed
411 @param newName new name to be shown (string) 415 @param newName new name to be shown (string)
412 @exception RuntimeError Not implemented 416 @exception RuntimeError Not implemented
413 """ 417 """
414 raise RuntimeError('Not implemented') 418 raise RuntimeError("Not implemented")
415 419
416 def _modificationStatusChanged(self, m, editor): 420 def _modificationStatusChanged(self, m, editor):
417 """ 421 """
418 Protected slot to handle the modificationStatusChanged signal. 422 Protected slot to handle the modificationStatusChanged signal.
419 423
420 @param m flag indicating the modification status (boolean) 424 @param m flag indicating the modification status (boolean)
421 @param editor editor window changed 425 @param editor editor window changed
422 @exception RuntimeError Not implemented 426 @exception RuntimeError Not implemented
423 """ 427 """
424 raise RuntimeError('Not implemented') 428 raise RuntimeError("Not implemented")
425 429
426 def mainWidget(self): 430 def mainWidget(self):
427 """ 431 """
428 Public method to return a reference to the main Widget of a 432 Public method to return a reference to the main Widget of a
429 specific view manager subclass. 433 specific view manager subclass.
430 434
431 @exception RuntimeError Not implemented 435 @exception RuntimeError Not implemented
432 """ 436 """
433 raise RuntimeError('Not implemented') 437 raise RuntimeError("Not implemented")
434 438
435 ##################################################################### 439 #####################################################################
436 ## methods above need to be implemented by a subclass 440 ## methods above need to be implemented by a subclass
437 ##################################################################### 441 #####################################################################
438 442
439 def canSplit(self): 443 def canSplit(self):
440 """ 444 """
441 Public method to signal if splitting of the view is available. 445 Public method to signal if splitting of the view is available.
442 446
443 @return flag indicating splitting of the view is available. 447 @return flag indicating splitting of the view is available.
444 """ 448 """
445 return False 449 return False
446 450
447 def addSplit(self): 451 def addSplit(self):
448 """ 452 """
449 Public method used to split the current view. 453 Public method used to split the current view.
450 """ 454 """
451 pass 455 pass
452 456
453 @pyqtSlot() 457 @pyqtSlot()
454 def removeSplit(self, index=-1): 458 def removeSplit(self, index=-1):
455 """ 459 """
456 Public method used to remove the current split view or a split view 460 Public method used to remove the current split view or a split view
457 by index. 461 by index.
458 462
459 @param index index of the split to be removed (-1 means to 463 @param index index of the split to be removed (-1 means to
460 delete the current split) 464 delete the current split)
461 @type int 465 @type int
462 @return flag indicating successful deletion 466 @return flag indicating successful deletion
463 @rtype bool 467 @rtype bool
464 """ 468 """
465 return False 469 return False
466 470
467 def splitCount(self): 471 def splitCount(self):
468 """ 472 """
469 Public method to get the number of split views. 473 Public method to get the number of split views.
470 474
471 @return number of split views 475 @return number of split views
472 @rtype int 476 @rtype int
473 """ 477 """
474 return 0 478 return 0
475 479
476 def setSplitCount(self, count): 480 def setSplitCount(self, count):
477 """ 481 """
478 Public method to set the number of split views. 482 Public method to set the number of split views.
479 483
480 @param count number of split views 484 @param count number of split views
481 @type int 485 @type int
482 """ 486 """
483 pass 487 pass
484 488
485 def getSplitOrientation(self): 489 def getSplitOrientation(self):
486 """ 490 """
487 Public method to get the orientation of the split view. 491 Public method to get the orientation of the split view.
488 492
489 @return orientation of the split (Qt.Orientation.Horizontal or 493 @return orientation of the split (Qt.Orientation.Horizontal or
490 Qt.Orientation.Vertical) 494 Qt.Orientation.Vertical)
491 """ 495 """
492 return Qt.Orientation.Vertical 496 return Qt.Orientation.Vertical
493 497
494 def setSplitOrientation(self, orientation): 498 def setSplitOrientation(self, orientation):
495 """ 499 """
496 Public method used to set the orientation of the split view. 500 Public method used to set the orientation of the split view.
497 501
498 @param orientation orientation of the split 502 @param orientation orientation of the split
499 (Qt.Orientation.Horizontal or Qt.Orientation.Vertical) 503 (Qt.Orientation.Horizontal or Qt.Orientation.Vertical)
500 """ 504 """
501 pass 505 pass
502 506
503 def nextSplit(self): 507 def nextSplit(self):
504 """ 508 """
505 Public slot used to move to the next split. 509 Public slot used to move to the next split.
506 """ 510 """
507 pass 511 pass
508 512
509 def prevSplit(self): 513 def prevSplit(self):
510 """ 514 """
511 Public slot used to move to the previous split. 515 Public slot used to move to the previous split.
512 """ 516 """
513 pass 517 pass
514 518
515 def eventFilter(self, qobject, event): 519 def eventFilter(self, qobject, event):
516 """ 520 """
517 Public method called to filter an event. 521 Public method called to filter an event.
518 522
519 @param qobject object, that generated the event (QObject) 523 @param qobject object, that generated the event (QObject)
520 @param event the event, that was generated by object (QEvent) 524 @param event the event, that was generated by object (QEvent)
521 @return flag indicating if event was filtered out 525 @return flag indicating if event was filtered out
522 """ 526 """
523 return False 527 return False
524 528
525 ##################################################################### 529 #####################################################################
526 ## methods above need to be implemented by a subclass, that supports 530 ## methods above need to be implemented by a subclass, that supports
527 ## splitting of the viewmanager area. 531 ## splitting of the viewmanager area.
528 ##################################################################### 532 #####################################################################
529 533
530 def initActions(self): 534 def initActions(self):
531 """ 535 """
532 Public method defining the user interface actions. 536 Public method defining the user interface actions.
533 """ 537 """
534 # list containing all edit actions 538 # list containing all edit actions
535 self.editActions = [] 539 self.editActions = []
536 540
537 # list containing all file actions 541 # list containing all file actions
538 self.fileActions = [] 542 self.fileActions = []
539 543
540 # list containing all search actions 544 # list containing all search actions
541 self.searchActions = [] 545 self.searchActions = []
542 546
543 # list containing all view actions 547 # list containing all view actions
544 self.viewActions = [] 548 self.viewActions = []
545 549
546 # list containing all window actions 550 # list containing all window actions
547 self.windowActions = [] 551 self.windowActions = []
548 552
549 # list containing all macro actions 553 # list containing all macro actions
550 self.macroActions = [] 554 self.macroActions = []
551 555
552 # list containing all bookmark actions 556 # list containing all bookmark actions
553 self.bookmarkActions = [] 557 self.bookmarkActions = []
554 558
555 # list containing all spell checking actions 559 # list containing all spell checking actions
556 self.spellingActions = [] 560 self.spellingActions = []
557 561
558 self.__actions = { 562 self.__actions = {
559 "bookmark": self.bookmarkActions, 563 "bookmark": self.bookmarkActions,
560 "edit": self.editActions, 564 "edit": self.editActions,
561 "file": self.fileActions, 565 "file": self.fileActions,
562 "macro": self.macroActions, 566 "macro": self.macroActions,
563 "search": self.searchActions, 567 "search": self.searchActions,
564 "spelling": self.spellingActions, 568 "spelling": self.spellingActions,
565 "view": self.viewActions, 569 "view": self.viewActions,
566 "window": self.windowActions, 570 "window": self.windowActions,
567 } 571 }
568 572
569 self._initWindowActions() 573 self._initWindowActions()
570 self.__initFileActions() 574 self.__initFileActions()
571 self.__initEditActions() 575 self.__initEditActions()
572 self.__initSearchActions() 576 self.__initSearchActions()
573 self.__initViewActions() 577 self.__initViewActions()
574 self.__initMacroActions() 578 self.__initMacroActions()
575 self.__initBookmarkActions() 579 self.__initBookmarkActions()
576 self.__initSpellingActions() 580 self.__initSpellingActions()
577 581
578 ################################################################## 582 ##################################################################
579 ## Initialize the file related actions, file menu and toolbar 583 ## Initialize the file related actions, file menu and toolbar
580 ################################################################## 584 ##################################################################
581 585
582 def __initFileActions(self): 586 def __initFileActions(self):
583 """ 587 """
584 Private method defining the user interface actions for file handling. 588 Private method defining the user interface actions for file handling.
585 """ 589 """
586 self.newAct = EricAction( 590 self.newAct = EricAction(
587 QCoreApplication.translate('ViewManager', 'New'), 591 QCoreApplication.translate("ViewManager", "New"),
588 UI.PixmapCache.getIcon("new"), 592 UI.PixmapCache.getIcon("new"),
589 QCoreApplication.translate('ViewManager', '&New'), 593 QCoreApplication.translate("ViewManager", "&New"),
590 QKeySequence( 594 QKeySequence(
591 QCoreApplication.translate('ViewManager', "Ctrl+N", 595 QCoreApplication.translate("ViewManager", "Ctrl+N", "File|New")
592 "File|New")), 596 ),
593 0, self, 'vm_file_new') 597 0,
598 self,
599 "vm_file_new",
600 )
594 self.newAct.setStatusTip( 601 self.newAct.setStatusTip(
595 QCoreApplication.translate( 602 QCoreApplication.translate("ViewManager", "Open an empty editor window")
596 'ViewManager', 'Open an empty editor window')) 603 )
597 self.newAct.setWhatsThis(QCoreApplication.translate( 604 self.newAct.setWhatsThis(
598 'ViewManager', 605 QCoreApplication.translate(
599 """<b>New</b>""" 606 "ViewManager",
600 """<p>An empty editor window will be created.</p>""" 607 """<b>New</b>""" """<p>An empty editor window will be created.</p>""",
601 )) 608 )
609 )
602 self.newAct.triggered.connect(self.newEditor) 610 self.newAct.triggered.connect(self.newEditor)
603 self.fileActions.append(self.newAct) 611 self.fileActions.append(self.newAct)
604 612
605 self.openAct = EricAction( 613 self.openAct = EricAction(
606 QCoreApplication.translate('ViewManager', 'Open'), 614 QCoreApplication.translate("ViewManager", "Open"),
607 UI.PixmapCache.getIcon("open"), 615 UI.PixmapCache.getIcon("open"),
608 QCoreApplication.translate('ViewManager', '&Open...'), 616 QCoreApplication.translate("ViewManager", "&Open..."),
609 QKeySequence( 617 QKeySequence(
610 QCoreApplication.translate('ViewManager', "Ctrl+O", 618 QCoreApplication.translate("ViewManager", "Ctrl+O", "File|Open")
611 "File|Open")), 619 ),
612 0, self, 'vm_file_open') 620 0,
613 self.openAct.setStatusTip(QCoreApplication.translate( 621 self,
614 'ViewManager', 'Open a file')) 622 "vm_file_open",
615 self.openAct.setWhatsThis(QCoreApplication.translate( 623 )
616 'ViewManager', 624 self.openAct.setStatusTip(
617 """<b>Open a file</b>""" 625 QCoreApplication.translate("ViewManager", "Open a file")
618 """<p>You will be asked for the name of a file to be opened""" 626 )
619 """ in an editor window.</p>""" 627 self.openAct.setWhatsThis(
620 )) 628 QCoreApplication.translate(
629 "ViewManager",
630 """<b>Open a file</b>"""
631 """<p>You will be asked for the name of a file to be opened"""
632 """ in an editor window.</p>""",
633 )
634 )
621 self.openAct.triggered.connect(self.__openFiles) 635 self.openAct.triggered.connect(self.__openFiles)
622 self.fileActions.append(self.openAct) 636 self.fileActions.append(self.openAct)
623 637
624 self.closeActGrp = createActionGroup(self) 638 self.closeActGrp = createActionGroup(self)
625 639
626 self.closeAct = EricAction( 640 self.closeAct = EricAction(
627 QCoreApplication.translate('ViewManager', 'Close'), 641 QCoreApplication.translate("ViewManager", "Close"),
628 UI.PixmapCache.getIcon("closeEditor"), 642 UI.PixmapCache.getIcon("closeEditor"),
629 QCoreApplication.translate('ViewManager', '&Close'), 643 QCoreApplication.translate("ViewManager", "&Close"),
630 QKeySequence( 644 QKeySequence(
631 QCoreApplication.translate('ViewManager', "Ctrl+W", 645 QCoreApplication.translate("ViewManager", "Ctrl+W", "File|Close")
632 "File|Close")), 646 ),
633 0, self.closeActGrp, 'vm_file_close') 647 0,
648 self.closeActGrp,
649 "vm_file_close",
650 )
634 self.closeAct.setStatusTip( 651 self.closeAct.setStatusTip(
635 QCoreApplication.translate('ViewManager', 652 QCoreApplication.translate("ViewManager", "Close the current window")
636 'Close the current window')) 653 )
637 self.closeAct.setWhatsThis(QCoreApplication.translate( 654 self.closeAct.setWhatsThis(
638 'ViewManager', 655 QCoreApplication.translate(
639 """<b>Close Window</b>""" 656 "ViewManager",
640 """<p>Close the current window.</p>""" 657 """<b>Close Window</b>""" """<p>Close the current window.</p>""",
641 )) 658 )
659 )
642 self.closeAct.triggered.connect(self.closeCurrentWindow) 660 self.closeAct.triggered.connect(self.closeCurrentWindow)
643 self.fileActions.append(self.closeAct) 661 self.fileActions.append(self.closeAct)
644 662
645 self.closeAllAct = EricAction( 663 self.closeAllAct = EricAction(
646 QCoreApplication.translate('ViewManager', 'Close All'), 664 QCoreApplication.translate("ViewManager", "Close All"),
647 QCoreApplication.translate('ViewManager', 'Clos&e All'), 665 QCoreApplication.translate("ViewManager", "Clos&e All"),
648 0, 0, self.closeActGrp, 'vm_file_close_all') 666 0,
667 0,
668 self.closeActGrp,
669 "vm_file_close_all",
670 )
649 self.closeAllAct.setStatusTip( 671 self.closeAllAct.setStatusTip(
650 QCoreApplication.translate('ViewManager', 672 QCoreApplication.translate("ViewManager", "Close all editor windows")
651 'Close all editor windows')) 673 )
652 self.closeAllAct.setWhatsThis(QCoreApplication.translate( 674 self.closeAllAct.setWhatsThis(
653 'ViewManager', 675 QCoreApplication.translate(
654 """<b>Close All Windows</b>""" 676 "ViewManager",
655 """<p>Close all editor windows.</p>""" 677 """<b>Close All Windows</b>""" """<p>Close all editor windows.</p>""",
656 )) 678 )
679 )
657 self.closeAllAct.triggered.connect(self.closeAllWindows) 680 self.closeAllAct.triggered.connect(self.closeAllWindows)
658 self.fileActions.append(self.closeAllAct) 681 self.fileActions.append(self.closeAllAct)
659 682
660 self.closeActGrp.setEnabled(False) 683 self.closeActGrp.setEnabled(False)
661 684
662 self.saveActGrp = createActionGroup(self) 685 self.saveActGrp = createActionGroup(self)
663 686
664 self.saveAct = EricAction( 687 self.saveAct = EricAction(
665 QCoreApplication.translate('ViewManager', 'Save'), 688 QCoreApplication.translate("ViewManager", "Save"),
666 UI.PixmapCache.getIcon("fileSave"), 689 UI.PixmapCache.getIcon("fileSave"),
667 QCoreApplication.translate('ViewManager', '&Save'), 690 QCoreApplication.translate("ViewManager", "&Save"),
668 QKeySequence(QCoreApplication.translate( 691 QKeySequence(
669 'ViewManager', "Ctrl+S", "File|Save")), 692 QCoreApplication.translate("ViewManager", "Ctrl+S", "File|Save")
670 0, self.saveActGrp, 'vm_file_save') 693 ),
694 0,
695 self.saveActGrp,
696 "vm_file_save",
697 )
671 self.saveAct.setStatusTip( 698 self.saveAct.setStatusTip(
672 QCoreApplication.translate('ViewManager', 'Save the current file')) 699 QCoreApplication.translate("ViewManager", "Save the current file")
673 self.saveAct.setWhatsThis(QCoreApplication.translate( 700 )
674 'ViewManager', 701 self.saveAct.setWhatsThis(
675 """<b>Save File</b>""" 702 QCoreApplication.translate(
676 """<p>Save the contents of current editor window.</p>""" 703 "ViewManager",
677 )) 704 """<b>Save File</b>"""
705 """<p>Save the contents of current editor window.</p>""",
706 )
707 )
678 self.saveAct.triggered.connect(self.saveCurrentEditor) 708 self.saveAct.triggered.connect(self.saveCurrentEditor)
679 self.fileActions.append(self.saveAct) 709 self.fileActions.append(self.saveAct)
680 710
681 self.saveAsAct = EricAction( 711 self.saveAsAct = EricAction(
682 QCoreApplication.translate('ViewManager', 'Save as'), 712 QCoreApplication.translate("ViewManager", "Save as"),
683 UI.PixmapCache.getIcon("fileSaveAs"), 713 UI.PixmapCache.getIcon("fileSaveAs"),
684 QCoreApplication.translate('ViewManager', 'Save &as...'), 714 QCoreApplication.translate("ViewManager", "Save &as..."),
685 QKeySequence(QCoreApplication.translate( 715 QKeySequence(
686 'ViewManager', "Shift+Ctrl+S", "File|Save As")), 716 QCoreApplication.translate(
687 0, self.saveActGrp, 'vm_file_save_as') 717 "ViewManager", "Shift+Ctrl+S", "File|Save As"
688 self.saveAsAct.setStatusTip(QCoreApplication.translate( 718 )
689 'ViewManager', 'Save the current file to a new one')) 719 ),
690 self.saveAsAct.setWhatsThis(QCoreApplication.translate( 720 0,
691 'ViewManager', 721 self.saveActGrp,
692 """<b>Save File as</b>""" 722 "vm_file_save_as",
693 """<p>Save the contents of current editor window to a new file.""" 723 )
694 """ The file can be entered in a file selection dialog.</p>""" 724 self.saveAsAct.setStatusTip(
695 )) 725 QCoreApplication.translate(
726 "ViewManager", "Save the current file to a new one"
727 )
728 )
729 self.saveAsAct.setWhatsThis(
730 QCoreApplication.translate(
731 "ViewManager",
732 """<b>Save File as</b>"""
733 """<p>Save the contents of current editor window to a new file."""
734 """ The file can be entered in a file selection dialog.</p>""",
735 )
736 )
696 self.saveAsAct.triggered.connect(self.saveAsCurrentEditor) 737 self.saveAsAct.triggered.connect(self.saveAsCurrentEditor)
697 self.fileActions.append(self.saveAsAct) 738 self.fileActions.append(self.saveAsAct)
698 739
699 self.saveCopyAct = EricAction( 740 self.saveCopyAct = EricAction(
700 QCoreApplication.translate('ViewManager', 'Save Copy'), 741 QCoreApplication.translate("ViewManager", "Save Copy"),
701 UI.PixmapCache.getIcon("fileSaveCopy"), 742 UI.PixmapCache.getIcon("fileSaveCopy"),
702 QCoreApplication.translate('ViewManager', 'Save &Copy...'), 743 QCoreApplication.translate("ViewManager", "Save &Copy..."),
703 0, 0, self.saveActGrp, 'vm_file_save_copy') 744 0,
704 self.saveCopyAct.setStatusTip(QCoreApplication.translate( 745 0,
705 'ViewManager', 'Save a copy of the current file')) 746 self.saveActGrp,
706 self.saveCopyAct.setWhatsThis(QCoreApplication.translate( 747 "vm_file_save_copy",
707 'ViewManager', 748 )
708 """<b>Save Copy</b>""" 749 self.saveCopyAct.setStatusTip(
709 """<p>Save a copy of the contents of current editor window.""" 750 QCoreApplication.translate("ViewManager", "Save a copy of the current file")
710 """ The file can be entered in a file selection dialog.</p>""" 751 )
711 )) 752 self.saveCopyAct.setWhatsThis(
753 QCoreApplication.translate(
754 "ViewManager",
755 """<b>Save Copy</b>"""
756 """<p>Save a copy of the contents of current editor window."""
757 """ The file can be entered in a file selection dialog.</p>""",
758 )
759 )
712 self.saveCopyAct.triggered.connect(self.saveCopyCurrentEditor) 760 self.saveCopyAct.triggered.connect(self.saveCopyCurrentEditor)
713 self.fileActions.append(self.saveCopyAct) 761 self.fileActions.append(self.saveCopyAct)
714 762
715 self.saveAllAct = EricAction( 763 self.saveAllAct = EricAction(
716 QCoreApplication.translate('ViewManager', 'Save all'), 764 QCoreApplication.translate("ViewManager", "Save all"),
717 UI.PixmapCache.getIcon("fileSaveAll"), 765 UI.PixmapCache.getIcon("fileSaveAll"),
718 QCoreApplication.translate('ViewManager', 'Save a&ll'), 766 QCoreApplication.translate("ViewManager", "Save a&ll"),
719 0, 0, self.saveActGrp, 'vm_file_save_all') 767 0,
720 self.saveAllAct.setStatusTip(QCoreApplication.translate( 768 0,
721 'ViewManager', 'Save all files')) 769 self.saveActGrp,
722 self.saveAllAct.setWhatsThis(QCoreApplication.translate( 770 "vm_file_save_all",
723 'ViewManager', 771 )
724 """<b>Save All Files</b>""" 772 self.saveAllAct.setStatusTip(
725 """<p>Save the contents of all editor windows.</p>""" 773 QCoreApplication.translate("ViewManager", "Save all files")
726 )) 774 )
775 self.saveAllAct.setWhatsThis(
776 QCoreApplication.translate(
777 "ViewManager",
778 """<b>Save All Files</b>"""
779 """<p>Save the contents of all editor windows.</p>""",
780 )
781 )
727 self.saveAllAct.triggered.connect(self.saveAllEditors) 782 self.saveAllAct.triggered.connect(self.saveAllEditors)
728 self.fileActions.append(self.saveAllAct) 783 self.fileActions.append(self.saveAllAct)
729 784
730 self.saveActGrp.setEnabled(False) 785 self.saveActGrp.setEnabled(False)
731 786
732 self.printAct = EricAction( 787 self.printAct = EricAction(
733 QCoreApplication.translate('ViewManager', 'Print'), 788 QCoreApplication.translate("ViewManager", "Print"),
734 UI.PixmapCache.getIcon("print"), 789 UI.PixmapCache.getIcon("print"),
735 QCoreApplication.translate('ViewManager', '&Print'), 790 QCoreApplication.translate("ViewManager", "&Print"),
736 QKeySequence(QCoreApplication.translate( 791 QKeySequence(
737 'ViewManager', "Ctrl+P", "File|Print")), 792 QCoreApplication.translate("ViewManager", "Ctrl+P", "File|Print")
738 0, self, 'vm_file_print') 793 ),
739 self.printAct.setStatusTip(QCoreApplication.translate( 794 0,
740 'ViewManager', 'Print the current file')) 795 self,
741 self.printAct.setWhatsThis(QCoreApplication.translate( 796 "vm_file_print",
742 'ViewManager', 797 )
743 """<b>Print File</b>""" 798 self.printAct.setStatusTip(
744 """<p>Print the contents of current editor window.</p>""" 799 QCoreApplication.translate("ViewManager", "Print the current file")
745 )) 800 )
801 self.printAct.setWhatsThis(
802 QCoreApplication.translate(
803 "ViewManager",
804 """<b>Print File</b>"""
805 """<p>Print the contents of current editor window.</p>""",
806 )
807 )
746 self.printAct.triggered.connect(self.printCurrentEditor) 808 self.printAct.triggered.connect(self.printCurrentEditor)
747 self.printAct.setEnabled(False) 809 self.printAct.setEnabled(False)
748 self.fileActions.append(self.printAct) 810 self.fileActions.append(self.printAct)
749 811
750 self.printPreviewAct = EricAction( 812 self.printPreviewAct = EricAction(
751 QCoreApplication.translate('ViewManager', 'Print Preview'), 813 QCoreApplication.translate("ViewManager", "Print Preview"),
752 UI.PixmapCache.getIcon("printPreview"), 814 UI.PixmapCache.getIcon("printPreview"),
753 QCoreApplication.translate('ViewManager', 'Print Preview'), 815 QCoreApplication.translate("ViewManager", "Print Preview"),
754 0, 0, self, 'vm_file_print_preview') 816 0,
755 self.printPreviewAct.setStatusTip(QCoreApplication.translate( 817 0,
756 'ViewManager', 'Print preview of the current file')) 818 self,
757 self.printPreviewAct.setWhatsThis(QCoreApplication.translate( 819 "vm_file_print_preview",
758 'ViewManager', 820 )
759 """<b>Print Preview</b>""" 821 self.printPreviewAct.setStatusTip(
760 """<p>Print preview of the current editor window.</p>""" 822 QCoreApplication.translate(
761 )) 823 "ViewManager", "Print preview of the current file"
762 self.printPreviewAct.triggered.connect( 824 )
763 self.printPreviewCurrentEditor) 825 )
826 self.printPreviewAct.setWhatsThis(
827 QCoreApplication.translate(
828 "ViewManager",
829 """<b>Print Preview</b>"""
830 """<p>Print preview of the current editor window.</p>""",
831 )
832 )
833 self.printPreviewAct.triggered.connect(self.printPreviewCurrentEditor)
764 self.printPreviewAct.setEnabled(False) 834 self.printPreviewAct.setEnabled(False)
765 self.fileActions.append(self.printPreviewAct) 835 self.fileActions.append(self.printPreviewAct)
766 836
767 self.findLocationAct = EricAction( 837 self.findLocationAct = EricAction(
768 QCoreApplication.translate('ViewManager', 'Find File'), 838 QCoreApplication.translate("ViewManager", "Find File"),
769 UI.PixmapCache.getIcon("findLocation"), 839 UI.PixmapCache.getIcon("findLocation"),
770 QCoreApplication.translate('ViewManager', 'Find &File...'), 840 QCoreApplication.translate("ViewManager", "Find &File..."),
771 QKeySequence(QCoreApplication.translate( 841 QKeySequence(
772 'ViewManager', "Alt+Ctrl+F", "File|Find File")), 842 QCoreApplication.translate(
773 0, self, 'vm_file_search_file') 843 "ViewManager", "Alt+Ctrl+F", "File|Find File"
774 self.findLocationAct.setStatusTip(QCoreApplication.translate( 844 )
775 'ViewManager', 'Search for a file by entering a search pattern')) 845 ),
776 self.findLocationAct.setWhatsThis(QCoreApplication.translate( 846 0,
777 'ViewManager', 847 self,
778 """<b>Find File</b>""" 848 "vm_file_search_file",
779 """<p>This searches for a file by entering a search pattern.</p>""" 849 )
780 )) 850 self.findLocationAct.setStatusTip(
851 QCoreApplication.translate(
852 "ViewManager", "Search for a file by entering a search pattern"
853 )
854 )
855 self.findLocationAct.setWhatsThis(
856 QCoreApplication.translate(
857 "ViewManager",
858 """<b>Find File</b>"""
859 """<p>This searches for a file by entering a search pattern.</p>""",
860 )
861 )
781 self.findLocationAct.triggered.connect(self.__findLocation) 862 self.findLocationAct.triggered.connect(self.__findLocation)
782 self.fileActions.append(self.findLocationAct) 863 self.fileActions.append(self.findLocationAct)
783 864
784 def initFileMenu(self): 865 def initFileMenu(self):
785 """ 866 """
786 Public method to create the File menu. 867 Public method to create the File menu.
787 868
788 @return the generated menu 869 @return the generated menu
789 """ 870 """
790 menu = QMenu(QCoreApplication.translate('ViewManager', '&File'), 871 menu = QMenu(QCoreApplication.translate("ViewManager", "&File"), self.ui)
791 self.ui)
792 self.recentMenu = QMenu( 872 self.recentMenu = QMenu(
793 QCoreApplication.translate('ViewManager', 'Open &Recent Files'), 873 QCoreApplication.translate("ViewManager", "Open &Recent Files"), menu
794 menu) 874 )
795 self.bookmarkedMenu = QMenu( 875 self.bookmarkedMenu = QMenu(
796 QCoreApplication.translate('ViewManager', 876 QCoreApplication.translate("ViewManager", "Open &Bookmarked Files"), menu
797 'Open &Bookmarked Files'), 877 )
798 menu)
799 self.exportersMenu = self.__initContextMenuExporters() 878 self.exportersMenu = self.__initContextMenuExporters()
800 menu.setTearOffEnabled(True) 879 menu.setTearOffEnabled(True)
801 880
802 menu.addAction(self.newAct) 881 menu.addAction(self.newAct)
803 menu.addAction(self.openAct) 882 menu.addAction(self.openAct)
804 self.menuRecentAct = menu.addMenu(self.recentMenu) 883 self.menuRecentAct = menu.addMenu(self.recentMenu)
805 menu.addMenu(self.bookmarkedMenu) 884 menu.addMenu(self.bookmarkedMenu)
806 menu.addSeparator() 885 menu.addSeparator()
815 menu.addAction(self.saveAllAct) 894 menu.addAction(self.saveAllAct)
816 self.exportersMenuAct = menu.addMenu(self.exportersMenu) 895 self.exportersMenuAct = menu.addMenu(self.exportersMenu)
817 menu.addSeparator() 896 menu.addSeparator()
818 menu.addAction(self.printPreviewAct) 897 menu.addAction(self.printPreviewAct)
819 menu.addAction(self.printAct) 898 menu.addAction(self.printAct)
820 899
821 self.recentMenu.aboutToShow.connect(self.__showRecentMenu) 900 self.recentMenu.aboutToShow.connect(self.__showRecentMenu)
822 self.recentMenu.triggered.connect(self.__openSourceFile) 901 self.recentMenu.triggered.connect(self.__openSourceFile)
823 self.bookmarkedMenu.aboutToShow.connect(self.__showBookmarkedMenu) 902 self.bookmarkedMenu.aboutToShow.connect(self.__showBookmarkedMenu)
824 self.bookmarkedMenu.triggered.connect(self.__openSourceFile) 903 self.bookmarkedMenu.triggered.connect(self.__openSourceFile)
825 menu.aboutToShow.connect(self.__showFileMenu) 904 menu.aboutToShow.connect(self.__showFileMenu)
826 905
827 self.exportersMenuAct.setEnabled(False) 906 self.exportersMenuAct.setEnabled(False)
828 907
829 return menu 908 return menu
830 909
831 def initFileToolbar(self, toolbarManager): 910 def initFileToolbar(self, toolbarManager):
832 """ 911 """
833 Public method to create the File toolbar. 912 Public method to create the File toolbar.
834 913
835 @param toolbarManager reference to a toolbar manager object 914 @param toolbarManager reference to a toolbar manager object
836 (EricToolBarManager) 915 (EricToolBarManager)
837 @return the generated toolbar 916 @return the generated toolbar
838 """ 917 """
839 tb = QToolBar(QCoreApplication.translate('ViewManager', 'File'), 918 tb = QToolBar(QCoreApplication.translate("ViewManager", "File"), self.ui)
840 self.ui)
841 tb.setIconSize(UI.Config.ToolBarIconSize) 919 tb.setIconSize(UI.Config.ToolBarIconSize)
842 tb.setObjectName("FileToolbar") 920 tb.setObjectName("FileToolbar")
843 tb.setToolTip(QCoreApplication.translate('ViewManager', 'File')) 921 tb.setToolTip(QCoreApplication.translate("ViewManager", "File"))
844 922
845 tb.addAction(self.newAct) 923 tb.addAction(self.newAct)
846 tb.addAction(self.openAct) 924 tb.addAction(self.openAct)
847 tb.addAction(self.closeAct) 925 tb.addAction(self.closeAct)
848 tb.addSeparator() 926 tb.addSeparator()
849 tb.addAction(self.saveAct) 927 tb.addAction(self.saveAct)
850 tb.addAction(self.saveAsAct) 928 tb.addAction(self.saveAsAct)
851 tb.addAction(self.saveCopyAct) 929 tb.addAction(self.saveCopyAct)
852 tb.addAction(self.saveAllAct) 930 tb.addAction(self.saveAllAct)
853 931
854 toolbarManager.addToolBar(tb, tb.windowTitle()) 932 toolbarManager.addToolBar(tb, tb.windowTitle())
855 toolbarManager.addAction(self.printPreviewAct, tb.windowTitle()) 933 toolbarManager.addAction(self.printPreviewAct, tb.windowTitle())
856 toolbarManager.addAction(self.printAct, tb.windowTitle()) 934 toolbarManager.addAction(self.printAct, tb.windowTitle())
857 935
858 return tb 936 return tb
859 937
860 def __initContextMenuExporters(self): 938 def __initContextMenuExporters(self):
861 """ 939 """
862 Private method used to setup the Exporters sub menu. 940 Private method used to setup the Exporters sub menu.
863 941
864 @return reference to the generated menu (QMenu) 942 @return reference to the generated menu (QMenu)
865 """ 943 """
866 menu = QMenu(QCoreApplication.translate('ViewManager', "Export as")) 944 menu = QMenu(QCoreApplication.translate("ViewManager", "Export as"))
867 945
868 import QScintilla.Exporters 946 import QScintilla.Exporters
947
869 supportedExporters = QScintilla.Exporters.getSupportedFormats() 948 supportedExporters = QScintilla.Exporters.getSupportedFormats()
870 exporters = sorted(supportedExporters.keys()) 949 exporters = sorted(supportedExporters.keys())
871 for exporter in exporters: 950 for exporter in exporters:
872 act = menu.addAction(supportedExporters[exporter]) 951 act = menu.addAction(supportedExporters[exporter])
873 act.setData(exporter) 952 act.setData(exporter)
874 953
875 menu.triggered.connect(self.__exportMenuTriggered) 954 menu.triggered.connect(self.__exportMenuTriggered)
876 955
877 return menu 956 return menu
878 957
879 ################################################################## 958 ##################################################################
880 ## Initialize the edit related actions, edit menu and toolbar 959 ## Initialize the edit related actions, edit menu and toolbar
881 ################################################################## 960 ##################################################################
882 961
883 def __initEditActions(self): 962 def __initEditActions(self):
884 """ 963 """
885 Private method defining the user interface actions for the edit 964 Private method defining the user interface actions for the edit
886 commands. 965 commands.
887 """ 966 """
888 self.editActGrp = createActionGroup(self) 967 self.editActGrp = createActionGroup(self)
889 968
890 self.undoAct = EricAction( 969 self.undoAct = EricAction(
891 QCoreApplication.translate('ViewManager', 'Undo'), 970 QCoreApplication.translate("ViewManager", "Undo"),
892 UI.PixmapCache.getIcon("editUndo"), 971 UI.PixmapCache.getIcon("editUndo"),
893 QCoreApplication.translate('ViewManager', '&Undo'), 972 QCoreApplication.translate("ViewManager", "&Undo"),
894 QKeySequence(QCoreApplication.translate( 973 QKeySequence(
895 'ViewManager', "Ctrl+Z", "Edit|Undo")), 974 QCoreApplication.translate("ViewManager", "Ctrl+Z", "Edit|Undo")
896 QKeySequence(QCoreApplication.translate( 975 ),
897 'ViewManager', "Alt+Backspace", "Edit|Undo")), 976 QKeySequence(
898 self.editActGrp, 'vm_edit_undo') 977 QCoreApplication.translate("ViewManager", "Alt+Backspace", "Edit|Undo")
899 self.undoAct.setStatusTip(QCoreApplication.translate( 978 ),
900 'ViewManager', 'Undo the last change')) 979 self.editActGrp,
901 self.undoAct.setWhatsThis(QCoreApplication.translate( 980 "vm_edit_undo",
902 'ViewManager', 981 )
903 """<b>Undo</b>""" 982 self.undoAct.setStatusTip(
904 """<p>Undo the last change done in the current editor.</p>""" 983 QCoreApplication.translate("ViewManager", "Undo the last change")
905 )) 984 )
985 self.undoAct.setWhatsThis(
986 QCoreApplication.translate(
987 "ViewManager",
988 """<b>Undo</b>"""
989 """<p>Undo the last change done in the current editor.</p>""",
990 )
991 )
906 self.undoAct.triggered.connect(self.__editUndo) 992 self.undoAct.triggered.connect(self.__editUndo)
907 self.editActions.append(self.undoAct) 993 self.editActions.append(self.undoAct)
908 994
909 self.redoAct = EricAction( 995 self.redoAct = EricAction(
910 QCoreApplication.translate('ViewManager', 'Redo'), 996 QCoreApplication.translate("ViewManager", "Redo"),
911 UI.PixmapCache.getIcon("editRedo"), 997 UI.PixmapCache.getIcon("editRedo"),
912 QCoreApplication.translate('ViewManager', '&Redo'), 998 QCoreApplication.translate("ViewManager", "&Redo"),
913 QKeySequence(QCoreApplication.translate( 999 QKeySequence(
914 'ViewManager', "Ctrl+Shift+Z", "Edit|Redo")), 1000 QCoreApplication.translate("ViewManager", "Ctrl+Shift+Z", "Edit|Redo")
915 0, 1001 ),
916 self.editActGrp, 'vm_edit_redo') 1002 0,
917 self.redoAct.setStatusTip(QCoreApplication.translate( 1003 self.editActGrp,
918 'ViewManager', 'Redo the last change')) 1004 "vm_edit_redo",
919 self.redoAct.setWhatsThis(QCoreApplication.translate( 1005 )
920 'ViewManager', 1006 self.redoAct.setStatusTip(
921 """<b>Redo</b>""" 1007 QCoreApplication.translate("ViewManager", "Redo the last change")
922 """<p>Redo the last change done in the current editor.</p>""" 1008 )
923 )) 1009 self.redoAct.setWhatsThis(
1010 QCoreApplication.translate(
1011 "ViewManager",
1012 """<b>Redo</b>"""
1013 """<p>Redo the last change done in the current editor.</p>""",
1014 )
1015 )
924 self.redoAct.triggered.connect(self.__editRedo) 1016 self.redoAct.triggered.connect(self.__editRedo)
925 self.editActions.append(self.redoAct) 1017 self.editActions.append(self.redoAct)
926 1018
927 self.revertAct = EricAction( 1019 self.revertAct = EricAction(
928 QCoreApplication.translate( 1020 QCoreApplication.translate("ViewManager", "Revert to last saved state"),
929 'ViewManager', 'Revert to last saved state'), 1021 QCoreApplication.translate("ViewManager", "Re&vert to last saved state"),
930 QCoreApplication.translate( 1022 QKeySequence(
931 'ViewManager', 'Re&vert to last saved state'), 1023 QCoreApplication.translate("ViewManager", "Ctrl+Y", "Edit|Revert")
932 QKeySequence(QCoreApplication.translate( 1024 ),
933 'ViewManager', "Ctrl+Y", "Edit|Revert")), 1025 0,
934 0, 1026 self.editActGrp,
935 self.editActGrp, 'vm_edit_revert') 1027 "vm_edit_revert",
936 self.revertAct.setStatusTip(QCoreApplication.translate( 1028 )
937 'ViewManager', 'Revert to last saved state')) 1029 self.revertAct.setStatusTip(
938 self.revertAct.setWhatsThis(QCoreApplication.translate( 1030 QCoreApplication.translate("ViewManager", "Revert to last saved state")
939 'ViewManager', 1031 )
940 """<b>Revert to last saved state</b>""" 1032 self.revertAct.setWhatsThis(
941 """<p>Undo all changes up to the last saved state""" 1033 QCoreApplication.translate(
942 """ of the current editor.</p>""" 1034 "ViewManager",
943 )) 1035 """<b>Revert to last saved state</b>"""
1036 """<p>Undo all changes up to the last saved state"""
1037 """ of the current editor.</p>""",
1038 )
1039 )
944 self.revertAct.triggered.connect(self.__editRevert) 1040 self.revertAct.triggered.connect(self.__editRevert)
945 self.editActions.append(self.revertAct) 1041 self.editActions.append(self.revertAct)
946 1042
947 self.copyActGrp = createActionGroup(self.editActGrp) 1043 self.copyActGrp = createActionGroup(self.editActGrp)
948 1044
949 self.cutAct = EricAction( 1045 self.cutAct = EricAction(
950 QCoreApplication.translate('ViewManager', 'Cut'), 1046 QCoreApplication.translate("ViewManager", "Cut"),
951 UI.PixmapCache.getIcon("editCut"), 1047 UI.PixmapCache.getIcon("editCut"),
952 QCoreApplication.translate('ViewManager', 'Cu&t'), 1048 QCoreApplication.translate("ViewManager", "Cu&t"),
953 QKeySequence(QCoreApplication.translate( 1049 QKeySequence(
954 'ViewManager', "Ctrl+X", "Edit|Cut")), 1050 QCoreApplication.translate("ViewManager", "Ctrl+X", "Edit|Cut")
955 QKeySequence(QCoreApplication.translate( 1051 ),
956 'ViewManager', "Shift+Del", "Edit|Cut")), 1052 QKeySequence(
957 self.copyActGrp, 'vm_edit_cut') 1053 QCoreApplication.translate("ViewManager", "Shift+Del", "Edit|Cut")
958 self.cutAct.setStatusTip(QCoreApplication.translate( 1054 ),
959 'ViewManager', 'Cut the selection')) 1055 self.copyActGrp,
960 self.cutAct.setWhatsThis(QCoreApplication.translate( 1056 "vm_edit_cut",
961 'ViewManager', 1057 )
962 """<b>Cut</b>""" 1058 self.cutAct.setStatusTip(
963 """<p>Cut the selected text of the current editor to the""" 1059 QCoreApplication.translate("ViewManager", "Cut the selection")
964 """ clipboard.</p>""" 1060 )
965 )) 1061 self.cutAct.setWhatsThis(
1062 QCoreApplication.translate(
1063 "ViewManager",
1064 """<b>Cut</b>"""
1065 """<p>Cut the selected text of the current editor to the"""
1066 """ clipboard.</p>""",
1067 )
1068 )
966 self.cutAct.triggered.connect(self.__editCut) 1069 self.cutAct.triggered.connect(self.__editCut)
967 self.editActions.append(self.cutAct) 1070 self.editActions.append(self.cutAct)
968 1071
969 self.copyAct = EricAction( 1072 self.copyAct = EricAction(
970 QCoreApplication.translate('ViewManager', 'Copy'), 1073 QCoreApplication.translate("ViewManager", "Copy"),
971 UI.PixmapCache.getIcon("editCopy"), 1074 UI.PixmapCache.getIcon("editCopy"),
972 QCoreApplication.translate('ViewManager', '&Copy'), 1075 QCoreApplication.translate("ViewManager", "&Copy"),
973 QKeySequence(QCoreApplication.translate( 1076 QKeySequence(
974 'ViewManager', "Ctrl+C", "Edit|Copy")), 1077 QCoreApplication.translate("ViewManager", "Ctrl+C", "Edit|Copy")
975 QKeySequence(QCoreApplication.translate( 1078 ),
976 'ViewManager', "Ctrl+Ins", "Edit|Copy")), 1079 QKeySequence(
977 self.copyActGrp, 'vm_edit_copy') 1080 QCoreApplication.translate("ViewManager", "Ctrl+Ins", "Edit|Copy")
978 self.copyAct.setStatusTip(QCoreApplication.translate( 1081 ),
979 'ViewManager', 'Copy the selection')) 1082 self.copyActGrp,
980 self.copyAct.setWhatsThis(QCoreApplication.translate( 1083 "vm_edit_copy",
981 'ViewManager', 1084 )
982 """<b>Copy</b>""" 1085 self.copyAct.setStatusTip(
983 """<p>Copy the selected text of the current editor to the""" 1086 QCoreApplication.translate("ViewManager", "Copy the selection")
984 """ clipboard.</p>""" 1087 )
985 )) 1088 self.copyAct.setWhatsThis(
1089 QCoreApplication.translate(
1090 "ViewManager",
1091 """<b>Copy</b>"""
1092 """<p>Copy the selected text of the current editor to the"""
1093 """ clipboard.</p>""",
1094 )
1095 )
986 self.copyAct.triggered.connect(self.__editCopy) 1096 self.copyAct.triggered.connect(self.__editCopy)
987 self.editActions.append(self.copyAct) 1097 self.editActions.append(self.copyAct)
988 1098
989 self.pasteAct = EricAction( 1099 self.pasteAct = EricAction(
990 QCoreApplication.translate('ViewManager', 'Paste'), 1100 QCoreApplication.translate("ViewManager", "Paste"),
991 UI.PixmapCache.getIcon("editPaste"), 1101 UI.PixmapCache.getIcon("editPaste"),
992 QCoreApplication.translate('ViewManager', '&Paste'), 1102 QCoreApplication.translate("ViewManager", "&Paste"),
993 QKeySequence(QCoreApplication.translate( 1103 QKeySequence(
994 'ViewManager', "Ctrl+V", "Edit|Paste")), 1104 QCoreApplication.translate("ViewManager", "Ctrl+V", "Edit|Paste")
995 QKeySequence(QCoreApplication.translate( 1105 ),
996 'ViewManager', "Shift+Ins", "Edit|Paste")), 1106 QKeySequence(
997 self.copyActGrp, 'vm_edit_paste') 1107 QCoreApplication.translate("ViewManager", "Shift+Ins", "Edit|Paste")
998 self.pasteAct.setStatusTip(QCoreApplication.translate( 1108 ),
999 'ViewManager', 'Paste the last cut/copied text')) 1109 self.copyActGrp,
1000 self.pasteAct.setWhatsThis(QCoreApplication.translate( 1110 "vm_edit_paste",
1001 'ViewManager', 1111 )
1002 """<b>Paste</b>""" 1112 self.pasteAct.setStatusTip(
1003 """<p>Paste the last cut/copied text from the clipboard to""" 1113 QCoreApplication.translate("ViewManager", "Paste the last cut/copied text")
1004 """ the current editor.</p>""" 1114 )
1005 )) 1115 self.pasteAct.setWhatsThis(
1116 QCoreApplication.translate(
1117 "ViewManager",
1118 """<b>Paste</b>"""
1119 """<p>Paste the last cut/copied text from the clipboard to"""
1120 """ the current editor.</p>""",
1121 )
1122 )
1006 self.pasteAct.triggered.connect(self.__editPaste) 1123 self.pasteAct.triggered.connect(self.__editPaste)
1007 self.editActions.append(self.pasteAct) 1124 self.editActions.append(self.pasteAct)
1008 1125
1009 self.deleteAct = EricAction( 1126 self.deleteAct = EricAction(
1010 QCoreApplication.translate('ViewManager', 'Clear'), 1127 QCoreApplication.translate("ViewManager", "Clear"),
1011 UI.PixmapCache.getIcon("editDelete"), 1128 UI.PixmapCache.getIcon("editDelete"),
1012 QCoreApplication.translate('ViewManager', 'Clear'), 1129 QCoreApplication.translate("ViewManager", "Clear"),
1013 QKeySequence(QCoreApplication.translate( 1130 QKeySequence(
1014 'ViewManager', "Alt+Shift+C", "Edit|Clear")), 1131 QCoreApplication.translate("ViewManager", "Alt+Shift+C", "Edit|Clear")
1015 0, 1132 ),
1016 self.copyActGrp, 'vm_edit_clear') 1133 0,
1017 self.deleteAct.setStatusTip(QCoreApplication.translate( 1134 self.copyActGrp,
1018 'ViewManager', 'Clear all text')) 1135 "vm_edit_clear",
1019 self.deleteAct.setWhatsThis(QCoreApplication.translate( 1136 )
1020 'ViewManager', 1137 self.deleteAct.setStatusTip(
1021 """<b>Clear</b>""" 1138 QCoreApplication.translate("ViewManager", "Clear all text")
1022 """<p>Delete all text of the current editor.</p>""" 1139 )
1023 )) 1140 self.deleteAct.setWhatsThis(
1141 QCoreApplication.translate(
1142 "ViewManager",
1143 """<b>Clear</b>""" """<p>Delete all text of the current editor.</p>""",
1144 )
1145 )
1024 self.deleteAct.triggered.connect(self.__editDelete) 1146 self.deleteAct.triggered.connect(self.__editDelete)
1025 self.editActions.append(self.deleteAct) 1147 self.editActions.append(self.deleteAct)
1026 1148
1027 self.joinAct = EricAction( 1149 self.joinAct = EricAction(
1028 QCoreApplication.translate('ViewManager', 'Join Lines'), 1150 QCoreApplication.translate("ViewManager", "Join Lines"),
1029 QCoreApplication.translate('ViewManager', 'Join Lines'), 1151 QCoreApplication.translate("ViewManager", "Join Lines"),
1030 QKeySequence(QCoreApplication.translate( 1152 QKeySequence(
1031 'ViewManager', "Ctrl+J", "Edit|Join Lines")), 1153 QCoreApplication.translate("ViewManager", "Ctrl+J", "Edit|Join Lines")
1032 0, 1154 ),
1033 self.editActGrp, 'vm_edit_join_lines') 1155 0,
1034 self.joinAct.setStatusTip(QCoreApplication.translate( 1156 self.editActGrp,
1035 'ViewManager', 'Join Lines')) 1157 "vm_edit_join_lines",
1036 self.joinAct.setWhatsThis(QCoreApplication.translate( 1158 )
1037 'ViewManager', 1159 self.joinAct.setStatusTip(
1038 """<b>Join Lines</b>""" 1160 QCoreApplication.translate("ViewManager", "Join Lines")
1039 """<p>Join the current and the next lines.</p>""" 1161 )
1040 )) 1162 self.joinAct.setWhatsThis(
1163 QCoreApplication.translate(
1164 "ViewManager",
1165 """<b>Join Lines</b>"""
1166 """<p>Join the current and the next lines.</p>""",
1167 )
1168 )
1041 self.joinAct.triggered.connect(self.__editJoin) 1169 self.joinAct.triggered.connect(self.__editJoin)
1042 self.editActions.append(self.joinAct) 1170 self.editActions.append(self.joinAct)
1043 1171
1044 self.indentAct = EricAction( 1172 self.indentAct = EricAction(
1045 QCoreApplication.translate('ViewManager', 'Indent'), 1173 QCoreApplication.translate("ViewManager", "Indent"),
1046 UI.PixmapCache.getIcon("editIndent"), 1174 UI.PixmapCache.getIcon("editIndent"),
1047 QCoreApplication.translate('ViewManager', '&Indent'), 1175 QCoreApplication.translate("ViewManager", "&Indent"),
1048 QKeySequence(QCoreApplication.translate( 1176 QKeySequence(
1049 'ViewManager', "Ctrl+I", "Edit|Indent")), 1177 QCoreApplication.translate("ViewManager", "Ctrl+I", "Edit|Indent")
1050 0, 1178 ),
1051 self.editActGrp, 'vm_edit_indent') 1179 0,
1052 self.indentAct.setStatusTip(QCoreApplication.translate( 1180 self.editActGrp,
1053 'ViewManager', 'Indent line')) 1181 "vm_edit_indent",
1054 self.indentAct.setWhatsThis(QCoreApplication.translate( 1182 )
1055 'ViewManager', 1183 self.indentAct.setStatusTip(
1056 """<b>Indent</b>""" 1184 QCoreApplication.translate("ViewManager", "Indent line")
1057 """<p>Indents the current line or the lines of the""" 1185 )
1058 """ selection by one level.</p>""" 1186 self.indentAct.setWhatsThis(
1059 )) 1187 QCoreApplication.translate(
1188 "ViewManager",
1189 """<b>Indent</b>"""
1190 """<p>Indents the current line or the lines of the"""
1191 """ selection by one level.</p>""",
1192 )
1193 )
1060 self.indentAct.triggered.connect(self.__editIndent) 1194 self.indentAct.triggered.connect(self.__editIndent)
1061 self.editActions.append(self.indentAct) 1195 self.editActions.append(self.indentAct)
1062 1196
1063 self.unindentAct = EricAction( 1197 self.unindentAct = EricAction(
1064 QCoreApplication.translate('ViewManager', 'Unindent'), 1198 QCoreApplication.translate("ViewManager", "Unindent"),
1065 UI.PixmapCache.getIcon("editUnindent"), 1199 UI.PixmapCache.getIcon("editUnindent"),
1066 QCoreApplication.translate('ViewManager', 'U&nindent'), 1200 QCoreApplication.translate("ViewManager", "U&nindent"),
1067 QKeySequence(QCoreApplication.translate( 1201 QKeySequence(
1068 'ViewManager', "Ctrl+Shift+I", "Edit|Unindent")), 1202 QCoreApplication.translate(
1069 0, 1203 "ViewManager", "Ctrl+Shift+I", "Edit|Unindent"
1070 self.editActGrp, 'vm_edit_unindent') 1204 )
1071 self.unindentAct.setStatusTip(QCoreApplication.translate( 1205 ),
1072 'ViewManager', 'Unindent line')) 1206 0,
1073 self.unindentAct.setWhatsThis(QCoreApplication.translate( 1207 self.editActGrp,
1074 'ViewManager', 1208 "vm_edit_unindent",
1075 """<b>Unindent</b>""" 1209 )
1076 """<p>Unindents the current line or the lines of the""" 1210 self.unindentAct.setStatusTip(
1077 """ selection by one level.</p>""" 1211 QCoreApplication.translate("ViewManager", "Unindent line")
1078 )) 1212 )
1213 self.unindentAct.setWhatsThis(
1214 QCoreApplication.translate(
1215 "ViewManager",
1216 """<b>Unindent</b>"""
1217 """<p>Unindents the current line or the lines of the"""
1218 """ selection by one level.</p>""",
1219 )
1220 )
1079 self.unindentAct.triggered.connect(self.__editUnindent) 1221 self.unindentAct.triggered.connect(self.__editUnindent)
1080 self.editActions.append(self.unindentAct) 1222 self.editActions.append(self.unindentAct)
1081 1223
1082 self.smartIndentAct = EricAction( 1224 self.smartIndentAct = EricAction(
1083 QCoreApplication.translate('ViewManager', 'Smart indent'), 1225 QCoreApplication.translate("ViewManager", "Smart indent"),
1084 UI.PixmapCache.getIcon("editSmartIndent"), 1226 UI.PixmapCache.getIcon("editSmartIndent"),
1085 QCoreApplication.translate('ViewManager', 'Smart indent'), 1227 QCoreApplication.translate("ViewManager", "Smart indent"),
1086 0, 0, 1228 0,
1087 self.editActGrp, 'vm_edit_smart_indent') 1229 0,
1088 self.smartIndentAct.setStatusTip(QCoreApplication.translate( 1230 self.editActGrp,
1089 'ViewManager', 'Smart indent Line or Selection')) 1231 "vm_edit_smart_indent",
1090 self.smartIndentAct.setWhatsThis(QCoreApplication.translate( 1232 )
1091 'ViewManager', 1233 self.smartIndentAct.setStatusTip(
1092 """<b>Smart indent</b>""" 1234 QCoreApplication.translate("ViewManager", "Smart indent Line or Selection")
1093 """<p>Indents the current line or the lines of the""" 1235 )
1094 """ current selection smartly.</p>""" 1236 self.smartIndentAct.setWhatsThis(
1095 )) 1237 QCoreApplication.translate(
1238 "ViewManager",
1239 """<b>Smart indent</b>"""
1240 """<p>Indents the current line or the lines of the"""
1241 """ current selection smartly.</p>""",
1242 )
1243 )
1096 self.smartIndentAct.triggered.connect(self.__editSmartIndent) 1244 self.smartIndentAct.triggered.connect(self.__editSmartIndent)
1097 self.editActions.append(self.smartIndentAct) 1245 self.editActions.append(self.smartIndentAct)
1098 1246
1099 self.commentAct = EricAction( 1247 self.commentAct = EricAction(
1100 QCoreApplication.translate('ViewManager', 'Comment'), 1248 QCoreApplication.translate("ViewManager", "Comment"),
1101 UI.PixmapCache.getIcon("editComment"), 1249 UI.PixmapCache.getIcon("editComment"),
1102 QCoreApplication.translate('ViewManager', 'C&omment'), 1250 QCoreApplication.translate("ViewManager", "C&omment"),
1103 QKeySequence(QCoreApplication.translate( 1251 QKeySequence(
1104 'ViewManager', "Ctrl+M", "Edit|Comment")), 1252 QCoreApplication.translate("ViewManager", "Ctrl+M", "Edit|Comment")
1105 0, 1253 ),
1106 self.editActGrp, 'vm_edit_comment') 1254 0,
1107 self.commentAct.setStatusTip(QCoreApplication.translate( 1255 self.editActGrp,
1108 'ViewManager', 'Comment Line or Selection')) 1256 "vm_edit_comment",
1109 self.commentAct.setWhatsThis(QCoreApplication.translate( 1257 )
1110 'ViewManager', 1258 self.commentAct.setStatusTip(
1111 """<b>Comment</b>""" 1259 QCoreApplication.translate("ViewManager", "Comment Line or Selection")
1112 """<p>Comments the current line or the lines of the""" 1260 )
1113 """ current selection.</p>""" 1261 self.commentAct.setWhatsThis(
1114 )) 1262 QCoreApplication.translate(
1263 "ViewManager",
1264 """<b>Comment</b>"""
1265 """<p>Comments the current line or the lines of the"""
1266 """ current selection.</p>""",
1267 )
1268 )
1115 self.commentAct.triggered.connect(self.__editComment) 1269 self.commentAct.triggered.connect(self.__editComment)
1116 self.editActions.append(self.commentAct) 1270 self.editActions.append(self.commentAct)
1117 1271
1118 self.uncommentAct = EricAction( 1272 self.uncommentAct = EricAction(
1119 QCoreApplication.translate('ViewManager', 'Uncomment'), 1273 QCoreApplication.translate("ViewManager", "Uncomment"),
1120 UI.PixmapCache.getIcon("editUncomment"), 1274 UI.PixmapCache.getIcon("editUncomment"),
1121 QCoreApplication.translate('ViewManager', 'Unco&mment'), 1275 QCoreApplication.translate("ViewManager", "Unco&mment"),
1122 QKeySequence(QCoreApplication.translate( 1276 QKeySequence(
1123 'ViewManager', "Ctrl+Shift+M", "Edit|Uncomment")), 1277 QCoreApplication.translate(
1124 0, 1278 "ViewManager", "Ctrl+Shift+M", "Edit|Uncomment"
1125 self.editActGrp, 'vm_edit_uncomment') 1279 )
1126 self.uncommentAct.setStatusTip(QCoreApplication.translate( 1280 ),
1127 'ViewManager', 'Uncomment Line or Selection')) 1281 0,
1128 self.uncommentAct.setWhatsThis(QCoreApplication.translate( 1282 self.editActGrp,
1129 'ViewManager', 1283 "vm_edit_uncomment",
1130 """<b>Uncomment</b>""" 1284 )
1131 """<p>Uncomments the current line or the lines of the""" 1285 self.uncommentAct.setStatusTip(
1132 """ current selection.</p>""" 1286 QCoreApplication.translate("ViewManager", "Uncomment Line or Selection")
1133 )) 1287 )
1288 self.uncommentAct.setWhatsThis(
1289 QCoreApplication.translate(
1290 "ViewManager",
1291 """<b>Uncomment</b>"""
1292 """<p>Uncomments the current line or the lines of the"""
1293 """ current selection.</p>""",
1294 )
1295 )
1134 self.uncommentAct.triggered.connect(self.__editUncomment) 1296 self.uncommentAct.triggered.connect(self.__editUncomment)
1135 self.editActions.append(self.uncommentAct) 1297 self.editActions.append(self.uncommentAct)
1136 1298
1137 self.toggleCommentAct = EricAction( 1299 self.toggleCommentAct = EricAction(
1138 QCoreApplication.translate('ViewManager', 'Toggle Comment'), 1300 QCoreApplication.translate("ViewManager", "Toggle Comment"),
1139 UI.PixmapCache.getIcon("editToggleComment"), 1301 UI.PixmapCache.getIcon("editToggleComment"),
1140 QCoreApplication.translate('ViewManager', 'Toggle Comment'), 1302 QCoreApplication.translate("ViewManager", "Toggle Comment"),
1141 QKeySequence(QCoreApplication.translate( 1303 QKeySequence(
1142 'ViewManager', "Ctrl+#", "Edit|Toggle Comment")), 1304 QCoreApplication.translate(
1143 0, 1305 "ViewManager", "Ctrl+#", "Edit|Toggle Comment"
1144 self.editActGrp, 'vm_edit_toggle_comment') 1306 )
1145 self.toggleCommentAct.setStatusTip(QCoreApplication.translate( 1307 ),
1146 'ViewManager', 1308 0,
1147 'Toggle the comment of the current line, selection or' 1309 self.editActGrp,
1148 ' comment block')) 1310 "vm_edit_toggle_comment",
1149 self.toggleCommentAct.setWhatsThis(QCoreApplication.translate( 1311 )
1150 'ViewManager', 1312 self.toggleCommentAct.setStatusTip(
1151 """<b>Toggle Comment</b>""" 1313 QCoreApplication.translate(
1152 """<p>If the current line does not start with a block comment,""" 1314 "ViewManager",
1153 """ the current line or selection is commented. If it is already""" 1315 "Toggle the comment of the current line, selection or" " comment block",
1154 """ commented, this comment block is uncommented. </p>""" 1316 )
1155 )) 1317 )
1318 self.toggleCommentAct.setWhatsThis(
1319 QCoreApplication.translate(
1320 "ViewManager",
1321 """<b>Toggle Comment</b>"""
1322 """<p>If the current line does not start with a block comment,"""
1323 """ the current line or selection is commented. If it is already"""
1324 """ commented, this comment block is uncommented. </p>""",
1325 )
1326 )
1156 self.toggleCommentAct.triggered.connect(self.__editToggleComment) 1327 self.toggleCommentAct.triggered.connect(self.__editToggleComment)
1157 self.editActions.append(self.toggleCommentAct) 1328 self.editActions.append(self.toggleCommentAct)
1158 1329
1159 self.streamCommentAct = EricAction( 1330 self.streamCommentAct = EricAction(
1160 QCoreApplication.translate('ViewManager', 'Stream Comment'), 1331 QCoreApplication.translate("ViewManager", "Stream Comment"),
1161 QCoreApplication.translate('ViewManager', 'Stream Comment'), 1332 QCoreApplication.translate("ViewManager", "Stream Comment"),
1162 0, 0, 1333 0,
1163 self.editActGrp, 'vm_edit_stream_comment') 1334 0,
1164 self.streamCommentAct.setStatusTip(QCoreApplication.translate( 1335 self.editActGrp,
1165 'ViewManager', 1336 "vm_edit_stream_comment",
1166 'Stream Comment Line or Selection')) 1337 )
1167 self.streamCommentAct.setWhatsThis(QCoreApplication.translate( 1338 self.streamCommentAct.setStatusTip(
1168 'ViewManager', 1339 QCoreApplication.translate(
1169 """<b>Stream Comment</b>""" 1340 "ViewManager", "Stream Comment Line or Selection"
1170 """<p>Stream comments the current line or the current""" 1341 )
1171 """ selection.</p>""" 1342 )
1172 )) 1343 self.streamCommentAct.setWhatsThis(
1344 QCoreApplication.translate(
1345 "ViewManager",
1346 """<b>Stream Comment</b>"""
1347 """<p>Stream comments the current line or the current"""
1348 """ selection.</p>""",
1349 )
1350 )
1173 self.streamCommentAct.triggered.connect(self.__editStreamComment) 1351 self.streamCommentAct.triggered.connect(self.__editStreamComment)
1174 self.editActions.append(self.streamCommentAct) 1352 self.editActions.append(self.streamCommentAct)
1175 1353
1176 self.boxCommentAct = EricAction( 1354 self.boxCommentAct = EricAction(
1177 QCoreApplication.translate('ViewManager', 'Box Comment'), 1355 QCoreApplication.translate("ViewManager", "Box Comment"),
1178 QCoreApplication.translate('ViewManager', 'Box Comment'), 1356 QCoreApplication.translate("ViewManager", "Box Comment"),
1179 0, 0, 1357 0,
1180 self.editActGrp, 'vm_edit_box_comment') 1358 0,
1181 self.boxCommentAct.setStatusTip(QCoreApplication.translate( 1359 self.editActGrp,
1182 'ViewManager', 'Box Comment Line or Selection')) 1360 "vm_edit_box_comment",
1183 self.boxCommentAct.setWhatsThis(QCoreApplication.translate( 1361 )
1184 'ViewManager', 1362 self.boxCommentAct.setStatusTip(
1185 """<b>Box Comment</b>""" 1363 QCoreApplication.translate("ViewManager", "Box Comment Line or Selection")
1186 """<p>Box comments the current line or the lines of the""" 1364 )
1187 """ current selection.</p>""" 1365 self.boxCommentAct.setWhatsThis(
1188 )) 1366 QCoreApplication.translate(
1367 "ViewManager",
1368 """<b>Box Comment</b>"""
1369 """<p>Box comments the current line or the lines of the"""
1370 """ current selection.</p>""",
1371 )
1372 )
1189 self.boxCommentAct.triggered.connect(self.__editBoxComment) 1373 self.boxCommentAct.triggered.connect(self.__editBoxComment)
1190 self.editActions.append(self.boxCommentAct) 1374 self.editActions.append(self.boxCommentAct)
1191 1375
1192 self.selectBraceAct = EricAction( 1376 self.selectBraceAct = EricAction(
1193 QCoreApplication.translate('ViewManager', 'Select to brace'), 1377 QCoreApplication.translate("ViewManager", "Select to brace"),
1194 QCoreApplication.translate('ViewManager', 'Select to &brace'), 1378 QCoreApplication.translate("ViewManager", "Select to &brace"),
1195 QKeySequence(QCoreApplication.translate( 1379 QKeySequence(
1196 'ViewManager', "Ctrl+E", "Edit|Select to brace")), 1380 QCoreApplication.translate(
1197 0, 1381 "ViewManager", "Ctrl+E", "Edit|Select to brace"
1198 self.editActGrp, 'vm_edit_select_to_brace') 1382 )
1199 self.selectBraceAct.setStatusTip(QCoreApplication.translate( 1383 ),
1200 'ViewManager', 'Select text to the matching brace')) 1384 0,
1201 self.selectBraceAct.setWhatsThis(QCoreApplication.translate( 1385 self.editActGrp,
1202 'ViewManager', 1386 "vm_edit_select_to_brace",
1203 """<b>Select to brace</b>""" 1387 )
1204 """<p>Select text of the current editor to the matching""" 1388 self.selectBraceAct.setStatusTip(
1205 """ brace.</p>""" 1389 QCoreApplication.translate(
1206 )) 1390 "ViewManager", "Select text to the matching brace"
1391 )
1392 )
1393 self.selectBraceAct.setWhatsThis(
1394 QCoreApplication.translate(
1395 "ViewManager",
1396 """<b>Select to brace</b>"""
1397 """<p>Select text of the current editor to the matching"""
1398 """ brace.</p>""",
1399 )
1400 )
1207 self.selectBraceAct.triggered.connect(self.__editSelectBrace) 1401 self.selectBraceAct.triggered.connect(self.__editSelectBrace)
1208 self.editActions.append(self.selectBraceAct) 1402 self.editActions.append(self.selectBraceAct)
1209 1403
1210 self.selectAllAct = EricAction( 1404 self.selectAllAct = EricAction(
1211 QCoreApplication.translate('ViewManager', 'Select all'), 1405 QCoreApplication.translate("ViewManager", "Select all"),
1212 UI.PixmapCache.getIcon("editSelectAll"), 1406 UI.PixmapCache.getIcon("editSelectAll"),
1213 QCoreApplication.translate('ViewManager', '&Select all'), 1407 QCoreApplication.translate("ViewManager", "&Select all"),
1214 QKeySequence(QCoreApplication.translate( 1408 QKeySequence(
1215 'ViewManager', "Ctrl+A", "Edit|Select all")), 1409 QCoreApplication.translate("ViewManager", "Ctrl+A", "Edit|Select all")
1216 0, 1410 ),
1217 self.editActGrp, 'vm_edit_select_all') 1411 0,
1218 self.selectAllAct.setStatusTip(QCoreApplication.translate( 1412 self.editActGrp,
1219 'ViewManager', 'Select all text')) 1413 "vm_edit_select_all",
1220 self.selectAllAct.setWhatsThis(QCoreApplication.translate( 1414 )
1221 'ViewManager', 1415 self.selectAllAct.setStatusTip(
1222 """<b>Select All</b>""" 1416 QCoreApplication.translate("ViewManager", "Select all text")
1223 """<p>Select all text of the current editor.</p>""" 1417 )
1224 )) 1418 self.selectAllAct.setWhatsThis(
1419 QCoreApplication.translate(
1420 "ViewManager",
1421 """<b>Select All</b>"""
1422 """<p>Select all text of the current editor.</p>""",
1423 )
1424 )
1225 self.selectAllAct.triggered.connect(self.__editSelectAll) 1425 self.selectAllAct.triggered.connect(self.__editSelectAll)
1226 self.editActions.append(self.selectAllAct) 1426 self.editActions.append(self.selectAllAct)
1227 1427
1228 self.deselectAllAct = EricAction( 1428 self.deselectAllAct = EricAction(
1229 QCoreApplication.translate('ViewManager', 'Deselect all'), 1429 QCoreApplication.translate("ViewManager", "Deselect all"),
1230 QCoreApplication.translate('ViewManager', '&Deselect all'), 1430 QCoreApplication.translate("ViewManager", "&Deselect all"),
1231 QKeySequence(QCoreApplication.translate( 1431 QKeySequence(
1232 'ViewManager', "Alt+Ctrl+A", "Edit|Deselect all")), 1432 QCoreApplication.translate(
1233 0, 1433 "ViewManager", "Alt+Ctrl+A", "Edit|Deselect all"
1234 self.editActGrp, 'vm_edit_deselect_all') 1434 )
1235 self.deselectAllAct.setStatusTip(QCoreApplication.translate( 1435 ),
1236 'ViewManager', 'Deselect all text')) 1436 0,
1237 self.deselectAllAct.setWhatsThis(QCoreApplication.translate( 1437 self.editActGrp,
1238 'ViewManager', 1438 "vm_edit_deselect_all",
1239 """<b>Deselect All</b>""" 1439 )
1240 """<p>Deselect all text of the current editor.</p>""" 1440 self.deselectAllAct.setStatusTip(
1241 )) 1441 QCoreApplication.translate("ViewManager", "Deselect all text")
1442 )
1443 self.deselectAllAct.setWhatsThis(
1444 QCoreApplication.translate(
1445 "ViewManager",
1446 """<b>Deselect All</b>"""
1447 """<p>Deselect all text of the current editor.</p>""",
1448 )
1449 )
1242 self.deselectAllAct.triggered.connect(self.__editDeselectAll) 1450 self.deselectAllAct.triggered.connect(self.__editDeselectAll)
1243 self.editActions.append(self.deselectAllAct) 1451 self.editActions.append(self.deselectAllAct)
1244 1452
1245 self.convertEOLAct = EricAction( 1453 self.convertEOLAct = EricAction(
1246 QCoreApplication.translate( 1454 QCoreApplication.translate("ViewManager", "Convert Line End Characters"),
1247 'ViewManager', 'Convert Line End Characters'), 1455 QCoreApplication.translate("ViewManager", "Convert &Line End Characters"),
1248 QCoreApplication.translate( 1456 0,
1249 'ViewManager', 'Convert &Line End Characters'), 1457 0,
1250 0, 0, 1458 self.editActGrp,
1251 self.editActGrp, 'vm_edit_convert_eol') 1459 "vm_edit_convert_eol",
1252 self.convertEOLAct.setStatusTip(QCoreApplication.translate( 1460 )
1253 'ViewManager', 'Convert Line End Characters')) 1461 self.convertEOLAct.setStatusTip(
1254 self.convertEOLAct.setWhatsThis(QCoreApplication.translate( 1462 QCoreApplication.translate("ViewManager", "Convert Line End Characters")
1255 'ViewManager', 1463 )
1256 """<b>Convert Line End Characters</b>""" 1464 self.convertEOLAct.setWhatsThis(
1257 """<p>Convert the line end characters to the currently set""" 1465 QCoreApplication.translate(
1258 """ type.</p>""" 1466 "ViewManager",
1259 )) 1467 """<b>Convert Line End Characters</b>"""
1468 """<p>Convert the line end characters to the currently set"""
1469 """ type.</p>""",
1470 )
1471 )
1260 self.convertEOLAct.triggered.connect(self.__convertEOL) 1472 self.convertEOLAct.triggered.connect(self.__convertEOL)
1261 self.editActions.append(self.convertEOLAct) 1473 self.editActions.append(self.convertEOLAct)
1262 1474
1263 self.shortenEmptyAct = EricAction( 1475 self.shortenEmptyAct = EricAction(
1264 QCoreApplication.translate('ViewManager', 'Shorten empty lines'), 1476 QCoreApplication.translate("ViewManager", "Shorten empty lines"),
1265 QCoreApplication.translate('ViewManager', 'Shorten empty lines'), 1477 QCoreApplication.translate("ViewManager", "Shorten empty lines"),
1266 0, 0, 1478 0,
1267 self.editActGrp, 'vm_edit_shorten_empty_lines') 1479 0,
1268 self.shortenEmptyAct.setStatusTip(QCoreApplication.translate( 1480 self.editActGrp,
1269 'ViewManager', 'Shorten empty lines')) 1481 "vm_edit_shorten_empty_lines",
1270 self.shortenEmptyAct.setWhatsThis(QCoreApplication.translate( 1482 )
1271 'ViewManager', 1483 self.shortenEmptyAct.setStatusTip(
1272 """<b>Shorten empty lines</b>""" 1484 QCoreApplication.translate("ViewManager", "Shorten empty lines")
1273 """<p>Shorten lines consisting solely of whitespace""" 1485 )
1274 """ characters.</p>""" 1486 self.shortenEmptyAct.setWhatsThis(
1275 )) 1487 QCoreApplication.translate(
1488 "ViewManager",
1489 """<b>Shorten empty lines</b>"""
1490 """<p>Shorten lines consisting solely of whitespace"""
1491 """ characters.</p>""",
1492 )
1493 )
1276 self.shortenEmptyAct.triggered.connect(self.__shortenEmptyLines) 1494 self.shortenEmptyAct.triggered.connect(self.__shortenEmptyLines)
1277 self.editActions.append(self.shortenEmptyAct) 1495 self.editActions.append(self.shortenEmptyAct)
1278 1496
1279 self.autoCompleteAct = EricAction( 1497 self.autoCompleteAct = EricAction(
1280 QCoreApplication.translate('ViewManager', 'Complete'), 1498 QCoreApplication.translate("ViewManager", "Complete"),
1281 QCoreApplication.translate('ViewManager', '&Complete'), 1499 QCoreApplication.translate("ViewManager", "&Complete"),
1282 QKeySequence(QCoreApplication.translate( 1500 QKeySequence(
1283 'ViewManager', "Ctrl+Space", "Edit|Complete")), 1501 QCoreApplication.translate("ViewManager", "Ctrl+Space", "Edit|Complete")
1284 0, 1502 ),
1285 self.editActGrp, 'vm_edit_autocomplete') 1503 0,
1286 self.autoCompleteAct.setStatusTip(QCoreApplication.translate( 1504 self.editActGrp,
1287 'ViewManager', 'Complete current word')) 1505 "vm_edit_autocomplete",
1288 self.autoCompleteAct.setWhatsThis(QCoreApplication.translate( 1506 )
1289 'ViewManager', 1507 self.autoCompleteAct.setStatusTip(
1290 """<b>Complete</b>""" 1508 QCoreApplication.translate("ViewManager", "Complete current word")
1291 """<p>Performs a completion of the word containing""" 1509 )
1292 """ the cursor.</p>""" 1510 self.autoCompleteAct.setWhatsThis(
1293 )) 1511 QCoreApplication.translate(
1512 "ViewManager",
1513 """<b>Complete</b>"""
1514 """<p>Performs a completion of the word containing"""
1515 """ the cursor.</p>""",
1516 )
1517 )
1294 self.autoCompleteAct.triggered.connect(self.__editAutoComplete) 1518 self.autoCompleteAct.triggered.connect(self.__editAutoComplete)
1295 self.editActions.append(self.autoCompleteAct) 1519 self.editActions.append(self.autoCompleteAct)
1296 1520
1297 self.autoCompleteFromDocAct = EricAction( 1521 self.autoCompleteFromDocAct = EricAction(
1298 QCoreApplication.translate( 1522 QCoreApplication.translate("ViewManager", "Complete from Document"),
1299 'ViewManager', 'Complete from Document'), 1523 QCoreApplication.translate("ViewManager", "Complete from Document"),
1300 QCoreApplication.translate( 1524 QKeySequence(
1301 'ViewManager', 'Complete from Document'), 1525 QCoreApplication.translate(
1302 QKeySequence(QCoreApplication.translate( 1526 "ViewManager", "Ctrl+Shift+Space", "Edit|Complete from Document"
1303 'ViewManager', "Ctrl+Shift+Space", 1527 )
1304 "Edit|Complete from Document")), 1528 ),
1305 0, 1529 0,
1306 self.editActGrp, 'vm_edit_autocomplete_from_document') 1530 self.editActGrp,
1307 self.autoCompleteFromDocAct.setStatusTip(QCoreApplication.translate( 1531 "vm_edit_autocomplete_from_document",
1308 'ViewManager', 1532 )
1309 'Complete current word from Document')) 1533 self.autoCompleteFromDocAct.setStatusTip(
1310 self.autoCompleteFromDocAct.setWhatsThis(QCoreApplication.translate( 1534 QCoreApplication.translate(
1311 'ViewManager', 1535 "ViewManager", "Complete current word from Document"
1312 """<b>Complete from Document</b>""" 1536 )
1313 """<p>Performs a completion from document of the word""" 1537 )
1314 """ containing the cursor.</p>""" 1538 self.autoCompleteFromDocAct.setWhatsThis(
1315 )) 1539 QCoreApplication.translate(
1316 self.autoCompleteFromDocAct.triggered.connect( 1540 "ViewManager",
1317 self.__editAutoCompleteFromDoc) 1541 """<b>Complete from Document</b>"""
1542 """<p>Performs a completion from document of the word"""
1543 """ containing the cursor.</p>""",
1544 )
1545 )
1546 self.autoCompleteFromDocAct.triggered.connect(self.__editAutoCompleteFromDoc)
1318 self.editActions.append(self.autoCompleteFromDocAct) 1547 self.editActions.append(self.autoCompleteFromDocAct)
1319 1548
1320 self.autoCompleteFromAPIsAct = EricAction( 1549 self.autoCompleteFromAPIsAct = EricAction(
1321 QCoreApplication.translate('ViewManager', 1550 QCoreApplication.translate("ViewManager", "Complete from APIs"),
1322 'Complete from APIs'), 1551 QCoreApplication.translate("ViewManager", "Complete from APIs"),
1323 QCoreApplication.translate('ViewManager', 1552 QKeySequence(
1324 'Complete from APIs'), 1553 QCoreApplication.translate(
1325 QKeySequence(QCoreApplication.translate( 1554 "ViewManager", "Ctrl+Alt+Space", "Edit|Complete from APIs"
1326 'ViewManager', "Ctrl+Alt+Space", 1555 )
1327 "Edit|Complete from APIs")), 1556 ),
1328 0, 1557 0,
1329 self.editActGrp, 'vm_edit_autocomplete_from_api') 1558 self.editActGrp,
1330 self.autoCompleteFromAPIsAct.setStatusTip(QCoreApplication.translate( 1559 "vm_edit_autocomplete_from_api",
1331 'ViewManager', 1560 )
1332 'Complete current word from APIs')) 1561 self.autoCompleteFromAPIsAct.setStatusTip(
1333 self.autoCompleteFromAPIsAct.setWhatsThis(QCoreApplication.translate( 1562 QCoreApplication.translate("ViewManager", "Complete current word from APIs")
1334 'ViewManager', 1563 )
1335 """<b>Complete from APIs</b>""" 1564 self.autoCompleteFromAPIsAct.setWhatsThis(
1336 """<p>Performs a completion from APIs of the word""" 1565 QCoreApplication.translate(
1337 """ containing the cursor.</p>""" 1566 "ViewManager",
1338 )) 1567 """<b>Complete from APIs</b>"""
1339 self.autoCompleteFromAPIsAct.triggered.connect( 1568 """<p>Performs a completion from APIs of the word"""
1340 self.__editAutoCompleteFromAPIs) 1569 """ containing the cursor.</p>""",
1570 )
1571 )
1572 self.autoCompleteFromAPIsAct.triggered.connect(self.__editAutoCompleteFromAPIs)
1341 self.editActions.append(self.autoCompleteFromAPIsAct) 1573 self.editActions.append(self.autoCompleteFromAPIsAct)
1342 1574
1343 self.autoCompleteFromAllAct = EricAction( 1575 self.autoCompleteFromAllAct = EricAction(
1344 QCoreApplication.translate( 1576 QCoreApplication.translate(
1345 'ViewManager', 'Complete from Document and APIs'), 1577 "ViewManager", "Complete from Document and APIs"
1346 QCoreApplication.translate( 1578 ),
1347 'ViewManager', 'Complete from Document and APIs'), 1579 QCoreApplication.translate(
1348 QKeySequence(QCoreApplication.translate( 1580 "ViewManager", "Complete from Document and APIs"
1349 'ViewManager', "Alt+Shift+Space", 1581 ),
1350 "Edit|Complete from Document and APIs")), 1582 QKeySequence(
1351 0, 1583 QCoreApplication.translate(
1352 self.editActGrp, 'vm_edit_autocomplete_from_all') 1584 "ViewManager",
1353 self.autoCompleteFromAllAct.setStatusTip(QCoreApplication.translate( 1585 "Alt+Shift+Space",
1354 'ViewManager', 1586 "Edit|Complete from Document and APIs",
1355 'Complete current word from Document and APIs')) 1587 )
1356 self.autoCompleteFromAllAct.setWhatsThis(QCoreApplication.translate( 1588 ),
1357 'ViewManager', 1589 0,
1358 """<b>Complete from Document and APIs</b>""" 1590 self.editActGrp,
1359 """<p>Performs a completion from document and APIs""" 1591 "vm_edit_autocomplete_from_all",
1360 """ of the word containing the cursor.</p>""" 1592 )
1361 )) 1593 self.autoCompleteFromAllAct.setStatusTip(
1362 self.autoCompleteFromAllAct.triggered.connect( 1594 QCoreApplication.translate(
1363 self.__editAutoCompleteFromAll) 1595 "ViewManager", "Complete current word from Document and APIs"
1596 )
1597 )
1598 self.autoCompleteFromAllAct.setWhatsThis(
1599 QCoreApplication.translate(
1600 "ViewManager",
1601 """<b>Complete from Document and APIs</b>"""
1602 """<p>Performs a completion from document and APIs"""
1603 """ of the word containing the cursor.</p>""",
1604 )
1605 )
1606 self.autoCompleteFromAllAct.triggered.connect(self.__editAutoCompleteFromAll)
1364 self.editActions.append(self.autoCompleteFromAllAct) 1607 self.editActions.append(self.autoCompleteFromAllAct)
1365 1608
1366 self.calltipsAct = EricAction( 1609 self.calltipsAct = EricAction(
1367 QCoreApplication.translate('ViewManager', 'Calltip'), 1610 QCoreApplication.translate("ViewManager", "Calltip"),
1368 QCoreApplication.translate('ViewManager', '&Calltip'), 1611 QCoreApplication.translate("ViewManager", "&Calltip"),
1369 QKeySequence(QCoreApplication.translate( 1612 QKeySequence(
1370 'ViewManager', "Meta+Alt+Space", "Edit|Calltip")), 1613 QCoreApplication.translate(
1371 0, 1614 "ViewManager", "Meta+Alt+Space", "Edit|Calltip"
1372 self.editActGrp, 'vm_edit_calltip') 1615 )
1373 self.calltipsAct.setStatusTip(QCoreApplication.translate( 1616 ),
1374 'ViewManager', 'Show Calltips')) 1617 0,
1375 self.calltipsAct.setWhatsThis(QCoreApplication.translate( 1618 self.editActGrp,
1376 'ViewManager', 1619 "vm_edit_calltip",
1377 """<b>Calltip</b>""" 1620 )
1378 """<p>Show calltips based on the characters immediately to the""" 1621 self.calltipsAct.setStatusTip(
1379 """ left of the cursor.</p>""" 1622 QCoreApplication.translate("ViewManager", "Show Calltips")
1380 )) 1623 )
1624 self.calltipsAct.setWhatsThis(
1625 QCoreApplication.translate(
1626 "ViewManager",
1627 """<b>Calltip</b>"""
1628 """<p>Show calltips based on the characters immediately to the"""
1629 """ left of the cursor.</p>""",
1630 )
1631 )
1381 self.calltipsAct.triggered.connect(self.__editShowCallTips) 1632 self.calltipsAct.triggered.connect(self.__editShowCallTips)
1382 self.editActions.append(self.calltipsAct) 1633 self.editActions.append(self.calltipsAct)
1383 1634
1384 self.codeInfoAct = EricAction( 1635 self.codeInfoAct = EricAction(
1385 QCoreApplication.translate('ViewManager', 'Code Info'), 1636 QCoreApplication.translate("ViewManager", "Code Info"),
1386 UI.PixmapCache.getIcon("codeDocuViewer"), 1637 UI.PixmapCache.getIcon("codeDocuViewer"),
1387 QCoreApplication.translate('ViewManager', 'Code Info'), 1638 QCoreApplication.translate("ViewManager", "Code Info"),
1388 QKeySequence(QCoreApplication.translate( 1639 QKeySequence(
1389 'ViewManager', "Ctrl+Alt+I", "Edit|Code Info")), 1640 QCoreApplication.translate(
1390 0, 1641 "ViewManager", "Ctrl+Alt+I", "Edit|Code Info"
1391 self.editActGrp, 'vm_edit_codeinfo') 1642 )
1392 self.codeInfoAct.setStatusTip(QCoreApplication.translate( 1643 ),
1393 'ViewManager', 'Show Code Info')) 1644 0,
1394 self.codeInfoAct.setWhatsThis(QCoreApplication.translate( 1645 self.editActGrp,
1395 'ViewManager', 1646 "vm_edit_codeinfo",
1396 """<b>Code Info</b>""" 1647 )
1397 """<p>Show code information based on the cursor position.</p>""" 1648 self.codeInfoAct.setStatusTip(
1398 )) 1649 QCoreApplication.translate("ViewManager", "Show Code Info")
1650 )
1651 self.codeInfoAct.setWhatsThis(
1652 QCoreApplication.translate(
1653 "ViewManager",
1654 """<b>Code Info</b>"""
1655 """<p>Show code information based on the cursor position.</p>""",
1656 )
1657 )
1399 self.codeInfoAct.triggered.connect(self.__editShowCodeInfo) 1658 self.codeInfoAct.triggered.connect(self.__editShowCodeInfo)
1400 self.editActions.append(self.codeInfoAct) 1659 self.editActions.append(self.codeInfoAct)
1401 1660
1402 self.sortAct = EricAction( 1661 self.sortAct = EricAction(
1403 QCoreApplication.translate('ViewManager', 'Sort'), 1662 QCoreApplication.translate("ViewManager", "Sort"),
1404 QCoreApplication.translate('ViewManager', 'Sort'), 1663 QCoreApplication.translate("ViewManager", "Sort"),
1405 QKeySequence(QCoreApplication.translate( 1664 QKeySequence(
1406 'ViewManager', "Ctrl+Alt+S", "Edit|Sort")), 1665 QCoreApplication.translate("ViewManager", "Ctrl+Alt+S", "Edit|Sort")
1407 0, 1666 ),
1408 self.editActGrp, 'vm_edit_sort') 1667 0,
1409 self.sortAct.setStatusTip(QCoreApplication.translate( 1668 self.editActGrp,
1410 'ViewManager', 1669 "vm_edit_sort",
1411 'Sort the lines containing the rectangular selection')) 1670 )
1412 self.sortAct.setWhatsThis(QCoreApplication.translate( 1671 self.sortAct.setStatusTip(
1413 'ViewManager', 1672 QCoreApplication.translate(
1414 """<b>Sort</b>""" 1673 "ViewManager", "Sort the lines containing the rectangular selection"
1415 """<p>Sort the lines spanned by a rectangular selection based on""" 1674 )
1416 """ the selection ignoring leading and trailing whitespace.</p>""" 1675 )
1417 )) 1676 self.sortAct.setWhatsThis(
1677 QCoreApplication.translate(
1678 "ViewManager",
1679 """<b>Sort</b>"""
1680 """<p>Sort the lines spanned by a rectangular selection based on"""
1681 """ the selection ignoring leading and trailing whitespace.</p>""",
1682 )
1683 )
1418 self.sortAct.triggered.connect(self.__editSortSelectedLines) 1684 self.sortAct.triggered.connect(self.__editSortSelectedLines)
1419 self.editActions.append(self.sortAct) 1685 self.editActions.append(self.sortAct)
1420 1686
1421 self.docstringAct = EricAction( 1687 self.docstringAct = EricAction(
1422 QCoreApplication.translate('ViewManager', 'Generate Docstring'), 1688 QCoreApplication.translate("ViewManager", "Generate Docstring"),
1423 QCoreApplication.translate('ViewManager', 'Generate Docstring'), 1689 QCoreApplication.translate("ViewManager", "Generate Docstring"),
1424 QKeySequence(QCoreApplication.translate( 1690 QKeySequence(
1425 'ViewManager', "Ctrl+Alt+D", "Edit|Generate Docstring")), 1691 QCoreApplication.translate(
1426 0, 1692 "ViewManager", "Ctrl+Alt+D", "Edit|Generate Docstring"
1427 self.editActGrp, 'vm_edit_generate_docstring') 1693 )
1428 self.docstringAct.setStatusTip(QCoreApplication.translate( 1694 ),
1429 'ViewManager', 1695 0,
1430 'Generate a docstring for the current function/method')) 1696 self.editActGrp,
1431 self.docstringAct.setWhatsThis(QCoreApplication.translate( 1697 "vm_edit_generate_docstring",
1432 'ViewManager', 1698 )
1433 """<b>Generate Docstring</b>""" 1699 self.docstringAct.setStatusTip(
1434 """<p>Generate a docstring for the current function/method if""" 1700 QCoreApplication.translate(
1435 """ the cursor is placed on the line starting the function""" 1701 "ViewManager", "Generate a docstring for the current function/method"
1436 """ definition or on the line thereafter. The docstring is""" 1702 )
1437 """ inserted at the appropriate position and the cursor is""" 1703 )
1438 """ placed at the end of the description line.</p>""" 1704 self.docstringAct.setWhatsThis(
1439 )) 1705 QCoreApplication.translate(
1706 "ViewManager",
1707 """<b>Generate Docstring</b>"""
1708 """<p>Generate a docstring for the current function/method if"""
1709 """ the cursor is placed on the line starting the function"""
1710 """ definition or on the line thereafter. The docstring is"""
1711 """ inserted at the appropriate position and the cursor is"""
1712 """ placed at the end of the description line.</p>""",
1713 )
1714 )
1440 self.docstringAct.triggered.connect(self.__editInsertDocstring) 1715 self.docstringAct.triggered.connect(self.__editInsertDocstring)
1441 self.editActions.append(self.docstringAct) 1716 self.editActions.append(self.docstringAct)
1442 1717
1443 self.editActGrp.setEnabled(False) 1718 self.editActGrp.setEnabled(False)
1444 self.copyActGrp.setEnabled(False) 1719 self.copyActGrp.setEnabled(False)
1445 1720
1446 #################################################################### 1721 ####################################################################
1447 ## Below follow the actions for QScintilla standard commands. 1722 ## Below follow the actions for QScintilla standard commands.
1448 #################################################################### 1723 ####################################################################
1449 1724
1450 self.esm = QSignalMapper(self) 1725 self.esm = QSignalMapper(self)
1451 self.esm.mappedInt.connect(self.__editorCommand) 1726 self.esm.mappedInt.connect(self.__editorCommand)
1452 1727
1453 self.editorActGrp = createActionGroup(self.editActGrp) 1728 self.editorActGrp = createActionGroup(self.editActGrp)
1454 1729
1455 act = EricAction( 1730 act = EricAction(
1456 QCoreApplication.translate('ViewManager', 1731 QCoreApplication.translate("ViewManager", "Move left one character"),
1457 'Move left one character'), 1732 QCoreApplication.translate("ViewManager", "Move left one character"),
1458 QCoreApplication.translate('ViewManager', 1733 QKeySequence(QCoreApplication.translate("ViewManager", "Left")),
1459 'Move left one character'), 1734 0,
1460 QKeySequence(QCoreApplication.translate('ViewManager', 'Left')), 0, 1735 self.editorActGrp,
1461 self.editorActGrp, 'vm_edit_move_left_char') 1736 "vm_edit_move_left_char",
1737 )
1462 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFT) 1738 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFT)
1463 if isMacPlatform(): 1739 if isMacPlatform():
1464 act.setAlternateShortcut(QKeySequence( 1740 act.setAlternateShortcut(
1465 QCoreApplication.translate('ViewManager', 'Meta+B'))) 1741 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+B"))
1742 )
1466 act.triggered.connect(self.esm.map) 1743 act.triggered.connect(self.esm.map)
1467 self.editActions.append(act) 1744 self.editActions.append(act)
1468 1745
1469 act = EricAction( 1746 act = EricAction(
1470 QCoreApplication.translate('ViewManager', 1747 QCoreApplication.translate("ViewManager", "Move right one character"),
1471 'Move right one character'), 1748 QCoreApplication.translate("ViewManager", "Move right one character"),
1472 QCoreApplication.translate('ViewManager', 1749 QKeySequence(QCoreApplication.translate("ViewManager", "Right")),
1473 'Move right one character'), 1750 0,
1474 QKeySequence(QCoreApplication.translate('ViewManager', 'Right')), 1751 self.editorActGrp,
1475 0, self.editorActGrp, 'vm_edit_move_right_char') 1752 "vm_edit_move_right_char",
1753 )
1476 if isMacPlatform(): 1754 if isMacPlatform():
1477 act.setAlternateShortcut(QKeySequence( 1755 act.setAlternateShortcut(
1478 QCoreApplication.translate('ViewManager', 'Meta+F'))) 1756 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+F"))
1757 )
1479 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHT) 1758 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHT)
1480 act.triggered.connect(self.esm.map) 1759 act.triggered.connect(self.esm.map)
1481 self.editActions.append(act) 1760 self.editActions.append(act)
1482 1761
1483 act = EricAction( 1762 act = EricAction(
1484 QCoreApplication.translate('ViewManager', 'Move up one line'), 1763 QCoreApplication.translate("ViewManager", "Move up one line"),
1485 QCoreApplication.translate('ViewManager', 'Move up one line'), 1764 QCoreApplication.translate("ViewManager", "Move up one line"),
1486 QKeySequence(QCoreApplication.translate('ViewManager', 'Up')), 0, 1765 QKeySequence(QCoreApplication.translate("ViewManager", "Up")),
1487 self.editorActGrp, 'vm_edit_move_up_line') 1766 0,
1767 self.editorActGrp,
1768 "vm_edit_move_up_line",
1769 )
1488 if isMacPlatform(): 1770 if isMacPlatform():
1489 act.setAlternateShortcut(QKeySequence( 1771 act.setAlternateShortcut(
1490 QCoreApplication.translate('ViewManager', 'Meta+P'))) 1772 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+P"))
1773 )
1491 self.esm.setMapping(act, QsciScintilla.SCI_LINEUP) 1774 self.esm.setMapping(act, QsciScintilla.SCI_LINEUP)
1492 act.triggered.connect(self.esm.map) 1775 act.triggered.connect(self.esm.map)
1493 self.editActions.append(act) 1776 self.editActions.append(act)
1494 1777
1495 act = EricAction( 1778 act = EricAction(
1496 QCoreApplication.translate('ViewManager', 'Move down one line'), 1779 QCoreApplication.translate("ViewManager", "Move down one line"),
1497 QCoreApplication.translate('ViewManager', 'Move down one line'), 1780 QCoreApplication.translate("ViewManager", "Move down one line"),
1498 QKeySequence(QCoreApplication.translate('ViewManager', 'Down')), 0, 1781 QKeySequence(QCoreApplication.translate("ViewManager", "Down")),
1499 self.editorActGrp, 'vm_edit_move_down_line') 1782 0,
1783 self.editorActGrp,
1784 "vm_edit_move_down_line",
1785 )
1500 if isMacPlatform(): 1786 if isMacPlatform():
1501 act.setAlternateShortcut(QKeySequence( 1787 act.setAlternateShortcut(
1502 QCoreApplication.translate('ViewManager', 'Meta+N'))) 1788 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+N"))
1789 )
1503 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWN) 1790 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWN)
1504 act.triggered.connect(self.esm.map) 1791 act.triggered.connect(self.esm.map)
1505 self.editActions.append(act) 1792 self.editActions.append(act)
1506 1793
1507 act = EricAction( 1794 act = EricAction(
1508 QCoreApplication.translate('ViewManager', 1795 QCoreApplication.translate("ViewManager", "Move left one word part"),
1509 'Move left one word part'), 1796 QCoreApplication.translate("ViewManager", "Move left one word part"),
1510 QCoreApplication.translate('ViewManager', 1797 0,
1511 'Move left one word part'), 1798 0,
1512 0, 0, 1799 self.editorActGrp,
1513 self.editorActGrp, 'vm_edit_move_left_word_part') 1800 "vm_edit_move_left_word_part",
1801 )
1514 if not isMacPlatform(): 1802 if not isMacPlatform():
1515 act.setShortcut(QKeySequence( 1803 act.setShortcut(
1516 QCoreApplication.translate('ViewManager', 'Alt+Left'))) 1804 QKeySequence(QCoreApplication.translate("ViewManager", "Alt+Left"))
1805 )
1517 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTLEFT) 1806 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTLEFT)
1518 act.triggered.connect(self.esm.map) 1807 act.triggered.connect(self.esm.map)
1519 self.editActions.append(act) 1808 self.editActions.append(act)
1520 1809
1521 act = EricAction( 1810 act = EricAction(
1522 QCoreApplication.translate('ViewManager', 1811 QCoreApplication.translate("ViewManager", "Move right one word part"),
1523 'Move right one word part'), 1812 QCoreApplication.translate("ViewManager", "Move right one word part"),
1524 QCoreApplication.translate('ViewManager', 1813 0,
1525 'Move right one word part'), 1814 0,
1526 0, 0, 1815 self.editorActGrp,
1527 self.editorActGrp, 'vm_edit_move_right_word_part') 1816 "vm_edit_move_right_word_part",
1817 )
1528 if not isMacPlatform(): 1818 if not isMacPlatform():
1529 act.setShortcut(QKeySequence( 1819 act.setShortcut(
1530 QCoreApplication.translate('ViewManager', 'Alt+Right'))) 1820 QKeySequence(QCoreApplication.translate("ViewManager", "Alt+Right"))
1821 )
1531 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTRIGHT) 1822 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTRIGHT)
1532 act.triggered.connect(self.esm.map) 1823 act.triggered.connect(self.esm.map)
1533 self.editActions.append(act) 1824 self.editActions.append(act)
1534 1825
1535 act = EricAction( 1826 act = EricAction(
1536 QCoreApplication.translate('ViewManager', 'Move left one word'), 1827 QCoreApplication.translate("ViewManager", "Move left one word"),
1537 QCoreApplication.translate('ViewManager', 'Move left one word'), 1828 QCoreApplication.translate("ViewManager", "Move left one word"),
1538 0, 0, 1829 0,
1539 self.editorActGrp, 'vm_edit_move_left_word') 1830 0,
1831 self.editorActGrp,
1832 "vm_edit_move_left_word",
1833 )
1540 if isMacPlatform(): 1834 if isMacPlatform():
1541 act.setShortcut(QKeySequence( 1835 act.setShortcut(
1542 QCoreApplication.translate('ViewManager', 'Alt+Left'))) 1836 QKeySequence(QCoreApplication.translate("ViewManager", "Alt+Left"))
1837 )
1543 else: 1838 else:
1544 act.setShortcut(QKeySequence( 1839 act.setShortcut(
1545 QCoreApplication.translate('ViewManager', 'Ctrl+Left'))) 1840 QKeySequence(QCoreApplication.translate("ViewManager", "Ctrl+Left"))
1841 )
1546 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFT) 1842 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFT)
1547 act.triggered.connect(self.esm.map) 1843 act.triggered.connect(self.esm.map)
1548 self.editActions.append(act) 1844 self.editActions.append(act)
1549 1845
1550 act = EricAction( 1846 act = EricAction(
1551 QCoreApplication.translate('ViewManager', 'Move right one word'), 1847 QCoreApplication.translate("ViewManager", "Move right one word"),
1552 QCoreApplication.translate('ViewManager', 'Move right one word'), 1848 QCoreApplication.translate("ViewManager", "Move right one word"),
1553 0, 0, 1849 0,
1554 self.editorActGrp, 'vm_edit_move_right_word') 1850 0,
1851 self.editorActGrp,
1852 "vm_edit_move_right_word",
1853 )
1555 if not isMacPlatform(): 1854 if not isMacPlatform():
1556 act.setShortcut(QKeySequence( 1855 act.setShortcut(
1557 QCoreApplication.translate('ViewManager', 'Ctrl+Right'))) 1856 QKeySequence(QCoreApplication.translate("ViewManager", "Ctrl+Right"))
1857 )
1558 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHT) 1858 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHT)
1559 act.triggered.connect(self.esm.map) 1859 act.triggered.connect(self.esm.map)
1560 self.editActions.append(act) 1860 self.editActions.append(act)
1561 1861
1562 act = EricAction( 1862 act = EricAction(
1563 QCoreApplication.translate( 1863 QCoreApplication.translate(
1564 'ViewManager', 1864 "ViewManager", "Move to first visible character in document line"
1565 'Move to first visible character in document line'), 1865 ),
1566 QCoreApplication.translate( 1866 QCoreApplication.translate(
1567 'ViewManager', 1867 "ViewManager", "Move to first visible character in document line"
1568 'Move to first visible character in document line'), 1868 ),
1569 0, 0, 1869 0,
1570 self.editorActGrp, 'vm_edit_move_first_visible_char') 1870 0,
1871 self.editorActGrp,
1872 "vm_edit_move_first_visible_char",
1873 )
1571 if not isMacPlatform(): 1874 if not isMacPlatform():
1572 act.setShortcut(QKeySequence( 1875 act.setShortcut(
1573 QCoreApplication.translate('ViewManager', 'Home'))) 1876 QKeySequence(QCoreApplication.translate("ViewManager", "Home"))
1877 )
1574 self.esm.setMapping(act, QsciScintilla.SCI_VCHOME) 1878 self.esm.setMapping(act, QsciScintilla.SCI_VCHOME)
1575 act.triggered.connect(self.esm.map) 1879 act.triggered.connect(self.esm.map)
1576 self.editActions.append(act) 1880 self.editActions.append(act)
1577 1881
1578 act = EricAction( 1882 act = EricAction(
1579 QCoreApplication.translate( 1883 QCoreApplication.translate("ViewManager", "Move to start of display line"),
1580 'ViewManager', 'Move to start of display line'), 1884 QCoreApplication.translate("ViewManager", "Move to start of display line"),
1581 QCoreApplication.translate( 1885 0,
1582 'ViewManager', 'Move to start of display line'), 1886 0,
1583 0, 0, 1887 self.editorActGrp,
1584 self.editorActGrp, 'vm_edit_move_start_line') 1888 "vm_edit_move_start_line",
1889 )
1585 if isMacPlatform(): 1890 if isMacPlatform():
1586 act.setShortcut(QKeySequence( 1891 act.setShortcut(
1587 QCoreApplication.translate('ViewManager', 'Ctrl+Left'))) 1892 QKeySequence(QCoreApplication.translate("ViewManager", "Ctrl+Left"))
1893 )
1588 else: 1894 else:
1589 act.setShortcut(QKeySequence( 1895 act.setShortcut(
1590 QCoreApplication.translate('ViewManager', 'Alt+Home'))) 1896 QKeySequence(QCoreApplication.translate("ViewManager", "Alt+Home"))
1897 )
1591 self.esm.setMapping(act, QsciScintilla.SCI_HOMEDISPLAY) 1898 self.esm.setMapping(act, QsciScintilla.SCI_HOMEDISPLAY)
1592 act.triggered.connect(self.esm.map) 1899 act.triggered.connect(self.esm.map)
1593 self.editActions.append(act) 1900 self.editActions.append(act)
1594 1901
1595 act = EricAction( 1902 act = EricAction(
1596 QCoreApplication.translate( 1903 QCoreApplication.translate("ViewManager", "Move to end of document line"),
1597 'ViewManager', 'Move to end of document line'), 1904 QCoreApplication.translate("ViewManager", "Move to end of document line"),
1598 QCoreApplication.translate( 1905 0,
1599 'ViewManager', 'Move to end of document line'), 1906 0,
1600 0, 0, 1907 self.editorActGrp,
1601 self.editorActGrp, 'vm_edit_move_end_line') 1908 "vm_edit_move_end_line",
1909 )
1602 if isMacPlatform(): 1910 if isMacPlatform():
1603 act.setShortcut(QKeySequence( 1911 act.setShortcut(
1604 QCoreApplication.translate('ViewManager', 'Meta+E'))) 1912 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+E"))
1913 )
1605 else: 1914 else:
1606 act.setShortcut(QKeySequence( 1915 act.setShortcut(
1607 QCoreApplication.translate('ViewManager', 'End'))) 1916 QKeySequence(QCoreApplication.translate("ViewManager", "End"))
1917 )
1608 self.esm.setMapping(act, QsciScintilla.SCI_LINEEND) 1918 self.esm.setMapping(act, QsciScintilla.SCI_LINEEND)
1609 act.triggered.connect(self.esm.map) 1919 act.triggered.connect(self.esm.map)
1610 self.editActions.append(act) 1920 self.editActions.append(act)
1611 1921
1612 act = EricAction( 1922 act = EricAction(
1613 QCoreApplication.translate('ViewManager', 1923 QCoreApplication.translate("ViewManager", "Scroll view down one line"),
1614 'Scroll view down one line'), 1924 QCoreApplication.translate("ViewManager", "Scroll view down one line"),
1615 QCoreApplication.translate('ViewManager', 1925 QKeySequence(QCoreApplication.translate("ViewManager", "Ctrl+Down")),
1616 'Scroll view down one line'), 1926 0,
1617 QKeySequence(QCoreApplication.translate('ViewManager', 1927 self.editorActGrp,
1618 'Ctrl+Down')), 1928 "vm_edit_scroll_down_line",
1619 0, self.editorActGrp, 'vm_edit_scroll_down_line') 1929 )
1620 self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLDOWN) 1930 self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLDOWN)
1621 act.triggered.connect(self.esm.map) 1931 act.triggered.connect(self.esm.map)
1622 self.editActions.append(act) 1932 self.editActions.append(act)
1623 1933
1624 act = EricAction( 1934 act = EricAction(
1625 QCoreApplication.translate('ViewManager', 1935 QCoreApplication.translate("ViewManager", "Scroll view up one line"),
1626 'Scroll view up one line'), 1936 QCoreApplication.translate("ViewManager", "Scroll view up one line"),
1627 QCoreApplication.translate('ViewManager', 1937 QKeySequence(QCoreApplication.translate("ViewManager", "Ctrl+Up")),
1628 'Scroll view up one line'), 1938 0,
1629 QKeySequence(QCoreApplication.translate('ViewManager', 'Ctrl+Up')), 1939 self.editorActGrp,
1630 0, self.editorActGrp, 'vm_edit_scroll_up_line') 1940 "vm_edit_scroll_up_line",
1941 )
1631 self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLUP) 1942 self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLUP)
1632 act.triggered.connect(self.esm.map) 1943 act.triggered.connect(self.esm.map)
1633 self.editActions.append(act) 1944 self.editActions.append(act)
1634 1945
1635 act = EricAction( 1946 act = EricAction(
1636 QCoreApplication.translate('ViewManager', 'Move up one paragraph'), 1947 QCoreApplication.translate("ViewManager", "Move up one paragraph"),
1637 QCoreApplication.translate('ViewManager', 'Move up one paragraph'), 1948 QCoreApplication.translate("ViewManager", "Move up one paragraph"),
1638 QKeySequence(QCoreApplication.translate('ViewManager', 'Alt+Up')), 1949 QKeySequence(QCoreApplication.translate("ViewManager", "Alt+Up")),
1639 0, self.editorActGrp, 'vm_edit_move_up_para') 1950 0,
1951 self.editorActGrp,
1952 "vm_edit_move_up_para",
1953 )
1640 self.esm.setMapping(act, QsciScintilla.SCI_PARAUP) 1954 self.esm.setMapping(act, QsciScintilla.SCI_PARAUP)
1641 act.triggered.connect(self.esm.map) 1955 act.triggered.connect(self.esm.map)
1642 self.editActions.append(act) 1956 self.editActions.append(act)
1643 1957
1644 act = EricAction( 1958 act = EricAction(
1645 QCoreApplication.translate('ViewManager', 1959 QCoreApplication.translate("ViewManager", "Move down one paragraph"),
1646 'Move down one paragraph'), 1960 QCoreApplication.translate("ViewManager", "Move down one paragraph"),
1647 QCoreApplication.translate('ViewManager', 1961 QKeySequence(QCoreApplication.translate("ViewManager", "Alt+Down")),
1648 'Move down one paragraph'), 1962 0,
1649 QKeySequence(QCoreApplication.translate('ViewManager', 1963 self.editorActGrp,
1650 'Alt+Down')), 1964 "vm_edit_move_down_para",
1651 0, self.editorActGrp, 'vm_edit_move_down_para') 1965 )
1652 self.esm.setMapping(act, QsciScintilla.SCI_PARADOWN) 1966 self.esm.setMapping(act, QsciScintilla.SCI_PARADOWN)
1653 act.triggered.connect(self.esm.map) 1967 act.triggered.connect(self.esm.map)
1654 self.editActions.append(act) 1968 self.editActions.append(act)
1655 1969
1656 act = EricAction( 1970 act = EricAction(
1657 QCoreApplication.translate('ViewManager', 'Move up one page'), 1971 QCoreApplication.translate("ViewManager", "Move up one page"),
1658 QCoreApplication.translate('ViewManager', 'Move up one page'), 1972 QCoreApplication.translate("ViewManager", "Move up one page"),
1659 QKeySequence(QCoreApplication.translate('ViewManager', 'PgUp')), 0, 1973 QKeySequence(QCoreApplication.translate("ViewManager", "PgUp")),
1660 self.editorActGrp, 'vm_edit_move_up_page') 1974 0,
1975 self.editorActGrp,
1976 "vm_edit_move_up_page",
1977 )
1661 self.esm.setMapping(act, QsciScintilla.SCI_PAGEUP) 1978 self.esm.setMapping(act, QsciScintilla.SCI_PAGEUP)
1662 act.triggered.connect(self.esm.map) 1979 act.triggered.connect(self.esm.map)
1663 self.editActions.append(act) 1980 self.editActions.append(act)
1664 1981
1665 act = EricAction( 1982 act = EricAction(
1666 QCoreApplication.translate('ViewManager', 'Move down one page'), 1983 QCoreApplication.translate("ViewManager", "Move down one page"),
1667 QCoreApplication.translate('ViewManager', 'Move down one page'), 1984 QCoreApplication.translate("ViewManager", "Move down one page"),
1668 QKeySequence(QCoreApplication.translate('ViewManager', 'PgDown')), 1985 QKeySequence(QCoreApplication.translate("ViewManager", "PgDown")),
1669 0, self.editorActGrp, 'vm_edit_move_down_page') 1986 0,
1987 self.editorActGrp,
1988 "vm_edit_move_down_page",
1989 )
1670 if isMacPlatform(): 1990 if isMacPlatform():
1671 act.setAlternateShortcut(QKeySequence( 1991 act.setAlternateShortcut(
1672 QCoreApplication.translate('ViewManager', 'Meta+V'))) 1992 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+V"))
1993 )
1673 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWN) 1994 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWN)
1674 act.triggered.connect(self.esm.map) 1995 act.triggered.connect(self.esm.map)
1675 self.editActions.append(act) 1996 self.editActions.append(act)
1676 1997
1677 act = EricAction( 1998 act = EricAction(
1678 QCoreApplication.translate('ViewManager', 1999 QCoreApplication.translate("ViewManager", "Move to start of document"),
1679 'Move to start of document'), 2000 QCoreApplication.translate("ViewManager", "Move to start of document"),
1680 QCoreApplication.translate('ViewManager', 2001 0,
1681 'Move to start of document'), 2002 0,
1682 0, 0, 2003 self.editorActGrp,
1683 self.editorActGrp, 'vm_edit_move_start_text') 2004 "vm_edit_move_start_text",
2005 )
1684 if isMacPlatform(): 2006 if isMacPlatform():
1685 act.setShortcut(QKeySequence( 2007 act.setShortcut(
1686 QCoreApplication.translate('ViewManager', 'Ctrl+Up'))) 2008 QKeySequence(QCoreApplication.translate("ViewManager", "Ctrl+Up"))
2009 )
1687 else: 2010 else:
1688 act.setShortcut(QKeySequence( 2011 act.setShortcut(
1689 QCoreApplication.translate('ViewManager', 'Ctrl+Home'))) 2012 QKeySequence(QCoreApplication.translate("ViewManager", "Ctrl+Home"))
2013 )
1690 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTSTART) 2014 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTSTART)
1691 act.triggered.connect(self.esm.map) 2015 act.triggered.connect(self.esm.map)
1692 self.editActions.append(act) 2016 self.editActions.append(act)
1693 2017
1694 act = EricAction( 2018 act = EricAction(
1695 QCoreApplication.translate('ViewManager', 2019 QCoreApplication.translate("ViewManager", "Move to end of document"),
1696 'Move to end of document'), 2020 QCoreApplication.translate("ViewManager", "Move to end of document"),
1697 QCoreApplication.translate('ViewManager', 2021 0,
1698 'Move to end of document'), 2022 0,
1699 0, 0, 2023 self.editorActGrp,
1700 self.editorActGrp, 'vm_edit_move_end_text') 2024 "vm_edit_move_end_text",
2025 )
1701 if isMacPlatform(): 2026 if isMacPlatform():
1702 act.setShortcut(QKeySequence( 2027 act.setShortcut(
1703 QCoreApplication.translate('ViewManager', 'Ctrl+Down'))) 2028 QKeySequence(QCoreApplication.translate("ViewManager", "Ctrl+Down"))
2029 )
1704 else: 2030 else:
1705 act.setShortcut(QKeySequence( 2031 act.setShortcut(
1706 QCoreApplication.translate('ViewManager', 'Ctrl+End'))) 2032 QKeySequence(QCoreApplication.translate("ViewManager", "Ctrl+End"))
2033 )
1707 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTEND) 2034 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTEND)
1708 act.triggered.connect(self.esm.map) 2035 act.triggered.connect(self.esm.map)
1709 self.editActions.append(act) 2036 self.editActions.append(act)
1710 2037
1711 act = EricAction( 2038 act = EricAction(
1712 QCoreApplication.translate('ViewManager', 'Indent one level'), 2039 QCoreApplication.translate("ViewManager", "Indent one level"),
1713 QCoreApplication.translate('ViewManager', 'Indent one level'), 2040 QCoreApplication.translate("ViewManager", "Indent one level"),
1714 QKeySequence(QCoreApplication.translate('ViewManager', 'Tab')), 0, 2041 QKeySequence(QCoreApplication.translate("ViewManager", "Tab")),
1715 self.editorActGrp, 'vm_edit_indent_one_level') 2042 0,
2043 self.editorActGrp,
2044 "vm_edit_indent_one_level",
2045 )
1716 self.esm.setMapping(act, QsciScintilla.SCI_TAB) 2046 self.esm.setMapping(act, QsciScintilla.SCI_TAB)
1717 act.triggered.connect(self.esm.map) 2047 act.triggered.connect(self.esm.map)
1718 self.editActions.append(act) 2048 self.editActions.append(act)
1719 2049
1720 act = EricAction( 2050 act = EricAction(
1721 QCoreApplication.translate('ViewManager', 'Unindent one level'), 2051 QCoreApplication.translate("ViewManager", "Unindent one level"),
1722 QCoreApplication.translate('ViewManager', 'Unindent one level'), 2052 QCoreApplication.translate("ViewManager", "Unindent one level"),
1723 QKeySequence(QCoreApplication.translate('ViewManager', 2053 QKeySequence(QCoreApplication.translate("ViewManager", "Shift+Tab")),
1724 'Shift+Tab')), 2054 0,
1725 0, self.editorActGrp, 'vm_edit_unindent_one_level') 2055 self.editorActGrp,
2056 "vm_edit_unindent_one_level",
2057 )
1726 self.esm.setMapping(act, QsciScintilla.SCI_BACKTAB) 2058 self.esm.setMapping(act, QsciScintilla.SCI_BACKTAB)
1727 act.triggered.connect(self.esm.map) 2059 act.triggered.connect(self.esm.map)
1728 self.editActions.append(act) 2060 self.editActions.append(act)
1729 2061
1730 act = EricAction( 2062 act = EricAction(
1731 QCoreApplication.translate( 2063 QCoreApplication.translate(
1732 'ViewManager', 'Extend selection left one character'), 2064 "ViewManager", "Extend selection left one character"
1733 QCoreApplication.translate( 2065 ),
1734 'ViewManager', 'Extend selection left one character'), 2066 QCoreApplication.translate(
1735 QKeySequence(QCoreApplication.translate('ViewManager', 2067 "ViewManager", "Extend selection left one character"
1736 'Shift+Left')), 2068 ),
1737 0, self.editorActGrp, 'vm_edit_extend_selection_left_char') 2069 QKeySequence(QCoreApplication.translate("ViewManager", "Shift+Left")),
2070 0,
2071 self.editorActGrp,
2072 "vm_edit_extend_selection_left_char",
2073 )
1738 if isMacPlatform(): 2074 if isMacPlatform():
1739 act.setAlternateShortcut(QKeySequence( 2075 act.setAlternateShortcut(
1740 QCoreApplication.translate('ViewManager', 'Meta+Shift+B'))) 2076 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+Shift+B"))
2077 )
1741 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFTEXTEND) 2078 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFTEXTEND)
1742 act.triggered.connect(self.esm.map) 2079 act.triggered.connect(self.esm.map)
1743 self.editActions.append(act) 2080 self.editActions.append(act)
1744 2081
1745 act = EricAction( 2082 act = EricAction(
1746 QCoreApplication.translate( 2083 QCoreApplication.translate(
1747 'ViewManager', 'Extend selection right one character'), 2084 "ViewManager", "Extend selection right one character"
1748 QCoreApplication.translate( 2085 ),
1749 'ViewManager', 'Extend selection right one character'), 2086 QCoreApplication.translate(
1750 QKeySequence(QCoreApplication.translate('ViewManager', 2087 "ViewManager", "Extend selection right one character"
1751 'Shift+Right')), 2088 ),
1752 0, self.editorActGrp, 'vm_edit_extend_selection_right_char') 2089 QKeySequence(QCoreApplication.translate("ViewManager", "Shift+Right")),
2090 0,
2091 self.editorActGrp,
2092 "vm_edit_extend_selection_right_char",
2093 )
1753 if isMacPlatform(): 2094 if isMacPlatform():
1754 act.setAlternateShortcut(QKeySequence( 2095 act.setAlternateShortcut(
1755 QCoreApplication.translate('ViewManager', 'Meta+Shift+F'))) 2096 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+Shift+F"))
2097 )
1756 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHTEXTEND) 2098 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHTEXTEND)
1757 act.triggered.connect(self.esm.map) 2099 act.triggered.connect(self.esm.map)
1758 self.editActions.append(act) 2100 self.editActions.append(act)
1759 2101
1760 act = EricAction( 2102 act = EricAction(
1761 QCoreApplication.translate( 2103 QCoreApplication.translate("ViewManager", "Extend selection up one line"),
1762 'ViewManager', 'Extend selection up one line'), 2104 QCoreApplication.translate("ViewManager", "Extend selection up one line"),
1763 QCoreApplication.translate( 2105 QKeySequence(QCoreApplication.translate("ViewManager", "Shift+Up")),
1764 'ViewManager', 'Extend selection up one line'), 2106 0,
1765 QKeySequence(QCoreApplication.translate('ViewManager', 2107 self.editorActGrp,
1766 'Shift+Up')), 2108 "vm_edit_extend_selection_up_line",
1767 0, self.editorActGrp, 'vm_edit_extend_selection_up_line') 2109 )
1768 if isMacPlatform(): 2110 if isMacPlatform():
1769 act.setAlternateShortcut(QKeySequence( 2111 act.setAlternateShortcut(
1770 QCoreApplication.translate('ViewManager', 'Meta+Shift+P'))) 2112 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+Shift+P"))
2113 )
1771 self.esm.setMapping(act, QsciScintilla.SCI_LINEUPEXTEND) 2114 self.esm.setMapping(act, QsciScintilla.SCI_LINEUPEXTEND)
1772 act.triggered.connect(self.esm.map) 2115 act.triggered.connect(self.esm.map)
1773 self.editActions.append(act) 2116 self.editActions.append(act)
1774 2117
1775 act = EricAction( 2118 act = EricAction(
1776 QCoreApplication.translate( 2119 QCoreApplication.translate("ViewManager", "Extend selection down one line"),
1777 'ViewManager', 'Extend selection down one line'), 2120 QCoreApplication.translate("ViewManager", "Extend selection down one line"),
1778 QCoreApplication.translate( 2121 QKeySequence(QCoreApplication.translate("ViewManager", "Shift+Down")),
1779 'ViewManager', 'Extend selection down one line'), 2122 0,
1780 QKeySequence(QCoreApplication.translate('ViewManager', 2123 self.editorActGrp,
1781 'Shift+Down')), 2124 "vm_edit_extend_selection_down_line",
1782 0, self.editorActGrp, 'vm_edit_extend_selection_down_line') 2125 )
1783 if isMacPlatform(): 2126 if isMacPlatform():
1784 act.setAlternateShortcut(QKeySequence( 2127 act.setAlternateShortcut(
1785 QCoreApplication.translate('ViewManager', 'Meta+Shift+N'))) 2128 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+Shift+N"))
2129 )
1786 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWNEXTEND) 2130 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWNEXTEND)
1787 act.triggered.connect(self.esm.map) 2131 act.triggered.connect(self.esm.map)
1788 self.editActions.append(act) 2132 self.editActions.append(act)
1789 2133
1790 act = EricAction( 2134 act = EricAction(
1791 QCoreApplication.translate( 2135 QCoreApplication.translate(
1792 'ViewManager', 'Extend selection left one word part'), 2136 "ViewManager", "Extend selection left one word part"
1793 QCoreApplication.translate( 2137 ),
1794 'ViewManager', 'Extend selection left one word part'), 2138 QCoreApplication.translate(
1795 0, 0, 2139 "ViewManager", "Extend selection left one word part"
1796 self.editorActGrp, 'vm_edit_extend_selection_left_word_part') 2140 ),
2141 0,
2142 0,
2143 self.editorActGrp,
2144 "vm_edit_extend_selection_left_word_part",
2145 )
1797 if not isMacPlatform(): 2146 if not isMacPlatform():
1798 act.setShortcut(QKeySequence( 2147 act.setShortcut(
1799 QCoreApplication.translate('ViewManager', 'Alt+Shift+Left'))) 2148 QKeySequence(
2149 QCoreApplication.translate("ViewManager", "Alt+Shift+Left")
2150 )
2151 )
1800 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTLEFTEXTEND) 2152 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTLEFTEXTEND)
1801 act.triggered.connect(self.esm.map) 2153 act.triggered.connect(self.esm.map)
1802 self.editActions.append(act) 2154 self.editActions.append(act)
1803 2155
1804 act = EricAction( 2156 act = EricAction(
1805 QCoreApplication.translate( 2157 QCoreApplication.translate(
1806 'ViewManager', 'Extend selection right one word part'), 2158 "ViewManager", "Extend selection right one word part"
1807 QCoreApplication.translate( 2159 ),
1808 'ViewManager', 'Extend selection right one word part'), 2160 QCoreApplication.translate(
1809 0, 0, 2161 "ViewManager", "Extend selection right one word part"
1810 self.editorActGrp, 'vm_edit_extend_selection_right_word_part') 2162 ),
2163 0,
2164 0,
2165 self.editorActGrp,
2166 "vm_edit_extend_selection_right_word_part",
2167 )
1811 if not isMacPlatform(): 2168 if not isMacPlatform():
1812 act.setShortcut(QKeySequence( 2169 act.setShortcut(
1813 QCoreApplication.translate('ViewManager', 'Alt+Shift+Right'))) 2170 QKeySequence(
2171 QCoreApplication.translate("ViewManager", "Alt+Shift+Right")
2172 )
2173 )
1814 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTRIGHTEXTEND) 2174 self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTRIGHTEXTEND)
1815 act.triggered.connect(self.esm.map) 2175 act.triggered.connect(self.esm.map)
1816 self.editActions.append(act) 2176 self.editActions.append(act)
1817 2177
1818 act = EricAction( 2178 act = EricAction(
1819 QCoreApplication.translate( 2179 QCoreApplication.translate("ViewManager", "Extend selection left one word"),
1820 'ViewManager', 'Extend selection left one word'), 2180 QCoreApplication.translate("ViewManager", "Extend selection left one word"),
1821 QCoreApplication.translate( 2181 0,
1822 'ViewManager', 'Extend selection left one word'), 2182 0,
1823 0, 0, 2183 self.editorActGrp,
1824 self.editorActGrp, 'vm_edit_extend_selection_left_word') 2184 "vm_edit_extend_selection_left_word",
2185 )
1825 if isMacPlatform(): 2186 if isMacPlatform():
1826 act.setShortcut(QKeySequence( 2187 act.setShortcut(
1827 QCoreApplication.translate('ViewManager', 'Alt+Shift+Left'))) 2188 QKeySequence(
2189 QCoreApplication.translate("ViewManager", "Alt+Shift+Left")
2190 )
2191 )
1828 else: 2192 else:
1829 act.setShortcut(QKeySequence( 2193 act.setShortcut(
1830 QCoreApplication.translate('ViewManager', 'Ctrl+Shift+Left'))) 2194 QKeySequence(
2195 QCoreApplication.translate("ViewManager", "Ctrl+Shift+Left")
2196 )
2197 )
1831 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTEXTEND) 2198 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTEXTEND)
1832 act.triggered.connect(self.esm.map) 2199 act.triggered.connect(self.esm.map)
1833 self.editActions.append(act) 2200 self.editActions.append(act)
1834 2201
1835 act = EricAction( 2202 act = EricAction(
1836 QCoreApplication.translate( 2203 QCoreApplication.translate(
1837 'ViewManager', 'Extend selection right one word'), 2204 "ViewManager", "Extend selection right one word"
1838 QCoreApplication.translate( 2205 ),
1839 'ViewManager', 'Extend selection right one word'), 2206 QCoreApplication.translate(
1840 0, 0, 2207 "ViewManager", "Extend selection right one word"
1841 self.editorActGrp, 'vm_edit_extend_selection_right_word') 2208 ),
2209 0,
2210 0,
2211 self.editorActGrp,
2212 "vm_edit_extend_selection_right_word",
2213 )
1842 if isMacPlatform(): 2214 if isMacPlatform():
1843 act.setShortcut(QKeySequence( 2215 act.setShortcut(
1844 QCoreApplication.translate('ViewManager', 'Alt+Shift+Right'))) 2216 QKeySequence(
2217 QCoreApplication.translate("ViewManager", "Alt+Shift+Right")
2218 )
2219 )
1845 else: 2220 else:
1846 act.setShortcut(QKeySequence( 2221 act.setShortcut(
1847 QCoreApplication.translate('ViewManager', 'Ctrl+Shift+Right'))) 2222 QKeySequence(
2223 QCoreApplication.translate("ViewManager", "Ctrl+Shift+Right")
2224 )
2225 )
1848 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHTEXTEND) 2226 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHTEXTEND)
1849 act.triggered.connect(self.esm.map) 2227 act.triggered.connect(self.esm.map)
1850 self.editActions.append(act) 2228 self.editActions.append(act)
1851 2229
1852 act = EricAction( 2230 act = EricAction(
1853 QCoreApplication.translate( 2231 QCoreApplication.translate(
1854 'ViewManager', 2232 "ViewManager",
1855 'Extend selection to first visible character in document' 2233 "Extend selection to first visible character in document" " line",
1856 ' line'), 2234 ),
1857 QCoreApplication.translate( 2235 QCoreApplication.translate(
1858 'ViewManager', 2236 "ViewManager",
1859 'Extend selection to first visible character in document' 2237 "Extend selection to first visible character in document" " line",
1860 ' line'), 2238 ),
1861 0, 0, 2239 0,
1862 self.editorActGrp, 'vm_edit_extend_selection_first_visible_char') 2240 0,
2241 self.editorActGrp,
2242 "vm_edit_extend_selection_first_visible_char",
2243 )
1863 if not isMacPlatform(): 2244 if not isMacPlatform():
1864 act.setShortcut(QKeySequence( 2245 act.setShortcut(
1865 QCoreApplication.translate('ViewManager', 'Shift+Home'))) 2246 QKeySequence(QCoreApplication.translate("ViewManager", "Shift+Home"))
2247 )
1866 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEEXTEND) 2248 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEEXTEND)
1867 act.triggered.connect(self.esm.map) 2249 act.triggered.connect(self.esm.map)
1868 self.editActions.append(act) 2250 self.editActions.append(act)
1869 2251
1870 act = EricAction( 2252 act = EricAction(
1871 QCoreApplication.translate( 2253 QCoreApplication.translate(
1872 'ViewManager', 'Extend selection to end of document line'), 2254 "ViewManager", "Extend selection to end of document line"
1873 QCoreApplication.translate( 2255 ),
1874 'ViewManager', 'Extend selection to end of document line'), 2256 QCoreApplication.translate(
1875 0, 0, 2257 "ViewManager", "Extend selection to end of document line"
1876 self.editorActGrp, 'vm_edit_extend_selection_end_line') 2258 ),
2259 0,
2260 0,
2261 self.editorActGrp,
2262 "vm_edit_extend_selection_end_line",
2263 )
1877 if isMacPlatform(): 2264 if isMacPlatform():
1878 act.setShortcut(QKeySequence( 2265 act.setShortcut(
1879 QCoreApplication.translate('ViewManager', 'Meta+Shift+E'))) 2266 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+Shift+E"))
2267 )
1880 else: 2268 else:
1881 act.setShortcut(QKeySequence( 2269 act.setShortcut(
1882 QCoreApplication.translate('ViewManager', 'Shift+End'))) 2270 QKeySequence(QCoreApplication.translate("ViewManager", "Shift+End"))
2271 )
1883 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDEXTEND) 2272 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDEXTEND)
1884 act.triggered.connect(self.esm.map) 2273 act.triggered.connect(self.esm.map)
1885 self.editActions.append(act) 2274 self.editActions.append(act)
1886 2275
1887 act = EricAction( 2276 act = EricAction(
1888 QCoreApplication.translate( 2277 QCoreApplication.translate(
1889 'ViewManager', 'Extend selection up one paragraph'), 2278 "ViewManager", "Extend selection up one paragraph"
1890 QCoreApplication.translate( 2279 ),
1891 'ViewManager', 'Extend selection up one paragraph'), 2280 QCoreApplication.translate(
1892 QKeySequence(QCoreApplication.translate( 2281 "ViewManager", "Extend selection up one paragraph"
1893 'ViewManager', 'Alt+Shift+Up')), 2282 ),
1894 0, 2283 QKeySequence(QCoreApplication.translate("ViewManager", "Alt+Shift+Up")),
1895 self.editorActGrp, 'vm_edit_extend_selection_up_para') 2284 0,
2285 self.editorActGrp,
2286 "vm_edit_extend_selection_up_para",
2287 )
1896 self.esm.setMapping(act, QsciScintilla.SCI_PARAUPEXTEND) 2288 self.esm.setMapping(act, QsciScintilla.SCI_PARAUPEXTEND)
1897 act.triggered.connect(self.esm.map) 2289 act.triggered.connect(self.esm.map)
1898 self.editActions.append(act) 2290 self.editActions.append(act)
1899 2291
1900 act = EricAction( 2292 act = EricAction(
1901 QCoreApplication.translate( 2293 QCoreApplication.translate(
1902 'ViewManager', 'Extend selection down one paragraph'), 2294 "ViewManager", "Extend selection down one paragraph"
1903 QCoreApplication.translate( 2295 ),
1904 'ViewManager', 'Extend selection down one paragraph'), 2296 QCoreApplication.translate(
1905 QKeySequence(QCoreApplication.translate( 2297 "ViewManager", "Extend selection down one paragraph"
1906 'ViewManager', 'Alt+Shift+Down')), 2298 ),
1907 0, 2299 QKeySequence(QCoreApplication.translate("ViewManager", "Alt+Shift+Down")),
1908 self.editorActGrp, 'vm_edit_extend_selection_down_para') 2300 0,
2301 self.editorActGrp,
2302 "vm_edit_extend_selection_down_para",
2303 )
1909 self.esm.setMapping(act, QsciScintilla.SCI_PARADOWNEXTEND) 2304 self.esm.setMapping(act, QsciScintilla.SCI_PARADOWNEXTEND)
1910 act.triggered.connect(self.esm.map) 2305 act.triggered.connect(self.esm.map)
1911 self.editActions.append(act) 2306 self.editActions.append(act)
1912 2307
1913 act = EricAction( 2308 act = EricAction(
1914 QCoreApplication.translate( 2309 QCoreApplication.translate("ViewManager", "Extend selection up one page"),
1915 'ViewManager', 'Extend selection up one page'), 2310 QCoreApplication.translate("ViewManager", "Extend selection up one page"),
1916 QCoreApplication.translate( 2311 QKeySequence(QCoreApplication.translate("ViewManager", "Shift+PgUp")),
1917 'ViewManager', 'Extend selection up one page'), 2312 0,
1918 QKeySequence(QCoreApplication.translate('ViewManager', 2313 self.editorActGrp,
1919 'Shift+PgUp')), 2314 "vm_edit_extend_selection_up_page",
1920 0, self.editorActGrp, 'vm_edit_extend_selection_up_page') 2315 )
1921 self.esm.setMapping(act, QsciScintilla.SCI_PAGEUPEXTEND) 2316 self.esm.setMapping(act, QsciScintilla.SCI_PAGEUPEXTEND)
1922 act.triggered.connect(self.esm.map) 2317 act.triggered.connect(self.esm.map)
1923 self.editActions.append(act) 2318 self.editActions.append(act)
1924 2319
1925 act = EricAction( 2320 act = EricAction(
1926 QCoreApplication.translate( 2321 QCoreApplication.translate("ViewManager", "Extend selection down one page"),
1927 'ViewManager', 'Extend selection down one page'), 2322 QCoreApplication.translate("ViewManager", "Extend selection down one page"),
1928 QCoreApplication.translate( 2323 QKeySequence(QCoreApplication.translate("ViewManager", "Shift+PgDown")),
1929 'ViewManager', 'Extend selection down one page'), 2324 0,
1930 QKeySequence(QCoreApplication.translate( 2325 self.editorActGrp,
1931 'ViewManager', 'Shift+PgDown')), 2326 "vm_edit_extend_selection_down_page",
1932 0, 2327 )
1933 self.editorActGrp, 'vm_edit_extend_selection_down_page')
1934 if isMacPlatform(): 2328 if isMacPlatform():
1935 act.setAlternateShortcut(QKeySequence( 2329 act.setAlternateShortcut(
1936 QCoreApplication.translate('ViewManager', 'Meta+Shift+V'))) 2330 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+Shift+V"))
2331 )
1937 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWNEXTEND) 2332 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWNEXTEND)
1938 act.triggered.connect(self.esm.map) 2333 act.triggered.connect(self.esm.map)
1939 self.editActions.append(act) 2334 self.editActions.append(act)
1940 2335
1941 act = EricAction( 2336 act = EricAction(
1942 QCoreApplication.translate( 2337 QCoreApplication.translate(
1943 'ViewManager', 'Extend selection to start of document'), 2338 "ViewManager", "Extend selection to start of document"
1944 QCoreApplication.translate( 2339 ),
1945 'ViewManager', 'Extend selection to start of document'), 2340 QCoreApplication.translate(
1946 0, 0, 2341 "ViewManager", "Extend selection to start of document"
1947 self.editorActGrp, 'vm_edit_extend_selection_start_text') 2342 ),
2343 0,
2344 0,
2345 self.editorActGrp,
2346 "vm_edit_extend_selection_start_text",
2347 )
1948 if isMacPlatform(): 2348 if isMacPlatform():
1949 act.setShortcut(QKeySequence( 2349 act.setShortcut(
1950 QCoreApplication.translate('ViewManager', 'Ctrl+Shift+Up'))) 2350 QKeySequence(QCoreApplication.translate("ViewManager", "Ctrl+Shift+Up"))
2351 )
1951 else: 2352 else:
1952 act.setShortcut(QKeySequence( 2353 act.setShortcut(
1953 QCoreApplication.translate('ViewManager', 'Ctrl+Shift+Home'))) 2354 QKeySequence(
2355 QCoreApplication.translate("ViewManager", "Ctrl+Shift+Home")
2356 )
2357 )
1954 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTSTARTEXTEND) 2358 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTSTARTEXTEND)
1955 act.triggered.connect(self.esm.map) 2359 act.triggered.connect(self.esm.map)
1956 self.editActions.append(act) 2360 self.editActions.append(act)
1957 2361
1958 act = EricAction( 2362 act = EricAction(
1959 QCoreApplication.translate( 2363 QCoreApplication.translate(
1960 'ViewManager', 'Extend selection to end of document'), 2364 "ViewManager", "Extend selection to end of document"
1961 QCoreApplication.translate( 2365 ),
1962 'ViewManager', 'Extend selection to end of document'), 2366 QCoreApplication.translate(
1963 0, 0, 2367 "ViewManager", "Extend selection to end of document"
1964 self.editorActGrp, 'vm_edit_extend_selection_end_text') 2368 ),
2369 0,
2370 0,
2371 self.editorActGrp,
2372 "vm_edit_extend_selection_end_text",
2373 )
1965 if isMacPlatform(): 2374 if isMacPlatform():
1966 act.setShortcut(QKeySequence( 2375 act.setShortcut(
1967 QCoreApplication.translate('ViewManager', 'Ctrl+Shift+Down'))) 2376 QKeySequence(
2377 QCoreApplication.translate("ViewManager", "Ctrl+Shift+Down")
2378 )
2379 )
1968 else: 2380 else:
1969 act.setShortcut(QKeySequence( 2381 act.setShortcut(
1970 QCoreApplication.translate('ViewManager', 'Ctrl+Shift+End'))) 2382 QKeySequence(
2383 QCoreApplication.translate("ViewManager", "Ctrl+Shift+End")
2384 )
2385 )
1971 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTENDEXTEND) 2386 self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTENDEXTEND)
1972 act.triggered.connect(self.esm.map) 2387 act.triggered.connect(self.esm.map)
1973 self.editActions.append(act) 2388 self.editActions.append(act)
1974 2389
1975 act = EricAction( 2390 act = EricAction(
1976 QCoreApplication.translate('ViewManager', 2391 QCoreApplication.translate("ViewManager", "Delete previous character"),
1977 'Delete previous character'), 2392 QCoreApplication.translate("ViewManager", "Delete previous character"),
1978 QCoreApplication.translate('ViewManager', 2393 QKeySequence(QCoreApplication.translate("ViewManager", "Backspace")),
1979 'Delete previous character'), 2394 0,
1980 QKeySequence(QCoreApplication.translate('ViewManager', 2395 self.editorActGrp,
1981 'Backspace')), 2396 "vm_edit_delete_previous_char",
1982 0, self.editorActGrp, 'vm_edit_delete_previous_char') 2397 )
1983 if isMacPlatform(): 2398 if isMacPlatform():
1984 act.setAlternateShortcut(QKeySequence( 2399 act.setAlternateShortcut(
1985 QCoreApplication.translate('ViewManager', 'Meta+H'))) 2400 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+H"))
2401 )
1986 else: 2402 else:
1987 act.setAlternateShortcut(QKeySequence( 2403 act.setAlternateShortcut(
1988 QCoreApplication.translate('ViewManager', 'Shift+Backspace'))) 2404 QKeySequence(
2405 QCoreApplication.translate("ViewManager", "Shift+Backspace")
2406 )
2407 )
1989 self.esm.setMapping(act, QsciScintilla.SCI_DELETEBACK) 2408 self.esm.setMapping(act, QsciScintilla.SCI_DELETEBACK)
1990 act.triggered.connect(self.esm.map) 2409 act.triggered.connect(self.esm.map)
1991 self.editActions.append(act) 2410 self.editActions.append(act)
1992 2411
1993 act = EricAction( 2412 act = EricAction(
1994 QCoreApplication.translate( 2413 QCoreApplication.translate(
1995 'ViewManager', 2414 "ViewManager", "Delete previous character if not at start of line"
1996 'Delete previous character if not at start of line'), 2415 ),
1997 QCoreApplication.translate( 2416 QCoreApplication.translate(
1998 'ViewManager', 2417 "ViewManager", "Delete previous character if not at start of line"
1999 'Delete previous character if not at start of line'), 2418 ),
2000 0, 0, 2419 0,
2001 self.editorActGrp, 'vm_edit_delet_previous_char_not_line_start') 2420 0,
2421 self.editorActGrp,
2422 "vm_edit_delet_previous_char_not_line_start",
2423 )
2002 self.esm.setMapping(act, QsciScintilla.SCI_DELETEBACKNOTLINE) 2424 self.esm.setMapping(act, QsciScintilla.SCI_DELETEBACKNOTLINE)
2003 act.triggered.connect(self.esm.map) 2425 act.triggered.connect(self.esm.map)
2004 self.editActions.append(act) 2426 self.editActions.append(act)
2005 2427
2006 act = EricAction( 2428 act = EricAction(
2007 QCoreApplication.translate('ViewManager', 2429 QCoreApplication.translate("ViewManager", "Delete current character"),
2008 'Delete current character'), 2430 QCoreApplication.translate("ViewManager", "Delete current character"),
2009 QCoreApplication.translate('ViewManager', 2431 QKeySequence(QCoreApplication.translate("ViewManager", "Del")),
2010 'Delete current character'), 2432 0,
2011 QKeySequence(QCoreApplication.translate('ViewManager', 'Del')), 2433 self.editorActGrp,
2012 0, self.editorActGrp, 'vm_edit_delete_current_char') 2434 "vm_edit_delete_current_char",
2435 )
2013 if isMacPlatform(): 2436 if isMacPlatform():
2014 act.setAlternateShortcut(QKeySequence( 2437 act.setAlternateShortcut(
2015 QCoreApplication.translate('ViewManager', 'Meta+D'))) 2438 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+D"))
2439 )
2016 self.esm.setMapping(act, QsciScintilla.SCI_CLEAR) 2440 self.esm.setMapping(act, QsciScintilla.SCI_CLEAR)
2017 act.triggered.connect(self.esm.map) 2441 act.triggered.connect(self.esm.map)
2018 self.editActions.append(act) 2442 self.editActions.append(act)
2019 2443
2020 act = EricAction( 2444 act = EricAction(
2021 QCoreApplication.translate('ViewManager', 'Delete word to left'), 2445 QCoreApplication.translate("ViewManager", "Delete word to left"),
2022 QCoreApplication.translate('ViewManager', 'Delete word to left'), 2446 QCoreApplication.translate("ViewManager", "Delete word to left"),
2023 QKeySequence(QCoreApplication.translate( 2447 QKeySequence(QCoreApplication.translate("ViewManager", "Ctrl+Backspace")),
2024 'ViewManager', 'Ctrl+Backspace')), 2448 0,
2025 0, 2449 self.editorActGrp,
2026 self.editorActGrp, 'vm_edit_delete_word_left') 2450 "vm_edit_delete_word_left",
2451 )
2027 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDLEFT) 2452 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDLEFT)
2028 act.triggered.connect(self.esm.map) 2453 act.triggered.connect(self.esm.map)
2029 self.editActions.append(act) 2454 self.editActions.append(act)
2030 2455
2031 act = EricAction( 2456 act = EricAction(
2032 QCoreApplication.translate('ViewManager', 'Delete word to right'), 2457 QCoreApplication.translate("ViewManager", "Delete word to right"),
2033 QCoreApplication.translate('ViewManager', 'Delete word to right'), 2458 QCoreApplication.translate("ViewManager", "Delete word to right"),
2034 QKeySequence(QCoreApplication.translate('ViewManager', 2459 QKeySequence(QCoreApplication.translate("ViewManager", "Ctrl+Del")),
2035 'Ctrl+Del')), 2460 0,
2036 0, self.editorActGrp, 'vm_edit_delete_word_right') 2461 self.editorActGrp,
2462 "vm_edit_delete_word_right",
2463 )
2037 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDRIGHT) 2464 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDRIGHT)
2038 act.triggered.connect(self.esm.map) 2465 act.triggered.connect(self.esm.map)
2039 self.editActions.append(act) 2466 self.editActions.append(act)
2040 2467
2041 act = EricAction( 2468 act = EricAction(
2042 QCoreApplication.translate('ViewManager', 'Delete line to left'), 2469 QCoreApplication.translate("ViewManager", "Delete line to left"),
2043 QCoreApplication.translate('ViewManager', 'Delete line to left'), 2470 QCoreApplication.translate("ViewManager", "Delete line to left"),
2044 QKeySequence(QCoreApplication.translate( 2471 QKeySequence(
2045 'ViewManager', 'Ctrl+Shift+Backspace')), 2472 QCoreApplication.translate("ViewManager", "Ctrl+Shift+Backspace")
2046 0, 2473 ),
2047 self.editorActGrp, 'vm_edit_delete_line_left') 2474 0,
2475 self.editorActGrp,
2476 "vm_edit_delete_line_left",
2477 )
2048 self.esm.setMapping(act, QsciScintilla.SCI_DELLINELEFT) 2478 self.esm.setMapping(act, QsciScintilla.SCI_DELLINELEFT)
2049 act.triggered.connect(self.esm.map) 2479 act.triggered.connect(self.esm.map)
2050 self.editActions.append(act) 2480 self.editActions.append(act)
2051 2481
2052 act = EricAction( 2482 act = EricAction(
2053 QCoreApplication.translate('ViewManager', 'Delete line to right'), 2483 QCoreApplication.translate("ViewManager", "Delete line to right"),
2054 QCoreApplication.translate('ViewManager', 'Delete line to right'), 2484 QCoreApplication.translate("ViewManager", "Delete line to right"),
2055 0, 0, 2485 0,
2056 self.editorActGrp, 'vm_edit_delete_line_right') 2486 0,
2487 self.editorActGrp,
2488 "vm_edit_delete_line_right",
2489 )
2057 if isMacPlatform(): 2490 if isMacPlatform():
2058 act.setShortcut(QKeySequence( 2491 act.setShortcut(
2059 QCoreApplication.translate('ViewManager', 'Meta+K'))) 2492 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+K"))
2493 )
2060 else: 2494 else:
2061 act.setShortcut(QKeySequence( 2495 act.setShortcut(
2062 QCoreApplication.translate('ViewManager', 'Ctrl+Shift+Del'))) 2496 QKeySequence(
2497 QCoreApplication.translate("ViewManager", "Ctrl+Shift+Del")
2498 )
2499 )
2063 self.esm.setMapping(act, QsciScintilla.SCI_DELLINERIGHT) 2500 self.esm.setMapping(act, QsciScintilla.SCI_DELLINERIGHT)
2064 act.triggered.connect(self.esm.map) 2501 act.triggered.connect(self.esm.map)
2065 self.editActions.append(act) 2502 self.editActions.append(act)
2066 2503
2067 act = EricAction( 2504 act = EricAction(
2068 QCoreApplication.translate('ViewManager', 'Insert new line'), 2505 QCoreApplication.translate("ViewManager", "Insert new line"),
2069 QCoreApplication.translate('ViewManager', 'Insert new line'), 2506 QCoreApplication.translate("ViewManager", "Insert new line"),
2070 QKeySequence(QCoreApplication.translate('ViewManager', 'Return')), 2507 QKeySequence(QCoreApplication.translate("ViewManager", "Return")),
2071 QKeySequence(QCoreApplication.translate('ViewManager', 'Enter')), 2508 QKeySequence(QCoreApplication.translate("ViewManager", "Enter")),
2072 self.editorActGrp, 'vm_edit_insert_line') 2509 self.editorActGrp,
2510 "vm_edit_insert_line",
2511 )
2073 self.esm.setMapping(act, QsciScintilla.SCI_NEWLINE) 2512 self.esm.setMapping(act, QsciScintilla.SCI_NEWLINE)
2074 act.triggered.connect(self.esm.map) 2513 act.triggered.connect(self.esm.map)
2075 self.editActions.append(act) 2514 self.editActions.append(act)
2076 2515
2077 act = EricAction( 2516 act = EricAction(
2078 QCoreApplication.translate( 2517 QCoreApplication.translate(
2079 'ViewManager', 'Insert new line below current line'), 2518 "ViewManager", "Insert new line below current line"
2080 QCoreApplication.translate( 2519 ),
2081 'ViewManager', 'Insert new line below current line'), 2520 QCoreApplication.translate(
2082 QKeySequence(QCoreApplication.translate( 2521 "ViewManager", "Insert new line below current line"
2083 'ViewManager', 'Shift+Return')), 2522 ),
2084 QKeySequence(QCoreApplication.translate('ViewManager', 2523 QKeySequence(QCoreApplication.translate("ViewManager", "Shift+Return")),
2085 'Shift+Enter')), 2524 QKeySequence(QCoreApplication.translate("ViewManager", "Shift+Enter")),
2086 self.editorActGrp, 'vm_edit_insert_line_below') 2525 self.editorActGrp,
2526 "vm_edit_insert_line_below",
2527 )
2087 act.triggered.connect(self.__newLineBelow) 2528 act.triggered.connect(self.__newLineBelow)
2088 self.editActions.append(act) 2529 self.editActions.append(act)
2089 2530
2090 act = EricAction( 2531 act = EricAction(
2091 QCoreApplication.translate('ViewManager', 'Delete current line'), 2532 QCoreApplication.translate("ViewManager", "Delete current line"),
2092 QCoreApplication.translate('ViewManager', 'Delete current line'), 2533 QCoreApplication.translate("ViewManager", "Delete current line"),
2093 QKeySequence(QCoreApplication.translate( 2534 QKeySequence(QCoreApplication.translate("ViewManager", "Ctrl+Shift+L")),
2094 'ViewManager', 'Ctrl+Shift+L')), 2535 0,
2095 0, 2536 self.editorActGrp,
2096 self.editorActGrp, 'vm_edit_delete_current_line') 2537 "vm_edit_delete_current_line",
2538 )
2097 self.esm.setMapping(act, QsciScintilla.SCI_LINEDELETE) 2539 self.esm.setMapping(act, QsciScintilla.SCI_LINEDELETE)
2098 act.triggered.connect(self.esm.map) 2540 act.triggered.connect(self.esm.map)
2099 self.editActions.append(act) 2541 self.editActions.append(act)
2100 2542
2101 act = EricAction( 2543 act = EricAction(
2102 QCoreApplication.translate( 2544 QCoreApplication.translate("ViewManager", "Duplicate current line"),
2103 'ViewManager', 'Duplicate current line'), 2545 QCoreApplication.translate("ViewManager", "Duplicate current line"),
2104 QCoreApplication.translate( 2546 QKeySequence(QCoreApplication.translate("ViewManager", "Ctrl+D")),
2105 'ViewManager', 'Duplicate current line'), 2547 0,
2106 QKeySequence(QCoreApplication.translate('ViewManager', 'Ctrl+D')), 2548 self.editorActGrp,
2107 0, self.editorActGrp, 'vm_edit_duplicate_current_line') 2549 "vm_edit_duplicate_current_line",
2550 )
2108 self.esm.setMapping(act, QsciScintilla.SCI_LINEDUPLICATE) 2551 self.esm.setMapping(act, QsciScintilla.SCI_LINEDUPLICATE)
2109 act.triggered.connect(self.esm.map) 2552 act.triggered.connect(self.esm.map)
2110 self.editActions.append(act) 2553 self.editActions.append(act)
2111 2554
2112 act = EricAction( 2555 act = EricAction(
2113 QCoreApplication.translate( 2556 QCoreApplication.translate(
2114 'ViewManager', 'Swap current and previous lines'), 2557 "ViewManager", "Swap current and previous lines"
2115 QCoreApplication.translate( 2558 ),
2116 'ViewManager', 'Swap current and previous lines'), 2559 QCoreApplication.translate(
2117 QKeySequence(QCoreApplication.translate('ViewManager', 'Ctrl+T')), 2560 "ViewManager", "Swap current and previous lines"
2118 0, self.editorActGrp, 'vm_edit_swap_current_previous_line') 2561 ),
2562 QKeySequence(QCoreApplication.translate("ViewManager", "Ctrl+T")),
2563 0,
2564 self.editorActGrp,
2565 "vm_edit_swap_current_previous_line",
2566 )
2119 self.esm.setMapping(act, QsciScintilla.SCI_LINETRANSPOSE) 2567 self.esm.setMapping(act, QsciScintilla.SCI_LINETRANSPOSE)
2120 act.triggered.connect(self.esm.map) 2568 act.triggered.connect(self.esm.map)
2121 self.editActions.append(act) 2569 self.editActions.append(act)
2122 2570
2123 act = EricAction( 2571 act = EricAction(
2124 QCoreApplication.translate('ViewManager', 2572 QCoreApplication.translate("ViewManager", "Reverse selected lines"),
2125 'Reverse selected lines'), 2573 QCoreApplication.translate("ViewManager", "Reverse selected lines"),
2126 QCoreApplication.translate('ViewManager', 2574 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+Alt+R")),
2127 'Reverse selected lines'), 2575 0,
2128 QKeySequence(QCoreApplication.translate('ViewManager', 2576 self.editorActGrp,
2129 'Meta+Alt+R')), 2577 "vm_edit_reverse selected_lines",
2130 0, self.editorActGrp, 'vm_edit_reverse selected_lines') 2578 )
2131 self.esm.setMapping(act, QsciScintilla.SCI_LINEREVERSE) 2579 self.esm.setMapping(act, QsciScintilla.SCI_LINEREVERSE)
2132 act.triggered.connect(self.esm.map) 2580 act.triggered.connect(self.esm.map)
2133 self.editActions.append(act) 2581 self.editActions.append(act)
2134 2582
2135 act = EricAction( 2583 act = EricAction(
2136 QCoreApplication.translate('ViewManager', 'Cut current line'), 2584 QCoreApplication.translate("ViewManager", "Cut current line"),
2137 QCoreApplication.translate('ViewManager', 'Cut current line'), 2585 QCoreApplication.translate("ViewManager", "Cut current line"),
2138 QKeySequence(QCoreApplication.translate('ViewManager', 2586 QKeySequence(QCoreApplication.translate("ViewManager", "Alt+Shift+L")),
2139 'Alt+Shift+L')), 2587 0,
2140 0, self.editorActGrp, 'vm_edit_cut_current_line') 2588 self.editorActGrp,
2589 "vm_edit_cut_current_line",
2590 )
2141 self.esm.setMapping(act, QsciScintilla.SCI_LINECUT) 2591 self.esm.setMapping(act, QsciScintilla.SCI_LINECUT)
2142 act.triggered.connect(self.esm.map) 2592 act.triggered.connect(self.esm.map)
2143 self.editActions.append(act) 2593 self.editActions.append(act)
2144 2594
2145 act = EricAction( 2595 act = EricAction(
2146 QCoreApplication.translate('ViewManager', 'Copy current line'), 2596 QCoreApplication.translate("ViewManager", "Copy current line"),
2147 QCoreApplication.translate('ViewManager', 'Copy current line'), 2597 QCoreApplication.translate("ViewManager", "Copy current line"),
2148 QKeySequence(QCoreApplication.translate( 2598 QKeySequence(QCoreApplication.translate("ViewManager", "Ctrl+Shift+T")),
2149 'ViewManager', 'Ctrl+Shift+T')), 2599 0,
2150 0, 2600 self.editorActGrp,
2151 self.editorActGrp, 'vm_edit_copy_current_line') 2601 "vm_edit_copy_current_line",
2602 )
2152 self.esm.setMapping(act, QsciScintilla.SCI_LINECOPY) 2603 self.esm.setMapping(act, QsciScintilla.SCI_LINECOPY)
2153 act.triggered.connect(self.esm.map) 2604 act.triggered.connect(self.esm.map)
2154 self.editActions.append(act) 2605 self.editActions.append(act)
2155 2606
2156 act = EricAction( 2607 act = EricAction(
2157 QCoreApplication.translate( 2608 QCoreApplication.translate("ViewManager", "Toggle insert/overtype"),
2158 'ViewManager', 'Toggle insert/overtype'), 2609 QCoreApplication.translate("ViewManager", "Toggle insert/overtype"),
2159 QCoreApplication.translate( 2610 QKeySequence(QCoreApplication.translate("ViewManager", "Ins")),
2160 'ViewManager', 'Toggle insert/overtype'), 2611 0,
2161 QKeySequence(QCoreApplication.translate('ViewManager', 'Ins')), 2612 self.editorActGrp,
2162 0, self.editorActGrp, 'vm_edit_toggle_insert_overtype') 2613 "vm_edit_toggle_insert_overtype",
2614 )
2163 self.esm.setMapping(act, QsciScintilla.SCI_EDITTOGGLEOVERTYPE) 2615 self.esm.setMapping(act, QsciScintilla.SCI_EDITTOGGLEOVERTYPE)
2164 act.triggered.connect(self.esm.map) 2616 act.triggered.connect(self.esm.map)
2165 self.editActions.append(act) 2617 self.editActions.append(act)
2166 2618
2167 act = EricAction( 2619 act = EricAction(
2168 QCoreApplication.translate( 2620 QCoreApplication.translate("ViewManager", "Move to end of display line"),
2169 'ViewManager', 'Move to end of display line'), 2621 QCoreApplication.translate("ViewManager", "Move to end of display line"),
2170 QCoreApplication.translate( 2622 0,
2171 'ViewManager', 'Move to end of display line'), 2623 0,
2172 0, 0, 2624 self.editorActGrp,
2173 self.editorActGrp, 'vm_edit_move_end_displayed_line') 2625 "vm_edit_move_end_displayed_line",
2626 )
2174 if isMacPlatform(): 2627 if isMacPlatform():
2175 act.setShortcut(QKeySequence( 2628 act.setShortcut(
2176 QCoreApplication.translate('ViewManager', 'Ctrl+Right'))) 2629 QKeySequence(QCoreApplication.translate("ViewManager", "Ctrl+Right"))
2630 )
2177 else: 2631 else:
2178 act.setShortcut(QKeySequence( 2632 act.setShortcut(
2179 QCoreApplication.translate('ViewManager', 'Alt+End'))) 2633 QKeySequence(QCoreApplication.translate("ViewManager", "Alt+End"))
2634 )
2180 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDDISPLAY) 2635 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDDISPLAY)
2181 act.triggered.connect(self.esm.map) 2636 act.triggered.connect(self.esm.map)
2182 self.editActions.append(act) 2637 self.editActions.append(act)
2183 2638
2184 act = EricAction( 2639 act = EricAction(
2185 QCoreApplication.translate( 2640 QCoreApplication.translate(
2186 'ViewManager', 'Extend selection to end of display line'), 2641 "ViewManager", "Extend selection to end of display line"
2187 QCoreApplication.translate( 2642 ),
2188 'ViewManager', 'Extend selection to end of display line'), 2643 QCoreApplication.translate(
2189 0, 0, 2644 "ViewManager", "Extend selection to end of display line"
2190 self.editorActGrp, 'vm_edit_extend_selection_end_displayed_line') 2645 ),
2646 0,
2647 0,
2648 self.editorActGrp,
2649 "vm_edit_extend_selection_end_displayed_line",
2650 )
2191 if isMacPlatform(): 2651 if isMacPlatform():
2192 act.setShortcut(QKeySequence( 2652 act.setShortcut(
2193 QCoreApplication.translate('ViewManager', 'Ctrl+Shift+Right'))) 2653 QKeySequence(
2654 QCoreApplication.translate("ViewManager", "Ctrl+Shift+Right")
2655 )
2656 )
2194 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDDISPLAYEXTEND) 2657 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDDISPLAYEXTEND)
2195 act.triggered.connect(self.esm.map) 2658 act.triggered.connect(self.esm.map)
2196 self.editActions.append(act) 2659 self.editActions.append(act)
2197 2660
2198 act = EricAction( 2661 act = EricAction(
2199 QCoreApplication.translate('ViewManager', 'Formfeed'), 2662 QCoreApplication.translate("ViewManager", "Formfeed"),
2200 QCoreApplication.translate('ViewManager', 'Formfeed'), 2663 QCoreApplication.translate("ViewManager", "Formfeed"),
2201 0, 0, 2664 0,
2202 self.editorActGrp, 'vm_edit_formfeed') 2665 0,
2666 self.editorActGrp,
2667 "vm_edit_formfeed",
2668 )
2203 self.esm.setMapping(act, QsciScintilla.SCI_FORMFEED) 2669 self.esm.setMapping(act, QsciScintilla.SCI_FORMFEED)
2204 act.triggered.connect(self.esm.map) 2670 act.triggered.connect(self.esm.map)
2205 self.editActions.append(act) 2671 self.editActions.append(act)
2206 2672
2207 act = EricAction( 2673 act = EricAction(
2208 QCoreApplication.translate('ViewManager', 'Escape'), 2674 QCoreApplication.translate("ViewManager", "Escape"),
2209 QCoreApplication.translate('ViewManager', 'Escape'), 2675 QCoreApplication.translate("ViewManager", "Escape"),
2210 QKeySequence(QCoreApplication.translate('ViewManager', 'Esc')), 0, 2676 QKeySequence(QCoreApplication.translate("ViewManager", "Esc")),
2211 self.editorActGrp, 'vm_edit_escape') 2677 0,
2678 self.editorActGrp,
2679 "vm_edit_escape",
2680 )
2212 self.esm.setMapping(act, QsciScintilla.SCI_CANCEL) 2681 self.esm.setMapping(act, QsciScintilla.SCI_CANCEL)
2213 act.triggered.connect(self.esm.map) 2682 act.triggered.connect(self.esm.map)
2214 self.editActions.append(act) 2683 self.editActions.append(act)
2215 2684
2216 act = EricAction( 2685 act = EricAction(
2217 QCoreApplication.translate( 2686 QCoreApplication.translate(
2218 'ViewManager', 'Extend rectangular selection down one line'), 2687 "ViewManager", "Extend rectangular selection down one line"
2219 QCoreApplication.translate( 2688 ),
2220 'ViewManager', 'Extend rectangular selection down one line'), 2689 QCoreApplication.translate(
2221 QKeySequence(QCoreApplication.translate( 2690 "ViewManager", "Extend rectangular selection down one line"
2222 'ViewManager', 'Alt+Ctrl+Down')), 2691 ),
2223 0, 2692 QKeySequence(QCoreApplication.translate("ViewManager", "Alt+Ctrl+Down")),
2224 self.editorActGrp, 'vm_edit_extend_rect_selection_down_line') 2693 0,
2694 self.editorActGrp,
2695 "vm_edit_extend_rect_selection_down_line",
2696 )
2225 if isMacPlatform(): 2697 if isMacPlatform():
2226 act.setAlternateShortcut(QKeySequence( 2698 act.setAlternateShortcut(
2227 QCoreApplication.translate('ViewManager', 'Meta+Alt+Shift+N'))) 2699 QKeySequence(
2700 QCoreApplication.translate("ViewManager", "Meta+Alt+Shift+N")
2701 )
2702 )
2228 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWNRECTEXTEND) 2703 self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWNRECTEXTEND)
2229 act.triggered.connect(self.esm.map) 2704 act.triggered.connect(self.esm.map)
2230 self.editActions.append(act) 2705 self.editActions.append(act)
2231 2706
2232 act = EricAction( 2707 act = EricAction(
2233 QCoreApplication.translate( 2708 QCoreApplication.translate(
2234 'ViewManager', 'Extend rectangular selection up one line'), 2709 "ViewManager", "Extend rectangular selection up one line"
2235 QCoreApplication.translate( 2710 ),
2236 'ViewManager', 'Extend rectangular selection up one line'), 2711 QCoreApplication.translate(
2237 QKeySequence(QCoreApplication.translate('ViewManager', 2712 "ViewManager", "Extend rectangular selection up one line"
2238 'Alt+Ctrl+Up')), 2713 ),
2239 0, self.editorActGrp, 'vm_edit_extend_rect_selection_up_line') 2714 QKeySequence(QCoreApplication.translate("ViewManager", "Alt+Ctrl+Up")),
2715 0,
2716 self.editorActGrp,
2717 "vm_edit_extend_rect_selection_up_line",
2718 )
2240 if isMacPlatform(): 2719 if isMacPlatform():
2241 act.setAlternateShortcut(QKeySequence( 2720 act.setAlternateShortcut(
2242 QCoreApplication.translate('ViewManager', 'Meta+Alt+Shift+P'))) 2721 QKeySequence(
2722 QCoreApplication.translate("ViewManager", "Meta+Alt+Shift+P")
2723 )
2724 )
2243 self.esm.setMapping(act, QsciScintilla.SCI_LINEUPRECTEXTEND) 2725 self.esm.setMapping(act, QsciScintilla.SCI_LINEUPRECTEXTEND)
2244 act.triggered.connect(self.esm.map) 2726 act.triggered.connect(self.esm.map)
2245 self.editActions.append(act) 2727 self.editActions.append(act)
2246 2728
2247 act = EricAction( 2729 act = EricAction(
2248 QCoreApplication.translate( 2730 QCoreApplication.translate(
2249 'ViewManager', 2731 "ViewManager", "Extend rectangular selection left one character"
2250 'Extend rectangular selection left one character'), 2732 ),
2251 QCoreApplication.translate( 2733 QCoreApplication.translate(
2252 'ViewManager', 2734 "ViewManager", "Extend rectangular selection left one character"
2253 'Extend rectangular selection left one character'), 2735 ),
2254 QKeySequence(QCoreApplication.translate( 2736 QKeySequence(QCoreApplication.translate("ViewManager", "Alt+Ctrl+Left")),
2255 'ViewManager', 'Alt+Ctrl+Left')), 2737 0,
2256 0, 2738 self.editorActGrp,
2257 self.editorActGrp, 'vm_edit_extend_rect_selection_left_char') 2739 "vm_edit_extend_rect_selection_left_char",
2740 )
2258 if isMacPlatform(): 2741 if isMacPlatform():
2259 act.setAlternateShortcut(QKeySequence( 2742 act.setAlternateShortcut(
2260 QCoreApplication.translate('ViewManager', 'Meta+Alt+Shift+B'))) 2743 QKeySequence(
2744 QCoreApplication.translate("ViewManager", "Meta+Alt+Shift+B")
2745 )
2746 )
2261 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFTRECTEXTEND) 2747 self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFTRECTEXTEND)
2262 act.triggered.connect(self.esm.map) 2748 act.triggered.connect(self.esm.map)
2263 self.editActions.append(act) 2749 self.editActions.append(act)
2264 2750
2265 act = EricAction( 2751 act = EricAction(
2266 QCoreApplication.translate( 2752 QCoreApplication.translate(
2267 'ViewManager', 2753 "ViewManager", "Extend rectangular selection right one character"
2268 'Extend rectangular selection right one character'), 2754 ),
2269 QCoreApplication.translate( 2755 QCoreApplication.translate(
2270 'ViewManager', 2756 "ViewManager", "Extend rectangular selection right one character"
2271 'Extend rectangular selection right one character'), 2757 ),
2272 QKeySequence(QCoreApplication.translate( 2758 QKeySequence(QCoreApplication.translate("ViewManager", "Alt+Ctrl+Right")),
2273 'ViewManager', 'Alt+Ctrl+Right')), 2759 0,
2274 0, 2760 self.editorActGrp,
2275 self.editorActGrp, 'vm_edit_extend_rect_selection_right_char') 2761 "vm_edit_extend_rect_selection_right_char",
2762 )
2276 if isMacPlatform(): 2763 if isMacPlatform():
2277 act.setAlternateShortcut(QKeySequence( 2764 act.setAlternateShortcut(
2278 QCoreApplication.translate('ViewManager', 'Meta+Alt+Shift+F'))) 2765 QKeySequence(
2766 QCoreApplication.translate("ViewManager", "Meta+Alt+Shift+F")
2767 )
2768 )
2279 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHTRECTEXTEND) 2769 self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHTRECTEXTEND)
2280 act.triggered.connect(self.esm.map) 2770 act.triggered.connect(self.esm.map)
2281 self.editActions.append(act) 2771 self.editActions.append(act)
2282 2772
2283 act = EricAction( 2773 act = EricAction(
2284 QCoreApplication.translate( 2774 QCoreApplication.translate(
2285 'ViewManager', 2775 "ViewManager",
2286 'Extend rectangular selection to first visible character in' 2776 "Extend rectangular selection to first visible character in"
2287 ' document line'), 2777 " document line",
2288 QCoreApplication.translate( 2778 ),
2289 'ViewManager', 2779 QCoreApplication.translate(
2290 'Extend rectangular selection to first visible character in' 2780 "ViewManager",
2291 ' document line'), 2781 "Extend rectangular selection to first visible character in"
2292 0, 0, 2782 " document line",
2783 ),
2784 0,
2785 0,
2293 self.editorActGrp, 2786 self.editorActGrp,
2294 'vm_edit_extend_rect_selection_first_visible_char') 2787 "vm_edit_extend_rect_selection_first_visible_char",
2788 )
2295 if not isMacPlatform(): 2789 if not isMacPlatform():
2296 act.setShortcut(QKeySequence( 2790 act.setShortcut(
2297 QCoreApplication.translate('ViewManager', 'Alt+Shift+Home'))) 2791 QKeySequence(
2792 QCoreApplication.translate("ViewManager", "Alt+Shift+Home")
2793 )
2794 )
2298 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMERECTEXTEND) 2795 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMERECTEXTEND)
2299 act.triggered.connect(self.esm.map) 2796 act.triggered.connect(self.esm.map)
2300 self.editActions.append(act) 2797 self.editActions.append(act)
2301 2798
2302 act = EricAction( 2799 act = EricAction(
2303 QCoreApplication.translate( 2800 QCoreApplication.translate(
2304 'ViewManager', 2801 "ViewManager", "Extend rectangular selection to end of document line"
2305 'Extend rectangular selection to end of document line'), 2802 ),
2306 QCoreApplication.translate( 2803 QCoreApplication.translate(
2307 'ViewManager', 2804 "ViewManager", "Extend rectangular selection to end of document line"
2308 'Extend rectangular selection to end of document line'), 2805 ),
2309 0, 0, 2806 0,
2310 self.editorActGrp, 'vm_edit_extend_rect_selection_end_line') 2807 0,
2808 self.editorActGrp,
2809 "vm_edit_extend_rect_selection_end_line",
2810 )
2311 if isMacPlatform(): 2811 if isMacPlatform():
2312 act.setShortcut(QKeySequence( 2812 act.setShortcut(
2313 QCoreApplication.translate('ViewManager', 'Meta+Alt+Shift+E'))) 2813 QKeySequence(
2814 QCoreApplication.translate("ViewManager", "Meta+Alt+Shift+E")
2815 )
2816 )
2314 else: 2817 else:
2315 act.setShortcut(QKeySequence( 2818 act.setShortcut(
2316 QCoreApplication.translate('ViewManager', 'Alt+Shift+End'))) 2819 QKeySequence(QCoreApplication.translate("ViewManager", "Alt+Shift+End"))
2820 )
2317 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDRECTEXTEND) 2821 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDRECTEXTEND)
2318 act.triggered.connect(self.esm.map) 2822 act.triggered.connect(self.esm.map)
2319 self.editActions.append(act) 2823 self.editActions.append(act)
2320 2824
2321 act = EricAction( 2825 act = EricAction(
2322 QCoreApplication.translate( 2826 QCoreApplication.translate(
2323 'ViewManager', 2827 "ViewManager", "Extend rectangular selection up one page"
2324 'Extend rectangular selection up one page'), 2828 ),
2325 QCoreApplication.translate( 2829 QCoreApplication.translate(
2326 'ViewManager', 2830 "ViewManager", "Extend rectangular selection up one page"
2327 'Extend rectangular selection up one page'), 2831 ),
2328 QKeySequence(QCoreApplication.translate( 2832 QKeySequence(QCoreApplication.translate("ViewManager", "Alt+Shift+PgUp")),
2329 'ViewManager', 'Alt+Shift+PgUp')), 2833 0,
2330 0, 2834 self.editorActGrp,
2331 self.editorActGrp, 'vm_edit_extend_rect_selection_up_page') 2835 "vm_edit_extend_rect_selection_up_page",
2836 )
2332 self.esm.setMapping(act, QsciScintilla.SCI_PAGEUPRECTEXTEND) 2837 self.esm.setMapping(act, QsciScintilla.SCI_PAGEUPRECTEXTEND)
2333 act.triggered.connect(self.esm.map) 2838 act.triggered.connect(self.esm.map)
2334 self.editActions.append(act) 2839 self.editActions.append(act)
2335 2840
2336 act = EricAction( 2841 act = EricAction(
2337 QCoreApplication.translate( 2842 QCoreApplication.translate(
2338 'ViewManager', 2843 "ViewManager", "Extend rectangular selection down one page"
2339 'Extend rectangular selection down one page'), 2844 ),
2340 QCoreApplication.translate( 2845 QCoreApplication.translate(
2341 'ViewManager', 2846 "ViewManager", "Extend rectangular selection down one page"
2342 'Extend rectangular selection down one page'), 2847 ),
2343 QKeySequence(QCoreApplication.translate( 2848 QKeySequence(QCoreApplication.translate("ViewManager", "Alt+Shift+PgDown")),
2344 'ViewManager', 'Alt+Shift+PgDown')), 2849 0,
2345 0, 2850 self.editorActGrp,
2346 self.editorActGrp, 'vm_edit_extend_rect_selection_down_page') 2851 "vm_edit_extend_rect_selection_down_page",
2852 )
2347 if isMacPlatform(): 2853 if isMacPlatform():
2348 act.setAlternateShortcut(QKeySequence( 2854 act.setAlternateShortcut(
2349 QCoreApplication.translate('ViewManager', 'Meta+Alt+Shift+V'))) 2855 QKeySequence(
2856 QCoreApplication.translate("ViewManager", "Meta+Alt+Shift+V")
2857 )
2858 )
2350 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWNRECTEXTEND) 2859 self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWNRECTEXTEND)
2351 act.triggered.connect(self.esm.map) 2860 act.triggered.connect(self.esm.map)
2352 self.editActions.append(act) 2861 self.editActions.append(act)
2353 2862
2354 act = EricAction( 2863 act = EricAction(
2355 QCoreApplication.translate( 2864 QCoreApplication.translate("ViewManager", "Duplicate current selection"),
2356 'ViewManager', 'Duplicate current selection'), 2865 QCoreApplication.translate("ViewManager", "Duplicate current selection"),
2357 QCoreApplication.translate( 2866 QKeySequence(QCoreApplication.translate("ViewManager", "Ctrl+Shift+D")),
2358 'ViewManager', 'Duplicate current selection'), 2867 0,
2359 QKeySequence(QCoreApplication.translate( 2868 self.editorActGrp,
2360 'ViewManager', 'Ctrl+Shift+D')), 2869 "vm_edit_duplicate_current_selection",
2361 0, 2870 )
2362 self.editorActGrp, 'vm_edit_duplicate_current_selection')
2363 self.esm.setMapping(act, QsciScintilla.SCI_SELECTIONDUPLICATE) 2871 self.esm.setMapping(act, QsciScintilla.SCI_SELECTIONDUPLICATE)
2364 act.triggered.connect(self.esm.map) 2872 act.triggered.connect(self.esm.map)
2365 self.editActions.append(act) 2873 self.editActions.append(act)
2366 2874
2367 if hasattr(QsciScintilla, "SCI_SCROLLTOSTART"): 2875 if hasattr(QsciScintilla, "SCI_SCROLLTOSTART"):
2368 act = EricAction( 2876 act = EricAction(
2369 QCoreApplication.translate( 2877 QCoreApplication.translate(
2370 'ViewManager', 'Scroll to start of document'), 2878 "ViewManager", "Scroll to start of document"
2879 ),
2371 QCoreApplication.translate( 2880 QCoreApplication.translate(
2372 'ViewManager', 'Scroll to start of document'), 2881 "ViewManager", "Scroll to start of document"
2373 0, 0, 2882 ),
2374 self.editorActGrp, 'vm_edit_scroll_start_text') 2883 0,
2884 0,
2885 self.editorActGrp,
2886 "vm_edit_scroll_start_text",
2887 )
2375 if isMacPlatform(): 2888 if isMacPlatform():
2376 act.setShortcut(QKeySequence( 2889 act.setShortcut(
2377 QCoreApplication.translate('ViewManager', 'Home'))) 2890 QKeySequence(QCoreApplication.translate("ViewManager", "Home"))
2891 )
2378 self.esm.setMapping(act, QsciScintilla.SCI_SCROLLTOSTART) 2892 self.esm.setMapping(act, QsciScintilla.SCI_SCROLLTOSTART)
2379 act.triggered.connect(self.esm.map) 2893 act.triggered.connect(self.esm.map)
2380 self.editActions.append(act) 2894 self.editActions.append(act)
2381 2895
2382 if hasattr(QsciScintilla, "SCI_SCROLLTOEND"): 2896 if hasattr(QsciScintilla, "SCI_SCROLLTOEND"):
2383 act = EricAction( 2897 act = EricAction(
2384 QCoreApplication.translate( 2898 QCoreApplication.translate("ViewManager", "Scroll to end of document"),
2385 'ViewManager', 'Scroll to end of document'), 2899 QCoreApplication.translate("ViewManager", "Scroll to end of document"),
2386 QCoreApplication.translate( 2900 0,
2387 'ViewManager', 'Scroll to end of document'), 2901 0,
2388 0, 0, 2902 self.editorActGrp,
2389 self.editorActGrp, 'vm_edit_scroll_end_text') 2903 "vm_edit_scroll_end_text",
2904 )
2390 if isMacPlatform(): 2905 if isMacPlatform():
2391 act.setShortcut(QKeySequence( 2906 act.setShortcut(
2392 QCoreApplication.translate('ViewManager', 'End'))) 2907 QKeySequence(QCoreApplication.translate("ViewManager", "End"))
2908 )
2393 self.esm.setMapping(act, QsciScintilla.SCI_SCROLLTOEND) 2909 self.esm.setMapping(act, QsciScintilla.SCI_SCROLLTOEND)
2394 act.triggered.connect(self.esm.map) 2910 act.triggered.connect(self.esm.map)
2395 self.editActions.append(act) 2911 self.editActions.append(act)
2396 2912
2397 if hasattr(QsciScintilla, "SCI_VERTICALCENTRECARET"): 2913 if hasattr(QsciScintilla, "SCI_VERTICALCENTRECARET"):
2398 act = EricAction( 2914 act = EricAction(
2399 QCoreApplication.translate( 2915 QCoreApplication.translate(
2400 'ViewManager', 'Scroll vertically to center current line'), 2916 "ViewManager", "Scroll vertically to center current line"
2917 ),
2401 QCoreApplication.translate( 2918 QCoreApplication.translate(
2402 'ViewManager', 'Scroll vertically to center current line'), 2919 "ViewManager", "Scroll vertically to center current line"
2403 0, 0, 2920 ),
2404 self.editorActGrp, 'vm_edit_scroll_vertically_center') 2921 0,
2922 0,
2923 self.editorActGrp,
2924 "vm_edit_scroll_vertically_center",
2925 )
2405 if isMacPlatform(): 2926 if isMacPlatform():
2406 act.setShortcut(QKeySequence( 2927 act.setShortcut(
2407 QCoreApplication.translate('ViewManager', 'Meta+L'))) 2928 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+L"))
2929 )
2408 self.esm.setMapping(act, QsciScintilla.SCI_VERTICALCENTRECARET) 2930 self.esm.setMapping(act, QsciScintilla.SCI_VERTICALCENTRECARET)
2409 act.triggered.connect(self.esm.map) 2931 act.triggered.connect(self.esm.map)
2410 self.editActions.append(act) 2932 self.editActions.append(act)
2411 2933
2412 if hasattr(QsciScintilla, "SCI_WORDRIGHTEND"): 2934 if hasattr(QsciScintilla, "SCI_WORDRIGHTEND"):
2413 act = EricAction( 2935 act = EricAction(
2414 QCoreApplication.translate( 2936 QCoreApplication.translate("ViewManager", "Move to end of next word"),
2415 'ViewManager', 'Move to end of next word'), 2937 QCoreApplication.translate("ViewManager", "Move to end of next word"),
2416 QCoreApplication.translate( 2938 0,
2417 'ViewManager', 'Move to end of next word'), 2939 0,
2418 0, 0, 2940 self.editorActGrp,
2419 self.editorActGrp, 'vm_edit_move_end_next_word') 2941 "vm_edit_move_end_next_word",
2942 )
2420 if isMacPlatform(): 2943 if isMacPlatform():
2421 act.setShortcut(QKeySequence( 2944 act.setShortcut(
2422 QCoreApplication.translate('ViewManager', 'Alt+Right'))) 2945 QKeySequence(QCoreApplication.translate("ViewManager", "Alt+Right"))
2946 )
2423 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHTEND) 2947 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHTEND)
2424 act.triggered.connect(self.esm.map) 2948 act.triggered.connect(self.esm.map)
2425 self.editActions.append(act) 2949 self.editActions.append(act)
2426 2950
2427 if hasattr(QsciScintilla, "SCI_WORDRIGHTENDEXTEND"): 2951 if hasattr(QsciScintilla, "SCI_WORDRIGHTENDEXTEND"):
2428 act = EricAction( 2952 act = EricAction(
2429 QCoreApplication.translate( 2953 QCoreApplication.translate(
2430 'ViewManager', 'Extend selection to end of next word'), 2954 "ViewManager", "Extend selection to end of next word"
2955 ),
2431 QCoreApplication.translate( 2956 QCoreApplication.translate(
2432 'ViewManager', 'Extend selection to end of next word'), 2957 "ViewManager", "Extend selection to end of next word"
2433 0, 0, 2958 ),
2434 self.editorActGrp, 'vm_edit_select_end_next_word') 2959 0,
2960 0,
2961 self.editorActGrp,
2962 "vm_edit_select_end_next_word",
2963 )
2435 if isMacPlatform(): 2964 if isMacPlatform():
2436 act.setShortcut(QKeySequence( 2965 act.setShortcut(
2437 QCoreApplication.translate('ViewManager', 2966 QKeySequence(
2438 'Alt+Shift+Right'))) 2967 QCoreApplication.translate("ViewManager", "Alt+Shift+Right")
2968 )
2969 )
2439 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHTENDEXTEND) 2970 self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHTENDEXTEND)
2440 act.triggered.connect(self.esm.map) 2971 act.triggered.connect(self.esm.map)
2441 self.editActions.append(act) 2972 self.editActions.append(act)
2442 2973
2443 if hasattr(QsciScintilla, "SCI_WORDLEFTEND"): 2974 if hasattr(QsciScintilla, "SCI_WORDLEFTEND"):
2444 act = EricAction( 2975 act = EricAction(
2445 QCoreApplication.translate( 2976 QCoreApplication.translate(
2446 'ViewManager', 'Move to end of previous word'), 2977 "ViewManager", "Move to end of previous word"
2978 ),
2447 QCoreApplication.translate( 2979 QCoreApplication.translate(
2448 'ViewManager', 'Move to end of previous word'), 2980 "ViewManager", "Move to end of previous word"
2449 0, 0, 2981 ),
2450 self.editorActGrp, 'vm_edit_move_end_previous_word') 2982 0,
2983 0,
2984 self.editorActGrp,
2985 "vm_edit_move_end_previous_word",
2986 )
2451 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTEND) 2987 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTEND)
2452 act.triggered.connect(self.esm.map) 2988 act.triggered.connect(self.esm.map)
2453 self.editActions.append(act) 2989 self.editActions.append(act)
2454 2990
2455 if hasattr(QsciScintilla, "SCI_WORDLEFTENDEXTEND"): 2991 if hasattr(QsciScintilla, "SCI_WORDLEFTENDEXTEND"):
2456 act = EricAction( 2992 act = EricAction(
2457 QCoreApplication.translate( 2993 QCoreApplication.translate(
2458 'ViewManager', 'Extend selection to end of previous word'), 2994 "ViewManager", "Extend selection to end of previous word"
2995 ),
2459 QCoreApplication.translate( 2996 QCoreApplication.translate(
2460 'ViewManager', 'Extend selection to end of previous word'), 2997 "ViewManager", "Extend selection to end of previous word"
2461 0, 0, 2998 ),
2462 self.editorActGrp, 'vm_edit_select_end_previous_word') 2999 0,
3000 0,
3001 self.editorActGrp,
3002 "vm_edit_select_end_previous_word",
3003 )
2463 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTENDEXTEND) 3004 self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTENDEXTEND)
2464 act.triggered.connect(self.esm.map) 3005 act.triggered.connect(self.esm.map)
2465 self.editActions.append(act) 3006 self.editActions.append(act)
2466 3007
2467 if hasattr(QsciScintilla, "SCI_HOME"): 3008 if hasattr(QsciScintilla, "SCI_HOME"):
2468 act = EricAction( 3009 act = EricAction(
2469 QCoreApplication.translate( 3010 QCoreApplication.translate(
2470 'ViewManager', 'Move to start of document line'), 3011 "ViewManager", "Move to start of document line"
3012 ),
2471 QCoreApplication.translate( 3013 QCoreApplication.translate(
2472 'ViewManager', 'Move to start of document line'), 3014 "ViewManager", "Move to start of document line"
2473 0, 0, 3015 ),
2474 self.editorActGrp, 'vm_edit_move_start_document_line') 3016 0,
3017 0,
3018 self.editorActGrp,
3019 "vm_edit_move_start_document_line",
3020 )
2475 if isMacPlatform(): 3021 if isMacPlatform():
2476 act.setShortcut(QKeySequence( 3022 act.setShortcut(
2477 QCoreApplication.translate('ViewManager', 'Meta+A'))) 3023 QKeySequence(QCoreApplication.translate("ViewManager", "Meta+A"))
3024 )
2478 self.esm.setMapping(act, QsciScintilla.SCI_HOME) 3025 self.esm.setMapping(act, QsciScintilla.SCI_HOME)
2479 act.triggered.connect(self.esm.map) 3026 act.triggered.connect(self.esm.map)
2480 self.editActions.append(act) 3027 self.editActions.append(act)
2481 3028
2482 if hasattr(QsciScintilla, "SCI_HOMEEXTEND"): 3029 if hasattr(QsciScintilla, "SCI_HOMEEXTEND"):
2483 act = EricAction( 3030 act = EricAction(
2484 QCoreApplication.translate( 3031 QCoreApplication.translate(
2485 'ViewManager', 3032 "ViewManager", "Extend selection to start of document line"
2486 'Extend selection to start of document line'), 3033 ),
2487 QCoreApplication.translate( 3034 QCoreApplication.translate(
2488 'ViewManager', 3035 "ViewManager", "Extend selection to start of document line"
2489 'Extend selection to start of document line'), 3036 ),
2490 0, 0, 3037 0,
3038 0,
2491 self.editorActGrp, 3039 self.editorActGrp,
2492 'vm_edit_extend_selection_start_document_line') 3040 "vm_edit_extend_selection_start_document_line",
3041 )
2493 if isMacPlatform(): 3042 if isMacPlatform():
2494 act.setShortcut(QKeySequence( 3043 act.setShortcut(
2495 QCoreApplication.translate('ViewManager', 'Meta+Shift+A'))) 3044 QKeySequence(
3045 QCoreApplication.translate("ViewManager", "Meta+Shift+A")
3046 )
3047 )
2496 self.esm.setMapping(act, QsciScintilla.SCI_HOMEEXTEND) 3048 self.esm.setMapping(act, QsciScintilla.SCI_HOMEEXTEND)
2497 act.triggered.connect(self.esm.map) 3049 act.triggered.connect(self.esm.map)
2498 self.editActions.append(act) 3050 self.editActions.append(act)
2499 3051
2500 if hasattr(QsciScintilla, "SCI_HOMERECTEXTEND"): 3052 if hasattr(QsciScintilla, "SCI_HOMERECTEXTEND"):
2501 act = EricAction( 3053 act = EricAction(
2502 QCoreApplication.translate( 3054 QCoreApplication.translate(
2503 'ViewManager', 3055 "ViewManager",
2504 'Extend rectangular selection to start of document line'), 3056 "Extend rectangular selection to start of document line",
3057 ),
2505 QCoreApplication.translate( 3058 QCoreApplication.translate(
2506 'ViewManager', 3059 "ViewManager",
2507 'Extend rectangular selection to start of document line'), 3060 "Extend rectangular selection to start of document line",
2508 0, 0, 3061 ),
2509 self.editorActGrp, 'vm_edit_select_rect_start_line') 3062 0,
3063 0,
3064 self.editorActGrp,
3065 "vm_edit_select_rect_start_line",
3066 )
2510 if isMacPlatform(): 3067 if isMacPlatform():
2511 act.setShortcut(QKeySequence( 3068 act.setShortcut(
2512 QCoreApplication.translate('ViewManager', 3069 QKeySequence(
2513 'Meta+Alt+Shift+A'))) 3070 QCoreApplication.translate("ViewManager", "Meta+Alt+Shift+A")
3071 )
3072 )
2514 self.esm.setMapping(act, QsciScintilla.SCI_HOMERECTEXTEND) 3073 self.esm.setMapping(act, QsciScintilla.SCI_HOMERECTEXTEND)
2515 act.triggered.connect(self.esm.map) 3074 act.triggered.connect(self.esm.map)
2516 self.editActions.append(act) 3075 self.editActions.append(act)
2517 3076
2518 if hasattr(QsciScintilla, "SCI_HOMEDISPLAYEXTEND"): 3077 if hasattr(QsciScintilla, "SCI_HOMEDISPLAYEXTEND"):
2519 act = EricAction( 3078 act = EricAction(
2520 QCoreApplication.translate( 3079 QCoreApplication.translate(
2521 'ViewManager', 3080 "ViewManager", "Extend selection to start of display line"
2522 'Extend selection to start of display line'), 3081 ),
2523 QCoreApplication.translate( 3082 QCoreApplication.translate(
2524 'ViewManager', 3083 "ViewManager", "Extend selection to start of display line"
2525 'Extend selection to start of display line'), 3084 ),
2526 0, 0, 3085 0,
3086 0,
2527 self.editorActGrp, 3087 self.editorActGrp,
2528 'vm_edit_extend_selection_start_display_line') 3088 "vm_edit_extend_selection_start_display_line",
3089 )
2529 if isMacPlatform(): 3090 if isMacPlatform():
2530 act.setShortcut(QKeySequence( 3091 act.setShortcut(
2531 QCoreApplication.translate('ViewManager', 3092 QKeySequence(
2532 'Ctrl+Shift+Left'))) 3093 QCoreApplication.translate("ViewManager", "Ctrl+Shift+Left")
3094 )
3095 )
2533 self.esm.setMapping(act, QsciScintilla.SCI_HOMEDISPLAYEXTEND) 3096 self.esm.setMapping(act, QsciScintilla.SCI_HOMEDISPLAYEXTEND)
2534 act.triggered.connect(self.esm.map) 3097 act.triggered.connect(self.esm.map)
2535 self.editActions.append(act) 3098 self.editActions.append(act)
2536 3099
2537 if hasattr(QsciScintilla, "SCI_HOMEWRAP"): 3100 if hasattr(QsciScintilla, "SCI_HOMEWRAP"):
2538 act = EricAction( 3101 act = EricAction(
2539 QCoreApplication.translate( 3102 QCoreApplication.translate(
2540 'ViewManager', 3103 "ViewManager", "Move to start of display or document line"
2541 'Move to start of display or document line'), 3104 ),
2542 QCoreApplication.translate( 3105 QCoreApplication.translate(
2543 'ViewManager', 3106 "ViewManager", "Move to start of display or document line"
2544 'Move to start of display or document line'), 3107 ),
2545 0, 0, 3108 0,
2546 self.editorActGrp, 'vm_edit_move_start_display_document_line') 3109 0,
3110 self.editorActGrp,
3111 "vm_edit_move_start_display_document_line",
3112 )
2547 self.esm.setMapping(act, QsciScintilla.SCI_HOMEWRAP) 3113 self.esm.setMapping(act, QsciScintilla.SCI_HOMEWRAP)
2548 act.triggered.connect(self.esm.map) 3114 act.triggered.connect(self.esm.map)
2549 self.editActions.append(act) 3115 self.editActions.append(act)
2550 3116
2551 if hasattr(QsciScintilla, "SCI_HOMEWRAPEXTEND"): 3117 if hasattr(QsciScintilla, "SCI_HOMEWRAPEXTEND"):
2552 act = EricAction( 3118 act = EricAction(
2553 QCoreApplication.translate( 3119 QCoreApplication.translate(
2554 'ViewManager', 3120 "ViewManager",
2555 'Extend selection to start of display or document line'), 3121 "Extend selection to start of display or document line",
3122 ),
2556 QCoreApplication.translate( 3123 QCoreApplication.translate(
2557 'ViewManager', 3124 "ViewManager",
2558 'Extend selection to start of display or document line'), 3125 "Extend selection to start of display or document line",
2559 0, 0, 3126 ),
3127 0,
3128 0,
2560 self.editorActGrp, 3129 self.editorActGrp,
2561 'vm_edit_extend_selection_start_display_document_line') 3130 "vm_edit_extend_selection_start_display_document_line",
3131 )
2562 self.esm.setMapping(act, QsciScintilla.SCI_HOMEWRAPEXTEND) 3132 self.esm.setMapping(act, QsciScintilla.SCI_HOMEWRAPEXTEND)
2563 act.triggered.connect(self.esm.map) 3133 act.triggered.connect(self.esm.map)
2564 self.editActions.append(act) 3134 self.editActions.append(act)
2565 3135
2566 if hasattr(QsciScintilla, "SCI_VCHOMEWRAP"): 3136 if hasattr(QsciScintilla, "SCI_VCHOMEWRAP"):
2567 act = EricAction( 3137 act = EricAction(
2568 QCoreApplication.translate( 3138 QCoreApplication.translate(
2569 'ViewManager', 3139 "ViewManager",
2570 'Move to first visible character in display or document' 3140 "Move to first visible character in display or document" " line",
2571 ' line'), 3141 ),
2572 QCoreApplication.translate( 3142 QCoreApplication.translate(
2573 'ViewManager', 3143 "ViewManager",
2574 'Move to first visible character in display or document' 3144 "Move to first visible character in display or document" " line",
2575 ' line'), 3145 ),
2576 0, 0, 3146 0,
3147 0,
2577 self.editorActGrp, 3148 self.editorActGrp,
2578 'vm_edit_move_first_visible_char_document_line') 3149 "vm_edit_move_first_visible_char_document_line",
3150 )
2579 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEWRAP) 3151 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEWRAP)
2580 act.triggered.connect(self.esm.map) 3152 act.triggered.connect(self.esm.map)
2581 self.editActions.append(act) 3153 self.editActions.append(act)
2582 3154
2583 if hasattr(QsciScintilla, "SCI_VCHOMEWRAPEXTEND"): 3155 if hasattr(QsciScintilla, "SCI_VCHOMEWRAPEXTEND"):
2584 act = EricAction( 3156 act = EricAction(
2585 QCoreApplication.translate( 3157 QCoreApplication.translate(
2586 'ViewManager', 3158 "ViewManager",
2587 'Extend selection to first visible character in' 3159 "Extend selection to first visible character in"
2588 ' display or document line'), 3160 " display or document line",
3161 ),
2589 QCoreApplication.translate( 3162 QCoreApplication.translate(
2590 'ViewManager', 3163 "ViewManager",
2591 'Extend selection to first visible character in' 3164 "Extend selection to first visible character in"
2592 ' display or document line'), 3165 " display or document line",
2593 0, 0, 3166 ),
3167 0,
3168 0,
2594 self.editorActGrp, 3169 self.editorActGrp,
2595 'vm_edit_extend_selection_first_visible_char_document_line') 3170 "vm_edit_extend_selection_first_visible_char_document_line",
3171 )
2596 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEWRAPEXTEND) 3172 self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEWRAPEXTEND)
2597 act.triggered.connect(self.esm.map) 3173 act.triggered.connect(self.esm.map)
2598 self.editActions.append(act) 3174 self.editActions.append(act)
2599 3175
2600 if hasattr(QsciScintilla, "SCI_LINEENDWRAP"): 3176 if hasattr(QsciScintilla, "SCI_LINEENDWRAP"):
2601 act = EricAction( 3177 act = EricAction(
2602 QCoreApplication.translate( 3178 QCoreApplication.translate(
2603 'ViewManager', 3179 "ViewManager", "Move to end of display or document line"
2604 'Move to end of display or document line'), 3180 ),
2605 QCoreApplication.translate( 3181 QCoreApplication.translate(
2606 'ViewManager', 3182 "ViewManager", "Move to end of display or document line"
2607 'Move to end of display or document line'), 3183 ),
2608 0, 0, 3184 0,
2609 self.editorActGrp, 'vm_edit_end_start_display_document_line') 3185 0,
3186 self.editorActGrp,
3187 "vm_edit_end_start_display_document_line",
3188 )
2610 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDWRAP) 3189 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDWRAP)
2611 act.triggered.connect(self.esm.map) 3190 act.triggered.connect(self.esm.map)
2612 self.editActions.append(act) 3191 self.editActions.append(act)
2613 3192
2614 if hasattr(QsciScintilla, "SCI_LINEENDWRAPEXTEND"): 3193 if hasattr(QsciScintilla, "SCI_LINEENDWRAPEXTEND"):
2615 act = EricAction( 3194 act = EricAction(
2616 QCoreApplication.translate( 3195 QCoreApplication.translate(
2617 'ViewManager', 3196 "ViewManager", "Extend selection to end of display or document line"
2618 'Extend selection to end of display or document line'), 3197 ),
2619 QCoreApplication.translate( 3198 QCoreApplication.translate(
2620 'ViewManager', 3199 "ViewManager", "Extend selection to end of display or document line"
2621 'Extend selection to end of display or document line'), 3200 ),
2622 0, 0, 3201 0,
3202 0,
2623 self.editorActGrp, 3203 self.editorActGrp,
2624 'vm_edit_extend_selection_end_display_document_line') 3204 "vm_edit_extend_selection_end_display_document_line",
3205 )
2625 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDWRAPEXTEND) 3206 self.esm.setMapping(act, QsciScintilla.SCI_LINEENDWRAPEXTEND)
2626 act.triggered.connect(self.esm.map) 3207 act.triggered.connect(self.esm.map)
2627 self.editActions.append(act) 3208 self.editActions.append(act)
2628 3209
2629 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEUP"): 3210 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEUP"):
2630 act = EricAction( 3211 act = EricAction(
2631 QCoreApplication.translate( 3212 QCoreApplication.translate("ViewManager", "Stuttered move up one page"),
2632 'ViewManager', 'Stuttered move up one page'), 3213 QCoreApplication.translate("ViewManager", "Stuttered move up one page"),
2633 QCoreApplication.translate( 3214 0,
2634 'ViewManager', 'Stuttered move up one page'), 3215 0,
2635 0, 0, 3216 self.editorActGrp,
2636 self.editorActGrp, 'vm_edit_stuttered_move_up_page') 3217 "vm_edit_stuttered_move_up_page",
3218 )
2637 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEUP) 3219 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEUP)
2638 act.triggered.connect(self.esm.map) 3220 act.triggered.connect(self.esm.map)
2639 self.editActions.append(act) 3221 self.editActions.append(act)
2640 3222
2641 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEUPEXTEND"): 3223 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEUPEXTEND"):
2642 act = EricAction( 3224 act = EricAction(
2643 QCoreApplication.translate( 3225 QCoreApplication.translate(
2644 'ViewManager', 'Stuttered extend selection up one page'), 3226 "ViewManager", "Stuttered extend selection up one page"
3227 ),
2645 QCoreApplication.translate( 3228 QCoreApplication.translate(
2646 'ViewManager', 'Stuttered extend selection up one page'), 3229 "ViewManager", "Stuttered extend selection up one page"
2647 0, 0, 3230 ),
3231 0,
3232 0,
2648 self.editorActGrp, 3233 self.editorActGrp,
2649 'vm_edit_stuttered_extend_selection_up_page') 3234 "vm_edit_stuttered_extend_selection_up_page",
3235 )
2650 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEUPEXTEND) 3236 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEUPEXTEND)
2651 act.triggered.connect(self.esm.map) 3237 act.triggered.connect(self.esm.map)
2652 self.editActions.append(act) 3238 self.editActions.append(act)
2653 3239
2654 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEDOWN"): 3240 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEDOWN"):
2655 act = EricAction( 3241 act = EricAction(
2656 QCoreApplication.translate( 3242 QCoreApplication.translate(
2657 'ViewManager', 'Stuttered move down one page'), 3243 "ViewManager", "Stuttered move down one page"
3244 ),
2658 QCoreApplication.translate( 3245 QCoreApplication.translate(
2659 'ViewManager', 'Stuttered move down one page'), 3246 "ViewManager", "Stuttered move down one page"
2660 0, 0, 3247 ),
2661 self.editorActGrp, 'vm_edit_stuttered_move_down_page') 3248 0,
3249 0,
3250 self.editorActGrp,
3251 "vm_edit_stuttered_move_down_page",
3252 )
2662 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEDOWN) 3253 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEDOWN)
2663 act.triggered.connect(self.esm.map) 3254 act.triggered.connect(self.esm.map)
2664 self.editActions.append(act) 3255 self.editActions.append(act)
2665 3256
2666 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEDOWNEXTEND"): 3257 if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEDOWNEXTEND"):
2667 act = EricAction( 3258 act = EricAction(
2668 QCoreApplication.translate( 3259 QCoreApplication.translate(
2669 'ViewManager', 'Stuttered extend selection down one page'), 3260 "ViewManager", "Stuttered extend selection down one page"
3261 ),
2670 QCoreApplication.translate( 3262 QCoreApplication.translate(
2671 'ViewManager', 'Stuttered extend selection down one page'), 3263 "ViewManager", "Stuttered extend selection down one page"
2672 0, 0, 3264 ),
3265 0,
3266 0,
2673 self.editorActGrp, 3267 self.editorActGrp,
2674 'vm_edit_stuttered_extend_selection_down_page') 3268 "vm_edit_stuttered_extend_selection_down_page",
3269 )
2675 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEDOWNEXTEND) 3270 self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEDOWNEXTEND)
2676 act.triggered.connect(self.esm.map) 3271 act.triggered.connect(self.esm.map)
2677 self.editActions.append(act) 3272 self.editActions.append(act)
2678 3273
2679 if hasattr(QsciScintilla, "SCI_DELWORDRIGHTEND"): 3274 if hasattr(QsciScintilla, "SCI_DELWORDRIGHTEND"):
2680 act = EricAction( 3275 act = EricAction(
2681 QCoreApplication.translate( 3276 QCoreApplication.translate(
2682 'ViewManager', 'Delete right to end of next word'), 3277 "ViewManager", "Delete right to end of next word"
3278 ),
2683 QCoreApplication.translate( 3279 QCoreApplication.translate(
2684 'ViewManager', 'Delete right to end of next word'), 3280 "ViewManager", "Delete right to end of next word"
2685 0, 0, 3281 ),
2686 self.editorActGrp, 'vm_edit_delete_right_end_next_word') 3282 0,
3283 0,
3284 self.editorActGrp,
3285 "vm_edit_delete_right_end_next_word",
3286 )
2687 if isMacPlatform(): 3287 if isMacPlatform():
2688 act.setShortcut(QKeySequence( 3288 act.setShortcut(
2689 QCoreApplication.translate('ViewManager', 'Alt+Del'))) 3289 QKeySequence(QCoreApplication.translate("ViewManager", "Alt+Del"))
3290 )
2690 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDRIGHTEND) 3291 self.esm.setMapping(act, QsciScintilla.SCI_DELWORDRIGHTEND)
2691 act.triggered.connect(self.esm.map) 3292 act.triggered.connect(self.esm.map)
2692 self.editActions.append(act) 3293 self.editActions.append(act)
2693 3294
2694 if hasattr(QsciScintilla, "SCI_MOVESELECTEDLINESUP"): 3295 if hasattr(QsciScintilla, "SCI_MOVESELECTEDLINESUP"):
2695 act = EricAction( 3296 act = EricAction(
2696 QCoreApplication.translate( 3297 QCoreApplication.translate(
2697 'ViewManager', 'Move selected lines up one line'), 3298 "ViewManager", "Move selected lines up one line"
3299 ),
2698 QCoreApplication.translate( 3300 QCoreApplication.translate(
2699 'ViewManager', 'Move selected lines up one line'), 3301 "ViewManager", "Move selected lines up one line"
2700 0, 0, 3302 ),
2701 self.editorActGrp, 'vm_edit_move_selection_up_one_line') 3303 0,
3304 0,
3305 self.editorActGrp,
3306 "vm_edit_move_selection_up_one_line",
3307 )
2702 self.esm.setMapping(act, QsciScintilla.SCI_MOVESELECTEDLINESUP) 3308 self.esm.setMapping(act, QsciScintilla.SCI_MOVESELECTEDLINESUP)
2703 act.triggered.connect(self.esm.map) 3309 act.triggered.connect(self.esm.map)
2704 self.editActions.append(act) 3310 self.editActions.append(act)
2705 3311
2706 if hasattr(QsciScintilla, "SCI_MOVESELECTEDLINESDOWN"): 3312 if hasattr(QsciScintilla, "SCI_MOVESELECTEDLINESDOWN"):
2707 act = EricAction( 3313 act = EricAction(
2708 QCoreApplication.translate( 3314 QCoreApplication.translate(
2709 'ViewManager', 'Move selected lines down one line'), 3315 "ViewManager", "Move selected lines down one line"
3316 ),
2710 QCoreApplication.translate( 3317 QCoreApplication.translate(
2711 'ViewManager', 'Move selected lines down one line'), 3318 "ViewManager", "Move selected lines down one line"
2712 0, 0, 3319 ),
2713 self.editorActGrp, 'vm_edit_move_selection_down_one_line') 3320 0,
3321 0,
3322 self.editorActGrp,
3323 "vm_edit_move_selection_down_one_line",
3324 )
2714 self.esm.setMapping(act, QsciScintilla.SCI_MOVESELECTEDLINESDOWN) 3325 self.esm.setMapping(act, QsciScintilla.SCI_MOVESELECTEDLINESDOWN)
2715 act.triggered.connect(self.esm.map) 3326 act.triggered.connect(self.esm.map)
2716 self.editActions.append(act) 3327 self.editActions.append(act)
2717 3328
2718 self.editorActGrp.setEnabled(False) 3329 self.editorActGrp.setEnabled(False)
2719 3330
2720 self.editLowerCaseAct = EricAction( 3331 self.editLowerCaseAct = EricAction(
2721 QCoreApplication.translate( 3332 QCoreApplication.translate(
2722 'ViewManager', 'Convert selection to lower case'), 3333 "ViewManager", "Convert selection to lower case"
2723 QCoreApplication.translate( 3334 ),
2724 'ViewManager', 'Convert selection to lower case'), 3335 QCoreApplication.translate(
2725 QKeySequence(QCoreApplication.translate('ViewManager', 3336 "ViewManager", "Convert selection to lower case"
2726 'Alt+Shift+U')), 3337 ),
2727 0, self.editActGrp, 'vm_edit_convert_selection_lower') 3338 QKeySequence(QCoreApplication.translate("ViewManager", "Alt+Shift+U")),
3339 0,
3340 self.editActGrp,
3341 "vm_edit_convert_selection_lower",
3342 )
2728 self.esm.setMapping(self.editLowerCaseAct, QsciScintilla.SCI_LOWERCASE) 3343 self.esm.setMapping(self.editLowerCaseAct, QsciScintilla.SCI_LOWERCASE)
2729 self.editLowerCaseAct.triggered.connect(self.esm.map) 3344 self.editLowerCaseAct.triggered.connect(self.esm.map)
2730 self.editActions.append(self.editLowerCaseAct) 3345 self.editActions.append(self.editLowerCaseAct)
2731 3346
2732 self.editUpperCaseAct = EricAction( 3347 self.editUpperCaseAct = EricAction(
2733 QCoreApplication.translate( 3348 QCoreApplication.translate(
2734 'ViewManager', 'Convert selection to upper case'), 3349 "ViewManager", "Convert selection to upper case"
2735 QCoreApplication.translate( 3350 ),
2736 'ViewManager', 'Convert selection to upper case'), 3351 QCoreApplication.translate(
2737 QKeySequence(QCoreApplication.translate( 3352 "ViewManager", "Convert selection to upper case"
2738 'ViewManager', 'Ctrl+Shift+U')), 3353 ),
2739 0, 3354 QKeySequence(QCoreApplication.translate("ViewManager", "Ctrl+Shift+U")),
2740 self.editActGrp, 'vm_edit_convert_selection_upper') 3355 0,
3356 self.editActGrp,
3357 "vm_edit_convert_selection_upper",
3358 )
2741 self.esm.setMapping(self.editUpperCaseAct, QsciScintilla.SCI_UPPERCASE) 3359 self.esm.setMapping(self.editUpperCaseAct, QsciScintilla.SCI_UPPERCASE)
2742 self.editUpperCaseAct.triggered.connect(self.esm.map) 3360 self.editUpperCaseAct.triggered.connect(self.esm.map)
2743 self.editActions.append(self.editUpperCaseAct) 3361 self.editActions.append(self.editUpperCaseAct)
2744 3362
2745 def initEditMenu(self): 3363 def initEditMenu(self):
2746 """ 3364 """
2747 Public method to create the Edit menu. 3365 Public method to create the Edit menu.
2748 3366
2749 @return the generated menu 3367 @return the generated menu
2750 """ 3368 """
2751 autocompletionMenu = QMenu( 3369 autocompletionMenu = QMenu(
2752 QCoreApplication.translate('ViewManager', 'Complete'), 3370 QCoreApplication.translate("ViewManager", "Complete"), self.ui
2753 self.ui) 3371 )
2754 autocompletionMenu.setTearOffEnabled(True) 3372 autocompletionMenu.setTearOffEnabled(True)
2755 autocompletionMenu.addAction(self.autoCompleteAct) 3373 autocompletionMenu.addAction(self.autoCompleteAct)
2756 autocompletionMenu.addSeparator() 3374 autocompletionMenu.addSeparator()
2757 autocompletionMenu.addAction(self.autoCompleteFromDocAct) 3375 autocompletionMenu.addAction(self.autoCompleteFromDocAct)
2758 autocompletionMenu.addAction(self.autoCompleteFromAPIsAct) 3376 autocompletionMenu.addAction(self.autoCompleteFromAPIsAct)
2759 autocompletionMenu.addAction(self.autoCompleteFromAllAct) 3377 autocompletionMenu.addAction(self.autoCompleteFromAllAct)
2760 3378
2761 menu = QMenu(QCoreApplication.translate('ViewManager', '&Edit'), 3379 menu = QMenu(QCoreApplication.translate("ViewManager", "&Edit"), self.ui)
2762 self.ui)
2763 menu.setTearOffEnabled(True) 3380 menu.setTearOffEnabled(True)
2764 menu.addAction(self.undoAct) 3381 menu.addAction(self.undoAct)
2765 menu.addAction(self.redoAct) 3382 menu.addAction(self.redoAct)
2766 menu.addAction(self.revertAct) 3383 menu.addAction(self.revertAct)
2767 menu.addSeparator() 3384 menu.addSeparator()
2800 menu.addAction(self.selectAllAct) 3417 menu.addAction(self.selectAllAct)
2801 menu.addAction(self.deselectAllAct) 3418 menu.addAction(self.deselectAllAct)
2802 menu.addSeparator() 3419 menu.addSeparator()
2803 menu.addAction(self.shortenEmptyAct) 3420 menu.addAction(self.shortenEmptyAct)
2804 menu.addAction(self.convertEOLAct) 3421 menu.addAction(self.convertEOLAct)
2805 3422
2806 return menu 3423 return menu
2807 3424
2808 def initEditToolbar(self, toolbarManager): 3425 def initEditToolbar(self, toolbarManager):
2809 """ 3426 """
2810 Public method to create the Edit toolbar. 3427 Public method to create the Edit toolbar.
2811 3428
2812 @param toolbarManager reference to a toolbar manager object 3429 @param toolbarManager reference to a toolbar manager object
2813 (EricToolBarManager) 3430 (EricToolBarManager)
2814 @return the generated toolbar 3431 @return the generated toolbar
2815 """ 3432 """
2816 tb = QToolBar(QCoreApplication.translate('ViewManager', 'Edit'), 3433 tb = QToolBar(QCoreApplication.translate("ViewManager", "Edit"), self.ui)
2817 self.ui)
2818 tb.setIconSize(UI.Config.ToolBarIconSize) 3434 tb.setIconSize(UI.Config.ToolBarIconSize)
2819 tb.setObjectName("EditToolbar") 3435 tb.setObjectName("EditToolbar")
2820 tb.setToolTip(QCoreApplication.translate('ViewManager', 'Edit')) 3436 tb.setToolTip(QCoreApplication.translate("ViewManager", "Edit"))
2821 3437
2822 tb.addAction(self.undoAct) 3438 tb.addAction(self.undoAct)
2823 tb.addAction(self.redoAct) 3439 tb.addAction(self.redoAct)
2824 tb.addSeparator() 3440 tb.addSeparator()
2825 tb.addAction(self.cutAct) 3441 tb.addAction(self.cutAct)
2826 tb.addAction(self.copyAct) 3442 tb.addAction(self.copyAct)
2828 tb.addAction(self.deleteAct) 3444 tb.addAction(self.deleteAct)
2829 tb.addSeparator() 3445 tb.addSeparator()
2830 tb.addAction(self.commentAct) 3446 tb.addAction(self.commentAct)
2831 tb.addAction(self.uncommentAct) 3447 tb.addAction(self.uncommentAct)
2832 tb.addAction(self.toggleCommentAct) 3448 tb.addAction(self.toggleCommentAct)
2833 3449
2834 toolbarManager.addToolBar(tb, tb.windowTitle()) 3450 toolbarManager.addToolBar(tb, tb.windowTitle())
2835 toolbarManager.addAction(self.smartIndentAct, tb.windowTitle()) 3451 toolbarManager.addAction(self.smartIndentAct, tb.windowTitle())
2836 toolbarManager.addAction(self.indentAct, tb.windowTitle()) 3452 toolbarManager.addAction(self.indentAct, tb.windowTitle())
2837 toolbarManager.addAction(self.unindentAct, tb.windowTitle()) 3453 toolbarManager.addAction(self.unindentAct, tb.windowTitle())
2838 3454
2839 return tb 3455 return tb
2840 3456
2841 ################################################################## 3457 ##################################################################
2842 ## Initialize the search related actions and the search toolbar 3458 ## Initialize the search related actions and the search toolbar
2843 ################################################################## 3459 ##################################################################
2844 3460
2845 def __initSearchActions(self): 3461 def __initSearchActions(self):
2846 """ 3462 """
2847 Private method defining the user interface actions for the search 3463 Private method defining the user interface actions for the search
2848 commands. 3464 commands.
2849 """ 3465 """
2850 self.searchActGrp = createActionGroup(self) 3466 self.searchActGrp = createActionGroup(self)
2851 self.searchOpenFilesActGrp = createActionGroup(self) 3467 self.searchOpenFilesActGrp = createActionGroup(self)
2852 3468
2853 self.searchAct = EricAction( 3469 self.searchAct = EricAction(
2854 QCoreApplication.translate('ViewManager', 'Search'), 3470 QCoreApplication.translate("ViewManager", "Search"),
2855 UI.PixmapCache.getIcon("find"), 3471 UI.PixmapCache.getIcon("find"),
2856 QCoreApplication.translate('ViewManager', '&Search...'), 3472 QCoreApplication.translate("ViewManager", "&Search..."),
2857 QKeySequence(QCoreApplication.translate( 3473 QKeySequence(
2858 'ViewManager', "Ctrl+F", "Search|Search")), 3474 QCoreApplication.translate("ViewManager", "Ctrl+F", "Search|Search")
2859 0, 3475 ),
2860 self.searchActGrp, 'vm_search') 3476 0,
2861 self.searchAct.setStatusTip(QCoreApplication.translate( 3477 self.searchActGrp,
2862 'ViewManager', 'Search for a text')) 3478 "vm_search",
2863 self.searchAct.setWhatsThis(QCoreApplication.translate( 3479 )
2864 'ViewManager', 3480 self.searchAct.setStatusTip(
2865 """<b>Search</b>""" 3481 QCoreApplication.translate("ViewManager", "Search for a text")
2866 """<p>Search for some text in the current editor. A""" 3482 )
2867 """ dialog is shown to enter the searchtext and options""" 3483 self.searchAct.setWhatsThis(
2868 """ for the search.</p>""" 3484 QCoreApplication.translate(
2869 )) 3485 "ViewManager",
3486 """<b>Search</b>"""
3487 """<p>Search for some text in the current editor. A"""
3488 """ dialog is shown to enter the searchtext and options"""
3489 """ for the search.</p>""",
3490 )
3491 )
2870 self.searchAct.triggered.connect(self.showSearchWidget) 3492 self.searchAct.triggered.connect(self.showSearchWidget)
2871 self.searchActions.append(self.searchAct) 3493 self.searchActions.append(self.searchAct)
2872 3494
2873 self.searchNextAct = EricAction( 3495 self.searchNextAct = EricAction(
2874 QCoreApplication.translate( 3496 QCoreApplication.translate("ViewManager", "Search next"),
2875 'ViewManager', 'Search next'),
2876 UI.PixmapCache.getIcon("findNext"), 3497 UI.PixmapCache.getIcon("findNext"),
2877 QCoreApplication.translate('ViewManager', 'Search &next'), 3498 QCoreApplication.translate("ViewManager", "Search &next"),
2878 QKeySequence(QCoreApplication.translate( 3499 QKeySequence(
2879 'ViewManager', "F3", "Search|Search next")), 3500 QCoreApplication.translate("ViewManager", "F3", "Search|Search next")
2880 0, 3501 ),
2881 self.searchActGrp, 'vm_search_next') 3502 0,
2882 self.searchNextAct.setStatusTip(QCoreApplication.translate( 3503 self.searchActGrp,
2883 'ViewManager', 'Search next occurrence of text')) 3504 "vm_search_next",
2884 self.searchNextAct.setWhatsThis(QCoreApplication.translate( 3505 )
2885 'ViewManager', 3506 self.searchNextAct.setStatusTip(
2886 """<b>Search next</b>""" 3507 QCoreApplication.translate("ViewManager", "Search next occurrence of text")
2887 """<p>Search the next occurrence of some text in the current""" 3508 )
2888 """ editor. The previously entered searchtext and options are""" 3509 self.searchNextAct.setWhatsThis(
2889 """ reused.</p>""" 3510 QCoreApplication.translate(
2890 )) 3511 "ViewManager",
3512 """<b>Search next</b>"""
3513 """<p>Search the next occurrence of some text in the current"""
3514 """ editor. The previously entered searchtext and options are"""
3515 """ reused.</p>""",
3516 )
3517 )
2891 self.searchNextAct.triggered.connect(self.__searchNext) 3518 self.searchNextAct.triggered.connect(self.__searchNext)
2892 self.searchActions.append(self.searchNextAct) 3519 self.searchActions.append(self.searchNextAct)
2893 3520
2894 self.searchPrevAct = EricAction( 3521 self.searchPrevAct = EricAction(
2895 QCoreApplication.translate('ViewManager', 'Search previous'), 3522 QCoreApplication.translate("ViewManager", "Search previous"),
2896 UI.PixmapCache.getIcon("findPrev"), 3523 UI.PixmapCache.getIcon("findPrev"),
2897 QCoreApplication.translate('ViewManager', 'Search &previous'), 3524 QCoreApplication.translate("ViewManager", "Search &previous"),
2898 QKeySequence(QCoreApplication.translate( 3525 QKeySequence(
2899 'ViewManager', "Shift+F3", "Search|Search previous")), 3526 QCoreApplication.translate(
2900 0, 3527 "ViewManager", "Shift+F3", "Search|Search previous"
2901 self.searchActGrp, 'vm_search_previous') 3528 )
2902 self.searchPrevAct.setStatusTip(QCoreApplication.translate( 3529 ),
2903 'ViewManager', 'Search previous occurrence of text')) 3530 0,
2904 self.searchPrevAct.setWhatsThis(QCoreApplication.translate( 3531 self.searchActGrp,
2905 'ViewManager', 3532 "vm_search_previous",
2906 """<b>Search previous</b>""" 3533 )
2907 """<p>Search the previous occurrence of some text in the current""" 3534 self.searchPrevAct.setStatusTip(
2908 """ editor. The previously entered searchtext and options are""" 3535 QCoreApplication.translate(
2909 """ reused.</p>""" 3536 "ViewManager", "Search previous occurrence of text"
2910 )) 3537 )
3538 )
3539 self.searchPrevAct.setWhatsThis(
3540 QCoreApplication.translate(
3541 "ViewManager",
3542 """<b>Search previous</b>"""
3543 """<p>Search the previous occurrence of some text in the current"""
3544 """ editor. The previously entered searchtext and options are"""
3545 """ reused.</p>""",
3546 )
3547 )
2911 self.searchPrevAct.triggered.connect(self.__searchPrev) 3548 self.searchPrevAct.triggered.connect(self.__searchPrev)
2912 self.searchActions.append(self.searchPrevAct) 3549 self.searchActions.append(self.searchPrevAct)
2913 3550
2914 self.searchClearMarkersAct = EricAction( 3551 self.searchClearMarkersAct = EricAction(
2915 QCoreApplication.translate('ViewManager', 'Clear search markers'), 3552 QCoreApplication.translate("ViewManager", "Clear search markers"),
2916 UI.PixmapCache.getIcon("findClear"), 3553 UI.PixmapCache.getIcon("findClear"),
2917 QCoreApplication.translate('ViewManager', 'Clear search markers'), 3554 QCoreApplication.translate("ViewManager", "Clear search markers"),
2918 QKeySequence(QCoreApplication.translate( 3555 QKeySequence(
2919 'ViewManager', "Ctrl+3", "Search|Clear search markers")), 3556 QCoreApplication.translate(
2920 0, 3557 "ViewManager", "Ctrl+3", "Search|Clear search markers"
2921 self.searchActGrp, 'vm_clear_search_markers') 3558 )
2922 self.searchClearMarkersAct.setStatusTip(QCoreApplication.translate( 3559 ),
2923 'ViewManager', 'Clear all displayed search markers')) 3560 0,
2924 self.searchClearMarkersAct.setWhatsThis(QCoreApplication.translate( 3561 self.searchActGrp,
2925 'ViewManager', 3562 "vm_clear_search_markers",
2926 """<b>Clear search markers</b>""" 3563 )
2927 """<p>Clear all displayed search markers.</p>""" 3564 self.searchClearMarkersAct.setStatusTip(
2928 )) 3565 QCoreApplication.translate(
2929 self.searchClearMarkersAct.triggered.connect( 3566 "ViewManager", "Clear all displayed search markers"
2930 self.__searchClearMarkers) 3567 )
3568 )
3569 self.searchClearMarkersAct.setWhatsThis(
3570 QCoreApplication.translate(
3571 "ViewManager",
3572 """<b>Clear search markers</b>"""
3573 """<p>Clear all displayed search markers.</p>""",
3574 )
3575 )
3576 self.searchClearMarkersAct.triggered.connect(self.__searchClearMarkers)
2931 self.searchActions.append(self.searchClearMarkersAct) 3577 self.searchActions.append(self.searchClearMarkersAct)
2932 3578
2933 self.searchNextWordAct = EricAction( 3579 self.searchNextWordAct = EricAction(
2934 QCoreApplication.translate( 3580 QCoreApplication.translate("ViewManager", "Search current word forward"),
2935 'ViewManager', 'Search current word forward'),
2936 UI.PixmapCache.getIcon("findWordNext"), 3581 UI.PixmapCache.getIcon("findWordNext"),
2937 QCoreApplication.translate( 3582 QCoreApplication.translate("ViewManager", "Search current word forward"),
2938 'ViewManager', 'Search current word forward'), 3583 QKeySequence(
2939 QKeySequence(QCoreApplication.translate( 3584 QCoreApplication.translate(
2940 'ViewManager', 3585 "ViewManager", "Ctrl+.", "Search|Search current word forward"
2941 "Ctrl+.", "Search|Search current word forward")), 3586 )
2942 0, 3587 ),
2943 self.searchActGrp, 'vm_search_word_next') 3588 0,
2944 self.searchNextWordAct.setStatusTip(QCoreApplication.translate( 3589 self.searchActGrp,
2945 'ViewManager', 3590 "vm_search_word_next",
2946 'Search next occurrence of the current word')) 3591 )
2947 self.searchNextWordAct.setWhatsThis(QCoreApplication.translate( 3592 self.searchNextWordAct.setStatusTip(
2948 'ViewManager', 3593 QCoreApplication.translate(
2949 """<b>Search current word forward</b>""" 3594 "ViewManager", "Search next occurrence of the current word"
2950 """<p>Search the next occurrence of the current word of the""" 3595 )
2951 """ current editor.</p>""" 3596 )
2952 )) 3597 self.searchNextWordAct.setWhatsThis(
3598 QCoreApplication.translate(
3599 "ViewManager",
3600 """<b>Search current word forward</b>"""
3601 """<p>Search the next occurrence of the current word of the"""
3602 """ current editor.</p>""",
3603 )
3604 )
2953 self.searchNextWordAct.triggered.connect(self.__findNextWord) 3605 self.searchNextWordAct.triggered.connect(self.__findNextWord)
2954 self.searchActions.append(self.searchNextWordAct) 3606 self.searchActions.append(self.searchNextWordAct)
2955 3607
2956 self.searchPrevWordAct = EricAction( 3608 self.searchPrevWordAct = EricAction(
2957 QCoreApplication.translate( 3609 QCoreApplication.translate("ViewManager", "Search current word backward"),
2958 'ViewManager', 'Search current word backward'),
2959 UI.PixmapCache.getIcon("findWordPrev"), 3610 UI.PixmapCache.getIcon("findWordPrev"),
2960 QCoreApplication.translate( 3611 QCoreApplication.translate("ViewManager", "Search current word backward"),
2961 'ViewManager', 'Search current word backward'), 3612 QKeySequence(
2962 QKeySequence(QCoreApplication.translate( 3613 QCoreApplication.translate(
2963 'ViewManager', 3614 "ViewManager", "Ctrl+,", "Search|Search current word backward"
2964 "Ctrl+,", "Search|Search current word backward")), 3615 )
2965 0, 3616 ),
2966 self.searchActGrp, 'vm_search_word_previous') 3617 0,
2967 self.searchPrevWordAct.setStatusTip(QCoreApplication.translate( 3618 self.searchActGrp,
2968 'ViewManager', 3619 "vm_search_word_previous",
2969 'Search previous occurrence of the current word')) 3620 )
2970 self.searchPrevWordAct.setWhatsThis(QCoreApplication.translate( 3621 self.searchPrevWordAct.setStatusTip(
2971 'ViewManager', 3622 QCoreApplication.translate(
2972 """<b>Search current word backward</b>""" 3623 "ViewManager", "Search previous occurrence of the current word"
2973 """<p>Search the previous occurrence of the current word of the""" 3624 )
2974 """ current editor.</p>""" 3625 )
2975 )) 3626 self.searchPrevWordAct.setWhatsThis(
3627 QCoreApplication.translate(
3628 "ViewManager",
3629 """<b>Search current word backward</b>"""
3630 """<p>Search the previous occurrence of the current word of the"""
3631 """ current editor.</p>""",
3632 )
3633 )
2976 self.searchPrevWordAct.triggered.connect(self.__findPrevWord) 3634 self.searchPrevWordAct.triggered.connect(self.__findPrevWord)
2977 self.searchActions.append(self.searchPrevWordAct) 3635 self.searchActions.append(self.searchPrevWordAct)
2978 3636
2979 self.replaceAct = EricAction( 3637 self.replaceAct = EricAction(
2980 QCoreApplication.translate('ViewManager', 'Replace'), 3638 QCoreApplication.translate("ViewManager", "Replace"),
2981 QCoreApplication.translate('ViewManager', '&Replace...'), 3639 QCoreApplication.translate("ViewManager", "&Replace..."),
2982 QKeySequence(QCoreApplication.translate( 3640 QKeySequence(
2983 'ViewManager', "Ctrl+R", "Search|Replace")), 3641 QCoreApplication.translate("ViewManager", "Ctrl+R", "Search|Replace")
2984 0, 3642 ),
2985 self.searchActGrp, 'vm_search_replace') 3643 0,
2986 self.replaceAct.setStatusTip(QCoreApplication.translate( 3644 self.searchActGrp,
2987 'ViewManager', 'Replace some text')) 3645 "vm_search_replace",
2988 self.replaceAct.setWhatsThis(QCoreApplication.translate( 3646 )
2989 'ViewManager', 3647 self.replaceAct.setStatusTip(
2990 """<b>Replace</b>""" 3648 QCoreApplication.translate("ViewManager", "Replace some text")
2991 """<p>Search for some text in the current editor and replace it.""" 3649 )
2992 """ A dialog is shown to enter the searchtext, the replacement""" 3650 self.replaceAct.setWhatsThis(
2993 """ text and options for the search and replace.</p>""" 3651 QCoreApplication.translate(
2994 )) 3652 "ViewManager",
3653 """<b>Replace</b>"""
3654 """<p>Search for some text in the current editor and replace it."""
3655 """ A dialog is shown to enter the searchtext, the replacement"""
3656 """ text and options for the search and replace.</p>""",
3657 )
3658 )
2995 self.replaceAct.triggered.connect(self.showReplaceWidget) 3659 self.replaceAct.triggered.connect(self.showReplaceWidget)
2996 self.searchActions.append(self.replaceAct) 3660 self.searchActions.append(self.replaceAct)
2997 3661
2998 self.replaceAndSearchAct = EricAction( 3662 self.replaceAndSearchAct = EricAction(
2999 QCoreApplication.translate( 3663 QCoreApplication.translate("ViewManager", "Replace and Search"),
3000 'ViewManager', 'Replace and Search'),
3001 UI.PixmapCache.getIcon("editReplaceSearch"), 3664 UI.PixmapCache.getIcon("editReplaceSearch"),
3002 QCoreApplication.translate( 3665 QCoreApplication.translate("ViewManager", "Replace and Search"),
3003 'ViewManager', 'Replace and Search'), 3666 QKeySequence(
3004 QKeySequence(QCoreApplication.translate( 3667 QCoreApplication.translate(
3005 'ViewManager', "Meta+R", "Search|Replace and Search")), 3668 "ViewManager", "Meta+R", "Search|Replace and Search"
3006 0, 3669 )
3007 self.searchActGrp, 'vm_replace_search') 3670 ),
3008 self.replaceAndSearchAct.setStatusTip(QCoreApplication.translate( 3671 0,
3009 'ViewManager', 3672 self.searchActGrp,
3010 'Replace the found text and search the next occurrence')) 3673 "vm_replace_search",
3011 self.replaceAndSearchAct.setWhatsThis(QCoreApplication.translate( 3674 )
3012 'ViewManager', 3675 self.replaceAndSearchAct.setStatusTip(
3013 """<b>Replace and Search</b>""" 3676 QCoreApplication.translate(
3014 """<p>Replace the found occurrence of text in the current""" 3677 "ViewManager", "Replace the found text and search the next occurrence"
3015 """ editor and search for the next one. The previously entered""" 3678 )
3016 """ search text and options are reused.</p>""" 3679 )
3017 )) 3680 self.replaceAndSearchAct.setWhatsThis(
3018 self.replaceAndSearchAct.triggered.connect( 3681 QCoreApplication.translate(
3019 self.__replaceWidget.replaceSearch) 3682 "ViewManager",
3683 """<b>Replace and Search</b>"""
3684 """<p>Replace the found occurrence of text in the current"""
3685 """ editor and search for the next one. The previously entered"""
3686 """ search text and options are reused.</p>""",
3687 )
3688 )
3689 self.replaceAndSearchAct.triggered.connect(self.__replaceWidget.replaceSearch)
3020 self.searchActions.append(self.replaceAndSearchAct) 3690 self.searchActions.append(self.replaceAndSearchAct)
3021 3691
3022 self.replaceSelectionAct = EricAction( 3692 self.replaceSelectionAct = EricAction(
3023 QCoreApplication.translate( 3693 QCoreApplication.translate("ViewManager", "Replace Occurrence"),
3024 'ViewManager', 'Replace Occurrence'),
3025 UI.PixmapCache.getIcon("editReplace"), 3694 UI.PixmapCache.getIcon("editReplace"),
3026 QCoreApplication.translate( 3695 QCoreApplication.translate("ViewManager", "Replace Occurrence"),
3027 'ViewManager', 'Replace Occurrence'), 3696 QKeySequence(
3028 QKeySequence(QCoreApplication.translate( 3697 QCoreApplication.translate(
3029 'ViewManager', "Ctrl+Meta+R", "Search|Replace Occurrence")), 3698 "ViewManager", "Ctrl+Meta+R", "Search|Replace Occurrence"
3030 0, 3699 )
3031 self.searchActGrp, 'vm_replace_occurrence') 3700 ),
3032 self.replaceSelectionAct.setStatusTip(QCoreApplication.translate( 3701 0,
3033 'ViewManager', 'Replace the found text')) 3702 self.searchActGrp,
3034 self.replaceSelectionAct.setWhatsThis(QCoreApplication.translate( 3703 "vm_replace_occurrence",
3035 'ViewManager', 3704 )
3036 """<b>Replace Occurrence</b>""" 3705 self.replaceSelectionAct.setStatusTip(
3037 """<p>Replace the found occurrence of the search text in the""" 3706 QCoreApplication.translate("ViewManager", "Replace the found text")
3038 """ current editor.</p>""" 3707 )
3039 )) 3708 self.replaceSelectionAct.setWhatsThis(
3040 self.replaceSelectionAct.triggered.connect( 3709 QCoreApplication.translate(
3041 self.__replaceWidget.replace) 3710 "ViewManager",
3711 """<b>Replace Occurrence</b>"""
3712 """<p>Replace the found occurrence of the search text in the"""
3713 """ current editor.</p>""",
3714 )
3715 )
3716 self.replaceSelectionAct.triggered.connect(self.__replaceWidget.replace)
3042 self.searchActions.append(self.replaceSelectionAct) 3717 self.searchActions.append(self.replaceSelectionAct)
3043 3718
3044 self.replaceAllAct = EricAction( 3719 self.replaceAllAct = EricAction(
3045 QCoreApplication.translate( 3720 QCoreApplication.translate("ViewManager", "Replace All"),
3046 'ViewManager', 'Replace All'),
3047 UI.PixmapCache.getIcon("editReplaceAll"), 3721 UI.PixmapCache.getIcon("editReplaceAll"),
3048 QCoreApplication.translate( 3722 QCoreApplication.translate("ViewManager", "Replace All"),
3049 'ViewManager', 'Replace All'), 3723 QKeySequence(
3050 QKeySequence(QCoreApplication.translate( 3724 QCoreApplication.translate(
3051 'ViewManager', "Shift+Meta+R", "Search|Replace All")), 3725 "ViewManager", "Shift+Meta+R", "Search|Replace All"
3052 0, 3726 )
3053 self.searchActGrp, 'vm_replace_all') 3727 ),
3054 self.replaceAllAct.setStatusTip(QCoreApplication.translate( 3728 0,
3055 'ViewManager', 'Replace search text occurrences')) 3729 self.searchActGrp,
3056 self.replaceAllAct.setWhatsThis(QCoreApplication.translate( 3730 "vm_replace_all",
3057 'ViewManager', 3731 )
3058 """<b>Replace All</b>""" 3732 self.replaceAllAct.setStatusTip(
3059 """<p>Replace all occurrences of the search text in the current""" 3733 QCoreApplication.translate("ViewManager", "Replace search text occurrences")
3060 """ editor.</p>""" 3734 )
3061 )) 3735 self.replaceAllAct.setWhatsThis(
3062 self.replaceAllAct.triggered.connect( 3736 QCoreApplication.translate(
3063 self.__replaceWidget.replaceAll) 3737 "ViewManager",
3738 """<b>Replace All</b>"""
3739 """<p>Replace all occurrences of the search text in the current"""
3740 """ editor.</p>""",
3741 )
3742 )
3743 self.replaceAllAct.triggered.connect(self.__replaceWidget.replaceAll)
3064 self.searchActions.append(self.replaceAllAct) 3744 self.searchActions.append(self.replaceAllAct)
3065 3745
3066 self.gotoAct = EricAction( 3746 self.gotoAct = EricAction(
3067 QCoreApplication.translate('ViewManager', 'Goto Line'), 3747 QCoreApplication.translate("ViewManager", "Goto Line"),
3068 UI.PixmapCache.getIcon("goto"), 3748 UI.PixmapCache.getIcon("goto"),
3069 QCoreApplication.translate('ViewManager', '&Goto Line...'), 3749 QCoreApplication.translate("ViewManager", "&Goto Line..."),
3070 QKeySequence(QCoreApplication.translate( 3750 QKeySequence(
3071 'ViewManager', "Ctrl+G", "Search|Goto Line")), 3751 QCoreApplication.translate("ViewManager", "Ctrl+G", "Search|Goto Line")
3072 0, 3752 ),
3073 self.searchActGrp, 'vm_search_goto_line') 3753 0,
3074 self.gotoAct.setStatusTip(QCoreApplication.translate( 3754 self.searchActGrp,
3075 'ViewManager', 'Goto Line')) 3755 "vm_search_goto_line",
3076 self.gotoAct.setWhatsThis(QCoreApplication.translate( 3756 )
3077 'ViewManager', 3757 self.gotoAct.setStatusTip(
3078 """<b>Goto Line</b>""" 3758 QCoreApplication.translate("ViewManager", "Goto Line")
3079 """<p>Go to a specific line of text in the current editor.""" 3759 )
3080 """ A dialog is shown to enter the linenumber.</p>""" 3760 self.gotoAct.setWhatsThis(
3081 )) 3761 QCoreApplication.translate(
3762 "ViewManager",
3763 """<b>Goto Line</b>"""
3764 """<p>Go to a specific line of text in the current editor."""
3765 """ A dialog is shown to enter the linenumber.</p>""",
3766 )
3767 )
3082 self.gotoAct.triggered.connect(self.__goto) 3768 self.gotoAct.triggered.connect(self.__goto)
3083 self.searchActions.append(self.gotoAct) 3769 self.searchActions.append(self.gotoAct)
3084 3770
3085 self.gotoBraceAct = EricAction( 3771 self.gotoBraceAct = EricAction(
3086 QCoreApplication.translate('ViewManager', 'Goto Brace'), 3772 QCoreApplication.translate("ViewManager", "Goto Brace"),
3087 UI.PixmapCache.getIcon("gotoBrace"), 3773 UI.PixmapCache.getIcon("gotoBrace"),
3088 QCoreApplication.translate('ViewManager', 'Goto &Brace'), 3774 QCoreApplication.translate("ViewManager", "Goto &Brace"),
3089 QKeySequence(QCoreApplication.translate( 3775 QKeySequence(
3090 'ViewManager', "Ctrl+L", "Search|Goto Brace")), 3776 QCoreApplication.translate("ViewManager", "Ctrl+L", "Search|Goto Brace")
3091 0, 3777 ),
3092 self.searchActGrp, 'vm_search_goto_brace') 3778 0,
3093 self.gotoBraceAct.setStatusTip(QCoreApplication.translate( 3779 self.searchActGrp,
3094 'ViewManager', 'Goto Brace')) 3780 "vm_search_goto_brace",
3095 self.gotoBraceAct.setWhatsThis(QCoreApplication.translate( 3781 )
3096 'ViewManager', 3782 self.gotoBraceAct.setStatusTip(
3097 """<b>Goto Brace</b>""" 3783 QCoreApplication.translate("ViewManager", "Goto Brace")
3098 """<p>Go to the matching brace in the current editor.</p>""" 3784 )
3099 )) 3785 self.gotoBraceAct.setWhatsThis(
3786 QCoreApplication.translate(
3787 "ViewManager",
3788 """<b>Goto Brace</b>"""
3789 """<p>Go to the matching brace in the current editor.</p>""",
3790 )
3791 )
3100 self.gotoBraceAct.triggered.connect(self.__gotoBrace) 3792 self.gotoBraceAct.triggered.connect(self.__gotoBrace)
3101 self.searchActions.append(self.gotoBraceAct) 3793 self.searchActions.append(self.gotoBraceAct)
3102 3794
3103 self.gotoLastEditAct = EricAction( 3795 self.gotoLastEditAct = EricAction(
3104 QCoreApplication.translate( 3796 QCoreApplication.translate("ViewManager", "Goto Last Edit Location"),
3105 'ViewManager', 'Goto Last Edit Location'),
3106 UI.PixmapCache.getIcon("gotoLastEditPosition"), 3797 UI.PixmapCache.getIcon("gotoLastEditPosition"),
3107 QCoreApplication.translate( 3798 QCoreApplication.translate("ViewManager", "Goto Last &Edit Location"),
3108 'ViewManager', 'Goto Last &Edit Location'), 3799 QKeySequence(
3109 QKeySequence(QCoreApplication.translate( 3800 QCoreApplication.translate(
3110 'ViewManager', 3801 "ViewManager", "Ctrl+Shift+G", "Search|Goto Last Edit Location"
3111 "Ctrl+Shift+G", "Search|Goto Last Edit Location")), 3802 )
3112 0, 3803 ),
3113 self.searchActGrp, 'vm_search_goto_last_edit_location') 3804 0,
3805 self.searchActGrp,
3806 "vm_search_goto_last_edit_location",
3807 )
3114 self.gotoLastEditAct.setStatusTip( 3808 self.gotoLastEditAct.setStatusTip(
3115 QCoreApplication.translate( 3809 QCoreApplication.translate("ViewManager", "Goto Last Edit Location")
3116 'ViewManager', 'Goto Last Edit Location')) 3810 )
3117 self.gotoLastEditAct.setWhatsThis(QCoreApplication.translate( 3811 self.gotoLastEditAct.setWhatsThis(
3118 'ViewManager', 3812 QCoreApplication.translate(
3119 """<b>Goto Last Edit Location</b>""" 3813 "ViewManager",
3120 """<p>Go to the location of the last edit in the current""" 3814 """<b>Goto Last Edit Location</b>"""
3121 """ editor.</p>""" 3815 """<p>Go to the location of the last edit in the current"""
3122 )) 3816 """ editor.</p>""",
3817 )
3818 )
3123 self.gotoLastEditAct.triggered.connect(self.__gotoLastEditPosition) 3819 self.gotoLastEditAct.triggered.connect(self.__gotoLastEditPosition)
3124 self.searchActions.append(self.gotoLastEditAct) 3820 self.searchActions.append(self.gotoLastEditAct)
3125 3821
3126 self.gotoPreviousDefAct = EricAction( 3822 self.gotoPreviousDefAct = EricAction(
3127 QCoreApplication.translate( 3823 QCoreApplication.translate("ViewManager", "Goto Previous Method or Class"),
3128 'ViewManager', 'Goto Previous Method or Class'), 3824 QCoreApplication.translate("ViewManager", "Goto Previous Method or Class"),
3129 QCoreApplication.translate( 3825 QKeySequence(
3130 'ViewManager', 'Goto Previous Method or Class'), 3826 QCoreApplication.translate(
3131 QKeySequence(QCoreApplication.translate( 3827 "ViewManager",
3132 'ViewManager', 3828 "Ctrl+Shift+Up",
3133 "Ctrl+Shift+Up", "Search|Goto Previous Method or Class")), 3829 "Search|Goto Previous Method or Class",
3134 0, 3830 )
3135 self.searchActGrp, 'vm_search_goto_previous_method_or_class') 3831 ),
3832 0,
3833 self.searchActGrp,
3834 "vm_search_goto_previous_method_or_class",
3835 )
3136 self.gotoPreviousDefAct.setStatusTip( 3836 self.gotoPreviousDefAct.setStatusTip(
3137 QCoreApplication.translate( 3837 QCoreApplication.translate(
3138 'ViewManager', 3838 "ViewManager", "Go to the previous method or class definition"
3139 'Go to the previous method or class definition')) 3839 )
3140 self.gotoPreviousDefAct.setWhatsThis(QCoreApplication.translate( 3840 )
3141 'ViewManager', 3841 self.gotoPreviousDefAct.setWhatsThis(
3142 """<b>Goto Previous Method or Class</b>""" 3842 QCoreApplication.translate(
3143 """<p>Goes to the line of the previous method or class""" 3843 "ViewManager",
3144 """ definition and highlights the name.</p>""" 3844 """<b>Goto Previous Method or Class</b>"""
3145 )) 3845 """<p>Goes to the line of the previous method or class"""
3146 self.gotoPreviousDefAct.triggered.connect( 3846 """ definition and highlights the name.</p>""",
3147 self.__gotoPreviousMethodClass) 3847 )
3848 )
3849 self.gotoPreviousDefAct.triggered.connect(self.__gotoPreviousMethodClass)
3148 self.searchActions.append(self.gotoPreviousDefAct) 3850 self.searchActions.append(self.gotoPreviousDefAct)
3149 3851
3150 self.gotoNextDefAct = EricAction( 3852 self.gotoNextDefAct = EricAction(
3151 QCoreApplication.translate( 3853 QCoreApplication.translate("ViewManager", "Goto Next Method or Class"),
3152 'ViewManager', 'Goto Next Method or Class'), 3854 QCoreApplication.translate("ViewManager", "Goto Next Method or Class"),
3153 QCoreApplication.translate( 3855 QKeySequence(
3154 'ViewManager', 'Goto Next Method or Class'), 3856 QCoreApplication.translate(
3155 QKeySequence(QCoreApplication.translate( 3857 "ViewManager", "Ctrl+Shift+Down", "Search|Goto Next Method or Class"
3156 'ViewManager', 3858 )
3157 "Ctrl+Shift+Down", "Search|Goto Next Method or Class")), 3859 ),
3158 0, 3860 0,
3159 self.searchActGrp, 'vm_search_goto_next_method_or_class') 3861 self.searchActGrp,
3160 self.gotoNextDefAct.setStatusTip(QCoreApplication.translate( 3862 "vm_search_goto_next_method_or_class",
3161 'ViewManager', 'Go to the next method or class definition')) 3863 )
3162 self.gotoNextDefAct.setWhatsThis(QCoreApplication.translate( 3864 self.gotoNextDefAct.setStatusTip(
3163 'ViewManager', 3865 QCoreApplication.translate(
3164 """<b>Goto Next Method or Class</b>""" 3866 "ViewManager", "Go to the next method or class definition"
3165 """<p>Goes to the line of the next method or class definition""" 3867 )
3166 """ and highlights the name.</p>""" 3868 )
3167 )) 3869 self.gotoNextDefAct.setWhatsThis(
3870 QCoreApplication.translate(
3871 "ViewManager",
3872 """<b>Goto Next Method or Class</b>"""
3873 """<p>Goes to the line of the next method or class definition"""
3874 """ and highlights the name.</p>""",
3875 )
3876 )
3168 self.gotoNextDefAct.triggered.connect(self.__gotoNextMethodClass) 3877 self.gotoNextDefAct.triggered.connect(self.__gotoNextMethodClass)
3169 self.searchActions.append(self.gotoNextDefAct) 3878 self.searchActions.append(self.gotoNextDefAct)
3170 3879
3171 self.searchActGrp.setEnabled(False) 3880 self.searchActGrp.setEnabled(False)
3172 3881
3173 self.searchFilesAct = EricAction( 3882 self.searchFilesAct = EricAction(
3174 QCoreApplication.translate('ViewManager', 'Search in Files'), 3883 QCoreApplication.translate("ViewManager", "Search in Files"),
3175 UI.PixmapCache.getIcon("projectFind"), 3884 UI.PixmapCache.getIcon("projectFind"),
3176 QCoreApplication.translate('ViewManager', 'Search in &Files...'), 3885 QCoreApplication.translate("ViewManager", "Search in &Files..."),
3177 QKeySequence(QCoreApplication.translate( 3886 QKeySequence(
3178 'ViewManager', "Shift+Ctrl+F", "Search|Search Files")), 3887 QCoreApplication.translate(
3179 0, 3888 "ViewManager", "Shift+Ctrl+F", "Search|Search Files"
3180 self, 'vm_search_in_files') 3889 )
3181 self.searchFilesAct.setStatusTip(QCoreApplication.translate( 3890 ),
3182 'ViewManager', 'Search for a text in files')) 3891 0,
3183 self.searchFilesAct.setWhatsThis(QCoreApplication.translate( 3892 self,
3184 'ViewManager', 3893 "vm_search_in_files",
3185 """<b>Search in Files</b>""" 3894 )
3186 """<p>Search for some text in the files of a directory tree""" 3895 self.searchFilesAct.setStatusTip(
3187 """ or the project. A window is shown to enter the searchtext""" 3896 QCoreApplication.translate("ViewManager", "Search for a text in files")
3188 """ and options for the search and to display the result.</p>""" 3897 )
3189 )) 3898 self.searchFilesAct.setWhatsThis(
3899 QCoreApplication.translate(
3900 "ViewManager",
3901 """<b>Search in Files</b>"""
3902 """<p>Search for some text in the files of a directory tree"""
3903 """ or the project. A window is shown to enter the searchtext"""
3904 """ and options for the search and to display the result.</p>""",
3905 )
3906 )
3190 self.searchFilesAct.triggered.connect(self.__searchFiles) 3907 self.searchFilesAct.triggered.connect(self.__searchFiles)
3191 self.searchActions.append(self.searchFilesAct) 3908 self.searchActions.append(self.searchFilesAct)
3192 3909
3193 self.replaceFilesAct = EricAction( 3910 self.replaceFilesAct = EricAction(
3194 QCoreApplication.translate('ViewManager', 'Replace in Files'), 3911 QCoreApplication.translate("ViewManager", "Replace in Files"),
3195 QCoreApplication.translate('ViewManager', 'Replace in F&iles...'), 3912 QCoreApplication.translate("ViewManager", "Replace in F&iles..."),
3196 QKeySequence(QCoreApplication.translate( 3913 QKeySequence(
3197 'ViewManager', "Shift+Ctrl+R", "Search|Replace in Files")), 3914 QCoreApplication.translate(
3198 0, 3915 "ViewManager", "Shift+Ctrl+R", "Search|Replace in Files"
3199 self, 'vm_replace_in_files') 3916 )
3200 self.replaceFilesAct.setStatusTip(QCoreApplication.translate( 3917 ),
3201 'ViewManager', 'Search for a text in files and replace it')) 3918 0,
3202 self.replaceFilesAct.setWhatsThis(QCoreApplication.translate( 3919 self,
3203 'ViewManager', 3920 "vm_replace_in_files",
3204 """<b>Replace in Files</b>""" 3921 )
3205 """<p>Search for some text in the files of a directory tree""" 3922 self.replaceFilesAct.setStatusTip(
3206 """ or the project and replace it. A window is shown to enter""" 3923 QCoreApplication.translate(
3207 """ the searchtext, the replacement text and options for the""" 3924 "ViewManager", "Search for a text in files and replace it"
3208 """ search and to display the result.</p>""" 3925 )
3209 )) 3926 )
3927 self.replaceFilesAct.setWhatsThis(
3928 QCoreApplication.translate(
3929 "ViewManager",
3930 """<b>Replace in Files</b>"""
3931 """<p>Search for some text in the files of a directory tree"""
3932 """ or the project and replace it. A window is shown to enter"""
3933 """ the searchtext, the replacement text and options for the"""
3934 """ search and to display the result.</p>""",
3935 )
3936 )
3210 self.replaceFilesAct.triggered.connect(self.__replaceFiles) 3937 self.replaceFilesAct.triggered.connect(self.__replaceFiles)
3211 self.searchActions.append(self.replaceFilesAct) 3938 self.searchActions.append(self.replaceFilesAct)
3212 3939
3213 self.searchOpenFilesAct = EricAction( 3940 self.searchOpenFilesAct = EricAction(
3214 QCoreApplication.translate( 3941 QCoreApplication.translate("ViewManager", "Search in Open Files"),
3215 'ViewManager', 'Search in Open Files'),
3216 UI.PixmapCache.getIcon("documentFind"), 3942 UI.PixmapCache.getIcon("documentFind"),
3217 QCoreApplication.translate( 3943 QCoreApplication.translate("ViewManager", "Search in Open Files..."),
3218 'ViewManager', 'Search in Open Files...'), 3944 QKeySequence(
3219 QKeySequence(QCoreApplication.translate( 3945 QCoreApplication.translate(
3220 'ViewManager', 3946 "ViewManager", "Meta+Ctrl+Alt+F", "Search|Search Open Files"
3221 "Meta+Ctrl+Alt+F", "Search|Search Open Files")), 3947 )
3222 0, 3948 ),
3223 self.searchOpenFilesActGrp, 'vm_search_in_open_files') 3949 0,
3224 self.searchOpenFilesAct.setStatusTip(QCoreApplication.translate( 3950 self.searchOpenFilesActGrp,
3225 'ViewManager', 'Search for a text in open files')) 3951 "vm_search_in_open_files",
3226 self.searchOpenFilesAct.setWhatsThis(QCoreApplication.translate( 3952 )
3227 'ViewManager', 3953 self.searchOpenFilesAct.setStatusTip(
3228 """<b>Search in Open Files</b>""" 3954 QCoreApplication.translate("ViewManager", "Search for a text in open files")
3229 """<p>Search for some text in the currently opened files.""" 3955 )
3230 """ A window is shown to enter the search text""" 3956 self.searchOpenFilesAct.setWhatsThis(
3231 """ and options for the search and to display the result.</p>""" 3957 QCoreApplication.translate(
3232 )) 3958 "ViewManager",
3959 """<b>Search in Open Files</b>"""
3960 """<p>Search for some text in the currently opened files."""
3961 """ A window is shown to enter the search text"""
3962 """ and options for the search and to display the result.</p>""",
3963 )
3964 )
3233 self.searchOpenFilesAct.triggered.connect(self.__searchOpenFiles) 3965 self.searchOpenFilesAct.triggered.connect(self.__searchOpenFiles)
3234 self.searchActions.append(self.searchOpenFilesAct) 3966 self.searchActions.append(self.searchOpenFilesAct)
3235 3967
3236 self.replaceOpenFilesAct = EricAction( 3968 self.replaceOpenFilesAct = EricAction(
3237 QCoreApplication.translate( 3969 QCoreApplication.translate("ViewManager", "Replace in Open Files"),
3238 'ViewManager', 'Replace in Open Files'), 3970 QCoreApplication.translate("ViewManager", "Replace in Open Files..."),
3239 QCoreApplication.translate( 3971 QKeySequence(
3240 'ViewManager', 'Replace in Open Files...'), 3972 QCoreApplication.translate(
3241 QKeySequence(QCoreApplication.translate( 3973 "ViewManager", "Meta+Ctrl+Alt+R", "Search|Replace in Open Files"
3242 'ViewManager', 3974 )
3243 "Meta+Ctrl+Alt+R", "Search|Replace in Open Files")), 3975 ),
3244 0, 3976 0,
3245 self.searchOpenFilesActGrp, 'vm_replace_in_open_files') 3977 self.searchOpenFilesActGrp,
3246 self.replaceOpenFilesAct.setStatusTip(QCoreApplication.translate( 3978 "vm_replace_in_open_files",
3247 'ViewManager', 'Search for a text in open files and replace it')) 3979 )
3248 self.replaceOpenFilesAct.setWhatsThis(QCoreApplication.translate( 3980 self.replaceOpenFilesAct.setStatusTip(
3249 'ViewManager', 3981 QCoreApplication.translate(
3250 """<b>Replace in Open Files</b>""" 3982 "ViewManager", "Search for a text in open files and replace it"
3251 """<p>Search for some text in the currently opened files""" 3983 )
3252 """ and replace it. A window is shown to enter""" 3984 )
3253 """ the search text, the replacement text and options for the""" 3985 self.replaceOpenFilesAct.setWhatsThis(
3254 """ search and to display the result.</p>""" 3986 QCoreApplication.translate(
3255 )) 3987 "ViewManager",
3988 """<b>Replace in Open Files</b>"""
3989 """<p>Search for some text in the currently opened files"""
3990 """ and replace it. A window is shown to enter"""
3991 """ the search text, the replacement text and options for the"""
3992 """ search and to display the result.</p>""",
3993 )
3994 )
3256 self.replaceOpenFilesAct.triggered.connect(self.__replaceOpenFiles) 3995 self.replaceOpenFilesAct.triggered.connect(self.__replaceOpenFiles)
3257 self.searchActions.append(self.replaceOpenFilesAct) 3996 self.searchActions.append(self.replaceOpenFilesAct)
3258 3997
3259 self.searchOpenFilesActGrp.setEnabled(False) 3998 self.searchOpenFilesActGrp.setEnabled(False)
3260 3999
3261 def initSearchMenu(self): 4000 def initSearchMenu(self):
3262 """ 4001 """
3263 Public method to create the Search menu. 4002 Public method to create the Search menu.
3264 4003
3265 @return the generated menu 4004 @return the generated menu
3266 @rtype QMenu 4005 @rtype QMenu
3267 """ 4006 """
3268 menu = QMenu( 4007 menu = QMenu(QCoreApplication.translate("ViewManager", "&Search"), self.ui)
3269 QCoreApplication.translate('ViewManager', '&Search'),
3270 self.ui)
3271 menu.setTearOffEnabled(True) 4008 menu.setTearOffEnabled(True)
3272 menu.addAction(self.searchAct) 4009 menu.addAction(self.searchAct)
3273 menu.addAction(self.searchNextAct) 4010 menu.addAction(self.searchNextAct)
3274 menu.addAction(self.searchPrevAct) 4011 menu.addAction(self.searchPrevAct)
3275 menu.addAction(self.searchNextWordAct) 4012 menu.addAction(self.searchNextWordAct)
3281 menu.addAction(self.searchFilesAct) 4018 menu.addAction(self.searchFilesAct)
3282 menu.addAction(self.replaceFilesAct) 4019 menu.addAction(self.replaceFilesAct)
3283 menu.addSeparator() 4020 menu.addSeparator()
3284 menu.addAction(self.searchOpenFilesAct) 4021 menu.addAction(self.searchOpenFilesAct)
3285 menu.addAction(self.replaceOpenFilesAct) 4022 menu.addAction(self.replaceOpenFilesAct)
3286 4023
3287 return menu 4024 return menu
3288 4025
3289 def initSearchToolbar(self, toolbarManager): 4026 def initSearchToolbar(self, toolbarManager):
3290 """ 4027 """
3291 Public method to create the Search toolbar. 4028 Public method to create the Search toolbar.
3292 4029
3293 @param toolbarManager reference to a toolbar manager object 4030 @param toolbarManager reference to a toolbar manager object
3294 @type EricToolBarManager 4031 @type EricToolBarManager
3295 @return generated toolbar 4032 @return generated toolbar
3296 @rtype QToolBar 4033 @rtype QToolBar
3297 """ 4034 """
3298 tb = QToolBar(QCoreApplication.translate('ViewManager', 'Search'), 4035 tb = QToolBar(QCoreApplication.translate("ViewManager", "Search"), self.ui)
3299 self.ui)
3300 tb.setIconSize(UI.Config.ToolBarIconSize) 4036 tb.setIconSize(UI.Config.ToolBarIconSize)
3301 tb.setObjectName("SearchToolbar") 4037 tb.setObjectName("SearchToolbar")
3302 tb.setToolTip(QCoreApplication.translate('ViewManager', 'Search')) 4038 tb.setToolTip(QCoreApplication.translate("ViewManager", "Search"))
3303 4039
3304 tb.addAction(self.searchAct) 4040 tb.addAction(self.searchAct)
3305 tb.addAction(self.searchNextAct) 4041 tb.addAction(self.searchNextAct)
3306 tb.addAction(self.searchPrevAct) 4042 tb.addAction(self.searchPrevAct)
3307 tb.addAction(self.searchNextWordAct) 4043 tb.addAction(self.searchNextWordAct)
3308 tb.addAction(self.searchPrevWordAct) 4044 tb.addAction(self.searchPrevWordAct)
3311 tb.addSeparator() 4047 tb.addSeparator()
3312 tb.addAction(self.searchFilesAct) 4048 tb.addAction(self.searchFilesAct)
3313 tb.addAction(self.searchOpenFilesAct) 4049 tb.addAction(self.searchOpenFilesAct)
3314 tb.addSeparator() 4050 tb.addSeparator()
3315 tb.addAction(self.gotoLastEditAct) 4051 tb.addAction(self.gotoLastEditAct)
3316 4052
3317 tb.setAllowedAreas( 4053 tb.setAllowedAreas(
3318 Qt.ToolBarArea.TopToolBarArea | 4054 Qt.ToolBarArea.TopToolBarArea | Qt.ToolBarArea.BottomToolBarArea
3319 Qt.ToolBarArea.BottomToolBarArea 4055 )
3320 ) 4056
3321
3322 toolbarManager.addToolBar(tb, tb.windowTitle()) 4057 toolbarManager.addToolBar(tb, tb.windowTitle())
3323 toolbarManager.addAction(self.gotoAct, tb.windowTitle()) 4058 toolbarManager.addAction(self.gotoAct, tb.windowTitle())
3324 toolbarManager.addAction(self.gotoBraceAct, tb.windowTitle()) 4059 toolbarManager.addAction(self.gotoBraceAct, tb.windowTitle())
3325 toolbarManager.addAction(self.replaceSelectionAct, tb.windowTitle()) 4060 toolbarManager.addAction(self.replaceSelectionAct, tb.windowTitle())
3326 toolbarManager.addAction(self.replaceAllAct, tb.windowTitle()) 4061 toolbarManager.addAction(self.replaceAllAct, tb.windowTitle())
3327 toolbarManager.addAction(self.replaceAndSearchAct, tb.windowTitle()) 4062 toolbarManager.addAction(self.replaceAndSearchAct, tb.windowTitle())
3328 4063
3329 return tb 4064 return tb
3330 4065
3331 ################################################################## 4066 ##################################################################
3332 ## Initialize the view related actions, view menu and toolbar 4067 ## Initialize the view related actions, view menu and toolbar
3333 ################################################################## 4068 ##################################################################
3334 4069
3335 def __initViewActions(self): 4070 def __initViewActions(self):
3336 """ 4071 """
3337 Private method defining the user interface actions for the view 4072 Private method defining the user interface actions for the view
3338 commands. 4073 commands.
3339 """ 4074 """
3340 self.viewActGrp = createActionGroup(self) 4075 self.viewActGrp = createActionGroup(self)
3341 self.viewFoldActGrp = createActionGroup(self) 4076 self.viewFoldActGrp = createActionGroup(self)
3342 4077
3343 self.zoomInAct = EricAction( 4078 self.zoomInAct = EricAction(
3344 QCoreApplication.translate('ViewManager', 'Zoom in'), 4079 QCoreApplication.translate("ViewManager", "Zoom in"),
3345 UI.PixmapCache.getIcon("zoomIn"), 4080 UI.PixmapCache.getIcon("zoomIn"),
3346 QCoreApplication.translate('ViewManager', 'Zoom &in'), 4081 QCoreApplication.translate("ViewManager", "Zoom &in"),
3347 QKeySequence(QCoreApplication.translate( 4082 QKeySequence(
3348 'ViewManager', "Ctrl++", "View|Zoom in")), 4083 QCoreApplication.translate("ViewManager", "Ctrl++", "View|Zoom in")
3349 QKeySequence(QCoreApplication.translate( 4084 ),
3350 'ViewManager', "Zoom In", "View|Zoom in")), 4085 QKeySequence(
3351 self.viewActGrp, 'vm_view_zoom_in') 4086 QCoreApplication.translate("ViewManager", "Zoom In", "View|Zoom in")
3352 self.zoomInAct.setStatusTip(QCoreApplication.translate( 4087 ),
3353 'ViewManager', 'Zoom in on the text')) 4088 self.viewActGrp,
3354 self.zoomInAct.setWhatsThis(QCoreApplication.translate( 4089 "vm_view_zoom_in",
3355 'ViewManager', 4090 )
3356 """<b>Zoom in</b>""" 4091 self.zoomInAct.setStatusTip(
3357 """<p>Zoom in on the text. This makes the text bigger.</p>""" 4092 QCoreApplication.translate("ViewManager", "Zoom in on the text")
3358 )) 4093 )
4094 self.zoomInAct.setWhatsThis(
4095 QCoreApplication.translate(
4096 "ViewManager",
4097 """<b>Zoom in</b>"""
4098 """<p>Zoom in on the text. This makes the text bigger.</p>""",
4099 )
4100 )
3359 self.zoomInAct.triggered.connect(self.__zoomIn) 4101 self.zoomInAct.triggered.connect(self.__zoomIn)
3360 self.viewActions.append(self.zoomInAct) 4102 self.viewActions.append(self.zoomInAct)
3361 4103
3362 self.zoomOutAct = EricAction( 4104 self.zoomOutAct = EricAction(
3363 QCoreApplication.translate('ViewManager', 'Zoom out'), 4105 QCoreApplication.translate("ViewManager", "Zoom out"),
3364 UI.PixmapCache.getIcon("zoomOut"), 4106 UI.PixmapCache.getIcon("zoomOut"),
3365 QCoreApplication.translate('ViewManager', 'Zoom &out'), 4107 QCoreApplication.translate("ViewManager", "Zoom &out"),
3366 QKeySequence(QCoreApplication.translate( 4108 QKeySequence(
3367 'ViewManager', "Ctrl+-", "View|Zoom out")), 4109 QCoreApplication.translate("ViewManager", "Ctrl+-", "View|Zoom out")
3368 QKeySequence(QCoreApplication.translate( 4110 ),
3369 'ViewManager', "Zoom Out", "View|Zoom out")), 4111 QKeySequence(
3370 self.viewActGrp, 'vm_view_zoom_out') 4112 QCoreApplication.translate("ViewManager", "Zoom Out", "View|Zoom out")
3371 self.zoomOutAct.setStatusTip(QCoreApplication.translate( 4113 ),
3372 'ViewManager', 'Zoom out on the text')) 4114 self.viewActGrp,
3373 self.zoomOutAct.setWhatsThis(QCoreApplication.translate( 4115 "vm_view_zoom_out",
3374 'ViewManager', 4116 )
3375 """<b>Zoom out</b>""" 4117 self.zoomOutAct.setStatusTip(
3376 """<p>Zoom out on the text. This makes the text smaller.</p>""" 4118 QCoreApplication.translate("ViewManager", "Zoom out on the text")
3377 )) 4119 )
4120 self.zoomOutAct.setWhatsThis(
4121 QCoreApplication.translate(
4122 "ViewManager",
4123 """<b>Zoom out</b>"""
4124 """<p>Zoom out on the text. This makes the text smaller.</p>""",
4125 )
4126 )
3378 self.zoomOutAct.triggered.connect(self.__zoomOut) 4127 self.zoomOutAct.triggered.connect(self.__zoomOut)
3379 self.viewActions.append(self.zoomOutAct) 4128 self.viewActions.append(self.zoomOutAct)
3380 4129
3381 self.zoomResetAct = EricAction( 4130 self.zoomResetAct = EricAction(
3382 QCoreApplication.translate('ViewManager', 'Zoom reset'), 4131 QCoreApplication.translate("ViewManager", "Zoom reset"),
3383 UI.PixmapCache.getIcon("zoomReset"), 4132 UI.PixmapCache.getIcon("zoomReset"),
3384 QCoreApplication.translate('ViewManager', 'Zoom &reset'), 4133 QCoreApplication.translate("ViewManager", "Zoom &reset"),
3385 QKeySequence(QCoreApplication.translate( 4134 QKeySequence(
3386 'ViewManager', "Ctrl+0", "View|Zoom reset")), 4135 QCoreApplication.translate("ViewManager", "Ctrl+0", "View|Zoom reset")
3387 0, 4136 ),
3388 self.viewActGrp, 'vm_view_zoom_reset') 4137 0,
3389 self.zoomResetAct.setStatusTip(QCoreApplication.translate( 4138 self.viewActGrp,
3390 'ViewManager', 'Reset the zoom of the text')) 4139 "vm_view_zoom_reset",
3391 self.zoomResetAct.setWhatsThis(QCoreApplication.translate( 4140 )
3392 'ViewManager', 4141 self.zoomResetAct.setStatusTip(
3393 """<b>Zoom reset</b>""" 4142 QCoreApplication.translate("ViewManager", "Reset the zoom of the text")
3394 """<p>Reset the zoom of the text. """ 4143 )
3395 """This sets the zoom factor to 100%.</p>""" 4144 self.zoomResetAct.setWhatsThis(
3396 )) 4145 QCoreApplication.translate(
4146 "ViewManager",
4147 """<b>Zoom reset</b>"""
4148 """<p>Reset the zoom of the text. """
4149 """This sets the zoom factor to 100%.</p>""",
4150 )
4151 )
3397 self.zoomResetAct.triggered.connect(self.__zoomReset) 4152 self.zoomResetAct.triggered.connect(self.__zoomReset)
3398 self.viewActions.append(self.zoomResetAct) 4153 self.viewActions.append(self.zoomResetAct)
3399 4154
3400 self.zoomToAct = EricAction( 4155 self.zoomToAct = EricAction(
3401 QCoreApplication.translate('ViewManager', 'Zoom'), 4156 QCoreApplication.translate("ViewManager", "Zoom"),
3402 UI.PixmapCache.getIcon("zoomTo"), 4157 UI.PixmapCache.getIcon("zoomTo"),
3403 QCoreApplication.translate('ViewManager', '&Zoom'), 4158 QCoreApplication.translate("ViewManager", "&Zoom"),
3404 0, 0, 4159 0,
3405 self.viewActGrp, 'vm_view_zoom') 4160 0,
3406 self.zoomToAct.setStatusTip(QCoreApplication.translate( 4161 self.viewActGrp,
3407 'ViewManager', 'Zoom the text')) 4162 "vm_view_zoom",
3408 self.zoomToAct.setWhatsThis(QCoreApplication.translate( 4163 )
3409 'ViewManager', 4164 self.zoomToAct.setStatusTip(
3410 """<b>Zoom</b>""" 4165 QCoreApplication.translate("ViewManager", "Zoom the text")
3411 """<p>Zoom the text. This opens a dialog where the""" 4166 )
3412 """ desired size can be entered.</p>""" 4167 self.zoomToAct.setWhatsThis(
3413 )) 4168 QCoreApplication.translate(
4169 "ViewManager",
4170 """<b>Zoom</b>"""
4171 """<p>Zoom the text. This opens a dialog where the"""
4172 """ desired size can be entered.</p>""",
4173 )
4174 )
3414 self.zoomToAct.triggered.connect(self.__zoom) 4175 self.zoomToAct.triggered.connect(self.__zoom)
3415 self.viewActions.append(self.zoomToAct) 4176 self.viewActions.append(self.zoomToAct)
3416 4177
3417 self.toggleAllAct = EricAction( 4178 self.toggleAllAct = EricAction(
3418 QCoreApplication.translate('ViewManager', 'Toggle all folds'), 4179 QCoreApplication.translate("ViewManager", "Toggle all folds"),
3419 QCoreApplication.translate('ViewManager', '&Toggle all folds'), 4180 QCoreApplication.translate("ViewManager", "&Toggle all folds"),
3420 0, 0, self.viewFoldActGrp, 'vm_view_toggle_all_folds') 4181 0,
3421 self.toggleAllAct.setStatusTip(QCoreApplication.translate( 4182 0,
3422 'ViewManager', 'Toggle all folds')) 4183 self.viewFoldActGrp,
3423 self.toggleAllAct.setWhatsThis(QCoreApplication.translate( 4184 "vm_view_toggle_all_folds",
3424 'ViewManager', 4185 )
3425 """<b>Toggle all folds</b>""" 4186 self.toggleAllAct.setStatusTip(
3426 """<p>Toggle all folds of the current editor.</p>""" 4187 QCoreApplication.translate("ViewManager", "Toggle all folds")
3427 )) 4188 )
4189 self.toggleAllAct.setWhatsThis(
4190 QCoreApplication.translate(
4191 "ViewManager",
4192 """<b>Toggle all folds</b>"""
4193 """<p>Toggle all folds of the current editor.</p>""",
4194 )
4195 )
3428 self.toggleAllAct.triggered.connect(self.__toggleAll) 4196 self.toggleAllAct.triggered.connect(self.__toggleAll)
3429 self.viewActions.append(self.toggleAllAct) 4197 self.viewActions.append(self.toggleAllAct)
3430 4198
3431 self.toggleAllChildrenAct = EricAction( 4199 self.toggleAllChildrenAct = EricAction(
3432 QCoreApplication.translate( 4200 QCoreApplication.translate(
3433 'ViewManager', 'Toggle all folds (including children)'), 4201 "ViewManager", "Toggle all folds (including children)"
3434 QCoreApplication.translate( 4202 ),
3435 'ViewManager', 'Toggle all &folds (including children)'), 4203 QCoreApplication.translate(
3436 0, 0, self.viewFoldActGrp, 'vm_view_toggle_all_folds_children') 4204 "ViewManager", "Toggle all &folds (including children)"
3437 self.toggleAllChildrenAct.setStatusTip(QCoreApplication.translate( 4205 ),
3438 'ViewManager', 'Toggle all folds (including children)')) 4206 0,
3439 self.toggleAllChildrenAct.setWhatsThis(QCoreApplication.translate( 4207 0,
3440 'ViewManager', 4208 self.viewFoldActGrp,
3441 """<b>Toggle all folds (including children)</b>""" 4209 "vm_view_toggle_all_folds_children",
3442 """<p>Toggle all folds of the current editor including""" 4210 )
3443 """ all children.</p>""" 4211 self.toggleAllChildrenAct.setStatusTip(
3444 )) 4212 QCoreApplication.translate(
3445 self.toggleAllChildrenAct.triggered.connect( 4213 "ViewManager", "Toggle all folds (including children)"
3446 self.__toggleAllChildren) 4214 )
4215 )
4216 self.toggleAllChildrenAct.setWhatsThis(
4217 QCoreApplication.translate(
4218 "ViewManager",
4219 """<b>Toggle all folds (including children)</b>"""
4220 """<p>Toggle all folds of the current editor including"""
4221 """ all children.</p>""",
4222 )
4223 )
4224 self.toggleAllChildrenAct.triggered.connect(self.__toggleAllChildren)
3447 self.viewActions.append(self.toggleAllChildrenAct) 4225 self.viewActions.append(self.toggleAllChildrenAct)
3448 4226
3449 self.toggleCurrentAct = EricAction( 4227 self.toggleCurrentAct = EricAction(
3450 QCoreApplication.translate('ViewManager', 'Toggle current fold'), 4228 QCoreApplication.translate("ViewManager", "Toggle current fold"),
3451 QCoreApplication.translate('ViewManager', 'Toggle &current fold'), 4229 QCoreApplication.translate("ViewManager", "Toggle &current fold"),
3452 0, 0, self.viewFoldActGrp, 'vm_view_toggle_current_fold') 4230 0,
3453 self.toggleCurrentAct.setStatusTip(QCoreApplication.translate( 4231 0,
3454 'ViewManager', 'Toggle current fold')) 4232 self.viewFoldActGrp,
3455 self.toggleCurrentAct.setWhatsThis(QCoreApplication.translate( 4233 "vm_view_toggle_current_fold",
3456 'ViewManager', 4234 )
3457 """<b>Toggle current fold</b>""" 4235 self.toggleCurrentAct.setStatusTip(
3458 """<p>Toggle the folds of the current line of the current""" 4236 QCoreApplication.translate("ViewManager", "Toggle current fold")
3459 """ editor.</p>""" 4237 )
3460 )) 4238 self.toggleCurrentAct.setWhatsThis(
4239 QCoreApplication.translate(
4240 "ViewManager",
4241 """<b>Toggle current fold</b>"""
4242 """<p>Toggle the folds of the current line of the current"""
4243 """ editor.</p>""",
4244 )
4245 )
3461 self.toggleCurrentAct.triggered.connect(self.__toggleCurrent) 4246 self.toggleCurrentAct.triggered.connect(self.__toggleCurrent)
3462 self.viewActions.append(self.toggleCurrentAct) 4247 self.viewActions.append(self.toggleCurrentAct)
3463 4248
3464 self.clearAllFoldsAct = EricAction( 4249 self.clearAllFoldsAct = EricAction(
3465 QCoreApplication.translate('ViewManager', 'Clear all folds'), 4250 QCoreApplication.translate("ViewManager", "Clear all folds"),
3466 QCoreApplication.translate('ViewManager', 'Clear &all folds'), 4251 QCoreApplication.translate("ViewManager", "Clear &all folds"),
3467 0, 0, self.viewFoldActGrp, 'vm_view_clear_all_folds') 4252 0,
3468 self.clearAllFoldsAct.setStatusTip(QCoreApplication.translate( 4253 0,
3469 'ViewManager', 'Clear all folds')) 4254 self.viewFoldActGrp,
3470 self.clearAllFoldsAct.setWhatsThis(QCoreApplication.translate( 4255 "vm_view_clear_all_folds",
3471 'ViewManager', 4256 )
3472 """<b>Clear all folds</b>""" 4257 self.clearAllFoldsAct.setStatusTip(
3473 """<p>Clear all folds of the current editor, i.e. ensure that""" 4258 QCoreApplication.translate("ViewManager", "Clear all folds")
3474 """ all lines are displayed unfolded.</p>""" 4259 )
3475 )) 4260 self.clearAllFoldsAct.setWhatsThis(
4261 QCoreApplication.translate(
4262 "ViewManager",
4263 """<b>Clear all folds</b>"""
4264 """<p>Clear all folds of the current editor, i.e. ensure that"""
4265 """ all lines are displayed unfolded.</p>""",
4266 )
4267 )
3476 self.clearAllFoldsAct.triggered.connect(self.__clearAllFolds) 4268 self.clearAllFoldsAct.triggered.connect(self.__clearAllFolds)
3477 self.viewActions.append(self.clearAllFoldsAct) 4269 self.viewActions.append(self.clearAllFoldsAct)
3478 4270
3479 self.unhighlightAct = EricAction( 4271 self.unhighlightAct = EricAction(
3480 QCoreApplication.translate('ViewManager', 'Remove all highlights'), 4272 QCoreApplication.translate("ViewManager", "Remove all highlights"),
3481 UI.PixmapCache.getIcon("unhighlight"), 4273 UI.PixmapCache.getIcon("unhighlight"),
3482 QCoreApplication.translate('ViewManager', 'Remove all highlights'), 4274 QCoreApplication.translate("ViewManager", "Remove all highlights"),
3483 0, 0, 4275 0,
3484 self, 'vm_view_unhighlight') 4276 0,
3485 self.unhighlightAct.setStatusTip(QCoreApplication.translate( 4277 self,
3486 'ViewManager', 'Remove all highlights')) 4278 "vm_view_unhighlight",
3487 self.unhighlightAct.setWhatsThis(QCoreApplication.translate( 4279 )
3488 'ViewManager', 4280 self.unhighlightAct.setStatusTip(
3489 """<b>Remove all highlights</b>""" 4281 QCoreApplication.translate("ViewManager", "Remove all highlights")
3490 """<p>Remove the highlights of all editors.</p>""" 4282 )
3491 )) 4283 self.unhighlightAct.setWhatsThis(
4284 QCoreApplication.translate(
4285 "ViewManager",
4286 """<b>Remove all highlights</b>"""
4287 """<p>Remove the highlights of all editors.</p>""",
4288 )
4289 )
3492 self.unhighlightAct.triggered.connect(self.__unhighlight) 4290 self.unhighlightAct.triggered.connect(self.__unhighlight)
3493 self.viewActions.append(self.unhighlightAct) 4291 self.viewActions.append(self.unhighlightAct)
3494 4292
3495 self.newDocumentViewAct = EricAction( 4293 self.newDocumentViewAct = EricAction(
3496 QCoreApplication.translate('ViewManager', 'New Document View'), 4294 QCoreApplication.translate("ViewManager", "New Document View"),
3497 UI.PixmapCache.getIcon("documentNewView"), 4295 UI.PixmapCache.getIcon("documentNewView"),
3498 QCoreApplication.translate('ViewManager', 'New &Document View'), 4296 QCoreApplication.translate("ViewManager", "New &Document View"),
3499 0, 0, self, 'vm_view_new_document_view') 4297 0,
3500 self.newDocumentViewAct.setStatusTip(QCoreApplication.translate( 4298 0,
3501 'ViewManager', 'Open a new view of the current document')) 4299 self,
3502 self.newDocumentViewAct.setWhatsThis(QCoreApplication.translate( 4300 "vm_view_new_document_view",
3503 'ViewManager', 4301 )
3504 """<b>New Document View</b>""" 4302 self.newDocumentViewAct.setStatusTip(
3505 """<p>Opens a new view of the current document. Both views show""" 4303 QCoreApplication.translate(
3506 """ the same document. However, the cursors may be positioned""" 4304 "ViewManager", "Open a new view of the current document"
3507 """ independently.</p>""" 4305 )
3508 )) 4306 )
4307 self.newDocumentViewAct.setWhatsThis(
4308 QCoreApplication.translate(
4309 "ViewManager",
4310 """<b>New Document View</b>"""
4311 """<p>Opens a new view of the current document. Both views show"""
4312 """ the same document. However, the cursors may be positioned"""
4313 """ independently.</p>""",
4314 )
4315 )
3509 self.newDocumentViewAct.triggered.connect(self.__newDocumentView) 4316 self.newDocumentViewAct.triggered.connect(self.__newDocumentView)
3510 self.viewActions.append(self.newDocumentViewAct) 4317 self.viewActions.append(self.newDocumentViewAct)
3511 4318
3512 self.newDocumentSplitViewAct = EricAction( 4319 self.newDocumentSplitViewAct = EricAction(
3513 QCoreApplication.translate( 4320 QCoreApplication.translate(
3514 'ViewManager', 'New Document View (with new split)'), 4321 "ViewManager", "New Document View (with new split)"
4322 ),
3515 UI.PixmapCache.getIcon("splitVertical"), 4323 UI.PixmapCache.getIcon("splitVertical"),
3516 QCoreApplication.translate( 4324 QCoreApplication.translate(
3517 'ViewManager', 'New Document View (with new split)'), 4325 "ViewManager", "New Document View (with new split)"
3518 0, 0, self, 'vm_view_new_document_split_view') 4326 ),
3519 self.newDocumentSplitViewAct.setStatusTip(QCoreApplication.translate( 4327 0,
3520 'ViewManager', 4328 0,
3521 'Open a new view of the current document in a new split')) 4329 self,
3522 self.newDocumentSplitViewAct.setWhatsThis(QCoreApplication.translate( 4330 "vm_view_new_document_split_view",
3523 'ViewManager', 4331 )
3524 """<b>New Document View</b>""" 4332 self.newDocumentSplitViewAct.setStatusTip(
3525 """<p>Opens a new view of the current document in a new split.""" 4333 QCoreApplication.translate(
3526 """ Both views show the same document. However, the cursors may""" 4334 "ViewManager", "Open a new view of the current document in a new split"
3527 """ be positioned independently.</p>""" 4335 )
3528 )) 4336 )
3529 self.newDocumentSplitViewAct.triggered.connect( 4337 self.newDocumentSplitViewAct.setWhatsThis(
3530 self.__newDocumentSplitView) 4338 QCoreApplication.translate(
4339 "ViewManager",
4340 """<b>New Document View</b>"""
4341 """<p>Opens a new view of the current document in a new split."""
4342 """ Both views show the same document. However, the cursors may"""
4343 """ be positioned independently.</p>""",
4344 )
4345 )
4346 self.newDocumentSplitViewAct.triggered.connect(self.__newDocumentSplitView)
3531 self.viewActions.append(self.newDocumentSplitViewAct) 4347 self.viewActions.append(self.newDocumentSplitViewAct)
3532 4348
3533 self.splitViewAct = EricAction( 4349 self.splitViewAct = EricAction(
3534 QCoreApplication.translate('ViewManager', 'Split view'), 4350 QCoreApplication.translate("ViewManager", "Split view"),
3535 UI.PixmapCache.getIcon("splitVertical"), 4351 UI.PixmapCache.getIcon("splitVertical"),
3536 QCoreApplication.translate('ViewManager', '&Split view'), 4352 QCoreApplication.translate("ViewManager", "&Split view"),
3537 0, 0, self, 'vm_view_split_view') 4353 0,
3538 self.splitViewAct.setStatusTip(QCoreApplication.translate( 4354 0,
3539 'ViewManager', 'Add a split to the view')) 4355 self,
3540 self.splitViewAct.setWhatsThis(QCoreApplication.translate( 4356 "vm_view_split_view",
3541 'ViewManager', 4357 )
3542 """<b>Split view</b>""" 4358 self.splitViewAct.setStatusTip(
3543 """<p>Add a split to the view.</p>""" 4359 QCoreApplication.translate("ViewManager", "Add a split to the view")
3544 )) 4360 )
4361 self.splitViewAct.setWhatsThis(
4362 QCoreApplication.translate(
4363 "ViewManager",
4364 """<b>Split view</b>""" """<p>Add a split to the view.</p>""",
4365 )
4366 )
3545 self.splitViewAct.triggered.connect(self.__splitView) 4367 self.splitViewAct.triggered.connect(self.__splitView)
3546 self.viewActions.append(self.splitViewAct) 4368 self.viewActions.append(self.splitViewAct)
3547 4369
3548 self.splitOrientationAct = EricAction( 4370 self.splitOrientationAct = EricAction(
3549 QCoreApplication.translate('ViewManager', 'Arrange horizontally'), 4371 QCoreApplication.translate("ViewManager", "Arrange horizontally"),
3550 QCoreApplication.translate('ViewManager', 'Arrange &horizontally'), 4372 QCoreApplication.translate("ViewManager", "Arrange &horizontally"),
3551 0, 0, self, 'vm_view_arrange_horizontally', True) 4373 0,
3552 self.splitOrientationAct.setStatusTip(QCoreApplication.translate( 4374 0,
3553 'ViewManager', 'Arrange the splitted views horizontally')) 4375 self,
3554 self.splitOrientationAct.setWhatsThis(QCoreApplication.translate( 4376 "vm_view_arrange_horizontally",
3555 'ViewManager', 4377 True,
3556 """<b>Arrange horizontally</b>""" 4378 )
3557 """<p>Arrange the splitted views horizontally.</p>""" 4379 self.splitOrientationAct.setStatusTip(
3558 )) 4380 QCoreApplication.translate(
4381 "ViewManager", "Arrange the splitted views horizontally"
4382 )
4383 )
4384 self.splitOrientationAct.setWhatsThis(
4385 QCoreApplication.translate(
4386 "ViewManager",
4387 """<b>Arrange horizontally</b>"""
4388 """<p>Arrange the splitted views horizontally.</p>""",
4389 )
4390 )
3559 self.splitOrientationAct.setChecked(False) 4391 self.splitOrientationAct.setChecked(False)
3560 self.splitOrientationAct.toggled[bool].connect(self.__splitOrientation) 4392 self.splitOrientationAct.toggled[bool].connect(self.__splitOrientation)
3561 self.viewActions.append(self.splitOrientationAct) 4393 self.viewActions.append(self.splitOrientationAct)
3562 4394
3563 self.splitRemoveAct = EricAction( 4395 self.splitRemoveAct = EricAction(
3564 QCoreApplication.translate('ViewManager', 'Remove split'), 4396 QCoreApplication.translate("ViewManager", "Remove split"),
3565 UI.PixmapCache.getIcon("remsplitVertical"), 4397 UI.PixmapCache.getIcon("remsplitVertical"),
3566 QCoreApplication.translate('ViewManager', '&Remove split'), 4398 QCoreApplication.translate("ViewManager", "&Remove split"),
3567 0, 0, self, 'vm_view_remove_split') 4399 0,
3568 self.splitRemoveAct.setStatusTip(QCoreApplication.translate( 4400 0,
3569 'ViewManager', 'Remove the current split')) 4401 self,
3570 self.splitRemoveAct.setWhatsThis(QCoreApplication.translate( 4402 "vm_view_remove_split",
3571 'ViewManager', 4403 )
3572 """<b>Remove split</b>""" 4404 self.splitRemoveAct.setStatusTip(
3573 """<p>Remove the current split.</p>""" 4405 QCoreApplication.translate("ViewManager", "Remove the current split")
3574 )) 4406 )
4407 self.splitRemoveAct.setWhatsThis(
4408 QCoreApplication.translate(
4409 "ViewManager",
4410 """<b>Remove split</b>""" """<p>Remove the current split.</p>""",
4411 )
4412 )
3575 self.splitRemoveAct.triggered.connect(self.removeSplit) 4413 self.splitRemoveAct.triggered.connect(self.removeSplit)
3576 self.viewActions.append(self.splitRemoveAct) 4414 self.viewActions.append(self.splitRemoveAct)
3577 4415
3578 self.nextSplitAct = EricAction( 4416 self.nextSplitAct = EricAction(
3579 QCoreApplication.translate('ViewManager', 'Next split'), 4417 QCoreApplication.translate("ViewManager", "Next split"),
3580 QCoreApplication.translate('ViewManager', '&Next split'), 4418 QCoreApplication.translate("ViewManager", "&Next split"),
3581 QKeySequence(QCoreApplication.translate( 4419 QKeySequence(
3582 'ViewManager', "Ctrl+Alt+N", "View|Next split")), 4420 QCoreApplication.translate(
3583 0, 4421 "ViewManager", "Ctrl+Alt+N", "View|Next split"
3584 self, 'vm_next_split') 4422 )
3585 self.nextSplitAct.setStatusTip(QCoreApplication.translate( 4423 ),
3586 'ViewManager', 'Move to the next split')) 4424 0,
3587 self.nextSplitAct.setWhatsThis(QCoreApplication.translate( 4425 self,
3588 'ViewManager', 4426 "vm_next_split",
3589 """<b>Next split</b>""" 4427 )
3590 """<p>Move to the next split.</p>""" 4428 self.nextSplitAct.setStatusTip(
3591 )) 4429 QCoreApplication.translate("ViewManager", "Move to the next split")
4430 )
4431 self.nextSplitAct.setWhatsThis(
4432 QCoreApplication.translate(
4433 "ViewManager",
4434 """<b>Next split</b>""" """<p>Move to the next split.</p>""",
4435 )
4436 )
3592 self.nextSplitAct.triggered.connect(self.nextSplit) 4437 self.nextSplitAct.triggered.connect(self.nextSplit)
3593 self.viewActions.append(self.nextSplitAct) 4438 self.viewActions.append(self.nextSplitAct)
3594 4439
3595 self.prevSplitAct = EricAction( 4440 self.prevSplitAct = EricAction(
3596 QCoreApplication.translate('ViewManager', 'Previous split'), 4441 QCoreApplication.translate("ViewManager", "Previous split"),
3597 QCoreApplication.translate('ViewManager', '&Previous split'), 4442 QCoreApplication.translate("ViewManager", "&Previous split"),
3598 QKeySequence(QCoreApplication.translate( 4443 QKeySequence(
3599 'ViewManager', "Ctrl+Alt+P", "View|Previous split")), 4444 QCoreApplication.translate(
3600 0, self, 'vm_previous_split') 4445 "ViewManager", "Ctrl+Alt+P", "View|Previous split"
3601 self.prevSplitAct.setStatusTip(QCoreApplication.translate( 4446 )
3602 'ViewManager', 'Move to the previous split')) 4447 ),
3603 self.prevSplitAct.setWhatsThis(QCoreApplication.translate( 4448 0,
3604 'ViewManager', 4449 self,
3605 """<b>Previous split</b>""" 4450 "vm_previous_split",
3606 """<p>Move to the previous split.</p>""" 4451 )
3607 )) 4452 self.prevSplitAct.setStatusTip(
4453 QCoreApplication.translate("ViewManager", "Move to the previous split")
4454 )
4455 self.prevSplitAct.setWhatsThis(
4456 QCoreApplication.translate(
4457 "ViewManager",
4458 """<b>Previous split</b>""" """<p>Move to the previous split.</p>""",
4459 )
4460 )
3608 self.prevSplitAct.triggered.connect(self.prevSplit) 4461 self.prevSplitAct.triggered.connect(self.prevSplit)
3609 self.viewActions.append(self.prevSplitAct) 4462 self.viewActions.append(self.prevSplitAct)
3610 4463
3611 self.previewAct = EricAction( 4464 self.previewAct = EricAction(
3612 QCoreApplication.translate('ViewManager', 'Preview'), 4465 QCoreApplication.translate("ViewManager", "Preview"),
3613 UI.PixmapCache.getIcon("previewer"), 4466 UI.PixmapCache.getIcon("previewer"),
3614 QCoreApplication.translate('ViewManager', 'Preview'), 4467 QCoreApplication.translate("ViewManager", "Preview"),
3615 0, 0, self, 'vm_preview', True) 4468 0,
3616 self.previewAct.setStatusTip(QCoreApplication.translate( 4469 0,
3617 'ViewManager', 'Preview the current file in the web browser')) 4470 self,
3618 self.previewAct.setWhatsThis(QCoreApplication.translate( 4471 "vm_preview",
3619 'ViewManager', 4472 True,
3620 """<b>Preview</b>""" 4473 )
3621 """<p>This opens the web browser with a preview of""" 4474 self.previewAct.setStatusTip(
3622 """ the current file.</p>""" 4475 QCoreApplication.translate(
3623 )) 4476 "ViewManager", "Preview the current file in the web browser"
4477 )
4478 )
4479 self.previewAct.setWhatsThis(
4480 QCoreApplication.translate(
4481 "ViewManager",
4482 """<b>Preview</b>"""
4483 """<p>This opens the web browser with a preview of"""
4484 """ the current file.</p>""",
4485 )
4486 )
3624 self.previewAct.setChecked(Preferences.getUI("ShowFilePreview")) 4487 self.previewAct.setChecked(Preferences.getUI("ShowFilePreview"))
3625 self.previewAct.toggled[bool].connect(self.__previewEditor) 4488 self.previewAct.toggled[bool].connect(self.__previewEditor)
3626 self.viewActions.append(self.previewAct) 4489 self.viewActions.append(self.previewAct)
3627 4490
3628 self.astViewerAct = EricAction( 4491 self.astViewerAct = EricAction(
3629 QCoreApplication.translate('ViewManager', 'Python AST Viewer'), 4492 QCoreApplication.translate("ViewManager", "Python AST Viewer"),
3630 UI.PixmapCache.getIcon("astTree"), 4493 UI.PixmapCache.getIcon("astTree"),
3631 QCoreApplication.translate('ViewManager', 'Python AST Viewer'), 4494 QCoreApplication.translate("ViewManager", "Python AST Viewer"),
3632 0, 0, self, 'vm_python_ast_viewer', True) 4495 0,
3633 self.astViewerAct.setStatusTip(QCoreApplication.translate( 4496 0,
3634 'ViewManager', 'Show the AST for the current Python file')) 4497 self,
3635 self.astViewerAct.setWhatsThis(QCoreApplication.translate( 4498 "vm_python_ast_viewer",
3636 'ViewManager', 4499 True,
3637 """<b>Python AST Viewer</b>""" 4500 )
3638 """<p>This opens the a tree view of the AST of the current""" 4501 self.astViewerAct.setStatusTip(
3639 """ Python source file.</p>""" 4502 QCoreApplication.translate(
3640 )) 4503 "ViewManager", "Show the AST for the current Python file"
4504 )
4505 )
4506 self.astViewerAct.setWhatsThis(
4507 QCoreApplication.translate(
4508 "ViewManager",
4509 """<b>Python AST Viewer</b>"""
4510 """<p>This opens the a tree view of the AST of the current"""
4511 """ Python source file.</p>""",
4512 )
4513 )
3641 self.astViewerAct.setChecked(False) 4514 self.astViewerAct.setChecked(False)
3642 self.astViewerAct.toggled[bool].connect(self.__astViewer) 4515 self.astViewerAct.toggled[bool].connect(self.__astViewer)
3643 self.viewActions.append(self.astViewerAct) 4516 self.viewActions.append(self.astViewerAct)
3644 4517
3645 self.disViewerAct = EricAction( 4518 self.disViewerAct = EricAction(
3646 QCoreApplication.translate( 4519 QCoreApplication.translate("ViewManager", "Python Disassembly Viewer"),
3647 'ViewManager', 'Python Disassembly Viewer'),
3648 UI.PixmapCache.getIcon("disassembly"), 4520 UI.PixmapCache.getIcon("disassembly"),
3649 QCoreApplication.translate( 4521 QCoreApplication.translate("ViewManager", "Python Disassembly Viewer"),
3650 'ViewManager', 'Python Disassembly Viewer'), 4522 0,
3651 0, 0, self, 'vm_python_dis_viewer', True) 4523 0,
3652 self.disViewerAct.setStatusTip(QCoreApplication.translate( 4524 self,
3653 'ViewManager', 'Show the Disassembly for the current Python file')) 4525 "vm_python_dis_viewer",
3654 self.disViewerAct.setWhatsThis(QCoreApplication.translate( 4526 True,
3655 'ViewManager', 4527 )
3656 """<b>Python Disassembly Viewer</b>""" 4528 self.disViewerAct.setStatusTip(
3657 """<p>This opens the a tree view of the Disassembly of the""" 4529 QCoreApplication.translate(
3658 """ current Python source file.</p>""" 4530 "ViewManager", "Show the Disassembly for the current Python file"
3659 )) 4531 )
4532 )
4533 self.disViewerAct.setWhatsThis(
4534 QCoreApplication.translate(
4535 "ViewManager",
4536 """<b>Python Disassembly Viewer</b>"""
4537 """<p>This opens the a tree view of the Disassembly of the"""
4538 """ current Python source file.</p>""",
4539 )
4540 )
3660 self.disViewerAct.setChecked(False) 4541 self.disViewerAct.setChecked(False)
3661 self.disViewerAct.toggled[bool].connect(self.__disViewer) 4542 self.disViewerAct.toggled[bool].connect(self.__disViewer)
3662 self.viewActions.append(self.disViewerAct) 4543 self.viewActions.append(self.disViewerAct)
3663 4544
3664 self.viewActGrp.setEnabled(False) 4545 self.viewActGrp.setEnabled(False)
3665 self.viewFoldActGrp.setEnabled(False) 4546 self.viewFoldActGrp.setEnabled(False)
3666 self.unhighlightAct.setEnabled(False) 4547 self.unhighlightAct.setEnabled(False)
3667 self.splitViewAct.setEnabled(False) 4548 self.splitViewAct.setEnabled(False)
3668 self.splitOrientationAct.setEnabled(False) 4549 self.splitOrientationAct.setEnabled(False)
3672 self.previewAct.setEnabled(True) 4553 self.previewAct.setEnabled(True)
3673 self.astViewerAct.setEnabled(False) 4554 self.astViewerAct.setEnabled(False)
3674 self.disViewerAct.setEnabled(False) 4555 self.disViewerAct.setEnabled(False)
3675 self.newDocumentViewAct.setEnabled(False) 4556 self.newDocumentViewAct.setEnabled(False)
3676 self.newDocumentSplitViewAct.setEnabled(False) 4557 self.newDocumentSplitViewAct.setEnabled(False)
3677 4558
3678 self.splitOrientationAct.setChecked( 4559 self.splitOrientationAct.setChecked(
3679 Preferences.getUI("SplitOrientationVertical")) 4560 Preferences.getUI("SplitOrientationVertical")
3680 4561 )
4562
3681 def initViewMenu(self): 4563 def initViewMenu(self):
3682 """ 4564 """
3683 Public method to create the View menu. 4565 Public method to create the View menu.
3684 4566
3685 @return the generated menu 4567 @return the generated menu
3686 """ 4568 """
3687 menu = QMenu(QCoreApplication.translate('ViewManager', '&View'), 4569 menu = QMenu(QCoreApplication.translate("ViewManager", "&View"), self.ui)
3688 self.ui)
3689 menu.setTearOffEnabled(True) 4570 menu.setTearOffEnabled(True)
3690 menu.addActions(self.viewActGrp.actions()) 4571 menu.addActions(self.viewActGrp.actions())
3691 menu.addSeparator() 4572 menu.addSeparator()
3692 menu.addActions(self.viewFoldActGrp.actions()) 4573 menu.addActions(self.viewFoldActGrp.actions())
3693 menu.addSeparator() 4574 menu.addSeparator()
3704 menu.addAction(self.splitViewAct) 4585 menu.addAction(self.splitViewAct)
3705 menu.addAction(self.splitOrientationAct) 4586 menu.addAction(self.splitOrientationAct)
3706 menu.addAction(self.splitRemoveAct) 4587 menu.addAction(self.splitRemoveAct)
3707 menu.addAction(self.nextSplitAct) 4588 menu.addAction(self.nextSplitAct)
3708 menu.addAction(self.prevSplitAct) 4589 menu.addAction(self.prevSplitAct)
3709 4590
3710 return menu 4591 return menu
3711 4592
3712 def initViewToolbar(self, toolbarManager): 4593 def initViewToolbar(self, toolbarManager):
3713 """ 4594 """
3714 Public method to create the View toolbar. 4595 Public method to create the View toolbar.
3715 4596
3716 @param toolbarManager reference to a toolbar manager object 4597 @param toolbarManager reference to a toolbar manager object
3717 (EricToolBarManager) 4598 (EricToolBarManager)
3718 @return the generated toolbar 4599 @return the generated toolbar
3719 """ 4600 """
3720 tb = QToolBar(QCoreApplication.translate('ViewManager', 'View'), 4601 tb = QToolBar(QCoreApplication.translate("ViewManager", "View"), self.ui)
3721 self.ui)
3722 tb.setIconSize(UI.Config.ToolBarIconSize) 4602 tb.setIconSize(UI.Config.ToolBarIconSize)
3723 tb.setObjectName("ViewToolbar") 4603 tb.setObjectName("ViewToolbar")
3724 tb.setToolTip(QCoreApplication.translate('ViewManager', 'View')) 4604 tb.setToolTip(QCoreApplication.translate("ViewManager", "View"))
3725 4605
3726 tb.addActions(self.viewActGrp.actions()) 4606 tb.addActions(self.viewActGrp.actions())
3727 tb.addSeparator() 4607 tb.addSeparator()
3728 tb.addAction(self.previewAct) 4608 tb.addAction(self.previewAct)
3729 tb.addAction(self.astViewerAct) 4609 tb.addAction(self.astViewerAct)
3730 tb.addAction(self.disViewerAct) 4610 tb.addAction(self.disViewerAct)
3731 tb.addSeparator() 4611 tb.addSeparator()
3732 tb.addAction(self.newDocumentViewAct) 4612 tb.addAction(self.newDocumentViewAct)
3733 if self.canSplit(): 4613 if self.canSplit():
3734 tb.addAction(self.newDocumentSplitViewAct) 4614 tb.addAction(self.newDocumentSplitViewAct)
3735 4615
3736 toolbarManager.addToolBar(tb, tb.windowTitle()) 4616 toolbarManager.addToolBar(tb, tb.windowTitle())
3737 toolbarManager.addAction(self.unhighlightAct, tb.windowTitle()) 4617 toolbarManager.addAction(self.unhighlightAct, tb.windowTitle())
3738 toolbarManager.addAction(self.splitViewAct, tb.windowTitle()) 4618 toolbarManager.addAction(self.splitViewAct, tb.windowTitle())
3739 toolbarManager.addAction(self.splitRemoveAct, tb.windowTitle()) 4619 toolbarManager.addAction(self.splitRemoveAct, tb.windowTitle())
3740 4620
3741 return tb 4621 return tb
3742 4622
3743 ################################################################## 4623 ##################################################################
3744 ## Initialize the macro related actions and macro menu 4624 ## Initialize the macro related actions and macro menu
3745 ################################################################## 4625 ##################################################################
3746 4626
3747 def __initMacroActions(self): 4627 def __initMacroActions(self):
3748 """ 4628 """
3749 Private method defining the user interface actions for the macro 4629 Private method defining the user interface actions for the macro
3750 commands. 4630 commands.
3751 """ 4631 """
3752 self.macroActGrp = createActionGroup(self) 4632 self.macroActGrp = createActionGroup(self)
3753 4633
3754 self.macroStartRecAct = EricAction( 4634 self.macroStartRecAct = EricAction(
3755 QCoreApplication.translate( 4635 QCoreApplication.translate("ViewManager", "Start Macro Recording"),
3756 'ViewManager', 'Start Macro Recording'), 4636 QCoreApplication.translate("ViewManager", "S&tart Macro Recording"),
3757 QCoreApplication.translate( 4637 0,
3758 'ViewManager', 'S&tart Macro Recording'), 4638 0,
3759 0, 0, self.macroActGrp, 'vm_macro_start_recording') 4639 self.macroActGrp,
3760 self.macroStartRecAct.setStatusTip(QCoreApplication.translate( 4640 "vm_macro_start_recording",
3761 'ViewManager', 'Start Macro Recording')) 4641 )
3762 self.macroStartRecAct.setWhatsThis(QCoreApplication.translate( 4642 self.macroStartRecAct.setStatusTip(
3763 'ViewManager', 4643 QCoreApplication.translate("ViewManager", "Start Macro Recording")
3764 """<b>Start Macro Recording</b>""" 4644 )
3765 """<p>Start recording editor commands into a new macro.</p>""" 4645 self.macroStartRecAct.setWhatsThis(
3766 )) 4646 QCoreApplication.translate(
4647 "ViewManager",
4648 """<b>Start Macro Recording</b>"""
4649 """<p>Start recording editor commands into a new macro.</p>""",
4650 )
4651 )
3767 self.macroStartRecAct.triggered.connect(self.__macroStartRecording) 4652 self.macroStartRecAct.triggered.connect(self.__macroStartRecording)
3768 self.macroActions.append(self.macroStartRecAct) 4653 self.macroActions.append(self.macroStartRecAct)
3769 4654
3770 self.macroStopRecAct = EricAction( 4655 self.macroStopRecAct = EricAction(
3771 QCoreApplication.translate('ViewManager', 'Stop Macro Recording'), 4656 QCoreApplication.translate("ViewManager", "Stop Macro Recording"),
3772 QCoreApplication.translate('ViewManager', 'Sto&p Macro Recording'), 4657 QCoreApplication.translate("ViewManager", "Sto&p Macro Recording"),
3773 0, 0, self.macroActGrp, 'vm_macro_stop_recording') 4658 0,
3774 self.macroStopRecAct.setStatusTip(QCoreApplication.translate( 4659 0,
3775 'ViewManager', 'Stop Macro Recording')) 4660 self.macroActGrp,
3776 self.macroStopRecAct.setWhatsThis(QCoreApplication.translate( 4661 "vm_macro_stop_recording",
3777 'ViewManager', 4662 )
3778 """<b>Stop Macro Recording</b>""" 4663 self.macroStopRecAct.setStatusTip(
3779 """<p>Stop recording editor commands into a new macro.</p>""" 4664 QCoreApplication.translate("ViewManager", "Stop Macro Recording")
3780 )) 4665 )
4666 self.macroStopRecAct.setWhatsThis(
4667 QCoreApplication.translate(
4668 "ViewManager",
4669 """<b>Stop Macro Recording</b>"""
4670 """<p>Stop recording editor commands into a new macro.</p>""",
4671 )
4672 )
3781 self.macroStopRecAct.triggered.connect(self.__macroStopRecording) 4673 self.macroStopRecAct.triggered.connect(self.__macroStopRecording)
3782 self.macroActions.append(self.macroStopRecAct) 4674 self.macroActions.append(self.macroStopRecAct)
3783 4675
3784 self.macroRunAct = EricAction( 4676 self.macroRunAct = EricAction(
3785 QCoreApplication.translate('ViewManager', 'Run Macro'), 4677 QCoreApplication.translate("ViewManager", "Run Macro"),
3786 QCoreApplication.translate('ViewManager', '&Run Macro'), 4678 QCoreApplication.translate("ViewManager", "&Run Macro"),
3787 0, 0, self.macroActGrp, 'vm_macro_run') 4679 0,
3788 self.macroRunAct.setStatusTip(QCoreApplication.translate( 4680 0,
3789 'ViewManager', 'Run Macro')) 4681 self.macroActGrp,
3790 self.macroRunAct.setWhatsThis(QCoreApplication.translate( 4682 "vm_macro_run",
3791 'ViewManager', 4683 )
3792 """<b>Run Macro</b>""" 4684 self.macroRunAct.setStatusTip(
3793 """<p>Run a previously recorded editor macro.</p>""" 4685 QCoreApplication.translate("ViewManager", "Run Macro")
3794 )) 4686 )
4687 self.macroRunAct.setWhatsThis(
4688 QCoreApplication.translate(
4689 "ViewManager",
4690 """<b>Run Macro</b>"""
4691 """<p>Run a previously recorded editor macro.</p>""",
4692 )
4693 )
3795 self.macroRunAct.triggered.connect(self.__macroRun) 4694 self.macroRunAct.triggered.connect(self.__macroRun)
3796 self.macroActions.append(self.macroRunAct) 4695 self.macroActions.append(self.macroRunAct)
3797 4696
3798 self.macroDeleteAct = EricAction( 4697 self.macroDeleteAct = EricAction(
3799 QCoreApplication.translate('ViewManager', 'Delete Macro'), 4698 QCoreApplication.translate("ViewManager", "Delete Macro"),
3800 QCoreApplication.translate('ViewManager', '&Delete Macro'), 4699 QCoreApplication.translate("ViewManager", "&Delete Macro"),
3801 0, 0, self.macroActGrp, 'vm_macro_delete') 4700 0,
3802 self.macroDeleteAct.setStatusTip(QCoreApplication.translate( 4701 0,
3803 'ViewManager', 'Delete Macro')) 4702 self.macroActGrp,
3804 self.macroDeleteAct.setWhatsThis(QCoreApplication.translate( 4703 "vm_macro_delete",
3805 'ViewManager', 4704 )
3806 """<b>Delete Macro</b>""" 4705 self.macroDeleteAct.setStatusTip(
3807 """<p>Delete a previously recorded editor macro.</p>""" 4706 QCoreApplication.translate("ViewManager", "Delete Macro")
3808 )) 4707 )
4708 self.macroDeleteAct.setWhatsThis(
4709 QCoreApplication.translate(
4710 "ViewManager",
4711 """<b>Delete Macro</b>"""
4712 """<p>Delete a previously recorded editor macro.</p>""",
4713 )
4714 )
3809 self.macroDeleteAct.triggered.connect(self.__macroDelete) 4715 self.macroDeleteAct.triggered.connect(self.__macroDelete)
3810 self.macroActions.append(self.macroDeleteAct) 4716 self.macroActions.append(self.macroDeleteAct)
3811 4717
3812 self.macroLoadAct = EricAction( 4718 self.macroLoadAct = EricAction(
3813 QCoreApplication.translate('ViewManager', 'Load Macro'), 4719 QCoreApplication.translate("ViewManager", "Load Macro"),
3814 QCoreApplication.translate('ViewManager', '&Load Macro'), 4720 QCoreApplication.translate("ViewManager", "&Load Macro"),
3815 0, 0, self.macroActGrp, 'vm_macro_load') 4721 0,
3816 self.macroLoadAct.setStatusTip(QCoreApplication.translate( 4722 0,
3817 'ViewManager', 'Load Macro')) 4723 self.macroActGrp,
3818 self.macroLoadAct.setWhatsThis(QCoreApplication.translate( 4724 "vm_macro_load",
3819 'ViewManager', 4725 )
3820 """<b>Load Macro</b>""" 4726 self.macroLoadAct.setStatusTip(
3821 """<p>Load an editor macro from a file.</p>""" 4727 QCoreApplication.translate("ViewManager", "Load Macro")
3822 )) 4728 )
4729 self.macroLoadAct.setWhatsThis(
4730 QCoreApplication.translate(
4731 "ViewManager",
4732 """<b>Load Macro</b>""" """<p>Load an editor macro from a file.</p>""",
4733 )
4734 )
3823 self.macroLoadAct.triggered.connect(self.__macroLoad) 4735 self.macroLoadAct.triggered.connect(self.__macroLoad)
3824 self.macroActions.append(self.macroLoadAct) 4736 self.macroActions.append(self.macroLoadAct)
3825 4737
3826 self.macroSaveAct = EricAction( 4738 self.macroSaveAct = EricAction(
3827 QCoreApplication.translate('ViewManager', 'Save Macro'), 4739 QCoreApplication.translate("ViewManager", "Save Macro"),
3828 QCoreApplication.translate('ViewManager', '&Save Macro'), 4740 QCoreApplication.translate("ViewManager", "&Save Macro"),
3829 0, 0, self.macroActGrp, 'vm_macro_save') 4741 0,
3830 self.macroSaveAct.setStatusTip(QCoreApplication.translate( 4742 0,
3831 'ViewManager', 'Save Macro')) 4743 self.macroActGrp,
3832 self.macroSaveAct.setWhatsThis(QCoreApplication.translate( 4744 "vm_macro_save",
3833 'ViewManager', 4745 )
3834 """<b>Save Macro</b>""" 4746 self.macroSaveAct.setStatusTip(
3835 """<p>Save a previously recorded editor macro to a file.</p>""" 4747 QCoreApplication.translate("ViewManager", "Save Macro")
3836 )) 4748 )
4749 self.macroSaveAct.setWhatsThis(
4750 QCoreApplication.translate(
4751 "ViewManager",
4752 """<b>Save Macro</b>"""
4753 """<p>Save a previously recorded editor macro to a file.</p>""",
4754 )
4755 )
3837 self.macroSaveAct.triggered.connect(self.__macroSave) 4756 self.macroSaveAct.triggered.connect(self.__macroSave)
3838 self.macroActions.append(self.macroSaveAct) 4757 self.macroActions.append(self.macroSaveAct)
3839 4758
3840 self.macroActGrp.setEnabled(False) 4759 self.macroActGrp.setEnabled(False)
3841 4760
3842 def initMacroMenu(self): 4761 def initMacroMenu(self):
3843 """ 4762 """
3844 Public method to create the Macro menu. 4763 Public method to create the Macro menu.
3845 4764
3846 @return the generated menu 4765 @return the generated menu
3847 """ 4766 """
3848 menu = QMenu(QCoreApplication.translate('ViewManager', "&Macros"), 4767 menu = QMenu(QCoreApplication.translate("ViewManager", "&Macros"), self.ui)
3849 self.ui)
3850 menu.setTearOffEnabled(True) 4768 menu.setTearOffEnabled(True)
3851 menu.addActions(self.macroActGrp.actions()) 4769 menu.addActions(self.macroActGrp.actions())
3852 4770
3853 return menu 4771 return menu
3854 4772
3855 ##################################################################### 4773 #####################################################################
3856 ## Initialize the bookmark related actions, bookmark menu and toolbar 4774 ## Initialize the bookmark related actions, bookmark menu and toolbar
3857 ##################################################################### 4775 #####################################################################
3858 4776
3859 def __initBookmarkActions(self): 4777 def __initBookmarkActions(self):
3860 """ 4778 """
3861 Private method defining the user interface actions for the bookmarks 4779 Private method defining the user interface actions for the bookmarks
3862 commands. 4780 commands.
3863 """ 4781 """
3864 self.bookmarkActGrp = createActionGroup(self) 4782 self.bookmarkActGrp = createActionGroup(self)
3865 4783
3866 self.bookmarkToggleAct = EricAction( 4784 self.bookmarkToggleAct = EricAction(
3867 QCoreApplication.translate('ViewManager', 'Toggle Bookmark'), 4785 QCoreApplication.translate("ViewManager", "Toggle Bookmark"),
3868 UI.PixmapCache.getIcon("bookmarkToggle"), 4786 UI.PixmapCache.getIcon("bookmarkToggle"),
3869 QCoreApplication.translate('ViewManager', '&Toggle Bookmark'), 4787 QCoreApplication.translate("ViewManager", "&Toggle Bookmark"),
3870 QKeySequence(QCoreApplication.translate( 4788 QKeySequence(
3871 'ViewManager', "Alt+Ctrl+T", "Bookmark|Toggle")), 4789 QCoreApplication.translate(
3872 0, 4790 "ViewManager", "Alt+Ctrl+T", "Bookmark|Toggle"
3873 self.bookmarkActGrp, 'vm_bookmark_toggle') 4791 )
3874 self.bookmarkToggleAct.setStatusTip(QCoreApplication.translate( 4792 ),
3875 'ViewManager', 'Toggle Bookmark')) 4793 0,
3876 self.bookmarkToggleAct.setWhatsThis(QCoreApplication.translate( 4794 self.bookmarkActGrp,
3877 'ViewManager', 4795 "vm_bookmark_toggle",
3878 """<b>Toggle Bookmark</b>""" 4796 )
3879 """<p>Toggle a bookmark at the current line of the current""" 4797 self.bookmarkToggleAct.setStatusTip(
3880 """ editor.</p>""" 4798 QCoreApplication.translate("ViewManager", "Toggle Bookmark")
3881 )) 4799 )
4800 self.bookmarkToggleAct.setWhatsThis(
4801 QCoreApplication.translate(
4802 "ViewManager",
4803 """<b>Toggle Bookmark</b>"""
4804 """<p>Toggle a bookmark at the current line of the current"""
4805 """ editor.</p>""",
4806 )
4807 )
3882 self.bookmarkToggleAct.triggered.connect(self.__toggleBookmark) 4808 self.bookmarkToggleAct.triggered.connect(self.__toggleBookmark)
3883 self.bookmarkActions.append(self.bookmarkToggleAct) 4809 self.bookmarkActions.append(self.bookmarkToggleAct)
3884 4810
3885 self.bookmarkNextAct = EricAction( 4811 self.bookmarkNextAct = EricAction(
3886 QCoreApplication.translate('ViewManager', 'Next Bookmark'), 4812 QCoreApplication.translate("ViewManager", "Next Bookmark"),
3887 UI.PixmapCache.getIcon("bookmarkNext"), 4813 UI.PixmapCache.getIcon("bookmarkNext"),
3888 QCoreApplication.translate('ViewManager', '&Next Bookmark'), 4814 QCoreApplication.translate("ViewManager", "&Next Bookmark"),
3889 QKeySequence(QCoreApplication.translate( 4815 QKeySequence(
3890 'ViewManager', "Ctrl+PgDown", "Bookmark|Next")), 4816 QCoreApplication.translate(
3891 0, 4817 "ViewManager", "Ctrl+PgDown", "Bookmark|Next"
3892 self.bookmarkActGrp, 'vm_bookmark_next') 4818 )
3893 self.bookmarkNextAct.setStatusTip(QCoreApplication.translate( 4819 ),
3894 'ViewManager', 'Next Bookmark')) 4820 0,
3895 self.bookmarkNextAct.setWhatsThis(QCoreApplication.translate( 4821 self.bookmarkActGrp,
3896 'ViewManager', 4822 "vm_bookmark_next",
3897 """<b>Next Bookmark</b>""" 4823 )
3898 """<p>Go to next bookmark of the current editor.</p>""" 4824 self.bookmarkNextAct.setStatusTip(
3899 )) 4825 QCoreApplication.translate("ViewManager", "Next Bookmark")
4826 )
4827 self.bookmarkNextAct.setWhatsThis(
4828 QCoreApplication.translate(
4829 "ViewManager",
4830 """<b>Next Bookmark</b>"""
4831 """<p>Go to next bookmark of the current editor.</p>""",
4832 )
4833 )
3900 self.bookmarkNextAct.triggered.connect(self.__nextBookmark) 4834 self.bookmarkNextAct.triggered.connect(self.__nextBookmark)
3901 self.bookmarkActions.append(self.bookmarkNextAct) 4835 self.bookmarkActions.append(self.bookmarkNextAct)
3902 4836
3903 self.bookmarkPreviousAct = EricAction( 4837 self.bookmarkPreviousAct = EricAction(
3904 QCoreApplication.translate('ViewManager', 'Previous Bookmark'), 4838 QCoreApplication.translate("ViewManager", "Previous Bookmark"),
3905 UI.PixmapCache.getIcon("bookmarkPrevious"), 4839 UI.PixmapCache.getIcon("bookmarkPrevious"),
3906 QCoreApplication.translate('ViewManager', '&Previous Bookmark'), 4840 QCoreApplication.translate("ViewManager", "&Previous Bookmark"),
3907 QKeySequence(QCoreApplication.translate( 4841 QKeySequence(
3908 'ViewManager', "Ctrl+PgUp", "Bookmark|Previous")), 4842 QCoreApplication.translate(
3909 0, 4843 "ViewManager", "Ctrl+PgUp", "Bookmark|Previous"
3910 self.bookmarkActGrp, 'vm_bookmark_previous') 4844 )
3911 self.bookmarkPreviousAct.setStatusTip(QCoreApplication.translate( 4845 ),
3912 'ViewManager', 'Previous Bookmark')) 4846 0,
3913 self.bookmarkPreviousAct.setWhatsThis(QCoreApplication.translate( 4847 self.bookmarkActGrp,
3914 'ViewManager', 4848 "vm_bookmark_previous",
3915 """<b>Previous Bookmark</b>""" 4849 )
3916 """<p>Go to previous bookmark of the current editor.</p>""" 4850 self.bookmarkPreviousAct.setStatusTip(
3917 )) 4851 QCoreApplication.translate("ViewManager", "Previous Bookmark")
4852 )
4853 self.bookmarkPreviousAct.setWhatsThis(
4854 QCoreApplication.translate(
4855 "ViewManager",
4856 """<b>Previous Bookmark</b>"""
4857 """<p>Go to previous bookmark of the current editor.</p>""",
4858 )
4859 )
3918 self.bookmarkPreviousAct.triggered.connect(self.__previousBookmark) 4860 self.bookmarkPreviousAct.triggered.connect(self.__previousBookmark)
3919 self.bookmarkActions.append(self.bookmarkPreviousAct) 4861 self.bookmarkActions.append(self.bookmarkPreviousAct)
3920 4862
3921 self.bookmarkClearAct = EricAction( 4863 self.bookmarkClearAct = EricAction(
3922 QCoreApplication.translate('ViewManager', 'Clear Bookmarks'), 4864 QCoreApplication.translate("ViewManager", "Clear Bookmarks"),
3923 QCoreApplication.translate('ViewManager', '&Clear Bookmarks'), 4865 QCoreApplication.translate("ViewManager", "&Clear Bookmarks"),
3924 QKeySequence(QCoreApplication.translate( 4866 QKeySequence(
3925 'ViewManager', "Alt+Ctrl+C", "Bookmark|Clear")), 4867 QCoreApplication.translate(
3926 0, 4868 "ViewManager", "Alt+Ctrl+C", "Bookmark|Clear"
3927 self.bookmarkActGrp, 'vm_bookmark_clear') 4869 )
3928 self.bookmarkClearAct.setStatusTip(QCoreApplication.translate( 4870 ),
3929 'ViewManager', 'Clear Bookmarks')) 4871 0,
3930 self.bookmarkClearAct.setWhatsThis(QCoreApplication.translate( 4872 self.bookmarkActGrp,
3931 'ViewManager', 4873 "vm_bookmark_clear",
3932 """<b>Clear Bookmarks</b>""" 4874 )
3933 """<p>Clear bookmarks of all editors.</p>""" 4875 self.bookmarkClearAct.setStatusTip(
3934 )) 4876 QCoreApplication.translate("ViewManager", "Clear Bookmarks")
4877 )
4878 self.bookmarkClearAct.setWhatsThis(
4879 QCoreApplication.translate(
4880 "ViewManager",
4881 """<b>Clear Bookmarks</b>"""
4882 """<p>Clear bookmarks of all editors.</p>""",
4883 )
4884 )
3935 self.bookmarkClearAct.triggered.connect(self.__clearAllBookmarks) 4885 self.bookmarkClearAct.triggered.connect(self.__clearAllBookmarks)
3936 self.bookmarkActions.append(self.bookmarkClearAct) 4886 self.bookmarkActions.append(self.bookmarkClearAct)
3937 4887
3938 self.syntaxErrorGotoAct = EricAction( 4888 self.syntaxErrorGotoAct = EricAction(
3939 QCoreApplication.translate('ViewManager', 'Goto Syntax Error'), 4889 QCoreApplication.translate("ViewManager", "Goto Syntax Error"),
3940 UI.PixmapCache.getIcon("syntaxErrorGoto"), 4890 UI.PixmapCache.getIcon("syntaxErrorGoto"),
3941 QCoreApplication.translate('ViewManager', '&Goto Syntax Error'), 4891 QCoreApplication.translate("ViewManager", "&Goto Syntax Error"),
3942 0, 0, 4892 0,
3943 self.bookmarkActGrp, 'vm_syntaxerror_goto') 4893 0,
3944 self.syntaxErrorGotoAct.setStatusTip(QCoreApplication.translate( 4894 self.bookmarkActGrp,
3945 'ViewManager', 'Goto Syntax Error')) 4895 "vm_syntaxerror_goto",
3946 self.syntaxErrorGotoAct.setWhatsThis(QCoreApplication.translate( 4896 )
3947 'ViewManager', 4897 self.syntaxErrorGotoAct.setStatusTip(
3948 """<b>Goto Syntax Error</b>""" 4898 QCoreApplication.translate("ViewManager", "Goto Syntax Error")
3949 """<p>Go to next syntax error of the current editor.</p>""" 4899 )
3950 )) 4900 self.syntaxErrorGotoAct.setWhatsThis(
4901 QCoreApplication.translate(
4902 "ViewManager",
4903 """<b>Goto Syntax Error</b>"""
4904 """<p>Go to next syntax error of the current editor.</p>""",
4905 )
4906 )
3951 self.syntaxErrorGotoAct.triggered.connect(self.__gotoSyntaxError) 4907 self.syntaxErrorGotoAct.triggered.connect(self.__gotoSyntaxError)
3952 self.bookmarkActions.append(self.syntaxErrorGotoAct) 4908 self.bookmarkActions.append(self.syntaxErrorGotoAct)
3953 4909
3954 self.syntaxErrorClearAct = EricAction( 4910 self.syntaxErrorClearAct = EricAction(
3955 QCoreApplication.translate('ViewManager', 'Clear Syntax Errors'), 4911 QCoreApplication.translate("ViewManager", "Clear Syntax Errors"),
3956 QCoreApplication.translate('ViewManager', 'Clear &Syntax Errors'), 4912 QCoreApplication.translate("ViewManager", "Clear &Syntax Errors"),
3957 0, 0, 4913 0,
3958 self.bookmarkActGrp, 'vm_syntaxerror_clear') 4914 0,
3959 self.syntaxErrorClearAct.setStatusTip(QCoreApplication.translate( 4915 self.bookmarkActGrp,
3960 'ViewManager', 'Clear Syntax Errors')) 4916 "vm_syntaxerror_clear",
3961 self.syntaxErrorClearAct.setWhatsThis(QCoreApplication.translate( 4917 )
3962 'ViewManager', 4918 self.syntaxErrorClearAct.setStatusTip(
3963 """<b>Clear Syntax Errors</b>""" 4919 QCoreApplication.translate("ViewManager", "Clear Syntax Errors")
3964 """<p>Clear syntax errors of all editors.</p>""" 4920 )
3965 )) 4921 self.syntaxErrorClearAct.setWhatsThis(
3966 self.syntaxErrorClearAct.triggered.connect( 4922 QCoreApplication.translate(
3967 self.__clearAllSyntaxErrors) 4923 "ViewManager",
4924 """<b>Clear Syntax Errors</b>"""
4925 """<p>Clear syntax errors of all editors.</p>""",
4926 )
4927 )
4928 self.syntaxErrorClearAct.triggered.connect(self.__clearAllSyntaxErrors)
3968 self.bookmarkActions.append(self.syntaxErrorClearAct) 4929 self.bookmarkActions.append(self.syntaxErrorClearAct)
3969 4930
3970 self.warningsNextAct = EricAction( 4931 self.warningsNextAct = EricAction(
3971 QCoreApplication.translate('ViewManager', 'Next warning message'), 4932 QCoreApplication.translate("ViewManager", "Next warning message"),
3972 UI.PixmapCache.getIcon("warningNext"), 4933 UI.PixmapCache.getIcon("warningNext"),
3973 QCoreApplication.translate('ViewManager', '&Next warning message'), 4934 QCoreApplication.translate("ViewManager", "&Next warning message"),
3974 0, 0, 4935 0,
3975 self.bookmarkActGrp, 'vm_warning_next') 4936 0,
3976 self.warningsNextAct.setStatusTip(QCoreApplication.translate( 4937 self.bookmarkActGrp,
3977 'ViewManager', 'Next warning message')) 4938 "vm_warning_next",
3978 self.warningsNextAct.setWhatsThis(QCoreApplication.translate( 4939 )
3979 'ViewManager', 4940 self.warningsNextAct.setStatusTip(
3980 """<b>Next warning message</b>""" 4941 QCoreApplication.translate("ViewManager", "Next warning message")
3981 """<p>Go to next line of the current editor""" 4942 )
3982 """ having a pyflakes warning.</p>""" 4943 self.warningsNextAct.setWhatsThis(
3983 )) 4944 QCoreApplication.translate(
4945 "ViewManager",
4946 """<b>Next warning message</b>"""
4947 """<p>Go to next line of the current editor"""
4948 """ having a pyflakes warning.</p>""",
4949 )
4950 )
3984 self.warningsNextAct.triggered.connect(self.__nextWarning) 4951 self.warningsNextAct.triggered.connect(self.__nextWarning)
3985 self.bookmarkActions.append(self.warningsNextAct) 4952 self.bookmarkActions.append(self.warningsNextAct)
3986 4953
3987 self.warningsPreviousAct = EricAction( 4954 self.warningsPreviousAct = EricAction(
3988 QCoreApplication.translate( 4955 QCoreApplication.translate("ViewManager", "Previous warning message"),
3989 'ViewManager', 'Previous warning message'),
3990 UI.PixmapCache.getIcon("warningPrev"), 4956 UI.PixmapCache.getIcon("warningPrev"),
3991 QCoreApplication.translate( 4957 QCoreApplication.translate("ViewManager", "&Previous warning message"),
3992 'ViewManager', '&Previous warning message'), 4958 0,
3993 0, 0, 4959 0,
3994 self.bookmarkActGrp, 'vm_warning_previous') 4960 self.bookmarkActGrp,
3995 self.warningsPreviousAct.setStatusTip(QCoreApplication.translate( 4961 "vm_warning_previous",
3996 'ViewManager', 'Previous warning message')) 4962 )
3997 self.warningsPreviousAct.setWhatsThis(QCoreApplication.translate( 4963 self.warningsPreviousAct.setStatusTip(
3998 'ViewManager', 4964 QCoreApplication.translate("ViewManager", "Previous warning message")
3999 """<b>Previous warning message</b>""" 4965 )
4000 """<p>Go to previous line of the current editor""" 4966 self.warningsPreviousAct.setWhatsThis(
4001 """ having a pyflakes warning.</p>""" 4967 QCoreApplication.translate(
4002 )) 4968 "ViewManager",
4969 """<b>Previous warning message</b>"""
4970 """<p>Go to previous line of the current editor"""
4971 """ having a pyflakes warning.</p>""",
4972 )
4973 )
4003 self.warningsPreviousAct.triggered.connect(self.__previousWarning) 4974 self.warningsPreviousAct.triggered.connect(self.__previousWarning)
4004 self.bookmarkActions.append(self.warningsPreviousAct) 4975 self.bookmarkActions.append(self.warningsPreviousAct)
4005 4976
4006 self.warningsClearAct = EricAction( 4977 self.warningsClearAct = EricAction(
4007 QCoreApplication.translate( 4978 QCoreApplication.translate("ViewManager", "Clear Warning Messages"),
4008 'ViewManager', 'Clear Warning Messages'), 4979 QCoreApplication.translate("ViewManager", "Clear &Warning Messages"),
4009 QCoreApplication.translate( 4980 0,
4010 'ViewManager', 'Clear &Warning Messages'), 4981 0,
4011 0, 0, 4982 self.bookmarkActGrp,
4012 self.bookmarkActGrp, 'vm_warnings_clear') 4983 "vm_warnings_clear",
4013 self.warningsClearAct.setStatusTip(QCoreApplication.translate( 4984 )
4014 'ViewManager', 'Clear Warning Messages')) 4985 self.warningsClearAct.setStatusTip(
4015 self.warningsClearAct.setWhatsThis(QCoreApplication.translate( 4986 QCoreApplication.translate("ViewManager", "Clear Warning Messages")
4016 'ViewManager', 4987 )
4017 """<b>Clear Warning Messages</b>""" 4988 self.warningsClearAct.setWhatsThis(
4018 """<p>Clear pyflakes warning messages of all editors.</p>""" 4989 QCoreApplication.translate(
4019 )) 4990 "ViewManager",
4991 """<b>Clear Warning Messages</b>"""
4992 """<p>Clear pyflakes warning messages of all editors.</p>""",
4993 )
4994 )
4020 self.warningsClearAct.triggered.connect(self.__clearAllWarnings) 4995 self.warningsClearAct.triggered.connect(self.__clearAllWarnings)
4021 self.bookmarkActions.append(self.warningsClearAct) 4996 self.bookmarkActions.append(self.warningsClearAct)
4022 4997
4023 self.notcoveredNextAct = EricAction( 4998 self.notcoveredNextAct = EricAction(
4024 QCoreApplication.translate('ViewManager', 'Next uncovered line'), 4999 QCoreApplication.translate("ViewManager", "Next uncovered line"),
4025 UI.PixmapCache.getIcon("notcoveredNext"), 5000 UI.PixmapCache.getIcon("notcoveredNext"),
4026 QCoreApplication.translate('ViewManager', '&Next uncovered line'), 5001 QCoreApplication.translate("ViewManager", "&Next uncovered line"),
4027 0, 0, 5002 0,
4028 self.bookmarkActGrp, 'vm_uncovered_next') 5003 0,
4029 self.notcoveredNextAct.setStatusTip(QCoreApplication.translate( 5004 self.bookmarkActGrp,
4030 'ViewManager', 'Next uncovered line')) 5005 "vm_uncovered_next",
4031 self.notcoveredNextAct.setWhatsThis(QCoreApplication.translate( 5006 )
4032 'ViewManager', 5007 self.notcoveredNextAct.setStatusTip(
4033 """<b>Next uncovered line</b>""" 5008 QCoreApplication.translate("ViewManager", "Next uncovered line")
4034 """<p>Go to next line of the current editor marked as not""" 5009 )
4035 """ covered.</p>""" 5010 self.notcoveredNextAct.setWhatsThis(
4036 )) 5011 QCoreApplication.translate(
5012 "ViewManager",
5013 """<b>Next uncovered line</b>"""
5014 """<p>Go to next line of the current editor marked as not"""
5015 """ covered.</p>""",
5016 )
5017 )
4037 self.notcoveredNextAct.triggered.connect(self.__nextUncovered) 5018 self.notcoveredNextAct.triggered.connect(self.__nextUncovered)
4038 self.bookmarkActions.append(self.notcoveredNextAct) 5019 self.bookmarkActions.append(self.notcoveredNextAct)
4039 5020
4040 self.notcoveredPreviousAct = EricAction( 5021 self.notcoveredPreviousAct = EricAction(
4041 QCoreApplication.translate( 5022 QCoreApplication.translate("ViewManager", "Previous uncovered line"),
4042 'ViewManager', 'Previous uncovered line'),
4043 UI.PixmapCache.getIcon("notcoveredPrev"), 5023 UI.PixmapCache.getIcon("notcoveredPrev"),
4044 QCoreApplication.translate( 5024 QCoreApplication.translate("ViewManager", "&Previous uncovered line"),
4045 'ViewManager', '&Previous uncovered line'), 5025 0,
4046 0, 0, 5026 0,
4047 self.bookmarkActGrp, 'vm_uncovered_previous') 5027 self.bookmarkActGrp,
4048 self.notcoveredPreviousAct.setStatusTip(QCoreApplication.translate( 5028 "vm_uncovered_previous",
4049 'ViewManager', 'Previous uncovered line')) 5029 )
4050 self.notcoveredPreviousAct.setWhatsThis(QCoreApplication.translate( 5030 self.notcoveredPreviousAct.setStatusTip(
4051 'ViewManager', 5031 QCoreApplication.translate("ViewManager", "Previous uncovered line")
4052 """<b>Previous uncovered line</b>""" 5032 )
4053 """<p>Go to previous line of the current editor marked""" 5033 self.notcoveredPreviousAct.setWhatsThis(
4054 """ as not covered.</p>""" 5034 QCoreApplication.translate(
4055 )) 5035 "ViewManager",
4056 self.notcoveredPreviousAct.triggered.connect( 5036 """<b>Previous uncovered line</b>"""
4057 self.__previousUncovered) 5037 """<p>Go to previous line of the current editor marked"""
5038 """ as not covered.</p>""",
5039 )
5040 )
5041 self.notcoveredPreviousAct.triggered.connect(self.__previousUncovered)
4058 self.bookmarkActions.append(self.notcoveredPreviousAct) 5042 self.bookmarkActions.append(self.notcoveredPreviousAct)
4059 5043
4060 self.taskNextAct = EricAction( 5044 self.taskNextAct = EricAction(
4061 QCoreApplication.translate('ViewManager', 'Next Task'), 5045 QCoreApplication.translate("ViewManager", "Next Task"),
4062 UI.PixmapCache.getIcon("taskNext"), 5046 UI.PixmapCache.getIcon("taskNext"),
4063 QCoreApplication.translate('ViewManager', '&Next Task'), 5047 QCoreApplication.translate("ViewManager", "&Next Task"),
4064 0, 0, 5048 0,
4065 self.bookmarkActGrp, 'vm_task_next') 5049 0,
4066 self.taskNextAct.setStatusTip(QCoreApplication.translate( 5050 self.bookmarkActGrp,
4067 'ViewManager', 'Next Task')) 5051 "vm_task_next",
4068 self.taskNextAct.setWhatsThis(QCoreApplication.translate( 5052 )
4069 'ViewManager', 5053 self.taskNextAct.setStatusTip(
4070 """<b>Next Task</b>""" 5054 QCoreApplication.translate("ViewManager", "Next Task")
4071 """<p>Go to next line of the current editor having a task.</p>""" 5055 )
4072 )) 5056 self.taskNextAct.setWhatsThis(
5057 QCoreApplication.translate(
5058 "ViewManager",
5059 """<b>Next Task</b>"""
5060 """<p>Go to next line of the current editor having a task.</p>""",
5061 )
5062 )
4073 self.taskNextAct.triggered.connect(self.__nextTask) 5063 self.taskNextAct.triggered.connect(self.__nextTask)
4074 self.bookmarkActions.append(self.taskNextAct) 5064 self.bookmarkActions.append(self.taskNextAct)
4075 5065
4076 self.taskPreviousAct = EricAction( 5066 self.taskPreviousAct = EricAction(
4077 QCoreApplication.translate('ViewManager', 'Previous Task'), 5067 QCoreApplication.translate("ViewManager", "Previous Task"),
4078 UI.PixmapCache.getIcon("taskPrev"), 5068 UI.PixmapCache.getIcon("taskPrev"),
4079 QCoreApplication.translate( 5069 QCoreApplication.translate("ViewManager", "&Previous Task"),
4080 'ViewManager', '&Previous Task'), 5070 0,
4081 0, 0, 5071 0,
4082 self.bookmarkActGrp, 'vm_task_previous') 5072 self.bookmarkActGrp,
4083 self.taskPreviousAct.setStatusTip(QCoreApplication.translate( 5073 "vm_task_previous",
4084 'ViewManager', 'Previous Task')) 5074 )
4085 self.taskPreviousAct.setWhatsThis(QCoreApplication.translate( 5075 self.taskPreviousAct.setStatusTip(
4086 'ViewManager', 5076 QCoreApplication.translate("ViewManager", "Previous Task")
4087 """<b>Previous Task</b>""" 5077 )
4088 """<p>Go to previous line of the current editor having a""" 5078 self.taskPreviousAct.setWhatsThis(
4089 """ task.</p>""" 5079 QCoreApplication.translate(
4090 )) 5080 "ViewManager",
5081 """<b>Previous Task</b>"""
5082 """<p>Go to previous line of the current editor having a"""
5083 """ task.</p>""",
5084 )
5085 )
4091 self.taskPreviousAct.triggered.connect(self.__previousTask) 5086 self.taskPreviousAct.triggered.connect(self.__previousTask)
4092 self.bookmarkActions.append(self.taskPreviousAct) 5087 self.bookmarkActions.append(self.taskPreviousAct)
4093 5088
4094 self.changeNextAct = EricAction( 5089 self.changeNextAct = EricAction(
4095 QCoreApplication.translate('ViewManager', 'Next Change'), 5090 QCoreApplication.translate("ViewManager", "Next Change"),
4096 UI.PixmapCache.getIcon("changeNext"), 5091 UI.PixmapCache.getIcon("changeNext"),
4097 QCoreApplication.translate('ViewManager', '&Next Change'), 5092 QCoreApplication.translate("ViewManager", "&Next Change"),
4098 0, 0, 5093 0,
4099 self.bookmarkActGrp, 'vm_change_next') 5094 0,
4100 self.changeNextAct.setStatusTip(QCoreApplication.translate( 5095 self.bookmarkActGrp,
4101 'ViewManager', 'Next Change')) 5096 "vm_change_next",
4102 self.changeNextAct.setWhatsThis(QCoreApplication.translate( 5097 )
4103 'ViewManager', 5098 self.changeNextAct.setStatusTip(
4104 """<b>Next Change</b>""" 5099 QCoreApplication.translate("ViewManager", "Next Change")
4105 """<p>Go to next line of the current editor having a change""" 5100 )
4106 """ marker.</p>""" 5101 self.changeNextAct.setWhatsThis(
4107 )) 5102 QCoreApplication.translate(
5103 "ViewManager",
5104 """<b>Next Change</b>"""
5105 """<p>Go to next line of the current editor having a change"""
5106 """ marker.</p>""",
5107 )
5108 )
4108 self.changeNextAct.triggered.connect(self.__nextChange) 5109 self.changeNextAct.triggered.connect(self.__nextChange)
4109 self.bookmarkActions.append(self.changeNextAct) 5110 self.bookmarkActions.append(self.changeNextAct)
4110 5111
4111 self.changePreviousAct = EricAction( 5112 self.changePreviousAct = EricAction(
4112 QCoreApplication.translate('ViewManager', 'Previous Change'), 5113 QCoreApplication.translate("ViewManager", "Previous Change"),
4113 UI.PixmapCache.getIcon("changePrev"), 5114 UI.PixmapCache.getIcon("changePrev"),
4114 QCoreApplication.translate( 5115 QCoreApplication.translate("ViewManager", "&Previous Change"),
4115 'ViewManager', '&Previous Change'), 5116 0,
4116 0, 0, 5117 0,
4117 self.bookmarkActGrp, 'vm_change_previous') 5118 self.bookmarkActGrp,
4118 self.changePreviousAct.setStatusTip(QCoreApplication.translate( 5119 "vm_change_previous",
4119 'ViewManager', 'Previous Change')) 5120 )
4120 self.changePreviousAct.setWhatsThis(QCoreApplication.translate( 5121 self.changePreviousAct.setStatusTip(
4121 'ViewManager', 5122 QCoreApplication.translate("ViewManager", "Previous Change")
4122 """<b>Previous Change</b>""" 5123 )
4123 """<p>Go to previous line of the current editor having""" 5124 self.changePreviousAct.setWhatsThis(
4124 """ a change marker.</p>""" 5125 QCoreApplication.translate(
4125 )) 5126 "ViewManager",
5127 """<b>Previous Change</b>"""
5128 """<p>Go to previous line of the current editor having"""
5129 """ a change marker.</p>""",
5130 )
5131 )
4126 self.changePreviousAct.triggered.connect(self.__previousChange) 5132 self.changePreviousAct.triggered.connect(self.__previousChange)
4127 self.bookmarkActions.append(self.changePreviousAct) 5133 self.bookmarkActions.append(self.changePreviousAct)
4128 5134
4129 self.bookmarkActGrp.setEnabled(False) 5135 self.bookmarkActGrp.setEnabled(False)
4130 5136
4131 def initBookmarkMenu(self): 5137 def initBookmarkMenu(self):
4132 """ 5138 """
4133 Public method to create the Bookmark menu. 5139 Public method to create the Bookmark menu.
4134 5140
4135 @return the generated menu 5141 @return the generated menu
4136 """ 5142 """
4137 menu = QMenu(QCoreApplication.translate('ViewManager', '&Bookmarks'), 5143 menu = QMenu(QCoreApplication.translate("ViewManager", "&Bookmarks"), self.ui)
4138 self.ui)
4139 self.bookmarksMenu = QMenu( 5144 self.bookmarksMenu = QMenu(
4140 QCoreApplication.translate('ViewManager', '&Bookmarks'), 5145 QCoreApplication.translate("ViewManager", "&Bookmarks"), menu
4141 menu) 5146 )
4142 menu.setTearOffEnabled(True) 5147 menu.setTearOffEnabled(True)
4143 5148
4144 menu.addAction(self.bookmarkToggleAct) 5149 menu.addAction(self.bookmarkToggleAct)
4145 menu.addAction(self.bookmarkNextAct) 5150 menu.addAction(self.bookmarkNextAct)
4146 menu.addAction(self.bookmarkPreviousAct) 5151 menu.addAction(self.bookmarkPreviousAct)
4147 menu.addAction(self.bookmarkClearAct) 5152 menu.addAction(self.bookmarkClearAct)
4148 menu.addSeparator() 5153 menu.addSeparator()
4161 menu.addAction(self.taskNextAct) 5166 menu.addAction(self.taskNextAct)
4162 menu.addAction(self.taskPreviousAct) 5167 menu.addAction(self.taskPreviousAct)
4163 menu.addSeparator() 5168 menu.addSeparator()
4164 menu.addAction(self.changeNextAct) 5169 menu.addAction(self.changeNextAct)
4165 menu.addAction(self.changePreviousAct) 5170 menu.addAction(self.changePreviousAct)
4166 5171
4167 self.bookmarksMenu.aboutToShow.connect(self.__showBookmarksMenu) 5172 self.bookmarksMenu.aboutToShow.connect(self.__showBookmarksMenu)
4168 self.bookmarksMenu.triggered.connect(self.__bookmarkSelected) 5173 self.bookmarksMenu.triggered.connect(self.__bookmarkSelected)
4169 menu.aboutToShow.connect(self.__showBookmarkMenu) 5174 menu.aboutToShow.connect(self.__showBookmarkMenu)
4170 5175
4171 return menu 5176 return menu
4172 5177
4173 def initBookmarkToolbar(self, toolbarManager): 5178 def initBookmarkToolbar(self, toolbarManager):
4174 """ 5179 """
4175 Public method to create the Bookmark toolbar. 5180 Public method to create the Bookmark toolbar.
4176 5181
4177 @param toolbarManager reference to a toolbar manager object 5182 @param toolbarManager reference to a toolbar manager object
4178 (EricToolBarManager) 5183 (EricToolBarManager)
4179 @return the generated toolbar 5184 @return the generated toolbar
4180 """ 5185 """
4181 tb = QToolBar(QCoreApplication.translate('ViewManager', 'Bookmarks'), 5186 tb = QToolBar(QCoreApplication.translate("ViewManager", "Bookmarks"), self.ui)
4182 self.ui)
4183 tb.setIconSize(UI.Config.ToolBarIconSize) 5187 tb.setIconSize(UI.Config.ToolBarIconSize)
4184 tb.setObjectName("BookmarksToolbar") 5188 tb.setObjectName("BookmarksToolbar")
4185 tb.setToolTip(QCoreApplication.translate('ViewManager', 'Bookmarks')) 5189 tb.setToolTip(QCoreApplication.translate("ViewManager", "Bookmarks"))
4186 5190
4187 tb.addAction(self.bookmarkToggleAct) 5191 tb.addAction(self.bookmarkToggleAct)
4188 tb.addAction(self.bookmarkNextAct) 5192 tb.addAction(self.bookmarkNextAct)
4189 tb.addAction(self.bookmarkPreviousAct) 5193 tb.addAction(self.bookmarkPreviousAct)
4190 tb.addSeparator() 5194 tb.addSeparator()
4191 tb.addAction(self.syntaxErrorGotoAct) 5195 tb.addAction(self.syntaxErrorGotoAct)
4196 tb.addAction(self.taskNextAct) 5200 tb.addAction(self.taskNextAct)
4197 tb.addAction(self.taskPreviousAct) 5201 tb.addAction(self.taskPreviousAct)
4198 tb.addSeparator() 5202 tb.addSeparator()
4199 tb.addAction(self.changeNextAct) 5203 tb.addAction(self.changeNextAct)
4200 tb.addAction(self.changePreviousAct) 5204 tb.addAction(self.changePreviousAct)
4201 5205
4202 toolbarManager.addToolBar(tb, tb.windowTitle()) 5206 toolbarManager.addToolBar(tb, tb.windowTitle())
4203 toolbarManager.addAction(self.notcoveredNextAct, tb.windowTitle()) 5207 toolbarManager.addAction(self.notcoveredNextAct, tb.windowTitle())
4204 toolbarManager.addAction(self.notcoveredPreviousAct, tb.windowTitle()) 5208 toolbarManager.addAction(self.notcoveredPreviousAct, tb.windowTitle())
4205 5209
4206 return tb 5210 return tb
4207 5211
4208 ################################################################## 5212 ##################################################################
4209 ## Initialize the spell checking related actions 5213 ## Initialize the spell checking related actions
4210 ################################################################## 5214 ##################################################################
4211 5215
4212 def __initSpellingActions(self): 5216 def __initSpellingActions(self):
4213 """ 5217 """
4214 Private method to initialize the spell checking actions. 5218 Private method to initialize the spell checking actions.
4215 """ 5219 """
4216 self.spellingActGrp = createActionGroup(self) 5220 self.spellingActGrp = createActionGroup(self)
4217 5221
4218 self.spellCheckAct = EricAction( 5222 self.spellCheckAct = EricAction(
4219 QCoreApplication.translate('ViewManager', 'Check spelling'), 5223 QCoreApplication.translate("ViewManager", "Check spelling"),
4220 UI.PixmapCache.getIcon("spellchecking"), 5224 UI.PixmapCache.getIcon("spellchecking"),
4221 QCoreApplication.translate( 5225 QCoreApplication.translate("ViewManager", "Check &spelling..."),
4222 'ViewManager', 'Check &spelling...'), 5226 QKeySequence(
4223 QKeySequence(QCoreApplication.translate( 5227 QCoreApplication.translate(
4224 'ViewManager', "Shift+F7", "Spelling|Spell Check")), 5228 "ViewManager", "Shift+F7", "Spelling|Spell Check"
4225 0, 5229 )
4226 self.spellingActGrp, 'vm_spelling_spellcheck') 5230 ),
4227 self.spellCheckAct.setStatusTip(QCoreApplication.translate( 5231 0,
4228 'ViewManager', 'Perform spell check of current editor')) 5232 self.spellingActGrp,
4229 self.spellCheckAct.setWhatsThis(QCoreApplication.translate( 5233 "vm_spelling_spellcheck",
4230 'ViewManager', 5234 )
4231 """<b>Check spelling</b>""" 5235 self.spellCheckAct.setStatusTip(
4232 """<p>Perform a spell check of the current editor.</p>""" 5236 QCoreApplication.translate(
4233 )) 5237 "ViewManager", "Perform spell check of current editor"
5238 )
5239 )
5240 self.spellCheckAct.setWhatsThis(
5241 QCoreApplication.translate(
5242 "ViewManager",
5243 """<b>Check spelling</b>"""
5244 """<p>Perform a spell check of the current editor.</p>""",
5245 )
5246 )
4234 self.spellCheckAct.triggered.connect(self.__spellCheck) 5247 self.spellCheckAct.triggered.connect(self.__spellCheck)
4235 self.spellingActions.append(self.spellCheckAct) 5248 self.spellingActions.append(self.spellCheckAct)
4236 5249
4237 self.autoSpellCheckAct = EricAction( 5250 self.autoSpellCheckAct = EricAction(
4238 QCoreApplication.translate( 5251 QCoreApplication.translate("ViewManager", "Automatic spell checking"),
4239 'ViewManager', 'Automatic spell checking'),
4240 UI.PixmapCache.getIcon("autospellchecking"), 5252 UI.PixmapCache.getIcon("autospellchecking"),
4241 QCoreApplication.translate( 5253 QCoreApplication.translate("ViewManager", "&Automatic spell checking"),
4242 'ViewManager', '&Automatic spell checking'), 5254 0,
4243 0, 0, 5255 0,
4244 self.spellingActGrp, 'vm_spelling_autospellcheck', True) 5256 self.spellingActGrp,
4245 self.autoSpellCheckAct.setStatusTip(QCoreApplication.translate( 5257 "vm_spelling_autospellcheck",
4246 'ViewManager', '(De-)Activate automatic spell checking')) 5258 True,
4247 self.autoSpellCheckAct.setWhatsThis(QCoreApplication.translate( 5259 )
4248 'ViewManager', 5260 self.autoSpellCheckAct.setStatusTip(
4249 """<b>Automatic spell checking</b>""" 5261 QCoreApplication.translate(
4250 """<p>Activate or deactivate the automatic spell checking""" 5262 "ViewManager", "(De-)Activate automatic spell checking"
4251 """ function of all editors.</p>""" 5263 )
4252 )) 5264 )
5265 self.autoSpellCheckAct.setWhatsThis(
5266 QCoreApplication.translate(
5267 "ViewManager",
5268 """<b>Automatic spell checking</b>"""
5269 """<p>Activate or deactivate the automatic spell checking"""
5270 """ function of all editors.</p>""",
5271 )
5272 )
4253 self.autoSpellCheckAct.setChecked( 5273 self.autoSpellCheckAct.setChecked(
4254 Preferences.getEditor("AutoSpellCheckingEnabled")) 5274 Preferences.getEditor("AutoSpellCheckingEnabled")
4255 self.autoSpellCheckAct.triggered.connect( 5275 )
4256 self.__setAutoSpellChecking) 5276 self.autoSpellCheckAct.triggered.connect(self.__setAutoSpellChecking)
4257 self.spellingActions.append(self.autoSpellCheckAct) 5277 self.spellingActions.append(self.autoSpellCheckAct)
4258 5278
4259 self.__enableSpellingActions() 5279 self.__enableSpellingActions()
4260 5280
4261 def __enableSpellingActions(self): 5281 def __enableSpellingActions(self):
4262 """ 5282 """
4263 Private method to set the enabled state of the spelling actions. 5283 Private method to set the enabled state of the spelling actions.
4264 """ 5284 """
4265 from QScintilla.SpellChecker import SpellChecker 5285 from QScintilla.SpellChecker import SpellChecker
5286
4266 spellingAvailable = SpellChecker.isAvailable() 5287 spellingAvailable = SpellChecker.isAvailable()
4267 5288
4268 self.spellCheckAct.setEnabled( 5289 self.spellCheckAct.setEnabled(len(self.editors) != 0 and spellingAvailable)
4269 len(self.editors) != 0 and spellingAvailable)
4270 self.autoSpellCheckAct.setEnabled(spellingAvailable) 5290 self.autoSpellCheckAct.setEnabled(spellingAvailable)
4271 5291
4272 def addToExtrasMenu(self, menu): 5292 def addToExtrasMenu(self, menu):
4273 """ 5293 """
4274 Public method to add some actions to the Extras menu. 5294 Public method to add some actions to the Extras menu.
4275 5295
4276 @param menu reference to the menu to add actions to (QMenu) 5296 @param menu reference to the menu to add actions to (QMenu)
4277 """ 5297 """
4278 self.__editSpellingMenu = QMenu(QCoreApplication.translate( 5298 self.__editSpellingMenu = QMenu(
4279 'ViewManager', "Edit Dictionary")) 5299 QCoreApplication.translate("ViewManager", "Edit Dictionary")
5300 )
4280 self.__editProjectPwlAct = self.__editSpellingMenu.addAction( 5301 self.__editProjectPwlAct = self.__editSpellingMenu.addAction(
4281 QCoreApplication.translate('ViewManager', "Project Word List"), 5302 QCoreApplication.translate("ViewManager", "Project Word List"),
4282 self.__editProjectPWL) 5303 self.__editProjectPWL,
5304 )
4283 self.__editProjectPelAct = self.__editSpellingMenu.addAction( 5305 self.__editProjectPelAct = self.__editSpellingMenu.addAction(
4284 QCoreApplication.translate( 5306 QCoreApplication.translate("ViewManager", "Project Exception List"),
4285 'ViewManager', "Project Exception List"), 5307 self.__editProjectPEL,
4286 self.__editProjectPEL) 5308 )
4287 self.__editSpellingMenu.addSeparator() 5309 self.__editSpellingMenu.addSeparator()
4288 self.__editUserPwlAct = self.__editSpellingMenu.addAction( 5310 self.__editUserPwlAct = self.__editSpellingMenu.addAction(
4289 QCoreApplication.translate('ViewManager', "User Word List"), 5311 QCoreApplication.translate("ViewManager", "User Word List"),
4290 self.__editUserPWL) 5312 self.__editUserPWL,
5313 )
4291 self.__editUserPelAct = self.__editSpellingMenu.addAction( 5314 self.__editUserPelAct = self.__editSpellingMenu.addAction(
4292 QCoreApplication.translate('ViewManager', "User Exception List"), 5315 QCoreApplication.translate("ViewManager", "User Exception List"),
4293 self.__editUserPEL) 5316 self.__editUserPEL,
4294 self.__editSpellingMenu.aboutToShow.connect( 5317 )
4295 self.__showEditSpellingMenu) 5318 self.__editSpellingMenu.aboutToShow.connect(self.__showEditSpellingMenu)
4296 5319
4297 menu.addAction(self.spellCheckAct) 5320 menu.addAction(self.spellCheckAct)
4298 menu.addAction(self.autoSpellCheckAct) 5321 menu.addAction(self.autoSpellCheckAct)
4299 menu.addMenu(self.__editSpellingMenu) 5322 menu.addMenu(self.__editSpellingMenu)
4300 menu.addSeparator() 5323 menu.addSeparator()
4301 5324
4302 def initSpellingToolbar(self, toolbarManager): 5325 def initSpellingToolbar(self, toolbarManager):
4303 """ 5326 """
4304 Public method to create the Spelling toolbar. 5327 Public method to create the Spelling toolbar.
4305 5328
4306 @param toolbarManager reference to a toolbar manager object 5329 @param toolbarManager reference to a toolbar manager object
4307 (EricToolBarManager) 5330 (EricToolBarManager)
4308 @return the generated toolbar 5331 @return the generated toolbar
4309 """ 5332 """
4310 tb = QToolBar(QCoreApplication.translate('ViewManager', 'Spelling'), 5333 tb = QToolBar(QCoreApplication.translate("ViewManager", "Spelling"), self.ui)
4311 self.ui)
4312 tb.setIconSize(UI.Config.ToolBarIconSize) 5334 tb.setIconSize(UI.Config.ToolBarIconSize)
4313 tb.setObjectName("SpellingToolbar") 5335 tb.setObjectName("SpellingToolbar")
4314 tb.setToolTip(QCoreApplication.translate('ViewManager', 'Spelling')) 5336 tb.setToolTip(QCoreApplication.translate("ViewManager", "Spelling"))
4315 5337
4316 tb.addAction(self.spellCheckAct) 5338 tb.addAction(self.spellCheckAct)
4317 tb.addAction(self.autoSpellCheckAct) 5339 tb.addAction(self.autoSpellCheckAct)
4318 5340
4319 toolbarManager.addToolBar(tb, tb.windowTitle()) 5341 toolbarManager.addToolBar(tb, tb.windowTitle())
4320 5342
4321 return tb 5343 return tb
4322 5344
4323 ################################################################## 5345 ##################################################################
4324 ## Methods and slots that deal with file and window handling 5346 ## Methods and slots that deal with file and window handling
4325 ################################################################## 5347 ##################################################################
4326 5348
4327 def __openFiles(self): 5349 def __openFiles(self):
4328 """ 5350 """
4329 Private slot to open some files. 5351 Private slot to open some files.
4330 """ 5352 """
4331 # set the cwd of the dialog based on the following search criteria: 5353 # set the cwd of the dialog based on the following search criteria:
4332 # 1: Directory of currently active editor 5354 # 1: Directory of currently active editor
4333 # 2: Directory of currently active project 5355 # 2: Directory of currently active project
4334 # 3: CWD 5356 # 3: CWD
4335 import QScintilla.Lexers 5357 import QScintilla.Lexers
5358
4336 fileFilter = self._getOpenFileFilter() 5359 fileFilter = self._getOpenFileFilter()
4337 progs = EricFileDialog.getOpenFileNamesAndFilter( 5360 progs = EricFileDialog.getOpenFileNamesAndFilter(
4338 self.ui, 5361 self.ui,
4339 QCoreApplication.translate('ViewManager', "Open files"), 5362 QCoreApplication.translate("ViewManager", "Open files"),
4340 self._getOpenStartDir(), 5363 self._getOpenStartDir(),
4341 QScintilla.Lexers.getOpenFileFiltersList(True, True), 5364 QScintilla.Lexers.getOpenFileFiltersList(True, True),
4342 fileFilter)[0] 5365 fileFilter,
5366 )[0]
4343 for prog in progs: 5367 for prog in progs:
4344 self.openFiles(prog) 5368 self.openFiles(prog)
4345 5369
4346 def openFiles(self, prog): 5370 def openFiles(self, prog):
4347 """ 5371 """
4348 Public slot to open some files. 5372 Public slot to open some files.
4349 5373
4350 @param prog name of file to be opened (string) 5374 @param prog name of file to be opened (string)
4351 """ 5375 """
4352 prog = os.path.abspath(prog) 5376 prog = os.path.abspath(prog)
4353 # Open up the new files. 5377 # Open up the new files.
4354 self.openSourceFile(prog) 5378 self.openSourceFile(prog)
4355 5379
4356 def checkDirty(self, editor, autosave=False): 5380 def checkDirty(self, editor, autosave=False):
4357 """ 5381 """
4358 Public method to check the dirty status and open a message window. 5382 Public method to check the dirty status and open a message window.
4359 5383
4360 @param editor editor window to check 5384 @param editor editor window to check
4361 @type Editor 5385 @type Editor
4362 @param autosave flag indicating that the file should be saved 5386 @param autosave flag indicating that the file should be saved
4363 automatically 5387 automatically
4364 @type bool 5388 @type bool
4369 fn = editor.getFileName() 5393 fn = editor.getFileName()
4370 # ignore the dirty status, if there is more than one open editor 5394 # ignore the dirty status, if there is more than one open editor
4371 # for the same file 5395 # for the same file
4372 if fn and self.getOpenEditorCount(fn) > 1: 5396 if fn and self.getOpenEditorCount(fn) > 1:
4373 return True 5397 return True
4374 5398
4375 if fn is None: 5399 if fn is None:
4376 fn = editor.getNoName() 5400 fn = editor.getNoName()
4377 autosave = False 5401 autosave = False
4378 if autosave: 5402 if autosave:
4379 res = editor.saveFile() 5403 res = editor.saveFile()
4380 else: 5404 else:
4381 res = EricMessageBox.okToClearData( 5405 res = EricMessageBox.okToClearData(
4382 self.ui, 5406 self.ui,
4383 QCoreApplication.translate('ViewManager', "File Modified"), 5407 QCoreApplication.translate("ViewManager", "File Modified"),
4384 QCoreApplication.translate( 5408 QCoreApplication.translate(
4385 'ViewManager', 5409 "ViewManager",
4386 """<p>The file <b>{0}</b> has unsaved changes.</p>""") 5410 """<p>The file <b>{0}</b> has unsaved changes.</p>""",
4387 .format(fn), 5411 ).format(fn),
4388 editor.saveFile) 5412 editor.saveFile,
5413 )
4389 if res: 5414 if res:
4390 self.setEditorName(editor, editor.getFileName()) 5415 self.setEditorName(editor, editor.getFileName())
4391 return res 5416 return res
4392 5417
4393 return True 5418 return True
4394 5419
4395 def checkAllDirty(self): 5420 def checkAllDirty(self):
4396 """ 5421 """
4397 Public method to check the dirty status of all editors. 5422 Public method to check the dirty status of all editors.
4398 5423
4399 @return flag indicating successful reset of all dirty flags 5424 @return flag indicating successful reset of all dirty flags
4400 @rtype bool 5425 @rtype bool
4401 """ 5426 """
4402 return all(self.checkDirty(editor) for editor in self.editors) 5427 return all(self.checkDirty(editor) for editor in self.editors)
4403 5428
4404 def checkFileDirty(self, fn): 5429 def checkFileDirty(self, fn):
4405 """ 5430 """
4406 Public method to check the dirty status of an editor given its file 5431 Public method to check the dirty status of an editor given its file
4407 name and open a message window. 5432 name and open a message window.
4408 5433
4409 @param fn file name of editor to be checked 5434 @param fn file name of editor to be checked
4410 @type str 5435 @type str
4411 @return flag indicating successful reset of the dirty flag 5436 @return flag indicating successful reset of the dirty flag
4412 @rtype bool 5437 @rtype bool
4413 """ 5438 """
4414 for editor in self.editors: 5439 for editor in self.editors:
4415 if Utilities.samepath(fn, editor.getFileName()): 5440 if Utilities.samepath(fn, editor.getFileName()):
4416 break 5441 break
4417 else: 5442 else:
4418 return True 5443 return True
4419 5444
4420 res = self.checkDirty(editor) 5445 res = self.checkDirty(editor)
4421 return res 5446 return res
4422 5447
4423 def hasDirtyEditor(self): 5448 def hasDirtyEditor(self):
4424 """ 5449 """
4425 Public method to ask, if any of the open editors contains unsaved 5450 Public method to ask, if any of the open editors contains unsaved
4426 changes. 5451 changes.
4427 5452
4428 @return flag indicating at least one editor has unsaved changes 5453 @return flag indicating at least one editor has unsaved changes
4429 @rtype bool 5454 @rtype bool
4430 """ 5455 """
4431 return any(editor.isModified() for editor in self.editors) 5456 return any(editor.isModified() for editor in self.editors)
4432 5457
4433 def closeEditor(self, editor, ignoreDirty=False): 5458 def closeEditor(self, editor, ignoreDirty=False):
4434 """ 5459 """
4435 Public method to close an editor window. 5460 Public method to close an editor window.
4436 5461
4437 @param editor editor window to be closed 5462 @param editor editor window to be closed
4438 @type Editor 5463 @type Editor
4439 @param ignoreDirty flag indicating to ignore the 'dirty' status 5464 @param ignoreDirty flag indicating to ignore the 'dirty' status
4440 @type bool 5465 @type bool
4441 @return flag indicating success 5466 @return flag indicating success
4442 @rtype bool 5467 @rtype bool
4443 """ 5468 """
4444 # save file if necessary 5469 # save file if necessary
4445 if not ignoreDirty and not self.checkDirty(editor): 5470 if not ignoreDirty and not self.checkDirty(editor):
4446 return False 5471 return False
4447 5472
4448 # get the filename of the editor for later use 5473 # get the filename of the editor for later use
4449 fn = editor.getFileName() 5474 fn = editor.getFileName()
4450 5475
4451 # remove the window 5476 # remove the window
4452 editor.parent().shutdownTimer() 5477 editor.parent().shutdownTimer()
4453 self._removeView(editor) 5478 self._removeView(editor)
4454 self.editors.remove(editor) 5479 self.editors.remove(editor)
4455 5480
4456 # send a signal, if it was the last editor for this filename 5481 # send a signal, if it was the last editor for this filename
4457 if fn and self.getOpenEditor(fn) is None: 5482 if fn and self.getOpenEditor(fn) is None:
4458 self.editorClosed.emit(fn) 5483 self.editorClosed.emit(fn)
4459 self.editorClosedEd.emit(editor) 5484 self.editorClosedEd.emit(editor)
4460 5485
4461 # send a signal, if it was the very last editor 5486 # send a signal, if it was the very last editor
4462 if not len(self.editors): 5487 if not len(self.editors):
4463 self.__lastEditorClosed() 5488 self.__lastEditorClosed()
4464 self.lastEditorClosed.emit() 5489 self.lastEditorClosed.emit()
4465 5490
4466 editor.deleteLater() 5491 editor.deleteLater()
4467 5492
4468 return True 5493 return True
4469 5494
4470 def closeCurrentWindow(self): 5495 def closeCurrentWindow(self):
4471 """ 5496 """
4472 Public method to close the current window. 5497 Public method to close the current window.
4473 5498
4474 @return flag indicating success (boolean) 5499 @return flag indicating success (boolean)
4475 """ 5500 """
4476 aw = self.activeWindow() 5501 aw = self.activeWindow()
4477 if aw is None: 5502 if aw is None:
4478 return False 5503 return False
4479 5504
4480 res = self.closeEditor(aw) 5505 res = self.closeEditor(aw)
4481 if res and aw == self.currentEditor: 5506 if res and aw == self.currentEditor:
4482 self.currentEditor = None 5507 self.currentEditor = None
4483 5508
4484 return res 5509 return res
4485 5510
4486 def closeAllWindows(self, ignoreDirty=False): 5511 def closeAllWindows(self, ignoreDirty=False):
4487 """ 5512 """
4488 Public method to close all editor windows. 5513 Public method to close all editor windows.
4489 5514
4490 @param ignoreDirty flag indicating to ignore the 'dirty' status 5515 @param ignoreDirty flag indicating to ignore the 'dirty' status
4491 @type bool 5516 @type bool
4492 """ 5517 """
4493 savedEditors = self.editors[:] 5518 savedEditors = self.editors[:]
4494 for editor in savedEditors: 5519 for editor in savedEditors:
4495 self.closeEditor(editor, ignoreDirty=ignoreDirty) 5520 self.closeEditor(editor, ignoreDirty=ignoreDirty)
4496 5521
4497 def closeWindow(self, fn, ignoreDirty=False): 5522 def closeWindow(self, fn, ignoreDirty=False):
4498 """ 5523 """
4499 Public method to close an arbitrary source editor. 5524 Public method to close an arbitrary source editor.
4500 5525
4501 @param fn file name of the editor to be closed 5526 @param fn file name of the editor to be closed
4502 @type str 5527 @type str
4503 @param ignoreDirty flag indicating to ignore the 'dirty' status 5528 @param ignoreDirty flag indicating to ignore the 'dirty' status
4504 @type bool 5529 @type bool
4505 @return flag indicating success 5530 @return flag indicating success
4508 for editor in self.editors: 5533 for editor in self.editors:
4509 if Utilities.samepath(fn, editor.getFileName()): 5534 if Utilities.samepath(fn, editor.getFileName()):
4510 break 5535 break
4511 else: 5536 else:
4512 return True 5537 return True
4513 5538
4514 res = self.closeEditor(editor, ignoreDirty=ignoreDirty) 5539 res = self.closeEditor(editor, ignoreDirty=ignoreDirty)
4515 if res and editor == self.currentEditor: 5540 if res and editor == self.currentEditor:
4516 self.currentEditor = None 5541 self.currentEditor = None
4517 5542
4518 return res 5543 return res
4519 5544
4520 def closeEditorWindow(self, editor): 5545 def closeEditorWindow(self, editor):
4521 """ 5546 """
4522 Public method to close an arbitrary source editor. 5547 Public method to close an arbitrary source editor.
4523 5548
4524 @param editor editor to be closed 5549 @param editor editor to be closed
4525 """ 5550 """
4526 if editor is None: 5551 if editor is None:
4527 return 5552 return
4528 5553
4529 res = self.closeEditor(editor) 5554 res = self.closeEditor(editor)
4530 if res and editor == self.currentEditor: 5555 if res and editor == self.currentEditor:
4531 self.currentEditor = None 5556 self.currentEditor = None
4532 5557
4533 def exit(self): 5558 def exit(self):
4534 """ 5559 """
4535 Public method to handle the debugged program terminating. 5560 Public method to handle the debugged program terminating.
4536 """ 5561 """
4537 if self.currentEditor is not None: 5562 if self.currentEditor is not None:
4538 self.currentEditor.highlight() 5563 self.currentEditor.highlight()
4539 self.currentEditor = None 5564 self.currentEditor = None
4540 5565
4541 for editor in self.editors: 5566 for editor in self.editors:
4542 editor.refreshCoverageAnnotations() 5567 editor.refreshCoverageAnnotations()
4543 5568
4544 self.__setSbFile() 5569 self.__setSbFile()
4545 5570
4546 def openSourceFile(self, fn, lineno=-1, filetype="", 5571 def openSourceFile(
4547 selStart=0, selEnd=0, pos=0, addNext=False, 5572 self,
4548 indexes=None): 5573 fn,
5574 lineno=-1,
5575 filetype="",
5576 selStart=0,
5577 selEnd=0,
5578 pos=0,
5579 addNext=False,
5580 indexes=None,
5581 ):
4549 """ 5582 """
4550 Public slot to display a file in an editor. 5583 Public slot to display a file in an editor.
4551 5584
4552 @param fn name of file to be opened 5585 @param fn name of file to be opened
4553 @type str 5586 @type str
4554 @param lineno line number to place the cursor at or list of line 5587 @param lineno line number to place the cursor at or list of line
4555 numbers (cursor will be placed at the next line greater than 5588 numbers (cursor will be placed at the next line greater than
4556 the current one) 5589 the current one)
4571 @type tuple of two int 5604 @type tuple of two int
4572 @return reference to the opened editor 5605 @return reference to the opened editor
4573 @rtype Editor 5606 @rtype Editor
4574 """ 5607 """
4575 try: 5608 try:
4576 newWin, editor = self.getEditor(fn, filetype=filetype, 5609 newWin, editor = self.getEditor(
4577 addNext=addNext, indexes=indexes) 5610 fn, filetype=filetype, addNext=addNext, indexes=indexes
5611 )
4578 except (OSError, UnicodeDecodeError): 5612 except (OSError, UnicodeDecodeError):
4579 return None 5613 return None
4580 5614
4581 if newWin: 5615 if newWin:
4582 self._modificationStatusChanged(editor.isModified(), editor) 5616 self._modificationStatusChanged(editor.isModified(), editor)
4583 self._checkActions(editor) 5617 self._checkActions(editor)
4584 5618
4585 cline, cindex = editor.getCursorPosition() 5619 cline, cindex = editor.getCursorPosition()
4586 cline += 1 5620 cline += 1
4587 if isinstance(lineno, list): 5621 if isinstance(lineno, list):
4588 if len(lineno) > 1: 5622 if len(lineno) > 1:
4589 for line in lineno: 5623 for line in lineno:
4595 line = lineno[0] 5629 line = lineno[0]
4596 else: 5630 else:
4597 line = -1 5631 line = -1
4598 else: 5632 else:
4599 line = lineno 5633 line = lineno
4600 5634
4601 if line >= 0 and line != cline: 5635 if line >= 0 and line != cline:
4602 editor.ensureVisibleTop(line) 5636 editor.ensureVisibleTop(line)
4603 editor.gotoLine(line, pos) 5637 editor.gotoLine(line, pos)
4604 5638
4605 if selStart != selEnd: 5639 if selStart != selEnd:
4606 editor.setSelection(line - 1, selStart, line - 1, selEnd) 5640 editor.setSelection(line - 1, selStart, line - 1, selEnd)
4607 5641
4608 # insert filename into list of recently opened files 5642 # insert filename into list of recently opened files
4609 self.addToRecentList(fn) 5643 self.addToRecentList(fn)
4610 5644
4611 return editor 5645 return editor
4612 5646
4613 def __connectEditor(self, editor): 5647 def __connectEditor(self, editor):
4614 """ 5648 """
4615 Private method to establish all editor connections. 5649 Private method to establish all editor connections.
4616 5650
4617 @param editor reference to the editor object to be connected 5651 @param editor reference to the editor object to be connected
4618 """ 5652 """
4619 editor.modificationStatusChanged.connect( 5653 editor.modificationStatusChanged.connect(self._modificationStatusChanged)
4620 self._modificationStatusChanged)
4621 editor.cursorChanged.connect( 5654 editor.cursorChanged.connect(
4622 lambda f, l, p: self.__cursorChanged(f, l, p, editor)) 5655 lambda f, l, p: self.__cursorChanged(f, l, p, editor)
4623 editor.editorSaved.connect( 5656 )
4624 lambda fn: self.__editorSaved(fn, editor)) 5657 editor.editorSaved.connect(lambda fn: self.__editorSaved(fn, editor))
4625 editor.editorRenamed.connect( 5658 editor.editorRenamed.connect(lambda fn: self.__editorRenamed(fn, editor))
4626 lambda fn: self.__editorRenamed(fn, editor))
4627 editor.breakpointToggled.connect(self.__breakpointToggled) 5659 editor.breakpointToggled.connect(self.__breakpointToggled)
4628 editor.bookmarkToggled.connect(self.__bookmarkToggled) 5660 editor.bookmarkToggled.connect(self.__bookmarkToggled)
4629 editor.syntaxerrorToggled.connect(self._syntaxErrorToggled) 5661 editor.syntaxerrorToggled.connect(self._syntaxErrorToggled)
4630 editor.coverageMarkersShown.connect(self.__coverageMarkersShown) 5662 editor.coverageMarkersShown.connect(self.__coverageMarkersShown)
4631 editor.autoCompletionAPIsAvailable.connect( 5663 editor.autoCompletionAPIsAvailable.connect(
4632 lambda a: self.__editorAutoCompletionAPIsAvailable(a, editor)) 5664 lambda a: self.__editorAutoCompletionAPIsAvailable(a, editor)
5665 )
4633 editor.undoAvailable.connect(self.undoAct.setEnabled) 5666 editor.undoAvailable.connect(self.undoAct.setEnabled)
4634 editor.redoAvailable.connect(self.redoAct.setEnabled) 5667 editor.redoAvailable.connect(self.redoAct.setEnabled)
4635 editor.taskMarkersUpdated.connect(self.__taskMarkersUpdated) 5668 editor.taskMarkersUpdated.connect(self.__taskMarkersUpdated)
4636 editor.changeMarkersUpdated.connect(self.__changeMarkersUpdated) 5669 editor.changeMarkersUpdated.connect(self.__changeMarkersUpdated)
4637 editor.languageChanged.connect( 5670 editor.languageChanged.connect(lambda: self.__editorConfigChanged(editor))
4638 lambda: self.__editorConfigChanged(editor)) 5671 editor.eolChanged.connect(lambda: self.__editorConfigChanged(editor))
4639 editor.eolChanged.connect( 5672 editor.encodingChanged.connect(lambda: self.__editorConfigChanged(editor))
4640 lambda: self.__editorConfigChanged(editor))
4641 editor.encodingChanged.connect(
4642 lambda: self.__editorConfigChanged(editor))
4643 editor.selectionChanged.connect( 5673 editor.selectionChanged.connect(
4644 lambda: self.__searchWidget.selectionChanged(editor)) 5674 lambda: self.__searchWidget.selectionChanged(editor)
5675 )
4645 editor.selectionChanged.connect( 5676 editor.selectionChanged.connect(
4646 lambda: self.__replaceWidget.selectionChanged(editor)) 5677 lambda: self.__replaceWidget.selectionChanged(editor)
4647 editor.selectionChanged.connect( 5678 )
4648 lambda: self.__editorSelectionChanged(editor)) 5679 editor.selectionChanged.connect(lambda: self.__editorSelectionChanged(editor))
4649 editor.lastEditPositionAvailable.connect( 5680 editor.lastEditPositionAvailable.connect(self.__lastEditPositionAvailable)
4650 self.__lastEditPositionAvailable) 5681 editor.zoomValueChanged.connect(lambda v: self.zoomValueChanged(v, editor))
4651 editor.zoomValueChanged.connect(
4652 lambda v: self.zoomValueChanged(v, editor))
4653 editor.mouseDoubleClick.connect( 5682 editor.mouseDoubleClick.connect(
4654 lambda pos, buttons: self.__editorDoubleClicked(editor, pos, 5683 lambda pos, buttons: self.__editorDoubleClicked(editor, pos, buttons)
4655 buttons)) 5684 )
4656 5685
4657 editor.languageChanged.connect( 5686 editor.languageChanged.connect(lambda: self.editorLanguageChanged.emit(editor))
4658 lambda: self.editorLanguageChanged.emit(editor))
4659 editor.textChanged.connect(lambda: self.editorTextChanged.emit(editor)) 5687 editor.textChanged.connect(lambda: self.editorTextChanged.emit(editor))
4660 5688
4661 def newEditorView(self, fn, caller, filetype="", indexes=None): 5689 def newEditorView(self, fn, caller, filetype="", indexes=None):
4662 """ 5690 """
4663 Public method to create a new editor displaying the given document. 5691 Public method to create a new editor displaying the given document.
4664 5692
4665 @param fn filename of this view 5693 @param fn filename of this view
4666 @type str 5694 @type str
4667 @param caller reference to the editor calling this method 5695 @param caller reference to the editor calling this method
4668 @type Editor 5696 @type Editor
4669 @param filetype type of the source file 5697 @param filetype type of the source file
4673 @type tuple of two int 5701 @type tuple of two int
4674 @return reference to the new editor object 5702 @return reference to the new editor object
4675 @rtype Editor 5703 @rtype Editor
4676 """ 5704 """
4677 editor, assembly = self.cloneEditor(caller, filetype, fn) 5705 editor, assembly = self.cloneEditor(caller, filetype, fn)
4678 5706
4679 self._addView(assembly, fn, caller.getNoName(), indexes=indexes) 5707 self._addView(assembly, fn, caller.getNoName(), indexes=indexes)
4680 self._modificationStatusChanged(editor.isModified(), editor) 5708 self._modificationStatusChanged(editor.isModified(), editor)
4681 self._checkActions(editor) 5709 self._checkActions(editor)
4682 5710
4683 return editor 5711 return editor
4684 5712
4685 def cloneEditor(self, caller, filetype, fn): 5713 def cloneEditor(self, caller, filetype, fn):
4686 """ 5714 """
4687 Public method to clone an editor displaying the given document. 5715 Public method to clone an editor displaying the given document.
4688 5716
4689 @param caller reference to the editor calling this method 5717 @param caller reference to the editor calling this method
4690 @param filetype type of the source file (string) 5718 @param filetype type of the source file (string)
4691 @param fn filename of this view 5719 @param fn filename of this view
4692 @return reference to the new editor object (Editor.Editor) and the new 5720 @return reference to the new editor object (Editor.Editor) and the new
4693 editor assembly object (EditorAssembly.EditorAssembly) 5721 editor assembly object (EditorAssembly.EditorAssembly)
4694 """ 5722 """
4695 from QScintilla.EditorAssembly import EditorAssembly 5723 from QScintilla.EditorAssembly import EditorAssembly
4696 assembly = EditorAssembly(self.dbs, fn, self, filetype=filetype, 5724
4697 editor=caller, 5725 assembly = EditorAssembly(
4698 tv=ericApp().getObject("TaskViewer")) 5726 self.dbs,
5727 fn,
5728 self,
5729 filetype=filetype,
5730 editor=caller,
5731 tv=ericApp().getObject("TaskViewer"),
5732 )
4699 editor = assembly.getEditor() 5733 editor = assembly.getEditor()
4700 self.editors.append(editor) 5734 self.editors.append(editor)
4701 self.__connectEditor(editor) 5735 self.__connectEditor(editor)
4702 self.__editorOpened() 5736 self.__editorOpened()
4703 self.editorOpened.emit(fn) 5737 self.editorOpened.emit(fn)
4704 self.editorOpenedEd.emit(editor) 5738 self.editorOpenedEd.emit(editor)
4705 5739
4706 return editor, assembly 5740 return editor, assembly
4707 5741
4708 def addToRecentList(self, fn): 5742 def addToRecentList(self, fn):
4709 """ 5743 """
4710 Public slot to add a filename to the list of recently opened files. 5744 Public slot to add a filename to the list of recently opened files.
4711 5745
4712 @param fn name of the file to be added 5746 @param fn name of the file to be added
4713 """ 5747 """
4714 for recent in self.recent[:]: 5748 for recent in self.recent[:]:
4715 if Utilities.samepath(fn, recent): 5749 if Utilities.samepath(fn, recent):
4716 self.recent.remove(recent) 5750 self.recent.remove(recent)
4717 self.recent.insert(0, fn) 5751 self.recent.insert(0, fn)
4718 maxRecent = Preferences.getUI("RecentNumber") 5752 maxRecent = Preferences.getUI("RecentNumber")
4719 if len(self.recent) > maxRecent: 5753 if len(self.recent) > maxRecent:
4720 self.recent = self.recent[:maxRecent] 5754 self.recent = self.recent[:maxRecent]
4721 self.__saveRecent() 5755 self.__saveRecent()
4722 5756
4723 def showDebugSource(self, fn, line): 5757 def showDebugSource(self, fn, line):
4724 """ 5758 """
4725 Public method to open the given file and highlight the given line in 5759 Public method to open the given file and highlight the given line in
4726 it. 5760 it.
4727 5761
4728 @param fn filename of editor to update (string) 5762 @param fn filename of editor to update (string)
4729 @param line line number to highlight (int) 5763 @param line line number to highlight (int)
4730 """ 5764 """
4731 if not fn.startswith('<'): 5765 if not fn.startswith("<"):
4732 self.openSourceFile(fn, line) 5766 self.openSourceFile(fn, line)
4733 self.setFileLine(fn, line) 5767 self.setFileLine(fn, line)
4734 5768
4735 def setFileLine(self, fn, line, error=False, syntaxError=False): 5769 def setFileLine(self, fn, line, error=False, syntaxError=False):
4736 """ 5770 """
4737 Public method to update the user interface when the current program 5771 Public method to update the user interface when the current program
4738 or line changes. 5772 or line changes.
4739 5773
4740 @param fn filename of editor to update (string) 5774 @param fn filename of editor to update (string)
4741 @param line line number to highlight (int) 5775 @param line line number to highlight (int)
4742 @param error flag indicating an error highlight (boolean) 5776 @param error flag indicating an error highlight (boolean)
4743 @param syntaxError flag indicating a syntax error 5777 @param syntaxError flag indicating a syntax error
4744 """ 5778 """
4745 try: 5779 try:
4746 newWin, self.currentEditor = self.getEditor(fn) 5780 newWin, self.currentEditor = self.getEditor(fn)
4747 except (OSError, UnicodeDecodeError): 5781 except (OSError, UnicodeDecodeError):
4748 return 5782 return
4749 5783
4750 enc = self.currentEditor.getEncoding() 5784 enc = self.currentEditor.getEncoding()
4751 lang = self.currentEditor.getLanguage() 5785 lang = self.currentEditor.getLanguage()
4752 eol = self.currentEditor.getEolIndicator() 5786 eol = self.currentEditor.getEolIndicator()
4753 zoom = self.currentEditor.getZoom() 5787 zoom = self.currentEditor.getZoom()
4754 self.__setSbFile(fn, line, encoding=enc, language=lang, eol=eol, 5788 self.__setSbFile(fn, line, encoding=enc, language=lang, eol=eol, zoom=zoom)
4755 zoom=zoom) 5789
4756
4757 # Change the highlighted line. 5790 # Change the highlighted line.
4758 self.currentEditor.highlight(line, error, syntaxError) 5791 self.currentEditor.highlight(line, error, syntaxError)
4759 5792
4760 self.currentEditor.highlightVisible() 5793 self.currentEditor.highlightVisible()
4761 self._checkActions(self.currentEditor, False) 5794 self._checkActions(self.currentEditor, False)
4762 5795
4763 def __setSbFile(self, fn=None, line=None, pos=None, 5796 def __setSbFile(
4764 encoding=None, language=None, eol=None, 5797 self,
4765 zoom=None): 5798 fn=None,
5799 line=None,
5800 pos=None,
5801 encoding=None,
5802 language=None,
5803 eol=None,
5804 zoom=None,
5805 ):
4766 """ 5806 """
4767 Private method to set the file info in the status bar. 5807 Private method to set the file info in the status bar.
4768 5808
4769 @param fn filename to display (string) 5809 @param fn filename to display (string)
4770 @param line line number to display (int) 5810 @param line line number to display (int)
4771 @param pos character position to display (int) 5811 @param pos character position to display (int)
4772 @param encoding encoding name to display (string) 5812 @param encoding encoding name to display (string)
4773 @param language language to display (string) 5813 @param language language to display (string)
4774 @param eol eol indicator to display (string) 5814 @param eol eol indicator to display (string)
4775 @param zoom zoom value (integer) 5815 @param zoom zoom value (integer)
4776 """ 5816 """
4777 if not fn: 5817 if not fn:
4778 fn = '' 5818 fn = ""
4779 writ = ' ' 5819 writ = " "
4780 else: 5820 else:
4781 if os.access(fn, os.W_OK): 5821 if os.access(fn, os.W_OK):
4782 writ = 'rw' 5822 writ = "rw"
4783 else: 5823 else:
4784 writ = 'ro' 5824 writ = "ro"
4785 self.sbWritable.setText(writ) 5825 self.sbWritable.setText(writ)
4786 5826
4787 if line is None: 5827 if line is None:
4788 line = '' 5828 line = ""
4789 self.sbLine.setText( 5829 self.sbLine.setText(
4790 QCoreApplication.translate('ViewManager', 'Line: {0:5}') 5830 QCoreApplication.translate("ViewManager", "Line: {0:5}").format(line)
4791 .format(line)) 5831 )
4792 5832
4793 if pos is None: 5833 if pos is None:
4794 pos = '' 5834 pos = ""
4795 self.sbPos.setText( 5835 self.sbPos.setText(
4796 QCoreApplication.translate('ViewManager', 'Pos: {0:5}') 5836 QCoreApplication.translate("ViewManager", "Pos: {0:5}").format(pos)
4797 .format(pos)) 5837 )
4798 5838
4799 if encoding is None: 5839 if encoding is None:
4800 encoding = '' 5840 encoding = ""
4801 self.sbEnc.setText(encoding) 5841 self.sbEnc.setText(encoding)
4802 5842
4803 if language is None: 5843 if language is None:
4804 pixmap = QPixmap() 5844 pixmap = QPixmap()
4805 elif language == "": 5845 elif language == "":
4806 pixmap = UI.PixmapCache.getPixmap("fileText") 5846 pixmap = UI.PixmapCache.getPixmap("fileText")
4807 else: 5847 else:
4808 import QScintilla.Lexers 5848 import QScintilla.Lexers
5849
4809 pixmap = QScintilla.Lexers.getLanguageIcon(language, True) 5850 pixmap = QScintilla.Lexers.getLanguageIcon(language, True)
4810 self.sbLang.setPixmap(pixmap) 5851 self.sbLang.setPixmap(pixmap)
4811 if pixmap.isNull(): 5852 if pixmap.isNull():
4812 self.sbLang.setText(language) 5853 self.sbLang.setText(language)
4813 self.sbLang.setToolTip("") 5854 self.sbLang.setToolTip("")
4814 else: 5855 else:
4815 self.sbLang.setText("") 5856 self.sbLang.setText("")
4816 self.sbLang.setToolTip( 5857 self.sbLang.setToolTip(
4817 QCoreApplication.translate('ViewManager', 'Language: {0}') 5858 QCoreApplication.translate("ViewManager", "Language: {0}").format(
4818 .format(language)) 5859 language
4819 5860 )
5861 )
5862
4820 if eol is None: 5863 if eol is None:
4821 eol = '' 5864 eol = ""
4822 self.sbEol.setPixmap(self.__eolPixmap(eol)) 5865 self.sbEol.setPixmap(self.__eolPixmap(eol))
4823 self.sbEol.setToolTip( 5866 self.sbEol.setToolTip(
4824 QCoreApplication.translate('ViewManager', 'EOL Mode: {0}') 5867 QCoreApplication.translate("ViewManager", "EOL Mode: {0}").format(eol)
4825 .format(eol)) 5868 )
4826 5869
4827 if zoom is None: 5870 if zoom is None:
4828 if QApplication.focusWidget() == ericApp().getObject("Shell"): 5871 if QApplication.focusWidget() == ericApp().getObject("Shell"):
4829 aw = ericApp().getObject("Shell") 5872 aw = ericApp().getObject("Shell")
4830 else: 5873 else:
4831 aw = self.activeWindow() 5874 aw = self.activeWindow()
4832 if aw: 5875 if aw:
4833 self.sbZoom.setValue(aw.getZoom()) 5876 self.sbZoom.setValue(aw.getZoom())
4834 else: 5877 else:
4835 self.sbZoom.setValue(zoom) 5878 self.sbZoom.setValue(zoom)
4836 5879
4837 def __eolPixmap(self, eolIndicator): 5880 def __eolPixmap(self, eolIndicator):
4838 """ 5881 """
4839 Private method to get an EOL pixmap for an EOL string. 5882 Private method to get an EOL pixmap for an EOL string.
4840 5883
4841 @param eolIndicator eol indicator string (string) 5884 @param eolIndicator eol indicator string (string)
4842 @return pixmap for the eol indicator (QPixmap) 5885 @return pixmap for the eol indicator (QPixmap)
4843 """ 5886 """
4844 if eolIndicator == "LF": 5887 if eolIndicator == "LF":
4845 pixmap = UI.PixmapCache.getPixmap("eolLinux") 5888 pixmap = UI.PixmapCache.getPixmap("eolLinux")
4848 elif eolIndicator == "CRLF": 5891 elif eolIndicator == "CRLF":
4849 pixmap = UI.PixmapCache.getPixmap("eolWindows") 5892 pixmap = UI.PixmapCache.getPixmap("eolWindows")
4850 else: 5893 else:
4851 pixmap = QPixmap() 5894 pixmap = QPixmap()
4852 return pixmap 5895 return pixmap
4853 5896
4854 def __unhighlight(self): 5897 def __unhighlight(self):
4855 """ 5898 """
4856 Private slot to switch of all highlights. 5899 Private slot to switch of all highlights.
4857 """ 5900 """
4858 self.unhighlight() 5901 self.unhighlight()
4859 5902
4860 def unhighlight(self, current=False): 5903 def unhighlight(self, current=False):
4861 """ 5904 """
4862 Public method to switch off all highlights or the highlight of 5905 Public method to switch off all highlights or the highlight of
4863 the current editor. 5906 the current editor.
4864 5907
4865 @param current flag indicating only the current editor should be 5908 @param current flag indicating only the current editor should be
4866 unhighlighted (boolean) 5909 unhighlighted (boolean)
4867 """ 5910 """
4868 if current: 5911 if current:
4869 if self.currentEditor is not None: 5912 if self.currentEditor is not None:
4870 self.currentEditor.highlight() 5913 self.currentEditor.highlight()
4871 else: 5914 else:
4872 for editor in self.editors: 5915 for editor in self.editors:
4873 editor.highlight() 5916 editor.highlight()
4874 5917
4875 def getOpenFilenames(self): 5918 def getOpenFilenames(self):
4876 """ 5919 """
4877 Public method returning a list of the filenames of all editors. 5920 Public method returning a list of the filenames of all editors.
4878 5921
4879 @return list of all opened filenames (list of strings) 5922 @return list of all opened filenames (list of strings)
4880 """ 5923 """
4881 filenames = [] 5924 filenames = []
4882 for editor in self.editors: 5925 for editor in self.editors:
4883 fn = editor.getFileName() 5926 fn = editor.getFileName()
4884 if fn is not None and fn not in filenames and os.path.exists(fn): 5927 if fn is not None and fn not in filenames and os.path.exists(fn):
4885 # only return names of existing files 5928 # only return names of existing files
4886 filenames.append(fn) 5929 filenames.append(fn)
4887 5930
4888 return filenames 5931 return filenames
4889 5932
4890 def getEditor(self, fn, filetype="", addNext=False, indexes=None): 5933 def getEditor(self, fn, filetype="", addNext=False, indexes=None):
4891 """ 5934 """
4892 Public method to return the editor displaying the given file. 5935 Public method to return the editor displaying the given file.
4893 5936
4894 If there is no editor with the given file, a new editor window is 5937 If there is no editor with the given file, a new editor window is
4895 created. 5938 created.
4896 5939
4897 @param fn filename to look for 5940 @param fn filename to look for
4898 @type str 5941 @type str
4899 @param filetype type of the source file 5942 @param filetype type of the source file
4900 @type str 5943 @type str
4901 @param addNext flag indicating that if a new editor needs to be 5944 @param addNext flag indicating that if a new editor needs to be
4914 for editor in self.editors: 5957 for editor in self.editors:
4915 if Utilities.samepath(fn, editor.getFileName()): 5958 if Utilities.samepath(fn, editor.getFileName()):
4916 break 5959 break
4917 else: 5960 else:
4918 from QScintilla.EditorAssembly import EditorAssembly 5961 from QScintilla.EditorAssembly import EditorAssembly
4919 assembly = EditorAssembly(self.dbs, fn, self, 5962
4920 filetype=filetype, 5963 assembly = EditorAssembly(
4921 tv=ericApp().getObject("TaskViewer")) 5964 self.dbs,
5965 fn,
5966 self,
5967 filetype=filetype,
5968 tv=ericApp().getObject("TaskViewer"),
5969 )
4922 editor = assembly.getEditor() 5970 editor = assembly.getEditor()
4923 self.editors.append(editor) 5971 self.editors.append(editor)
4924 self.__connectEditor(editor) 5972 self.__connectEditor(editor)
4925 self.__editorOpened() 5973 self.__editorOpened()
4926 self.editorOpened.emit(fn) 5974 self.editorOpened.emit(fn)
4927 self.editorOpenedEd.emit(editor) 5975 self.editorOpenedEd.emit(editor)
4928 newWin = True 5976 newWin = True
4929 5977
4930 if newWin: 5978 if newWin:
4931 self._addView(assembly, fn, addNext=addNext, indexes=indexes) 5979 self._addView(assembly, fn, addNext=addNext, indexes=indexes)
4932 else: 5980 else:
4933 self._showView(editor.parent(), fn) 5981 self._showView(editor.parent(), fn)
4934 5982
4935 return (newWin, editor) 5983 return (newWin, editor)
4936 5984
4937 def getOpenEditors(self): 5985 def getOpenEditors(self):
4938 """ 5986 """
4939 Public method to get references to all open editors. 5987 Public method to get references to all open editors.
4940 5988
4941 @return list of references to all open editors (list of 5989 @return list of references to all open editors (list of
4942 QScintilla.editor) 5990 QScintilla.editor)
4943 """ 5991 """
4944 return self.editors 5992 return self.editors
4945 5993
4946 def getOpenEditorsCount(self): 5994 def getOpenEditorsCount(self):
4947 """ 5995 """
4948 Public method to get the number of open editors. 5996 Public method to get the number of open editors.
4949 5997
4950 @return number of open editors (integer) 5998 @return number of open editors (integer)
4951 """ 5999 """
4952 return len(self.editors) 6000 return len(self.editors)
4953 6001
4954 def getOpenEditor(self, fn): 6002 def getOpenEditor(self, fn):
4955 """ 6003 """
4956 Public method to return the editor displaying the given file. 6004 Public method to return the editor displaying the given file.
4957 6005
4958 @param fn filename to look for 6006 @param fn filename to look for
4959 @return a reference to the editor displaying this file or None, if 6007 @return a reference to the editor displaying this file or None, if
4960 no editor was found 6008 no editor was found
4961 """ 6009 """
4962 for editor in self.editors: 6010 for editor in self.editors:
4963 if Utilities.samepath(fn, editor.getFileName()): 6011 if Utilities.samepath(fn, editor.getFileName()):
4964 return editor 6012 return editor
4965 6013
4966 return None 6014 return None
4967 6015
4968 def getOpenEditorCount(self, fn): 6016 def getOpenEditorCount(self, fn):
4969 """ 6017 """
4970 Public method to return the count of editors displaying the given file. 6018 Public method to return the count of editors displaying the given file.
4971 6019
4972 @param fn filename to look for 6020 @param fn filename to look for
4973 @return count of editors displaying this file (integer) 6021 @return count of editors displaying this file (integer)
4974 """ 6022 """
4975 count = 0 6023 count = 0
4976 for editor in self.editors: 6024 for editor in self.editors:
4977 if Utilities.samepath(fn, editor.getFileName()): 6025 if Utilities.samepath(fn, editor.getFileName()):
4978 count += 1 6026 count += 1
4979 return count 6027 return count
4980 6028
4981 def getOpenEditorsForSession(self): 6029 def getOpenEditorsForSession(self):
4982 """ 6030 """
4983 Public method to get a lists of all open editors. 6031 Public method to get a lists of all open editors.
4984 6032
4985 The returned list contains one list per split view. If the view manager 6033 The returned list contains one list per split view. If the view manager
4986 cannot split the view, only one list of editors is returned. 6034 cannot split the view, only one list of editors is returned.
4987 6035
4988 Note: This method should be implemented by subclasses. 6036 Note: This method should be implemented by subclasses.
4989 6037
4990 @return list of list of editor references 6038 @return list of list of editor references
4991 @rtype list of list of Editor 6039 @rtype list of list of Editor
4992 """ 6040 """
4993 return [self.editors] 6041 return [self.editors]
4994 6042
4995 def getActiveName(self): 6043 def getActiveName(self):
4996 """ 6044 """
4997 Public method to retrieve the filename of the active window. 6045 Public method to retrieve the filename of the active window.
4998 6046
4999 @return filename of active window (string) 6047 @return filename of active window (string)
5000 """ 6048 """
5001 aw = self.activeWindow() 6049 aw = self.activeWindow()
5002 if aw: 6050 if aw:
5003 return aw.getFileName() 6051 return aw.getFileName()
5004 else: 6052 else:
5005 return None 6053 return None
5006 6054
5007 def saveEditor(self, fn): 6055 def saveEditor(self, fn):
5008 """ 6056 """
5009 Public method to save a named editor file. 6057 Public method to save a named editor file.
5010 6058
5011 @param fn filename of editor to be saved (string) 6059 @param fn filename of editor to be saved (string)
5012 @return flag indicating success (boolean) 6060 @return flag indicating success (boolean)
5013 """ 6061 """
5014 for editor in self.editors: 6062 for editor in self.editors:
5015 if Utilities.samepath(fn, editor.getFileName()): 6063 if Utilities.samepath(fn, editor.getFileName()):
5016 break 6064 break
5017 else: 6065 else:
5018 return True 6066 return True
5019 6067
5020 if not editor.isModified(): 6068 if not editor.isModified():
5021 return True 6069 return True
5022 else: 6070 else:
5023 ok = editor.saveFile() 6071 ok = editor.saveFile()
5024 return ok 6072 return ok
5025 6073
5026 def saveEditorEd(self, ed): 6074 def saveEditorEd(self, ed):
5027 """ 6075 """
5028 Public slot to save the contents of an editor. 6076 Public slot to save the contents of an editor.
5029 6077
5030 @param ed editor to be saved 6078 @param ed editor to be saved
5031 @return flag indicating success (boolean) 6079 @return flag indicating success (boolean)
5032 """ 6080 """
5033 if ed: 6081 if ed:
5034 if not ed.isModified(): 6082 if not ed.isModified():
5038 if ok: 6086 if ok:
5039 self.setEditorName(ed, ed.getFileName()) 6087 self.setEditorName(ed, ed.getFileName())
5040 return ok 6088 return ok
5041 else: 6089 else:
5042 return False 6090 return False
5043 6091
5044 def saveCurrentEditor(self): 6092 def saveCurrentEditor(self):
5045 """ 6093 """
5046 Public slot to save the contents of the current editor. 6094 Public slot to save the contents of the current editor.
5047 """ 6095 """
5048 aw = self.activeWindow() 6096 aw = self.activeWindow()
5049 self.saveEditorEd(aw) 6097 self.saveEditorEd(aw)
5050 6098
5051 def saveAsEditorEd(self, ed): 6099 def saveAsEditorEd(self, ed):
5052 """ 6100 """
5053 Public slot to save the contents of an editor to a new file. 6101 Public slot to save the contents of an editor to a new file.
5054 6102
5055 @param ed editor to be saved 6103 @param ed editor to be saved
5056 """ 6104 """
5057 if ed: 6105 if ed:
5058 ok = ed.saveFileAs() 6106 ok = ed.saveFileAs()
5059 if ok: 6107 if ok:
5060 self.setEditorName(ed, ed.getFileName()) 6108 self.setEditorName(ed, ed.getFileName())
5061 6109
5062 def saveAsCurrentEditor(self): 6110 def saveAsCurrentEditor(self):
5063 """ 6111 """
5064 Public slot to save the contents of the current editor to a new file. 6112 Public slot to save the contents of the current editor to a new file.
5065 """ 6113 """
5066 aw = self.activeWindow() 6114 aw = self.activeWindow()
5068 6116
5069 def saveCopyEditorEd(self, ed): 6117 def saveCopyEditorEd(self, ed):
5070 """ 6118 """
5071 Public slot to save the contents of an editor to a new copy of 6119 Public slot to save the contents of an editor to a new copy of
5072 the file. 6120 the file.
5073 6121
5074 @param ed editor to be saved 6122 @param ed editor to be saved
5075 """ 6123 """
5076 if ed: 6124 if ed:
5077 ed.saveFileCopy() 6125 ed.saveFileCopy()
5078 6126
5079 def saveCopyCurrentEditor(self): 6127 def saveCopyCurrentEditor(self):
5080 """ 6128 """
5081 Public slot to save the contents of the current editor to a new copy 6129 Public slot to save the contents of the current editor to a new copy
5082 of the file. 6130 of the file.
5083 """ 6131 """
5084 aw = self.activeWindow() 6132 aw = self.activeWindow()
5085 self.saveCopyEditorEd(aw) 6133 self.saveCopyEditorEd(aw)
5086 6134
5087 def saveEditorsList(self, editors): 6135 def saveEditorsList(self, editors):
5088 """ 6136 """
5089 Public slot to save a list of editors. 6137 Public slot to save a list of editors.
5090 6138
5091 @param editors list of editors to be saved 6139 @param editors list of editors to be saved
5092 """ 6140 """
5093 for editor in editors: 6141 for editor in editors:
5094 ok = editor.saveFile() 6142 ok = editor.saveFile()
5095 if ok: 6143 if ok:
5096 self.setEditorName(editor, editor.getFileName()) 6144 self.setEditorName(editor, editor.getFileName())
5097 6145
5098 def saveAllEditors(self): 6146 def saveAllEditors(self):
5099 """ 6147 """
5100 Public slot to save the contents of all editors. 6148 Public slot to save the contents of all editors.
5101 """ 6149 """
5102 for editor in self.editors: 6150 for editor in self.editors:
5103 ok = editor.saveFile() 6151 ok = editor.saveFile()
5104 if ok: 6152 if ok:
5105 self.setEditorName(editor, editor.getFileName()) 6153 self.setEditorName(editor, editor.getFileName())
5106 6154
5107 # restart autosave timer 6155 # restart autosave timer
5108 if self.autosaveInterval > 0: 6156 if self.autosaveInterval > 0:
5109 self.autosaveTimer.start(self.autosaveInterval * 60000) 6157 self.autosaveTimer.start(self.autosaveInterval * 60000)
5110 6158
5111 def __exportMenuTriggered(self, act): 6159 def __exportMenuTriggered(self, act):
5112 """ 6160 """
5113 Private method to handle the selection of an export format. 6161 Private method to handle the selection of an export format.
5114 6162
5115 @param act reference to the action that was triggered (QAction) 6163 @param act reference to the action that was triggered (QAction)
5116 """ 6164 """
5117 aw = self.activeWindow() 6165 aw = self.activeWindow()
5118 if aw: 6166 if aw:
5119 exporterFormat = act.data() 6167 exporterFormat = act.data()
5120 aw.exportFile(exporterFormat) 6168 aw.exportFile(exporterFormat)
5121 6169
5122 def newEditor(self): 6170 def newEditor(self):
5123 """ 6171 """
5124 Public slot to generate a new empty editor. 6172 Public slot to generate a new empty editor.
5125 """ 6173 """
5126 from QScintilla.EditorAssembly import EditorAssembly 6174 from QScintilla.EditorAssembly import EditorAssembly
5127 assembly = EditorAssembly(self.dbs, "", self, 6175
5128 tv=ericApp().getObject("TaskViewer")) 6176 assembly = EditorAssembly(
6177 self.dbs, "", self, tv=ericApp().getObject("TaskViewer")
6178 )
5129 editor = assembly.getEditor() 6179 editor = assembly.getEditor()
5130 self.editors.append(editor) 6180 self.editors.append(editor)
5131 self.__connectEditor(editor) 6181 self.__connectEditor(editor)
5132 self._addView(assembly, None) 6182 self._addView(assembly, None)
5133 self.__editorOpened() 6183 self.__editorOpened()
5134 self._checkActions(editor) 6184 self._checkActions(editor)
5135 self.editorOpened.emit("") 6185 self.editorOpened.emit("")
5136 self.editorOpenedEd.emit(editor) 6186 self.editorOpenedEd.emit(editor)
5137 6187
5138 def printEditor(self, editor): 6188 def printEditor(self, editor):
5139 """ 6189 """
5140 Public slot to print an editor. 6190 Public slot to print an editor.
5141 6191
5142 @param editor editor to be printed 6192 @param editor editor to be printed
5143 @type Editor 6193 @type Editor
5144 """ 6194 """
5145 if editor: 6195 if editor:
5146 editor.printFile() 6196 editor.printFile()
5147 6197
5148 def printCurrentEditor(self): 6198 def printCurrentEditor(self):
5149 """ 6199 """
5150 Public slot to print the contents of the current editor. 6200 Public slot to print the contents of the current editor.
5151 """ 6201 """
5152 aw = self.activeWindow() 6202 aw = self.activeWindow()
5153 self.printEditor(aw) 6203 self.printEditor(aw)
5154 6204
5155 def printPreviewEditor(self, editor): 6205 def printPreviewEditor(self, editor):
5156 """ 6206 """
5157 Public slot to show a print preview of an editor. 6207 Public slot to show a print preview of an editor.
5158 6208
5159 @param editor editor to be printed 6209 @param editor editor to be printed
5160 @type Editor 6210 @type Editor
5161 """ 6211 """
5162 if editor: 6212 if editor:
5163 editor.printPreviewFile() 6213 editor.printPreviewFile()
5164 6214
5165 def printPreviewCurrentEditor(self): 6215 def printPreviewCurrentEditor(self):
5166 """ 6216 """
5167 Public slot to show a print preview of the current editor. 6217 Public slot to show a print preview of the current editor.
5168 """ 6218 """
5169 aw = self.activeWindow() 6219 aw = self.activeWindow()
5170 if aw: 6220 if aw:
5171 aw.printPreviewFile() 6221 aw.printPreviewFile()
5172 6222
5173 def __showFileMenu(self): 6223 def __showFileMenu(self):
5174 """ 6224 """
5175 Private method to set up the file menu. 6225 Private method to set up the file menu.
5176 """ 6226 """
5177 self.menuRecentAct.setEnabled(len(self.recent) > 0) 6227 self.menuRecentAct.setEnabled(len(self.recent) > 0)
5178 6228
5179 def __showRecentMenu(self): 6229 def __showRecentMenu(self):
5180 """ 6230 """
5181 Private method to set up recent files menu. 6231 Private method to set up recent files menu.
5182 """ 6232 """
5183 self.__loadRecent() 6233 self.__loadRecent()
5184 6234
5185 self.recentMenu.clear() 6235 self.recentMenu.clear()
5186 6236
5187 for idx, rs in enumerate(self.recent, start=1): 6237 for idx, rs in enumerate(self.recent, start=1):
5188 formatStr = '&{0:d}. {1}' if idx < 10 else '{0:d}. {1}' 6238 formatStr = "&{0:d}. {1}" if idx < 10 else "{0:d}. {1}"
5189 act = self.recentMenu.addAction( 6239 act = self.recentMenu.addAction(
5190 formatStr.format( 6240 formatStr.format(
5191 idx, 6241 idx, Utilities.compactPath(rs, self.ui.maxMenuFilePathLen)
5192 Utilities.compactPath(rs, self.ui.maxMenuFilePathLen))) 6242 )
6243 )
5193 act.setData(rs) 6244 act.setData(rs)
5194 act.setEnabled(pathlib.Path(rs).exists()) 6245 act.setEnabled(pathlib.Path(rs).exists())
5195 6246
5196 self.recentMenu.addSeparator() 6247 self.recentMenu.addSeparator()
5197 self.recentMenu.addAction( 6248 self.recentMenu.addAction(
5198 QCoreApplication.translate('ViewManager', '&Clear'), 6249 QCoreApplication.translate("ViewManager", "&Clear"), self.clearRecent
5199 self.clearRecent) 6250 )
5200 6251
5201 def __openSourceFile(self, act): 6252 def __openSourceFile(self, act):
5202 """ 6253 """
5203 Private method to open a file from the list of recently opened files. 6254 Private method to open a file from the list of recently opened files.
5204 6255
5205 @param act reference to the action that triggered (QAction) 6256 @param act reference to the action that triggered (QAction)
5206 """ 6257 """
5207 file = act.data() 6258 file = act.data()
5208 if file: 6259 if file:
5209 self.openSourceFile(file) 6260 self.openSourceFile(file)
5210 6261
5211 def clearRecent(self): 6262 def clearRecent(self):
5212 """ 6263 """
5213 Public method to clear the recent files menu. 6264 Public method to clear the recent files menu.
5214 """ 6265 """
5215 self.recent = [] 6266 self.recent = []
5216 self.__saveRecent() 6267 self.__saveRecent()
5217 6268
5218 def __showBookmarkedMenu(self): 6269 def __showBookmarkedMenu(self):
5219 """ 6270 """
5220 Private method to set up bookmarked files menu. 6271 Private method to set up bookmarked files menu.
5221 """ 6272 """
5222 self.bookmarkedMenu.clear() 6273 self.bookmarkedMenu.clear()
5223 6274
5224 for rp in self.bookmarked: 6275 for rp in self.bookmarked:
5225 act = self.bookmarkedMenu.addAction( 6276 act = self.bookmarkedMenu.addAction(
5226 Utilities.compactPath(rp, self.ui.maxMenuFilePathLen)) 6277 Utilities.compactPath(rp, self.ui.maxMenuFilePathLen)
6278 )
5227 act.setData(rp) 6279 act.setData(rp)
5228 act.setEnabled(pathlib.Path(rp).exists()) 6280 act.setEnabled(pathlib.Path(rp).exists())
5229 6281
5230 if len(self.bookmarked): 6282 if len(self.bookmarked):
5231 self.bookmarkedMenu.addSeparator() 6283 self.bookmarkedMenu.addSeparator()
5232 self.bookmarkedMenu.addAction( 6284 self.bookmarkedMenu.addAction(
5233 QCoreApplication.translate('ViewManager', '&Add'), 6285 QCoreApplication.translate("ViewManager", "&Add"), self.__addBookmarked
5234 self.__addBookmarked) 6286 )
5235 self.bookmarkedMenu.addAction( 6287 self.bookmarkedMenu.addAction(
5236 QCoreApplication.translate('ViewManager', '&Edit...'), 6288 QCoreApplication.translate("ViewManager", "&Edit..."), self.__editBookmarked
5237 self.__editBookmarked) 6289 )
5238 self.bookmarkedMenu.addAction( 6290 self.bookmarkedMenu.addAction(
5239 QCoreApplication.translate('ViewManager', '&Clear'), 6291 QCoreApplication.translate("ViewManager", "&Clear"), self.__clearBookmarked
5240 self.__clearBookmarked) 6292 )
5241 6293
5242 def __addBookmarked(self): 6294 def __addBookmarked(self):
5243 """ 6295 """
5244 Private method to add the current file to the list of bookmarked files. 6296 Private method to add the current file to the list of bookmarked files.
5245 """ 6297 """
5246 an = self.getActiveName() 6298 an = self.getActiveName()
5247 if an is not None and an not in self.bookmarked: 6299 if an is not None and an not in self.bookmarked:
5248 self.bookmarked.append(an) 6300 self.bookmarked.append(an)
5249 6301
5250 def __editBookmarked(self): 6302 def __editBookmarked(self):
5251 """ 6303 """
5252 Private method to edit the list of bookmarked files. 6304 Private method to edit the list of bookmarked files.
5253 """ 6305 """
5254 from .BookmarkedFilesDialog import BookmarkedFilesDialog 6306 from .BookmarkedFilesDialog import BookmarkedFilesDialog
6307
5255 dlg = BookmarkedFilesDialog(self.bookmarked, self.ui) 6308 dlg = BookmarkedFilesDialog(self.bookmarked, self.ui)
5256 if dlg.exec() == QDialog.DialogCode.Accepted: 6309 if dlg.exec() == QDialog.DialogCode.Accepted:
5257 self.bookmarked = dlg.getBookmarkedFiles() 6310 self.bookmarked = dlg.getBookmarkedFiles()
5258 6311
5259 def __clearBookmarked(self): 6312 def __clearBookmarked(self):
5260 """ 6313 """
5261 Private method to clear the bookmarked files menu. 6314 Private method to clear the bookmarked files menu.
5262 """ 6315 """
5263 self.bookmarked = [] 6316 self.bookmarked = []
5264 6317
5265 def projectOpened(self): 6318 def projectOpened(self):
5266 """ 6319 """
5267 Public slot to handle the projectOpened signal. 6320 Public slot to handle the projectOpened signal.
5268 """ 6321 """
5269 for editor in self.editors: 6322 for editor in self.editors:
5270 editor.projectOpened() 6323 editor.projectOpened()
5271 6324
5272 self.__editProjectPwlAct.setEnabled(True) 6325 self.__editProjectPwlAct.setEnabled(True)
5273 self.__editProjectPelAct.setEnabled(True) 6326 self.__editProjectPelAct.setEnabled(True)
5274 6327
5275 def projectClosed(self): 6328 def projectClosed(self):
5276 """ 6329 """
5277 Public slot to handle the projectClosed signal. 6330 Public slot to handle the projectClosed signal.
5278 """ 6331 """
5279 for editor in self.editors: 6332 for editor in self.editors:
5280 editor.projectClosed() 6333 editor.projectClosed()
5281 6334
5282 self.__editProjectPwlAct.setEnabled(False) 6335 self.__editProjectPwlAct.setEnabled(False)
5283 self.__editProjectPelAct.setEnabled(False) 6336 self.__editProjectPelAct.setEnabled(False)
5284 6337
5285 def projectFileRenamed(self, oldfn, newfn): 6338 def projectFileRenamed(self, oldfn, newfn):
5286 """ 6339 """
5287 Public slot to handle the projectFileRenamed signal. 6340 Public slot to handle the projectFileRenamed signal.
5288 6341
5289 @param oldfn old filename of the file (string) 6342 @param oldfn old filename of the file (string)
5290 @param newfn new filename of the file (string) 6343 @param newfn new filename of the file (string)
5291 """ 6344 """
5292 editor = self.getOpenEditor(oldfn) 6345 editor = self.getOpenEditor(oldfn)
5293 if editor: 6346 if editor:
5294 editor.fileRenamed(newfn) 6347 editor.fileRenamed(newfn)
5295 6348
5296 def projectLexerAssociationsChanged(self): 6349 def projectLexerAssociationsChanged(self):
5297 """ 6350 """
5298 Public slot to handle changes of the project lexer associations. 6351 Public slot to handle changes of the project lexer associations.
5299 """ 6352 """
5300 for editor in self.editors: 6353 for editor in self.editors:
5301 editor.projectLexerAssociationsChanged() 6354 editor.projectLexerAssociationsChanged()
5302 6355
5303 def enableEditorsCheckFocusIn(self, enabled): 6356 def enableEditorsCheckFocusIn(self, enabled):
5304 """ 6357 """
5305 Public method to set a flag enabling the editors to perform focus in 6358 Public method to set a flag enabling the editors to perform focus in
5306 checks. 6359 checks.
5307 6360
5308 @param enabled flag indicating focus in checks should be performed 6361 @param enabled flag indicating focus in checks should be performed
5309 (boolean) 6362 (boolean)
5310 """ 6363 """
5311 self.editorsCheckFocusIn = enabled 6364 self.editorsCheckFocusIn = enabled
5312 6365
5313 def editorsCheckFocusInEnabled(self): 6366 def editorsCheckFocusInEnabled(self):
5314 """ 6367 """
5315 Public method returning the flag indicating editors should perform 6368 Public method returning the flag indicating editors should perform
5316 focus in checks. 6369 focus in checks.
5317 6370
5318 @return flag indicating focus in checks should be performed (boolean) 6371 @return flag indicating focus in checks should be performed (boolean)
5319 """ 6372 """
5320 return self.editorsCheckFocusIn 6373 return self.editorsCheckFocusIn
5321 6374
5322 def __findLocation(self): 6375 def __findLocation(self):
5323 """ 6376 """
5324 Private method to handle the Find File action. 6377 Private method to handle the Find File action.
5325 """ 6378 """
5326 self.ui.showFindLocationWidget() 6379 self.ui.showFindLocationWidget()
5327 6380
5328 def appFocusChanged(self, old, now): 6381 def appFocusChanged(self, old, now):
5329 """ 6382 """
5330 Public method to handle the global change of focus. 6383 Public method to handle the global change of focus.
5331 6384
5332 @param old reference to the widget loosing focus 6385 @param old reference to the widget loosing focus
5333 @type QWidget 6386 @type QWidget
5334 @param now reference to the widget gaining focus 6387 @param now reference to the widget gaining focus
5335 @type QWidget 6388 @type QWidget
5336 """ 6389 """
5337 # Focus handling was changed with Qt 5.13.1; this copes with that 6390 # Focus handling was changed with Qt 5.13.1; this copes with that
5338 if now is None: 6391 if now is None:
5339 return 6392 return
5340 6393
5341 from QScintilla.Shell import Shell 6394 from QScintilla.Shell import Shell
5342 6395
5343 if not isinstance(now, (Editor, Shell)): 6396 if not isinstance(now, (Editor, Shell)):
5344 self.editActGrp.setEnabled(False) 6397 self.editActGrp.setEnabled(False)
5345 self.copyActGrp.setEnabled(False) 6398 self.copyActGrp.setEnabled(False)
5346 self.viewActGrp.setEnabled(False) 6399 self.viewActGrp.setEnabled(False)
5347 self.sbZoom.setEnabled(False) 6400 self.sbZoom.setEnabled(False)
5348 else: 6401 else:
5349 self.sbZoom.setEnabled(True) 6402 self.sbZoom.setEnabled(True)
5350 self.sbZoom.setValue(now.getZoom()) 6403 self.sbZoom.setValue(now.getZoom())
5351 6404
5352 if not isinstance(now, (Editor, Shell)): 6405 if not isinstance(now, (Editor, Shell)):
5353 self.searchActGrp.setEnabled(False) 6406 self.searchActGrp.setEnabled(False)
5354 6407
5355 if not isinstance(now, (Editor, Shell)): 6408 if not isinstance(now, (Editor, Shell)):
5356 self.__lastFocusWidget = old 6409 self.__lastFocusWidget = old
5357 6410
5358 ################################################################## 6411 ##################################################################
5359 ## Below are the action methods for the edit menu 6412 ## Below are the action methods for the edit menu
5360 ################################################################## 6413 ##################################################################
5361 6414
5362 def __editUndo(self): 6415 def __editUndo(self):
5363 """ 6416 """
5364 Private method to handle the undo action. 6417 Private method to handle the undo action.
5365 """ 6418 """
5366 self.activeWindow().undo() 6419 self.activeWindow().undo()
5367 6420
5368 def __editRedo(self): 6421 def __editRedo(self):
5369 """ 6422 """
5370 Private method to handle the redo action. 6423 Private method to handle the redo action.
5371 """ 6424 """
5372 self.activeWindow().redo() 6425 self.activeWindow().redo()
5373 6426
5374 def __editRevert(self): 6427 def __editRevert(self):
5375 """ 6428 """
5376 Private method to handle the revert action. 6429 Private method to handle the revert action.
5377 """ 6430 """
5378 self.activeWindow().revertToUnmodified() 6431 self.activeWindow().revertToUnmodified()
5379 6432
5380 def __editCut(self): 6433 def __editCut(self):
5381 """ 6434 """
5382 Private method to handle the cut action. 6435 Private method to handle the cut action.
5383 """ 6436 """
5384 if QApplication.focusWidget() == ericApp().getObject("Shell"): 6437 if QApplication.focusWidget() == ericApp().getObject("Shell"):
5385 ericApp().getObject("Shell").cut() 6438 ericApp().getObject("Shell").cut()
5386 else: 6439 else:
5387 self.activeWindow().cut() 6440 self.activeWindow().cut()
5388 6441
5389 def __editCopy(self): 6442 def __editCopy(self):
5390 """ 6443 """
5391 Private method to handle the copy action. 6444 Private method to handle the copy action.
5392 """ 6445 """
5393 if QApplication.focusWidget() == ericApp().getObject("Shell"): 6446 if QApplication.focusWidget() == ericApp().getObject("Shell"):
5394 ericApp().getObject("Shell").copy() 6447 ericApp().getObject("Shell").copy()
5395 else: 6448 else:
5396 self.activeWindow().copy() 6449 self.activeWindow().copy()
5397 6450
5398 def __editPaste(self): 6451 def __editPaste(self):
5399 """ 6452 """
5400 Private method to handle the paste action. 6453 Private method to handle the paste action.
5401 """ 6454 """
5402 if QApplication.focusWidget() == ericApp().getObject("Shell"): 6455 if QApplication.focusWidget() == ericApp().getObject("Shell"):
5403 ericApp().getObject("Shell").paste() 6456 ericApp().getObject("Shell").paste()
5404 else: 6457 else:
5405 self.activeWindow().paste() 6458 self.activeWindow().paste()
5406 6459
5407 def __editDelete(self): 6460 def __editDelete(self):
5408 """ 6461 """
5409 Private method to handle the delete action. 6462 Private method to handle the delete action.
5410 """ 6463 """
5411 if QApplication.focusWidget() == ericApp().getObject("Shell"): 6464 if QApplication.focusWidget() == ericApp().getObject("Shell"):
5412 ericApp().getObject("Shell").clear() 6465 ericApp().getObject("Shell").clear()
5413 else: 6466 else:
5414 self.activeWindow().clear() 6467 self.activeWindow().clear()
5415 6468
5416 def __editJoin(self): 6469 def __editJoin(self):
5417 """ 6470 """
5418 Private method to handle the join action. 6471 Private method to handle the join action.
5419 """ 6472 """
5420 self.activeWindow().joinLines() 6473 self.activeWindow().joinLines()
5421 6474
5422 def __editIndent(self): 6475 def __editIndent(self):
5423 """ 6476 """
5424 Private method to handle the indent action. 6477 Private method to handle the indent action.
5425 """ 6478 """
5426 self.activeWindow().indentLineOrSelection() 6479 self.activeWindow().indentLineOrSelection()
5427 6480
5428 def __editUnindent(self): 6481 def __editUnindent(self):
5429 """ 6482 """
5430 Private method to handle the unindent action. 6483 Private method to handle the unindent action.
5431 """ 6484 """
5432 self.activeWindow().unindentLineOrSelection() 6485 self.activeWindow().unindentLineOrSelection()
5433 6486
5434 def __editSmartIndent(self): 6487 def __editSmartIndent(self):
5435 """ 6488 """
5436 Private method to handle the smart indent action. 6489 Private method to handle the smart indent action.
5437 """ 6490 """
5438 self.activeWindow().smartIndentLineOrSelection() 6491 self.activeWindow().smartIndentLineOrSelection()
5439 6492
5440 def __editToggleComment(self): 6493 def __editToggleComment(self):
5441 """ 6494 """
5442 Private method to handle the toggle comment action. 6495 Private method to handle the toggle comment action.
5443 """ 6496 """
5444 self.activeWindow().toggleCommentBlock() 6497 self.activeWindow().toggleCommentBlock()
5445 6498
5446 def __editComment(self): 6499 def __editComment(self):
5447 """ 6500 """
5448 Private method to handle the comment action. 6501 Private method to handle the comment action.
5449 """ 6502 """
5450 self.activeWindow().commentLineOrSelection() 6503 self.activeWindow().commentLineOrSelection()
5451 6504
5452 def __editUncomment(self): 6505 def __editUncomment(self):
5453 """ 6506 """
5454 Private method to handle the uncomment action. 6507 Private method to handle the uncomment action.
5455 """ 6508 """
5456 self.activeWindow().uncommentLineOrSelection() 6509 self.activeWindow().uncommentLineOrSelection()
5457 6510
5458 def __editStreamComment(self): 6511 def __editStreamComment(self):
5459 """ 6512 """
5460 Private method to handle the stream comment action. 6513 Private method to handle the stream comment action.
5461 """ 6514 """
5462 self.activeWindow().streamCommentLineOrSelection() 6515 self.activeWindow().streamCommentLineOrSelection()
5463 6516
5464 def __editBoxComment(self): 6517 def __editBoxComment(self):
5465 """ 6518 """
5466 Private method to handle the box comment action. 6519 Private method to handle the box comment action.
5467 """ 6520 """
5468 self.activeWindow().boxCommentLineOrSelection() 6521 self.activeWindow().boxCommentLineOrSelection()
5469 6522
5470 def __editSelectBrace(self): 6523 def __editSelectBrace(self):
5471 """ 6524 """
5472 Private method to handle the select to brace action. 6525 Private method to handle the select to brace action.
5473 """ 6526 """
5474 self.activeWindow().selectToMatchingBrace() 6527 self.activeWindow().selectToMatchingBrace()
5475 6528
5476 def __editSelectAll(self): 6529 def __editSelectAll(self):
5477 """ 6530 """
5478 Private method to handle the select all action. 6531 Private method to handle the select all action.
5479 """ 6532 """
5480 self.activeWindow().selectAll(True) 6533 self.activeWindow().selectAll(True)
5481 6534
5482 def __editDeselectAll(self): 6535 def __editDeselectAll(self):
5483 """ 6536 """
5484 Private method to handle the select all action. 6537 Private method to handle the select all action.
5485 """ 6538 """
5486 self.activeWindow().selectAll(False) 6539 self.activeWindow().selectAll(False)
5487 6540
5488 def __convertEOL(self): 6541 def __convertEOL(self):
5489 """ 6542 """
5490 Private method to handle the convert line end characters action. 6543 Private method to handle the convert line end characters action.
5491 """ 6544 """
5492 aw = self.activeWindow() 6545 aw = self.activeWindow()
5493 aw.convertEols(aw.eolMode()) 6546 aw.convertEols(aw.eolMode())
5494 6547
5495 def __shortenEmptyLines(self): 6548 def __shortenEmptyLines(self):
5496 """ 6549 """
5497 Private method to handle the shorten empty lines action. 6550 Private method to handle the shorten empty lines action.
5498 """ 6551 """
5499 self.activeWindow().shortenEmptyLines() 6552 self.activeWindow().shortenEmptyLines()
5500 6553
5501 def __editAutoComplete(self): 6554 def __editAutoComplete(self):
5502 """ 6555 """
5503 Private method to handle the autocomplete action. 6556 Private method to handle the autocomplete action.
5504 """ 6557 """
5505 self.activeWindow().autoComplete() 6558 self.activeWindow().autoComplete()
5506 6559
5507 def __editAutoCompleteFromDoc(self): 6560 def __editAutoCompleteFromDoc(self):
5508 """ 6561 """
5509 Private method to handle the autocomplete from document action. 6562 Private method to handle the autocomplete from document action.
5510 """ 6563 """
5511 self.activeWindow().autoCompleteFromDocument() 6564 self.activeWindow().autoCompleteFromDocument()
5512 6565
5513 def __editAutoCompleteFromAPIs(self): 6566 def __editAutoCompleteFromAPIs(self):
5514 """ 6567 """
5515 Private method to handle the autocomplete from APIs action. 6568 Private method to handle the autocomplete from APIs action.
5516 """ 6569 """
5517 self.activeWindow().autoCompleteFromAPIs() 6570 self.activeWindow().autoCompleteFromAPIs()
5518 6571
5519 def __editAutoCompleteFromAll(self): 6572 def __editAutoCompleteFromAll(self):
5520 """ 6573 """
5521 Private method to handle the autocomplete from All action. 6574 Private method to handle the autocomplete from All action.
5522 """ 6575 """
5523 self.activeWindow().autoCompleteFromAll() 6576 self.activeWindow().autoCompleteFromAll()
5524 6577
5525 def __editorAutoCompletionAPIsAvailable(self, available, editor): 6578 def __editorAutoCompletionAPIsAvailable(self, available, editor):
5526 """ 6579 """
5527 Private method to handle the availability of API autocompletion signal. 6580 Private method to handle the availability of API autocompletion signal.
5528 6581
5529 @param available flag indicating the availability of API 6582 @param available flag indicating the availability of API
5530 autocompletion 6583 autocompletion
5531 @type bool 6584 @type bool
5532 @param editor reference to the editor 6585 @param editor reference to the editor
5533 @type Editor 6586 @type Editor
5534 """ 6587 """
5535 self.autoCompleteAct.setEnabled( 6588 self.autoCompleteAct.setEnabled(editor.canProvideDynamicAutoCompletion())
5536 editor.canProvideDynamicAutoCompletion())
5537 self.autoCompleteFromAPIsAct.setEnabled(available) 6589 self.autoCompleteFromAPIsAct.setEnabled(available)
5538 self.autoCompleteFromAllAct.setEnabled(available) 6590 self.autoCompleteFromAllAct.setEnabled(available)
5539 self.calltipsAct.setEnabled(editor.canProvideCallTipps()) 6591 self.calltipsAct.setEnabled(editor.canProvideCallTipps())
5540 6592
5541 def __editShowCallTips(self): 6593 def __editShowCallTips(self):
5542 """ 6594 """
5543 Private method to handle the calltips action. 6595 Private method to handle the calltips action.
5544 """ 6596 """
5545 self.activeWindow().callTip() 6597 self.activeWindow().callTip()
5546 6598
5547 def __editShowCodeInfo(self): 6599 def __editShowCodeInfo(self):
5548 """ 6600 """
5549 Private method to handle the code info action. 6601 Private method to handle the code info action.
5550 """ 6602 """
5551 self.showEditorInfo(self.activeWindow()) 6603 self.showEditorInfo(self.activeWindow())
5552 6604
5553 ################################################################## 6605 ##################################################################
5554 ## Below are the action and utility methods for the search menu 6606 ## Below are the action and utility methods for the search menu
5555 ################################################################## 6607 ##################################################################
5556 6608
5557 def textForFind(self, getCurrentWord=True): 6609 def textForFind(self, getCurrentWord=True):
5558 """ 6610 """
5559 Public method to determine the selection or the current word for the 6611 Public method to determine the selection or the current word for the
5560 next find operation. 6612 next find operation.
5561 6613
5562 @param getCurrentWord flag indicating to return the current word, if 6614 @param getCurrentWord flag indicating to return the current word, if
5563 no selected text was found (boolean) 6615 no selected text was found (boolean)
5564 @return selection or current word (string) 6616 @return selection or current word (string)
5565 """ 6617 """
5566 aw = self.activeWindow() 6618 aw = self.activeWindow()
5567 if aw is None: 6619 if aw is None:
5568 return "" 6620 return ""
5569 6621
5570 return aw.getSearchText(not getCurrentWord) 6622 return aw.getSearchText(not getCurrentWord)
5571 6623
5572 def getSRHistory(self, key): 6624 def getSRHistory(self, key):
5573 """ 6625 """
5574 Public method to get the search or replace history list. 6626 Public method to get the search or replace history list.
5575 6627
5576 @param key list to return (must be 'search' or 'replace') 6628 @param key list to return (must be 'search' or 'replace')
5577 @return the requested history list (list of strings) 6629 @return the requested history list (list of strings)
5578 """ 6630 """
5579 return self.srHistory[key] 6631 return self.srHistory[key]
5580 6632
5581 def showSearchWidget(self): 6633 def showSearchWidget(self):
5582 """ 6634 """
5583 Public method to show the search widget. 6635 Public method to show the search widget.
5584 """ 6636 """
5585 self.__replaceWidget.hide() 6637 self.__replaceWidget.hide()
5586 self.__searchWidget.show() 6638 self.__searchWidget.show()
5587 self.__searchWidget.show(self.textForFind()) 6639 self.__searchWidget.show(self.textForFind())
5588 6640
5589 def __searchNext(self): 6641 def __searchNext(self):
5590 """ 6642 """
5591 Private slot to handle the search next action. 6643 Private slot to handle the search next action.
5592 """ 6644 """
5593 if self.__replaceWidget.isVisible(): 6645 if self.__replaceWidget.isVisible():
5594 self.__replaceWidget.findNext() 6646 self.__replaceWidget.findNext()
5595 else: 6647 else:
5596 self.__searchWidget.findNext() 6648 self.__searchWidget.findNext()
5597 6649
5598 def __searchPrev(self): 6650 def __searchPrev(self):
5599 """ 6651 """
5600 Private slot to handle the search previous action. 6652 Private slot to handle the search previous action.
5601 """ 6653 """
5602 if self.__replaceWidget.isVisible(): 6654 if self.__replaceWidget.isVisible():
5603 self.__replaceWidget.findPrev() 6655 self.__replaceWidget.findPrev()
5604 else: 6656 else:
5605 self.__searchWidget.findPrev() 6657 self.__searchWidget.findPrev()
5606 6658
5607 def showReplaceWidget(self): 6659 def showReplaceWidget(self):
5608 """ 6660 """
5609 Public method to show the replace widget. 6661 Public method to show the replace widget.
5610 """ 6662 """
5611 self.__searchWidget.hide() 6663 self.__searchWidget.hide()
5612 self.__replaceWidget.show(self.textForFind()) 6664 self.__replaceWidget.show(self.textForFind())
5613 6665
5614 def __findNextWord(self): 6666 def __findNextWord(self):
5615 """ 6667 """
5616 Private slot to find the next occurrence of the current word of the 6668 Private slot to find the next occurrence of the current word of the
5617 current editor. 6669 current editor.
5618 """ 6670 """
5619 self.activeWindow().searchCurrentWordForward() 6671 self.activeWindow().searchCurrentWordForward()
5620 6672
5621 def __findPrevWord(self): 6673 def __findPrevWord(self):
5622 """ 6674 """
5623 Private slot to find the previous occurrence of the current word of 6675 Private slot to find the previous occurrence of the current word of
5624 the current editor. 6676 the current editor.
5625 """ 6677 """
5626 self.activeWindow().searchCurrentWordBackward() 6678 self.activeWindow().searchCurrentWordBackward()
5627 6679
5628 def __searchClearMarkers(self): 6680 def __searchClearMarkers(self):
5629 """ 6681 """
5630 Private method to clear the search markers of the active window. 6682 Private method to clear the search markers of the active window.
5631 """ 6683 """
5632 self.activeWindow().clearSearchIndicators() 6684 self.activeWindow().clearSearchIndicators()
5633 6685
5634 def __goto(self): 6686 def __goto(self):
5635 """ 6687 """
5636 Private method to handle the goto action. 6688 Private method to handle the goto action.
5637 """ 6689 """
5638 from QScintilla.GotoDialog import GotoDialog 6690 from QScintilla.GotoDialog import GotoDialog
5639 6691
5640 aw = self.activeWindow() 6692 aw = self.activeWindow()
5641 lines = aw.lines() 6693 lines = aw.lines()
5642 curLine = aw.getCursorPosition()[0] + 1 6694 curLine = aw.getCursorPosition()[0] + 1
5643 dlg = GotoDialog(lines, curLine, self.ui, None, True) 6695 dlg = GotoDialog(lines, curLine, self.ui, None, True)
5644 if dlg.exec() == QDialog.DialogCode.Accepted: 6696 if dlg.exec() == QDialog.DialogCode.Accepted:
5645 aw.gotoLine(dlg.getLinenumber(), expand=True) 6697 aw.gotoLine(dlg.getLinenumber(), expand=True)
5646 6698
5647 def __gotoBrace(self): 6699 def __gotoBrace(self):
5648 """ 6700 """
5649 Private method to handle the goto brace action. 6701 Private method to handle the goto brace action.
5650 """ 6702 """
5651 self.activeWindow().moveToMatchingBrace() 6703 self.activeWindow().moveToMatchingBrace()
5652 6704
5653 def __gotoLastEditPosition(self): 6705 def __gotoLastEditPosition(self):
5654 """ 6706 """
5655 Private method to move the cursor to the last edit position. 6707 Private method to move the cursor to the last edit position.
5656 """ 6708 """
5657 self.activeWindow().gotoLastEditPosition() 6709 self.activeWindow().gotoLastEditPosition()
5658 6710
5659 def __lastEditPositionAvailable(self): 6711 def __lastEditPositionAvailable(self):
5660 """ 6712 """
5661 Private slot to handle the lastEditPositionAvailable signal of an 6713 Private slot to handle the lastEditPositionAvailable signal of an
5662 editor. 6714 editor.
5663 """ 6715 """
5664 self.gotoLastEditAct.setEnabled(True) 6716 self.gotoLastEditAct.setEnabled(True)
5665 6717
5666 def __gotoNextMethodClass(self): 6718 def __gotoNextMethodClass(self):
5667 """ 6719 """
5668 Private slot to go to the next Python/Ruby method or class definition. 6720 Private slot to go to the next Python/Ruby method or class definition.
5669 """ 6721 """
5670 self.activeWindow().gotoMethodClass(False) 6722 self.activeWindow().gotoMethodClass(False)
5671 6723
5672 def __gotoPreviousMethodClass(self): 6724 def __gotoPreviousMethodClass(self):
5673 """ 6725 """
5674 Private slot to go to the previous Python/Ruby method or class 6726 Private slot to go to the previous Python/Ruby method or class
5675 definition. 6727 definition.
5676 """ 6728 """
5677 self.activeWindow().gotoMethodClass(True) 6729 self.activeWindow().gotoMethodClass(True)
5678 6730
5679 def __searchFiles(self): 6731 def __searchFiles(self):
5680 """ 6732 """
5681 Private method to handle the search in files action. 6733 Private method to handle the search in files action.
5682 """ 6734 """
5683 self.ui.showFindFilesWidget(self.textForFind()) 6735 self.ui.showFindFilesWidget(self.textForFind())
5684 6736
5685 def __replaceFiles(self): 6737 def __replaceFiles(self):
5686 """ 6738 """
5687 Private method to handle the replace in files action. 6739 Private method to handle the replace in files action.
5688 """ 6740 """
5689 self.ui.showReplaceFilesWidget(self.textForFind()) 6741 self.ui.showReplaceFilesWidget(self.textForFind())
5690 6742
5691 def __searchOpenFiles(self): 6743 def __searchOpenFiles(self):
5692 """ 6744 """
5693 Private method to handle the search in open files action. 6745 Private method to handle the search in open files action.
5694 """ 6746 """
5695 self.ui.showFindFilesWidget(self.textForFind(), openFiles=True) 6747 self.ui.showFindFilesWidget(self.textForFind(), openFiles=True)
5696 6748
5697 def __replaceOpenFiles(self): 6749 def __replaceOpenFiles(self):
5698 """ 6750 """
5699 Private method to handle the replace in open files action. 6751 Private method to handle the replace in open files action.
5700 """ 6752 """
5701 self.ui.showReplaceFilesWidget(self.textForFind(), openFiles=True) 6753 self.ui.showReplaceFilesWidget(self.textForFind(), openFiles=True)
5702 6754
5703 ################################################################## 6755 ##################################################################
5704 ## Below are the action methods for the view menu 6756 ## Below are the action methods for the view menu
5705 ################################################################## 6757 ##################################################################
5706 6758
5707 def __zoomIn(self): 6759 def __zoomIn(self):
5708 """ 6760 """
5709 Private method to handle the zoom in action. 6761 Private method to handle the zoom in action.
5710 """ 6762 """
5711 if QApplication.focusWidget() == ericApp().getObject("Shell"): 6763 if QApplication.focusWidget() == ericApp().getObject("Shell"):
5713 else: 6765 else:
5714 aw = self.activeWindow() 6766 aw = self.activeWindow()
5715 if aw: 6767 if aw:
5716 aw.zoomIn() 6768 aw.zoomIn()
5717 self.sbZoom.setValue(aw.getZoom()) 6769 self.sbZoom.setValue(aw.getZoom())
5718 6770
5719 def __zoomOut(self): 6771 def __zoomOut(self):
5720 """ 6772 """
5721 Private method to handle the zoom out action. 6773 Private method to handle the zoom out action.
5722 """ 6774 """
5723 if QApplication.focusWidget() == ericApp().getObject("Shell"): 6775 if QApplication.focusWidget() == ericApp().getObject("Shell"):
5725 else: 6777 else:
5726 aw = self.activeWindow() 6778 aw = self.activeWindow()
5727 if aw: 6779 if aw:
5728 aw.zoomOut() 6780 aw.zoomOut()
5729 self.sbZoom.setValue(aw.getZoom()) 6781 self.sbZoom.setValue(aw.getZoom())
5730 6782
5731 def __zoomReset(self): 6783 def __zoomReset(self):
5732 """ 6784 """
5733 Private method to reset the zoom factor. 6785 Private method to reset the zoom factor.
5734 """ 6786 """
5735 self.__zoomTo(0) 6787 self.__zoomTo(0)
5736 6788
5737 def __zoom(self): 6789 def __zoom(self):
5738 """ 6790 """
5739 Private method to handle the zoom action. 6791 Private method to handle the zoom action.
5740 """ 6792 """
5741 aw = ( 6793 aw = (
5742 ericApp().getObject("Shell") 6794 ericApp().getObject("Shell")
5743 if QApplication.focusWidget() == ericApp().getObject("Shell") else 6795 if QApplication.focusWidget() == ericApp().getObject("Shell")
5744 self.activeWindow() 6796 else self.activeWindow()
5745 ) 6797 )
5746 if aw: 6798 if aw:
5747 from QScintilla.ZoomDialog import ZoomDialog 6799 from QScintilla.ZoomDialog import ZoomDialog
6800
5748 dlg = ZoomDialog(aw.getZoom(), self.ui, None, True) 6801 dlg = ZoomDialog(aw.getZoom(), self.ui, None, True)
5749 if dlg.exec() == QDialog.DialogCode.Accepted: 6802 if dlg.exec() == QDialog.DialogCode.Accepted:
5750 value = dlg.getZoomSize() 6803 value = dlg.getZoomSize()
5751 self.__zoomTo(value) 6804 self.__zoomTo(value)
5752 6805
5753 def __zoomTo(self, value): 6806 def __zoomTo(self, value):
5754 """ 6807 """
5755 Private slot to zoom to a given value. 6808 Private slot to zoom to a given value.
5756 6809
5757 @param value zoom value to be set (integer) 6810 @param value zoom value to be set (integer)
5758 """ 6811 """
5759 aw = ( 6812 aw = (
5760 ericApp().getObject("Shell") 6813 ericApp().getObject("Shell")
5761 if QApplication.focusWidget() == ericApp().getObject("Shell") else 6814 if QApplication.focusWidget() == ericApp().getObject("Shell")
5762 self.activeWindow() 6815 else self.activeWindow()
5763 ) 6816 )
5764 if aw: 6817 if aw:
5765 aw.zoomTo(value) 6818 aw.zoomTo(value)
5766 self.sbZoom.setValue(aw.getZoom()) 6819 self.sbZoom.setValue(aw.getZoom())
5767 6820
5768 def zoomValueChanged(self, value, zoomingWidget): 6821 def zoomValueChanged(self, value, zoomingWidget):
5769 """ 6822 """
5770 Public slot to handle changes of the zoom value. 6823 Public slot to handle changes of the zoom value.
5771 6824
5772 @param value new zoom value 6825 @param value new zoom value
5773 @type int 6826 @type int
5774 @param zoomingWidget reference to the widget triggering the slot 6827 @param zoomingWidget reference to the widget triggering the slot
5775 @type Editor or Shell 6828 @type Editor or Shell
5776 """ 6829 """
5777 aw = ( 6830 aw = (
5778 ericApp().getObject("Shell") 6831 ericApp().getObject("Shell")
5779 if QApplication.focusWidget() == ericApp().getObject("Shell") else 6832 if QApplication.focusWidget() == ericApp().getObject("Shell")
5780 self.activeWindow() 6833 else self.activeWindow()
5781 ) 6834 )
5782 if aw and aw == zoomingWidget: 6835 if aw and aw == zoomingWidget:
5783 self.sbZoom.setValue(value) 6836 self.sbZoom.setValue(value)
5784 6837
5785 def __clearAllFolds(self): 6838 def __clearAllFolds(self):
5786 """ 6839 """
5787 Private method to handle the clear all folds action. 6840 Private method to handle the clear all folds action.
5788 """ 6841 """
5789 aw = self.activeWindow() 6842 aw = self.activeWindow()
5790 if aw: 6843 if aw:
5791 aw.clearFolds() 6844 aw.clearFolds()
5792 6845
5793 def __toggleAll(self): 6846 def __toggleAll(self):
5794 """ 6847 """
5795 Private method to handle the toggle all folds action. 6848 Private method to handle the toggle all folds action.
5796 """ 6849 """
5797 aw = self.activeWindow() 6850 aw = self.activeWindow()
5798 if aw: 6851 if aw:
5799 aw.foldAll() 6852 aw.foldAll()
5800 6853
5801 def __toggleAllChildren(self): 6854 def __toggleAllChildren(self):
5802 """ 6855 """
5803 Private method to handle the toggle all folds (including children) 6856 Private method to handle the toggle all folds (including children)
5804 action. 6857 action.
5805 """ 6858 """
5806 aw = self.activeWindow() 6859 aw = self.activeWindow()
5807 if aw: 6860 if aw:
5808 aw.foldAll(True) 6861 aw.foldAll(True)
5809 6862
5810 def __toggleCurrent(self): 6863 def __toggleCurrent(self):
5811 """ 6864 """
5812 Private method to handle the toggle current fold action. 6865 Private method to handle the toggle current fold action.
5813 """ 6866 """
5814 aw = self.activeWindow() 6867 aw = self.activeWindow()
5815 if aw: 6868 if aw:
5816 aw.toggleCurrentFold() 6869 aw.toggleCurrentFold()
5817 6870
5818 def __newDocumentView(self): 6871 def __newDocumentView(self):
5819 """ 6872 """
5820 Private method to open a new view of the current editor. 6873 Private method to open a new view of the current editor.
5821 """ 6874 """
5822 aw = self.activeWindow() 6875 aw = self.activeWindow()
5823 if aw: 6876 if aw:
5824 self.newEditorView(aw.getFileName(), aw, aw.getFileType()) 6877 self.newEditorView(aw.getFileName(), aw, aw.getFileType())
5825 6878
5826 def __newDocumentSplitView(self): 6879 def __newDocumentSplitView(self):
5827 """ 6880 """
5828 Private method to open a new view of the current editor in a new split. 6881 Private method to open a new view of the current editor in a new split.
5829 """ 6882 """
5830 aw = self.activeWindow() 6883 aw = self.activeWindow()
5831 if aw: 6884 if aw:
5832 self.addSplit() 6885 self.addSplit()
5833 self.newEditorView(aw.getFileName(), aw, aw.getFileType()) 6886 self.newEditorView(aw.getFileName(), aw, aw.getFileType())
5834 6887
5835 def __splitView(self): 6888 def __splitView(self):
5836 """ 6889 """
5837 Private method to handle the split view action. 6890 Private method to handle the split view action.
5838 """ 6891 """
5839 self.addSplit() 6892 self.addSplit()
5840 6893
5841 def __splitOrientation(self, checked): 6894 def __splitOrientation(self, checked):
5842 """ 6895 """
5843 Private method to handle the split orientation action. 6896 Private method to handle the split orientation action.
5844 6897
5845 @param checked flag indicating the checked state of the action 6898 @param checked flag indicating the checked state of the action
5846 (boolean). True means splitting horizontally. 6899 (boolean). True means splitting horizontally.
5847 """ 6900 """
5848 if checked: 6901 if checked:
5849 self.setSplitOrientation(Qt.Orientation.Horizontal) 6902 self.setSplitOrientation(Qt.Orientation.Horizontal)
5850 self.splitViewAct.setIcon( 6903 self.splitViewAct.setIcon(UI.PixmapCache.getIcon("splitHorizontal"))
5851 UI.PixmapCache.getIcon("splitHorizontal")) 6904 self.splitRemoveAct.setIcon(UI.PixmapCache.getIcon("remsplitHorizontal"))
5852 self.splitRemoveAct.setIcon(
5853 UI.PixmapCache.getIcon("remsplitHorizontal"))
5854 self.newDocumentSplitViewAct.setIcon( 6905 self.newDocumentSplitViewAct.setIcon(
5855 UI.PixmapCache.getIcon("splitHorizontal")) 6906 UI.PixmapCache.getIcon("splitHorizontal")
6907 )
5856 else: 6908 else:
5857 self.setSplitOrientation(Qt.Orientation.Vertical) 6909 self.setSplitOrientation(Qt.Orientation.Vertical)
5858 self.splitViewAct.setIcon( 6910 self.splitViewAct.setIcon(UI.PixmapCache.getIcon("splitVertical"))
5859 UI.PixmapCache.getIcon("splitVertical")) 6911 self.splitRemoveAct.setIcon(UI.PixmapCache.getIcon("remsplitVertical"))
5860 self.splitRemoveAct.setIcon(
5861 UI.PixmapCache.getIcon("remsplitVertical"))
5862 self.newDocumentSplitViewAct.setIcon( 6912 self.newDocumentSplitViewAct.setIcon(
5863 UI.PixmapCache.getIcon("splitVertical")) 6913 UI.PixmapCache.getIcon("splitVertical")
6914 )
5864 Preferences.setUI("SplitOrientationVertical", checked) 6915 Preferences.setUI("SplitOrientationVertical", checked)
5865 6916
5866 def __previewEditor(self, checked): 6917 def __previewEditor(self, checked):
5867 """ 6918 """
5868 Private slot to handle a change of the preview selection state. 6919 Private slot to handle a change of the preview selection state.
5869 6920
5870 @param checked state of the action (boolean) 6921 @param checked state of the action (boolean)
5871 """ 6922 """
5872 Preferences.setUI("ShowFilePreview", checked) 6923 Preferences.setUI("ShowFilePreview", checked)
5873 self.previewStateChanged.emit(checked) 6924 self.previewStateChanged.emit(checked)
5874 6925
5875 def __astViewer(self, checked): 6926 def __astViewer(self, checked):
5876 """ 6927 """
5877 Private slot to handle a change of the AST Viewer selection state. 6928 Private slot to handle a change of the AST Viewer selection state.
5878 6929
5879 @param checked state of the action (boolean) 6930 @param checked state of the action (boolean)
5880 """ 6931 """
5881 self.astViewerStateChanged.emit(checked) 6932 self.astViewerStateChanged.emit(checked)
5882 6933
5883 def __disViewer(self, checked): 6934 def __disViewer(self, checked):
5884 """ 6935 """
5885 Private slot to handle a change of the DIS Viewer selection state. 6936 Private slot to handle a change of the DIS Viewer selection state.
5886 6937
5887 @param checked state of the action (boolean) 6938 @param checked state of the action (boolean)
5888 """ 6939 """
5889 self.disViewerStateChanged.emit(checked) 6940 self.disViewerStateChanged.emit(checked)
5890 6941
5891 ################################################################## 6942 ##################################################################
5892 ## Below are the action methods for the macro menu 6943 ## Below are the action methods for the macro menu
5893 ################################################################## 6944 ##################################################################
5894 6945
5895 def __macroStartRecording(self): 6946 def __macroStartRecording(self):
5896 """ 6947 """
5897 Private method to handle the start macro recording action. 6948 Private method to handle the start macro recording action.
5898 """ 6949 """
5899 self.activeWindow().macroRecordingStart() 6950 self.activeWindow().macroRecordingStart()
5900 6951
5901 def __macroStopRecording(self): 6952 def __macroStopRecording(self):
5902 """ 6953 """
5903 Private method to handle the stop macro recording action. 6954 Private method to handle the stop macro recording action.
5904 """ 6955 """
5905 self.activeWindow().macroRecordingStop() 6956 self.activeWindow().macroRecordingStop()
5906 6957
5907 def __macroRun(self): 6958 def __macroRun(self):
5908 """ 6959 """
5909 Private method to handle the run macro action. 6960 Private method to handle the run macro action.
5910 """ 6961 """
5911 self.activeWindow().macroRun() 6962 self.activeWindow().macroRun()
5912 6963
5913 def __macroDelete(self): 6964 def __macroDelete(self):
5914 """ 6965 """
5915 Private method to handle the delete macro action. 6966 Private method to handle the delete macro action.
5916 """ 6967 """
5917 self.activeWindow().macroDelete() 6968 self.activeWindow().macroDelete()
5918 6969
5919 def __macroLoad(self): 6970 def __macroLoad(self):
5920 """ 6971 """
5921 Private method to handle the load macro action. 6972 Private method to handle the load macro action.
5922 """ 6973 """
5923 self.activeWindow().macroLoad() 6974 self.activeWindow().macroLoad()
5924 6975
5925 def __macroSave(self): 6976 def __macroSave(self):
5926 """ 6977 """
5927 Private method to handle the save macro action. 6978 Private method to handle the save macro action.
5928 """ 6979 """
5929 self.activeWindow().macroSave() 6980 self.activeWindow().macroSave()
5930 6981
5931 ################################################################## 6982 ##################################################################
5932 ## Below are the action methods for the bookmarks menu 6983 ## Below are the action methods for the bookmarks menu
5933 ################################################################## 6984 ##################################################################
5934 6985
5935 def __toggleBookmark(self): 6986 def __toggleBookmark(self):
5936 """ 6987 """
5937 Private method to handle the toggle bookmark action. 6988 Private method to handle the toggle bookmark action.
5938 """ 6989 """
5939 self.activeWindow().menuToggleBookmark() 6990 self.activeWindow().menuToggleBookmark()
5940 6991
5941 def __nextBookmark(self): 6992 def __nextBookmark(self):
5942 """ 6993 """
5943 Private method to handle the next bookmark action. 6994 Private method to handle the next bookmark action.
5944 """ 6995 """
5945 self.activeWindow().nextBookmark() 6996 self.activeWindow().nextBookmark()
5946 6997
5947 def __previousBookmark(self): 6998 def __previousBookmark(self):
5948 """ 6999 """
5949 Private method to handle the previous bookmark action. 7000 Private method to handle the previous bookmark action.
5950 """ 7001 """
5951 self.activeWindow().previousBookmark() 7002 self.activeWindow().previousBookmark()
5952 7003
5953 def __clearAllBookmarks(self): 7004 def __clearAllBookmarks(self):
5954 """ 7005 """
5955 Private method to handle the clear all bookmarks action. 7006 Private method to handle the clear all bookmarks action.
5956 """ 7007 """
5957 for editor in self.editors: 7008 for editor in self.editors:
5958 editor.clearBookmarks() 7009 editor.clearBookmarks()
5959 7010
5960 self.bookmarkNextAct.setEnabled(False) 7011 self.bookmarkNextAct.setEnabled(False)
5961 self.bookmarkPreviousAct.setEnabled(False) 7012 self.bookmarkPreviousAct.setEnabled(False)
5962 self.bookmarkClearAct.setEnabled(False) 7013 self.bookmarkClearAct.setEnabled(False)
5963 7014
5964 def __showBookmarkMenu(self): 7015 def __showBookmarkMenu(self):
5965 """ 7016 """
5966 Private method to set up the bookmark menu. 7017 Private method to set up the bookmark menu.
5967 """ 7018 """
5968 bookmarksFound = 0 7019 bookmarksFound = 0
5972 bookmarksFound = len(editor.getBookmarks()) > 0 7023 bookmarksFound = len(editor.getBookmarks()) > 0
5973 if bookmarksFound: 7024 if bookmarksFound:
5974 self.menuBookmarksAct.setEnabled(True) 7025 self.menuBookmarksAct.setEnabled(True)
5975 return 7026 return
5976 self.menuBookmarksAct.setEnabled(False) 7027 self.menuBookmarksAct.setEnabled(False)
5977 7028
5978 def __showBookmarksMenu(self): 7029 def __showBookmarksMenu(self):
5979 """ 7030 """
5980 Private method to handle the show bookmarks menu signal. 7031 Private method to handle the show bookmarks menu signal.
5981 """ 7032 """
5982 self.bookmarksMenu.clear() 7033 self.bookmarksMenu.clear()
5983 7034
5984 filenames = self.getOpenFilenames() 7035 filenames = self.getOpenFilenames()
5985 for filename in sorted(filenames): 7036 for filename in sorted(filenames):
5986 editor = self.getOpenEditor(filename) 7037 editor = self.getOpenEditor(filename)
5987 for bookmark in editor.getBookmarks(): 7038 for bookmark in editor.getBookmarks():
5988 bmSuffix = " : {0:d}".format(bookmark) 7039 bmSuffix = " : {0:d}".format(bookmark)
5989 act = self.bookmarksMenu.addAction( 7040 act = self.bookmarksMenu.addAction(
5990 "{0}{1}".format( 7041 "{0}{1}".format(
5991 Utilities.compactPath( 7042 Utilities.compactPath(
5992 filename, 7043 filename, self.ui.maxMenuFilePathLen - len(bmSuffix)
5993 self.ui.maxMenuFilePathLen - len(bmSuffix)), 7044 ),
5994 bmSuffix)) 7045 bmSuffix,
7046 )
7047 )
5995 act.setData([filename, bookmark]) 7048 act.setData([filename, bookmark])
5996 7049
5997 def __bookmarkSelected(self, act): 7050 def __bookmarkSelected(self, act):
5998 """ 7051 """
5999 Private method to handle the bookmark selected signal. 7052 Private method to handle the bookmark selected signal.
6000 7053
6001 @param act reference to the action that triggered (QAction) 7054 @param act reference to the action that triggered (QAction)
6002 """ 7055 """
6003 bmList = act.data() 7056 bmList = act.data()
6004 filename = bmList[0] 7057 filename = bmList[0]
6005 line = bmList[1] 7058 line = bmList[1]
6006 self.openSourceFile(filename, line) 7059 self.openSourceFile(filename, line)
6007 7060
6008 def __bookmarkToggled(self, editor): 7061 def __bookmarkToggled(self, editor):
6009 """ 7062 """
6010 Private slot to handle the bookmarkToggled signal. 7063 Private slot to handle the bookmarkToggled signal.
6011 7064
6012 It checks some bookmark actions and reemits the signal. 7065 It checks some bookmark actions and reemits the signal.
6013 7066
6014 @param editor editor that sent the signal 7067 @param editor editor that sent the signal
6015 """ 7068 """
6016 if editor.hasBookmarks(): 7069 if editor.hasBookmarks():
6017 self.bookmarkNextAct.setEnabled(True) 7070 self.bookmarkNextAct.setEnabled(True)
6018 self.bookmarkPreviousAct.setEnabled(True) 7071 self.bookmarkPreviousAct.setEnabled(True)
6020 else: 7073 else:
6021 self.bookmarkNextAct.setEnabled(False) 7074 self.bookmarkNextAct.setEnabled(False)
6022 self.bookmarkPreviousAct.setEnabled(False) 7075 self.bookmarkPreviousAct.setEnabled(False)
6023 self.bookmarkClearAct.setEnabled(False) 7076 self.bookmarkClearAct.setEnabled(False)
6024 self.bookmarkToggled.emit(editor) 7077 self.bookmarkToggled.emit(editor)
6025 7078
6026 def __gotoSyntaxError(self): 7079 def __gotoSyntaxError(self):
6027 """ 7080 """
6028 Private method to handle the goto syntax error action. 7081 Private method to handle the goto syntax error action.
6029 """ 7082 """
6030 self.activeWindow().gotoSyntaxError() 7083 self.activeWindow().gotoSyntaxError()
6031 7084
6032 def __clearAllSyntaxErrors(self): 7085 def __clearAllSyntaxErrors(self):
6033 """ 7086 """
6034 Private method to handle the clear all syntax errors action. 7087 Private method to handle the clear all syntax errors action.
6035 """ 7088 """
6036 for editor in self.editors: 7089 for editor in self.editors:
6037 editor.clearSyntaxError() 7090 editor.clearSyntaxError()
6038 7091
6039 def _syntaxErrorToggled(self, editor): 7092 def _syntaxErrorToggled(self, editor):
6040 """ 7093 """
6041 Protected slot to handle the syntaxerrorToggled signal. 7094 Protected slot to handle the syntaxerrorToggled signal.
6042 7095
6043 It checks some syntax error actions and reemits the signal. 7096 It checks some syntax error actions and reemits the signal.
6044 7097
6045 @param editor editor that sent the signal 7098 @param editor editor that sent the signal
6046 """ 7099 """
6047 if editor.hasSyntaxErrors(): 7100 if editor.hasSyntaxErrors():
6048 self.syntaxErrorGotoAct.setEnabled(True) 7101 self.syntaxErrorGotoAct.setEnabled(True)
6049 self.syntaxErrorClearAct.setEnabled(True) 7102 self.syntaxErrorClearAct.setEnabled(True)
6057 else: 7110 else:
6058 self.warningsNextAct.setEnabled(False) 7111 self.warningsNextAct.setEnabled(False)
6059 self.warningsPreviousAct.setEnabled(False) 7112 self.warningsPreviousAct.setEnabled(False)
6060 self.warningsClearAct.setEnabled(False) 7113 self.warningsClearAct.setEnabled(False)
6061 self.syntaxerrorToggled.emit(editor) 7114 self.syntaxerrorToggled.emit(editor)
6062 7115
6063 def __nextWarning(self): 7116 def __nextWarning(self):
6064 """ 7117 """
6065 Private method to handle the next warning action. 7118 Private method to handle the next warning action.
6066 """ 7119 """
6067 self.activeWindow().nextWarning() 7120 self.activeWindow().nextWarning()
6068 7121
6069 def __previousWarning(self): 7122 def __previousWarning(self):
6070 """ 7123 """
6071 Private method to handle the previous warning action. 7124 Private method to handle the previous warning action.
6072 """ 7125 """
6073 self.activeWindow().previousWarning() 7126 self.activeWindow().previousWarning()
6074 7127
6075 def __clearAllWarnings(self): 7128 def __clearAllWarnings(self):
6076 """ 7129 """
6077 Private method to handle the clear all warnings action. 7130 Private method to handle the clear all warnings action.
6078 """ 7131 """
6079 for editor in self.editors: 7132 for editor in self.editors:
6080 editor.clearWarnings() 7133 editor.clearWarnings()
6081 7134
6082 def __nextUncovered(self): 7135 def __nextUncovered(self):
6083 """ 7136 """
6084 Private method to handle the next uncovered action. 7137 Private method to handle the next uncovered action.
6085 """ 7138 """
6086 self.activeWindow().nextUncovered() 7139 self.activeWindow().nextUncovered()
6087 7140
6088 def __previousUncovered(self): 7141 def __previousUncovered(self):
6089 """ 7142 """
6090 Private method to handle the previous uncovered action. 7143 Private method to handle the previous uncovered action.
6091 """ 7144 """
6092 self.activeWindow().previousUncovered() 7145 self.activeWindow().previousUncovered()
6093 7146
6094 def __coverageMarkersShown(self, shown): 7147 def __coverageMarkersShown(self, shown):
6095 """ 7148 """
6096 Private slot to handle the coverageMarkersShown signal. 7149 Private slot to handle the coverageMarkersShown signal.
6097 7150
6098 @param shown flag indicating whether the markers were shown or cleared 7151 @param shown flag indicating whether the markers were shown or cleared
6099 """ 7152 """
6100 if shown: 7153 if shown:
6101 self.notcoveredNextAct.setEnabled(True) 7154 self.notcoveredNextAct.setEnabled(True)
6102 self.notcoveredPreviousAct.setEnabled(True) 7155 self.notcoveredPreviousAct.setEnabled(True)
6103 else: 7156 else:
6104 self.notcoveredNextAct.setEnabled(False) 7157 self.notcoveredNextAct.setEnabled(False)
6105 self.notcoveredPreviousAct.setEnabled(False) 7158 self.notcoveredPreviousAct.setEnabled(False)
6106 7159
6107 def __taskMarkersUpdated(self, editor): 7160 def __taskMarkersUpdated(self, editor):
6108 """ 7161 """
6109 Private slot to handle the taskMarkersUpdated signal. 7162 Private slot to handle the taskMarkersUpdated signal.
6110 7163
6111 @param editor editor that sent the signal 7164 @param editor editor that sent the signal
6112 """ 7165 """
6113 if editor.hasTaskMarkers(): 7166 if editor.hasTaskMarkers():
6114 self.taskNextAct.setEnabled(True) 7167 self.taskNextAct.setEnabled(True)
6115 self.taskPreviousAct.setEnabled(True) 7168 self.taskPreviousAct.setEnabled(True)
6116 else: 7169 else:
6117 self.taskNextAct.setEnabled(False) 7170 self.taskNextAct.setEnabled(False)
6118 self.taskPreviousAct.setEnabled(False) 7171 self.taskPreviousAct.setEnabled(False)
6119 7172
6120 def __nextTask(self): 7173 def __nextTask(self):
6121 """ 7174 """
6122 Private method to handle the next task action. 7175 Private method to handle the next task action.
6123 """ 7176 """
6124 self.activeWindow().nextTask() 7177 self.activeWindow().nextTask()
6125 7178
6126 def __previousTask(self): 7179 def __previousTask(self):
6127 """ 7180 """
6128 Private method to handle the previous task action. 7181 Private method to handle the previous task action.
6129 """ 7182 """
6130 self.activeWindow().previousTask() 7183 self.activeWindow().previousTask()
6131 7184
6132 def __changeMarkersUpdated(self, editor): 7185 def __changeMarkersUpdated(self, editor):
6133 """ 7186 """
6134 Private slot to handle the changeMarkersUpdated signal. 7187 Private slot to handle the changeMarkersUpdated signal.
6135 7188
6136 @param editor editor that sent the signal 7189 @param editor editor that sent the signal
6137 """ 7190 """
6138 if editor.hasChangeMarkers(): 7191 if editor.hasChangeMarkers():
6139 self.changeNextAct.setEnabled(True) 7192 self.changeNextAct.setEnabled(True)
6140 self.changePreviousAct.setEnabled(True) 7193 self.changePreviousAct.setEnabled(True)
6141 else: 7194 else:
6142 self.changeNextAct.setEnabled(False) 7195 self.changeNextAct.setEnabled(False)
6143 self.changePreviousAct.setEnabled(False) 7196 self.changePreviousAct.setEnabled(False)
6144 7197
6145 def __nextChange(self): 7198 def __nextChange(self):
6146 """ 7199 """
6147 Private method to handle the next change action. 7200 Private method to handle the next change action.
6148 """ 7201 """
6149 self.activeWindow().nextChange() 7202 self.activeWindow().nextChange()
6150 7203
6151 def __previousChange(self): 7204 def __previousChange(self):
6152 """ 7205 """
6153 Private method to handle the previous change action. 7206 Private method to handle the previous change action.
6154 """ 7207 """
6155 self.activeWindow().previousChange() 7208 self.activeWindow().previousChange()
6156 7209
6157 ################################################################## 7210 ##################################################################
6158 ## Below are the action methods for the spell checking functions 7211 ## Below are the action methods for the spell checking functions
6159 ################################################################## 7212 ##################################################################
6160 7213
6161 def __showEditSpellingMenu(self): 7214 def __showEditSpellingMenu(self):
6162 """ 7215 """
6163 Private method to set up the edit dictionaries menu. 7216 Private method to set up the edit dictionaries menu.
6164 """ 7217 """
6165 proj = ericApp().getObject("Project") 7218 proj = ericApp().getObject("Project")
6166 projetOpen = proj.isOpen() 7219 projetOpen = proj.isOpen()
6167 pwl = ericApp().getObject("Project").getProjectDictionaries()[0] 7220 pwl = ericApp().getObject("Project").getProjectDictionaries()[0]
6168 self.__editProjectPwlAct.setEnabled(projetOpen and bool(pwl)) 7221 self.__editProjectPwlAct.setEnabled(projetOpen and bool(pwl))
6169 pel = ericApp().getObject("Project").getProjectDictionaries()[1] 7222 pel = ericApp().getObject("Project").getProjectDictionaries()[1]
6170 self.__editProjectPelAct.setEnabled(projetOpen and bool(pel)) 7223 self.__editProjectPelAct.setEnabled(projetOpen and bool(pel))
6171 7224
6172 from QScintilla.SpellChecker import SpellChecker 7225 from QScintilla.SpellChecker import SpellChecker
7226
6173 pwl = SpellChecker.getUserDictionaryPath() 7227 pwl = SpellChecker.getUserDictionaryPath()
6174 self.__editUserPwlAct.setEnabled(bool(pwl)) 7228 self.__editUserPwlAct.setEnabled(bool(pwl))
6175 pel = SpellChecker.getUserDictionaryPath(True) 7229 pel = SpellChecker.getUserDictionaryPath(True)
6176 self.__editUserPelAct.setEnabled(bool(pel)) 7230 self.__editUserPelAct.setEnabled(bool(pel))
6177 7231
6178 def __setAutoSpellChecking(self): 7232 def __setAutoSpellChecking(self):
6179 """ 7233 """
6180 Private slot to set the automatic spell checking of all editors. 7234 Private slot to set the automatic spell checking of all editors.
6181 """ 7235 """
6182 enabled = self.autoSpellCheckAct.isChecked() 7236 enabled = self.autoSpellCheckAct.isChecked()
6183 Preferences.setEditor("AutoSpellCheckingEnabled", enabled) 7237 Preferences.setEditor("AutoSpellCheckingEnabled", enabled)
6184 for editor in self.editors: 7238 for editor in self.editors:
6185 editor.setAutoSpellChecking() 7239 editor.setAutoSpellChecking()
6186 7240
6187 def __spellCheck(self): 7241 def __spellCheck(self):
6188 """ 7242 """
6189 Private slot to perform a spell check of the current editor. 7243 Private slot to perform a spell check of the current editor.
6190 """ 7244 """
6191 aw = self.activeWindow() 7245 aw = self.activeWindow()
6192 if aw: 7246 if aw:
6193 aw.checkSpelling() 7247 aw.checkSpelling()
6194 7248
6195 def __editProjectPWL(self): 7249 def __editProjectPWL(self):
6196 """ 7250 """
6197 Private slot to edit the project word list. 7251 Private slot to edit the project word list.
6198 """ 7252 """
6199 pwl = ericApp().getObject("Project").getProjectDictionaries()[0] 7253 pwl = ericApp().getObject("Project").getProjectDictionaries()[0]
6200 self.__editSpellingDictionary(pwl) 7254 self.__editSpellingDictionary(pwl)
6201 7255
6202 def __editProjectPEL(self): 7256 def __editProjectPEL(self):
6203 """ 7257 """
6204 Private slot to edit the project exception list. 7258 Private slot to edit the project exception list.
6205 """ 7259 """
6206 pel = ericApp().getObject("Project").getProjectDictionaries()[1] 7260 pel = ericApp().getObject("Project").getProjectDictionaries()[1]
6207 self.__editSpellingDictionary(pel) 7261 self.__editSpellingDictionary(pel)
6208 7262
6209 def __editUserPWL(self): 7263 def __editUserPWL(self):
6210 """ 7264 """
6211 Private slot to edit the user word list. 7265 Private slot to edit the user word list.
6212 """ 7266 """
6213 from QScintilla.SpellChecker import SpellChecker 7267 from QScintilla.SpellChecker import SpellChecker
7268
6214 pwl = SpellChecker.getUserDictionaryPath() 7269 pwl = SpellChecker.getUserDictionaryPath()
6215 self.__editSpellingDictionary(pwl) 7270 self.__editSpellingDictionary(pwl)
6216 7271
6217 def __editUserPEL(self): 7272 def __editUserPEL(self):
6218 """ 7273 """
6219 Private slot to edit the user exception list. 7274 Private slot to edit the user exception list.
6220 """ 7275 """
6221 from QScintilla.SpellChecker import SpellChecker 7276 from QScintilla.SpellChecker import SpellChecker
7277
6222 pel = SpellChecker.getUserDictionaryPath(True) 7278 pel = SpellChecker.getUserDictionaryPath(True)
6223 self.__editSpellingDictionary(pel) 7279 self.__editSpellingDictionary(pel)
6224 7280
6225 def __editSpellingDictionary(self, dictionaryFile): 7281 def __editSpellingDictionary(self, dictionaryFile):
6226 """ 7282 """
6227 Private slot to edit the given spelling dictionary. 7283 Private slot to edit the given spelling dictionary.
6228 7284
6229 @param dictionaryFile file name of the dictionary to edit (string) 7285 @param dictionaryFile file name of the dictionary to edit (string)
6230 """ 7286 """
6231 if os.path.exists(dictionaryFile): 7287 if os.path.exists(dictionaryFile):
6232 try: 7288 try:
6233 with open(dictionaryFile, "r", encoding="utf-8") as f: 7289 with open(dictionaryFile, "r", encoding="utf-8") as f:
6234 data = f.read() 7290 data = f.read()
6235 except OSError as err: 7291 except OSError as err:
6236 EricMessageBox.critical( 7292 EricMessageBox.critical(
6237 self.ui, 7293 self.ui,
6238 QCoreApplication.translate( 7294 QCoreApplication.translate(
6239 'ViewManager', "Edit Spelling Dictionary"), 7295 "ViewManager", "Edit Spelling Dictionary"
7296 ),
6240 QCoreApplication.translate( 7297 QCoreApplication.translate(
6241 'ViewManager', 7298 "ViewManager",
6242 """<p>The spelling dictionary file <b>{0}</b> could""" 7299 """<p>The spelling dictionary file <b>{0}</b> could"""
6243 """ not be read.</p><p>Reason: {1}</p>""").format( 7300 """ not be read.</p><p>Reason: {1}</p>""",
6244 dictionaryFile, str(err))) 7301 ).format(dictionaryFile, str(err)),
7302 )
6245 return 7303 return
6246 7304
6247 fileInfo = ( 7305 fileInfo = (
6248 dictionaryFile if len(dictionaryFile) < 40 7306 dictionaryFile
7307 if len(dictionaryFile) < 40
6249 else "...{0}".format(dictionaryFile[-40:]) 7308 else "...{0}".format(dictionaryFile[-40:])
6250 ) 7309 )
6251 from QScintilla.SpellingDictionaryEditDialog import ( 7310 from QScintilla.SpellingDictionaryEditDialog import (
6252 SpellingDictionaryEditDialog 7311 SpellingDictionaryEditDialog,
6253 ) 7312 )
7313
6254 dlg = SpellingDictionaryEditDialog( 7314 dlg = SpellingDictionaryEditDialog(
6255 data, 7315 data,
6256 QCoreApplication.translate('ViewManager', "Editing {0}") 7316 QCoreApplication.translate("ViewManager", "Editing {0}").format(
6257 .format(fileInfo), 7317 fileInfo
6258 self.ui) 7318 ),
7319 self.ui,
7320 )
6259 if dlg.exec() == QDialog.DialogCode.Accepted: 7321 if dlg.exec() == QDialog.DialogCode.Accepted:
6260 data = dlg.getData() 7322 data = dlg.getData()
6261 try: 7323 try:
6262 with open(dictionaryFile, "w", encoding="utf-8") as f: 7324 with open(dictionaryFile, "w", encoding="utf-8") as f:
6263 f.write(data) 7325 f.write(data)
6264 except OSError as err: 7326 except OSError as err:
6265 EricMessageBox.critical( 7327 EricMessageBox.critical(
6266 self.ui, 7328 self.ui,
6267 QCoreApplication.translate( 7329 QCoreApplication.translate(
6268 'ViewManager', "Edit Spelling Dictionary"), 7330 "ViewManager", "Edit Spelling Dictionary"
7331 ),
6269 QCoreApplication.translate( 7332 QCoreApplication.translate(
6270 'ViewManager', 7333 "ViewManager",
6271 """<p>The spelling dictionary file <b>{0}</b>""" 7334 """<p>The spelling dictionary file <b>{0}</b>"""
6272 """ could not be written.</p>""" 7335 """ could not be written.</p>"""
6273 """<p>Reason: {1}</p>""").format( 7336 """<p>Reason: {1}</p>""",
6274 dictionaryFile, str(err))) 7337 ).format(dictionaryFile, str(err)),
7338 )
6275 return 7339 return
6276 7340
6277 self.ui.showNotification( 7341 self.ui.showNotification(
6278 UI.PixmapCache.getPixmap("spellchecking48"), 7342 UI.PixmapCache.getPixmap("spellchecking48"),
6279 QCoreApplication.translate( 7343 QCoreApplication.translate(
6280 'ViewManager', "Edit Spelling Dictionary"), 7344 "ViewManager", "Edit Spelling Dictionary"
7345 ),
6281 QCoreApplication.translate( 7346 QCoreApplication.translate(
6282 'ViewManager', 7347 "ViewManager", "The spelling dictionary was saved successfully."
6283 "The spelling dictionary was saved successfully.")) 7348 ),
6284 7349 )
7350
6285 ################################################################## 7351 ##################################################################
6286 ## Below are general utility methods 7352 ## Below are general utility methods
6287 ################################################################## 7353 ##################################################################
6288 7354
6289 def handleResetUI(self): 7355 def handleResetUI(self):
6290 """ 7356 """
6291 Public slot to handle the resetUI signal. 7357 Public slot to handle the resetUI signal.
6292 """ 7358 """
6293 editor = self.activeWindow() 7359 editor = self.activeWindow()
6297 line, pos = editor.getCursorPosition() 7363 line, pos = editor.getCursorPosition()
6298 enc = editor.getEncoding() 7364 enc = editor.getEncoding()
6299 lang = editor.getLanguage() 7365 lang = editor.getLanguage()
6300 eol = editor.getEolIndicator() 7366 eol = editor.getEolIndicator()
6301 zoom = editor.getZoom() 7367 zoom = editor.getZoom()
6302 self.__setSbFile(editor.getFileName(), line + 1, pos, enc, lang, 7368 self.__setSbFile(editor.getFileName(), line + 1, pos, enc, lang, eol, zoom)
6303 eol, zoom) 7369
6304
6305 def closeViewManager(self): 7370 def closeViewManager(self):
6306 """ 7371 """
6307 Public method to shutdown the viewmanager. 7372 Public method to shutdown the viewmanager.
6308 7373
6309 If it cannot close all editor windows, it aborts the shutdown process. 7374 If it cannot close all editor windows, it aborts the shutdown process.
6310 7375
6311 @return flag indicating success (boolean) 7376 @return flag indicating success (boolean)
6312 """ 7377 """
6313 with contextlib.suppress(TypeError): 7378 with contextlib.suppress(TypeError):
6314 ericApp().focusChanged.disconnect(self.appFocusChanged) 7379 ericApp().focusChanged.disconnect(self.appFocusChanged)
6315 7380
6316 self.closeAllWindows() 7381 self.closeAllWindows()
6317 self.currentEditor = None 7382 self.currentEditor = None
6318 7383
6319 # save the list of recently opened projects 7384 # save the list of recently opened projects
6320 self.__saveRecent() 7385 self.__saveRecent()
6321 7386
6322 # save the list of recently opened projects 7387 # save the list of recently opened projects
6323 Preferences.getSettings().setValue( 7388 Preferences.getSettings().setValue("Bookmarked/Sources", self.bookmarked)
6324 'Bookmarked/Sources', self.bookmarked) 7389
6325
6326 res = len(self.editors) == 0 7390 res = len(self.editors) == 0
6327 7391
6328 if not res: 7392 if not res:
6329 ericApp().focusChanged.connect(self.appFocusChanged) 7393 ericApp().focusChanged.connect(self.appFocusChanged)
6330 7394
6331 return res 7395 return res
6332 7396
6333 def __lastEditorClosed(self): 7397 def __lastEditorClosed(self):
6334 """ 7398 """
6335 Private slot to handle the lastEditorClosed signal. 7399 Private slot to handle the lastEditorClosed signal.
6336 """ 7400 """
6337 self.closeActGrp.setEnabled(False) 7401 self.closeActGrp.setEnabled(False)
6355 self.disViewerAct.setEnabled(False) 7419 self.disViewerAct.setEnabled(False)
6356 self.macroActGrp.setEnabled(False) 7420 self.macroActGrp.setEnabled(False)
6357 self.bookmarkActGrp.setEnabled(False) 7421 self.bookmarkActGrp.setEnabled(False)
6358 self.__enableSpellingActions() 7422 self.__enableSpellingActions()
6359 self.__setSbFile(zoom=0) 7423 self.__setSbFile(zoom=0)
6360 7424
6361 # remove all split views, if this is supported 7425 # remove all split views, if this is supported
6362 if self.canSplit(): 7426 if self.canSplit():
6363 while self.removeSplit(): 7427 while self.removeSplit():
6364 pass 7428 pass
6365 7429
6366 # stop the autosave timer 7430 # stop the autosave timer
6367 if self.autosaveTimer.isActive(): 7431 if self.autosaveTimer.isActive():
6368 self.autosaveTimer.stop() 7432 self.autosaveTimer.stop()
6369 7433
6370 # hide search and replace widgets 7434 # hide search and replace widgets
6371 self.__searchWidget.hide() 7435 self.__searchWidget.hide()
6372 self.__replaceWidget.hide() 7436 self.__replaceWidget.hide()
6373 7437
6374 # hide the AST Viewer via its action 7438 # hide the AST Viewer via its action
6375 self.astViewerAct.setChecked(False) 7439 self.astViewerAct.setChecked(False)
6376 7440
6377 # hide the DIS Viewer via its action 7441 # hide the DIS Viewer via its action
6378 self.disViewerAct.setChecked(False) 7442 self.disViewerAct.setChecked(False)
6379 7443
6380 def __editorOpened(self): 7444 def __editorOpened(self):
6381 """ 7445 """
6382 Private slot to handle the editorOpened signal. 7446 Private slot to handle the editorOpened signal.
6383 """ 7447 """
6384 self.closeActGrp.setEnabled(True) 7448 self.closeActGrp.setEnabled(True)
6401 self.macroActGrp.setEnabled(True) 7465 self.macroActGrp.setEnabled(True)
6402 self.bookmarkActGrp.setEnabled(True) 7466 self.bookmarkActGrp.setEnabled(True)
6403 self.__enableSpellingActions() 7467 self.__enableSpellingActions()
6404 self.astViewerAct.setEnabled(True) 7468 self.astViewerAct.setEnabled(True)
6405 self.disViewerAct.setEnabled(True) 7469 self.disViewerAct.setEnabled(True)
6406 7470
6407 # activate the autosave timer 7471 # activate the autosave timer
6408 if ( 7472 if not self.autosaveTimer.isActive() and self.autosaveInterval > 0:
6409 not self.autosaveTimer.isActive() and
6410 self.autosaveInterval > 0
6411 ):
6412 self.autosaveTimer.start(self.autosaveInterval * 60000) 7473 self.autosaveTimer.start(self.autosaveInterval * 60000)
6413 7474
6414 def __autosave(self): 7475 def __autosave(self):
6415 """ 7476 """
6416 Private slot to save the contents of all editors automatically. 7477 Private slot to save the contents of all editors automatically.
6417 7478
6418 Only named editors will be saved by the autosave timer. 7479 Only named editors will be saved by the autosave timer.
6419 """ 7480 """
6420 for editor in self.editors: 7481 for editor in self.editors:
6421 if editor.shouldAutosave(): 7482 if editor.shouldAutosave():
6422 ok = editor.saveFile() 7483 ok = editor.saveFile()
6423 if ok: 7484 if ok:
6424 self.setEditorName(editor, editor.getFileName()) 7485 self.setEditorName(editor, editor.getFileName())
6425 7486
6426 # restart autosave timer 7487 # restart autosave timer
6427 if self.autosaveInterval > 0: 7488 if self.autosaveInterval > 0:
6428 self.autosaveTimer.start(self.autosaveInterval * 60000) 7489 self.autosaveTimer.start(self.autosaveInterval * 60000)
6429 7490
6430 def _checkActions(self, editor, setSb=True): 7491 def _checkActions(self, editor, setSb=True):
6431 """ 7492 """
6432 Protected slot to check some actions for their enable/disable status 7493 Protected slot to check some actions for their enable/disable status
6433 and set the statusbar info. 7494 and set the statusbar info.
6434 7495
6435 @param editor editor window 7496 @param editor editor window
6436 @param setSb flag indicating an update of the status bar is wanted 7497 @param setSb flag indicating an update of the status bar is wanted
6437 (boolean) 7498 (boolean)
6438 """ 7499 """
6439 if editor is not None: 7500 if editor is not None:
6440 self.saveAct.setEnabled(editor.isModified()) 7501 self.saveAct.setEnabled(editor.isModified())
6441 self.revertAct.setEnabled(editor.isModified()) 7502 self.revertAct.setEnabled(editor.isModified())
6442 7503
6443 self.undoAct.setEnabled(editor.isUndoAvailable()) 7504 self.undoAct.setEnabled(editor.isUndoAvailable())
6444 self.redoAct.setEnabled(editor.isRedoAvailable()) 7505 self.redoAct.setEnabled(editor.isRedoAvailable())
6445 self.gotoLastEditAct.setEnabled( 7506 self.gotoLastEditAct.setEnabled(editor.isLastEditPositionAvailable())
6446 editor.isLastEditPositionAvailable()) 7507
6447
6448 lex = editor.getLexer() 7508 lex = editor.getLexer()
6449 if lex is not None: 7509 if lex is not None:
6450 self.commentAct.setEnabled(lex.canBlockComment()) 7510 self.commentAct.setEnabled(lex.canBlockComment())
6451 self.uncommentAct.setEnabled(lex.canBlockComment()) 7511 self.uncommentAct.setEnabled(lex.canBlockComment())
6452 self.streamCommentAct.setEnabled(lex.canStreamComment()) 7512 self.streamCommentAct.setEnabled(lex.canStreamComment())
6454 else: 7514 else:
6455 self.commentAct.setEnabled(False) 7515 self.commentAct.setEnabled(False)
6456 self.uncommentAct.setEnabled(False) 7516 self.uncommentAct.setEnabled(False)
6457 self.streamCommentAct.setEnabled(False) 7517 self.streamCommentAct.setEnabled(False)
6458 self.boxCommentAct.setEnabled(False) 7518 self.boxCommentAct.setEnabled(False)
6459 7519
6460 if editor.hasBookmarks(): 7520 if editor.hasBookmarks():
6461 self.bookmarkNextAct.setEnabled(True) 7521 self.bookmarkNextAct.setEnabled(True)
6462 self.bookmarkPreviousAct.setEnabled(True) 7522 self.bookmarkPreviousAct.setEnabled(True)
6463 self.bookmarkClearAct.setEnabled(True) 7523 self.bookmarkClearAct.setEnabled(True)
6464 else: 7524 else:
6465 self.bookmarkNextAct.setEnabled(False) 7525 self.bookmarkNextAct.setEnabled(False)
6466 self.bookmarkPreviousAct.setEnabled(False) 7526 self.bookmarkPreviousAct.setEnabled(False)
6467 self.bookmarkClearAct.setEnabled(False) 7527 self.bookmarkClearAct.setEnabled(False)
6468 7528
6469 if editor.hasSyntaxErrors(): 7529 if editor.hasSyntaxErrors():
6470 self.syntaxErrorGotoAct.setEnabled(True) 7530 self.syntaxErrorGotoAct.setEnabled(True)
6471 self.syntaxErrorClearAct.setEnabled(True) 7531 self.syntaxErrorClearAct.setEnabled(True)
6472 else: 7532 else:
6473 self.syntaxErrorGotoAct.setEnabled(False) 7533 self.syntaxErrorGotoAct.setEnabled(False)
6474 self.syntaxErrorClearAct.setEnabled(False) 7534 self.syntaxErrorClearAct.setEnabled(False)
6475 7535
6476 if editor.hasWarnings(): 7536 if editor.hasWarnings():
6477 self.warningsNextAct.setEnabled(True) 7537 self.warningsNextAct.setEnabled(True)
6478 self.warningsPreviousAct.setEnabled(True) 7538 self.warningsPreviousAct.setEnabled(True)
6479 self.warningsClearAct.setEnabled(True) 7539 self.warningsClearAct.setEnabled(True)
6480 else: 7540 else:
6481 self.warningsNextAct.setEnabled(False) 7541 self.warningsNextAct.setEnabled(False)
6482 self.warningsPreviousAct.setEnabled(False) 7542 self.warningsPreviousAct.setEnabled(False)
6483 self.warningsClearAct.setEnabled(False) 7543 self.warningsClearAct.setEnabled(False)
6484 7544
6485 if editor.hasCoverageMarkers(): 7545 if editor.hasCoverageMarkers():
6486 self.notcoveredNextAct.setEnabled(True) 7546 self.notcoveredNextAct.setEnabled(True)
6487 self.notcoveredPreviousAct.setEnabled(True) 7547 self.notcoveredPreviousAct.setEnabled(True)
6488 else: 7548 else:
6489 self.notcoveredNextAct.setEnabled(False) 7549 self.notcoveredNextAct.setEnabled(False)
6490 self.notcoveredPreviousAct.setEnabled(False) 7550 self.notcoveredPreviousAct.setEnabled(False)
6491 7551
6492 if editor.hasTaskMarkers(): 7552 if editor.hasTaskMarkers():
6493 self.taskNextAct.setEnabled(True) 7553 self.taskNextAct.setEnabled(True)
6494 self.taskPreviousAct.setEnabled(True) 7554 self.taskPreviousAct.setEnabled(True)
6495 else: 7555 else:
6496 self.taskNextAct.setEnabled(False) 7556 self.taskNextAct.setEnabled(False)
6497 self.taskPreviousAct.setEnabled(False) 7557 self.taskPreviousAct.setEnabled(False)
6498 7558
6499 if editor.hasChangeMarkers(): 7559 if editor.hasChangeMarkers():
6500 self.changeNextAct.setEnabled(True) 7560 self.changeNextAct.setEnabled(True)
6501 self.changePreviousAct.setEnabled(True) 7561 self.changePreviousAct.setEnabled(True)
6502 else: 7562 else:
6503 self.changeNextAct.setEnabled(False) 7563 self.changeNextAct.setEnabled(False)
6504 self.changePreviousAct.setEnabled(False) 7564 self.changePreviousAct.setEnabled(False)
6505 7565
6506 if editor.canAutoCompleteFromAPIs(): 7566 if editor.canAutoCompleteFromAPIs():
6507 self.autoCompleteFromAPIsAct.setEnabled(True) 7567 self.autoCompleteFromAPIsAct.setEnabled(True)
6508 self.autoCompleteFromAllAct.setEnabled(True) 7568 self.autoCompleteFromAllAct.setEnabled(True)
6509 else: 7569 else:
6510 self.autoCompleteFromAPIsAct.setEnabled(False) 7570 self.autoCompleteFromAPIsAct.setEnabled(False)
6511 self.autoCompleteFromAllAct.setEnabled(False) 7571 self.autoCompleteFromAllAct.setEnabled(False)
6512 self.autoCompleteAct.setEnabled( 7572 self.autoCompleteAct.setEnabled(editor.canProvideDynamicAutoCompletion())
6513 editor.canProvideDynamicAutoCompletion())
6514 self.calltipsAct.setEnabled(editor.canProvideCallTipps()) 7573 self.calltipsAct.setEnabled(editor.canProvideCallTipps())
6515 self.codeInfoAct.setEnabled(self.__isEditorInfoSupportedEd(editor)) 7574 self.codeInfoAct.setEnabled(self.__isEditorInfoSupportedEd(editor))
6516 7575
6517 if editor.isPyFile() or editor.isRubyFile(): 7576 if editor.isPyFile() or editor.isRubyFile():
6518 self.gotoPreviousDefAct.setEnabled(True) 7577 self.gotoPreviousDefAct.setEnabled(True)
6519 self.gotoNextDefAct.setEnabled(True) 7578 self.gotoNextDefAct.setEnabled(True)
6520 else: 7579 else:
6521 self.gotoPreviousDefAct.setEnabled(False) 7580 self.gotoPreviousDefAct.setEnabled(False)
6522 self.gotoNextDefAct.setEnabled(False) 7581 self.gotoNextDefAct.setEnabled(False)
6523 7582
6524 self.sortAct.setEnabled(editor.selectionIsRectangle()) 7583 self.sortAct.setEnabled(editor.selectionIsRectangle())
6525 enable = editor.hasSelection() 7584 enable = editor.hasSelection()
6526 self.editUpperCaseAct.setEnabled(enable) 7585 self.editUpperCaseAct.setEnabled(enable)
6527 self.editLowerCaseAct.setEnabled(enable) 7586 self.editLowerCaseAct.setEnabled(enable)
6528 7587
6529 if setSb: 7588 if setSb:
6530 line, pos = editor.getCursorPosition() 7589 line, pos = editor.getCursorPosition()
6531 enc = editor.getEncoding() 7590 enc = editor.getEncoding()
6532 lang = editor.getLanguage() 7591 lang = editor.getLanguage()
6533 eol = editor.getEolIndicator() 7592 eol = editor.getEolIndicator()
6534 zoom = editor.getZoom() 7593 zoom = editor.getZoom()
6535 self.__setSbFile( 7594 self.__setSbFile(
6536 editor.getFileName(), line + 1, pos, enc, lang, eol, zoom) 7595 editor.getFileName(), line + 1, pos, enc, lang, eol, zoom
6537 7596 )
7597
6538 self.checkActions.emit(editor) 7598 self.checkActions.emit(editor)
6539 7599
6540 saveAllEnable = False 7600 saveAllEnable = False
6541 for editor in self.editors: 7601 for editor in self.editors:
6542 if editor.isModified(): 7602 if editor.isModified():
6543 saveAllEnable = True 7603 saveAllEnable = True
6544 self.saveAllAct.setEnabled(saveAllEnable) 7604 self.saveAllAct.setEnabled(saveAllEnable)
6545 7605
6546 def preferencesChanged(self): 7606 def preferencesChanged(self):
6547 """ 7607 """
6548 Public slot to handle the preferencesChanged signal. 7608 Public slot to handle the preferencesChanged signal.
6549 7609
6550 This method performs the following actions 7610 This method performs the following actions
6551 <ul> 7611 <ul>
6552 <li>reread the colours for the syntax highlighting</li> 7612 <li>reread the colours for the syntax highlighting</li>
6553 <li>reloads the already created API objetcs</li> 7613 <li>reloads the already created API objetcs</li>
6554 <li>starts or stops the autosave timer</li> 7614 <li>starts or stops the autosave timer</li>
6556 on an application restart.</li> 7616 on an application restart.</li>
6557 </ul> 7617 </ul>
6558 """ 7618 """
6559 # reload the APIs 7619 # reload the APIs
6560 self.apisManager.reloadAPIs() 7620 self.apisManager.reloadAPIs()
6561 7621
6562 # reload editor settings 7622 # reload editor settings
6563 for editor in self.editors: 7623 for editor in self.editors:
6564 zoom = editor.getZoom() 7624 zoom = editor.getZoom()
6565 editor.readSettings() 7625 editor.readSettings()
6566 editor.zoomTo(zoom) 7626 editor.zoomTo(zoom)
6567 7627
6568 # reload the autosave timer setting 7628 # reload the autosave timer setting
6569 self.autosaveInterval = Preferences.getEditor("AutosaveInterval") 7629 self.autosaveInterval = Preferences.getEditor("AutosaveInterval")
6570 if len(self.editors): 7630 if len(self.editors):
6571 if ( 7631 if self.autosaveTimer.isActive() and self.autosaveInterval == 0:
6572 self.autosaveTimer.isActive() and
6573 self.autosaveInterval == 0
6574 ):
6575 self.autosaveTimer.stop() 7632 self.autosaveTimer.stop()
6576 elif ( 7633 elif not self.autosaveTimer.isActive() and self.autosaveInterval > 0:
6577 not self.autosaveTimer.isActive() and
6578 self.autosaveInterval > 0
6579 ):
6580 self.autosaveTimer.start(self.autosaveInterval * 60000) 7634 self.autosaveTimer.start(self.autosaveInterval * 60000)
6581 7635
6582 self.__enableSpellingActions() 7636 self.__enableSpellingActions()
6583 7637
6584 def __editorSaved(self, fn, editor): 7638 def __editorSaved(self, fn, editor):
6585 """ 7639 """
6586 Private slot to handle the editorSaved signal. 7640 Private slot to handle the editorSaved signal.
6587 7641
6588 It simply re-emits the signal. 7642 It simply re-emits the signal.
6589 7643
6590 @param fn filename of the saved editor 7644 @param fn filename of the saved editor
6591 @type str 7645 @type str
6592 @param editor reference to the editor 7646 @param editor reference to the editor
6593 @type Editor 7647 @type Editor
6594 """ 7648 """
6595 self.editorSaved.emit(fn) 7649 self.editorSaved.emit(fn)
6596 self.editorSavedEd.emit(editor) 7650 self.editorSavedEd.emit(editor)
6597 7651
6598 def __editorRenamed(self, fn, editor): 7652 def __editorRenamed(self, fn, editor):
6599 """ 7653 """
6600 Private slot to handle the editorRenamed signal. 7654 Private slot to handle the editorRenamed signal.
6601 7655
6602 It simply re-emits the signal. 7656 It simply re-emits the signal.
6603 7657
6604 @param fn filename of the renamed editor 7658 @param fn filename of the renamed editor
6605 @type str 7659 @type str
6606 @param editor reference to the editor 7660 @param editor reference to the editor
6607 @type Editor 7661 @type Editor
6608 """ 7662 """
6609 self.editorRenamed.emit(fn) 7663 self.editorRenamed.emit(fn)
6610 self.editorRenamedEd.emit(editor) 7664 self.editorRenamedEd.emit(editor)
6611 7665
6612 def __cursorChanged(self, fn, line, pos, editor): 7666 def __cursorChanged(self, fn, line, pos, editor):
6613 """ 7667 """
6614 Private slot to handle the cursorChanged signal. 7668 Private slot to handle the cursorChanged signal.
6615 7669
6616 It emits the signal cursorChanged with parameter editor. 7670 It emits the signal cursorChanged with parameter editor.
6617 7671
6618 @param fn filename 7672 @param fn filename
6619 @type str 7673 @type str
6620 @param line line number of the cursor 7674 @param line line number of the cursor
6621 @type int 7675 @type int
6622 @param pos position in line of the cursor 7676 @param pos position in line of the cursor
6627 enc = editor.getEncoding() 7681 enc = editor.getEncoding()
6628 lang = editor.getLanguage() 7682 lang = editor.getLanguage()
6629 eol = editor.getEolIndicator() 7683 eol = editor.getEolIndicator()
6630 self.__setSbFile(fn, line, pos, enc, lang, eol) 7684 self.__setSbFile(fn, line, pos, enc, lang, eol)
6631 self.cursorChanged.emit(editor) 7685 self.cursorChanged.emit(editor)
6632 7686
6633 def __editorDoubleClicked(self, editor, pos, buttons): 7687 def __editorDoubleClicked(self, editor, pos, buttons):
6634 """ 7688 """
6635 Private slot handling mouse double clicks of an editor. 7689 Private slot handling mouse double clicks of an editor.
6636 7690
6637 Note: This method is simply a multiplexer to re-emit the signal 7691 Note: This method is simply a multiplexer to re-emit the signal
6638 with the editor prepended. 7692 with the editor prepended.
6639 7693
6640 @param editor reference to the editor, that emitted the signal 7694 @param editor reference to the editor, that emitted the signal
6641 @type Editor 7695 @type Editor
6642 @param pos position of the double click 7696 @param pos position of the double click
6643 @type QPoint 7697 @type QPoint
6644 @param buttons mouse buttons that were double clicked 7698 @param buttons mouse buttons that were double clicked
6645 @type Qt.MouseButtons 7699 @type Qt.MouseButtons
6646 """ 7700 """
6647 self.editorDoubleClickedEd.emit(editor, pos, buttons) 7701 self.editorDoubleClickedEd.emit(editor, pos, buttons)
6648 7702
6649 def __breakpointToggled(self, editor): 7703 def __breakpointToggled(self, editor):
6650 """ 7704 """
6651 Private slot to handle the breakpointToggled signal. 7705 Private slot to handle the breakpointToggled signal.
6652 7706
6653 It simply reemits the signal. 7707 It simply reemits the signal.
6654 7708
6655 @param editor editor that sent the signal 7709 @param editor editor that sent the signal
6656 """ 7710 """
6657 self.breakpointToggled.emit(editor) 7711 self.breakpointToggled.emit(editor)
6658 7712
6659 def getActions(self, actionSetType): 7713 def getActions(self, actionSetType):
6660 """ 7714 """
6661 Public method to get a list of all actions. 7715 Public method to get a list of all actions.
6662 7716
6663 @param actionSetType string denoting the action set to get. 7717 @param actionSetType string denoting the action set to get.
6664 It must be one of "edit", "file", "search", "view", "window", 7718 It must be one of "edit", "file", "search", "view", "window",
6665 "macro", "bookmark" or "spelling". 7719 "macro", "bookmark" or "spelling".
6666 @return list of all actions (list of EricAction) 7720 @return list of all actions (list of EricAction)
6667 """ 7721 """
6668 try: 7722 try:
6669 return self.__actions[actionSetType][:] 7723 return self.__actions[actionSetType][:]
6670 except KeyError: 7724 except KeyError:
6671 return [] 7725 return []
6672 7726
6673 def __editorCommand(self, cmd): 7727 def __editorCommand(self, cmd):
6674 """ 7728 """
6675 Private method to send an editor command to the active window. 7729 Private method to send an editor command to the active window.
6676 7730
6677 @param cmd the scintilla command to be sent 7731 @param cmd the scintilla command to be sent
6678 """ 7732 """
6679 focusWidget = QApplication.focusWidget() 7733 focusWidget = QApplication.focusWidget()
6680 if focusWidget == ericApp().getObject("Shell"): 7734 if focusWidget == ericApp().getObject("Shell"):
6681 ericApp().getObject("Shell").editorCommand(cmd) 7735 ericApp().getObject("Shell").editorCommand(cmd)
6682 else: 7736 else:
6683 aw = self.activeWindow() 7737 aw = self.activeWindow()
6684 if aw: 7738 if aw:
6685 aw.editorCommand(cmd) 7739 aw.editorCommand(cmd)
6686 7740
6687 def __newLineBelow(self): 7741 def __newLineBelow(self):
6688 """ 7742 """
6689 Private method to insert a new line below the current one even if 7743 Private method to insert a new line below the current one even if
6690 cursor is not at the end of the line. 7744 cursor is not at the end of the line.
6691 """ 7745 """
6694 return 7748 return
6695 else: 7749 else:
6696 aw = self.activeWindow() 7750 aw = self.activeWindow()
6697 if aw: 7751 if aw:
6698 aw.newLineBelow() 7752 aw.newLineBelow()
6699 7753
6700 def __editorConfigChanged(self, editor): 7754 def __editorConfigChanged(self, editor):
6701 """ 7755 """
6702 Private slot to handle changes of an editor's configuration. 7756 Private slot to handle changes of an editor's configuration.
6703 7757
6704 @param editor reference to the editor 7758 @param editor reference to the editor
6705 @type Editor 7759 @type Editor
6706 """ 7760 """
6707 fn = editor.getFileName() 7761 fn = editor.getFileName()
6708 line, pos = editor.getCursorPosition() 7762 line, pos = editor.getCursorPosition()
6709 enc = editor.getEncoding() 7763 enc = editor.getEncoding()
6710 lang = editor.getLanguage() 7764 lang = editor.getLanguage()
6711 eol = editor.getEolIndicator() 7765 eol = editor.getEolIndicator()
6712 zoom = editor.getZoom() 7766 zoom = editor.getZoom()
6713 self.__setSbFile( 7767 self.__setSbFile(
6714 fn, line + 1, pos, encoding=enc, language=lang, eol=eol, zoom=zoom) 7768 fn, line + 1, pos, encoding=enc, language=lang, eol=eol, zoom=zoom
7769 )
6715 self._checkActions(editor, False) 7770 self._checkActions(editor, False)
6716 7771
6717 def __editorSelectionChanged(self, editor): 7772 def __editorSelectionChanged(self, editor):
6718 """ 7773 """
6719 Private slot to handle changes of the current editors selection. 7774 Private slot to handle changes of the current editors selection.
6720 7775
6721 @param editor reference to the editor 7776 @param editor reference to the editor
6722 @type Editor 7777 @type Editor
6723 """ 7778 """
6724 self.sortAct.setEnabled(editor.selectionIsRectangle()) 7779 self.sortAct.setEnabled(editor.selectionIsRectangle())
6725 enable = editor.hasSelection() 7780 enable = editor.hasSelection()
6726 self.editUpperCaseAct.setEnabled(enable) 7781 self.editUpperCaseAct.setEnabled(enable)
6727 self.editLowerCaseAct.setEnabled(enable) 7782 self.editLowerCaseAct.setEnabled(enable)
6728 7783
6729 def __editSortSelectedLines(self): 7784 def __editSortSelectedLines(self):
6730 """ 7785 """
6731 Private slot to sort the selected lines. 7786 Private slot to sort the selected lines.
6732 """ 7787 """
6733 editor = self.activeWindow() 7788 editor = self.activeWindow()
6734 if editor: 7789 if editor:
6735 editor.sortLines() 7790 editor.sortLines()
6736 7791
6737 def __editInsertDocstring(self): 7792 def __editInsertDocstring(self):
6738 """ 7793 """
6739 Private method to insert a docstring. 7794 Private method to insert a docstring.
6740 """ 7795 """
6741 editor = self.activeWindow() 7796 editor = self.activeWindow()
6742 if editor: 7797 if editor:
6743 editor.insertDocstring() 7798 editor.insertDocstring()
6744 7799
6745 def showEditorInfo(self, editor): 7800 def showEditorInfo(self, editor):
6746 """ 7801 """
6747 Public method to show some information for a given editor. 7802 Public method to show some information for a given editor.
6748 7803
6749 @param editor editor to show information text for 7804 @param editor editor to show information text for
6750 @type Editor 7805 @type Editor
6751 """ 7806 """
6752 documentationViewer = self.ui.documentationViewer() 7807 documentationViewer = self.ui.documentationViewer()
6753 if documentationViewer: 7808 if documentationViewer:
6754 documentationViewer.showInfo(editor) 7809 documentationViewer.showInfo(editor)
6755 7810
6756 def isEditorInfoSupported(self, language): 7811 def isEditorInfoSupported(self, language):
6757 """ 7812 """
6758 Public method to check, if a language is supported by the 7813 Public method to check, if a language is supported by the
6759 documentation viewer. 7814 documentation viewer.
6760 7815
6761 @param language editor programming language to check 7816 @param language editor programming language to check
6762 @type str 7817 @type str
6763 @return flag indicating the support status 7818 @return flag indicating the support status
6764 @rtype bool 7819 @rtype bool
6765 """ 7820 """
6766 documentationViewer = self.ui.documentationViewer() 7821 documentationViewer = self.ui.documentationViewer()
6767 if documentationViewer: 7822 if documentationViewer:
6768 return documentationViewer.isSupportedLanguage(language) 7823 return documentationViewer.isSupportedLanguage(language)
6769 else: 7824 else:
6770 return False 7825 return False
6771 7826
6772 def __isEditorInfoSupportedEd(self, editor): 7827 def __isEditorInfoSupportedEd(self, editor):
6773 """ 7828 """
6774 Private method to check, if an editor is supported by the 7829 Private method to check, if an editor is supported by the
6775 documentation viewer. 7830 documentation viewer.
6776 7831
6777 @param editor reference to the editor to check for 7832 @param editor reference to the editor to check for
6778 @type Editor 7833 @type Editor
6779 @return flag indicating the support status 7834 @return flag indicating the support status
6780 @rtype bool 7835 @rtype bool
6781 """ 7836 """
6782 language = editor.getLanguage() 7837 language = editor.getLanguage()
6783 return self.isEditorInfoSupported(language) 7838 return self.isEditorInfoSupported(language)
6784 7839
6785 ################################################################## 7840 ##################################################################
6786 ## Below are protected utility methods 7841 ## Below are protected utility methods
6787 ################################################################## 7842 ##################################################################
6788 7843
6789 def _getOpenStartDir(self): 7844 def _getOpenStartDir(self):
6790 """ 7845 """
6791 Protected method to return the starting directory for a file open 7846 Protected method to return the starting directory for a file open
6792 dialog. 7847 dialog.
6793 7848
6794 The appropriate starting directory is calculated 7849 The appropriate starting directory is calculated
6795 using the following search order, until a match is found:<br /> 7850 using the following search order, until a match is found:<br />
6796 1: Directory of currently active editor<br /> 7851 1: Directory of currently active editor<br />
6797 2: Directory of currently active Project<br /> 7852 2: Directory of currently active Project<br />
6798 3: CWD 7853 3: CWD
6799 7854
6800 @return name of directory to start (string) 7855 @return name of directory to start (string)
6801 """ 7856 """
6802 # if we have an active source, return its path 7857 # if we have an active source, return its path
6803 if ( 7858 if self.activeWindow() is not None and self.activeWindow().getFileName():
6804 self.activeWindow() is not None and
6805 self.activeWindow().getFileName()
6806 ):
6807 return os.path.dirname(self.activeWindow().getFileName()) 7859 return os.path.dirname(self.activeWindow().getFileName())
6808 7860
6809 # check, if there is an active project and return its path 7861 # check, if there is an active project and return its path
6810 elif ericApp().getObject("Project").isOpen(): 7862 elif ericApp().getObject("Project").isOpen():
6811 return ericApp().getObject("Project").ppath 7863 return ericApp().getObject("Project").ppath
6812 7864
6813 else: 7865 else:
6814 return ( 7866 return Preferences.getMultiProject("Workspace") or Utilities.getHomeDir()
6815 Preferences.getMultiProject("Workspace") or 7867
6816 Utilities.getHomeDir()
6817 )
6818
6819 def _getOpenFileFilter(self): 7868 def _getOpenFileFilter(self):
6820 """ 7869 """
6821 Protected method to return the active filename filter for a file open 7870 Protected method to return the active filename filter for a file open
6822 dialog. 7871 dialog.
6823 7872
6824 The appropriate filename filter is determined by file extension of 7873 The appropriate filename filter is determined by file extension of
6825 the currently active editor. 7874 the currently active editor.
6826 7875
6827 @return name of the filename filter (string) or None 7876 @return name of the filename filter (string) or None
6828 """ 7877 """
6829 if ( 7878 if self.activeWindow() is not None and self.activeWindow().getFileName():
6830 self.activeWindow() is not None and
6831 self.activeWindow().getFileName()
6832 ):
6833 ext = os.path.splitext(self.activeWindow().getFileName())[1] 7879 ext = os.path.splitext(self.activeWindow().getFileName())[1]
6834 rx = re.compile(r".*\*\.{0}[ )].*".format(ext[1:])) 7880 rx = re.compile(r".*\*\.{0}[ )].*".format(ext[1:]))
6835 import QScintilla.Lexers 7881 import QScintilla.Lexers
7882
6836 filters = QScintilla.Lexers.getOpenFileFiltersList() 7883 filters = QScintilla.Lexers.getOpenFileFiltersList()
6837 index = -1 7884 index = -1
6838 for i in range(len(filters)): 7885 for i in range(len(filters)):
6839 if rx.fullmatch(filters[i]): 7886 if rx.fullmatch(filters[i]):
6840 index = i 7887 index = i
6843 return Preferences.getEditor("DefaultOpenFilter") 7890 return Preferences.getEditor("DefaultOpenFilter")
6844 else: 7891 else:
6845 return filters[index] 7892 return filters[index]
6846 else: 7893 else:
6847 return Preferences.getEditor("DefaultOpenFilter") 7894 return Preferences.getEditor("DefaultOpenFilter")
6848 7895
6849 ################################################################## 7896 ##################################################################
6850 ## Below are API handling methods 7897 ## Below are API handling methods
6851 ################################################################## 7898 ##################################################################
6852 7899
6853 def getAPIsManager(self): 7900 def getAPIsManager(self):
6854 """ 7901 """
6855 Public method to get a reference to the APIs manager. 7902 Public method to get a reference to the APIs manager.
6856 7903
6857 @return the APIs manager object (eric7.QScintilla.APIsManager) 7904 @return the APIs manager object (eric7.QScintilla.APIsManager)
6858 """ 7905 """
6859 return self.apisManager 7906 return self.apisManager
6860 7907
6861 ####################################################################### 7908 #######################################################################
6862 ## Cooperation related methods 7909 ## Cooperation related methods
6863 ####################################################################### 7910 #######################################################################
6864 7911
6865 def setCooperationClient(self, client): 7912 def setCooperationClient(self, client):
6866 """ 7913 """
6867 Public method to set a reference to the cooperation client. 7914 Public method to set a reference to the cooperation client.
6868 7915
6869 @param client reference to the cooperation client (CooperationClient) 7916 @param client reference to the cooperation client (CooperationClient)
6870 """ 7917 """
6871 self.__cooperationClient = client 7918 self.__cooperationClient = client
6872 7919
6873 def isConnected(self): 7920 def isConnected(self):
6874 """ 7921 """
6875 Public method to check the connection status of the IDE. 7922 Public method to check the connection status of the IDE.
6876 7923
6877 @return flag indicating the connection status (boolean) 7924 @return flag indicating the connection status (boolean)
6878 """ 7925 """
6879 return self.__cooperationClient.hasConnections() 7926 return self.__cooperationClient.hasConnections()
6880 7927
6881 def send(self, fileName, message): 7928 def send(self, fileName, message):
6882 """ 7929 """
6883 Public method to send an editor command to remote editors. 7930 Public method to send an editor command to remote editors.
6884 7931
6885 @param fileName file name of the editor (string) 7932 @param fileName file name of the editor (string)
6886 @param message command message to be sent (string) 7933 @param message command message to be sent (string)
6887 """ 7934 """
6888 project = ericApp().getObject("Project") 7935 project = ericApp().getObject("Project")
6889 if project.isProjectFile(fileName): 7936 if project.isProjectFile(fileName):
6890 self.__cooperationClient.sendEditorCommand( 7937 self.__cooperationClient.sendEditorCommand(
6891 project.getHash(), 7938 project.getHash(), project.getRelativeUniversalPath(fileName), message
6892 project.getRelativeUniversalPath(fileName), 7939 )
6893 message 7940
6894 )
6895
6896 def receive(self, projectHash, fileName, command): 7941 def receive(self, projectHash, fileName, command):
6897 """ 7942 """
6898 Public slot to handle received editor commands. 7943 Public slot to handle received editor commands.
6899 7944
6900 @param projectHash hash of the project (string) 7945 @param projectHash hash of the project (string)
6901 @param fileName project relative file name of the editor (string) 7946 @param fileName project relative file name of the editor (string)
6902 @param command command string (string) 7947 @param command command string (string)
6903 """ 7948 """
6904 project = ericApp().getObject("Project") 7949 project = ericApp().getObject("Project")
6905 if projectHash == project.getHash(): 7950 if projectHash == project.getHash():
6906 fn = project.getAbsoluteUniversalPath(fileName) 7951 fn = project.getAbsoluteUniversalPath(fileName)
6907 editor = self.getOpenEditor(fn) 7952 editor = self.getOpenEditor(fn)
6908 if editor: 7953 if editor:
6909 editor.receive(command) 7954 editor.receive(command)
6910 7955
6911 def shareConnected(self, connected): 7956 def shareConnected(self, connected):
6912 """ 7957 """
6913 Public slot to handle a change of the connected state. 7958 Public slot to handle a change of the connected state.
6914 7959
6915 @param connected flag indicating the connected state (boolean) 7960 @param connected flag indicating the connected state (boolean)
6916 """ 7961 """
6917 for editor in self.getOpenEditors(): 7962 for editor in self.getOpenEditors():
6918 editor.shareConnected(connected) 7963 editor.shareConnected(connected)
6919 7964
6920 def shareEditor(self, share): 7965 def shareEditor(self, share):
6921 """ 7966 """
6922 Public slot to set the shared status of the current editor. 7967 Public slot to set the shared status of the current editor.
6923 7968
6924 @param share flag indicating the share status (boolean) 7969 @param share flag indicating the share status (boolean)
6925 """ 7970 """
6926 aw = self.activeWindow() 7971 aw = self.activeWindow()
6927 if aw is not None: 7972 if aw is not None:
6928 fn = aw.getFileName() 7973 fn = aw.getFileName()
6929 if fn and ericApp().getObject("Project").isProjectFile(fn): 7974 if fn and ericApp().getObject("Project").isProjectFile(fn):
6930 aw.shareEditor(share) 7975 aw.shareEditor(share)
6931 7976
6932 def startSharedEdit(self): 7977 def startSharedEdit(self):
6933 """ 7978 """
6934 Public slot to start a shared edit session for the current editor. 7979 Public slot to start a shared edit session for the current editor.
6935 """ 7980 """
6936 aw = self.activeWindow() 7981 aw = self.activeWindow()
6937 if aw is not None: 7982 if aw is not None:
6938 fn = aw.getFileName() 7983 fn = aw.getFileName()
6939 if fn and ericApp().getObject("Project").isProjectFile(fn): 7984 if fn and ericApp().getObject("Project").isProjectFile(fn):
6940 aw.startSharedEdit() 7985 aw.startSharedEdit()
6941 7986
6942 def sendSharedEdit(self): 7987 def sendSharedEdit(self):
6943 """ 7988 """
6944 Public slot to end a shared edit session for the current editor and 7989 Public slot to end a shared edit session for the current editor and
6945 send the changes. 7990 send the changes.
6946 """ 7991 """
6947 aw = self.activeWindow() 7992 aw = self.activeWindow()
6948 if aw is not None: 7993 if aw is not None:
6949 fn = aw.getFileName() 7994 fn = aw.getFileName()
6950 if fn and ericApp().getObject("Project").isProjectFile(fn): 7995 if fn and ericApp().getObject("Project").isProjectFile(fn):
6951 aw.sendSharedEdit() 7996 aw.sendSharedEdit()
6952 7997
6953 def cancelSharedEdit(self): 7998 def cancelSharedEdit(self):
6954 """ 7999 """
6955 Public slot to cancel a shared edit session for the current editor. 8000 Public slot to cancel a shared edit session for the current editor.
6956 """ 8001 """
6957 aw = self.activeWindow() 8002 aw = self.activeWindow()
6958 if aw is not None: 8003 if aw is not None:
6959 fn = aw.getFileName() 8004 fn = aw.getFileName()
6960 if fn and ericApp().getObject("Project").isProjectFile(fn): 8005 if fn and ericApp().getObject("Project").isProjectFile(fn):
6961 aw.cancelSharedEdit() 8006 aw.cancelSharedEdit()
6962 8007
6963 ####################################################################### 8008 #######################################################################
6964 ## Symbols viewer related methods 8009 ## Symbols viewer related methods
6965 ####################################################################### 8010 #######################################################################
6966 8011
6967 def insertSymbol(self, txt): 8012 def insertSymbol(self, txt):
6968 """ 8013 """
6969 Public slot to insert a symbol text into the active window. 8014 Public slot to insert a symbol text into the active window.
6970 8015
6971 @param txt text to be inserted (string) 8016 @param txt text to be inserted (string)
6972 """ 8017 """
6973 if self.__lastFocusWidget == ericApp().getObject("Shell"): 8018 if self.__lastFocusWidget == ericApp().getObject("Shell"):
6974 ericApp().getObject("Shell").insert(txt) 8019 ericApp().getObject("Shell").insert(txt)
6975 else: 8020 else:
6976 aw = self.activeWindow() 8021 aw = self.activeWindow()
6977 if aw is not None: 8022 if aw is not None:
6978 curline, curindex = aw.getCursorPosition() 8023 curline, curindex = aw.getCursorPosition()
6979 aw.insert(txt) 8024 aw.insert(txt)
6980 aw.setCursorPosition(curline, curindex + len(txt)) 8025 aw.setCursorPosition(curline, curindex + len(txt))
6981 8026
6982 ####################################################################### 8027 #######################################################################
6983 ## Numbers viewer related methods 8028 ## Numbers viewer related methods
6984 ####################################################################### 8029 #######################################################################
6985 8030
6986 def insertNumber(self, txt): 8031 def insertNumber(self, txt):
6987 """ 8032 """
6988 Public slot to insert a number text into the active window. 8033 Public slot to insert a number text into the active window.
6989 8034
6990 @param txt text to be inserted (string) 8035 @param txt text to be inserted (string)
6991 """ 8036 """
6992 if self.__lastFocusWidget == ericApp().getObject("Shell"): 8037 if self.__lastFocusWidget == ericApp().getObject("Shell"):
6993 aw = ericApp().getObject("Shell") 8038 aw = ericApp().getObject("Shell")
6994 if aw.hasSelectedText(): 8039 if aw.hasSelectedText():
7000 if aw.hasSelectedText(): 8045 if aw.hasSelectedText():
7001 aw.removeSelectedText() 8046 aw.removeSelectedText()
7002 curline, curindex = aw.getCursorPosition() 8047 curline, curindex = aw.getCursorPosition()
7003 aw.insert(txt) 8048 aw.insert(txt)
7004 aw.setCursorPosition(curline, curindex + len(txt)) 8049 aw.setCursorPosition(curline, curindex + len(txt))
7005 8050
7006 def getNumber(self): 8051 def getNumber(self):
7007 """ 8052 """
7008 Public method to get a number from the active window. 8053 Public method to get a number from the active window.
7009 8054
7010 @return selected text of the active window (string) 8055 @return selected text of the active window (string)
7011 """ 8056 """
7012 txt = "" 8057 txt = ""
7013 if self.__lastFocusWidget == ericApp().getObject("Shell"): 8058 if self.__lastFocusWidget == ericApp().getObject("Shell"):
7014 aw = ericApp().getObject("Shell") 8059 aw = ericApp().getObject("Shell")

eric ide

mercurial