def __init__(self, name, parent, id, bmp_file, sizer, pos, property_window, show=True): """\ Class to handle wxStaticBitmap objects """ self.attribute = True ManagedBase.__init__(self, name, 'wxStaticBitmap', parent, id, sizer, pos, property_window, show=show) self.set_bitmap(bmp_file) # bitmap property self.access_functions['bitmap'] = (self.get_bitmap, self.set_bitmap) def set_attribute(v): self.attribute = int(v) self.access_functions['attribute'] = (lambda: self.attribute, set_attribute) self.bitmap_prop = FileDialogProperty( self, 'bitmap', None, #panel, style=wx.OPEN | wx.FILE_MUST_EXIST, can_disable=False, label=_("bitmap")) self.properties['bitmap'] = self.bitmap_prop self.properties['attribute'] = CheckBoxProperty( self, 'attribute', None, _('Store as attribute'), write_always=True) self.style = 0 self.access_functions['style'] = (self.get_style, self.set_style) self.style_pos = (wx.SIMPLE_BORDER, wx.DOUBLE_BORDER, wx.SUNKEN_BORDER, wx.RAISED_BORDER, wx.STATIC_BORDER, wx.NO_3D, wx.TAB_TRAVERSAL, wx.WANTS_CHARS, wx.NO_FULL_REPAINT_ON_RESIZE, wx.FULL_REPAINT_ON_RESIZE, wx.CLIP_CHILDREN) style_labels = (u'#section#' + _('Style'), 'wxSIMPLE_BORDER', 'wxDOUBLE_BORDER', 'wxSUNKEN_BORDER', 'wxRAISED_BORDER', 'wxSTATIC_BORDER', 'wxNO_3D', 'wxTAB_TRAVERSAL', 'wxWANTS_CHARS', 'wxNO_FULL_REPAINT_ON_RESIZE', 'wxFULL_REPAINT_ON_RESIZE', 'wxCLIP_CHILDREN') self.properties['style'] = CheckListProperty(self, 'style', None, style_labels)
def __init__(self, name, parent, index, style=wx.TR_HAS_BUTTONS|wx.BORDER_SUNKEN): ManagedBase.__init__(self, name, parent, index) EditStylesMixin.__init__(self) # initialise instance properties if style: self.properties["style"].set(style) self._item_with_name = None # a Tree item for visualization
def __init__(self, name, parent, label, pos): ManagedBase.__init__(self, name, 'wxRadioButton', parent, pos) EditStylesMixin.__init__(self) # initialise instance properties self.label = np.TextProperty("", multiline="grow") self.clicked = np.CheckBoxProperty(False, default_value=False)
def __init__(self, name, parent, id, style, sizer, pos): ManagedBase.__init__(self, name, 'wxStaticLine', parent, id, sizer, pos) EditStylesMixin.__init__(self) # initialise instance properties self.attribute = np.CheckBoxProperty(False, default_value=False) if style: self.properties["style"].set(style)
def __init__(self, name, parent, index): # initialize base classes ManagedBase.__init__(self, name, parent, index) EditStylesMixin.__init__(self) # initialize instance properties self.value = np.TextProperty("", multiline="grow")
def __init__(self, name, parent, index, style=wx.LC_REPORT | wx.BORDER_SUNKEN): ManagedBase.__init__(self, name, parent, index) EditStylesMixin.__init__(self, style) self.columns = GridColsProperty([]) self.rows_number = np.SpinProperty(0, immediate=True, default_value=0) self.properties["style"]._ignore_names = {"wxLC_VIRTUAL"} self.properties["style"]._one_required = ["wxLC_ICON", "wxLC_SMALL_ICON", "wxLC_LIST", "wxLC_REPORT"]
def __init__(self, name, parent, index, style): ManagedBase.__init__(self, name, parent, index) EditStylesMixin.__init__(self) # initialise instance properties self.attribute = np.CheckBoxProperty(False, default_value=False) if style: self.properties["style"].set(style)
def __init__(self, name, parent, index, bmp_file): ManagedBase.__init__(self, name, parent, index) EditStylesMixin.__init__(self) # initialise instance properties self.bitmap = np.BitmapProperty(bmp_file) self.attribute = np.CheckBoxProperty(False, default_value=False)
def __init__(self, name, parent, id, sizer, pos, property_window, show=True): import config ManagedBase.__init__(self, name, 'wxTextCtrl', parent, id, sizer, pos, property_window, show=show) self.value = "" self.style = 0 self.access_functions['value'] = (self.get_value, self.set_value) self.access_functions['style'] = (self.get_style, self.set_style) prop = self.properties # value property prop['value'] = TextProperty(self, 'value', None, multiline=True, label=_("value")) # style property self.style_pos = (wx.TE_PROCESS_ENTER, wx.TE_PROCESS_TAB, wx.TE_MULTILINE,wx.TE_PASSWORD, wx.TE_READONLY, wx.HSCROLL, wx.TE_RICH, wx.TE_RICH2, wx.TE_AUTO_URL, wx.TE_NOHIDESEL, wx.TE_CENTRE, wx.TE_RIGHT, wx.TE_LINEWRAP, wx.TE_WORDWRAP, wx.NO_BORDER) style_labels = ('#section#' + _('Style'), 'wxTE_PROCESS_ENTER', 'wxTE_PROCESS_TAB', 'wxTE_MULTILINE', 'wxTE_PASSWORD', 'wxTE_READONLY', 'wxHSCROLL', 'wxTE_RICH', 'wxTE_RICH2', 'wxTE_AUTO_URL', 'wxTE_NOHIDESEL', 'wxTE_CENTRE', 'wxTE_RIGHT', 'wxTE_LINEWRAP', 'wxTE_WORDWRAP', 'wxNO_BORDER') prop['style'] = CheckListProperty(self, 'style', None, style_labels) # 2003-09-04 added default_border if config.preferences.default_border: self.border = config.preferences.default_border_size self.flag = wx.ALL
def __init__(self, name, parent, id, label, sizer, pos, property_window, show=True): """\ Class to handle wxStaticText objects """ import config ManagedBase.__init__(self, name, 'wxStaticText', parent, id, sizer, pos, property_window, show=show) self.label = label self.style = 0 self.attribute = True self.access_functions['label'] = (self.get_label, self.set_label) self.access_functions['style'] = (self.get_style, self.set_style) def set_attribute(v): self.attribute = int(v) self.access_functions['attribute'] = (lambda : self.attribute, set_attribute) self.properties['label'] = TextProperty(self, 'label', None, multiline=True, label=_('label')) self.style_pos = (wx.ALIGN_LEFT, wx.ALIGN_RIGHT, wx.ALIGN_CENTRE, wx.ST_NO_AUTORESIZE) style_labels = ('#section#' + _('Style'), 'wxALIGN_LEFT', 'wxALIGN_RIGHT', 'wxALIGN_CENTRE', 'wxST_NO_AUTORESIZE') self.properties['style'] = CheckListProperty(self, 'style', None, style_labels) self.properties['attribute'] = CheckBoxProperty( self, 'attribute', None, _('Store as attribute'), write_always=True) # 2003-09-04 added default_border if config.preferences.default_border: self.border = config.preferences.default_border_size self.flag = wx.ALL
def __init__(self, name, parent, pos): # Initialise parent classes ManagedBase.__init__(self, name, 'wxCalendarCtrl', parent, pos) EditStylesMixin.__init__(self) # initialise instance properties self.default = np.CheckBoxProperty(False, default_value=False)
def __init__(self, name, parent, index, style): ManagedBase.__init__(self, name, parent, index) EditStylesMixin.__init__(self, style) # initialise instance properties self.range = np.IntRangePropertyA("0, 10", notnull=True) self.value = np.SpinPropertyA(0, val_range=(0, 10), immediate=True)
def __init__(self, name, parent, id, width, height, sizer, pos, property_window, show=True): """\ Class to handle spacers for sizers """ ManagedBase.__init__(self, name, 'spacer', parent, id, sizer, pos, property_window, show=show) self.__size = [width, height] self.access_functions['width'] = (self.get_width, self.set_width) self.access_functions['height'] = (self.get_height, self.set_height) self.properties['width'] = SpinProperty(self, 'width', None, label=_("width")) self.properties['height'] = SpinProperty(self, 'height', None, label=_("height"))
def __init__(self, name, parent, id, choices, sizer, pos): ManagedBase.__init__(self, name, 'wxCheckListBox', parent, id, sizer, pos) EditStylesMixin.__init__(self) # initialise instance properties self.selection = np.SpinProperty(-1, val_range=len(choices)-1, default_value=-1, immediate=True ) self.choices = ChoicesProperty( choices, [(_('Label'), np.GridProperty.STRING)] )
def __init__(self, name, klass, parent, id, sizer, pos): ManagedBase.__init__(self, name, klass, parent, id, sizer, pos) # initialise instance properties cols = [('Arguments', np.GridProperty.STRING)] self.arguments = ArgumentsProperty( [], cols ) self.custom_ctor = np.TextPropertyD("", name="custom_constructor", strip=True, default_value="")
def __init__(self, name, parent, id, label, sizer, pos, property_window, show=True): """\ Class to handle wxRadioButton objects """ import config ManagedBase.__init__(self, name, "wxRadioButton", parent, id, sizer, pos, property_window, show=show) self.label = label self.value = 0 # if nonzero, che radio button is selected self.style = 0 # label and checked properties self.access_functions["label"] = (self.get_label, self.set_label) self.access_functions["clicked"] = (self.get_value, self.set_value) self.access_functions["style"] = (self.get_style, self.set_style) self.properties["label"] = TextProperty(self, "label", None, multiline=True, label=_("label")) self.properties["clicked"] = CheckBoxProperty(self, "clicked", None, _("Clicked")) self.style_pos = [wx.RB_GROUP, wx.RB_SINGLE, wx.RB_USE_CHECKBOX] self.properties["style"] = CheckListProperty( self, "style", None, ["#section#" + _("Style"), "wxRB_GROUP", "wxRB_SINGLE", "wxRB_USE_CHECKBOX"], tooltips=[ _("Marks the beginning of a new group of radio buttons."), _( "In some circumstances, radio buttons that are not consecutive siblings trigger a hang bug in Windows (only). If this happens, add this style to mark the button as not belonging to a group, and implement the mutually-exclusive group behaviour yourself." ), _("Use a checkbox button instead of radio button (currently supported only on PalmOS)."), ], ) # 2003-09-04 added default_border if config.preferences.default_border: self.border = config.preferences.default_border_size self.flag = wx.ALL
def __init__(self, name, parent, id, sizer, pos, property_window, show=True, style=wx.TR_HAS_BUTTONS|wx.SUNKEN_BORDER): ManagedBase.__init__(self, name, 'wxTreeCtrl', parent, id, sizer, pos, property_window, show=show) self.style = style self.access_functions['style'] = (self.get_style, self.set_style) # style property self.style_pos = (wx.TR_HAS_BUTTONS, wx.TR_NO_LINES, wx.TR_LINES_AT_ROOT, wx.TR_EDIT_LABELS, wx.TR_MULTIPLE, wx.TR_NO_BUTTONS, wx.TR_TWIST_BUTTONS, wx.TR_FULL_ROW_HIGHLIGHT, wx.TR_HIDE_ROOT, wx.TR_ROW_LINES, wx.TR_HAS_VARIABLE_ROW_HEIGHT, wx.TR_SINGLE, wx.TR_MULTIPLE, wx.TR_EXTENDED, wx.TR_DEFAULT_STYLE, wx.SIMPLE_BORDER, wx.DOUBLE_BORDER, wx.SUNKEN_BORDER, wx.RAISED_BORDER, wx.STATIC_BORDER, wx.NO_BORDER, wx.WANTS_CHARS, wx.NO_FULL_REPAINT_ON_RESIZE, wx.FULL_REPAINT_ON_RESIZE) style_labels = ('#section#' + _('Style'), 'wxTR_HAS_BUTTONS', 'wxTR_NO_LINES', 'wxTR_LINES_AT_ROOT', 'wxTR_EDIT_LABELS', 'wxTR_MULTIPLE', 'wxTR_NO_BUTTONS', 'wxTR_TWIST_BUTTONS', 'wxTR_FULL_ROW_HIGHLIGHT', 'wxTR_HIDE_ROOT', 'wxTR_ROW_LINES', 'wxTR_HAS_VARIABLE_ROW_HEIGHT','wxTR_SINGLE', 'wxTR_MULTIPLE', 'wxTR_EXTENDED', 'wxTR_DEFAULT_STYLE', 'wxSIMPLE_BORDER', 'wxDOUBLE_BORDER', 'wxSUNKEN_BORDER', 'wxRAISED_BORDER', 'wxSTATIC_BORDER', 'wxNO_BORDER', 'wxWANTS_CHARS', 'wxNO_FULL_REPAINT_ON_RESIZE', 'wxFULL_REPAINT_ON_RESIZE') self.properties['style'] = CheckListProperty(self, 'style', None, style_labels) self._item_with_name = None
def __init__(self, name, parent, id, style, sizer, pos, property_window, show=True): """\ Class to handle wxNotebook objects """ ManagedBase.__init__(self, name, 'wxNotebook', parent, id, sizer, pos, property_window, show=show) self.virtual_sizer = NotebookVirtualSizer(self) self._is_removing_pages = False self.style = style self.tabs = [ ['tab1', None] ] # list of pages of this notebook # (actually a list of # 2-list label, window) self.access_functions['style'] = (self.get_tab_pos, self.set_tab_pos) self.properties['style'] = HiddenProperty(self, 'style', label=_("style")) self.access_functions['tabs'] = (self.get_tabs, self.set_tabs) tab_cols = [('Tab label', GridProperty.STRING)] self.properties['tabs'] = NotebookPagesProperty(self, 'tabs', None, tab_cols, label=_("tabs")) del tab_cols self.nb_sizer = None self._create_slots = False self.no_custom_class = False self.access_functions['no_custom_class'] = (self.get_no_custom_class, self.set_no_custom_class) self.properties['no_custom_class'] = CheckBoxProperty( self, 'no_custom_class', label=_("Don't generate code for this custom class"))
def __init__(self, name, parent, id, sizer, pos): "Class to handle wxGrid objects" ManagedBase.__init__(self, name, 'wxGrid', parent, id, sizer, pos) # instance properties self.create_grid = np.CheckBoxProperty(True) columns = [['A', '-1'], ['B', '-1'], ['C', '-1']] self.columns = GridColsProperty(columns, [('Label', np.GridProperty.STRING), ('Size', np.GridProperty.INT)]) self.rows_number = np.SpinProperty(10, immediate=True) self.row_label_size = np.SpinPropertyD(30, default_value=30, immediate=True) self.col_label_size = np.SpinPropertyD(30, default_value=30, immediate=True) self.lines_color = np.ColorPropertyD('#000000', default_value='#000000') self.label_bg_color = np.ColorPropertyD('#C0C0C0', default_value='#C0C0C0') self.enable_editing = np.CheckBoxProperty(True) self.enable_grid_lines = np.CheckBoxProperty(True) self.enable_col_resize = np.CheckBoxProperty(True) self.enable_row_resize = np.CheckBoxProperty(True) self.enable_grid_resize = np.CheckBoxProperty(True) self.selection_mode = np.RadioProperty(0, [0, 1, 2], ["Cells", "Rows", "Columns"], aliases=self._SELECTION_MODES, columns=3)
def __init__(self, name, parent, width, height, pos): #ManagedBase.__init__(self, 'spacer', 'spacer', parent, pos) ManagedBase.__init__(self, 'spacer', 'spacer', parent, pos) # initialise instance properties self.width = np.SpinProperty(width, immediate=True) self.height = np.SpinProperty(height, immediate=True)
def __init__(self, name, parent, index, style): ManagedBase.__init__(self, name, parent, index) EditStylesMixin.__init__(self) if style: self.properties["style"].set(style) # initialise instance properties self.range = np.SpinProperty(10, val_range=(0,10000000), immediate=True)
def __init__(self, name, parent, pos): ManagedBase.__init__(self, name, 'wxSpinButton', parent, pos) EditStylesMixin.__init__(self) # initialise instance properties self.range = np.IntRangePropertyA("0, 100") self.value = np.SpinPropertyA(0, val_range=(0, 100), immediate=True)
def __init__(self, name, parent, index, label=""): ManagedBase.__init__(self, name, parent, index) EditStylesMixin.__init__(self) # initialise instance properties self.label = np.TextProperty(label, multiline="grow") self.clicked = np.CheckBoxProperty(False, default_value=False)
def __init__(self, name, parent, id, win_1, win_2, orientation, sizer, pos): ManagedBase.__init__(self, name, 'wxSplitterWindow', parent, id, sizer, pos) EditStylesMixin.__init__(self) # initialise instance properties self.no_custom_class = np.CheckBoxProperty(False, default_value=False) self.sash_pos = np.SpinPropertyD(0, default_value="") if hasattr(wx, "SpinCtrlDouble"): self.sash_gravity = np.SpinDoublePropertyD(0.5, (0.0, 1.0), default_value=0.0, immediate=True) else: self.sash_gravity = np.FloatPropertyD(0.5, (0.0, 1.0), default_value=0.0) self.min_pane_size = np.SpinProperty(20) # hidden properties: orientation string, window_1, window_2 self.orientation = np.Property(orientation) self.window_1 = ChildWidgetNameProperty("_window_1") self.window_2 = ChildWidgetNameProperty("_window_2") self.virtual_sizer = SplitterWindowSizer(self) labels = ("SLOT Left", "SLOT Right") if orientation == "wxSPLIT_VERTICAL" else ( "SLOT Top", "SLOT Bottom") self._window_1 = win_1 or SizerSlot( self, self.virtual_sizer, 1, label=labels[0]) self._window_2 = win_2 or SizerSlot( self, self.virtual_sizer, 2, label=labels[1])
def __init__(self, name, parent, id, sizer, pos, property_window, show=True): """\ Class to handle wxCalendarCtrl objects """ import config self.default = False ManagedBase.__init__(self, name, 'wxCalendarCtrl', parent, id, sizer, pos, property_window, show=show) #self.access_functions['label'] = (self.get_label, self.set_label) #self.properties['label'] = TextProperty(self, 'label', None, # multiline=True) self.access_functions['default'] = (self.get_default, self.set_default) self.access_functions['style'] = (self.get_style, self.set_style) self.properties['default'] = CheckBoxProperty(self, 'default', None, label=_("default")) style_labels = ('#section#' + _('Style'), 'wxCAL_SUNDAY_FIRST', 'wxCAL_MONDAY_FIRST', 'wxCAL_SHOW_HOLIDAYS', 'wxCAL_NO_YEAR_CHANGE', 'wxCAL_NO_MONTH_CHANGE', 'wxCAL_SHOW_SURROUNDING_WEEKS','wxCAL_SEQUENTIAL_MONTH_SELECTION') self.style_pos = (CAL_SUNDAY_FIRST, CAL_MONDAY_FIRST, CAL_SHOW_HOLIDAYS, CAL_NO_YEAR_CHANGE, CAL_NO_MONTH_CHANGE, CAL_SHOW_SURROUNDING_WEEKS, CAL_SEQUENTIAL_MONTH_SELECTION) self.tooltips = (_("Show Sunday as the first day in the week"), _("Show Monday as the first day in the week"), _("Highlight holidays in the calendar"), _("Disable the year changing"), _("Disable the month (and, implicitly, the year) changing"), _("Show the neighbouring weeks in the previous and next months"), _("Use alternative, more compact, style for the month and year selection controls.")) self.properties['style'] = CheckListProperty(self, 'style', None, style_labels,tooltips=self.tooltips) if config.preferences.default_border: self.border = config.preferences.default_border_size self.flag = wx.ALL
def __init__(self, name, parent, id, label, choices, major_dim, style, sizer, pos): "Class to handle wxRadioBox objects" ManagedBase.__init__(self, name, 'wxRadioBox', parent, id, sizer, pos) self.static_box = None # initialise instance properties self.label = np.TextProperty("", multiline=True, fixed_height=True) self.dimension = np.SpinProperty(major_dim) self.selection = np.SpinProperty(0, val_range=(0, len(choices) - 1), immediate=True) self.choices = ChoicesProperty(choices, [(_('Label'), np.GridProperty.STRING)]) style = style or wx.RA_SPECIFY_ROWS styles = [wx.RA_SPECIFY_ROWS, wx.RA_SPECIFY_COLS] aliases = ["wxRA_SPECIFY_ROWS", "wxRA_SPECIFY_COLS"] # labels and aliases self.style = np.RadioProperty(style, styles, aliases, aliases=aliases, columns=2) self.buttons = None # list of wx.RadioButton
def __init__(self, name, parent, id, label, sizer, pos, property_window, show=True): """\ Class to handle wxRadioButton objects """ import config ManagedBase.__init__(self, name, 'wxRadioButton', parent, id, sizer, pos, property_window, show=show) self.label = label self.value = 0 # if nonzero, che radio button is selected self.style = 0 # label and checked properties self.access_functions['label'] = (self.get_label, self.set_label) self.access_functions['clicked'] = (self.get_value, self.set_value) self.access_functions['style'] = (self.get_style, self.set_style) self.properties['label'] = TextProperty(self, 'label', None, multiline=True, label=_("label")) self.properties['clicked'] = CheckBoxProperty(self, 'clicked', None, _('Clicked')) self.style_pos = [wx.RB_GROUP, wx.RB_SINGLE, wx.RB_USE_CHECKBOX] self.properties['style'] = CheckListProperty( self, 'style', None, ['#section#' + _('Style'), 'wxRB_GROUP', 'wxRB_SINGLE', 'wxRB_USE_CHECKBOX'], tooltips=[_('Marks the beginning of a new group of radio buttons.'), _('In some circumstances, radio buttons that are not consecutive siblings trigger a hang bug in Windows (only). If this happens, add this style to mark the button as not belonging to a group, and implement the mutually-exclusive group behaviour yourself.'), _('Use a checkbox button instead of radio button (currently supported only on PalmOS).')]) # 2003-09-04 added default_border if config.preferences.default_border: self.border = config.preferences.default_border_size self.flag = wx.ALL
def __init__(self, name, parent, index): ManagedBase.__init__(self, name, parent, index) EditStylesMixin.__init__(self) # initialise instance properties self.range = np.IntRangePropertyA( "0, 100" ) self.value = np.SpinPropertyA(0, val_range=(0,100), immediate=True, default_value="")
def __init__(self, name, parent, id, label, sizer, pos): ManagedBase.__init__(self, name, 'wxStaticText', parent, id, sizer, pos) EditStylesMixin.__init__(self) # initialise instance properties self.label = np.TextProperty(label, multiline="grow") self.attribute = np.CheckBoxProperty(False, default_value=False)
def __init__(self, name, parent, id, sizer, pos, property_window, show=True): import config ManagedBase.__init__(self, name, 'wxSpinCtrl', parent, id, sizer, pos, property_window, show=show) self.style = 0 self.value = 0 self.range = (0, 100) # Default values in wxSpinCtrl constructor. prop = self.properties self.access_functions['style'] = (self.get_style, self.set_style) self.access_functions['value'] = (self.get_value, self.set_value) self.access_functions['range'] = (self.get_range, self.set_range) style_labels = ('#section#' + _('Style'), 'wxSP_ARROW_KEYS', 'wxSP_WRAP', 'wxTE_PROCESS_ENTER', 'wxTE_PROCESS_TAB', 'wxTE_MULTILINE', 'wxTE_PASSWORD', 'wxTE_READONLY', 'wxHSCROLL', 'wxTE_RICH', 'wxTE_RICH2', 'wxTE_AUTO_URL', 'wxTE_NOHIDESEL', 'wxTE_CENTRE', 'wxTE_RIGHT', 'wxTE_LINEWRAP', 'wxTE_WORDWRAP', 'wxNO_BORDER') self.style_pos = (wx.SP_ARROW_KEYS, wx.SP_WRAP, wx.TE_PROCESS_ENTER, wx.TE_PROCESS_TAB, wx.TE_MULTILINE,wx.TE_PASSWORD, wx.TE_READONLY, wx.HSCROLL, wx.TE_RICH, wx.TE_RICH2, wx.TE_AUTO_URL, wx.TE_NOHIDESEL, wx.TE_CENTRE, wx.TE_RIGHT, wx.TE_LINEWRAP, wx.TE_WORDWRAP, wx.NO_BORDER) prop['style'] = CheckListProperty(self, 'style', None, style_labels) prop['range'] = TextProperty(self, 'range', None, can_disable=True, label=_("range")) prop['value'] = SpinProperty(self, 'value', None, can_disable=True, label=_("value")) # 2003-09-04 added default_border if config.preferences.default_border: self.border = config.preferences.default_border_size self.flag = wx.ALL
def __init__(self, name, parent, index, label): # Initialise parent classes ManagedBase.__init__(self, name, parent, index) EditStylesMixin.__init__(self) BitmapMixin.__init__(self) # initialise instance properties self.label = np.TextProperty(label, default_value="", multiline="grow") self.default = np.CheckBoxProperty(False, default_value=False) self.stockitem = np.ListBoxPropertyD(self.STOCKITEMS[0], choices=self.STOCKITEMS) self.bitmap = np.BitmapPropertyD(min_version=(3, 0)) self.disabled_bitmap = np.BitmapPropertyD(min_version=(3, 0)) self.pressed_bitmap = np.BitmapPropertyD(min_version=(3, 0)) self.current_bitmap = np.BitmapPropertyD(min_version=(3, 0)) self.focus_bitmap = np.BitmapPropertyD(min_version=(3, 0)) values = [wx.LEFT, wx.RIGHT, wx.TOP, wx.BOTTOM] aliases = ["wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM"] p = self.bitmap_dir = np.RadioProperty(wx.LEFT, values, columns=4, aliases=aliases, default_value=wx.LEFT) p.min_version = (3, 0) p.blocked = True
def __init__(self, name, parent, id, sizer, pos): "Class to handle wxGrid objects" ManagedBase.__init__(self, name, 'wxGrid', parent, id, sizer, pos) # instance properties self.create_grid = np.CheckBoxProperty(True) columns = [['A', -1], ['B', -1], ['C', -1]] self.columns = GridColsProperty([]) rows = [[str(n),-1] for n in range(10)] self.rows = GridRowsProperty( rows ) self.properties["rows_number"] = self.properties["rows"] # backward compatibility #self.rows_number = np.SpinProperty(10, immediate=True) self.row_label_size = np.SpinPropertyD(30, default_value=30, immediate=True) self.col_label_size = np.SpinPropertyD(30, default_value=30, immediate=True) self.lines_color = np.ColorPropertyD('#000000', default_value='#000000') self.label_bg_color = np.ColorPropertyD('#C0C0C0', default_value='#C0C0C0') self.enable_editing = np.CheckBoxProperty(True) self.enable_grid_lines = np.CheckBoxProperty(True) self.enable_col_resize = np.CheckBoxProperty(True) self.enable_row_resize = np.CheckBoxProperty(True) self.enable_grid_resize = np.CheckBoxProperty(True) self.selection_mode = np.RadioProperty(0, [0,1,2], ["Cells","Rows","Columns"], aliases=self._SELECTION_MODES, columns=3)
def __init__(self, name, parent, id, sizer, pos, property_window, show=True): """\ Class to handle wxDatePickerCtrl objects """ import config self.default = False ManagedBase.__init__(self, name, 'wxDatePickerCtrl', parent, id, sizer, pos, property_window, show=show) #self.access_functions['label'] = (self.get_label, self.set_label) #self.properties['label'] = TextProperty(self, 'label', None, # multiline=True, label=_("label")) self.access_functions['default'] = (self.get_default, self.set_default) self.access_functions['style'] = (self.get_style, self.set_style) self.properties['default'] = CheckBoxProperty(self, 'default', None, label=_("default")) style_labels = ('#section#' + _('Style'), 'wxDP_SPIN', 'wxDP_DROPDOWN', 'wxDP_DEFAULT', 'wxDP_ALLOWNONE', 'wxDP_SHOWCENTURY') self.style_pos = (wx.DP_SPIN, wx.DP_DROPDOWN, wx.DP_DEFAULT, wx.DP_ALLOWNONE, wx.DP_SHOWCENTURY) self.tooltips = (_("Creates a control without a month calendar drop down but with spin-control-like arrows to change individual date components. This style is not supported by the generic version."), _("Creates a control with a month calendar drop-down part from which the user can select a date."), _("Creates a control with the style that is best supported for the current platform (currently wxDP_SPIN under Windows and wxDP_DROPDOWN elsewhere)."), _("With this style, the control allows the user to not enter any valid date at all. Without it - the default - the control always has some valid date."), _("Forces display of the century in the default date format. Without this style the century could be displayed, or not, depending on the default date representation in the system.")) self.properties['style'] = CheckListProperty(self, 'style', None, style_labels,tooltips=self.tooltips) if config.preferences.default_border: self.border = config.preferences.default_border_size self.flag = wx.ALL
def __init__(self, name, parent, id, style, win_1, win_2, orientation, sizer, pos): ManagedBase.__init__(self, name, 'wxSplitterWindow', parent, id, sizer, pos) EditStylesMixin.__init__(self) # initialise instance properties self.no_custom_class = np.CheckBoxProperty(False, default_value=False) self.sash_pos = np.SpinPropertyD(0, default_value=0) self.min_pane_size = np.SpinProperty(20) # hidden properties: orientation string, window_1, window_2 self.orientation = np.Property(orientation) self.window_1 = ChildWidgetNameProperty("_window_1") self.window_2 = ChildWidgetNameProperty("_window_2") self.virtual_sizer = SplitterWindowSizer(self) labels = ("SLOT Left", "SLOT Right") if orientation == "wxSPLIT_VERTICAL" else ( "SLOT Top", "SLOT Bottom") self._window_1 = win_1 or SizerSlot(self, self.virtual_sizer, 1, labels[0]) self._window_2 = win_2 or SizerSlot(self, self.virtual_sizer, 2, labels[1]) if style: self.properties["style"].set(style)
def __init__(self, name, parent, index, choices): ManagedBase.__init__(self, name, parent, index) EditStylesMixin.__init__(self) # initialise instance properties self.selection = np.SpinProperty(-1, val_range=len(choices)-1, immediate=True ) self.choices = ChoicesProperty( choices, [(_('Label'), np.GridProperty.STRING)] )
def __init__(self, name, parent, id, sizer, pos): # initialize base classes ManagedBase.__init__(self, name, 'wxTextCtrl', parent, id, sizer, pos) EditStylesMixin.__init__(self) # initialize instance properties self.value = np.TextProperty("", multiline=True)
def __init__(self, name, parent, id, choices, sizer, pos, property_window, show=True): """\ Class to handle wxListBox objects """ ManagedBase.__init__(self, name, 'wxListBox', parent, id, sizer, pos, property_window, show=show) self.selection = 0 self.choices = choices # properties self.access_functions['choices'] = (self.get_choices, self.set_choices) self.properties['choices'] = ChoicesProperty( self, 'choices', None, [(_('Label'), GridProperty.STRING)], len(choices), label=_('choices')) self.access_functions['selection'] = (self.get_selection, self.set_selection) self.style = 0 self.access_functions['style'] = (self.get_style, self.set_style) self.properties['selection'] = SpinProperty(self, 'selection', None, r=(0, len(choices) - 1), label=_('selection')) self.style_pos = (wx.LB_SINGLE, wx.LB_MULTIPLE, wx.LB_EXTENDED, wx.LB_HSCROLL, wx.LB_ALWAYS_SB, wx.LB_NEEDED_SB, wx.LB_SORT) style_labels = ('#section#' + _('Style'), 'wxLB_SINGLE', 'wxLB_MULTIPLE', 'wxLB_EXTENDED', 'wxLB_HSCROLL', 'wxLB_ALWAYS_SB', 'wxLB_NEEDED_SB', 'wxLB_SORT') self.style_tooltips = ( _('Single-selection list.'), _('Multiple-selection list: the user can toggle multiple items on ' 'and off.'), _('Extended-selection list: the user can select multiple items ' 'using the SHIFT key and the mouse or special key combinations.' ), _('Create horizontal scrollbar if contents are too wide ' '(Windows only).'), _('Always show a vertical scrollbar.'), _('Only create a vertical scrollbar if needed.'), _('The listbox contents are sorted in alphabetical order.')) self.properties['style'] = CheckListProperty( self, 'style', None, style_labels, tooltips=self.style_tooltips)
def __init__(self, name, klass, parent, id, label, sizer, pos, property_window, show=True): """\ Class to handle wxFoo objects """ self.label = label self.default = False ManagedBase.__init__(self, name, klass, parent, id, sizer, pos, property_window, show=show) # introspect subclass looking for properties # and widgets self.property_names = [] self.property_proportion = {} attrs = dir(self) for attr in attrs: prefix = attr[0:4] if prefix == 'get_': getter = attr #print 'found getter ', getter # extract the property name prefix, name = attr.split('_', 1) #print 'getter ', name # check for a setter setter = 'set_%s' % name if not hasattr(self, setter): #print 'no setter for %s, skipping ' % name continue # check for a get_name_widget getter_widget = 'get_%s_widget' % name if not hasattr(self, getter_widget): #print 'no widget getter for %s, skipping ' % name continue #print 'adding property: %s' % name self.property_names.append(name) self.access_functions[name] = (getattr(self, getter), getattr(self, setter)) prop = getattr(self, getter_widget)() try: prop, proportion = prop except TypeError: proportion = 0 self.properties[name] = prop self.property_proportion[name] = proportion
def __init__(self, name, parent, id, sizer, pos, property_window, show=True, style=wx.TAB_TRAVERSAL): """\ Class to handle wxPanel objects """ ManagedBase.__init__(self, name, 'wxPanel', parent, id, sizer, pos, property_window, show=show) PanelBase.__init__(self, style)
def __init__(self, name, parent, id, label, sizer, pos, property_window, show=True): """\ Class to handle wxButton objects """ import config self.label = label self.default = False self.stockitem = "None" ManagedBase.__init__(self, name, 'wxButton', parent, id, sizer, pos, property_window, show=show) self.access_functions['label'] = (self.get_label, self.set_label) self.properties['label'] = TextProperty(self, 'label', None, multiline=True) self.access_functions['stockitem'] = (self.get_stockitem, self.set_stockitem) self.access_functions['default'] = (self.get_default, self.set_default) self.access_functions['style'] = (self.get_style, self.set_style) self.properties['default'] = CheckBoxProperty(self, 'default', None, label=_("Default")) self.properties['default'].tooltip = \ _("This sets the button to be the default " "item for the panel or dialog box.") #Get the list of items, and add a 'None' choices = ButtonStockItems.stock_ids.keys() choices.sort() choices[:0] = ['None'] self.properties['stockitem'] = ComboBoxProperty( self, 'stockitem', choices, can_disable=True, label=_("Stock item")) self.properties['stockitem'].tooltip = \ _("Standard IDs for button identifiers") self.style_pos = (wx.BU_LEFT, wx.BU_RIGHT, wx.BU_TOP, wx.BU_BOTTOM, wx.BU_EXACTFIT,wx.NO_BORDER) style_labels = ('#section#' + _('Style'), 'wxBU_LEFT', 'wxBU_RIGHT', 'wxBU_TOP', 'wxBU_BOTTOM', 'wxBU_EXACTFIT','wxNO_BORDER') #The tooltips tuple style_tooltips=(_("Left-justifies the label. Windows and GTK+ only."), _("Right-justifies the bitmap label. Windows and GTK+ " "only."), _("Aligns the label to the top of the button. Windows " "and GTK+ only."), _("Aligns the label to the bottom of the button. " "Windows and GTK+ only."), _("Creates the button as small as possible instead of " "making it of the standard size (which is the default " "behaviour )."), _("Creates a flat button. Windows and GTK+ only.")) self.properties['style'] = CheckListProperty( self, 'style', None, style_labels, tooltips=style_tooltips) # the tooltips tuple is # passed as the last # argument # 2003-09-04 added default_border if config.preferences.default_border: self.border = config.preferences.default_border_size self.flag = wx.ALL
def __init__(self, name, parent, id, style, win_1, win_2, orientation, sizer, pos, property_window, show=True): """\ Class to handle wxSplitterWindow objects """ ManagedBase.__init__(self, name, 'wxSplitterWindow', parent, id, sizer, pos, property_window, show=show) self.virtual_sizer = SplitterWindowSizer(self) if style is None: style = wx.SP_3D self.style = style self.window_1 = win_1 self.window_2 = win_2 self.orientation = orientation self.sash_pos = 0 self.access_functions['style'] = (self.get_style, self.set_style) self.access_functions['sash_pos'] = (self.get_sash_pos, self.set_sash_pos) self.style_pos = (wx.SP_3D, wx.SP_3DSASH, wx.SP_3DBORDER, #wx.SP_FULLSASH, wx.SP_BORDER, wx.SP_NOBORDER, wx.SP_PERMIT_UNSPLIT, wx.SP_LIVE_UPDATE, wx.CLIP_CHILDREN) style_labels = ('#section#' + _('Style'), 'wxSP_3D', 'wxSP_3DSASH', 'wxSP_3DBORDER', #'wxSP_FULLSASH', 'wxSP_BORDER', 'wxSP_NOBORDER', 'wxSP_PERMIT_UNSPLIT', 'wxSP_LIVE_UPDATE', 'wxCLIP_CHILDREN') self.properties['style'] = CheckListProperty(self, 'style', None, style_labels) if self.orientation == wx.SPLIT_HORIZONTAL: od = 'wxSPLIT_HORIZONTAL' else: od = 'wxSPLIT_VERTICAL' self.access_functions['orientation'] = (self.get_orientation, self.set_orientation) self.properties['orientation'] = HiddenProperty(self, 'orientation', label=_("orientation")) self.access_functions['window_1'] = (self.get_win_1, lambda v: None) self.access_functions['window_2'] = (self.get_win_2, lambda v: None) self.properties['window_1'] = HiddenProperty(self, 'window_1') self.properties['window_2'] = HiddenProperty(self, 'window_2') self.window_1 = SizerSlot(self, self.virtual_sizer, 1) self.window_2 = SizerSlot(self, self.virtual_sizer, 2) self.properties['sash_pos'] = SpinProperty(self, 'sash_pos', None, r=(0, 20), can_disable=True, label=_("sash_pos")) self.no_custom_class = False self.access_functions['no_custom_class'] = (self.get_no_custom_class, self.set_no_custom_class) self.properties['no_custom_class'] = CheckBoxProperty( self, 'no_custom_class', label=_("Don't generate code for this custom class"))
def __init__(self, name, parent, id, sizer, pos, property_window, show=True, style=wx.LC_REPORT|wx.SUNKEN_BORDER): ManagedBase.__init__(self, name, 'wxListCtrl', parent, id, sizer, pos, property_window, show=show) self.style = style self.access_functions['style'] = (self.get_style, self.set_style) # style property self.style_pos = (wx.LC_LIST, wx.LC_REPORT, wx.LC_ICON, wx.LC_VIRTUAL, wx.LC_SMALL_ICON, wx.LC_ALIGN_TOP, wx.LC_ALIGN_LEFT, wx.LC_AUTOARRANGE, wx.LC_EDIT_LABELS, wx.LC_NO_HEADER, wx.LC_SINGLE_SEL, wx.LC_SORT_ASCENDING, wx.LC_SORT_DESCENDING, wx.LC_HRULES, wx.LC_VRULES, wx.SIMPLE_BORDER, wx.DOUBLE_BORDER, wx.SUNKEN_BORDER, wx.RAISED_BORDER, wx.STATIC_BORDER, wx.NO_BORDER, wx.WANTS_CHARS, wx.NO_FULL_REPAINT_ON_RESIZE, wx.FULL_REPAINT_ON_RESIZE) style_labels = ('#section#' + _('Style'), 'wxLC_LIST', 'wxLC_REPORT', 'wxLC_ICON', 'wxLC_VIRTUAL', 'wxLC_SMALL_ICON', 'wxLC_ALIGN_TOP', 'wxLC_ALIGN_LEFT', 'wxLC_AUTOARRANGE', 'wxLC_EDIT_LABELS', 'wxLC_NO_HEADER', 'wxLC_SINGLE_SEL', 'wxLC_SORT_ASCENDING', 'wxLC_SORT_DESCENDING', 'wxLC_HRULES', 'wxLC_VRULES', 'wxSIMPLE_BORDER', 'wxDOUBLE_BORDER', 'wxSUNKEN_BORDER', 'wxRAISED_BORDER', 'wxSTATIC_BORDER', 'wxNO_BORDER', 'wxWANTS_CHARS', 'wxNO_FULL_REPAINT_ON_RESIZE', 'wxFULL_REPAINT_ON_RESIZE') self.style_tooltips = (_("Multicolumn list view, with optional small icons. Columns are computed automatically, i.e. you don't set columns as in wxLC_REPORT. In other words, the list wraps, unlike a wxListBox."), _("Single or multicolumn report view, with optional header."), _("Large icon view, with optional labels."), _("The application provides items text on demand. May only be used with wxLC_REPORT."), _("Small icon view, with optional labels."), _("Icons align to the top. Win32 default, Win32 only."), _("Icons align to the left."), _("Icons arrange themselves. Win32 only."), _("Labels are editable: the application will be notified when editing starts."), _("No header in report mode."), _("Single selection (default is multiple)."), _("Sort in ascending order (must still supply a comparison callback in SortItems."), _("Sort in descending order (must still supply a comparison callback in SortItems."), _("Draws light horizontal rules between rows in report mode."), _("Draws light vertical rules between columns in report mode"), _("Displays a thin border around the window. wxBORDER is the old name for this style."), _("Displays a double border. Windows and Mac only."), _("Displays a sunken border."), _("Displays a raised border."), _("Displays a border suitable for a static control. Windows only."), _("Displays no border, overriding the default border style for the window."), _("Use this to indicate that the window wants to get all char/key events for all keys - even for keys like TAB or ENTER which are usually used for dialog navigation and which wouldn't be generated without this style. If you need to use this style in order to get the arrows or etc., but would still like to have normal keyboard navigation take place, you should create and send a wxNavigationKeyEvent in response to the key events for Tab and Shift-Tab."), _("On Windows, this style used to disable repainting the window completely when its size is changed. Since this behaviour is now the default, the style is now obsolete and no longer has an effect."), _("Use this style to force a complete redraw of the window whenever it is resized instead of redrawing just the part of the window affected by resizing. Note that this was the behaviour by default before 2.5.1 release and that if you experience redraw problems with code which previously used to work you may want to try this. Currently this style applies on GTK+ 2 and Windows only, and full repainting is always done on other platforms.")) self.properties['style'] = CheckListProperty( self, 'style', None, style_labels, tooltips=self.style_tooltips)
def __init__(self, name, parent, id, bmp_file, sizer, pos, property_window, show=True): """\ Class to handle wxBitmapButton objects """ import config ManagedBase.__init__(self, name, "wxBitmapButton", parent, id, sizer, pos, property_window, show=show) self.default = False self.set_bitmap(bmp_file) # bitmap property self.access_functions["bitmap"] = (self.get_bitmap, self.set_bitmap) self.properties["bitmap"] = FileDialogProperty( self, "bitmap", None, style=wx.OPEN | wx.FILE_MUST_EXIST, can_disable=False, label=_("bitmap") ) self.access_functions["default"] = (self.get_default, self.set_default) self.access_functions["style"] = (self.get_style, self.set_style) self.properties["default"] = CheckBoxProperty(self, "default", None, label=_("default")) # 2003-08-07: added 'disabled_bitmap' property self.disabled_bitmap = "" self.access_functions["disabled_bitmap"] = (self.get_disabled_bitmap, self.set_disabled_bitmap) self.properties["disabled_bitmap"] = FileDialogProperty( self, "disabled_bitmap", None, style=wx.OPEN | wx.FILE_MUST_EXIST, label=_("disabled bitmap") ) # 2003-09-04 added default_border if config.preferences.default_border: self.border = config.preferences.default_border_size self.flag = wx.ALL self.style_pos = (wx.BU_AUTODRAW, wx.BU_LEFT, wx.BU_RIGHT, wx.BU_TOP, wx.BU_BOTTOM, wx.NO_BORDER) style_labels = ( "#section#" + _("Style"), "wxBU_AUTODRAW", "wxBU_LEFT", "wxBU_RIGHT", "wxBU_TOP", "wxBU_BOTTOM", "wxNO_BORDER", ) # The tooltips tuple self.tooltips = ( _( "If this is specified, the button will be drawn " "automatically using the label bitmap only, providing" " a 3D-look border. If this style is not specified, the " "button will be drawn without borders and using all " "provided bitmaps. WIN32 only." "Left-justifies the bitmap label. WIN32 only." ), _("Right-justifies the bitmap label. WIN32 only."), _("Aligns the bitmap label to the top of the button." " WIN32 only."), _("Aligns the bitmap label to the bottom of the button." " WIN32 only."), _("Creates a flat button. Windows and GTK+ only."), ) self.properties["style"] = CheckListProperty(self, "style", None, style_labels, tooltips=self.tooltips)
def __init__(self, name, parent, id, width, height, sizer, pos, property_window, show=True): """\ Class to handle spacers for sizers """ ManagedBase.__init__(self, name, "spacer", parent, id, sizer, pos, property_window, show=show) self.__size = [width, height] self.access_functions["width"] = (self.get_width, self.set_width) self.access_functions["height"] = (self.get_height, self.set_height) self.properties["width"] = SpinProperty(self, "width", None, label=_("width")) self.properties["height"] = SpinProperty(self, "height", None, label=_("height"))
def __init__(self, name, parent, id, style, sizer, pos, property_window, show=True): """\ Class to handle wxNotebook objects """ # create new and (still) unused notebook name if not name: name = self.next_notebook_name() # Increase number of created notebooks EditNotebook.notebook_number += 1 ManagedBase.__init__(self, name, 'wxNotebook', parent, id, sizer, pos, property_window, show=show) self.virtual_sizer = NotebookVirtualSizer(self) self._is_removing_pages = False self.style = style self.tabs = [['tab1', None]] # list of pages of this notebook # (actually a list of # 2-list label, window) self.access_functions['style'] = (self.get_tab_pos, self.set_tab_pos) self.properties['style'] = HiddenProperty( self, 'style', label=_("style"), ) self.access_functions['tabs'] = (self.get_tabs, self.set_tabs) tab_cols = [('Tab label', GridProperty.STRING)] self.properties['tabs'] = NotebookPagesProperty( self, 'tabs', None, tab_cols, label=_("tabs"), can_remove_last=False, ) del tab_cols self.nb_sizer = None self._create_slots = False self.no_custom_class = False self.access_functions['no_custom_class'] = (self.get_no_custom_class, self.set_no_custom_class) self.properties['no_custom_class'] = CheckBoxProperty( self, 'no_custom_class', label=_("Don't generate code for this custom class")) # first pane should have number 1 self.pane_number = 1
def __init__(self, name, klass, parent, id, sizer, pos, property_window, show=True): ManagedBase.__init__(self, name, klass, parent, id, sizer, pos, property_window, show) self.arguments = [['$parent'], ['$id']] #,['$width'],['$height']] self.access_functions['arguments'] = (self.get_arguments, self.set_arguments) cols = [('Arguments', GridProperty.STRING)] self.properties['arguments'] = ArgumentsProperty( self, 'arguments', None, cols, 2, label=_("arguments")) self.custom_ctor = "" # if not empty, an arbitrary piece of code that # will be used instead of the constructor name self.access_functions['custom_ctor'] = (self.get_custom_ctor, self.set_custom_ctor) self.properties['custom_ctor'] = TextProperty( self, 'custom_ctor', None, True, label=_('Custom constructor'))
def __init__(self, name, parent, id, orientation, sizer, pos, property_window, show=True): """\ Class to handle wxStaticLine objects """ self.orientation = orientation self.attribute = True ManagedBase.__init__(self, name, 'wxStaticLine', parent, id, sizer, pos, property_window, show=show) self.access_functions['style'] = (self.get_orientation, self.set_orientation) def set_attribute(v): self.attribute = int(v) self.access_functions['attribute'] = (lambda : self.attribute, set_attribute) self.properties['style'] = HiddenProperty(self, 'style', label=_("style")) self.properties['attribute'] = CheckBoxProperty( self, 'attribute', None, _('Store as attribute'), write_always=True) self.removed_p = self.properties['font']
def __init__(self, name, parent, id, choices, sizer, pos, property_window, show=True): """\ Class to handle wxComboBox objects """ import config ManagedBase.__init__(self, name, 'wxComboBox', parent, id, sizer, pos, property_window, show=show) self.choices = choices if len(choices): self.selection = 0 else: self.selection = -1 self.style = 0 # properties self.access_functions['choices'] = (self.get_choices, self.set_choices) self.access_functions['style'] = (self.get_style, self.set_style) style_labels = ('#section#' + _('Style'), 'wxCB_SIMPLE', 'wxCB_DROPDOWN', 'wxCB_READONLY', 'wxCB_SORT') self.style_pos = [ eval('wx.' + s[2:]) for s in style_labels[1:] ] self.tooltips = (_("Creates a combobox with a permanently displayed list." " Windows only."), _("Creates a combobox with a drop-down list."), _("Same as wxCB_DROPDOWN but only the strings specified " "as the combobox choices can be selected, it is " "impossible to select (even from a program) a string " "which is not in the choices list."), _("Sorts the entries in the list alphabetically.")) self.properties['style'] = CheckListProperty(self, 'style', None, style_labels, tooltips=self.tooltips) self.properties['choices'] = ChoicesProperty(self, 'choices', None, [('Label', GridProperty.STRING)], len(choices), label=_("choices")) self.access_functions['selection'] = (self.get_selection, self.set_selection) self.choices = list(choices) self.properties['selection'] = SpinProperty(self, 'selection', None, r=(0, len(choices)-1), label=_("selection")) # 2003-09-04 added default_border if config.preferences.default_border: self.border = config.preferences.default_border_size self.flag = wx.ALL
def __init__(self, name, parent, id, label, sizer, pos, property_window, show=True): """\ Class to handle wxToggleButton objects """ import config ManagedBase.__init__(self, name, 'wxToggleButton', parent, id, sizer, pos, property_window, show=show) self.label = label self.value = 0 self.access_functions['label'] = (self.get_label, self.set_label) self.access_functions['value'] = (self.get_value, self.set_value) self.properties['label'] = TextProperty(self, 'label', None, multiline=True, label=_("label")) self.properties['value'] = CheckBoxProperty(self, 'value', None, _('Clicked')) # 2003-09-04 added default_border if config.preferences.default_border: self.border = config.preferences.default_border_size self.flag = wx.ALL
def __init__(self, name, parent, id, choices, sizer, pos, property_window, show=True): """\ Class to handle wxListBox objects """ ManagedBase.__init__(self, name, 'wxListBox', parent, id, sizer, pos, property_window, show=show) self.selection = 0 self.choices = choices # properties self.access_functions['choices'] = (self.get_choices, self.set_choices) self.properties['choices'] = ChoicesProperty(self, 'choices', None, [(_('Label'), GridProperty.STRING)], len(choices), label=_('choices')) self.access_functions['selection'] = (self.get_selection, self.set_selection) self.style = 0 self.access_functions['style'] = (self.get_style, self.set_style) self.properties['selection'] = SpinProperty(self, 'selection', None, r=(0, len(choices)-1), label=_('selection')) self.style_pos = (wx.LB_SINGLE, wx.LB_MULTIPLE, wx.LB_EXTENDED, wx.LB_HSCROLL, wx.LB_ALWAYS_SB, wx.LB_NEEDED_SB, wx.LB_SORT) style_labels = ('#section#' + _('Style'), 'wxLB_SINGLE', 'wxLB_MULTIPLE', 'wxLB_EXTENDED', 'wxLB_HSCROLL', 'wxLB_ALWAYS_SB', 'wxLB_NEEDED_SB', 'wxLB_SORT') self.style_tooltips = (_('Single-selection list.'), _('Multiple-selection list: the user can toggle multiple items on ' 'and off.'), _('Extended-selection list: the user can select multiple items ' 'using the SHIFT key and the mouse or special key combinations.'), _('Create horizontal scrollbar if contents are too wide ' '(Windows only).'), _('Always show a vertical scrollbar.'), _('Only create a vertical scrollbar if needed.'), _('The listbox contents are sorted in alphabetical order.')) self.properties['style'] = CheckListProperty( self, 'style', None, style_labels, tooltips=self.style_tooltips)
def __init__(self, name, parent, id, style, sizer, pos, property_window, show=True): """\ Class to handle wxGauge objects """ ManagedBase.__init__(self, name, 'wxGauge', parent, id, sizer, pos, property_window, show=show) self.style = style self.range = 10 prop = self.properties self.access_functions['style'] = (self.get_style, self.set_style) self.access_functions['range'] = (self.get_range, self.set_range) style_labels = ('#section#' + _('Style'), 'wxGA_HORIZONTAL', 'wxGA_VERTICAL', 'wxGA_PROGRESSBAR', 'wxGA_SMOOTH') self.style_pos = (wx.GA_HORIZONTAL, wx.GA_VERTICAL, wx.GA_PROGRESSBAR, wx.GA_SMOOTH) self.tooltips = (_("Creates a horizontal gauge."), _("Creates a vertical gauge."), _("Under Windows 95, creates a horizontal progress bar."), _("Creates smooth progress bar with one pixel wide update step (not supported by all platforms).")) prop['style'] = CheckListProperty(self, 'style', None, style_labels,tooltips=self.tooltips) prop['range'] = SpinProperty(self, 'range', None, label=_("range"))
def __init__(self, name, parent, id, bmp_file, sizer, pos, property_window, show=True): """\ Class to handle wxStaticBitmap objects """ self.attribute = True ManagedBase.__init__(self, name, 'wxStaticBitmap', parent, id, sizer, pos, property_window, show=show) self.set_bitmap(bmp_file) # bitmap property self.access_functions['bitmap'] = (self.get_bitmap, self.set_bitmap) def set_attribute(v): self.attribute = int(v) self.access_functions['attribute'] = (lambda : self.attribute, set_attribute) self.bitmap_prop = FileDialogProperty(self, 'bitmap', None, #panel, style=wx.OPEN|wx.FILE_MUST_EXIST, can_disable=False, label=_("bitmap")) self.properties['bitmap'] = self.bitmap_prop self.properties['attribute'] = CheckBoxProperty( self, 'attribute', None, _('Store as attribute'), write_always=True) self.style = 0 self.access_functions['style'] = (self.get_style, self.set_style) self.style_pos = (wx.SIMPLE_BORDER, wx.DOUBLE_BORDER, wx.SUNKEN_BORDER, wx.RAISED_BORDER, wx.STATIC_BORDER, wx.NO_3D, wx.TAB_TRAVERSAL, wx.WANTS_CHARS, wx.NO_FULL_REPAINT_ON_RESIZE, wx.FULL_REPAINT_ON_RESIZE, wx.CLIP_CHILDREN) style_labels = (u'#section#' + _('Style'), 'wxSIMPLE_BORDER', 'wxDOUBLE_BORDER', 'wxSUNKEN_BORDER', 'wxRAISED_BORDER', 'wxSTATIC_BORDER', 'wxNO_3D', 'wxTAB_TRAVERSAL', 'wxWANTS_CHARS', 'wxNO_FULL_REPAINT_ON_RESIZE', 'wxFULL_REPAINT_ON_RESIZE', 'wxCLIP_CHILDREN') self.properties['style'] = CheckListProperty(self, 'style', None, style_labels)
def __init__(self, name, parent, id, label, choices, major_dim, style, sizer, pos, property_window, show=True): """\ Class to handle wxRadioBox objects """ ManagedBase.__init__(self, name, 'wxRadioBox', parent, id, sizer, pos, property_window, show=show) self.static_box = None self.selection = 0 self.choices = choices self.buttons = None self.major_dim = major_dim if not style: self.style = wx.RA_SPECIFY_ROWS else: self.style = style self.label = label # properties self.access_functions['label'] = (self.get_label, self.set_label) self.access_functions['choices'] = (self.get_choices, self.set_choices) self.access_functions['style'] = (self.get_style, self.set_style) self.access_functions['dimension'] = (self.get_major_dimension, self.set_major_dimension) self.access_functions['selection'] = (self.get_selection, self.set_selection) self.properties['label'] = TextProperty(self, 'label', None, label=_("label")) self.properties['selection'] = SpinProperty(self, 'selection', None, r=(0, len(choices)-1), label=_("selection")) self.properties['choices'] = ChoicesProperty(self, 'choices', None, [('Label', GridProperty.STRING)], len(choices), label=_("choices")) self.style_pos = [wx.RA_SPECIFY_ROWS, wx.RA_SPECIFY_COLS] self.properties['style'] = RadioProperty(self, 'style', None, ['wxRA_SPECIFY_ROWS', 'wxRA_SPECIFY_COLS'], label=_("style")) self.properties['dimension'] = SpinProperty(self, 'dimension', None, label=_("dimension"))
def __init__(self, name, parent, id, choices, sizer, pos, property_window, show=True): """\ Class to handle wxChoice objects """ import config ManagedBase.__init__(self, name, 'wxChoice', parent, id, sizer, pos, property_window, show=show) self.choices = choices self.selection = 0 self.access_functions['choices'] = (self.get_choices, self.set_choices) self.properties['choices'] = ChoicesProperty(self, 'choices', None, [('Label', GridProperty.STRING)], len(choices),label=_('choices')) self.access_functions['selection'] = (self.get_selection, self.set_selection) self.properties['selection'] = SpinProperty(self, 'selection', None, r=(0, len(choices)-1), label=_('selection')) # 2003-09-04 added default_border if config.preferences.default_border: self.border = config.preferences.default_border_size self.flag = wx.ALL
def __init__(self, name, parent, id, sizer, pos, property_window, show=True): import config ManagedBase.__init__(self, name, 'wxSpinButton', parent, id, sizer, pos, property_window, show=show) self.style = 0 self.value = 0 self.range = (0, 100) # Default values in wxSpinButton constructor. prop = self.properties self.access_functions['style'] = (self.get_style, self.set_style) self.access_functions['value'] = (self.get_value, self.set_value) self.access_functions['range'] = (self.get_range, self.set_range) style_labels = ('#section#' + _('Style'), 'wxSP_HORIZONTAL', 'wxSP_VERTICAL', 'wxSP_ARROW_KEYS', 'wxSP_WRAP') self.style_pos = (wx.SP_HORIZONTAL, wx.SP_VERTICAL, wx.SP_ARROW_KEYS, wx.SP_WRAP) prop['style'] = CheckListProperty(self, 'style', None, style_labels) prop['range'] = TextProperty(self, 'range', None, can_disable=True, label=_("range")) prop['value'] = SpinProperty(self, 'value', None, can_disable=True, label=_("value")) # 2003-09-04 added default_border if config.preferences.default_border: self.border = config.preferences.default_border_size self.flag = wx.ALL
def __init__(self, name, parent, id, style, sizer, pos, property_window, show=True): """\ Class to handle wxSlider objects """ ManagedBase.__init__(self, name, 'wxSlider', parent, id, sizer, pos, property_window, show=show) self.style = style self.value = 0 self.range = (0, 10) prop = self.properties self.access_functions['style'] = (self.get_style, self.set_style) self.access_functions['value'] = (self.get_value, self.set_value) self.access_functions['range'] = (self.get_range, self.set_range) style_labels = ('#section#' + _('Style'), 'wxSL_HORIZONTAL', 'wxSL_VERTICAL', 'wxSL_AUTOTICKS', 'wxSL_LABELS', 'wxSL_LEFT', 'wxSL_RIGHT', 'wxSL_TOP', 'wxSL_BOTTOM', 'wxSL_SELRANGE', 'wxSL_INVERSE') self.style_pos = (wx.SL_HORIZONTAL, wx.SL_VERTICAL, wx.SL_AUTOTICKS, wx.SL_LABELS, wx.SL_LEFT, wx.SL_RIGHT, wx.SL_TOP, wx.SL_BOTTOM, wx.SL_SELRANGE, wx.SL_INVERSE) tooltips = (_("Displays the slider horizontally (this is the default)."), _("Displays the slider vertically."), _("Displays tick marks."), _("Displays minimum, maximum and value labels."), _("Displays ticks on the left and forces the slider to be vertical."), _("Displays ticks on the right and forces the slider to be vertical."), _("Displays ticks on the top."), _("Displays ticks on the bottom (this is the default)."), _("Allows the user to select a range on the slider. Windows only."), _("Inverses the mininum and maximum endpoints on the slider. Not compatible with wxSL_SELRANGE.")) prop['style'] = CheckListProperty(self, 'style', None, style_labels, tooltips=tooltips) prop['range'] = TextProperty(self, 'range', None, can_disable=True, label=_("range")) prop['value'] = SpinProperty(self, 'value', None, can_disable=True, label=_("value"))
def __init__(self, name, parent, id, sizer, pos, property_window, show=True): """\ Class to handle wxGrid objects """ # values of properties for the grid: self.row_label_size = 30 self.col_label_size = 30 self.enable_editing = True self.enable_grid_lines = True self.rows_number = 10 self.enable_col_resize = True self.enable_row_resize = True self.enable_grid_resize = True self.lines_color = "#000000" self.label_bg_color = "#C0C0C0" self.selection_mode = 0 # == wxGrid.wxGridSelectCells self.create_grid = True self.columns = [["A", "-1"], ["B", "-1"], ["C", "-1"]] ManagedBase.__init__(self, name, "wxGrid", parent, id, sizer, pos, property_window, show=show) props = self.properties af = self.access_functions af["create_grid"] = (self.get_create_grid, self.set_create_grid) props["create_grid"] = CheckBoxProperty(self, "create_grid", None, write_always=True, label=_("create_grid")) af["row_label_size"] = (self.get_row_label_size, self.set_row_label_size) props["row_label_size"] = SpinProperty( self, "row_label_size", None, can_disable=True, label=_("row_label_size") ) af["col_label_size"] = (self.get_col_label_size, self.set_col_label_size) props["col_label_size"] = SpinProperty( self, "col_label_size", None, can_disable=True, label=_("col_label_size") ) af["enable_editing"] = (self.get_enable_editing, self.set_enable_editing) props["enable_editing"] = CheckBoxProperty( self, "enable_editing", None, write_always=True, label=_("enable_editing") ) af["enable_grid_lines"] = (self.get_enable_grid_lines, self.set_enable_grid_lines) props["enable_grid_lines"] = CheckBoxProperty( self, "enable_grid_lines", None, write_always=True, label=_("enable_grid_lines") ) af["rows_number"] = (self.get_rows_number, self.set_rows_number) props["rows_number"] = SpinProperty(self, "rows_number", None, label=_("rows_number")) af["enable_col_resize"] = (self.get_enable_col_resize, self.set_enable_col_resize) props["enable_col_resize"] = CheckBoxProperty( self, "enable_col_resize", None, write_always=True, label=_("enable_col_resize") ) af["enable_row_resize"] = (self.get_enable_row_resize, self.set_enable_row_resize) props["enable_row_resize"] = CheckBoxProperty( self, "enable_row_resize", None, write_always=True, label=_("enable_row_resize") ) af["enable_grid_resize"] = (self.get_enable_grid_resize, self.set_enable_grid_resize) props["enable_grid_resize"] = CheckBoxProperty( self, "enable_grid_resize", None, write_always=True, label=_("enable_grid_resize") ) af["lines_color"] = (self.get_lines_color, self.set_lines_color) props["lines_color"] = ColorDialogProperty(self, "lines_color", None, label=_("lines_color")) af["label_bg_color"] = (self.get_label_bg_color, self.set_label_bg_color) props["label_bg_color"] = ColorDialogProperty(self, "label_bg_color", None, label=_("label_bg_color")) af["selection_mode"] = (self.get_selection_mode, self.set_selection_mode) props["selection_mode"] = RadioProperty( self, "selection_mode", None, ["wxGrid.wxGridSelectCells", "wxGrid.wxGridSelectRows", "wxGrid.wxGridSelectColumns"], label=_("selection_mode"), ) af["columns"] = (self.get_columns, self.set_columns) props["columns"] = GridColsProperty( self, "columns", None, [("Label", GridProperty.STRING), ("Size", GridProperty.INT)], label=_("columns") )
def __init__(self, name, parent, id, label, sizer, pos, property_window, show=True): """\ Class to handle wxHyperlinkCtrl objects """ import config ManagedBase.__init__(self, name, 'wxHyperlinkCtrl', parent, id, sizer, pos, property_window, show=show) self.attribute = True self.label = label self.style = 0 self.url = "" self.access_functions['label'] = (self.get_label, self.set_label) self.access_functions['style'] = (self.get_style, self.set_style) self.access_functions['url'] = (self.get_url, self.set_url) self.access_functions['attribute'] = (self.get_attribute, self.set_attribute) self.properties['label'] = TextProperty( self, 'label', None, multiline=False, label=_('label') ) self.properties['label'].set_tooltip( _("Label of the hyperlink") ) self.properties['url'] = TextProperty( self, 'url', None, multiline=False, label=_('url') ) self.properties['url'].set_tooltip( _("URL associated with the given label") ) self.style_pos = ( wx.HL_ALIGN_LEFT, wx.HL_ALIGN_RIGHT, wx.HL_ALIGN_CENTRE, wx.HL_CONTEXTMENU, wx.HL_DEFAULT_STYLE, ) style_labels = ( '#section#' + _('Style'), 'wxHL_ALIGN_LEFT', 'wxHL_ALIGN_RIGHT', 'wxHL_ALIGN_CENTRE', 'wxHL_CONTEXTMENU', 'wxHL_DEFAULT_STYLE', ) self.properties['style'] = CheckListProperty(self, 'style', None, style_labels) self.properties['attribute'] = CheckBoxProperty( self, 'attribute', None, _('Store as attribute'), write_always=True ) if config.preferences.default_border: self.border = config.preferences.default_border_size self.flag = wx.ALL
def __init__(self, name, parent, id, sizer, pos, property_window, show=True): """\ Class to handle wxGrid objects """ # values of properties for the grid: self.row_label_size = 30 self.col_label_size = 30 self.enable_editing = True self.enable_grid_lines = True self.rows_number = 10 self.enable_col_resize = True self.enable_row_resize = True self.enable_grid_resize = True self.lines_color = '#000000' self.label_bg_color = '#C0C0C0' self.selection_mode = 0 # == wxGrid.wxGridSelectCells self.create_grid = True self.columns = [ ['A','-1'] , ['B','-1'] , ['C','-1'] ] ManagedBase.__init__(self, name, 'wxGrid', parent, id, sizer, pos, property_window, show=show) props = self.properties af = self.access_functions af['create_grid'] = (self.get_create_grid, self.set_create_grid) props['create_grid'] = CheckBoxProperty( self, 'create_grid', None, write_always=True, label=_("create_grid")) af['row_label_size'] = (self.get_row_label_size, self.set_row_label_size) props['row_label_size'] = SpinProperty( self, 'row_label_size', None, can_disable=True, label=_("row_label_size"), omitter='create_grid') af['col_label_size'] = (self.get_col_label_size, self.set_col_label_size) props['col_label_size'] = SpinProperty( self, 'col_label_size', None, can_disable=True, label=_("col_label_size"), omitter='create_grid') af['enable_editing'] = (self.get_enable_editing, self.set_enable_editing) props['enable_editing'] = CheckBoxProperty( self, 'enable_editing', None, write_always=True, label=_("enable_editing"), omitter='create_grid') af['enable_grid_lines'] = (self.get_enable_grid_lines, self.set_enable_grid_lines) props['enable_grid_lines']= CheckBoxProperty( self, 'enable_grid_lines', None, write_always=True, label=_("enable_grid_lines"), omitter='create_grid') af['rows_number'] = (self.get_rows_number, self.set_rows_number) props['rows_number'] = SpinProperty( self, 'rows_number', None, label=_("rows_number"), omitter='create_grid') af['enable_col_resize'] = (self.get_enable_col_resize, self.set_enable_col_resize) props['enable_col_resize']= CheckBoxProperty( self, 'enable_col_resize', None, write_always=True, label=_("enable_col_resize"), omitter='create_grid') af['enable_row_resize'] = (self.get_enable_row_resize, self.set_enable_row_resize) props['enable_row_resize'] = CheckBoxProperty( self, 'enable_row_resize', None, write_always=True, label=_("enable_row_resize"), omitter='create_grid') af['enable_grid_resize'] = (self.get_enable_grid_resize, self.set_enable_grid_resize) props['enable_grid_resize'] = CheckBoxProperty( self, 'enable_grid_resize', None, write_always=True, label=_("enable_grid_resize"), omitter='create_grid') af['lines_color'] = (self.get_lines_color, self.set_lines_color) props['lines_color']= ColorDialogProperty( self, 'lines_color', None, label=_("lines_color"), omitter='create_grid') af['label_bg_color'] = (self.get_label_bg_color, self.set_label_bg_color) props['label_bg_color']= ColorDialogProperty( self, 'label_bg_color', None, label=_("label_bg_color"), omitter='create_grid') af['selection_mode'] = (self.get_selection_mode, self.set_selection_mode) props['selection_mode'] = RadioProperty( self, 'selection_mode', None, ['wxGrid.wxGridSelectCells', 'wxGrid.wxGridSelectRows', 'wxGrid.wxGridSelectColumns'], label=_("selection_mode"), omitter='create_grid') af['columns'] = (self.get_columns, self.set_columns) props['columns'] = GridColsProperty( self, 'columns', None, [ ('Label', GridProperty.STRING), ('Size', GridProperty.INT) ], label=_("columns"), omitter='create_grid')