def _set_mode_layout(self, mode): if mode == 'Laser': self.get_control('brightness_pattern_calibration').Hide() self.get_control('contrast_pattern_calibration').Hide() self.get_control('saturation_pattern_calibration').Hide() self.get_control('exposure_pattern_calibration').Hide() self.get_control('brightness_laser_calibration').Show() self.get_control('contrast_laser_calibration').Show() self.get_control('saturation_laser_calibration').Show() self.get_control('exposure_laser_calibration').Show() self.get_control('remove_background_calibration').Show() elif mode == 'Pattern': self.get_control('brightness_pattern_calibration').Show() self.get_control('contrast_pattern_calibration').Show() self.get_control('saturation_pattern_calibration').Show() self.get_control('exposure_pattern_calibration').Show() self.get_control('brightness_laser_calibration').Hide() self.get_control('contrast_laser_calibration').Hide() self.get_control('saturation_laser_calibration').Hide() self.get_control('exposure_laser_calibration').Hide() self.get_control('remove_background_calibration').Hide() if sys.is_wx30(): self.content.SetSizerAndFit(self.content.vbox) if sys.is_windows(): self.parent.Refresh() self.parent.Layout() self.Layout()
def _set_mode_layout(self, mode): if mode == 'Laser': self.get_control('brightness_texture_scanning').Hide() self.get_control('contrast_texture_scanning').Hide() self.get_control('saturation_texture_scanning').Hide() self.get_control('exposure_texture_scanning').Hide() self.get_control('brightness_laser_scanning').Show() self.get_control('contrast_laser_scanning').Show() self.get_control('saturation_laser_scanning').Show() self.get_control('exposure_laser_scanning').Show() self.get_control('remove_background_scanning').Show() elif mode == 'Texture': self.get_control('brightness_texture_scanning').Show() self.get_control('contrast_texture_scanning').Show() self.get_control('saturation_texture_scanning').Show() self.get_control('exposure_texture_scanning').Show() self.get_control('brightness_laser_scanning').Hide() self.get_control('contrast_laser_scanning').Hide() self.get_control('saturation_laser_scanning').Hide() self.get_control('exposure_laser_scanning').Hide() self.get_control('remove_background_scanning').Hide() if sys.is_wx30(): self.content.SetSizerAndFit(self.content.vbox) if sys.is_windows(): self.parent.Refresh() self.parent.Layout() self.Layout()
def __init__(self, parent, name, engine_callback=None): ControlPanel.__init__(self, parent, name, engine_callback) self.flag_first_move = True # Elements self.label = wx.StaticText(self, label=_(self.setting._label), size=(130, -1)) self.control = wx.Slider(self, value=profile.settings[name], minValue=profile.settings.get_min_value(name), maxValue=profile.settings.get_max_value(name), size=(150, -1), style=wx.SL_LABELS) # Layout hbox = wx.BoxSizer(wx.HORIZONTAL) if sys.is_wx30(): hbox.Add(self.label, 0, wx.BOTTOM | wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 0) hbox.AddStretchSpacer() hbox.Add(self.control, 0, wx.BOTTOM | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 5) else: hbox.Add(self.label, 0, wx.TOP | wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5) hbox.AddStretchSpacer() hbox.Add(self.control, 0, wx.TOP | wx.ALIGN_CENTER_VERTICAL, 0) self.SetSizer(hbox) self.Layout() # Events self.control.Bind(wx.EVT_COMMAND_SCROLL_LINEUP, self._on_slider) self.control.Bind(wx.EVT_COMMAND_SCROLL_LINEDOWN, self._on_slider) self.control.Bind(wx.EVT_SCROLL_THUMBRELEASE, self._on_slider_released) self.control.Bind(wx.EVT_SCROLL_THUMBTRACK, self._on_slider_tracked)
def add_control(self, _name, _type, tooltip=None): control = _type(self, _name, tooltip) control.set_undo_callbacks(self.append_undo_callback, self.release_undo_callback) self.control_panels.update({_name: control}) self.vbox.Add(control, 0, wx.BOTTOM | wx.EXPAND, 5) self.vbox.Layout() if sys.is_wx30(): self.SetSizerAndFit(self.vbox)
def __init__(self, parent, append_undo_callback=None, release_undo_callback=None): wx.Panel.__init__(self, parent, size=(100, 100)) # Elements self.control_panels = OrderedDict() self.append_undo_callback = append_undo_callback self.release_undo_callback = release_undo_callback # Layout self.vbox = wx.BoxSizer(wx.VERTICAL) if sys.is_wx30(): self.SetSizerAndFit(self.vbox) else: self.SetSizer(self.vbox) self.Layout()