Python wx.EVT_SPINCTRL Examples
The following are 15
code examples of wx.EVT_SPINCTRL().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
wx
, or try the search function
.
Example #1
Source File: g.gui.tangible.py From grass-tangible-landscape with GNU General Public License v2.0 | 6 votes |
def BindModelProperties(self): self.btnCalibrateTilt.Bind(wx.EVT_BUTTON, self.scaniface.Calibrate) self.btnCalibrateExtent.Bind(wx.EVT_BUTTON, self.scaniface.CalibrateModelBBox) # model parameters self.elevInput.Bind(wx.EVT_TEXT, self.OnModelProperties) self.regionInput.Bind(wx.EVT_TEXT, self.OnModelProperties) self.zexag.Bind(wx.EVT_TEXT, self.OnModelProperties) self.rotate.Bind(wx.EVT_SPINCTRL, self.OnModelProperties) self.rotate.Bind(wx.EVT_TEXT, self.OnModelProperties) self.numscans.Bind(wx.EVT_SPINCTRL, self.OnModelProperties) self.numscans.Bind(wx.EVT_TEXT, self.OnModelProperties) self.interpolate.Bind(wx.EVT_CHECKBOX, self.OnModelProperties) self.smooth.Bind(wx.EVT_TEXT, self.OnModelProperties) self.resolution.Bind(wx.EVT_TEXT, self.OnModelProperties) self.trim_tolerance.Bind(wx.EVT_TEXT, self.OnModelProperties) for each in 'nsewtb': self.trim[each].Bind(wx.EVT_TEXT, self.OnModelProperties)
Example #2
Source File: preferencesdialog.py From wxGlade with MIT License | 6 votes |
def _fix_spin_ctrls(self): "Workaround to a wxGTK 2.8.4.2 bug in wx.SpinCtrl.GetValue" done = {} for name in ('autosave_delay', 'number_history', 'default_border_size'): def fix(n): done[n] = False def update(e): done[n] = True e.Skip() def get_val(): if not done[n]: return getattr(self.preferences, n) else: return wx.SpinCtrl.GetValue(getattr(self, n)) return update, get_val spin = getattr(self, name) if spin.GetValue() != getattr(self.preferences, name): update, get_val = fix(name) spin.GetValue = get_val spin.Bind(wx.EVT_SPINCTRL, update)
Example #3
Source File: cfgdlg.py From trelby with GNU General Public License v2.0 | 5 votes |
def addSpin(self, name, descr, parent, sizer, cfgName): sizer.Add(wx.StaticText(parent, -1, descr), 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 10) entry = wx.SpinCtrl(parent, -1) entry.SetRange(*self.cfg.cvars.getMinMax(cfgName)) wx.EVT_SPINCTRL(self, entry.GetId(), self.OnMisc) wx.EVT_KILL_FOCUS(entry, self.OnKillFocus) sizer.Add(entry, 0) setattr(self, name + "Entry", entry)
Example #4
Source File: cfgdlg.py From trelby with GNU General Public License v2.0 | 5 votes |
def addSpin(self, name, descr, parent, sizer, cfgName): hsizer = wx.BoxSizer(wx.HORIZONTAL) hsizer.Add(wx.StaticText(parent, -1, descr), 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 10) tmp = wx.SpinCtrl(parent, -1) tmp.SetRange(*self.cfg.cvars.getMinMax(cfgName)) wx.EVT_SPINCTRL(self, tmp.GetId(), self.OnMisc) wx.EVT_KILL_FOCUS(tmp, self.OnKillFocus) hsizer.Add(tmp) sizer.Add(hsizer, 0, wx.BOTTOM, 10) setattr(self, name + "Entry", tmp)
Example #5
Source File: params.py From admin4 with Apache License 2.0 | 5 votes |
def __init__(self, parent, name): PPanel.__init__(self, parent, name) self.ID_SPIN_CTRL = wx.NewId() sizer = wx.BoxSizer() self.spin = wx.SpinCtrl(self, self.ID_SPIN_CTRL, size=(60,-1)) self.spin.SetRange(-2147483648, 2147483647) # min/max integers sizer.Add(self.spin) self.SetAutoLayout(True) self.SetSizerAndFit(sizer) wx.EVT_SPINCTRL(self, self.ID_SPIN_CTRL, self.OnChange)
Example #6
Source File: params.py From admin4 with Apache License 2.0 | 5 votes |
def __init__(self, parent, name): PPanel.__init__(self, parent, name) self.ID_SPIN_CTRL = wx.NewId() sizer = wx.BoxSizer() self.spin = wx.SpinCtrl(self, self.ID_SPIN_CTRL, size=(60,-1)) self.spin.SetRange(0, 10000) # min/max integers sizer.Add(self.spin) self.SetAutoLayout(True) self.SetSizerAndFit(sizer) wx.EVT_SPINCTRL(self, self.ID_SPIN_CTRL, self.OnChange)
Example #7
Source File: new_properties.py From wxGlade with MIT License | 5 votes |
def create_editor(self, panel, sizer): if self.val_range is None: self.val_range = (0, 1000) hsizer = wx.BoxSizer(wx.HORIZONTAL) # label label_text = self._find_label() label = self.label_ctrl = self._get_label(label_text, panel) hsizer.Add(label, 0, wx.ALL | wx.ALIGN_CENTER, 3) # checkbox, if applicable self.enabler = None if self.deactivated is not None: self.enabler = wx.CheckBox(panel, -1, '') if config.preferences.use_checkboxes_workaround: size = self.enabler.GetSize() self.enabler.SetLabel("Enable %s"%label_text) self.enabler.SetMaxSize(size) self.enabler.SetValue(not self.deactivated) self.enabler.Bind( wx.EVT_CHECKBOX, lambda event: self.toggle_active(event.IsChecked()) ) hsizer.Add(self.enabler, 0, wx.ALIGN_CENTER_VERTICAL|wx.LEFT, 3) self.spin = self.create_spin_ctrl(panel) if self.deactivated is not None: self.spin.Enable(not self.deactivated) elif self.blocked or self.readonly: self.spin.Enable(False) # layout of the controls / sizers hsizer.Add(self.spin, 5, wx.ALL | wx.ALIGN_CENTER, 3) sizer.Add(hsizer, 0, wx.EXPAND) self._set_tooltip(label, self.spin, self.enabler) self.spin.Bind(wx.EVT_KILL_FOCUS, self.on_kill_focus) # by default, the value is only set when the focus is lost self.spin.Bind(wx.EVT_SET_FOCUS, self.on_focus) if wx.Platform == '__WXMAC__' or self.immediate: self.spin.Bind(wx.EVT_SPINCTRL, self.on_spin) self.spin.Bind(wx.EVT_TEXT_ENTER, self.on_spin) # we want the enter key (see style above) self.editing = True
Example #8
Source File: new_properties.py From wxGlade with MIT License | 5 votes |
def create_editor(self, panel, sizer): if not _is_gridbag(self.owner.parent): return max_rows, max_cols = self.owner.parent.check_span_range(self.owner.index, *self.value) hsizer = wx.BoxSizer(wx.HORIZONTAL) # label self.label_ctrl = label = self._get_label(self._find_label(), panel) hsizer.Add(label, 0, wx.ALL | wx.ALIGN_CENTER, 3) # checkbox, if applicable self.enabler = None style = wx.TE_PROCESS_ENTER | wx.SP_ARROW_KEYS self.rowspin = wx.SpinCtrl( panel, -1, style=style, min=1, max=max_rows) # don't set size here as the self.colspin = wx.SpinCtrl( panel, -1, style=style, min=1, max=max_cols) # combination withe SetSelection fails val = self.value self.rowspin.SetValue(val and val[0] or 1) self.colspin.SetValue(val and val[1] or 1) self.rowspin.Enable(max_rows!=1) self.colspin.Enable(max_cols!=1) self.rowspin.SetSelection(-1, -1) self.colspin.SetSelection(-1, -1) # layout of the controls / sizers; when adding the spins, set min size as well hsizer.Add(wx.StaticText(panel, -1, _("Rows:")), 1, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 3) si = hsizer.Add(self.rowspin, 5, wx.ALL | wx.ALIGN_CENTER, 3).SetMinSize( (30,-1) ) hsizer.Add(wx.StaticText(panel, -1, _("Cols:")), 1, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 3) hsizer.Add(self.colspin, 5, wx.ALL | wx.ALIGN_CENTER, 3).SetMinSize( (30,-1) ) sizer.Add(hsizer, 0, wx.EXPAND) self._set_tooltip(label, self.rowspin, self.colspin) self.rowspin.Bind(wx.EVT_KILL_FOCUS, self.on_kill_focus) # by default, the value is only set when the focus is lost self.colspin.Bind(wx.EVT_KILL_FOCUS, self.on_kill_focus) self.rowspin.Bind(wx.EVT_SET_FOCUS, self.on_focus) self.colspin.Bind(wx.EVT_SET_FOCUS, self.on_focus) if self.immediate: self.rowspin.Bind(wx.EVT_SPINCTRL, self.on_spin) self.rowspin.Bind(wx.EVT_TEXT_ENTER, self.on_spin) # we want the enter key (see style above) self.colspin.Bind(wx.EVT_SPINCTRL, self.on_spin) self.colspin.Bind(wx.EVT_TEXT_ENTER, self.on_spin) self.editing = True
Example #9
Source File: ImageProperty.py From meerk40t with MIT License | 5 votes |
def __init__(self, *args, **kwds): # begin wxGlade: ImageProperty.__init__ kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE | wx.FRAME_TOOL_WINDOW | wx.STAY_ON_TOP wx.Frame.__init__(self, *args, **kwds) Module.__init__(self) self.SetSize((276, 218)) self.spin_step_size = wx.SpinCtrl(self, wx.ID_ANY, "1", min=1, max=63) self.combo_dpi = wx.ComboBox(self, wx.ID_ANY, choices=["1000", "500", "333", "250", "200", "166", "142", "125", "111", "100"], style=wx.CB_DROPDOWN) self.text_x = wx.TextCtrl(self, wx.ID_ANY, "") self.text_y = wx.TextCtrl(self, wx.ID_ANY, "") self.text_width = wx.TextCtrl(self, wx.ID_ANY, "") self.text_height = wx.TextCtrl(self, wx.ID_ANY, "") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_SPINCTRL, self.on_spin_step, self.spin_step_size) self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_step, self.spin_step_size) self.Bind(wx.EVT_COMBOBOX, self.on_combo_dpi, self.combo_dpi) self.Bind(wx.EVT_TEXT, self.on_text_x, self.text_x) self.Bind(wx.EVT_TEXT_ENTER, self.on_text_x, self.text_x) self.Bind(wx.EVT_TEXT, self.on_text_y, self.text_y) self.Bind(wx.EVT_TEXT_ENTER, self.on_text_y, self.text_y) self.Bind(wx.EVT_TEXT, self.on_text_width, self.text_width) self.Bind(wx.EVT_TEXT_ENTER, self.on_text_width, self.text_width) self.Bind(wx.EVT_TEXT, self.on_text_height, self.text_height) self.Bind(wx.EVT_TEXT_ENTER, self.on_text_height, self.text_height) # end wxGlade self.image_element = None self.Bind(wx.EVT_CLOSE, self.on_close, self)
Example #10
Source File: RasterProperty.py From meerk40t with MIT License | 5 votes |
def __init__(self, *args, **kwds): # begin wxGlade: RasterProperty.__init__ kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE | wx.FRAME_TOOL_WINDOW | wx.STAY_ON_TOP wx.Frame.__init__(self, *args, **kwds) Module.__init__(self) self.SetSize((359, 355)) self.spin_speed_set = wx.SpinCtrlDouble(self, wx.ID_ANY, "200.0", min=0.0, max=500.0) self.spin_power_set = wx.SpinCtrlDouble(self, wx.ID_ANY, "1000.0", min=0.0, max=1000.0) self.spin_step_size = wx.SpinCtrl(self, wx.ID_ANY, "1", min=0, max=63) self.combo_raster_direction = wx.ComboBox(self, wx.ID_ANY, choices=[_("Top To Bottom"), _("Bottom To Top"), _("Right To Left"), _("Left To Right")], style=wx.CB_DROPDOWN) self.spin_overscan_set = wx.SpinCtrlDouble(self, wx.ID_ANY, "20.0", min=0.0, max=1000.0) self.radio_directional_raster = wx.RadioBox(self, wx.ID_ANY, _("Directional Raster"), choices=[_("Bidirectional"), _("Unidirectional")], majorDimension=2, style=wx.RA_SPECIFY_ROWS) self.radio_corner = wx.RadioBox(self, wx.ID_ANY, _("Start Corner"), choices=[" ", " ", " ", " "], majorDimension=2, style=wx.RA_SPECIFY_ROWS) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_SPINCTRLDOUBLE, self.on_spin_speed, self.spin_speed_set) self.Bind(wx.EVT_TEXT, self.on_spin_speed, self.spin_speed_set) self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_speed, self.spin_speed_set) self.Bind(wx.EVT_SPINCTRLDOUBLE, self.on_spin_power, self.spin_power_set) self.Bind(wx.EVT_TEXT, self.on_spin_power, self.spin_power_set) self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_power, self.spin_power_set) self.Bind(wx.EVT_SPINCTRL, self.on_spin_step, self.spin_step_size) self.Bind(wx.EVT_TEXT, self.on_spin_step, self.spin_step_size) self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_step, self.spin_step_size) self.Bind(wx.EVT_COMBOBOX, self.on_combo_raster_direction, self.combo_raster_direction) self.Bind(wx.EVT_SPINCTRLDOUBLE, self.on_spin_overscan, self.spin_overscan_set) self.Bind(wx.EVT_TEXT, self.on_spin_overscan, self.spin_overscan_set) self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_overscan, self.spin_overscan_set) self.Bind(wx.EVT_RADIOBOX, self.on_radio_directional, self.radio_directional_raster) self.Bind(wx.EVT_RADIOBOX, self.on_radio_corner, self.radio_corner) # end wxGlade self.operation = None self.Bind(wx.EVT_CLOSE, self.on_close, self)
Example #11
Source File: cfgdlg.py From trelby with GNU General Public License v2.0 | 4 votes |
def __init__(self, parent, id, cfg): wx.Panel.__init__(self, parent, id) self.cfg = cfg vsizer = wx.BoxSizer(wx.VERTICAL) vsizer.Add(wx.StaticText(self, -1, "Screen fonts:")) self.fontsLb = wx.ListBox(self, -1, size = (300, 100)) for it in ["fontNormal", "fontBold", "fontItalic", "fontBoldItalic"]: self.fontsLb.Append("", it) vsizer.Add(self.fontsLb, 0, wx.BOTTOM, 10) hsizer = wx.BoxSizer(wx.HORIZONTAL) btn = wx.Button(self, -1, "Change") wx.EVT_LISTBOX_DCLICK(self, self.fontsLb.GetId(), self.OnChangeFont) wx.EVT_BUTTON(self, btn.GetId(), self.OnChangeFont) self.errText = wx.StaticText(self, -1, "") self.origColor = self.errText.GetForegroundColour() hsizer.Add(btn) hsizer.Add((20, -1)) hsizer.Add(self.errText, 0, wx.ALIGN_CENTER_VERTICAL) vsizer.Add(hsizer, 0, wx.BOTTOM, 20) vsizer.Add(wx.StaticText(self, -1, "The settings below apply only" " to 'Draft' view mode."), 0, wx.BOTTOM, 15) hsizer = wx.BoxSizer(wx.HORIZONTAL) hsizer.Add(wx.StaticText(self, -1, "Row spacing:"), 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 10) self.spacingEntry = wx.SpinCtrl(self, -1) self.spacingEntry.SetRange(*self.cfg.cvars.getMinMax("fontYdelta")) wx.EVT_SPINCTRL(self, self.spacingEntry.GetId(), self.OnMisc) wx.EVT_KILL_FOCUS(self.spacingEntry, self.OnKillFocus) hsizer.Add(self.spacingEntry, 0) hsizer.Add(wx.StaticText(self, -1, "pixels"), 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 10) vsizer.Add(hsizer, 0, wx.EXPAND | wx.BOTTOM, 15) self.pbRb = wx.RadioBox(self, -1, "Page break lines to show", style = wx.RA_SPECIFY_COLS, majorDimension = 1, choices = [ "None", "Normal", "Normal + unadjusted " ]) vsizer.Add(self.pbRb) self.fontsLb.SetSelection(0) self.updateFontLb() self.cfg2gui() util.finishWindow(self, vsizer, center = False) wx.EVT_RADIOBOX(self, self.pbRb.GetId(), self.OnMisc)
Example #12
Source File: drawing.py From grass-tangible-landscape with GNU General Public License v2.0 | 4 votes |
def __init__(self, parent, giface, settings): wx.Panel.__init__(self, parent) self.giface = giface self.settings = settings self.settingsChanged = Signal('ScanningPanel.settingsChanged') if 'drawing' not in self.settings: self.settings['drawing'] = {} self.settings['drawing']['active'] = False self.settings['drawing']['name'] = '' self.settings['drawing']['type'] = 'point' self.settings['drawing']['append'] = False self.settings['drawing']['appendName'] = '' self.settings['drawing']['threshold'] = 760 mainSizer = wx.BoxSizer(wx.VERTICAL) self.ifDraw = wx.CheckBox(self, label=_("Draw vector:")) self.ifDraw.SetValue(self.settings['drawing']['active']) self.ifDraw.Bind(wx.EVT_CHECKBOX, self.OnDrawChange) self.ifDraw.Bind(wx.EVT_CHECKBOX, self.OnEnableDrawing) self.draw_vector = Select(self, size=(-1, -1), type='vector') self.draw_vector.SetValue(self.settings['drawing']['name']) self.draw_vector.Bind(wx.EVT_TEXT, self.OnDrawChange) self.draw_type = wx.RadioBox(parent=self, label="Vector type", choices=['point', 'line', 'area']) {'point': 0, 'line': 1, 'area': 2}[self.settings['drawing']['type']] self.draw_type.SetSelection({'point': 0, 'line': 1, 'area': 2}[self.settings['drawing']['type']]) self.draw_type.Bind(wx.EVT_RADIOBOX, self.OnDrawChange) self.threshold = wx.SpinCtrl(parent=self, min=0, max=765, initial=int(self.settings['drawing']['threshold'])) self.threshold.SetValue(int(self.settings['drawing']['threshold'])) self.threshold.Bind(wx.EVT_SPINCTRL, self.OnDrawChange) self.append = wx.CheckBox(parent=self, label="Append vector") self.append.SetValue(self.settings['drawing']['append']) self.append.Bind(wx.EVT_CHECKBOX, self.OnDrawChange) self.appendName = Select(self, size=(-1, -1), type='vector') self.appendName.SetValue(self.settings['drawing']['appendName']) self.appendName.Bind(wx.EVT_TEXT, self.OnDrawChange) self.clearBtn = wx.Button(parent=self, label="Clear") self.clearBtn.Bind(wx.EVT_BUTTON, lambda evt: self._newAppendedVector(evt)) sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(self.ifDraw, flag=wx.ALIGN_CENTER_VERTICAL, border=5) sizer.Add(self.draw_vector, proportion=1, flag=wx.ALIGN_CENTER_VERTICAL, border=5) mainSizer.Add(sizer, flag=wx.EXPAND | wx.ALL, border=5) sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(self.draw_type, proportion=1, flag=wx.ALIGN_CENTER_VERTICAL, border=5) mainSizer.Add(sizer, flag=wx.EXPAND | wx.ALL, border=5) sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(wx.StaticText(self, label='Brightness threshold:'), proportion=0, flag=wx.ALIGN_CENTER_VERTICAL, border=5) sizer.Add(self.threshold, proportion=1, flag=wx.ALIGN_CENTER_VERTICAL, border=5) mainSizer.Add(sizer, flag=wx.EXPAND | wx.ALL, border=5) sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(self.append, proportion=0, flag=wx.ALIGN_CENTER_VERTICAL, border=5) sizer.Add(self.appendName, proportion=1, flag=wx.ALIGN_CENTER_VERTICAL, border=5) sizer.Add(self.clearBtn, flag=wx.ALIGN_CENTER_VERTICAL, border=5) mainSizer.Add(sizer, flag=wx.EXPAND | wx.ALL, border=5) self.SetSizer(mainSizer) mainSizer.Fit(self) self.EnableDrawing(self.ifDraw.IsChecked())
Example #13
Source File: Controller.py From meerk40t with MIT License | 4 votes |
def __init__(self, *args, **kwds): # begin wxGlade: Controller.__init__ kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE | wx.FRAME_TOOL_WINDOW | wx.STAY_ON_TOP wx.Frame.__init__(self, *args, **kwds) Module.__init__(self) self.SetSize((499, 505)) self.button_controller_control = wx.Button(self, wx.ID_ANY, _("Start Controller")) self.text_controller_status = wx.TextCtrl(self, wx.ID_ANY, "") self.button_device_connect = wx.Button(self, wx.ID_ANY, _("Connection")) self.text_connection_status = wx.TextCtrl(self, wx.ID_ANY, "") self.text_device = wx.TextCtrl(self, wx.ID_ANY, "") self.text_location = wx.TextCtrl(self, wx.ID_ANY, "") self.gauge_buffer = wx.Gauge(self, wx.ID_ANY, 10) self.checkbox_limit_buffer = wx.CheckBox(self, wx.ID_ANY, _("Limit Write Buffer")) self.text_buffer_length = wx.TextCtrl(self, wx.ID_ANY, "") self.spin_packet_buffer_max = wx.SpinCtrl(self, wx.ID_ANY, "1500", min=1, max=100000) self.button_buffer_viewer = wx.BitmapButton(self, wx.ID_ANY, icons8_comments_50.GetBitmap()) self.packet_count_text = wx.TextCtrl(self, wx.ID_ANY, "") self.rejected_packet_count_text = wx.TextCtrl(self, wx.ID_ANY, "") self.packet_text_text = wx.TextCtrl(self, wx.ID_ANY, "") self.text_byte_0 = wx.TextCtrl(self, wx.ID_ANY, "") self.text_byte_1 = wx.TextCtrl(self, wx.ID_ANY, "") self.text_desc = wx.TextCtrl(self, wx.ID_ANY, "") self.text_byte_2 = wx.TextCtrl(self, wx.ID_ANY, "") self.text_byte_3 = wx.TextCtrl(self, wx.ID_ANY, "") self.text_byte_4 = wx.TextCtrl(self, wx.ID_ANY, "") self.text_byte_5 = wx.TextCtrl(self, wx.ID_ANY, "") self.button_pause = wx.BitmapButton(self, wx.ID_ANY, icons8_pause_50.GetBitmap()) self.button_stop = wx.BitmapButton(self, wx.ID_ANY, icons8_stop_sign_50.GetBitmap()) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.on_button_connect, self.button_device_connect) self.Bind(wx.EVT_CHECKBOX, self.on_check_limit_packet_buffer, self.checkbox_limit_buffer) self.Bind(wx.EVT_SPINCTRL, self.on_spin_packet_buffer_max, self.spin_packet_buffer_max) self.Bind(wx.EVT_TEXT, self.on_spin_packet_buffer_max, self.spin_packet_buffer_max) self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_packet_buffer_max, self.spin_packet_buffer_max) self.Bind(wx.EVT_BUTTON, lambda e: self.device.open('window', "BufferView", None, -1, ""), self.button_buffer_viewer) self.Bind(wx.EVT_BUTTON, self.on_button_pause_resume, self.button_pause) self.Bind(wx.EVT_BUTTON, self.on_button_emergency_stop, self.button_stop) # end wxGlade self.Bind(wx.EVT_CLOSE, self.on_close, self) self.Bind(wx.EVT_RIGHT_DOWN, self.on_controller_menu, self) self.buffer_max = 1 self.last_control_state = None
Example #14
Source File: Alignment.py From meerk40t with MIT License | 4 votes |
def __init__(self, *args, **kwds): # begin wxGlade: Alignment.__init__ kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE | wx.FRAME_TOOL_WINDOW | wx.STAY_ON_TOP wx.Frame.__init__(self, *args, **kwds) Module.__init__(self) self.SetSize((631, 365)) self.spin_vertical_distance = wx.SpinCtrl(self, wx.ID_ANY, "180", min=10, max=400) self.spin_vertical_power = wx.SpinCtrl(self, wx.ID_ANY, "180", min=10, max=500) self.check_vertical_done = wx.CheckBox(self, wx.ID_ANY, _("Vertical Alignment Finished")) self.spin_horizontal_distance = wx.SpinCtrl(self, wx.ID_ANY, "220", min=10, max=400) self.spin_horizontal_power = wx.SpinCtrl(self, wx.ID_ANY, "180", min=10, max=500) self.check_horizontal_done = wx.CheckBox(self, wx.ID_ANY, _("Horizontal Alignment Finished")) self.slider_square_power = wx.Slider(self, wx.ID_ANY, 200, 0, 1000, style=wx.SL_HORIZONTAL | wx.SL_LABELS) self.button_vertical_align_nearfar = wx.BitmapButton(self, wx.ID_ANY, icons8_resize_vertical_50.GetBitmap()) self.button_horizontal_align_nearfar = wx.BitmapButton(self, wx.ID_ANY, icons8_resize_horizontal_50.GetBitmap()) self.button_vertical_align = wx.BitmapButton(self, wx.ID_ANY, icons8_resize_vertical_50.GetBitmap()) self.button_horizontal_align = wx.BitmapButton(self, wx.ID_ANY, icons8_resize_horizontal_50.GetBitmap()) self.button_square_align_4_corner = wx.BitmapButton(self, wx.ID_ANY, icons8_stop_50.GetBitmap()) self.button_square_align = wx.BitmapButton(self, wx.ID_ANY, icons8_stop_50.GetBitmap()) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.on_button_vertical_align_nearfar, self.button_vertical_align_nearfar) self.Bind(wx.EVT_BUTTON, self.on_button_vertical_align, self.button_vertical_align) self.Bind(wx.EVT_SPINCTRL, self.on_spin_vertical_distance, self.spin_vertical_distance) self.Bind(wx.EVT_TEXT, self.on_spin_vertical_distance, self.spin_vertical_distance) self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_vertical_distance, self.spin_vertical_distance) self.Bind(wx.EVT_SPINCTRL, self.on_spin_vertical_power, self.spin_vertical_power) self.Bind(wx.EVT_TEXT, self.on_spin_vertical_power, self.spin_vertical_power) self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_vertical_power, self.spin_vertical_power) self.Bind(wx.EVT_CHECKBOX, self.on_check_vertical_done, self.check_vertical_done) self.Bind(wx.EVT_BUTTON, self.on_button_horizontal_align_nearfar, self.button_horizontal_align_nearfar) self.Bind(wx.EVT_BUTTON, self.on_button_horizontal_align, self.button_horizontal_align) self.Bind(wx.EVT_SPINCTRL, self.on_spin_horizontal_distance, self.spin_horizontal_distance) self.Bind(wx.EVT_TEXT, self.on_spin_horizontal_distance, self.spin_horizontal_distance) self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_horizontal_distance, self.spin_horizontal_distance) self.Bind(wx.EVT_SPINCTRL, self.on_spin_horizontal_power, self.spin_horizontal_power) self.Bind(wx.EVT_TEXT, self.on_spin_horizontal_power, self.spin_horizontal_power) self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_horizontal_power, self.spin_horizontal_power) self.Bind(wx.EVT_CHECKBOX, self.on_check_horizontal_done, self.check_horizontal_done) self.Bind(wx.EVT_BUTTON, self.on_button_square_align_4_corners, self.button_square_align_4_corner) self.Bind(wx.EVT_BUTTON, self.on_button_square_align, self.button_square_align) self.Bind(wx.EVT_COMMAND_SCROLL, self.on_slider_square_power_change, self.slider_square_power) self.Bind(wx.EVT_COMMAND_SCROLL_CHANGED, self.on_slider_square_power_change, self.slider_square_power) self.Bind(wx.EVT_CLOSE, self.on_close, self)
Example #15
Source File: LDPowerRailDialog.py From OpenPLC_Editor with GNU General Public License v3.0 | 4 votes |
def __init__(self, parent, controller, tagname): """ Constructor @param parent: Parent wx.Window of dialog for modal @param controller: Reference to project controller @param tagname: Tagname of project POU edited """ BlockPreviewDialog.__init__(self, parent, controller, tagname, title=_('Power Rail Properties')) # Init common sizers self._init_sizers(2, 0, 5, None, 2, 1) # Create label for connection type type_label = wx.StaticText(self, label=_('Type:')) self.LeftGridSizer.AddWindow(type_label, flag=wx.GROW) # Create radio buttons for selecting power rail type self.TypeRadioButtons = {} first = True for type, label in [(LEFTRAIL, _('Left PowerRail')), (RIGHTRAIL, _('Right PowerRail'))]: radio_button = wx.RadioButton(self, label=label, style=(wx.RB_GROUP if first else 0)) radio_button.SetValue(first) self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, radio_button) self.LeftGridSizer.AddWindow(radio_button, flag=wx.GROW) self.TypeRadioButtons[type] = radio_button first = False # Create label for power rail pin number pin_number_label = wx.StaticText(self, label=_('Pin number:')) self.LeftGridSizer.AddWindow(pin_number_label, flag=wx.GROW) # Create spin control for defining power rail pin number self.PinNumber = wx.SpinCtrl(self, min=1, max=50, style=wx.SP_ARROW_KEYS) self.PinNumber.SetValue(1) self.Bind(wx.EVT_SPINCTRL, self.OnPinNumberChanged, self.PinNumber) self.LeftGridSizer.AddWindow(self.PinNumber, flag=wx.GROW) # Add preview panel and associated label to sizers self.RightGridSizer.AddWindow(self.PreviewLabel, flag=wx.GROW) self.RightGridSizer.AddWindow(self.Preview, flag=wx.GROW) # Add buttons sizer to sizers self.MainSizer.AddSizer( self.ButtonSizer, border=20, flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT) self.Fit() # Left Power Rail radio button is default control having keyboard focus self.TypeRadioButtons[LEFTRAIL].SetFocus()