mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-30 22:31:21 -07:00
Merge pull request #665 from thopiekar/master-code-fixes
Fixing small issues in the code
This commit is contained in:
commit
e4effc1236
16 changed files with 25 additions and 45 deletions
|
|
@ -12,10 +12,7 @@ from UM.Math.Quaternion import Quaternion
|
|||
|
||||
from UM.Job import Job
|
||||
|
||||
import os
|
||||
import struct
|
||||
import math
|
||||
from os import listdir
|
||||
import zipfile
|
||||
|
||||
import xml.etree.ElementTree as ET
|
||||
|
|
@ -32,8 +29,6 @@ class ThreeMFReader(MeshReader):
|
|||
}
|
||||
|
||||
def read(self, file_name):
|
||||
result = None
|
||||
|
||||
result = SceneNode()
|
||||
# The base object of 3mf is a zipped archive.
|
||||
archive = zipfile.ZipFile(file_name, "r")
|
||||
|
|
@ -46,16 +41,16 @@ class ThreeMFReader(MeshReader):
|
|||
Logger.log("w", "No objects found in 3MF file %s, either the file is corrupt or you are using an outdated format", file_name)
|
||||
return None
|
||||
|
||||
for object in objects:
|
||||
for entry in objects:
|
||||
mesh = MeshData()
|
||||
node = SceneNode()
|
||||
vertex_list = []
|
||||
#for vertex in object.mesh.vertices.vertex:
|
||||
for vertex in object.findall(".//3mf:vertex", self._namespaces):
|
||||
#for vertex in entry.mesh.vertices.vertex:
|
||||
for vertex in entry.findall(".//3mf:vertex", self._namespaces):
|
||||
vertex_list.append([vertex.get("x"), vertex.get("y"), vertex.get("z")])
|
||||
Job.yieldThread()
|
||||
|
||||
triangles = object.findall(".//3mf:triangle", self._namespaces)
|
||||
triangles = entry.findall(".//3mf:triangle", self._namespaces)
|
||||
|
||||
mesh.reserveFaceCount(len(triangles))
|
||||
|
||||
|
|
@ -72,7 +67,7 @@ class ThreeMFReader(MeshReader):
|
|||
node.setMeshData(mesh)
|
||||
node.setSelectable(True)
|
||||
|
||||
transformation = root.findall("./3mf:build/3mf:item[@objectid='{0}']".format(object.get("id")), self._namespaces)
|
||||
transformation = root.findall("./3mf:build/3mf:item[@objectid='{0}']".format(entry.get("id")), self._namespaces)
|
||||
if transformation:
|
||||
transformation = transformation[0]
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
# Cura is released under the terms of the AGPLv3 or higher.
|
||||
|
||||
from UM.View.View import View
|
||||
from UM.View.Renderer import Renderer
|
||||
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
|
||||
from UM.Resources import Resources
|
||||
from UM.Event import Event, KeyEvent
|
||||
|
|
@ -11,7 +10,6 @@ from UM.Scene.Selection import Selection
|
|||
from UM.Math.Color import Color
|
||||
from UM.Mesh.MeshData import MeshData
|
||||
from UM.Job import Job
|
||||
from UM.Message import Message
|
||||
|
||||
from UM.View.RenderBatch import RenderBatch
|
||||
from UM.View.GL.OpenGL import OpenGL
|
||||
|
|
@ -23,7 +21,6 @@ from PyQt5.QtWidgets import QApplication
|
|||
|
||||
from . import LayerViewProxy
|
||||
|
||||
import time
|
||||
from UM.i18n import i18nCatalog
|
||||
catalog = i18nCatalog("cura")
|
||||
|
||||
|
|
@ -139,7 +136,7 @@ class LayerView(View):
|
|||
|
||||
def calculateMaxLayers(self):
|
||||
scene = self.getController().getScene()
|
||||
renderer = self.getRenderer()
|
||||
renderer = self.getRenderer() # TODO: Unused variable
|
||||
self._activity = True
|
||||
|
||||
self._old_max_layers = self._max_layers
|
||||
|
|
|
|||
|
|
@ -51,10 +51,10 @@ class LegacyProfileReader(ProfileReader):
|
|||
# \return A set of local variables, one for each setting in the legacy
|
||||
# profile.
|
||||
def prepareLocals(self, config_parser, config_section, defaults):
|
||||
locals = defaults.copy() #Don't edit the original!
|
||||
copied_locals = defaults.copy() #Don't edit the original!
|
||||
for option in config_parser.options(config_section):
|
||||
locals[option] = config_parser.get(config_section, option)
|
||||
return locals
|
||||
copied_locals[option] = config_parser.get(config_section, option)
|
||||
return copied_locals
|
||||
|
||||
## Reads a legacy Cura profile from a file and returns it.
|
||||
#
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
from UM.Tool import Tool
|
||||
from UM.Scene.Selection import Selection
|
||||
from UM.Application import Application
|
||||
from UM.Qt.ListModel import ListModel
|
||||
from UM.Preferences import Preferences
|
||||
|
||||
from . import PerObjectSettingsModel
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
from . import RemovableDrivePlugin
|
||||
|
||||
from UM.Logger import Logger
|
||||
|
||||
import glob
|
||||
import os
|
||||
import subprocess
|
||||
|
|
@ -33,6 +35,7 @@ class LinuxRemovableDrivePlugin(RemovableDrivePlugin.RemovableDrivePlugin):
|
|||
def performEjectDevice(self, device):
|
||||
p = subprocess.Popen(["umount", device.getId()], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
output = p.communicate()
|
||||
Logger.log("d", "umount returned: %s.", repr(output))
|
||||
|
||||
return_code = p.wait()
|
||||
if return_code != 0:
|
||||
|
|
|
|||
|
|
@ -4,10 +4,9 @@
|
|||
|
||||
from . import RemovableDrivePlugin
|
||||
|
||||
import threading
|
||||
from UM.Logger import Logger
|
||||
|
||||
import subprocess
|
||||
import time
|
||||
import os
|
||||
|
||||
import plistlib
|
||||
|
|
@ -44,8 +43,9 @@ class OSXRemovableDrivePlugin(RemovableDrivePlugin.RemovableDrivePlugin):
|
|||
return drives
|
||||
|
||||
def performEjectDevice(self, device):
|
||||
p = subprocess.Popen(["diskutil", "eject", path], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
p = subprocess.Popen(["diskutil", "eject", device.getId()], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
output = p.communicate()
|
||||
Logger.log("d", "umount returned: %s.", repr(output))
|
||||
|
||||
return_code = p.wait()
|
||||
if return_code != 0:
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class SliceInfo(Extension):
|
|||
break
|
||||
|
||||
|
||||
profile_values = settings.getChangedSettings()
|
||||
profile_values = settings.getChangedSettings() # TODO: Unused variable
|
||||
|
||||
# Get total material used (in mm^3)
|
||||
print_information = Application.getInstance().getPrintInformation()
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import time
|
|||
import queue
|
||||
import re
|
||||
import functools
|
||||
import os
|
||||
import os.path
|
||||
|
||||
from UM.Application import Application
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ import threading
|
|||
import platform
|
||||
import glob
|
||||
import time
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
from UM.Extension import Extension
|
||||
|
|
@ -60,7 +59,7 @@ class USBPrinterManager(QObject, SignalEmitter, OutputDevicePlugin, Extension):
|
|||
@pyqtProperty(float, notify = progressChanged)
|
||||
def progress(self):
|
||||
progress = 0
|
||||
for name, connection in self._printer_connections.items():
|
||||
for printer_name, connection in self._printer_connections.items():
|
||||
progress += connection.progress
|
||||
|
||||
return progress / len(self._printer_connections)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue