Plugins/PluginWizardE5MessageBox.py

Sat, 11 Jan 2014 11:55:33 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 11 Jan 2014 11:55:33 +0100
changeset 3190
a9a94491c4fd
parent 3180
2ed66f1e69fd
child 3345
071afe8be2a1
permissions
-rw-r--r--

Changed the code to use QObject.tr() instead of QObject.trUtf8().

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
3160
209a07d7e401 Updated copyright for 2014.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3036
diff changeset
3 # Copyright (c) 2010 - 2014 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
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 from PyQt4.QtCore import QObject
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 from PyQt4.QtGui import QDialog
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 from E5Gui.E5Application import e5App
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 from E5Gui.E5Action import E5Action
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 from E5Gui import E5MessageBox
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 # Start-Of-Header
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 name = "E5MessageBox Wizard Plugin"
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 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
20 autoactivate = True
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 deactivateable = True
3180
2ed66f1e69fd Started 5.5.x line of development.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
22 version = "5.5.0"
562
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 className = "E5MessageBoxWizard"
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 packageName = "__core__"
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 shortDescription = "Show the E5MessageBox wizard."
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 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
27 pyqtApi = 2
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 # End-Of-Header
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 error = ""
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
32
562
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 class E5MessageBoxWizard(QObject):
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 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
36 """
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 def __init__(self, ui):
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 """
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 Constructor
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 @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
42 """
1131
7781e396c903 Changed the code to use super() to access the superclass.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
43 super().__init__(ui)
562
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 self.__ui = ui
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 def activate(self):
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 """
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 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
49
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 @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
51 """
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 self.__initAction()
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 self.__initMenu()
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 None, True
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 def deactivate(self):
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 """
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 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
60 """
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 menu = self.__ui.getMenu("wizards")
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 if menu:
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 menu.removeAction(self.action)
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 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
65
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 def __initAction(self):
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 """
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 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
69 """
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3004
diff changeset
70 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
71 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
72 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
73 '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
74 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
75 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
76 """<b>E5MessageBox Wizard</b>"""
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 """<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
78 """ 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
79 """ 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
80 ))
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 self.action.triggered[()].connect(self.__handle)
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 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
84
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 def __initMenu(self):
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 """
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 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
88 """
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 menu = self.__ui.getMenu("wizards")
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 if menu:
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 menu.addAction(self.action)
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 def __callForm(self, editor):
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 """
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 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
96
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 @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
98 @return the generated code (string)
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 """
2407
b98cc8ee1142 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
100 from WizardPlugins.E5MessageBoxWizard.E5MessageBoxWizardDialog import \
b98cc8ee1142 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
101 E5MessageBoxWizardDialog
562
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 dlg = E5MessageBoxWizardDialog(None)
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 if dlg.exec_() == QDialog.Accepted:
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 line, index = editor.getCursorPosition()
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 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
106 if editor.indentationsUseTabs():
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 indString = '\t'
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 else:
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 indString = editor.indentationWidth() * ' '
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 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
111 else:
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 return (None, False)
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 def __handle(self):
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 """
2962
d6c9d1ca2da4 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2712
diff changeset
116 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
117 """
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 editor = e5App().getObject("ViewManager").activeWindow()
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
120 if editor is None:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3004
diff changeset
121 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3004
diff changeset
122 self.__ui,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3180
diff changeset
123 self.tr('No current editor'),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3180
diff changeset
124 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
125 else:
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 code, ok = self.__callForm(editor)
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 if ok:
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 line, index = editor.getCursorPosition()
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 # 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
130 editor.beginUndoAction()
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 editor.insertAt(code, line, index)
8bf0dbc1ca6a Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 editor.endUndoAction()

eric ide

mercurial