eric6/Plugins/PluginWizardE5MessageBox.py

Wed, 29 May 2019 22:14:02 +0200

author
T.Rzepka <Tobias.Rzepka@gmail.com>
date
Wed, 29 May 2019 22:14:02 +0200
branch
Variables Viewer
changeset 7030
73779c4c135a
parent 6942
2602857055c5
child 7199
c71bd6f21748
permissions
-rw-r--r--

Bugfix displaying to many characters as default_factory type.

562
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
6645
ad476851d7e0 Updated copyright for 2019.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
3 # Copyright (c) 2010 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
562
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the E5MessageBox wizard plugin.
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
3145
a9de05d4a22f # __IGNORE_WARNING__ added/ removed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3060
diff changeset
10 from __future__ import unicode_literals
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2407
diff changeset
11
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3523
diff changeset
12 from PyQt5.QtCore import QObject
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3523
diff changeset
13 from PyQt5.QtWidgets import QDialog
562
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 from E5Gui.E5Application import e5App
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 from E5Gui.E5Action import E5Action
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 from E5Gui import E5MessageBox
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18
5316
31cbc97d4974 Got rid of the manually set version numbers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
19 import UI.Info
31cbc97d4974 Got rid of the manually set version numbers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
20
562
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 # Start-Of-Header
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 name = "E5MessageBox Wizard Plugin"
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 autoactivate = True
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 deactivateable = True
5316
31cbc97d4974 Got rid of the manually set version numbers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
26 version = UI.Info.VersionOnly
562
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 className = "E5MessageBoxWizard"
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 packageName = "__core__"
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 shortDescription = "Show the E5MessageBox wizard."
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 longDescription = """This plugin shows the E5MessageBox wizard."""
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 pyqtApi = 2
3523
8df1ab89e261 python2Compatible flags for base plug-ins added.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3484
diff changeset
32 python2Compatible = True
562
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 # End-Of-Header
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 error = ""
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
37
562
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 class E5MessageBoxWizard(QObject):
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 """
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 Class implementing the E5MessageBox wizard plugin.
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 """
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 def __init__(self, ui):
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 """
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 Constructor
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 @param ui reference to the user interface object (UI.UserInterface)
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2407
diff changeset
48 super(E5MessageBoxWizard, self).__init__(ui)
562
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 self.__ui = ui
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 def activate(self):
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 """
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 Public method to activate this plugin.
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 @return tuple of None and activation status (boolean)
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 """
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 self.__initAction()
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 self.__initMenu()
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 return None, True
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 def deactivate(self):
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 """
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 Public method to deactivate this plugin.
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 """
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 menu = self.__ui.getMenu("wizards")
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 if menu:
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 menu.removeAction(self.action)
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 self.__ui.removeE5Actions([self.action], 'wizards')
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 def __initAction(self):
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 """
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 Private method to initialize the action.
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 """
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3004
diff changeset
75 self.action = E5Action(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3180
diff changeset
76 self.tr('E5MessageBox Wizard'),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3180
diff changeset
77 self.tr('&E5MessageBox Wizard...'), 0, 0, self,
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
78 'wizards_e5messagebox')
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3180
diff changeset
79 self.action.setStatusTip(self.tr('E5MessageBox Wizard'))
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3180
diff changeset
80 self.action.setWhatsThis(self.tr(
562
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 """<b>E5MessageBox Wizard</b>"""
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 """<p>This wizard opens a dialog for entering all the parameters"""
3004
c4bf32c791d0 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
83 """ needed to create an E5MessageBox. The generated code is"""
c4bf32c791d0 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
84 """ inserted at the current cursor position.</p>"""
562
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 ))
3345
071afe8be2a1 Changed signal/slot usage to not use constructs like 'triggered[()].connect(...)' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
86 self.action.triggered.connect(self.__handle)
562
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 self.__ui.addE5Actions([self.action], 'wizards')
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 def __initMenu(self):
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 """
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 Private method to add the actions to the right menu.
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 """
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 menu = self.__ui.getMenu("wizards")
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 if menu:
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 menu.addAction(self.action)
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 def __callForm(self, editor):
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 """
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 Private method to display a dialog and get the code.
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 @param editor reference to the current editor
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 @return the generated code (string)
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 """
2407
b98cc8ee1142 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
105 from WizardPlugins.E5MessageBoxWizard.E5MessageBoxWizardDialog import \
b98cc8ee1142 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
106 E5MessageBoxWizardDialog
562
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 dlg = E5MessageBoxWizardDialog(None)
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 if dlg.exec_() == QDialog.Accepted:
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 line, index = editor.getCursorPosition()
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 indLevel = editor.indentation(line) // editor.indentationWidth()
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 if editor.indentationsUseTabs():
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 indString = '\t'
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 else:
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 indString = editor.indentationWidth() * ' '
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 return (dlg.getCode(indLevel, indString), True)
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 else:
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117 return (None, False)
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 def __handle(self):
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 """
2962
d6c9d1ca2da4 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2712
diff changeset
121 Private method to handle the wizards action.
562
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 """
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 editor = e5App().getObject("ViewManager").activeWindow()
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
125 if editor is None:
6735
31e263d49c04 Fixed some code style issues detected by the updated style checker (over-indented lines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
126 E5MessageBox.critical(
31e263d49c04 Fixed some code style issues detected by the updated style checker (over-indented lines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
127 self.__ui,
31e263d49c04 Fixed some code style issues detected by the updated style checker (over-indented lines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
128 self.tr('No current editor'),
31e263d49c04 Fixed some code style issues detected by the updated style checker (over-indented lines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
129 self.tr('Please open or create a file first.'))
562
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 else:
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 code, ok = self.__callForm(editor)
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 if ok:
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 line, index = editor.getCursorPosition()
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 # It should be done on this way to allow undo
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 editor.beginUndoAction()
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 editor.insertAt(code, line, index)
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 editor.endUndoAction()

eric ide

mercurial