From: daid Date: Mon, 7 May 2012 14:03:42 +0000 (+0200) Subject: Added preferences to project planner to configure head size X-Git-Tag: RC3~12^2~6 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=c04c09a437da1ee944b6eac96c55a0f05e135a7b;p=cura.git Added preferences to project planner to configure head size --- diff --git a/Cura/gui/projectPlanner.py b/Cura/gui/projectPlanner.py index b24721e5..67317627 100644 --- a/Cura/gui/projectPlanner.py +++ b/Cura/gui/projectPlanner.py @@ -19,6 +19,8 @@ except: from gui import opengl from gui import toolbarUtil from gui import icon +from gui import configBase +from gui import validators from util import profile from util import util3d from util import stl @@ -159,6 +161,8 @@ class projectPlanner(wx.Frame): toolbarUtil.RadioButton(self.toolbar, group, 'object-top-on.png', 'object-top-off.png', 'Topdown view', callback=self.OnTopClick).SetValue(True) self.toolbar.AddSeparator() toolbarUtil.NormalButton(self.toolbar, self.OnQuit, 'exit.png', 'Close project planner') + self.toolbar.AddSeparator() + toolbarUtil.NormalButton(self.toolbar, self.OnPreferences, 'preferences.png', 'Project planner preferences') self.toolbar.Realize() @@ -228,6 +232,11 @@ class projectPlanner(wx.Frame): def OnQuit(self, e): self.Close() + def OnPreferences(self, e): + prefDialog = preferencesDialog(self) + prefDialog.Centre() + prefDialog.Show(True) + def OnSaveProject(self, e): dlg=wx.FileDialog(self, "Save project file", os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_SAVE) dlg.SetWildcard("Project files (*.curaproject)|*.curaproject") @@ -821,6 +830,41 @@ class ProjectSliceProgressWindow(wx.Frame): wx.CallAfter(self.abortButton.SetLabel, 'Close') +class preferencesDialog(configBase.configWindowBase): + def __init__(self, parent): + super(preferencesDialog, self).__init__(title="Project Planner Preferences") + + self.parent = parent + wx.EVT_CLOSE(self, self.OnClose) + + extruderAmount = int(profile.getPreference('extruder_amount')) + + left, right, main = self.CreateConfigPanel(self) + configBase.TitleRow(left, 'Machine head size') + c = configBase.SettingRow(left, 'Head size - X towards home (mm)', 'extruder_head_size_min_x', '0', 'Size of your printer head in the X direction, on the Ultimaker your fan is in this direction.', type = 'preference') + validators.validFloat(c, 0.1) + c = configBase.SettingRow(left, 'Head size - X towards end (mm)', 'extruder_head_size_max_x', '0', 'Size of your printer head in the X direction.', type = 'preference') + validators.validFloat(c, 0.1) + c = configBase.SettingRow(left, 'Head size - Y towards home (mm)', 'extruder_head_size_min_y', '0', 'Size of your printer head in the Y direction.', type = 'preference') + validators.validFloat(c, 0.1) + c = configBase.SettingRow(left, 'Head size - Y towards end (mm)', 'extruder_head_size_max_y', '0', 'Size of your printer head in the Y direction.', type = 'preference') + validators.validFloat(c, 0.1) + + self.okButton = wx.Button(left, -1, 'Ok') + left.GetSizer().Add(self.okButton, (left.GetSizer().GetRows(), 1)) + self.okButton.Bind(wx.EVT_BUTTON, self.OnClose) + + self.MakeModal(True) + main.Fit() + self.Fit() + + def OnClose(self, e): + self.parent.headSizeMin = util3d.Vector3(profile.getPreferenceFloat('extruder_head_size_min_x'), profile.getPreferenceFloat('extruder_head_size_min_y'),0) + self.parent.headSizeMax = util3d.Vector3(profile.getPreferenceFloat('extruder_head_size_max_x'), profile.getPreferenceFloat('extruder_head_size_max_y'),0) + + self.MakeModal(False) + self.Destroy() + def main(): app = wx.App(False) projectPlanner().Show(True) diff --git a/Cura/images/preferences.png b/Cura/images/preferences.png new file mode 100644 index 00000000..dab6b519 Binary files /dev/null and b/Cura/images/preferences.png differ