sizer = panel.GetSizer()
x = sizer.GetRows()
y = 0
+ flag = 0
self.validators = []
self.validationMsg = ''
if isinstance(defaultValue, types.StringTypes):
self.ctrl = wx.TextCtrl(panel, -1, getSettingFunc(configName))
self.ctrl.Bind(wx.EVT_TEXT, self.OnSettingChange)
+ flag = wx.EXPAND
elif isinstance(defaultValue, types.BooleanType):
self.ctrl = wx.CheckBox(panel, -1, style=wx.ALIGN_RIGHT)
self.SetValue(getSettingFunc(configName))
self.ctrl.Bind(wx.EVT_CHECKBOX, self.OnSettingChange)
+ elif isinstance(defaultValue, wx.Colour):
+ self.ctrl = wx.ColourPickerCtrl(panel, -1)
+ self.SetValue(getSettingFunc(configName))
+ self.ctrl.Bind(wx.EVT_COLOURPICKER_CHANGED, self.OnSettingChange)
else:
self.ctrl = wx.ComboBox(panel, -1, getSettingFunc(configName), choices=defaultValue, style=wx.CB_DROPDOWN|wx.CB_READONLY)
self.ctrl.Bind(wx.EVT_COMBOBOX, self.OnSettingChange)
+ flag = wx.EXPAND
sizer.Add(self.label, (x,y), flag=wx.ALIGN_CENTER_VERTICAL)
- sizer.Add(self.ctrl, (x,y+1), flag=wx.ALIGN_BOTTOM|wx.EXPAND)
+ sizer.Add(self.ctrl, (x,y+1), flag=wx.ALIGN_BOTTOM|flag)
sizer.SetRows(x+1)
self.ctrl.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseEnter)
self.panel.main.UpdatePopup(self)
def GetValue(self):
- return str(self.ctrl.GetValue())
+ if isinstance(self.ctrl, wx.ColourPickerCtrl):
+ return str(self.ctrl.GetColour().GetAsString(wx.C2S_HTML_SYNTAX))
+ else:
+ 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)
else:
self.ctrl.SetValue(value)
\r
wx.EVT_CLOSE(self, self.OnClose)\r
\r
+ self.parent = parent\r
self.oldExtruderAmount = int(profile.getPreference('extruder_amount'))\r
\r
left, right, main = self.CreateConfigPanel(self)\r
c = configBase.SettingRow(left, 'Offset Y', 'extruder_offset_y%d' % (i), '0.0', 'The offset of your secondary extruder compared to the primary.', type = 'preference')\r
validators.validFloat(c)\r
\r
+ configBase.TitleRow(left, 'Colours')\r
+ c = configBase.SettingRow(left, 'Model colour', 'model_colour', wx.Colour(0,0,0), '', type = 'preference')\r
+\r
configBase.TitleRow(right, 'Filament settings')\r
c = configBase.SettingRow(right, 'Filament density (kg/m3)', 'filament_density', '1300', 'Weight of the filament per m3. Around 1300 for PLA. And around 1040 for ABS. This value is used to estimate the weight if the filament used for the print.', type = 'preference')\r
validators.validFloat(c, 500.0, 3000.0)\r
c = configBase.SettingRow(right, 'SD card path', 'sdpath', '', 'Location of your SD card, when using the copy to SD feature.', type = 'preference')\r
c = configBase.SettingRow(right, 'Copy to SD with 8.3 names', 'sdshortnames', False, 'Save the gcode files in short filenames, so they are properly shown on the UltiController', type = 'preference')\r
\r
- self.okButton = wx.Button(left, -1, 'Ok')\r
- left.GetSizer().Add(self.okButton, (left.GetSizer().GetRows(), 1))\r
+ self.okButton = wx.Button(right, -1, 'Ok')\r
+ right.GetSizer().Add(self.okButton, (right.GetSizer().GetRows(), 0))\r
self.okButton.Bind(wx.EVT_BUTTON, self.OnClose)\r
\r
self.MakeModal(True)\r
if self.oldExtruderAmount != int(profile.getPreference('extruder_amount')):\r
wx.MessageBox('After changing the amount of extruders you need to restart Cura for full effect.', 'Extruder amount warning.', wx.OK | wx.ICON_INFORMATION)\r
self.MakeModal(False)\r
+ self.parent.updateProfileToControls()\r
self.Destroy()\r
\r
def getDrives():\r
self.swapXZ.SetValue(profile.getProfileSetting('swap_xz') == 'True')\r
self.swapYZ.SetValue(profile.getProfileSetting('swap_yz') == 'True')\r
self.updateModelTransform()\r
+ self.glCanvas.updateProfileToControls()\r
\r
class PreviewGLCanvas(glcanvas.GLCanvas):\r
def __init__(self, parent):\r
self.gcodeDisplayListMade = None\r
self.gcodeDisplayListCount = 0\r
self.objColor = [[1.0, 0.8, 0.6, 1.0], [0.2, 1.0, 0.1, 1.0], [1.0, 0.2, 0.1, 1.0], [0.1, 0.2, 1.0, 1.0]]\r
+ self.objColor[0] = profile.getPreferenceColour('model_colour')\r
\r
+ def updateProfileToControls(self):\r
+ self.objColor[0] = profile.getPreferenceColour('model_colour')\r
+\r
def OnMouseMotion(self,e):\r
if e.Dragging() and e.LeftIsDown():\r
if self.view3D:\r
'extruder_head_size_max_x': '18.0',\r
'extruder_head_size_max_y': '35.0',\r
'extruder_head_size_height': '80.0',\r
+ \r
+ 'model_colour': '#FFCC99',\r
}\r
\r
#########################################################\r
except (ValueError, SyntaxError, TypeError):\r
return 0.0\r
\r
+def getPreferenceColour(name):\r
+ colorString = getPreference(name)\r
+ return [float(int(colorString[1:3], 16)) / 255, float(int(colorString[3:5], 16)) / 255, float(int(colorString[5:7], 16)) / 255, 1.0]\r
+\r
def getPreference(name):\r
if name in tempOverride:\r
return unicode(tempOverride[name])\r