Пример #1
0
	def __init__(self, parent):
		wx.Panel.__init__(self, parent, size=(style.width*3+1, style.height*7+1))

		heading_font = wx.Font(16, wx.SWISS, wx.NORMAL, wx.LIGHT)
		small_font = wx.Font(12, wx.SWISS, wx.NORMAL, wx.LIGHT)

		swap_heading = wx.StaticText(self, label='Swap')
		mirror_heading = wx.StaticText(self, label='Mirror')
		scale_heading = wx.StaticText(self, label='Scale')

		swap_heading.SetFont(heading_font)
		mirror_heading.SetFont(heading_font)
		scale_heading.SetFont(heading_font)

		swap_heading.SetForegroundColour(style.accent1)
		mirror_heading.SetForegroundColour(style.accent1)
		scale_heading.SetForegroundColour(style.accent1)

		# swap panel
		swap_panel = wx.Panel(self)

		xy_heading = wx.StaticText(swap_panel, label='Swap X and Y')
		yz_heading = wx.StaticText(swap_panel, label='Swap Y and Z')

		xy_heading.SetFont(small_font)
		yz_heading.SetFont(small_font)

		self.xy_button = ToggleSwitch(swap_panel)
		self.yz_button = ToggleSwitch(swap_panel)

		self.xy_button.Bind(wx.EVT_CHECKBOX, self.onSwap)
		self.yz_button.Bind(wx.EVT_CHECKBOX, self.onSwap)

		sizer = wx.GridBagSizer()
		sizer.AddSpacer((20,1), (0,0))
		sizer.AddSpacer((100,1), (0,1))
		sizer.AddSpacer((1,25), (1,0))
		sizer.AddSpacer((1,25), (2,0))
		sizer.AddSpacer((20,1), (0,2))

		sizer.Add(xy_heading, (1,1))
		sizer.Add(yz_heading, (2,1))
		sizer.Add(self.xy_button, (1,3))
		sizer.Add(self.yz_button, (2,3))

		swap_panel.SetSizerAndFit(sizer)

		#mirror panel
		mirror_panel = wx.Panel(self)

		x_heading = wx.StaticText(mirror_panel, label='Mirror X')
		y_heading = wx.StaticText(mirror_panel, label='Mirror Y')
		z_heading = wx.StaticText(mirror_panel, label='Mirror Z')

		x_heading.SetFont(small_font)
		y_heading.SetFont(small_font)
		z_heading.SetFont(small_font)

		self.x_button = ToggleSwitch(mirror_panel)
		self.y_button = ToggleSwitch(mirror_panel)
		self.z_button = ToggleSwitch(mirror_panel)

		self.x_button.Bind(wx.EVT_CHECKBOX, self.onMirror)
		self.y_button.Bind(wx.EVT_CHECKBOX, self.onMirror)
		self.z_button.Bind(wx.EVT_CHECKBOX, self.onMirror)

		sizer = wx.GridBagSizer()
		sizer.AddSpacer((20,1), (0,0))
		sizer.AddSpacer((100,1), (0,1))
		sizer.AddSpacer((1,25), (1,0))
		sizer.AddSpacer((1,25), (2,0))
		sizer.AddSpacer((1,25), (3,0))
		sizer.AddSpacer((20,1), (0,2))

		sizer.Add(x_heading, (1,1))
		sizer.Add(y_heading, (2,1))
		sizer.Add(z_heading, (3,1))
		sizer.Add(self.x_button, (1,3))
		sizer.Add(self.y_button, (2,3))
		sizer.Add(self.z_button, (3,3))

		mirror_panel.SetSizerAndFit(sizer)

		#scale panel
		scale_panel = wx.Panel(self)

		self.scale = wx.TextCtrl(scale_panel)
		self.scale.SetValue('1.0')

		self.scale.Bind(wx.EVT_TEXT, self.onScale)

		sizer = wx.GridBagSizer()
		sizer.AddSpacer((20,1), (0,0))
		sizer.AddSpacer((1,25), (1,0))

		sizer.Add(self.scale, (1,1))

		scale_panel.SetSizer(sizer)

		#reset button
		reset = GenericButton(self, 'Reset All')
		reset.Bind(wx.EVT_BUTTON, self.onReset)

		#3d preview window
		self.preview = preview3d.previewPanel(self)
		#self.preview.loadModelFiles(['/Users/ProChef/Desktop/Cura-v2/images/UltimakerRobot_support.stl'])

		# window settings
		sizer = wx.GridBagSizer()
		sizer.AddSpacer((30,20), (0,0))

		sizer.Add(swap_heading, (1,1))
		sizer.AddSpacer((1,10), (2,1))
		sizer.Add(swap_panel, (3,1))
		sizer.AddSpacer((1,10), (4,1))

		sizer.Add(mirror_heading, (5,1))
		sizer.AddSpacer((1,10), (6,1))
		sizer.Add(mirror_panel, (7,1))
		sizer.AddSpacer((1,10), (8,1))

		sizer.Add(scale_heading, (9,1))
		sizer.AddSpacer((1,10), (10,1))
		sizer.Add(scale_panel, (11,1))
		sizer.AddSpacer((1,10), (12,1))

		#sizer.AddSpacer((1,30), (13,1))
		sizer.Add(reset, (14,1))

		sizer.AddSpacer((30,1), (1,2))
		sizer.Add(self.preview, (2,3), span=(15,1))

		self.SetSizer(sizer)
		self.Fit()
Пример #2
0
	def __init__(self, parent):
		wx.Panel.__init__(self, parent, size=(style.width*3+1, style.height*7+1))

		heading_font = wx.Font(16, wx.SWISS, wx.NORMAL, wx.LIGHT)
		small_font = wx.Font(12, wx.SWISS, wx.NORMAL, wx.LIGHT)

		quality_heading = wx.StaticText(self, label='Print Quality')
		material_heading = wx.StaticText(self, label='Print Material')
		optional_heading = wx.StaticText(self, label='Optional Settings')

		quality_heading.SetFont(heading_font)
		quality_heading.SetForegroundColour(style.accent1)
		material_heading.SetFont(heading_font)
		material_heading.SetForegroundColour(style.accent1)
		optional_heading.SetFont(heading_font)
		optional_heading.SetForegroundColour(style.accent1)

		quality_panel = wx.Panel(self)
		
		low_heading = wx.StaticText(quality_panel, label='Fast')
		med_heading = wx.StaticText(quality_panel, label='Normal')
		high_heading = wx.StaticText(quality_panel, label='High')
		ultra_heading = wx.StaticText(quality_panel, label='Ultra')

		low_heading.SetFont(small_font)
		med_heading.SetFont(small_font)
		high_heading.SetFont(small_font)
		ultra_heading.SetFont(small_font)

		self.low_button = ToggleSwitch(quality_panel, 'A fast, low quality print that will lack strength and have a poor surface finish. Use when printing a draft model for maximum speed and minimum cost.')
		self.med_button = ToggleSwitch(quality_panel, 'A regular quality print. Has a better surface finish and a denser infill than fast quality. Appropriate for most models, particularly large ones.')
		self.high_button = ToggleSwitch(quality_panel, 'A high quality print with good surface finish and a strong infill. Good for small models and models that require high dimensional accuracy.')
		self.ultra_button = ToggleSwitch(quality_panel, 'A very high quality print. Has a honeycomb infill pattern for extra strength and a very fine surface finish. Use only on final models (VERY slow!)')

		self.low_button.Bind(wx.EVT_CHECKBOX, self.onQualityClick)
		self.med_button.Bind(wx.EVT_CHECKBOX, self.onQualityClick)
		self.high_button.Bind(wx.EVT_CHECKBOX, self.onQualityClick)
		self.ultra_button.Bind(wx.EVT_CHECKBOX, self.onQualityClick)

		sizer = wx.GridBagSizer()
		sizer.AddSpacer((20,1), (0,0))
		sizer.AddSpacer((100,1), (0,1))
		sizer.AddSpacer((1,25), (1,0))
		sizer.AddSpacer((1,25), (2,0))
		sizer.AddSpacer((1,25), (3,0))
		sizer.AddSpacer((1,25), (4,0))
		sizer.AddSpacer((20,1), (0,2))

		sizer.Add(low_heading, (1,1))
		sizer.Add(med_heading, (2,1))
		sizer.Add(high_heading, (3,1))
		sizer.Add(ultra_heading, (4,1))
		sizer.Add(self.low_button, (1,3))
		sizer.Add(self.med_button, (2,3))
		sizer.Add(self.high_button, (3,3))
		sizer.Add(self.ultra_button, (4,3))

		quality_panel.SetSizerAndFit(sizer)

		self.material_panel = MaterialPanel(self)

		optional_panel = wx.Panel(self, size=(200, 100))

		support_heading = wx.StaticText(optional_panel, label='Print support')
		hollow_heading = wx.StaticText(optional_panel, label='Print hollow')
		solid_heading = wx.StaticText(optional_panel, label='Print solid')

		support_heading.SetFont(small_font)
		hollow_heading.SetFont(small_font)
		solid_heading.SetFont(small_font)

		self.support_button = ToggleSwitch(optional_panel, 'Use when the object has a lot of overhang.')
		self.hollow_button = ToggleSwitch(optional_panel)
		self.solid_button = ToggleSwitch(optional_panel)

		self.support_button.Bind(wx.EVT_CHECKBOX, self.onSupportClick)
		self.solid_button.Bind(wx.EVT_CHECKBOX, self.onDensityClick)
		self.hollow_button.Bind(wx.EVT_CHECKBOX, self.onDensityClick)

		sizer = wx.GridBagSizer()
		sizer.AddSpacer((20,1), (0,0))
		sizer.AddSpacer((100,1), (0,1))
		sizer.AddSpacer((1,25), (1,0))
		sizer.AddSpacer((1,25), (2,0))
		sizer.AddSpacer((1,25), (3,0))
		sizer.AddSpacer((20,1), (0,2))

		sizer.Add(support_heading, (1,1))
		sizer.Add(hollow_heading, (2,1))
		sizer.Add(solid_heading, (3,1))
		sizer.Add(self.support_button, (1,3))
		sizer.Add(self.hollow_button, (2,3))
		sizer.Add(self.solid_button, (3,3))

		optional_panel.SetSizerAndFit(sizer)

		sizer = wx.GridBagSizer()
		sizer.AddSpacer((30,20), (0,0))

		sizer.Add(quality_heading, (1, 1))
		sizer.AddSpacer((1,10), (2,1))
		sizer.Add(quality_panel, (3, 1))
		sizer.AddSpacer((1,20), (4,1))

		sizer.Add(material_heading, (5, 1))
		sizer.AddSpacer((1,10), (6,1))
		sizer.Add(self.material_panel, (7,1))
		sizer.AddSpacer((1,20), (8,1))


		sizer.Add(optional_heading, (9, 1))
		sizer.AddSpacer((1,10), (10,1))
		sizer.Add(optional_panel, (11,1))

		self.SetSizer(sizer)
		self.Fit()