eric6/QScintilla/Editor.py

Mon, 25 Jan 2021 14:44:35 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 25 Jan 2021 14:44:35 +0100
changeset 8004
38d359e2ded7
parent 8002
6002378278c9
child 8043
0acf98cd089a
child 8106
81bf8fe10735
permissions
-rw-r--r--

Editor: fixed the integration of docstring generator for newly created files.

92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
1 # -*- coding: utf-8 -*-
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
2
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
3 # Copyright (c) 2002 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
4 #
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
5
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
6 """
7960
e8fc383322f7 Harmonized some user visible strings and changed the term 'eric6' to the more generic 'eric'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
7 Module implementing the editor component of the eric IDE.
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
8 """
7229
53054eb5b15a Removed obsolete "from __future__ import ..." statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7225
diff changeset
9
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
10 import os
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
11 import re
158
6a561f87bc07 Added shared editor functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 156
diff changeset
12 import difflib
728
3ee110082fb7 Finished implementing the display of annotations .
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 726
diff changeset
13
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7261
diff changeset
14 from PyQt5.QtCore import (
7775
4a1db75550bd Changed code to not use deprecated 'QRegExp' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7771
diff changeset
15 pyqtSignal, pyqtSlot, Qt, QDir, QTimer, QModelIndex, QFileInfo,
4a1db75550bd Changed code to not use deprecated 'QRegExp' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7771
diff changeset
16 QCryptographicHash, QEvent, QDateTime, QPoint
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7261
diff changeset
17 )
7771
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
18 from PyQt5.QtGui import QPalette, QFont, QPixmap, QPainter
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7261
diff changeset
19 from PyQt5.QtWidgets import (
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7261
diff changeset
20 QLineEdit, QActionGroup, QDialog, QInputDialog, QApplication, QMenu
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7261
diff changeset
21 )
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
22 from PyQt5.QtPrintSupport import QPrinter, QPrintDialog, QAbstractPrintDialog
7225
aa36a9414d99 Editor: fixed the recent fix again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7224
diff changeset
23 from PyQt5.Qsci import QsciScintilla, QsciMacro, QsciStyledText
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
24
2084
d3f083dd0222 Made the fiveth set of Qt5 compatibility changes (some of the previous changes are backed out due to changes in PyQt4).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2077
diff changeset
25 from E5Gui.E5Application import e5App
536
6d8d39753c82 Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 535
diff changeset
26 from E5Gui import E5FileDialog, E5MessageBox
7771
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
27 from E5Gui.E5OverrideCursor import E5OverrideCursor
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
28
5888
f23f3d2b7516 Added a cache for the already determined completion lists.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5887
diff changeset
29 from E5Utilities.E5Cache import E5Cache
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
30
7746
12d5e1e6abd1 QScintilla: pushed required QScintilla version to 2.11.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7730
diff changeset
31 from .QsciScintillaCompat import QsciScintillaCompat
3329
1ee38e29ed4f Continued implementing support for a marker map in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3327
diff changeset
32 from .EditorMarkerMap import EditorMarkerMap
7310
460a332dcc56 Editor: added a context menu to select spell check language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7306
diff changeset
33 from .SpellChecker import SpellChecker
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
34
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
35 import Preferences
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
36 import Utilities
4290
5d4f4230a5ed Moved the code to create a display string for a modifier and mouse button combination to a separate file because it will be needed in other places than just the editor as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4288
diff changeset
37 from Utilities import MouseUtilities
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
38
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
39 import UI.PixmapCache
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
40
6099
a7fecbc392d7 Started implementing support for EditorConfig.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6092
diff changeset
41 from ThirdParty.EditorConfig import editorconfig
a7fecbc392d7 Started implementing support for EditorConfig.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6092
diff changeset
42
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
43 EditorAutoCompletionListID = 1
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
44 TemplateCompletionListID = 2
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
45
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
46
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
47 class Editor(QsciScintillaCompat):
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
48 """
7960
e8fc383322f7 Harmonized some user visible strings and changed the term 'eric6' to the more generic 'eric'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
49 Class implementing the editor component of the eric IDE.
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
50
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
51 @signal modificationStatusChanged(bool, QsciScintillaCompat) emitted when
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
52 the modification status has changed
501
5c615a85241a Finished porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
53 @signal undoAvailable(bool) emitted to signal the undo availability
5c615a85241a Finished porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
54 @signal redoAvailable(bool) emitted to signal the redo availability
5c615a85241a Finished porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
55 @signal cursorChanged(str, int, int) emitted when the cursor position
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
56 was changed
2768
eab35f6e709f Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2659
diff changeset
57 @signal cursorLineChanged(int) emitted when the cursor line was changed
501
5c615a85241a Finished porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
58 @signal editorAboutToBeSaved(str) emitted before the editor is saved
5c615a85241a Finished porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
59 @signal editorSaved(str) emitted after the editor has been saved
5c615a85241a Finished porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
60 @signal editorRenamed(str) emitted after the editor got a new name
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
61 (i.e. after a 'Save As')
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
62 @signal captionChanged(str, QsciScintillaCompat) emitted when the caption
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
63 is updated. Typically due to a readOnly attribute change.
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
64 @signal breakpointToggled(QsciScintillaCompat) emitted when a breakpoint
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
65 is toggled
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
66 @signal bookmarkToggled(QsciScintillaCompat) emitted when a bookmark is
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
67 toggled
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
68 @signal syntaxerrorToggled(QsciScintillaCompat) emitted when a syntax error
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
69 was discovered
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
70 @signal autoCompletionAPIsAvailable(bool) emitted after the autocompletion
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
71 function has been configured
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
72 @signal coverageMarkersShown(bool) emitted after the coverage markers have
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
73 been shown or cleared
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
74 @signal taskMarkersUpdated(QsciScintillaCompat) emitted when the task
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
75 markers were updated
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
76 @signal changeMarkersUpdated(QsciScintillaCompat) emitted when the change
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
77 markers were updated
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
78 @signal showMenu(str, QMenu, QsciScintillaCompat) emitted when a menu is
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
79 about to be shown. The name of the menu, a reference to the menu and
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
80 a reference to the editor are given.
501
5c615a85241a Finished porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
81 @signal languageChanged(str) emitted when the editors language was set. The
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
82 language is passed as a parameter.
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
83 @signal eolChanged(str) emitted when the editors eol type was set. The eol
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
84 string is passed as a parameter.
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
85 @signal encodingChanged(str) emitted when the editors encoding was set. The
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
86 encoding name is passed as a parameter.
7310
460a332dcc56 Editor: added a context menu to select spell check language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7306
diff changeset
87 @signal spellLanguageChanged(str) emitted when the editor spell check
460a332dcc56 Editor: added a context menu to select spell check language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7306
diff changeset
88 language was set. The language is passed as a parameter.
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
89 @signal lastEditPositionAvailable() emitted when a last edit position is
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
90 available
1807
9898a95461f1 Added a signal to the editor showing a refresh has happend and connected the editor assembly to it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1768
diff changeset
91 @signal refreshed() emitted to signal a refresh of the editor contents
5416
16366120b523 Added an option to hide the format buttons bar, if formatting is not supported for the editor text type (only supported for HTML, Markdown and reStructured Text).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
92 @signal settingsRead() emitted to signal, that the settings have been read
16366120b523 Added an option to hide the format buttons bar, if formatting is not supported for the editor text type (only supported for HTML, Markdown and reStructured Text).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
93 and set
6932
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6930
diff changeset
94 @signal mouseDoubleClick(position, buttons) emitted to signal a mouse
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6930
diff changeset
95 double click somewhere in the editor area
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
96 """
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
97 modificationStatusChanged = pyqtSignal(bool, QsciScintillaCompat)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
98 undoAvailable = pyqtSignal(bool)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
99 redoAvailable = pyqtSignal(bool)
486
e4711a55e482 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 478
diff changeset
100 cursorChanged = pyqtSignal(str, int, int)
2768
eab35f6e709f Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2659
diff changeset
101 cursorLineChanged = pyqtSignal(int)
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
102 editorAboutToBeSaved = pyqtSignal(str)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
103 editorSaved = pyqtSignal(str)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
104 editorRenamed = pyqtSignal(str)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
105 captionChanged = pyqtSignal(str, QsciScintillaCompat)
486
e4711a55e482 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 478
diff changeset
106 breakpointToggled = pyqtSignal(QsciScintillaCompat)
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
107 bookmarkToggled = pyqtSignal(QsciScintillaCompat)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
108 syntaxerrorToggled = pyqtSignal(QsciScintillaCompat)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
109 autoCompletionAPIsAvailable = pyqtSignal(bool)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
110 coverageMarkersShown = pyqtSignal(bool)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
111 taskMarkersUpdated = pyqtSignal(QsciScintillaCompat)
2162
4627e6ea7b6b Added capability to mark changed lines and to navigate between them to the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
112 changeMarkersUpdated = pyqtSignal(QsciScintillaCompat)
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
113 showMenu = pyqtSignal(str, QMenu, QsciScintillaCompat)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
114 languageChanged = pyqtSignal(str)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
115 eolChanged = pyqtSignal(str)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
116 encodingChanged = pyqtSignal(str)
7310
460a332dcc56 Editor: added a context menu to select spell check language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7306
diff changeset
117 spellLanguageChanged = pyqtSignal(str)
1169
36a3bb21e6e6 Added editor actions to go to the last edit location and to the previous or next Python or Ruby class or method definition.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
118 lastEditPositionAvailable = pyqtSignal()
1807
9898a95461f1 Added a signal to the editor showing a refresh has happend and connected the editor assembly to it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1768
diff changeset
119 refreshed = pyqtSignal()
5416
16366120b523 Added an option to hide the format buttons bar, if formatting is not supported for the editor text type (only supported for HTML, Markdown and reStructured Text).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
120 settingsRead = pyqtSignal()
6932
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6930
diff changeset
121 mouseDoubleClick = pyqtSignal(QPoint, int)
486
e4711a55e482 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 478
diff changeset
122
2905
a1ae4b297bc0 Added capability to have different warning styles to the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2904
diff changeset
123 WarningCode = 1
a1ae4b297bc0 Added capability to have different warning styles to the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2904
diff changeset
124 WarningStyle = 2
a1ae4b297bc0 Added capability to have different warning styles to the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2904
diff changeset
125
155
375e3c884874 Added code to transmit selections to remote editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 128
diff changeset
126 # Autocompletion icon definitions
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
127 ClassID = 1
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
128 ClassProtectedID = 2
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
129 ClassPrivateID = 3
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
130 MethodID = 4
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
131 MethodProtectedID = 5
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
132 MethodPrivateID = 6
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
133 AttributeID = 7
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
134 AttributeProtectedID = 8
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
135 AttributePrivateID = 9
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
136 EnumID = 10
5894
0d4431926611 Two additional autocomplete icons.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5891
diff changeset
137 KeywordsID = 11
0d4431926611 Two additional autocomplete icons.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5891
diff changeset
138 ModuleID = 12
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
139
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
140 FromDocumentID = 99
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
141
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
142 TemplateImageID = 100
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
143
155
375e3c884874 Added code to transmit selections to remote editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 128
diff changeset
144 # Cooperation related definitions
375e3c884874 Added code to transmit selections to remote editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 128
diff changeset
145 Separator = "@@@"
375e3c884874 Added code to transmit selections to remote editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 128
diff changeset
146
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
147 StartEditToken = "START_EDIT"
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
148 EndEditToken = "END_EDIT"
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
149 CancelEditToken = "CANCEL_EDIT"
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
150 RequestSyncToken = "REQUEST_SYNC"
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
151 SyncToken = "SYNC"
155
375e3c884874 Added code to transmit selections to remote editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 128
diff changeset
152
6111
d38b38117d83 Added VCS conflict markers to the types shown on the marker map.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6105
diff changeset
153 VcsConflictMarkerLineRegExpList = (
d38b38117d83 Added VCS conflict markers to the types shown on the marker map.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6105
diff changeset
154 r"""^<<<<<<< .*?$""",
d38b38117d83 Added VCS conflict markers to the types shown on the marker map.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6105
diff changeset
155 r"""^\|\|\|\|\|\|\| .*?$""",
d38b38117d83 Added VCS conflict markers to the types shown on the marker map.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6105
diff changeset
156 r"""^=======.*?$""",
d38b38117d83 Added VCS conflict markers to the types shown on the marker map.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6105
diff changeset
157 r"""^>>>>>>> .*?$""",
d38b38117d83 Added VCS conflict markers to the types shown on the marker map.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6105
diff changeset
158 )
d38b38117d83 Added VCS conflict markers to the types shown on the marker map.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6105
diff changeset
159
7969
62eff8b34a8d Editor, Mini Editor
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7960
diff changeset
160 EncloseChars = {
62eff8b34a8d Editor, Mini Editor
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7960
diff changeset
161 '"': '"',
62eff8b34a8d Editor, Mini Editor
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7960
diff changeset
162 "'": "'",
62eff8b34a8d Editor, Mini Editor
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7960
diff changeset
163 "(": "()",
62eff8b34a8d Editor, Mini Editor
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7960
diff changeset
164 ")": "()",
62eff8b34a8d Editor, Mini Editor
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7960
diff changeset
165 "{": "{}", # __IGNORE_WARNING_M613__
62eff8b34a8d Editor, Mini Editor
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7960
diff changeset
166 "}": "{}", # __IGNORE_WARNING_M613__
62eff8b34a8d Editor, Mini Editor
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7960
diff changeset
167 "[": "[]",
62eff8b34a8d Editor, Mini Editor
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7960
diff changeset
168 "]": "[]",
62eff8b34a8d Editor, Mini Editor
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7960
diff changeset
169 "<": "<>",
62eff8b34a8d Editor, Mini Editor
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7960
diff changeset
170 ">": "<>",
62eff8b34a8d Editor, Mini Editor
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7960
diff changeset
171 }
62eff8b34a8d Editor, Mini Editor
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7960
diff changeset
172
4891
d6e8171d2c02 Fixed an issue causing a crash with latest PyQt5 (5.6).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4814
diff changeset
173 def __init__(self, dbs, fn="", vm=None,
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
174 filetype="", editor=None, tv=None):
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
175 """
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
176 Constructor
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
177
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
178 @param dbs reference to the debug server object
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
179 @param fn name of the file to be opened (string). If it is None,
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
180 a new (empty) editor is opened
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2959
diff changeset
181 @param vm reference to the view manager object
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2959
diff changeset
182 (ViewManager.ViewManager)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
183 @param filetype type of the source file (string)
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
184 @param editor reference to an Editor object, if this is a cloned view
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
185 @param tv reference to the task viewer object
7836
2f0d208b8137 Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7790
diff changeset
186 @exception OSError raised to indicate an issue accessing the file
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
187 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2517
diff changeset
188 super(Editor, self).__init__()
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
189 self.setAttribute(Qt.WA_KeyCompression)
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
190 self.setUtf8(True)
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
191
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
192 self.dbs = dbs
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
193 self.taskViewer = tv
7306
7cb88e04e4c0 Editor:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7293
diff changeset
194 self.__setFileName(fn)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
195 self.vm = vm
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
196 self.filetype = filetype
788
5b1b59777460 Added a feature where flags can be given at the end of a source file. The only flag supported is 'FileType' to overwrite the filetype detection mechanism.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 777
diff changeset
197 self.filetypeByFlag = False
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
198 self.noName = ""
252
05692e3d37bf Some code cleanup in Editor.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
199 self.project = e5App().getObject("Project")
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
200
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
201 # clear some variables
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
202 self.lastHighlight = None # remember the last highlighted line
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
203 self.lastErrorMarker = None # remember the last error line
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
204 self.lastCurrMarker = None # remember the last current line
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
205
2905
a1ae4b297bc0 Added capability to have different warning styles to the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2904
diff changeset
206 self.breaks = {}
3621
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
207 # key: marker handle,
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
208 # value: (lineno, condition, temporary,
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
209 # enabled, ignorecount)
2905
a1ae4b297bc0 Added capability to have different warning styles to the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2904
diff changeset
210 self.bookmarks = []
3621
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
211 # bookmarks are just a list of handles to the
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
212 # bookmark markers
2905
a1ae4b297bc0 Added capability to have different warning styles to the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2904
diff changeset
213 self.syntaxerrors = {}
3621
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
214 # key: marker handle
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
215 # value: list of (error message, error index)
2905
a1ae4b297bc0 Added capability to have different warning styles to the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2904
diff changeset
216 self.warnings = {}
3621
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
217 # key: marker handle
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
218 # value: list of (warning message, warning type)
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
219 self.notcoveredMarkers = [] # just a list of marker handles
2391
f9a6a512bc1e Added functionality to refresh the coverage markers of an editor if such are shown.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
220 self.showingNotcoveredMarkers = False
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
221
6105
cbd34d558bd9 Finished implementing support for EditorConfig for the IDE editor component and the standalone editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6101
diff changeset
222 self.lexer_ = None
7293
4738aac944e6 Editor: fixed an issue determining the tab and indentation width override.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7278
diff changeset
223 self.apiLanguage = ''
6105
cbd34d558bd9 Finished implementing support for EditorConfig for the IDE editor component and the standalone editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6101
diff changeset
224
6099
a7fecbc392d7 Started implementing support for EditorConfig.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6092
diff changeset
225 self.__loadEditorConfig()
a7fecbc392d7 Started implementing support for EditorConfig.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6092
diff changeset
226
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
227 self.condHistory = []
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
228 self.__lexerReset = False
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
229 self.completer = None
6099
a7fecbc392d7 Started implementing support for EditorConfig.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6092
diff changeset
230 self.encoding = self.__getEditorConfig("DefaultEncoding")
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
231 self.lastModified = 0
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
232 self.line = -1
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
233 self.inReopenPrompt = False
3621
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
234 # true if the prompt to reload a changed source is present
2905
a1ae4b297bc0 Added capability to have different warning styles to the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2904
diff changeset
235 self.inFileRenamed = False
3621
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
236 # true if we are propagating a rename action
2905
a1ae4b297bc0 Added capability to have different warning styles to the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2904
diff changeset
237 self.inLanguageChanged = False
3621
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
238 # true if we are propagating a language change
2905
a1ae4b297bc0 Added capability to have different warning styles to the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2904
diff changeset
239 self.inEolChanged = False
3621
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
240 # true if we are propagating an eol change
2905
a1ae4b297bc0 Added capability to have different warning styles to the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2904
diff changeset
241 self.inEncodingChanged = False
3621
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
242 # true if we are propagating an encoding change
2905
a1ae4b297bc0 Added capability to have different warning styles to the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2904
diff changeset
243 self.inDragDrop = False
3621
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
244 # true if we are in drop mode
2905
a1ae4b297bc0 Added capability to have different warning styles to the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2904
diff changeset
245 self.inLinesChanged = False
3621
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
246 # true if we are propagating a lines changed event
2905
a1ae4b297bc0 Added capability to have different warning styles to the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2904
diff changeset
247 self.__hasTaskMarkers = False
3621
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
248 # no task markers present
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
249
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
250 self.macros = {} # list of defined macros
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
251 self.curMacro = None
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
252 self.recording = False
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
253
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
254 self.acAPI = False
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
255
1169
36a3bb21e6e6 Added editor actions to go to the last edit location and to the previous or next Python or Ruby class or method definition.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
256 self.__lastEditPosition = None
3863
472eb955ff9c Corrected the annotations scrollbar fix because it caused seg faults for short files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3861
diff changeset
257 self.__annotationLines = 0
1169
36a3bb21e6e6 Added editor actions to go to the last edit location and to the previous or next Python or Ruby class or method definition.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
258
7998
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7969
diff changeset
259 self.__docstringGenerator = None
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7969
diff changeset
260
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
261 # list of clones
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
262 self.__clones = []
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
263
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
264 # clear QScintilla defined keyboard commands
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
265 # we do our own handling through the view manager
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
266 self.clearAlternateKeys()
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
267 self.clearKeys()
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
268
7393
e83e0ba6b90d Editor: moved the creation of the marker map object.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
269 self.__markerMap = EditorMarkerMap(self)
e83e0ba6b90d Editor: moved the creation of the marker map object.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
270
155
375e3c884874 Added code to transmit selections to remote editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 128
diff changeset
271 # initialize the mark occurrences timer
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
272 self.__markOccurrencesTimer = QTimer(self)
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
273 self.__markOccurrencesTimer.setSingleShot(True)
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
274 self.__markOccurrencesTimer.setInterval(
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
275 Preferences.getEditor("MarkOccurrencesTimeout"))
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
276 self.__markOccurrencesTimer.timeout.connect(self.__markOccurrences)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
277 self.__markedText = ""
4304
f85965649066 Added the search markers to the marker map of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4302
diff changeset
278 self.__searchIndicatorLines = []
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
279
155
375e3c884874 Added code to transmit selections to remote editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 128
diff changeset
280 # initialize some spellchecking stuff
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
281 self.spell = None
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
282 self.lastLine = 0
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
283 self.lastIndex = 0
7347
1afdabb901dc Editor: fixed an omission
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7339
diff changeset
284 self.__inSpellLanguageChanged = False
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
285
155
375e3c884874 Added code to transmit selections to remote editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 128
diff changeset
286 # initialize some cooperation stuff
158
6a561f87bc07 Added shared editor functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 156
diff changeset
287 self.__isSyncing = False
6a561f87bc07 Added shared editor functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 156
diff changeset
288 self.__receivedWhileSyncing = []
6a561f87bc07 Added shared editor functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 156
diff changeset
289 self.__savedText = ""
6a561f87bc07 Added shared editor functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 156
diff changeset
290 self.__inSharedEdit = False
6a561f87bc07 Added shared editor functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 156
diff changeset
291 self.__isShared = False
6a561f87bc07 Added shared editor functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 156
diff changeset
292 self.__inRemoteSharedEdit = False
155
375e3c884874 Added code to transmit selections to remote editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 128
diff changeset
293
1169
36a3bb21e6e6 Added editor actions to go to the last edit location and to the previous or next Python or Ruby class or method definition.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
294 # connect signals before loading the text
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
295 self.modificationChanged.connect(self.__modificationChanged)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
296 self.cursorPositionChanged.connect(self.__cursorPositionChanged)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
297 self.modificationAttempted.connect(self.__modificationReadOnly)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
298
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
299 # define the margins markers
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
300 self.__changeMarkerSaved = self.markerDefine(
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
301 self.__createChangeMarkerPixmap(
3039
8dd0165d805d Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
302 "OnlineChangeTraceMarkerSaved"))
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
303 self.__changeMarkerUnsaved = self.markerDefine(
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
304 self.__createChangeMarkerPixmap(
3039
8dd0165d805d Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
305 "OnlineChangeTraceMarkerUnsaved"))
5706
59458b006d76 Changed the indication of the current instruction line and the error line to use a green or red arrow instead of a colored background.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
306 self.breakpoint = self.markerDefine(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
307 UI.PixmapCache.getPixmap("break"))
5706
59458b006d76 Changed the indication of the current instruction line and the error line to use a green or red arrow instead of a colored background.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
308 self.cbreakpoint = self.markerDefine(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
309 UI.PixmapCache.getPixmap("cBreak"))
5706
59458b006d76 Changed the indication of the current instruction line and the error line to use a green or red arrow instead of a colored background.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
310 self.tbreakpoint = self.markerDefine(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
311 UI.PixmapCache.getPixmap("tBreak"))
5706
59458b006d76 Changed the indication of the current instruction line and the error line to use a green or red arrow instead of a colored background.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
312 self.tcbreakpoint = self.markerDefine(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
313 UI.PixmapCache.getPixmap("tCBreak"))
5706
59458b006d76 Changed the indication of the current instruction line and the error line to use a green or red arrow instead of a colored background.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
314 self.dbreakpoint = self.markerDefine(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
315 UI.PixmapCache.getPixmap("breakDisabled"))
5706
59458b006d76 Changed the indication of the current instruction line and the error line to use a green or red arrow instead of a colored background.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
316 self.bookmark = self.markerDefine(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
317 UI.PixmapCache.getPixmap("bookmark16"))
5706
59458b006d76 Changed the indication of the current instruction line and the error line to use a green or red arrow instead of a colored background.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
318 self.syntaxerror = self.markerDefine(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
319 UI.PixmapCache.getPixmap("syntaxError"))
5706
59458b006d76 Changed the indication of the current instruction line and the error line to use a green or red arrow instead of a colored background.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
320 self.notcovered = self.markerDefine(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
321 UI.PixmapCache.getPixmap("notcovered"))
5706
59458b006d76 Changed the indication of the current instruction line and the error line to use a green or red arrow instead of a colored background.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
322 self.taskmarker = self.markerDefine(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
323 UI.PixmapCache.getPixmap("task"))
5706
59458b006d76 Changed the indication of the current instruction line and the error line to use a green or red arrow instead of a colored background.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5631
diff changeset
324 self.warning = self.markerDefine(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
325 UI.PixmapCache.getPixmap("warning"))
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
326
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
327 # define the line markers
5733
aed3e558407f Reintroduced the highlighting of current instruction line and the error line using colored background. It is configurable whether to use these backgrounds or the arrows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5706
diff changeset
328 if Preferences.getEditor("LineMarkersBackground"):
aed3e558407f Reintroduced the highlighting of current instruction line and the error line using colored background. It is configurable whether to use these backgrounds or the arrows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5706
diff changeset
329 self.currentline = self.markerDefine(QsciScintilla.Background)
aed3e558407f Reintroduced the highlighting of current instruction line and the error line using colored background. It is configurable whether to use these backgrounds or the arrows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5706
diff changeset
330 self.errorline = self.markerDefine(QsciScintilla.Background)
aed3e558407f Reintroduced the highlighting of current instruction line and the error line using colored background. It is configurable whether to use these backgrounds or the arrows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5706
diff changeset
331 self.__setLineMarkerColours()
aed3e558407f Reintroduced the highlighting of current instruction line and the error line using colored background. It is configurable whether to use these backgrounds or the arrows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5706
diff changeset
332 else:
aed3e558407f Reintroduced the highlighting of current instruction line and the error line using colored background. It is configurable whether to use these backgrounds or the arrows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5706
diff changeset
333 self.currentline = self.markerDefine(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
334 UI.PixmapCache.getPixmap("currentLineMarker"))
5733
aed3e558407f Reintroduced the highlighting of current instruction line and the error line using colored background. It is configurable whether to use these backgrounds or the arrows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5706
diff changeset
335 self.errorline = self.markerDefine(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
336 UI.PixmapCache.getPixmap("errorLineMarker"))
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
337
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7261
diff changeset
338 self.breakpointMask = (
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7261
diff changeset
339 (1 << self.breakpoint) |
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7261
diff changeset
340 (1 << self.cbreakpoint) |
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7261
diff changeset
341 (1 << self.tbreakpoint) |
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7261
diff changeset
342 (1 << self.tcbreakpoint) |
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7261
diff changeset
343 (1 << self.dbreakpoint)
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7261
diff changeset
344 )
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7261
diff changeset
345
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7261
diff changeset
346 self.changeMarkersMask = (
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7261
diff changeset
347 (1 << self.__changeMarkerSaved) |
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7261
diff changeset
348 (1 << self.__changeMarkerUnsaved)
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7261
diff changeset
349 )
2164
d67b14a3f884 Improved the change tracing function by marking saved and unsaved changes differently.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2163
diff changeset
350
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
351 # configure the margins
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
352 self.__setMarginsDisplay()
2640
dedcd4f987e0 Changed the line numbers margin to adjust themselves to the size needed (Editor, Mini Editor, Shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2632
diff changeset
353 self.linesChanged.connect(self.__resizeLinenoMargin)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
354
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
355 self.marginClicked.connect(self.__marginClicked)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
356
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
357 # set the eol mode
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
358 self.__setEolMode()
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
359
728
3ee110082fb7 Finished implementing the display of annotations .
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 726
diff changeset
360 # set the text display
3ee110082fb7 Finished implementing the display of annotations .
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 726
diff changeset
361 self.__setTextDisplay()
3ee110082fb7 Finished implementing the display of annotations .
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 726
diff changeset
362
2959
86ad8854361b Corrected an issue in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2955
diff changeset
363 # initialize the online syntax check timer
3972
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
364 try:
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
365 self.syntaxCheckService = e5App().getObject('SyntaxCheckService')
4503
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4498
diff changeset
366 self.syntaxCheckService.syntaxChecked.connect(
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4498
diff changeset
367 self.__processSyntaxCheckResult)
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4498
diff changeset
368 self.syntaxCheckService.error.connect(
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4498
diff changeset
369 self.__processSyntaxCheckError)
3972
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
370 self.__initOnlineSyntaxCheck()
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
371 except KeyError:
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
372 self.syntaxCheckService = None
2959
86ad8854361b Corrected an issue in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2955
diff changeset
373
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
374 self.isResourcesFile = False
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
375 if editor is None:
4891
d6e8171d2c02 Fixed an issue causing a crash with latest PyQt5 (5.6).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4814
diff changeset
376 if self.fileName:
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7261
diff changeset
377 if (
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7261
diff changeset
378 (QFileInfo(self.fileName).size() // 1024) >
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7261
diff changeset
379 Preferences.getEditor("WarnFilesize")
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7261
diff changeset
380 ):
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3011
diff changeset
381 res = E5MessageBox.yesNo(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3011
diff changeset
382 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
383 self.tr("Open File"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
384 self.tr("""<p>The size of the file <b>{0}</b>"""
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
385 """ is <b>{1} KB</b>."""
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
386 """ Do you really want to load it?</p>""")
3039
8dd0165d805d Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
387 .format(self.fileName,
8dd0165d805d Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
388 QFileInfo(self.fileName).size() // 1024),
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
389 icon=E5MessageBox.Warning)
541
00e1a5d060c5 Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 539
diff changeset
390 if not res:
7836
2f0d208b8137 Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7790
diff changeset
391 raise OSError()
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
392 self.readFile(self.fileName, True)
3446
5a670e55adbb Improved the way the Python variant of a source file is detected (thanks to Tobias Rzepka).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3441
diff changeset
393 self.__bindLexer(self.fileName)
5a670e55adbb Improved the way the Python variant of a source file is detected (thanks to Tobias Rzepka).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3441
diff changeset
394 self.__bindCompleter(self.fileName)
3579
eccd12461319 BackgroundService: Restart of the client in different situations handled.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3576
diff changeset
395 self.checkSyntax()
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
396 self.isResourcesFile = self.fileName.endswith(".qrc")
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
397
7278
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7276
diff changeset
398 self.__convertTabs()
1820a0344b62 Editor: added configuration option to set the tab and indentation width for each languages separately (as an override to the global ones).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7276
diff changeset
399
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
400 self.recolor()
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
401 else:
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
402 # clone the given editor
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
403 self.setDocument(editor.document())
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
404 self.breaks = editor.breaks
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
405 self.bookmarks = editor.bookmarks
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
406 self.syntaxerrors = editor.syntaxerrors
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
407 self.notcoveredMarkers = editor.notcoveredMarkers
2391
f9a6a512bc1e Added functionality to refresh the coverage markers of an editor if such are shown.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
408 self.showingNotcoveredMarkers = editor.showingNotcoveredMarkers
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
409 self.isResourcesFile = editor.isResourcesFile
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
410 self.lastModified = editor.lastModified
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
411
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
412 self.addClone(editor)
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
413 editor.addClone(self)
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
414
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
415 self.gotoLine(1)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
416
741
137cc6344b48 Fixed an issue in the Editor class introduced by the annotation job.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 730
diff changeset
417 # set the text display again
137cc6344b48 Fixed an issue in the Editor class introduced by the annotation job.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 730
diff changeset
418 self.__setTextDisplay()
137cc6344b48 Fixed an issue in the Editor class introduced by the annotation job.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 730
diff changeset
419
5886
ba6d27371e25 Implemented support for asynchroneous completion lists in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5881
diff changeset
420 # set the auto-completion function
ba6d27371e25 Implemented support for asynchroneous completion lists in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5881
diff changeset
421 self.__acContext = True
ba6d27371e25 Implemented support for asynchroneous completion lists in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5881
diff changeset
422 self.__acText = ""
ba6d27371e25 Implemented support for asynchroneous completion lists in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5881
diff changeset
423 self.__acCompletions = set()
5932
af9aa23e12ec Fallback option for using QScintilla if no auto completion found by plug-ins.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5919
diff changeset
424 self.__acCompletionsFinished = 0
5888
f23f3d2b7516 Added a cache for the already determined completion lists.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5887
diff changeset
425 self.__acCache = E5Cache(
f23f3d2b7516 Added a cache for the already determined completion lists.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5887
diff changeset
426 size=Preferences.getEditor("AutoCompletionCacheSize"))
5909
21d90a3abc7c Added a timeout configuration value to the completions cache after which completions will be removed from the cache.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5907
diff changeset
427 self.__acCache.setMaximumCacheTime(
21d90a3abc7c Added a timeout configuration value to the completions cache after which completions will be removed from the cache.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5907
diff changeset
428 Preferences.getEditor("AutoCompletionCacheTime"))
6755
009812744917 Editor: added an option to disable the caching of completion results.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6735
diff changeset
429 self.__acCacheEnabled = Preferences.getEditor(
009812744917 Editor: added an option to disable the caching of completion results.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6735
diff changeset
430 "AutoCompletionCacheEnabled")
5886
ba6d27371e25 Implemented support for asynchroneous completion lists in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5881
diff changeset
431 self.__acTimer = QTimer(self)
ba6d27371e25 Implemented support for asynchroneous completion lists in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5881
diff changeset
432 self.__acTimer.setSingleShot(True)
ba6d27371e25 Implemented support for asynchroneous completion lists in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5881
diff changeset
433 self.__acTimer.setInterval(
ba6d27371e25 Implemented support for asynchroneous completion lists in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5881
diff changeset
434 Preferences.getEditor("AutoCompletionTimeout"))
ba6d27371e25 Implemented support for asynchroneous completion lists in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5881
diff changeset
435 self.__acTimer.timeout.connect(self.__autoComplete)
ba6d27371e25 Implemented support for asynchroneous completion lists in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5881
diff changeset
436
5932
af9aa23e12ec Fallback option for using QScintilla if no auto completion found by plug-ins.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5919
diff changeset
437 self.__acWatchdog = QTimer(self)
af9aa23e12ec Fallback option for using QScintilla if no auto completion found by plug-ins.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5919
diff changeset
438 self.__acWatchdog.setSingleShot(True)
af9aa23e12ec Fallback option for using QScintilla if no auto completion found by plug-ins.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5919
diff changeset
439 self.__acWatchdog.setInterval(
af9aa23e12ec Fallback option for using QScintilla if no auto completion found by plug-ins.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5919
diff changeset
440 Preferences.getEditor("AutoCompletionWatchdogTime"))
af9aa23e12ec Fallback option for using QScintilla if no auto completion found by plug-ins.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5919
diff changeset
441 self.__acWatchdog.timeout.connect(self.autoCompleteQScintilla)
af9aa23e12ec Fallback option for using QScintilla if no auto completion found by plug-ins.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5919
diff changeset
442
6117
4cc6c171ecf6 Little performance improvement of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6116
diff changeset
443 self.userListActivated.connect(self.__completionListSelected)
6306
af71f34a0cfb Enable resizing of auto complete list box for also for QScintilla own completers.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6305
diff changeset
444 self.SCN_CHARADDED.connect(self.__charAdded)
af71f34a0cfb Enable resizing of auto complete list box for also for QScintilla own completers.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6305
diff changeset
445 self.SCN_AUTOCCANCELLED.connect(self.__autocompletionCancelled)
6117
4cc6c171ecf6 Little performance improvement of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6116
diff changeset
446
4271
480434472ac1 Added capability to the editor to ask multiple completion list and call-tip providers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4227
diff changeset
447 self.__completionListHookFunctions = {}
5886
ba6d27371e25 Implemented support for asynchroneous completion lists in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5881
diff changeset
448 self.__completionListAsyncHookFunctions = {}
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
449 self.__setAutoCompletion()
5881
13381dbbb81e Removed the pre 6.1.0 auto-completion and call-tip hook interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
450
5886
ba6d27371e25 Implemented support for asynchroneous completion lists in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5881
diff changeset
451 # set the call-tips function
4271
480434472ac1 Added capability to the editor to ask multiple completion list and call-tip providers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4227
diff changeset
452 self.__ctHookFunctions = {}
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
453 self.__setCallTips()
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
454
4286
255f56eb7f05 Started implementing support for mouse click handlers into the Editor. This can be used by plug-ins to implement function executed by a mouse click (e.g. goto definition upon Ctrl+Left Button).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4283
diff changeset
455 # set the mouse click handlers (fired on mouse release)
255f56eb7f05 Started implementing support for mouse click handlers into the Editor. This can be used by plug-ins to implement function executed by a mouse click (e.g. goto definition upon Ctrl+Left Button).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4283
diff changeset
456 self.__mouseClickHandlers = {}
255f56eb7f05 Started implementing support for mouse click handlers into the Editor. This can be used by plug-ins to implement function executed by a mouse click (e.g. goto definition upon Ctrl+Left Button).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4283
diff changeset
457 # dictionary with tuple of keyboard modifier and mouse button as key
255f56eb7f05 Started implementing support for mouse click handlers into the Editor. This can be used by plug-ins to implement function executed by a mouse click (e.g. goto definition upon Ctrl+Left Button).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4283
diff changeset
458 # and tuple of plug-in name and function as value
255f56eb7f05 Started implementing support for mouse click handlers into the Editor. This can be used by plug-ins to implement function executed by a mouse click (e.g. goto definition upon Ctrl+Left Button).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4283
diff changeset
459
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
460 sh = self.sizeHint()
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
461 if sh.height() < 300:
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
462 sh.setHeight(300)
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
463 self.resize(sh)
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
464
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
465 # Make sure tabbing through a QWorkspace works.
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
466 self.setFocusPolicy(Qt.StrongFocus)
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
467
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
468 self.__updateReadOnly(True)
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
469
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
470 self.setWhatsThis(self.tr(
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
471 """<b>A Source Editor Window</b>"""
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
472 """<p>This window is used to display and edit a source file."""
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
473 """ You can open as many of these as you like. The name of the"""
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
474 """ file is displayed in the window's titlebar.</p>"""
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
475 """<p>In order to set breakpoints just click in the space"""
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
476 """ between the line numbers and the fold markers. Via the"""
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
477 """ context menu of the margins they may be edited.</p>"""
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
478 """<p>In order to set bookmarks just Shift click in the space"""
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
479 """ between the line numbers and the fold markers.</p>"""
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
480 """<p>These actions can be reversed via the context menu.</p>"""
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
481 """<p>Ctrl clicking on a syntax error marker shows some info"""
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
482 """ about this error.</p>"""
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
483 ))
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
484
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
485 # Set the editors size, if it is too big for the view manager.
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
486 if self.vm is not None:
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
487 req = self.size()
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
488 bnd = req.boundedTo(self.vm.size())
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
489
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
490 if bnd.width() < req.width() or bnd.height() < req.height():
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
491 self.resize(bnd)
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
492
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
493 # set the autosave flag
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
494 self.autosaveEnabled = Preferences.getEditor("AutosaveInterval") > 0
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
495 self.autosaveManuallyDisabled = False
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
496
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
497 self.__initContextMenu()
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
498 self.__initContextMenuMargins()
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
499
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
500 self.__checkEol()
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
501 if editor is None:
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
502 self.__checkLanguage()
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
503 self.__checkEncoding()
7310
460a332dcc56 Editor: added a context menu to select spell check language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7306
diff changeset
504 self.__checkSpellLanguage()
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
505 else:
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
506 # it's a clone
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
507 self.__languageChanged(editor.apiLanguage, propagate=False)
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
508 self.__encodingChanged(editor.encoding, propagate=False)
7310
460a332dcc56 Editor: added a context menu to select spell check language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7306
diff changeset
509 self.__spellLanguageChanged(editor.getSpellingLanguage(),
460a332dcc56 Editor: added a context menu to select spell check language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7306
diff changeset
510 propagate=False)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
511
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
512 self.setAcceptDrops(True)
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
513
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
514 # breakpoint handling
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
515 self.breakpointModel = self.dbs.getBreakPointModel()
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
516 self.__restoreBreakpoints()
460
6a3899e91d76 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 448
diff changeset
517 self.breakpointModel.rowsAboutToBeRemoved.connect(
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
518 self.__deleteBreakPoints)
460
6a3899e91d76 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 448
diff changeset
519 self.breakpointModel.dataAboutToBeChanged.connect(
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
520 self.__breakPointDataAboutToBeChanged)
460
6a3899e91d76 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 448
diff changeset
521 self.breakpointModel.dataChanged.connect(
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
522 self.__changeBreakPoints)
460
6a3899e91d76 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 448
diff changeset
523 self.breakpointModel.rowsInserted.connect(
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
524 self.__addBreakPoints)
1928
adde55ed4ce5 Fixed the breakpoint performance issue properly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1897
diff changeset
525 self.SCN_MODIFIED.connect(self.__modified)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
526
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
527 # establish connection to some ViewManager action groups
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
528 self.addActions(self.vm.editorActGrp.actions())
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
529 self.addActions(self.vm.editActGrp.actions())
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
530 self.addActions(self.vm.copyActGrp.actions())
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
531 self.addActions(self.vm.viewActGrp.actions())
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
532
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
533 # register images to be shown in autocompletion lists
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
534 self.__registerImages()
1169
36a3bb21e6e6 Added editor actions to go to the last edit location and to the previous or next Python or Ruby class or method definition.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
535
36a3bb21e6e6 Added editor actions to go to the last edit location and to the previous or next Python or Ruby class or method definition.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
536 # connect signals after loading the text
36a3bb21e6e6 Added editor actions to go to the last edit location and to the previous or next Python or Ruby class or method definition.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
537 self.textChanged.connect(self.__textChanged)
1353
e1c0af081a8e Added a syntax check while typing function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1308
diff changeset
538
2162
4627e6ea7b6b Added capability to mark changed lines and to navigate between them to the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
539 # initialize the online change trace timer
4627e6ea7b6b Added capability to mark changed lines and to navigate between them to the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
540 self.__initOnlineChangeTrace()
4627e6ea7b6b Added capability to mark changed lines and to navigate between them to the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
541
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7261
diff changeset
542 if (
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7261
diff changeset
543 self.fileName and
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7261
diff changeset
544 self.project.isOpen() and
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7261
diff changeset
545 self.project.isProjectSource(self.fileName)
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7261
diff changeset
546 ):
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
547 self.project.projectPropertiesChanged.connect(
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
548 self.__projectPropertiesChanged)
1754
4e2f87d03546 Fixed an issue in the editor caused by double connecting to a signal.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1723
diff changeset
549
1518
e6e21910210d Added capability to zoom by a pinch gesture to the editor, the shell, the terminal, the web browser and various graphics related windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
550 self.grabGesture(Qt.PinchGesture)
3329
1ee38e29ed4f Continued implementing support for a marker map in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3327
diff changeset
551
1ee38e29ed4f Continued implementing support for a marker map in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3327
diff changeset
552 self.SCN_ZOOM.connect(self.__markerMap.update)
1ee38e29ed4f Continued implementing support for a marker map in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3327
diff changeset
553 self.__markerMap.update()
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
554
7306
7cb88e04e4c0 Editor:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7293
diff changeset
555 def __setFileName(self, name):
7cb88e04e4c0 Editor:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7293
diff changeset
556 """
7cb88e04e4c0 Editor:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7293
diff changeset
557 Private method to set the file name of the current file.
7cb88e04e4c0 Editor:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7293
diff changeset
558
7cb88e04e4c0 Editor:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7293
diff changeset
559 @param name name of the current file
7cb88e04e4c0 Editor:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7293
diff changeset
560 @type str
7cb88e04e4c0 Editor:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7293
diff changeset
561 """
7cb88e04e4c0 Editor:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7293
diff changeset
562 self.fileName = name
7cb88e04e4c0 Editor:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7293
diff changeset
563
7cb88e04e4c0 Editor:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7293
diff changeset
564 if self.fileName:
7cb88e04e4c0 Editor:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7293
diff changeset
565 self.__fileNameExtension = (
7cb88e04e4c0 Editor:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7293
diff changeset
566 os.path.splitext(self.fileName)[1][1:].lower()
7cb88e04e4c0 Editor:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7293
diff changeset
567 )
7cb88e04e4c0 Editor:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7293
diff changeset
568 else:
7cb88e04e4c0 Editor:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7293
diff changeset
569 self.__fileNameExtension = ""
7cb88e04e4c0 Editor:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7293
diff changeset
570
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
571 def __registerImages(self):
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
572 """
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
573 Private method to register images for autocompletion lists.
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
574 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
575 self.registerImage(self.ClassID,
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
576 UI.PixmapCache.getPixmap("class"))
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
577 self.registerImage(self.ClassProtectedID,
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
578 UI.PixmapCache.getPixmap("class_protected"))
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
579 self.registerImage(self.ClassPrivateID,
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
580 UI.PixmapCache.getPixmap("class_private"))
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
581 self.registerImage(self.MethodID,
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
582 UI.PixmapCache.getPixmap("method"))
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
583 self.registerImage(self.MethodProtectedID,
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
584 UI.PixmapCache.getPixmap("method_protected"))
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
585 self.registerImage(self.MethodPrivateID,
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
586 UI.PixmapCache.getPixmap("method_private"))
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
587 self.registerImage(self.AttributeID,
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
588 UI.PixmapCache.getPixmap("attribute"))
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
589 self.registerImage(self.AttributeProtectedID,
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
590 UI.PixmapCache.getPixmap("attribute_protected"))
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
591 self.registerImage(self.AttributePrivateID,
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
592 UI.PixmapCache.getPixmap("attribute_private"))
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
593 self.registerImage(self.EnumID,
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
594 UI.PixmapCache.getPixmap("enum"))
5894
0d4431926611 Two additional autocomplete icons.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5891
diff changeset
595 self.registerImage(self.KeywordsID,
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
596 UI.PixmapCache.getPixmap("keywords"))
5894
0d4431926611 Two additional autocomplete icons.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5891
diff changeset
597 self.registerImage(self.ModuleID,
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
598 UI.PixmapCache.getPixmap("module"))
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
599
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
600 self.registerImage(self.FromDocumentID,
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
601 UI.PixmapCache.getPixmap("editor"))
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
602
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
603 self.registerImage(self.TemplateImageID,
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
604 UI.PixmapCache.getPixmap("templateViewer"))
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
605
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
606 def addClone(self, editor):
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
607 """
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
608 Public method to add a clone to our list.
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
609
6052
8b49d3e0b4c8 Extended the session to store/retrieve the split views and the order of the editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
610 @param editor reference to the cloned editor
8b49d3e0b4c8 Extended the session to store/retrieve the split views and the order of the editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
611 @type Editor
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
612 """
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
613 self.__clones.append(editor)
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
614
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
615 editor.editorRenamed.connect(self.fileRenamed)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
616 editor.languageChanged.connect(self.languageChanged)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
617 editor.eolChanged.connect(self.__eolChanged)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
618 editor.encodingChanged.connect(self.__encodingChanged)
7310
460a332dcc56 Editor: added a context menu to select spell check language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7306
diff changeset
619 editor.spellLanguageChanged.connect(self.__spellLanguageChanged)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
620
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
621 def removeClone(self, editor):
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
622 """
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
623 Public method to remove a clone from our list.
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
624
6052
8b49d3e0b4c8 Extended the session to store/retrieve the split views and the order of the editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
625 @param editor reference to the cloned editor
8b49d3e0b4c8 Extended the session to store/retrieve the split views and the order of the editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
626 @type Editor
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
627 """
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
628 if editor in self.__clones:
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
629 editor.editorRenamed.disconnect(self.fileRenamed)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
630 editor.languageChanged.disconnect(self.languageChanged)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
631 editor.eolChanged.disconnect(self.__eolChanged)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
632 editor.encodingChanged.disconnect(self.__encodingChanged)
7310
460a332dcc56 Editor: added a context menu to select spell check language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7306
diff changeset
633 editor.spellLanguageChanged.disconnect(self.__spellLanguageChanged)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
634 self.__clones.remove(editor)
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
635
6052
8b49d3e0b4c8 Extended the session to store/retrieve the split views and the order of the editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
636 def isClone(self, editor):
8b49d3e0b4c8 Extended the session to store/retrieve the split views and the order of the editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
637 """
8b49d3e0b4c8 Extended the session to store/retrieve the split views and the order of the editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
638 Public method to test, if the given editor is a clone.
8b49d3e0b4c8 Extended the session to store/retrieve the split views and the order of the editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
639
8b49d3e0b4c8 Extended the session to store/retrieve the split views and the order of the editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
640 @param editor reference to the cloned editor
8b49d3e0b4c8 Extended the session to store/retrieve the split views and the order of the editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
641 @type Editor
8b49d3e0b4c8 Extended the session to store/retrieve the split views and the order of the editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
642 @return flag indicating a clone
8b49d3e0b4c8 Extended the session to store/retrieve the split views and the order of the editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
643 @rtype bool
8b49d3e0b4c8 Extended the session to store/retrieve the split views and the order of the editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
644 """
8b49d3e0b4c8 Extended the session to store/retrieve the split views and the order of the editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
645 return editor in self.__clones
8b49d3e0b4c8 Extended the session to store/retrieve the split views and the order of the editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
646
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
647 def __bindName(self, line0):
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
648 """
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
649 Private method to generate a dummy filename for binding a lexer.
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
650
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2959
diff changeset
651 @param line0 first line of text to use in the generation process
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2959
diff changeset
652 (string)
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2959
diff changeset
653 @return dummy file name to be used for binding a lexer (string)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
654 """
788
5b1b59777460 Added a feature where flags can be given at the end of a source file. The only flag supported is 'FileType' to overwrite the filetype detection mechanism.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 777
diff changeset
655 bindName = ""
2221
f72f8b0478cb Extended the first line checks to determine the file type.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2219
diff changeset
656 line0 = line0.lower()
f72f8b0478cb Extended the first line checks to determine the file type.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2219
diff changeset
657
f72f8b0478cb Extended the first line checks to determine the file type.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2219
diff changeset
658 # check first line if it does not start with #!
f72f8b0478cb Extended the first line checks to determine the file type.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2219
diff changeset
659 if line0.startswith(("<html", "<!doctype html", "<?php")):
f72f8b0478cb Extended the first line checks to determine the file type.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2219
diff changeset
660 bindName = "dummy.html"
f72f8b0478cb Extended the first line checks to determine the file type.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2219
diff changeset
661 elif line0.startswith(("<?xml", "<!doctype")):
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
662 bindName = "dummy.xml"
2221
f72f8b0478cb Extended the first line checks to determine the file type.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2219
diff changeset
663 elif line0.startswith("index: "):
f72f8b0478cb Extended the first line checks to determine the file type.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2219
diff changeset
664 bindName = "dummy.diff"
f72f8b0478cb Extended the first line checks to determine the file type.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2219
diff changeset
665 elif line0.startswith("\\documentclass"):
f72f8b0478cb Extended the first line checks to determine the file type.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2219
diff changeset
666 bindName = "dummy.tex"
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
667
788
5b1b59777460 Added a feature where flags can be given at the end of a source file. The only flag supported is 'FileType' to overwrite the filetype detection mechanism.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 777
diff changeset
668 if not bindName and self.filetype:
6718
24a7a749e132 Editor, MiniEditor: harmonized the lexer determination code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
669 # check filetype
24a7a749e132 Editor, MiniEditor: harmonized the lexer determination code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
670 from . import Lexers
24a7a749e132 Editor, MiniEditor: harmonized the lexer determination code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
671 supportedLanguages = Lexers.getSupportedLanguages()
24a7a749e132 Editor, MiniEditor: harmonized the lexer determination code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
672 if self.filetype in supportedLanguages:
24a7a749e132 Editor, MiniEditor: harmonized the lexer determination code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
673 bindName = supportedLanguages[self.filetype][1]
7635
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7628
diff changeset
674 elif self.filetype in ["Python", "Python3", "MicroPython"]:
788
5b1b59777460 Added a feature where flags can be given at the end of a source file. The only flag supported is 'FileType' to overwrite the filetype detection mechanism.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 777
diff changeset
675 bindName = "dummy.py"
6718
24a7a749e132 Editor, MiniEditor: harmonized the lexer determination code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
676
788
5b1b59777460 Added a feature where flags can be given at the end of a source file. The only flag supported is 'FileType' to overwrite the filetype detection mechanism.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 777
diff changeset
677 if not bindName and line0.startswith("#!"):
6718
24a7a749e132 Editor, MiniEditor: harmonized the lexer determination code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
678 # #! marker detection
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
679 if "python3" in line0:
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
680 bindName = "dummy.py"
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
681 self.filetype = "Python3"
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
682 elif "python" in line0:
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
683 bindName = "dummy.py"
7635
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7628
diff changeset
684 self.filetype = "Python3"
6073
a679240821cb Added file type detection base on the first line being a mode line (i.e. -*- mode: python -*-)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6059
diff changeset
685 elif "pypy3" in line0:
a679240821cb Added file type detection base on the first line being a mode line (i.e. -*- mode: python -*-)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6059
diff changeset
686 bindName = "dummy.py"
a679240821cb Added file type detection base on the first line being a mode line (i.e. -*- mode: python -*-)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6059
diff changeset
687 self.filetype = "Python3"
a679240821cb Added file type detection base on the first line being a mode line (i.e. -*- mode: python -*-)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6059
diff changeset
688 elif "pypy" in line0:
a679240821cb Added file type detection base on the first line being a mode line (i.e. -*- mode: python -*-)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6059
diff changeset
689 bindName = "dummy.py"
7635
0cdead130a81 Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7628
diff changeset
690 self.filetype = "Python3"
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
691 elif ("/bash" in line0 or "/sh" in line0):
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
692 bindName = "dummy.sh"
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
693 elif "ruby" in line0:
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
694 bindName = "dummy.rb"
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
695 self.filetype = "Ruby"
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
696 elif "perl" in line0:
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
697 bindName = "dummy.pl"
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
698 elif "lua" in line0:
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
699 bindName = "dummy.lua"
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
700 elif "dmd" in line0:
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
701 bindName = "dummy.d"
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
702 self.filetype = "D"
788
5b1b59777460 Added a feature where flags can be given at the end of a source file. The only flag supported is 'FileType' to overwrite the filetype detection mechanism.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 777
diff changeset
703
5b1b59777460 Added a feature where flags can be given at the end of a source file. The only flag supported is 'FileType' to overwrite the filetype detection mechanism.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 777
diff changeset
704 if not bindName:
6073
a679240821cb Added file type detection base on the first line being a mode line (i.e. -*- mode: python -*-)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6059
diff changeset
705 # mode line detection: -*- mode: python -*-
a679240821cb Added file type detection base on the first line being a mode line (i.e. -*- mode: python -*-)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6059
diff changeset
706 match = re.search(r"mode[:=]\s*([-\w_.]+)", line0)
a679240821cb Added file type detection base on the first line being a mode line (i.e. -*- mode: python -*-)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6059
diff changeset
707 if match:
a679240821cb Added file type detection base on the first line being a mode line (i.e. -*- mode: python -*-)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6059
diff changeset
708 mode = match.group(1).lower()
a679240821cb Added file type detection base on the first line being a mode line (i.e. -*- mode: python -*-)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6059
diff changeset
709 if mode in ["python3", "pypy3"]:
a679240821cb Added file type detection base on the first line being a mode line (i.e. -*- mode: python -*-)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6059
diff changeset
710 bindName = "dummy.py"
a679240821cb Added file type detection base on the first line being a mode line (i.e. -*- mode: python -*-)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6059
diff changeset
711 self.filetype = "Python3"
a679240821cb Added file type detection base on the first line being a mode line (i.e. -*- mode: python -*-)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6059
diff changeset
712 elif mode == "ruby":
a679240821cb Added file type detection base on the first line being a mode line (i.e. -*- mode: python -*-)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6059
diff changeset
713 bindName = "dummy.rb"
a679240821cb Added file type detection base on the first line being a mode line (i.e. -*- mode: python -*-)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6059
diff changeset
714 self.filetype = "Ruby"
a679240821cb Added file type detection base on the first line being a mode line (i.e. -*- mode: python -*-)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6059
diff changeset
715 elif mode == "perl":
a679240821cb Added file type detection base on the first line being a mode line (i.e. -*- mode: python -*-)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6059
diff changeset
716 bindName = "dummy.pl"
a679240821cb Added file type detection base on the first line being a mode line (i.e. -*- mode: python -*-)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6059
diff changeset
717 elif mode == "lua":
a679240821cb Added file type detection base on the first line being a mode line (i.e. -*- mode: python -*-)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6059
diff changeset
718 bindName = "dummy.lua"
a679240821cb Added file type detection base on the first line being a mode line (i.e. -*- mode: python -*-)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6059
diff changeset
719 elif mode in ["dmd", "d"]:
a679240821cb Added file type detection base on the first line being a mode line (i.e. -*- mode: python -*-)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6059
diff changeset
720 bindName = "dummy.d"
a679240821cb Added file type detection base on the first line being a mode line (i.e. -*- mode: python -*-)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6059
diff changeset
721 self.filetype = "D"
a679240821cb Added file type detection base on the first line being a mode line (i.e. -*- mode: python -*-)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6059
diff changeset
722
a679240821cb Added file type detection base on the first line being a mode line (i.e. -*- mode: python -*-)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6059
diff changeset
723 if not bindName:
788
5b1b59777460 Added a feature where flags can be given at the end of a source file. The only flag supported is 'FileType' to overwrite the filetype detection mechanism.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 777
diff changeset
724 bindName = self.fileName
5b1b59777460 Added a feature where flags can be given at the end of a source file. The only flag supported is 'FileType' to overwrite the filetype detection mechanism.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 777
diff changeset
725
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
726 return bindName
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
727
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
728 def getMenu(self, menuName):
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
729 """
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
730 Public method to get a reference to the main context menu or a submenu.
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
731
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
732 @param menuName name of the menu (string)
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
733 @return reference to the requested menu (QMenu) or None
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
734 """
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
735 try:
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
736 return self.__menus[menuName]
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
737 except KeyError:
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
738 return None
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
739
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
740 def hasMiniMenu(self):
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
741 """
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
742 Public method to check the miniMenu flag.
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
743
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
744 @return flag indicating a minimized context menu (boolean)
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
745 """
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
746 return self.miniMenu
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
747
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
748 def __initContextMenu(self):
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
749 """
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2959
diff changeset
750 Private method used to setup the context menu.
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
751 """
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
752 self.miniMenu = Preferences.getEditor("MiniContextMenu")
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
753
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
754 self.menuActs = {}
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
755 self.menu = QMenu()
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
756 self.__menus = {
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 939
diff changeset
757 "Main": self.menu,
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
758 }
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
759
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
760 self.languagesMenu = self.__initContextMenuLanguages()
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
761 self.__menus["Languages"] = self.languagesMenu
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
762 if self.isResourcesFile:
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
763 self.resourcesMenu = self.__initContextMenuResources()
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
764 self.__menus["Resources"] = self.resourcesMenu
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
765 else:
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
766 self.checksMenu = self.__initContextMenuChecks()
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
767 self.menuShow = self.__initContextMenuShow()
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
768 self.graphicsMenu = self.__initContextMenuGraphics()
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
769 self.autocompletionMenu = self.__initContextMenuAutocompletion()
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
770 self.__menus["Checks"] = self.checksMenu
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
771 self.__menus["Show"] = self.menuShow
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
772 self.__menus["Graphics"] = self.graphicsMenu
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
773 self.__menus["Autocompletion"] = self.autocompletionMenu
3583
3e8e0346d639 Re-fixed the recent editor issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3581
diff changeset
774 self.toolsMenu = self.__initContextMenuTools()
3e8e0346d639 Re-fixed the recent editor issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3581
diff changeset
775 self.__menus["Tools"] = self.toolsMenu
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
776 self.exportersMenu = self.__initContextMenuExporters()
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
777 self.__menus["Exporters"] = self.exportersMenu
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
778 self.eolMenu = self.__initContextMenuEol()
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
779 self.__menus["Eol"] = self.eolMenu
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
780 self.encodingsMenu = self.__initContextMenuEncodings()
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
781 self.__menus["Encodings"] = self.encodingsMenu
7310
460a332dcc56 Editor: added a context menu to select spell check language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7306
diff changeset
782 self.spellLanguagesMenu = self.__initContextMenuSpellLanguages()
460a332dcc56 Editor: added a context menu to select spell check language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7306
diff changeset
783 self.__menus["SpellLanguages"] = self.spellLanguagesMenu
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
784
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
785 self.menuActs["Undo"] = self.menu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
786 UI.PixmapCache.getIcon("editUndo"),
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
787 self.tr('Undo'), self.undo)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
788 self.menuActs["Redo"] = self.menu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
789 UI.PixmapCache.getIcon("editRedo"),
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
790 self.tr('Redo'), self.redo)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
791 self.menuActs["Revert"] = self.menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
792 self.tr("Revert to last saved state"),
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
793 self.revertToUnmodified)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
794 self.menu.addSeparator()
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
795 self.menuActs["Cut"] = self.menu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
796 UI.PixmapCache.getIcon("editCut"),
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
797 self.tr('Cut'), self.cut)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
798 self.menuActs["Copy"] = self.menu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
799 UI.PixmapCache.getIcon("editCopy"),
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
800 self.tr('Copy'), self.copy)
6059
8f7c66c53c27 Added a context menu entry to "Execute Selection In Console".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6052
diff changeset
801 self.menuActs["Paste"] = self.menu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
802 UI.PixmapCache.getIcon("editPaste"),
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
803 self.tr('Paste'), self.paste)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
804 if not self.miniMenu:
6059
8f7c66c53c27 Added a context menu entry to "Execute Selection In Console".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6052
diff changeset
805 self.menuActs["ExecuteSelection"] = self.menu.addAction(
8f7c66c53c27 Added a context menu entry to "Execute Selection In Console".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6052
diff changeset
806 self.tr("Execute Selection In Console"),
8f7c66c53c27 Added a context menu entry to "Execute Selection In Console".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6052
diff changeset
807 self.__executeSelection)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
808 self.menu.addSeparator()
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
809 self.menu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
810 UI.PixmapCache.getIcon("editIndent"),
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
811 self.tr('Indent'), self.indentLineOrSelection)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
812 self.menu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
813 UI.PixmapCache.getIcon("editUnindent"),
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
814 self.tr('Unindent'), self.unindentLineOrSelection)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
815 self.menuActs["Comment"] = self.menu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
816 UI.PixmapCache.getIcon("editComment"),
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
817 self.tr('Comment'), self.commentLineOrSelection)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
818 self.menuActs["Uncomment"] = self.menu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
819 UI.PixmapCache.getIcon("editUncomment"),
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
820 self.tr('Uncomment'), self.uncommentLineOrSelection)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
821 self.menuActs["StreamComment"] = self.menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
822 self.tr('Stream Comment'),
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
823 self.streamCommentLineOrSelection)
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
824 self.menuActs["BoxComment"] = self.menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
825 self.tr('Box Comment'),
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
826 self.boxCommentLineOrSelection)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
827 self.menu.addSeparator()
8000
47b15df088e4 Editor: extended the docstring functionality to be invocable via a keyboard shortcut (Ctrl+Alt+D).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7998
diff changeset
828 self.menuActs["Docstring"] = self.menu.addAction(
47b15df088e4 Editor: extended the docstring functionality to be invocable via a keyboard shortcut (Ctrl+Alt+D).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7998
diff changeset
829 self.tr("Generate Docstring"),
47b15df088e4 Editor: extended the docstring functionality to be invocable via a keyboard shortcut (Ctrl+Alt+D).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7998
diff changeset
830 self.__insertDocstring)
47b15df088e4 Editor: extended the docstring functionality to be invocable via a keyboard shortcut (Ctrl+Alt+D).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7998
diff changeset
831 self.menu.addSeparator()
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
832 self.menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
833 self.tr('Select to brace'), self.selectToMatchingBrace)
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
834 self.menu.addAction(self.tr('Select all'), self.__selectAll)
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
835 self.menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
836 self.tr('Deselect all'), self.__deselectAll)
6059
8f7c66c53c27 Added a context menu entry to "Execute Selection In Console".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6052
diff changeset
837 else:
8f7c66c53c27 Added a context menu entry to "Execute Selection In Console".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6052
diff changeset
838 self.menuActs["ExecuteSelection"] = None
8f7c66c53c27 Added a context menu entry to "Execute Selection In Console".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6052
diff changeset
839 self.menu.addSeparator()
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
840 self.menuActs["SpellCheck"] = self.menu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
841 UI.PixmapCache.getIcon("spellchecking"),
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
842 self.tr('Check spelling...'), self.checkSpelling)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
843 self.menuActs["SpellCheckSelection"] = self.menu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
844 UI.PixmapCache.getIcon("spellchecking"),
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
845 self.tr('Check spelling of selection...'),
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
846 self.__checkSpellingSelection)
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
847 self.menuActs["SpellCheckRemove"] = self.menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
848 self.tr("Remove from dictionary"),
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
849 self.__removeFromSpellingDictionary)
7310
460a332dcc56 Editor: added a context menu to select spell check language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7306
diff changeset
850 self.menuActs["SpellCheckLanguages"] = self.menu.addMenu(
460a332dcc56 Editor: added a context menu to select spell check language.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7306
diff changeset
851 self.spellLanguagesMenu)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
852 self.menu.addSeparator()
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
853 self.menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
854 self.tr('Shorten empty lines'), self.shortenEmptyLines)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
855 self.menu.addSeparator()
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
856 self.menuActs["Languages"] = self.menu.addMenu(self.languagesMenu)
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
857 self.menuActs["Encodings"] = self.menu.addMenu(self.encodingsMenu)
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
858 self.menuActs["Eol"] = self.menu.addMenu(self.eolMenu)
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
859 self.menu.addSeparator()
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
860 self.menuActs["MonospacedFont"] = self.menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
861 self.tr("Use Monospaced Font"),
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
862 self.handleMonospacedEnable)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
863 self.menuActs["MonospacedFont"].setCheckable(True)
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
864 self.menuActs["MonospacedFont"].setChecked(self.useMonospaced)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
865 self.menuActs["AutosaveEnable"] = self.menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
866 self.tr("Autosave enabled"), self.__autosaveEnable)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
867 self.menuActs["AutosaveEnable"].setCheckable(True)
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
868 self.menuActs["AutosaveEnable"].setChecked(self.autosaveEnabled)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
869 self.menuActs["TypingAidsEnabled"] = self.menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
870 self.tr("Typing aids enabled"), self.__toggleTypingAids)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
871 self.menuActs["TypingAidsEnabled"].setCheckable(True)
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
872 self.menuActs["TypingAidsEnabled"].setEnabled(
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
873 self.completer is not None)
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 559
diff changeset
874 self.menuActs["TypingAidsEnabled"].setChecked(
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
875 self.completer is not None and self.completer.isEnabled())
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
876 self.menuActs["AutoCompletionEnable"] = self.menu.addAction(
4153
95b18307079f Corrected some auto-completion related terms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4142
diff changeset
877 self.tr("Automatic Completion enabled"),
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
878 self.__toggleAutoCompletionEnable)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
879 self.menuActs["AutoCompletionEnable"].setCheckable(True)
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 559
diff changeset
880 self.menuActs["AutoCompletionEnable"].setChecked(
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
881 self.autoCompletionThreshold() != -1)
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
882 if not self.isResourcesFile:
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
883 self.menu.addMenu(self.autocompletionMenu)
4153
95b18307079f Corrected some auto-completion related terms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4142
diff changeset
884 self.menuActs["calltip"] = self.menu.addAction(
95b18307079f Corrected some auto-completion related terms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4142
diff changeset
885 self.tr('Calltip'), self.callTip)
5907
c928af9fce32 Added some code info actions to the editor context menu and the Edit main menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5905
diff changeset
886 self.menuActs["codeInfo"] = self.menu.addAction(
c928af9fce32 Added some code info actions to the editor context menu and the Edit main menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5905
diff changeset
887 self.tr('Code Info'), self.__showCodeInfo)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
888 self.menu.addSeparator()
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
889 if self.isResourcesFile:
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
890 self.menu.addMenu(self.resourcesMenu)
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
891 else:
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
892 self.menuActs["Check"] = self.menu.addMenu(self.checksMenu)
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
893 self.menu.addSeparator()
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
894 self.menuActs["Show"] = self.menu.addMenu(self.menuShow)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
895 self.menu.addSeparator()
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
896 self.menuActs["Diagrams"] = self.menu.addMenu(self.graphicsMenu)
3583
3e8e0346d639 Re-fixed the recent editor issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3581
diff changeset
897 self.menu.addSeparator()
3e8e0346d639 Re-fixed the recent editor issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3581
diff changeset
898 self.menuActs["Tools"] = self.menu.addMenu(self.toolsMenu)
3155
7e10d00e27ca Added a 'Tools' submenu to be populated by plug-ins and updated the plug-in document.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3152
diff changeset
899 self.menu.addSeparator()
3100
1c86bf655433 Added icons to the editor context menu 'New View' entries and gave them better titles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3095
diff changeset
900 self.menu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
901 UI.PixmapCache.getIcon("documentNewView"),
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
902 self.tr('New Document View'), self.__newView)
3100
1c86bf655433 Added icons to the editor context menu 'New View' entries and gave them better titles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3095
diff changeset
903 self.menuActs["NewSplit"] = self.menu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
904 UI.PixmapCache.getIcon("splitVertical"),
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
905 self.tr('New Document View (with new split)'),
3100
1c86bf655433 Added icons to the editor context menu 'New View' entries and gave them better titles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3095
diff changeset
906 self.__newViewNewSplit)
1c86bf655433 Added icons to the editor context menu 'New View' entries and gave them better titles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3095
diff changeset
907 self.menuActs["NewSplit"].setEnabled(self.vm.canSplit())
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
908 self.menu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
909 UI.PixmapCache.getIcon("close"),
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
910 self.tr('Close'), self.__contextClose)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
911 self.menu.addSeparator()
3394
d1d4d79b4f11 Added a context menu entry to reload a file with a given encoding.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3393
diff changeset
912 self.reopenEncodingMenu = self.__initContextMenuReopenWithEncoding()
d1d4d79b4f11 Added a context menu entry to reload a file with a given encoding.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3393
diff changeset
913 self.menuActs["Reopen"] = self.menu.addMenu(self.reopenEncodingMenu)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
914 self.menuActs["Save"] = self.menu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
915 UI.PixmapCache.getIcon("fileSave"),
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
916 self.tr('Save'), self.__contextSave)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
917 self.menu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
918 UI.PixmapCache.getIcon("fileSaveAs"),
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
919 self.tr('Save As...'), self.__contextSaveAs)
4402
ad524553e765 Added capability to save a copy of the editor contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4385
diff changeset
920 self.menu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
921 UI.PixmapCache.getIcon("fileSaveCopy"),
4402
ad524553e765 Added capability to save a copy of the editor contents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4385
diff changeset
922 self.tr('Save Copy...'), self.__contextSaveCopy)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
923 if not self.miniMenu:
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
924 self.menu.addMenu(self.exportersMenu)
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
925 self.menu.addSeparator()
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
926 self.menuActs["OpenRejections"] = self.menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
927 self.tr("Open 'rejection' file"),
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
928 self.__contextOpenRejections)
1299
fd5d21389d2b Added an action to the editor context menu and to the tabview and listview view managers to open an associated 'rejections' file (i.e. same file name with '.rej' appended).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1295
diff changeset
929 self.menu.addSeparator()
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
930 self.menu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
931 UI.PixmapCache.getIcon("printPreview"),
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
932 self.tr("Print Preview"), self.printPreviewFile)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
933 self.menu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7525
diff changeset
934 UI.PixmapCache.getIcon("print"),
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
935 self.tr('Print'), self.printFile)
1299
fd5d21389d2b Added an action to the editor context menu and to the tabview and listview view managers to open an associated 'rejections' file (i.e. same file name with '.rej' appended).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1295
diff changeset
936 else:
fd5d21389d2b Added an action to the editor context menu and to the tabview and listview view managers to open an associated 'rejections' file (i.e. same file name with '.rej' appended).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1295
diff changeset
937 self.menuActs["OpenRejections"] = None
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
938
461
34528aaedf1c Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 460
diff changeset
939 self.menu.aboutToShow.connect(self.__showContextMenu)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
940
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
941 self.spellingMenu = QMenu()
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
942 self.__menus["Spelling"] = self.spellingMenu
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
943
461
34528aaedf1c Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 460
diff changeset
944 self.spellingMenu.aboutToShow.connect(self.__showContextMenuSpelling)
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
945 self.spellingMenu.triggered.connect(
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
946 self.__contextMenuSpellingTriggered)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
947
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
948 def __initContextMenuAutocompletion(self):
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
949 """
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
950 Private method used to setup the Checks context sub menu.
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2959
diff changeset
951
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2959
diff changeset
952 @return reference to the generated menu (QMenu)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
953 """
4153
95b18307079f Corrected some auto-completion related terms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4142
diff changeset
954 menu = QMenu(self.tr('Complete'))
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
955
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
956 self.menuActs["acDynamic"] = menu.addAction(
4814
0e3903a7480d Synchronized the Complete menus of the global Edit menu and the editor context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4718
diff changeset
957 self.tr('Complete'), self.autoComplete)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
958 menu.addSeparator()
5888
f23f3d2b7516 Added a cache for the already determined completion lists.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5887
diff changeset
959 self.menuActs["acClearCache"] = menu.addAction(
f23f3d2b7516 Added a cache for the already determined completion lists.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5887
diff changeset
960 self.tr("Clear Completions Cache"), self.__clearCompletionsCache)
f23f3d2b7516 Added a cache for the already determined completion lists.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5887
diff changeset
961 menu.addSeparator()
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
962 menu.addAction(
4814
0e3903a7480d Synchronized the Complete menus of the global Edit menu and the editor context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4718
diff changeset
963 self.tr('Complete from Document'), self.autoCompleteFromDocument)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
964 self.menuActs["acAPI"] = menu.addAction(
4814
0e3903a7480d Synchronized the Complete menus of the global Edit menu and the editor context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4718
diff changeset
965 self.tr('Complete from APIs'), self.autoCompleteFromAPIs)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
966 self.menuActs["acAPIDocument"] = menu.addAction(
4814
0e3903a7480d Synchronized the Complete menus of the global Edit menu and the editor context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4718
diff changeset
967 self.tr('Complete from Document and APIs'),
0e3903a7480d Synchronized the Complete menus of the global Edit menu and the editor context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4718
diff changeset
968 self.autoCompleteFromAll)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
969
461
34528aaedf1c Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 460
diff changeset
970 menu.aboutToShow.connect(self.__showContextMenuAutocompletion)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
971
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
972 return menu
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
973
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
974 def __initContextMenuChecks(self):
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
975 """
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
976 Private method used to setup the Checks context sub menu.
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2959
diff changeset
977
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2959
diff changeset
978 @return reference to the generated menu (QMenu)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
979 """
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
980 menu = QMenu(self.tr('Check'))
461
34528aaedf1c Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 460
diff changeset
981 menu.aboutToShow.connect(self.__showContextMenuChecks)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
982 return menu
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
983
3155
7e10d00e27ca Added a 'Tools' submenu to be populated by plug-ins and updated the plug-in document.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3152
diff changeset
984 def __initContextMenuTools(self):
7e10d00e27ca Added a 'Tools' submenu to be populated by plug-ins and updated the plug-in document.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3152
diff changeset
985 """
7e10d00e27ca Added a 'Tools' submenu to be populated by plug-ins and updated the plug-in document.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3152
diff changeset
986 Private method used to setup the Tools context sub menu.
7e10d00e27ca Added a 'Tools' submenu to be populated by plug-ins and updated the plug-in document.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3152
diff changeset
987
7e10d00e27ca Added a 'Tools' submenu to be populated by plug-ins and updated the plug-in document.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3152
diff changeset
988 @return reference to the generated menu (QMenu)
7e10d00e27ca Added a 'Tools' submenu to be populated by plug-ins and updated the plug-in document.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3152
diff changeset
989 """
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
990 menu = QMenu(self.tr('Tools'))
3155
7e10d00e27ca Added a 'Tools' submenu to be populated by plug-ins and updated the plug-in document.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3152
diff changeset
991 menu.aboutToShow.connect(self.__showContextMenuTools)
7e10d00e27ca Added a 'Tools' submenu to be populated by plug-ins and updated the plug-in document.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3152
diff changeset
992 return menu
7e10d00e27ca Added a 'Tools' submenu to be populated by plug-ins and updated the plug-in document.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3152
diff changeset
993
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
994 def __initContextMenuShow(self):
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
995 """
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
996 Private method used to setup the Show context sub menu.
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2959
diff changeset
997
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2959
diff changeset
998 @return reference to the generated menu (QMenu)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
999 """
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
1000 menu = QMenu(self.tr('Show'))
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
1001
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
1002 menu.addAction(self.tr('Code metrics...'), self.__showCodeMetrics)
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
1003 self.coverageMenuAct = menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
1004 self.tr('Code coverage...'), self.__showCodeCoverage)
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
1005 self.coverageShowAnnotationMenuAct = menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
1006 self.tr('Show code coverage annotations'),
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
1007 self.codeCoverageShowAnnotations)
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
1008 self.coverageHideAnnotationMenuAct = menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
1009 self.tr('Hide code coverage annotations'),
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
1010 self.__codeCoverageHideAnnotations)
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2994
diff changeset
1011 self.profileMenuAct = menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
1012 self.tr('Profile data...'), self.__showProfileData)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
1013
461
34528aaedf1c Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 460
diff changeset
1014 menu.aboutToShow.connect(self.__showContextMenuShow)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
1015
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
1016 return menu
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
1017
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
1018 def __initContextMenuGraphics(self):
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
1019 """
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
1020 Private method used to setup the diagrams context sub menu.
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2959
diff changeset
1021
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2959
diff changeset
1022 @return reference to the generated menu (QMenu)
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
1023 """
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
1024 menu = QMenu(self.tr('Diagrams'))
92
30ffedc3e418 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 88
diff changeset
1025
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
1026 menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
1027 self.tr('Class Diagram...'), self.__showClassDiagram)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
1028 menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
1029 self.tr('Package Diagram...'), self.__showPackageDiagram)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
1030 menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
1031 self.tr('Imports Diagram...'), self.__showImportsDiagram)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
1032 self.applicationDiagramMenuAct = menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3169
diff changeset
1033 self.tr('Application Diagram...'),
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
1034 self.__showApplicationDiagram)
2034
8de0fc1f7fef Implemented functions to load UML graphics from disc.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2031
diff changeset
1035 menu.addSeparator()