Determine readonly state from location in filesystem instead of a metadata property

CURA-1684
This commit is contained in:
fieldOfView 2016-06-09 13:16:23 +02:00
parent 5da3665832
commit cd803bc36e
43 changed files with 9 additions and 48 deletions

View file

@ -266,7 +266,7 @@ class MachineManagerModel(QObject):
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id=container_id) containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id=container_id)
if not containers or not self._global_container_stack: if not containers or not self._global_container_stack:
return True return True
return containers[0].getMetaDataEntry("read_only", False) == "True" return containers[0].isReadOnly()
@pyqtSlot(result = str) @pyqtSlot(result = str)
def convertUserContainerToQuality(self): def convertUserContainerToQuality(self):
@ -288,7 +288,7 @@ class MachineManagerModel(QObject):
## Change type / id / name ## Change type / id / name
new_quality_container.setMetaDataEntry("type", "quality") new_quality_container.setMetaDataEntry("type", "quality")
new_quality_container.setMetaDataEntry("read_only", False) new_quality_container.setReadOnly(False)
new_quality_container.setName(name) new_quality_container.setName(name)
new_quality_container._id = name new_quality_container._id = name
@ -310,7 +310,7 @@ class MachineManagerModel(QObject):
## Copy all values ## Copy all values
new_container.deserialize(containers[0].serialize()) new_container.deserialize(containers[0].serialize())
new_container.setMetaDataEntry("read_only", False) new_container.setReadOnly(False)
new_container.setName(new_name) new_container.setName(new_name)
new_container._id = new_name new_container._id = new_name
UM.Settings.ContainerRegistry.getInstance().addContainer(new_container) UM.Settings.ContainerRegistry.getInstance().addContainer(new_container)

View file

@ -258,13 +258,13 @@ UM.MainWindow
{ {
//Insert a separator between readonly and custom profiles //Insert a separator between readonly and custom profiles
if(separatorIndex < 0 && index > 0) { if(separatorIndex < 0 && index > 0) {
if(model.getItem(index-1).metadata.read_only != model.getItem(index).metadata.read_only) { if(model.getItem(index-1).readOnly != model.getItem(index).readOnly) {
profileMenu.insertSeparator(index); profileMenu.insertSeparator(index);
separatorIndex = index; separatorIndex = index;
} }
} }
//Because of the separator, custom profiles move one index lower //Because of the separator, custom profiles move one index lower
profileMenu.insertItem((model.getItem(index).metadata.read_only) ? index : index + 1, object.item); profileMenu.insertItem((model.getItem(index).readOnly) ? index : index + 1, object.item);
} }
onObjectRemoved: onObjectRemoved:
{ {

View file

@ -65,8 +65,8 @@ UM.ManagementPage
activateEnabled: currentItem != null ? currentItem.id != Cura.MachineManager.activeQualityId : false; activateEnabled: currentItem != null ? currentItem.id != Cura.MachineManager.activeQualityId : false;
addEnabled: currentItem != null; addEnabled: currentItem != null;
removeEnabled: currentItem != null ? !currentItem.metadata.read_only : false; removeEnabled: currentItem != null ? !currentItem.readOnly : false;
renameEnabled: currentItem != null ? !currentItem.metadata.read_only : false; renameEnabled: currentItem != null ? !currentItem.readOnly : false;
scrollviewCaption: catalog.i18nc("@label %1 is printer name","Printer: %1").arg(Cura.MachineManager.activeMachineName) scrollviewCaption: catalog.i18nc("@label %1 is printer name","Printer: %1").arg(Cura.MachineManager.activeMachineName)

View file

@ -88,13 +88,13 @@ Item{
{ {
//Insert a separator between readonly and custom profiles //Insert a separator between readonly and custom profiles
if(separatorIndex < 0 && index > 0) { if(separatorIndex < 0 && index > 0) {
if(model.getItem(index-1).metadata.read_only != model.getItem(index).metadata.read_only) { if(model.getItem(index-1).readOnly != model.getItem(index).readOnly) {
profileSelectionMenu.insertSeparator(index); profileSelectionMenu.insertSeparator(index);
separatorIndex = index; separatorIndex = index;
} }
} }
//Because of the separator, custom profiles move one index lower //Because of the separator, custom profiles move one index lower
profileSelectionMenu.insertItem((model.getItem(index).metadata.read_only) ? index : index + 1, object.item); profileSelectionMenu.insertItem((model.getItem(index).readOnly) ? index : index + 1, object.item);
} }
onObjectRemoved: onObjectRemoved:
{ {

View file

@ -6,7 +6,6 @@ definition = fdmprinter
[metadata] [metadata]
type = quality type = quality
weight = -3 weight = -3
read_only = True
[values] [values]
layer_height = 0.06 layer_height = 0.06

View file

@ -6,7 +6,6 @@ definition = fdmprinter
[metadata] [metadata]
type = quality type = quality
weight = -1 weight = -1
read_only = True
[values] [values]
infill_sparse_density = 10 infill_sparse_density = 10

View file

@ -6,6 +6,5 @@ definition = fdmprinter
[metadata] [metadata]
type = quality type = quality
weight = -2 weight = -2
read_only = True
[values] [values]

View file

@ -7,7 +7,6 @@ definition = ultimaker2_extended_plus
type = quality type = quality
material = generic_abs_ultimaker2_extended_plus_0.25_mm material = generic_abs_ultimaker2_extended_plus_0.25_mm
weight = -2 weight = -2
read_only = True
[values] [values]
layer_height = 0.06 layer_height = 0.06

View file

@ -7,7 +7,6 @@ definition = ultimaker2_extended_plus
type = quality type = quality
material = generic_abs_ultimaker2_extended_plus_0.4_mm material = generic_abs_ultimaker2_extended_plus_0.4_mm
weight = -1 weight = -1
read_only = True
[values] [values]
layer_height = 0.15 layer_height = 0.15

View file

@ -7,7 +7,6 @@ definition = ultimaker2_extended_plus
type = quality type = quality
material = generic_abs_ultimaker2_extended_plus_0.4_mm material = generic_abs_ultimaker2_extended_plus_0.4_mm
weight = -3 weight = -3
read_only = True
[values] [values]
layer_height = 0.06 layer_height = 0.06

View file

@ -7,7 +7,6 @@ definition = ultimaker2_extended_plus
type = quality type = quality
material = generic_abs_ultimaker2_extended_plus_0.4_mm material = generic_abs_ultimaker2_extended_plus_0.4_mm
weight = -2 weight = -2
read_only = True
[values] [values]
layer_height = 0.1 layer_height = 0.1

View file

@ -7,7 +7,6 @@ definition = ultimaker2_extended_plus
type = quality type = quality
material = generic_abs_ultimaker2_extended_plus_0.6_mm material = generic_abs_ultimaker2_extended_plus_0.6_mm
weight = -2 weight = -2
read_only = True
[values] [values]
layer_height = 0.15 layer_height = 0.15

View file

@ -7,7 +7,6 @@ definition = ultimaker2_extended_plus
type = quality type = quality
material = generic_abs_ultimaker2_extended_plus_0.8_mm material = generic_abs_ultimaker2_extended_plus_0.8_mm
weight = -2 weight = -2
read_only = True
[values] [values]
layer_height = 0.2 layer_height = 0.2

View file

@ -7,7 +7,6 @@ definition = ultimaker2_extended_plus
type = quality type = quality
material = generic_cpe_ultimaker2_extended_plus_0.25_mm material = generic_cpe_ultimaker2_extended_plus_0.25_mm
weight = -2 weight = -2
read_only = True
[values] [values]
layer_height = 0.06 layer_height = 0.06

View file

@ -7,7 +7,6 @@ definition = ultimaker2_extended_plus
type = quality type = quality
material = generic_cpe_ultimaker2_extended_plus_0.4_mm material = generic_cpe_ultimaker2_extended_plus_0.4_mm
weight = -1 weight = -1
read_only = True
[values] [values]
layer_height = 0.15 layer_height = 0.15

View file

@ -7,7 +7,6 @@ definition = ultimaker2_extended_plus
type = quality type = quality
material = generic_cpe_ultimaker2_extended_plus_0.4_mm material = generic_cpe_ultimaker2_extended_plus_0.4_mm
weight = -3 weight = -3
read_only = True
[values] [values]
layer_height = 0.06 layer_height = 0.06

View file

@ -7,7 +7,6 @@ definition = ultimaker2_extended_plus
type = quality type = quality
material = generic_cpe_ultimaker2_extended_plus_0.4_mm material = generic_cpe_ultimaker2_extended_plus_0.4_mm
weight = -2 weight = -2
read_only = True
[values] [values]
layer_height = 0.1 layer_height = 0.1

View file

@ -7,7 +7,6 @@ definition = ultimaker2_extended_plus
type = quality type = quality
material = generic_cpe_ultimaker2_extended_plus_0.6_mm material = generic_cpe_ultimaker2_extended_plus_0.6_mm
weight = -2 weight = -2
read_only = True
[values] [values]
layer_height = 0.15 layer_height = 0.15

View file

@ -7,7 +7,6 @@ definition = ultimaker2_extended_plus
type = quality type = quality
material = generic_cpe_ultimaker2_extended_plus_0.8_mm material = generic_cpe_ultimaker2_extended_plus_0.8_mm
weight = -2 weight = -2
read_only = True
[values] [values]
layer_height = 0.2 layer_height = 0.2

View file

@ -7,7 +7,6 @@ definition = ultimaker2_extended_plus
type = quality type = quality
material = generic_pla_ultimaker2_extended_plus_0.25_mm material = generic_pla_ultimaker2_extended_plus_0.25_mm
weight = -2 weight = -2
read_only = True
[values] [values]
layer_height = 0.06 layer_height = 0.06

View file

@ -7,7 +7,6 @@ definition = ultimaker2_extended_plus
type = quality type = quality
material = generic_pla_ultimaker2_extended_plus_0.4_mm material = generic_pla_ultimaker2_extended_plus_0.4_mm
weight = -1 weight = -1
read_only = True
[values] [values]
layer_height = 0.15 layer_height = 0.15

View file

@ -7,7 +7,6 @@ definition = ultimaker2_extended_plus
type = quality type = quality
material = generic_pla_ultimaker2_extended_plus_0.4_mm material = generic_pla_ultimaker2_extended_plus_0.4_mm
weight = -3 weight = -3
read_only = True
[values] [values]
layer_height = 0.06 layer_height = 0.06

View file

@ -7,7 +7,6 @@ definition = ultimaker2_extended_plus
type = quality type = quality
material = generic_pla_ultimaker2_extended_plus_0.4_mm material = generic_pla_ultimaker2_extended_plus_0.4_mm
weight = -2 weight = -2
read_only = True
[values] [values]
layer_height = 0.1 layer_height = 0.1

View file

@ -7,7 +7,6 @@ definition = ultimaker2_extended_plus
material = generic_pla_ultimaker2_extended_plus_0.6_mm material = generic_pla_ultimaker2_extended_plus_0.6_mm
type = quality type = quality
weight = -2 weight = -2
read_only = True
[values] [values]
layer_height = 0.15 layer_height = 0.15

View file

@ -7,7 +7,6 @@ definition = ultimaker2_extended_plus
material = generic_pla_ultimaker2_extended_plus_0.8_mm material = generic_pla_ultimaker2_extended_plus_0.8_mm
type = quality type = quality
weight = -2 weight = -2
read_only = True
[values] [values]
layer_height = 0.2 layer_height = 0.2

View file

@ -7,7 +7,6 @@ definition = ultimaker2_plus
type = quality type = quality
material = generic_pla_ultimaker2_plus_0.25_mm material = generic_pla_ultimaker2_plus_0.25_mm
weight = -2 weight = -2
read_only = True
[values] [values]
layer_height = 0.06 layer_height = 0.06

View file

@ -7,7 +7,6 @@ definition = ultimaker2_plus
type = quality type = quality
material = generic_pla_ultimaker2_plus_0.4_mm material = generic_pla_ultimaker2_plus_0.4_mm
weight = -1 weight = -1
read_only = True
[values] [values]
layer_height = 0.15 layer_height = 0.15

View file

@ -7,7 +7,6 @@ definition = ultimaker2_plus
type = quality type = quality
material = generic_pla_ultimaker2_plus_0.4_mm material = generic_pla_ultimaker2_plus_0.4_mm
weight = -3 weight = -3
read_only = True
[values] [values]
layer_height = 0.06 layer_height = 0.06

View file

@ -7,7 +7,6 @@ definition = ultimaker2_plus
type = quality type = quality
material = generic_pla_ultimaker2_plus_0.4_mm material = generic_pla_ultimaker2_plus_0.4_mm
weight = -2 weight = -2
read_only = True
[values] [values]
layer_height = 0.1 layer_height = 0.1

View file

@ -7,7 +7,6 @@ definition = ultimaker2_plus
material = generic_pla_ultimaker2_plus_0.6_mm material = generic_pla_ultimaker2_plus_0.6_mm
type = quality type = quality
weight = -2 weight = -2
read_only = True
[values] [values]
layer_height = 0.15 layer_height = 0.15

View file

@ -7,7 +7,6 @@ definition = ultimaker2_plus
material = generic_pla_ultimaker2_plus_0.8_mm material = generic_pla_ultimaker2_plus_0.8_mm
type = quality type = quality
weight = -2 weight = -2
read_only = True
[values] [values]
layer_height = 0.2 layer_height = 0.2

View file

@ -7,7 +7,6 @@ definition = ultimaker2_plus
type = quality type = quality
material = generic_abs_ultimaker2_plus_0.25_mm material = generic_abs_ultimaker2_plus_0.25_mm
weight = -2 weight = -2
read_only = True
[values] [values]
layer_height = 0.06 layer_height = 0.06

View file

@ -7,7 +7,6 @@ definition = ultimaker2_plus
type = quality type = quality
material = generic_abs_ultimaker2_plus_0.4_mm material = generic_abs_ultimaker2_plus_0.4_mm
weight = -1 weight = -1
read_only = True
[values] [values]
layer_height = 0.15 layer_height = 0.15

View file

@ -7,7 +7,6 @@ definition = ultimaker2_plus
type = quality type = quality
material = generic_abs_ultimaker2_plus_0.4_mm material = generic_abs_ultimaker2_plus_0.4_mm
weight = -3 weight = -3
read_only = True
[values] [values]
layer_height = 0.06 layer_height = 0.06

View file

@ -7,7 +7,6 @@ definition = ultimaker2_plus
type = quality type = quality
material = generic_abs_ultimaker2_plus_0.4_mm material = generic_abs_ultimaker2_plus_0.4_mm
weight = -2 weight = -2
read_only = True
[values] [values]
layer_height = 0.1 layer_height = 0.1

View file

@ -7,7 +7,6 @@ definition = ultimaker2_plus
type = quality type = quality
material = generic_abs_ultimaker2_plus_0.6_mm material = generic_abs_ultimaker2_plus_0.6_mm
weight = -2 weight = -2
read_only = True
[values] [values]
layer_height = 0.15 layer_height = 0.15

View file

@ -7,7 +7,6 @@ definition = ultimaker2_plus
type = quality type = quality
material = generic_abs_ultimaker2_plus_0.8_mm material = generic_abs_ultimaker2_plus_0.8_mm
weight = -2 weight = -2
read_only = True
[values] [values]
layer_height = 0.2 layer_height = 0.2

View file

@ -7,7 +7,6 @@ definition = ultimaker2_plus
type = quality type = quality
material = generic_cpe_ultimaker2_plus_0.25_mm material = generic_cpe_ultimaker2_plus_0.25_mm
weight = -2 weight = -2
read_only = True
[values] [values]
layer_height = 0.06 layer_height = 0.06

View file

@ -7,7 +7,6 @@ definition = ultimaker2_plus
type = quality type = quality
material = generic_cpe_ultimaker2_plus_0.4_mm material = generic_cpe_ultimaker2_plus_0.4_mm
weight = -1 weight = -1
read_only = True
[values] [values]
layer_height = 0.15 layer_height = 0.15

View file

@ -7,7 +7,6 @@ definition = ultimaker2_plus
type = quality type = quality
material = generic_cpe_ultimaker2_plus_0.4_mm material = generic_cpe_ultimaker2_plus_0.4_mm
weight = -3 weight = -3
read_only = True
[values] [values]
layer_height = 0.06 layer_height = 0.06

View file

@ -7,7 +7,6 @@ definition = ultimaker2_plus
type = quality type = quality
material = generic_cpe_ultimaker2_plus_0.4_mm material = generic_cpe_ultimaker2_plus_0.4_mm
weight = -2 weight = -2
read_only = True
[values] [values]
layer_height = 0.1 layer_height = 0.1

View file

@ -7,7 +7,6 @@ definition = ultimaker2_plus
type = quality type = quality
material = generic_cpe_ultimaker2_plus_0.6_mm material = generic_cpe_ultimaker2_plus_0.6_mm
weight = -2 weight = -2
read_only = True
[values] [values]
layer_height = 0.15 layer_height = 0.15

View file

@ -7,7 +7,6 @@ definition = ultimaker2_plus
type = quality type = quality
material = generic_cpe_ultimaker2_plus_0.8_mm material = generic_cpe_ultimaker2_plus_0.8_mm
weight = -2 weight = -2
read_only = True
[values] [values]
layer_height = 0.2 layer_height = 0.2