diff options
author | Ghostkeeper <rubend@tutanota.com> | 2017-05-03 15:56:52 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2017-05-03 15:56:52 +0300 |
commit | 86f1a0559f678d471d374c69397e6b3fbadc5031 (patch) | |
tree | f0dcd3f7507f9f1f3c866a74cdd185714ed3afa4 | |
parent | d95488a9401ec5f9ac20512583797ef007efa051 (diff) |
Add documentation and further specify except around disconnecting signals
Catch just a TypeError instead of all exceptions. Added documentation to say why we catch a TypeError there. Also splitted up the try-except block for the 3 disconnects, just so that if the first fails we still try to disconnect from the other two.
Contributes to issue CURA-3497.
-rw-r--r-- | cura/PrintInformation.py | 2 | ||||
-rwxr-xr-x | cura/Settings/MachineManager.py | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/cura/PrintInformation.py b/cura/PrintInformation.py index cdb558b77c..ab63e4034d 100644 --- a/cura/PrintInformation.py +++ b/cura/PrintInformation.py @@ -185,7 +185,7 @@ class PrintInformation(QObject): if self._active_material_container: try: self._active_material_container.metaDataChanged.disconnect(self._onMaterialMetaDataChanged) - except TypeError: + except TypeError: #pyQtSignal gives a TypeError when disconnecting from something that is already disconnected. pass active_material_id = Application.getInstance().getMachineManager().activeMaterialId diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index e01c16849a..f94bffc643 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -236,9 +236,15 @@ class MachineManager(QObject): if self._global_container_stack: try: self._global_container_stack.nameChanged.disconnect(self._onMachineNameChanged) + except TypeError: #pyQtSignal gives a TypeError when disconnecting from something that was already disconnected. + pass + try: self._global_container_stack.containersChanged.disconnect(self._onInstanceContainersChanged) + except TypeError: + pass + try: self._global_container_stack.propertyChanged.disconnect(self._onPropertyChanged) - except: + except TypeError: pass material = self._global_container_stack.material material.nameChanged.disconnect(self._onMaterialNameChanged) |