mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-09 07:56:22 -06:00
Whole bunch of um-pep8 style fixes.
This commit is contained in:
parent
938ac7a08b
commit
743b403b29
10 changed files with 22 additions and 20 deletions
|
@ -142,7 +142,7 @@ class CuraApplication(QtApplication):
|
||||||
parser.add_argument("--debug", dest="debug-mode", action="store_true", default=False, help="Enable detailed crash reports.")
|
parser.add_argument("--debug", dest="debug-mode", action="store_true", default=False, help="Enable detailed crash reports.")
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if not "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION" in os.environ or os.environ["PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION"] != "cpp":
|
if "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION" not in os.environ or os.environ["PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION"] != "cpp":
|
||||||
Logger.log("w", "Using Python implementation of Protobuf, expect bad performance!")
|
Logger.log("w", "Using Python implementation of Protobuf, expect bad performance!")
|
||||||
|
|
||||||
self._i18n_catalog = i18nCatalog("cura");
|
self._i18n_catalog = i18nCatalog("cura");
|
||||||
|
|
|
@ -37,7 +37,7 @@ class ThreeMFReader(MeshReader):
|
||||||
if extension.lower() == self._supported_extension:
|
if extension.lower() == self._supported_extension:
|
||||||
result = SceneNode()
|
result = SceneNode()
|
||||||
# The base object of 3mf is a zipped archive.
|
# The base object of 3mf is a zipped archive.
|
||||||
archive = zipfile.ZipFile(file_name, 'r')
|
archive = zipfile.ZipFile(file_name, "r")
|
||||||
try:
|
try:
|
||||||
root = ET.parse(archive.open("3D/3dmodel.model"))
|
root = ET.parse(archive.open("3D/3dmodel.model"))
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
# 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
|
||||||
catalog = i18nCatalog("cura")
|
|
||||||
|
|
||||||
from . import ThreeMFReader
|
from . import ThreeMFReader
|
||||||
|
|
||||||
|
catalog = i18nCatalog("cura")
|
||||||
|
|
||||||
def getMetaData():
|
def getMetaData():
|
||||||
return {
|
return {
|
||||||
"plugin": {
|
"plugin": {
|
||||||
|
|
|
@ -58,7 +58,7 @@ class ChangeLog(Extension, QObject,):
|
||||||
|
|
||||||
def loadChangeLogs(self):
|
def loadChangeLogs(self):
|
||||||
self._change_logs = collections.OrderedDict()
|
self._change_logs = collections.OrderedDict()
|
||||||
with open(os.path.join(PluginRegistry.getInstance().getPluginPath("ChangeLogPlugin"), "ChangeLog.txt"), 'r',-1, "utf-8") as f:
|
with open(os.path.join(PluginRegistry.getInstance().getPluginPath("ChangeLogPlugin"), "ChangeLog.txt"), "r",-1, "utf-8") as f:
|
||||||
open_version = None
|
open_version = None
|
||||||
open_header = None
|
open_header = None
|
||||||
for line in f:
|
for line in f:
|
||||||
|
|
|
@ -125,7 +125,7 @@ class CuraEngineBackend(Backend):
|
||||||
return
|
return
|
||||||
|
|
||||||
if self._profile.hasErrorValue():
|
if self._profile.hasErrorValue():
|
||||||
Logger.log('w', "Profile has error values. Aborting slicing")
|
Logger.log("w", "Profile has error values. Aborting slicing")
|
||||||
if self._message:
|
if self._message:
|
||||||
self._message.hide()
|
self._message.hide()
|
||||||
self._message = None
|
self._message = None
|
||||||
|
|
|
@ -18,7 +18,7 @@ from . import Cura_pb2
|
||||||
|
|
||||||
## Formatter class that handles token expansion in start/end gcod
|
## Formatter class that handles token expansion in start/end gcod
|
||||||
class GcodeStartEndFormatter(Formatter):
|
class GcodeStartEndFormatter(Formatter):
|
||||||
def get_value(self, key, args, kwargs):
|
def get_value(self, key, args, kwargs): # [CodeStyle: get_value is an overridden function from the Formatter class]
|
||||||
if isinstance(key, str):
|
if isinstance(key, str):
|
||||||
try:
|
try:
|
||||||
return kwargs[key]
|
return kwargs[key]
|
||||||
|
@ -118,8 +118,8 @@ class StartSliceJob(Job):
|
||||||
msg = Cura_pb2.SettingList()
|
msg = Cura_pb2.SettingList()
|
||||||
settings = profile.getAllSettingValues(include_machine = True)
|
settings = profile.getAllSettingValues(include_machine = True)
|
||||||
start_gcode = settings["machine_start_gcode"]
|
start_gcode = settings["machine_start_gcode"]
|
||||||
settings["material_bed_temp_prepend"] = not "{material_bed_temperature}" in start_gcode
|
settings["material_bed_temp_prepend"] = "{material_bed_temperature}" not in start_gcode
|
||||||
settings["material_print_temp_prepend"] = not "{material_print_temperature}" in start_gcode
|
settings["material_print_temp_prepend"] = "{material_print_temperature}" not in start_gcode
|
||||||
for key, value in settings.items():
|
for key, value in settings.items():
|
||||||
s = msg.settings.add()
|
s = msg.settings.add()
|
||||||
s.name = key
|
s.name = key
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
# 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
|
||||||
catalog = i18nCatalog("cura")
|
|
||||||
|
|
||||||
from . import GCodeReader
|
from . import GCodeReader
|
||||||
|
|
||||||
|
catalog = i18nCatalog("cura")
|
||||||
|
|
||||||
def getMetaData():
|
def getMetaData():
|
||||||
return {
|
return {
|
||||||
"plugin": {
|
"plugin": {
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot, pyqtProperty
|
from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot, pyqtProperty
|
||||||
from UM.Application import Application
|
from UM.Application import Application
|
||||||
|
|
||||||
import LayerView
|
import LayerView
|
||||||
|
|
||||||
class LayerViewProxy(QObject):
|
class LayerViewProxy(QObject):
|
||||||
def __init__(self, parent = None):
|
def __init__(self, parent = None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
|
@ -110,7 +110,7 @@ class SliceInfo(Extension):
|
||||||
|
|
||||||
# Convert data to bytes
|
# Convert data to bytes
|
||||||
submitted_data = urllib.parse.urlencode(submitted_data)
|
submitted_data = urllib.parse.urlencode(submitted_data)
|
||||||
binary_data = submitted_data.encode('utf-8')
|
binary_data = submitted_data.encode("utf-8")
|
||||||
|
|
||||||
# Submit data
|
# Submit data
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -471,17 +471,17 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
|
||||||
self.showControlInterface()
|
self.showControlInterface()
|
||||||
|
|
||||||
def _setEndstopState(self, endstop_key, value):
|
def _setEndstopState(self, endstop_key, value):
|
||||||
if endstop_key == b'x_min':
|
if endstop_key == b"x_min":
|
||||||
if self._x_min_endstop_pressed != value:
|
if self._x_min_endstop_pressed != value:
|
||||||
self.endstopStateChanged.emit('x_min', value)
|
self.endstopStateChanged.emit("x_min", value)
|
||||||
self._x_min_endstop_pressed = value
|
self._x_min_endstop_pressed = value
|
||||||
elif endstop_key == b'y_min':
|
elif endstop_key == b"y_min":
|
||||||
if self._y_min_endstop_pressed != value:
|
if self._y_min_endstop_pressed != value:
|
||||||
self.endstopStateChanged.emit('y_min', value)
|
self.endstopStateChanged.emit("y_min", value)
|
||||||
self._y_min_endstop_pressed = value
|
self._y_min_endstop_pressed = value
|
||||||
elif endstop_key == b'z_min':
|
elif endstop_key == b"z_min":
|
||||||
if self._z_min_endstop_pressed != value:
|
if self._z_min_endstop_pressed != value:
|
||||||
self.endstopStateChanged.emit('z_min', value)
|
self.endstopStateChanged.emit("z_min", value)
|
||||||
self._z_min_endstop_pressed = value
|
self._z_min_endstop_pressed = value
|
||||||
|
|
||||||
## Listen thread function.
|
## Listen thread function.
|
||||||
|
@ -528,8 +528,8 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
|
||||||
pass
|
pass
|
||||||
#TODO: temperature changed callback
|
#TODO: temperature changed callback
|
||||||
elif b"_min" in line or b"_max" in line:
|
elif b"_min" in line or b"_max" in line:
|
||||||
tag, value = line.split(b':', 1)
|
tag, value = line.split(b":", 1)
|
||||||
self._setEndstopState(tag,(b'H' in value or b'TRIGGERED' in value))
|
self._setEndstopState(tag,(b"H" in value or b"TRIGGERED" in value))
|
||||||
|
|
||||||
if self._is_printing:
|
if self._is_printing:
|
||||||
if line == b"" and time.time() > ok_timeout:
|
if line == b"" and time.time() > ok_timeout:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue