aboutsummaryrefslogtreecommitdiffstats
path: root/python
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 /python
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 'python')
-rw-r--r--python/extensionmanager/__init__.py10
-rw-r--r--python/extensionmanager/actions.py8
-rw-r--r--python/extensionmanager/list.py10
3 files changed, 14 insertions, 14 deletions
diff --git a/python/extensionmanager/__init__.py b/python/extensionmanager/__init__.py
index 8588796..f6caa37 100644
--- a/python/extensionmanager/__init__.py
+++ b/python/extensionmanager/__init__.py
@@ -42,20 +42,20 @@
from .list import *
-from PythonExtension import QtCreator
+from QtCreator import Core
from PySide2.QtCore import *
from PySide2.QtWidgets import *
# Actions
def showExtensionList():
- dialog = ListView(QtCreator.Core.ICore.dialogParent())
+ dialog = ListView(Core.ICore.dialogParent())
dialog.exec_()
pythonExtensionsAction = QAction("About Python Extensions...")
pythonExtensionsAction.setMenuRole(QAction.ApplicationSpecificRole)
-pythonExtensionsCommand = QtCreator.Core.ActionManager.registerAction(pythonExtensionsAction,
- "PythonExtensions.About")
+pythonExtensionsCommand = Core.ActionManager.registerAction(pythonExtensionsAction,
+ "PythonExtensions.About")
QObject.connect(pythonExtensionsAction, SIGNAL("triggered()"), showExtensionList)
-helpMenu = QtCreator.Core.ActionManager.actionContainer("QtCreator.Menu.Help")
+helpMenu = Core.ActionManager.actionContainer("QtCreator.Menu.Help")
helpMenu.addAction(pythonExtensionsCommand, "QtCreator.Group.Help.About")
diff --git a/python/extensionmanager/actions.py b/python/extensionmanager/actions.py
index 7f05e77..48e5ae4 100644
--- a/python/extensionmanager/actions.py
+++ b/python/extensionmanager/actions.py
@@ -41,7 +41,7 @@
# Functions for installing and deleting extensions
import sys, zipfile
-from PythonExtension import PluginInstance as instance
+from QtCreator import PythonExtensions
from send2trash import send2trash
def install(path):
@@ -59,14 +59,14 @@ def install(path):
return "The .zip file is malformed."
# Make sure the extension manager does not overwrite
# extensions that are already installed
- for ext in instance.extensionList():
+ for ext in PythonExtensions.extensionList():
if extName == ext.name:
return "The extension \"{}\" is already installed. Uninstall it before trying again.".format(extName)
- extZip.extractall(instance.extensionDir().absolutePath())
+ extZip.extractall(PythonExtensions.extensionDir().absolutePath())
extZip.close()
except Exception as e:
return str(e)
return True
def uninstall(ext):
- send2trash(instance.extensionDir().absolutePath() + "/" + ext)
+ send2trash(PythonExtensions.extensionDir().absolutePath() + "/" + ext)
diff --git a/python/extensionmanager/list.py b/python/extensionmanager/list.py
index 32002b1..c71b4d4 100644
--- a/python/extensionmanager/list.py
+++ b/python/extensionmanager/list.py
@@ -43,7 +43,7 @@
from . import actions
from PySide2 import QtCore, QtWidgets, QtGui
-from PythonExtension import PluginInstance as instance
+from QtCreator import PythonExtensions
class ExtensionList(QtWidgets.QListWidget):
def __init__(self):
@@ -56,7 +56,7 @@ class ExtensionList(QtWidgets.QListWidget):
def loadExtensionList(self):
i = 0
- for ext in instance.extensionList():
+ for ext in PythonExtensions.extensionList():
item = QtWidgets.QListWidgetItem(self)
if not ext.loaded:
item.setText(ext.name + " [did not load]")
@@ -79,7 +79,7 @@ class ListView(QtWidgets.QDialog):
self.layout = QtWidgets.QVBoxLayout(self)
self.label = QtWidgets.QLabel()
- self.label.setText("Manage Python extensions installed to \"{0}\".".format(instance.extensionDir().absolutePath()))
+ self.label.setText("Manage Python extensions installed to \"{0}\".".format(PythonExtensions.extensionDir().absolutePath()))
self.label.setWordWrap(True)
self.layout.addWidget(self.label)
@@ -116,7 +116,7 @@ class ListView(QtWidgets.QDialog):
selected = self.list.selectedIndexes()
if len(selected) >= 1:
selected = selected[0].row()
- ext = instance.extensionList()[selected]
+ ext = PythonExtensions.extensionList()[selected]
if ext == "extensionmanager":
QtWidgets.QMessageBox.warning(self, "Can not Uninstall", "The Extension Manager can not uninstall itself.")
else:
@@ -145,7 +145,7 @@ class ListView(QtWidgets.QDialog):
"/",
"Qt Creator Python Extensions (*.zip)"
)
- oldExtensions = list(instance.extensionList())
+ oldExtensions = list(PythonExtensions.extensionList())
result = actions.install(fileName[0])
if result == True:
QtWidgets.QMessageBox.information(