mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-15 02:37:49 -06:00
Minor codecleanup (Typing & removing unused imports)
CURA-5734
This commit is contained in:
parent
fe9db9a260
commit
4def636fc9
3 changed files with 7 additions and 14 deletions
|
@ -2,18 +2,11 @@
|
|||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
from typing import Optional, List
|
||||
import os
|
||||
import urllib.parse
|
||||
from configparser import ConfigParser
|
||||
|
||||
from PyQt5.QtCore import pyqtProperty, Qt, pyqtSignal, pyqtSlot, QObject
|
||||
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject
|
||||
|
||||
|
||||
from UM.Application import Application
|
||||
from UM.Logger import Logger
|
||||
from UM.Qt.ListModel import ListModel
|
||||
from UM.Resources import Resources
|
||||
from UM.MimeTypeDatabase import MimeTypeDatabase, MimeTypeNotFoundError
|
||||
|
||||
from UM.i18n import i18nCatalog
|
||||
from cura.Settings.SettingVisibilityPreset import SettingVisibilityPreset
|
||||
|
|
|
@ -6,7 +6,7 @@ from typing import List
|
|||
from PyQt5.QtCore import pyqtProperty, QObject, pyqtSignal
|
||||
|
||||
from UM.Logger import Logger
|
||||
from UM.MimeTypeDatabase import MimeTypeDatabase, MimeTypeNotFoundError
|
||||
from UM.MimeTypeDatabase import MimeTypeDatabase
|
||||
|
||||
|
||||
class SettingVisibilityPreset(QObject):
|
||||
|
@ -15,7 +15,7 @@ class SettingVisibilityPreset(QObject):
|
|||
onWeightChanged = pyqtSignal()
|
||||
onIdChanged = pyqtSignal()
|
||||
|
||||
def __init__(self, id: str = "", name: str = "" , weight: int = 0, parent = None) -> None:
|
||||
def __init__(self, id: str = "", name: str = "", weight: int = 0, parent = None) -> None:
|
||||
super().__init__(parent)
|
||||
self._settings = [] # type: List[str]
|
||||
self._id = id
|
||||
|
@ -43,12 +43,12 @@ class SettingVisibilityPreset(QObject):
|
|||
self._name = name
|
||||
self.onNameChanged.emit()
|
||||
|
||||
def setId(self, id: int) -> None:
|
||||
def setId(self, id: str) -> None:
|
||||
if id != self._id:
|
||||
self._id = id
|
||||
self.onIdChanged.emit()
|
||||
|
||||
def setWeight(self, weight: str) -> None:
|
||||
def setWeight(self, weight: int) -> None:
|
||||
if weight != self._weight:
|
||||
self._weight = weight
|
||||
self.onWeightChanged.emit()
|
||||
|
@ -83,5 +83,5 @@ class SettingVisibilityPreset(QObject):
|
|||
self.setSettings(settings)
|
||||
self.setId(item_id)
|
||||
self.setName(parser["general"]["name"])
|
||||
self.setWeight(parser["general"]["weight"])
|
||||
self.setWeight(int(parser["general"]["weight"]))
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ def test_settingVisibilityPreset():
|
|||
assert setting_visibility_preset_test_settings == set(visibility_preset.settings)
|
||||
|
||||
assert visibility_preset.name == "test"
|
||||
assert visibility_preset.weight == '1'
|
||||
assert visibility_preset.weight == 1
|
||||
assert visibility_preset.settings.count("yay") == 1 # It's in the file twice but we should load it once.
|
||||
|
||||
def test_visibilityFromPrevious():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue