mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-19 12:47:49 -06:00
Implemented code review suggestions
Contributes to CURA-8558
This commit is contained in:
parent
e01e47b8fa
commit
11b3b08198
3 changed files with 10 additions and 7 deletions
|
@ -4,6 +4,9 @@
|
|||
from typing import Any, Dict, Generator, List, Optional, TYPE_CHECKING
|
||||
from PyQt5.QtCore import pyqtSlot, QObject
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from PyQt5.QtCore import QObject
|
||||
|
||||
from UM.i18n import i18nCatalog
|
||||
|
||||
from cura.CuraApplication import CuraApplication
|
||||
|
@ -28,7 +31,7 @@ class LocalPackageList(PackageList):
|
|||
}
|
||||
} # The section headers to be used for the different package categories
|
||||
|
||||
def __init__(self, parent: Optional[QObject] = None) -> None:
|
||||
def __init__(self, parent: Optional["QObject"] = None) -> None:
|
||||
super().__init__(parent)
|
||||
self._manager = CuraApplication.getInstance().getPackageManager()
|
||||
self._has_footer = False
|
||||
|
@ -43,6 +46,7 @@ class LocalPackageList(PackageList):
|
|||
self.setIsLoading(True)
|
||||
self._getLocalPackages()
|
||||
self.setIsLoading(False)
|
||||
self.setHasMore(False) # All packages should have been loaded at this time
|
||||
|
||||
def _getLocalPackages(self) -> None:
|
||||
""" Obtain the local packages.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, Qt
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
|
||||
from UM.i18n import i18nCatalog
|
||||
from UM.Qt.ListModel import ListModel
|
||||
|
@ -19,7 +19,7 @@ class PackageList(ListModel):
|
|||
"""
|
||||
PackageRole = Qt.UserRole + 1
|
||||
|
||||
def __init__(self, parent: "QObject" = None) -> None:
|
||||
def __init__(self, parent: Optional["QObject"] = None) -> None:
|
||||
super().__init__(parent)
|
||||
self._error_message = ""
|
||||
self.addRoleName(self.PackageRole, "package")
|
||||
|
@ -56,7 +56,7 @@ class PackageList(ListModel):
|
|||
"""
|
||||
return self._is_loading
|
||||
|
||||
hasMoreChanged = pyqtSignal() # The signal for hasMore property
|
||||
hasMoreChanged = pyqtSignal()
|
||||
|
||||
def setHasMore(self, value: bool) -> None:
|
||||
if self._has_more != value:
|
||||
|
@ -70,7 +70,7 @@ class PackageList(ListModel):
|
|||
"""
|
||||
return self._has_more
|
||||
|
||||
errorMessageChanged = pyqtSignal() # The signal for errorMessage property
|
||||
errorMessageChanged = pyqtSignal()
|
||||
|
||||
def setErrorMessage(self, error_message: str) -> None:
|
||||
if self._error_message != error_message:
|
||||
|
|
|
@ -18,7 +18,6 @@ from .PackageModel import PackageModel # The contents of this list.
|
|||
|
||||
if TYPE_CHECKING:
|
||||
from PyQt5.QtCore import QObject
|
||||
from PyQt5.QtNetwork import QNetworkReply
|
||||
|
||||
catalog = i18nCatalog("cura")
|
||||
|
||||
|
@ -26,7 +25,7 @@ catalog = i18nCatalog("cura")
|
|||
class RemotePackageList(PackageList):
|
||||
ITEMS_PER_PAGE = 20 # Pagination of number of elements to download at once.
|
||||
|
||||
def __init__(self, parent: "QObject" = None) -> None:
|
||||
def __init__(self, parent: Optional["QObject"] = None) -> None:
|
||||
super().__init__(parent)
|
||||
|
||||
self._ongoing_request: Optional[HttpRequestData] = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue