Refactor properties that start with 'get' to avoid confusion between slots & properties

Case in point: LayerViewProxy.getLayerViewType was decorated as a property but was used/intended as a slot.
This commit is contained in:
fieldOfView 2017-02-17 13:35:01 +01:00
parent bb030c724b
commit 9229027001
8 changed files with 18 additions and 18 deletions

View file

@ -705,7 +705,7 @@ class CuraApplication(QtApplication):
sceneBoundingBoxChanged = pyqtSignal() sceneBoundingBoxChanged = pyqtSignal()
@pyqtProperty(bool, notify = activityChanged) @pyqtProperty(bool, notify = activityChanged)
def getPlatformActivity(self): def platformActivity(self):
return self._platform_activity return self._platform_activity
@pyqtProperty(str, notify = sceneBoundingBoxChanged) @pyqtProperty(str, notify = sceneBoundingBoxChanged)

View file

@ -182,7 +182,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
self._dialog.setMachineType(machine_type) self._dialog.setMachineType(machine_type)
self._dialog.setExtruders(extruders) self._dialog.setExtruders(extruders)
self._dialog.setVariantType(variant_type_name) self._dialog.setVariantType(variant_type_name)
self._dialog.setHasObjectsOnPlate(Application.getInstance().getPlatformActivity) self._dialog.setHasObjectsOnPlate(Application.getInstance().platformActivity)
self._dialog.show() self._dialog.show()
# Block until the dialog is closed. # Block until the dialog is closed.

View file

@ -247,7 +247,7 @@ class CuraEngineBackend(Backend):
return return
if job.getResult() == StartSliceJob.StartJobResult.MaterialIncompatible: if job.getResult() == StartSliceJob.StartJobResult.MaterialIncompatible:
if Application.getInstance().getPlatformActivity: if Application.getInstance().platformActivity:
self._error_message = Message(catalog.i18nc("@info:status", self._error_message = Message(catalog.i18nc("@info:status",
"The selected material is incompatible with the selected machine or configuration.")) "The selected material is incompatible with the selected machine or configuration."))
self._error_message.show() self._error_message.show()
@ -257,7 +257,7 @@ class CuraEngineBackend(Backend):
return return
if job.getResult() == StartSliceJob.StartJobResult.SettingError: if job.getResult() == StartSliceJob.StartJobResult.SettingError:
if Application.getInstance().getPlatformActivity: if Application.getInstance().platformActivity:
extruders = list(ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId())) extruders = list(ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId()))
error_keys = [] error_keys = []
for extruder in extruders: for extruder in extruders:
@ -278,7 +278,7 @@ class CuraEngineBackend(Backend):
return return
if job.getResult() == StartSliceJob.StartJobResult.BuildPlateError: if job.getResult() == StartSliceJob.StartJobResult.BuildPlateError:
if Application.getInstance().getPlatformActivity: if Application.getInstance().platformActivity:
self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice because the prime tower or prime position(s) are invalid.")) self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice because the prime tower or prime position(s) are invalid."))
self._error_message.show() self._error_message.show()
self.backendStateChange.emit(BackendState.Error) self.backendStateChange.emit(BackendState.Error)
@ -286,7 +286,7 @@ class CuraEngineBackend(Backend):
self.backendStateChange.emit(BackendState.NotStarted) self.backendStateChange.emit(BackendState.NotStarted)
if job.getResult() == StartSliceJob.StartJobResult.NothingToSlice: if job.getResult() == StartSliceJob.StartJobResult.NothingToSlice:
if Application.getInstance().getPlatformActivity: if Application.getInstance().platformActivity:
self._error_message = Message(catalog.i18nc("@info:status", "Nothing to slice because none of the models fit the build volume. Please scale or rotate models to fit.")) self._error_message = Message(catalog.i18nc("@info:status", "Nothing to slice because none of the models fit the build volume. Please scale or rotate models to fit."))
self._error_message.show() self._error_message.show()
self.backendStateChange.emit(BackendState.Error) self.backendStateChange.emit(BackendState.Error)

View file

@ -75,7 +75,7 @@ Item
border.color: UM.Theme.getColor("slider_groove_border") border.color: UM.Theme.getColor("slider_groove_border")
color: UM.Theme.getColor("tool_panel_background") color: UM.Theme.getColor("tool_panel_background")
visible: UM.LayerView.getLayerActivity && Printer.getPlatformActivity ? true : false visible: UM.LayerView.layerActivity && Printer.platformActivity ? true : false
TextField TextField
{ {
@ -214,7 +214,7 @@ Item
UM.LayerView.setExtruderOpacity(0, checked ? 1.0 : 0.0); UM.LayerView.setExtruderOpacity(0, checked ? 1.0 : 0.0);
} }
text: "Extruder 1" text: "Extruder 1"
visible: !UM.LayerView.compatibilityMode && (UM.LayerView.getExtruderCount >= 1) visible: !UM.LayerView.compatibilityMode && (UM.LayerView.extruderCount >= 1)
} }
CheckBox { CheckBox {
checked: true checked: true
@ -222,7 +222,7 @@ Item
UM.LayerView.setExtruderOpacity(1, checked ? 1.0 : 0.0); UM.LayerView.setExtruderOpacity(1, checked ? 1.0 : 0.0);
} }
text: "Extruder 2" text: "Extruder 2"
visible: !UM.LayerView.compatibilityMode && (UM.LayerView.getExtruderCount >= 2) visible: !UM.LayerView.compatibilityMode && (UM.LayerView.extruderCount >= 2)
} }
CheckBox { CheckBox {
checked: true checked: true
@ -230,7 +230,7 @@ Item
UM.LayerView.setExtruderOpacity(2, checked ? 1.0 : 0.0); UM.LayerView.setExtruderOpacity(2, checked ? 1.0 : 0.0);
} }
text: "Extruder 3" text: "Extruder 3"
visible: !UM.LayerView.compatibilityMode && (UM.LayerView.getExtruderCount >= 3) visible: !UM.LayerView.compatibilityMode && (UM.LayerView.etruderCount >= 3)
} }
CheckBox { CheckBox {
checked: true checked: true
@ -238,11 +238,11 @@ Item
UM.LayerView.setExtruderOpacity(3, checked ? 1.0 : 0.0); UM.LayerView.setExtruderOpacity(3, checked ? 1.0 : 0.0);
} }
text: "Extruder 4" text: "Extruder 4"
visible: !UM.LayerView.compatibilityMode && (UM.LayerView.getExtruderCount >= 4) visible: !UM.LayerView.compatibilityMode && (UM.LayerView.extruderCount >= 4)
} }
Label { Label {
text: "Other extruders always visible" text: "Other extruders always visible"
visible: !UM.LayerView.compatibilityMode && (UM.LayerView.getExtruderCount >= 5) visible: !UM.LayerView.compatibilityMode && (UM.LayerView.extruderCount >= 5)
} }
CheckBox { CheckBox {
onClicked: { onClicked: {

View file

@ -20,7 +20,7 @@ class LayerViewProxy(QObject):
preferencesChanged = pyqtSignal() preferencesChanged = pyqtSignal()
@pyqtProperty(bool, notify = activityChanged) @pyqtProperty(bool, notify = activityChanged)
def getLayerActivity(self): def layerActivity(self):
active_view = self._controller.getActiveView() active_view = self._controller.getActiveView()
if type(active_view) == LayerView.LayerView.LayerView: if type(active_view) == LayerView.LayerView.LayerView:
return active_view.getActivity() return active_view.getActivity()
@ -79,7 +79,7 @@ class LayerViewProxy(QObject):
if type(active_view) == LayerView.LayerView.LayerView: if type(active_view) == LayerView.LayerView.LayerView:
active_view.setLayerViewType(layer_view_type) active_view.setLayerViewType(layer_view_type)
@pyqtProperty(bool) @pyqtSlot(result = int)
def getLayerViewType(self): def getLayerViewType(self):
active_view = self._controller.getActiveView() active_view = self._controller.getActiveView()
if type(active_view) == LayerView.LayerView.LayerView: if type(active_view) == LayerView.LayerView.LayerView:
@ -124,7 +124,7 @@ class LayerViewProxy(QObject):
active_view.setShowInfill(show) active_view.setShowInfill(show)
@pyqtProperty(int, notify = globalStackChanged) @pyqtProperty(int, notify = globalStackChanged)
def getExtruderCount(self): def extruderCount(self):
active_view = self._controller.getActiveView() active_view = self._controller.getActiveView()
if type(active_view) == LayerView.LayerView.LayerView: if type(active_view) == LayerView.LayerView.LayerView:
return active_view.getExtruderCount() return active_view.getExtruderCount()

View file

@ -12,7 +12,7 @@ import Cura 1.0 as Cura
Item { Item {
id: base id: base
property bool activity: Printer.getPlatformActivity property bool activity: Printer.platformActivity
property string fileBaseName property string fileBaseName
property variant activeMachineName: Cura.MachineManager.activeMachineName property variant activeMachineName: Cura.MachineManager.activeMachineName

View file

@ -80,7 +80,7 @@ Item
} }
} }
property bool activity: Printer.getPlatformActivity; property bool activity: Printer.platformActivity;
property int totalHeight: childrenRect.height + UM.Theme.getSize("default_margin").height property int totalHeight: childrenRect.height + UM.Theme.getSize("default_margin").height
property string fileBaseName property string fileBaseName
property string statusText: property string statusText:

View file

@ -14,7 +14,7 @@ Item {
property real progress: UM.Backend.progress; property real progress: UM.Backend.progress;
property int backendState: UM.Backend.state; property int backendState: UM.Backend.state;
property bool activity: Printer.getPlatformActivity; property bool activity: Printer.platformActivity;
property int totalHeight: childrenRect.height + UM.Theme.getSize("default_margin").height property int totalHeight: childrenRect.height + UM.Theme.getSize("default_margin").height
property string fileBaseName property string fileBaseName
property string statusText: property string statusText: