aboutsummaryrefslogtreecommitdiffstats
path: root/examples/macroexpander.py
diff options
context:
space:
mode:
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)