From c04c09a437da1ee944b6eac96c55a0f05e135a7b Mon Sep 17 00:00:00 2001 From: daid Date: Mon, 7 May 2012 16:03:42 +0200 Subject: [PATCH] Added preferences to project planner to configure head size --- Cura/gui/projectPlanner.py | 44 ++++++++++++++++++++++++++++++++++++ Cura/images/preferences.png | Bin 0 -> 690 bytes 2 files changed, 44 insertions(+) create mode 100644 Cura/images/preferences.png 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 0000000000000000000000000000000000000000..dab6b5190b33040e2c8a1b67132958ba99163574 GIT binary patch literal 690 zcmV;j0!{siP)Td47@B2I*7DcFFp@Cs$ z{>=Pm=6MGGQ*+^yp}C188q=Pf5>6y&)y_masBZO|83d{^H|52o6+KT#f#U zwE;*;HCWS{qIerlpRDtGy=UuBH8?wOb;PA522t^=TZ?OJYqj;5(e`ZcDgJ?e6ovl$ zy!>%g{dL?h&iMBGoc@-cF!tT0{p3$5XD2e0F)BJnF+V3_ubJ1<7=~Sz1_N z>fIFO`^u3LK75+PG)*QZ#-sv$I>1WYc|1Qahl1?|%+Ag*8<^o<&qHdeju4m+P*%1V zha;7x#U+M^he>xiafBx=_sU4O_Mj=F#OralhV&A>?a~#B3U?3+28pdlnVg&?)8irh zBf`?c7yN!dyHn?>udXCzEntK`PAn?D&1o&=mCYTw8N#MWBkBK-s9C%j=z5{+s-rq* zr_ZLR=Yp_6CR7Rwq?w4f;2XZvhyau-Jxysc>9$+Mo{~;{eKm23J;fqfNRT3tBmeToQmVS$aUWLs Y4dyl&fhWT