Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYouness Alaoui <kakaroto@kakaroto.homelinux.net>2015-09-02 00:02:23 +0300
committerYouness Alaoui <kakaroto@kakaroto.homelinux.net>2015-09-02 00:02:23 +0300
commit8ade22e986452aac95b75232db2260edc0d1b10a (patch)
tree00d210ba758a94a5487f5978f940d51a8ae88607
parent798a1e0a7707f82503a0808be523be4c0e76a250 (diff)
WIP: Add material_types combobox to quickprint profile
-rw-r--r--Cura/gui/simpleMode.py47
-rw-r--r--Cura/util/profile.py5
-rw-r--r--Cura/util/resources.py5
3 files changed, 52 insertions, 5 deletions
diff --git a/Cura/gui/simpleMode.py b/Cura/gui/simpleMode.py
index 7142ab3e4e..f34d31d492 100644
--- a/Cura/gui/simpleMode.py
+++ b/Cura/gui/simpleMode.py
@@ -19,6 +19,22 @@ class simpleModePanel(wx.Panel):
materials = resources.getSimpleModeMaterials()
+ self.material_types = {}
+ self.material_types[_("Others")] = []
+ for material in materials:
+ if material.disabled:
+ continue
+ if len(material.types) == 0:
+ self.material_types[_("Others")].append(material)
+ for type in material.types:
+ if self.material_types.has_key(type):
+ self.material_types[type].append(material)
+ else:
+ self.material_types[type] = [material]
+
+ if len(self.material_types[_("Others")]) == 0:
+ del self.material_types[_("Others")]
+
# Create material buttons
self.printMaterialPanel = wx.Panel(self)
selectedMaterial = None
@@ -47,11 +63,36 @@ class simpleModePanel(wx.Panel):
self.printMaterialPanel.Show(len(self._print_material_options) > 1 and \
self._print_material_options[0].profile.always_visible)
+ # Create material types combobox
+ self.printMaterialTypesPanel = wx.Panel(self)
+ selectedMaterialType = None
+ for material_type in self.material_types:
+ if profile.getProfileSetting('simpleModeMaterialType') == material_type and \
+ selectedMaterial.profile in self.material_types[material_type]:
+ selectedMaterialType = material_type
+
+ if selectedMaterialType is None:
+ if len(selectedMaterial.profile.types) == 0:
+ selectedMaterialType = _("Others")
+ else:
+ selectedMaterialType = selectedMaterial.profile.types[0]
+
+
self.printTypePanel = wx.Panel(self)
sizer = wx.GridBagSizer()
self.SetSizer(sizer)
+ sb = wx.StaticBox(self.printMaterialTypesPanel, label=_("Material types:"))
+ boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL)
+ boxsizer.SetMinSize((80, 20))
+ combobox = wx.ComboBox(self.printMaterialTypesPanel, -1, selectedMaterialType,
+ choices=self.material_types.keys(), style=wx.CB_READONLY)
+ boxsizer.Add(combobox)
+ self.printMaterialTypesPanel.SetSizer(wx.BoxSizer(wx.VERTICAL))
+ self.printMaterialTypesPanel.GetSizer().Add(boxsizer, flag=wx.EXPAND)
+ sizer.Add(self.printMaterialTypesPanel, (0,0), border=10, flag=wx.EXPAND|wx.RIGHT|wx.LEFT|wx.TOP)
+
sb = wx.StaticBox(self.printMaterialPanel, label=_("Material:"))
boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL)
boxsizer.SetMinSize((80, 20))
@@ -59,20 +100,20 @@ class simpleModePanel(wx.Panel):
boxsizer.Add(button)
self.printMaterialPanel.SetSizer(wx.BoxSizer(wx.VERTICAL))
self.printMaterialPanel.GetSizer().Add(boxsizer, flag=wx.EXPAND)
- sizer.Add(self.printMaterialPanel, (0,0), border=10, flag=wx.EXPAND|wx.RIGHT|wx.LEFT|wx.TOP)
+ sizer.Add(self.printMaterialPanel, (1,0), border=10, flag=wx.EXPAND|wx.RIGHT|wx.LEFT|wx.TOP)
sb = wx.StaticBox(self.printTypePanel, label=_("Select a quickprint profile:"))
boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL)
boxsizer.SetMinSize((180, 20))
self.printTypePanel.SetSizer(wx.BoxSizer(wx.VERTICAL))
self.printTypePanel.GetSizer().Add(boxsizer, flag=wx.EXPAND)
- sizer.Add(self.printTypePanel, (1,0), border=10, flag=wx.EXPAND|wx.RIGHT|wx.LEFT|wx.TOP)
+ sizer.Add(self.printTypePanel, (2,0), border=10, flag=wx.EXPAND|wx.RIGHT|wx.LEFT|wx.TOP)
self.printOptionsBox = wx.StaticBox(self, label=_("Other options:"))
boxsizer = wx.StaticBoxSizer(self.printOptionsBox, wx.VERTICAL)
boxsizer.SetMinSize((100, 20))
- sizer.Add(boxsizer, (2,0), border=10, flag=wx.EXPAND|wx.RIGHT|wx.LEFT|wx.TOP)
+ sizer.Add(boxsizer, (3,0), border=10, flag=wx.EXPAND|wx.RIGHT|wx.LEFT|wx.TOP)
self.printOptionsSizer = boxsizer
for button in self._print_material_options:
diff --git a/Cura/util/profile.py b/Cura/util/profile.py
index 080310c8b7..e71018f470 100644
--- a/Cura/util/profile.py
+++ b/Cura/util/profile.py
@@ -482,8 +482,9 @@ setting('postSwitchExtruder.gcode', """;Switch between the current extruder and
""", str, 'alteration', 'alteration')
setting('startMode', 'Simple', ['Simple', 'Normal'], 'preference', 'hidden')
-setting('simpleModeProfile', '2_normal', str, 'hidden', 'hidden')
-setting('simpleModeMaterial', '1_pla', str, 'hidden', 'hidden')
+setting('simpleModeProfile', 'Standard', str, 'hidden', 'hidden')
+setting('simpleModeMaterial', 'PLA', str, 'hidden', 'hidden')
+setting('simpleModeMaterialType', 'Beginner', str, 'hidden', 'hidden')
setting('oneAtATime', 'False', bool, 'preference', 'hidden')
setting('lastFile', os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'resources', 'example', 'Rocktopus.stl')), str, 'preference', 'hidden')
setting('save_profile', 'False', bool, 'preference', 'hidden').setLabel(_("Save profile on slice"), _("When slicing save the profile as [stl_file]_profile.ini next to the model."))
diff --git a/Cura/util/resources.py b/Cura/util/resources.py
index c0ce5f367b..0841711e0f 100644
--- a/Cura/util/resources.py
+++ b/Cura/util/resources.py
@@ -204,7 +204,12 @@ class PrintMaterial(ProfileIni):
self.profiles = []
self.options = []
+ self.types = []
+ types = self._getProfileInfo(self.ini, 'material_types')
+ if types != None:
+ for type in types.split('|'):
+ self.types.append(type.strip())
self.parseDirectory(self.path)
def parseDirectory(self, path):