mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
CURA-5296 Improvement to using CuraVersion
This commit is contained in:
parent
20a2ea4f2c
commit
3dda3f04fb
1 changed files with 19 additions and 21 deletions
|
@ -26,7 +26,6 @@ from .ConfigsModel import ConfigsModel
|
||||||
|
|
||||||
i18n_catalog = i18nCatalog("cura")
|
i18n_catalog = i18nCatalog("cura")
|
||||||
|
|
||||||
|
|
||||||
## The Toolbox class is responsible of communicating with the server through the API
|
## The Toolbox class is responsible of communicating with the server through the API
|
||||||
class Toolbox(QObject, Extension):
|
class Toolbox(QObject, Extension):
|
||||||
def __init__(self, parent=None) -> None:
|
def __init__(self, parent=None) -> None:
|
||||||
|
@ -35,15 +34,7 @@ class Toolbox(QObject, Extension):
|
||||||
self._application = Application.getInstance()
|
self._application = Application.getInstance()
|
||||||
self._package_manager = None
|
self._package_manager = None
|
||||||
self._plugin_registry = Application.getInstance().getPluginRegistry()
|
self._plugin_registry = Application.getInstance().getPluginRegistry()
|
||||||
|
self._packages_version = self._getPackagesVersion()
|
||||||
if hasattr(cura, "CuraVersion"):
|
|
||||||
if hasattr(cura.CuraVersion, "CuraPackagesVersion"):
|
|
||||||
self._packages_version = cura.CuraVersion.CuraPackagesVersion
|
|
||||||
else:
|
|
||||||
self._packages_version = self._plugin_registry.APIVersion
|
|
||||||
else:
|
|
||||||
self._packages_version = self._plugin_registry.APIVersion
|
|
||||||
|
|
||||||
self._api_version = 1
|
self._api_version = 1
|
||||||
self._api_url = "https://api-staging.ultimaker.com/cura-packages/v{api_version}/cura/v{package_version}".format( api_version = self._api_version, package_version = self._packages_version)
|
self._api_url = "https://api-staging.ultimaker.com/cura-packages/v{api_version}/cura/v{package_version}".format( api_version = self._api_version, package_version = self._packages_version)
|
||||||
|
|
||||||
|
@ -75,22 +66,22 @@ class Toolbox(QObject, Extension):
|
||||||
|
|
||||||
# Data:
|
# Data:
|
||||||
self._metadata = {
|
self._metadata = {
|
||||||
"authors": [],
|
"authors": [],
|
||||||
"packages": [],
|
"packages": [],
|
||||||
"plugins_showcase": [],
|
"plugins_showcase": [],
|
||||||
"plugins_installed": [],
|
"plugins_installed": [],
|
||||||
"materials_showcase": [],
|
"materials_showcase": [],
|
||||||
"materials_installed": []
|
"materials_installed": []
|
||||||
}
|
}
|
||||||
|
|
||||||
# Models:
|
# Models:
|
||||||
self._models = {
|
self._models = {
|
||||||
"authors": AuthorsModel(self),
|
"authors": AuthorsModel(self),
|
||||||
"packages": PackagesModel(self),
|
"packages": PackagesModel(self),
|
||||||
"plugins_showcase": PackagesModel(self),
|
"plugins_showcase": PackagesModel(self),
|
||||||
"plugins_available": PackagesModel(self),
|
"plugins_available": PackagesModel(self),
|
||||||
"plugins_installed": PackagesModel(self),
|
"plugins_installed": PackagesModel(self),
|
||||||
"materials_showcase": AuthorsModel(self),
|
"materials_showcase": AuthorsModel(self),
|
||||||
"materials_available": PackagesModel(self),
|
"materials_available": PackagesModel(self),
|
||||||
"materials_installed": PackagesModel(self)
|
"materials_installed": PackagesModel(self)
|
||||||
}
|
}
|
||||||
|
@ -163,6 +154,13 @@ class Toolbox(QObject, Extension):
|
||||||
def _onAppInitialized(self) -> None:
|
def _onAppInitialized(self) -> None:
|
||||||
self._package_manager = Application.getInstance().getCuraPackageManager()
|
self._package_manager = Application.getInstance().getCuraPackageManager()
|
||||||
|
|
||||||
|
def _getPackagesVersion(self) -> int:
|
||||||
|
if not hasattr(cura, "CuraVersion"):
|
||||||
|
return self._plugin_registry.APIVersion
|
||||||
|
if not hasattr(cura.CuraVersion, "CuraPackagesVersion"):
|
||||||
|
return self._plugin_registry.APIVersion
|
||||||
|
return cura.CuraVersion.CuraPackagesVersion
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def browsePackages(self) -> None:
|
def browsePackages(self) -> None:
|
||||||
# Create the network manager:
|
# Create the network manager:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue