From: Youness Alaoui Date: Wed, 29 Jul 2015 21:19:40 +0000 (-0400) Subject: Fix issue with ToolheadRow X-Git-Tag: lulzbot-15.02.1-2.01~56^2~16 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=d583b00e2bb756b1165e665487dc1f4c7594d803;p=cura.git Fix issue with ToolheadRow --- diff --git a/Cura/gui/configBase.py b/Cura/gui/configBase.py index 1b1850d9..4ccc2382 100644 --- a/Cura/gui/configBase.py +++ b/Cura/gui/configBase.py @@ -1,5 +1,4 @@ from __future__ import division -from Cura.gui.configWizard import ConfigWizard __copyright__ = "Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License" import wx, wx.lib.stattext, types @@ -7,6 +6,7 @@ from wx.lib.agw import floatspin from Cura.util import validators from Cura.util import profile +from Cura.gui import configWizard class configPanelBase(wx.Panel): "A base class for configuration dialogs. Handles creation of settings, and popups" @@ -250,7 +250,7 @@ class SettingRow(object): self.ctrl.SetValue(value) class ToolheadRow(object): - def __init__(self, panel, configName, valueOverride = None, index = None): + def __init__(self, panel, configName, index = None): sizer = panel.GetSizer() x = sizer.GetRows() y = 0 @@ -260,8 +260,8 @@ class ToolheadRow(object): self.settingIndex = index self.validationMsg = '' self.panel = panel - # We need a subpanel here because SettingRow always takes 2 grid spaces - # and we shouldn't take more than that. + # We need a subpanel here because SettingRow always takes 2 grid spaces + # and we shouldn't take more than that. self.subpanel = wx.Panel(self.panel) subsizer = wx.BoxSizer(wx.HORIZONTAL) self.subpanel.SetSizer(subsizer) @@ -272,37 +272,23 @@ class ToolheadRow(object): self.ctrl = wx.TextCtrl(self.subpanel, -1, self.setting.getValue(self.settingIndex)) self.ctrl.Enable(False) - self.changeToolheadButton = wx.Button(self.subpanel, -1, _("Change Toolhead")) - self.changeToolheadButton.Bind(wx.EVT_BUTTON, self.OnChangeToolheadButton) + self.button = wx.Button(self.subpanel, -1, _("Change Toolhead")) flag = wx.EXPAND self.ctrl.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseEnter) subsizer.Add(self.ctrl, 1, flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND) - subsizer.Add(self.changeToolheadButton, 0, flag=wx.ALIGN_CENTER_VERTICAL|wx.LEFT,border=2) + subsizer.Add(self.button, 0, flag=wx.ALIGN_CENTER_VERTICAL|wx.LEFT,border=2) sizer.Add(self.label, (x,y), flag=wx.ALIGN_CENTER_VERTICAL|wx.LEFT,border=10) sizer.Add(self.subpanel, (x,y+1), flag=wx.ALIGN_CENTER_VERTICAL|flag) sizer.SetRows(x+1) - self.ctrl.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseEnter) - if isinstance(self.ctrl, floatspin.FloatSpin): - self.ctrl.GetTextCtrl().Bind(wx.EVT_ENTER_WINDOW, self.OnMouseEnter) - self.defaultBGColour = self.ctrl.GetTextCtrl().GetBackgroundColour() - else: - self.defaultBGColour = self.ctrl.GetBackgroundColour() - panel.main.settingControlList.append(self) - def OnChangeToolheadButton(self, e): - import configWizard - import wx.wizard - self.ToolheadSelectPage = configWizard.ToolheadSelectPage(self) - wx.wizard.WizardPageSimple.Chain(self, self.GetParent().ToolheadSelectPage) - self.ToolheadSelectPage.test() - def OnMouseEnter(self, e): self.label.SetToolTipString(self.setting.getTooltip()) self.ctrl.SetToolTipString(self.setting.getTooltip()) + e.Skip() def OnMouseExit(self, e): self.label.SetToolTipString('') @@ -310,32 +296,15 @@ class ToolheadRow(object): e.Skip() def GetValue(self): - if isinstance(self.ctrl, wx.ColourPickerCtrl): - return str(self.ctrl.GetColour().GetAsString(wx.C2S_HTML_SYNTAX)) - elif isinstance(self.ctrl, wx.ComboBox): - value = unicode(self.ctrl.GetValue()) - for ret in self._englishChoices: - if _(ret) == value: - return ret - return value - else: - return str(self.ctrl.GetValue()) + return str(self.ctrl.GetValue()) def SetValue(self, value): - if isinstance(self.ctrl, wx.CheckBox): - self.ctrl.SetValue(str(value) == "True") - elif isinstance(self.ctrl, wx.ColourPickerCtrl): - self.ctrl.SetColour(value) - elif isinstance(self.ctrl, floatspin.FloatSpin): - try: - self.ctrl.SetValue(float(value)) - except ValueError: - pass - elif isinstance(self.ctrl, wx.ComboBox): - self.ctrl.SetValue(_(value)) - else: - self.ctrl.SetValue(value) - + self.ctrl.SetValue(value) + + def _validate(self): + pass + + class PopUp(wx.Frame): def __init__(self, parent, id, text): wx.Frame.__init__(self, parent, id, 'Frame title', size=(400,300))