Merge branch 'master' into fix_per_meshgroup_settings

This commit is contained in:
fieldOfView 2018-03-15 10:46:58 +01:00
commit 4a1f0a21ad
4 changed files with 42 additions and 24 deletions

View File

@ -3,7 +3,7 @@
from UM.Qt.ListModel import ListModel from UM.Qt.ListModel import ListModel
from PyQt5.QtCore import pyqtSlot, pyqtProperty, Qt, pyqtSignal from PyQt5.QtCore import Qt
from UM.Settings.ContainerRegistry import ContainerRegistry from UM.Settings.ContainerRegistry import ContainerRegistry
from UM.Settings.ContainerStack import ContainerStack from UM.Settings.ContainerStack import ContainerStack
@ -11,6 +11,7 @@ from UM.Settings.ContainerStack import ContainerStack
from UM.i18n import i18nCatalog from UM.i18n import i18nCatalog
catalog = i18nCatalog("cura") catalog = i18nCatalog("cura")
# #
# This the QML model for the quality management page. # This the QML model for the quality management page.
# #
@ -39,7 +40,7 @@ class MachineManagementModel(ListModel):
## Handler for container added/removed events from registry ## Handler for container added/removed events from registry
def _onContainerChanged(self, container): def _onContainerChanged(self, container):
# We only need to update when the added / removed container is a stack. # We only need to update when the added / removed container is a stack.
if isinstance(container, ContainerStack): if isinstance(container, ContainerStack) and container.getMetaDataEntry("type") == "machine":
self._update() self._update()
## Private convenience function to reset & repopulate the model. ## Private convenience function to reset & repopulate the model.
@ -47,7 +48,9 @@ class MachineManagementModel(ListModel):
items = [] items = []
# Get first the network enabled printers # Get first the network enabled printers
network_filter_printers = {"type": "machine", "um_network_key": "*", "hidden": "False"} network_filter_printers = {"type": "machine",
"um_network_key": "*",
"hidden": "False"}
self._network_container_stacks = ContainerRegistry.getInstance().findContainerStacks(**network_filter_printers) self._network_container_stacks = ContainerRegistry.getInstance().findContainerStacks(**network_filter_printers)
self._network_container_stacks.sort(key = lambda i: i.getMetaDataEntry("connect_group_name")) self._network_container_stacks.sort(key = lambda i: i.getMetaDataEntry("connect_group_name"))
@ -57,11 +60,11 @@ class MachineManagementModel(ListModel):
metadata["definition_name"] = container.getBottom().getName() metadata["definition_name"] = container.getBottom().getName()
items.append({"name": metadata["connect_group_name"], items.append({"name": metadata["connect_group_name"],
"id": container.getId(), "id": container.getId(),
"metadata": metadata, "metadata": metadata,
"group": catalog.i18nc("@info:title", "Network enabled printers")}) "group": catalog.i18nc("@info:title", "Network enabled printers")})
# Get now the local printes # Get now the local printers
local_filter_printers = {"type": "machine", "um_network_key": None} local_filter_printers = {"type": "machine", "um_network_key": None}
self._local_container_stacks = ContainerRegistry.getInstance().findContainerStacks(**local_filter_printers) self._local_container_stacks = ContainerRegistry.getInstance().findContainerStacks(**local_filter_printers)
self._local_container_stacks.sort(key = lambda i: i.getName()) self._local_container_stacks.sort(key = lambda i: i.getName())
@ -72,8 +75,8 @@ class MachineManagementModel(ListModel):
metadata["definition_name"] = container.getBottom().getName() metadata["definition_name"] = container.getBottom().getName()
items.append({"name": container.getName(), items.append({"name": container.getName(),
"id": container.getId(), "id": container.getId(),
"metadata": metadata, "metadata": metadata,
"group": catalog.i18nc("@info:title", "Local printers")}) "group": catalog.i18nc("@info:title", "Local printers")})
self.setItems(items) self.setItems(items)

View File

@ -38,16 +38,16 @@
"machine_max_feedrate_z": { "machine_max_feedrate_z": {
"default_value": 400 "default_value": 400
}, },
"steps_per_mm_x": { "machine_steps_per_mm_x": {
"default_value": 93 "default_value": 93
}, },
"steps_per_mm_y": { "machine_steps_per_mm_y": {
"default_value": 93 "default_value": 93
}, },
"steps_per_mm_z": { "machine_steps_per_mm_z": {
"default_value": 1600 "default_value": 1600
}, },
"steps_per_mm_e": { "machine_steps_per_mm_e": {
"default_value": 92 "default_value": 92
}, },
"gantry_height": { "gantry_height": {

View File

@ -55,7 +55,7 @@ ToolButton
PrinterStatusIcon PrinterStatusIcon
{ {
id: printerStatusIcon id: printerStatusIcon
visible: printerConnected visible: printerConnected || isNetworkPrinter
status: printerStatus status: printerStatus
anchors anchors
{ {

View File

@ -13,11 +13,17 @@ SettingItem
property string textBeforeEdit property string textBeforeEdit
property bool textHasChanged property bool textHasChanged
property bool focusGainedByClick: false
onFocusReceived: onFocusReceived:
{ {
textHasChanged = false; textHasChanged = false;
textBeforeEdit = focusItem.text; textBeforeEdit = focusItem.text;
focusItem.selectAll();
if(!focusGainedByClick)
{
// select all text when tabbing through fields (but not when selecting a field with the mouse)
focusItem.selectAll();
}
} }
contents: Rectangle contents: Rectangle
@ -93,14 +99,6 @@ SettingItem
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
} }
MouseArea
{
id: mouseArea
anchors.fill: parent;
//hoverEnabled: true;
cursorShape: Qt.IBeamCursor
}
TextInput TextInput
{ {
id: input id: input
@ -142,6 +140,7 @@ SettingItem
{ {
base.focusReceived(); base.focusReceived();
} }
base.focusGainedByClick = false;
} }
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text") color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text")
@ -178,6 +177,22 @@ SettingItem
} }
when: !input.activeFocus when: !input.activeFocus
} }
MouseArea
{
id: mouseArea
anchors.fill: parent;
cursorShape: Qt.IBeamCursor
onPressed: {
if(!input.activeFocus) {
base.focusGainedByClick = true;
input.forceActiveFocus();
}
mouse.accepted = false;
}
}
} }
} }
} }