aboutsummaryrefslogtreecommitdiffstats
path: root/examples/macroexpander.py
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2018-09-27 15:00:08 +0200
committerEike Ziller <eike.ziller@qt.io>2018-09-28 07:31:36 +0000
commit3412dc563119221bd730c1487937519df0761792 (patch)
treed738ea0a24c1013e589e69240d6fc91ae13ed999 /examples/macroexpander.py
parent3c4cafdf834c9b683501efca72dbbe1093cf6f9a (diff)
Clean up import hierarchy
PythonExtension.QtCreator.* -> QtCreator.* PythonExtension.PluginInstance -> QtCreator.PythonExtensions Also enables imports of the form "from QtCreator import Core" it is no longer necessary to write QtCreator.Core.... Change-Id: Ib9b433868dcc3fc7d1d534c6023bae7bf6d05fec Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'examples/macroexpander.py')
-rw-r--r--examples/macroexpander.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/examples/macroexpander.py b/examples/macroexpander.py
index 20e10a3..17c30cc 100644
--- a/examples/macroexpander.py
+++ b/examples/macroexpander.py
@@ -45,22 +45,23 @@ import examples_common
from PySide2.QtCore import QObject, SIGNAL
from PySide2.QtWidgets import QInputDialog, QMessageBox, QAction
-from PythonExtension import QtCreator
+from QtCreator import Core
+from QtCreator import Utils
# Register our macro (it can be used as %{Python:exp})
-QtCreator.Utils.MacroExpander().registerPrefix(b"Python", "Evaluate Python expressions.", lambda x: eval(x))
+Utils.MacroExpander().registerPrefix(b"Python", "Evaluate Python expressions.", lambda x: eval(x))
# Add a small menu item, that let's us test the macro
def act():
- text = QInputDialog.getMultiLineText(QtCreator.Core.ICore.dialogParent(),
+ text = QInputDialog.getMultiLineText(Core.ICore.dialogParent(),
"Input Text", "Input your text, including some macros",
"3 + 3 = %{Python:3+3}")
- text = QtCreator.Utils.MacroExpander().expand(text[0])
- QMessageBox.information(QtCreator.Core.ICore.dialogParent(), "Result", text)
+ text = Utils.MacroExpander().expand(text[0])
+ QMessageBox.information(Core.ICore.dialogParent(), "Result", text)
# Add this to the "Tools" menu
action = QAction("Test Macro Expander...")
-command = QtCreator.Core.ActionManager.registerAction(action, 'PythonExtensions.Examples.MacroExpander')
+command = Core.ActionManager.registerAction(action, 'PythonExtensions.Examples.MacroExpander')
QObject.connect(action, SIGNAL('triggered()'), act)
examples_common.addExampleItem(command)