diff options
author | Youness Alaoui <kakaroto@kakaroto.homelinux.net> | 2015-09-02 21:23:17 +0300 |
---|---|---|
committer | Youness Alaoui <kakaroto@kakaroto.homelinux.net> | 2015-09-02 21:26:59 +0300 |
commit | 6650dc400abc2f5815244360d0f269d2b5d4eca0 (patch) | |
tree | e4134fc3fb30c116be9359189b700297f390a1cf | |
parent | add4ed4acaa53682f51647819b1a45c6b6e61bef (diff) |
Do not crash if a machine has no materials at all
-rw-r--r-- | Cura/gui/simpleMode.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/Cura/gui/simpleMode.py b/Cura/gui/simpleMode.py index b252ad77a3..288fee4748 100644 --- a/Cura/gui/simpleMode.py +++ b/Cura/gui/simpleMode.py @@ -159,7 +159,7 @@ class simpleModePanel(wx.Panel): if button.profile == selectedMaterial: button.SetValue(True) break - self._materialSelected(None) + self._materialSelected(None) self.Layout() def _materialTypeSelected(self, e): @@ -224,6 +224,13 @@ class simpleModePanel(wx.Panel): boxsizer.Clear(True) self._print_profile_options = [] + if material is None: + self.printOptionsBox.Show(False) + self.printTypePanel.Show(False) + return + self.printOptionsBox.Show(True) + self.printTypePanel.Show(True) + # Add new profiles selectedProfile = None for print_profile in material.profiles: @@ -301,7 +308,9 @@ class simpleModePanel(wx.Panel): self._update(e) def _update(self, e): - profile.putProfileSetting('simpleModeMaterial', self._getSelectedMaterial().name) + material = self._getSelectedMaterial() + if material: + profile.putProfileSetting('simpleModeMaterial', material.name) for button in self._print_profile_options: if button.GetValue(): profile.putProfileSetting('simpleModeProfile', button.profile.name) @@ -314,7 +323,9 @@ class simpleModePanel(wx.Panel): settings[setting.getName()] = setting.getDefault() # Apply materials, profile, then options - settings.update(self._getSelectedMaterial().getProfileDict()) + material = self._getSelectedMaterial() + if material: + settings.update(material.getProfileDict()) for button in self._print_profile_options: if button.GetValue(): settings.update(button.profile.getProfileDict()) |