Minor fixes

CURA-4224

 - Fix code style
 - Fix typos
This commit is contained in:
Lipu Fei 2017-09-13 17:44:53 +02:00
parent 2e1c6abe0e
commit be57ccb127
3 changed files with 17 additions and 15 deletions

View file

@ -1,6 +1,6 @@
# Copyright (c) 2015 Ultimaker B.V. # Copyright (c) 2017 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher. # Cura is released under the terms of the AGPLv3 or higher.
from UM.Application import Application
from UM.Extension import Extension from UM.Extension import Extension
from UM.Preferences import Preferences from UM.Preferences import Preferences
from UM.Logger import Logger from UM.Logger import Logger
@ -33,9 +33,9 @@ class FirmwareUpdateChecker(Extension):
ContainerRegistry.getInstance().containerAdded.connect(self._onContainerAdded) ContainerRegistry.getInstance().containerAdded.connect(self._onContainerAdded)
def _onContainerAdded(self, container): def _onContainerAdded(self, container):
# Only take care when a new GlobaStack was added # Only take care when a new GlobalStack was added
if (isinstance(container, GlobalStack)): if isinstance(container, GlobalStack):
Logger.log("i", "You have a '%s' in printer list. Let's check the firmware!" % container.getId()) Logger.log("i", "You have a '%s' in printer list. Let's check the firmware!", container.getId())
self.checkFirmwareVersion(container, True) self.checkFirmwareVersion(container, True)
## Connect with software.ultimaker.com, load latest.version and check version info. ## Connect with software.ultimaker.com, load latest.version and check version info.

View file

@ -1,4 +1,4 @@
# Copyright (c) 2015 Ultimaker B.V. # Copyright (c) 2017 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher. # Cura is released under the terms of the AGPLv3 or higher.
from UM.Preferences import Preferences from UM.Preferences import Preferences
@ -49,12 +49,12 @@ class FirmwareUpdateCheckerJob(Job):
# If it is not None, then we compare between the checked_version and the current_version # If it is not None, then we compare between the checked_version and the current_version
# Now we just do that if the active printer is Ultimaker 3 or Ultimaker 3 Extended or any # Now we just do that if the active printer is Ultimaker 3 or Ultimaker 3 Extended or any
# other Ultimaker 3 that will come in the future # other Ultimaker 3 that will come in the future
if (machine_name[0:11] == "Ultimaker 3"): if machine_name[0:11] == "Ultimaker 3":
# Nothing to parse, just get the string # Nothing to parse, just get the string
# TODO: In the future may be done by parsing a JSON file with diferent version for each printer model # TODO: In the future may be done by parsing a JSON file with diferent version for each printer model
current_version = reader(current_version_file).readline().rstrip() current_version = reader(current_version_file).readline().rstrip()
Logger.log("i", "Reading firmware version of %s: %s" % (machine_name, current_version)) Logger.log("i", "Reading firmware version of %s: %s", machine_name, current_version)
# If it is the first time the version is checked, the checked_version is None # If it is the first time the version is checked, the checked_version is None
checked_version = Preferences.getInstance().getValue("info/latest_checked_firmware") checked_version = Preferences.getInstance().getValue("info/latest_checked_firmware")
@ -80,7 +80,7 @@ class FirmwareUpdateCheckerJob(Job):
Preferences.getInstance().setValue("info/latest_checked_firmware", current_version) Preferences.getInstance().setValue("info/latest_checked_firmware", current_version)
except Exception as e: except Exception as e:
Logger.log("w", "Failed to check for new version: %s" % e) Logger.log("w", "Failed to check for new version: %s", e)
if not self.silent: if not self.silent:
Message(i18n_catalog.i18nc("@info", "Could not access update information.")).show() Message(i18n_catalog.i18nc("@info", "Could not access update information.")).show()
return return

View file

@ -1,14 +1,16 @@
# Copyright (c) 2015 Ultimaker B.V. # Copyright (c) 2017 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher. # Cura is released under the terms of the AGPLv3 or higher.
from UM.i18n import i18nCatalog from UM.i18n import i18nCatalog
from . import FirmwareUpdateChecker from . import FirmwareUpdateChecker
i18n_catalog = i18nCatalog("cura") i18n_catalog = i18nCatalog("cura")
def getMetaData(): def getMetaData():
return { return {}
}
def register(app): def register(app):
return { "extension": FirmwareUpdateChecker.FirmwareUpdateChecker()} return {"extension": FirmwareUpdateChecker.FirmwareUpdateChecker()}