Example #1
0
 def on_change_val(self, event):
     val = self.get_value()
     for i in range(len(val)):
         handler = val[i][1].strip()
         if handler and self.validator_re.match(handler) is None:
             self.set_value(self.val)
             return event.Skip()
     GridProperty.on_change_val(self, event)
Example #2
0
    def display(self, panel):
        GridProperty.display(self, panel)
        self.btn.Hide()
        wx.grid.EVT_GRID_CELL_CHANGE(self.grid, self.on_change_val)
        tooltip = """\
You can use this property to add some extra custom properties to this widget.

For each property "prop" with value "val", wxGlade will generate a \
"widget.SetProp(val)" line (or a "<prop>val</prop>" line for XRC)."""
        self.grid.SetToolTip(wx.ToolTip(tooltip))
Example #3
0
 def __init__(self, owner):
     cols = [(_('Event'), GridProperty.STRING),
             (_('Handler'), GridProperty.STRING)]
     GridProperty.__init__(self, owner, 'events', None, cols,
                           len(owner.events), False, False, False, label=_('events'))
     self._pos = {}
     for index, name in enumerate(owner.events):
         self._pos[name] = index
     self.validator_re = re.compile(r'^\s*[\w-]+\s*$')
     self.set_value([[name, ''] for name in owner.events])
Example #4
0
 def display(self, parent):
     GridProperty.display(self, parent)
     attr = wx.grid.GridCellAttr()
     attr.SetReadOnly(True)
     self.grid.SetColAttr(0, attr)
     self.grid.AutoSizeColumn(0, False)
     self.grid.AutoSizeColumn(1, False)
     wx.grid.EVT_GRID_CELL_CHANGE(self.grid, self.on_change_val)
     szr = self.panel.GetSizer()
     szr.Show(self.btn_sizer, False)
     szr.Layout()
Example #5
0
    def __init__(self, owner):
        setattr(owner, 'extraproperties', [])
        def get(): return getattr(owner, 'extraproperties')
        def set(val): return setattr(owner, 'extraproperties', val)
        owner.access_functions['extraproperties'] = (get, set)

        cols = [(_('Property'), GridProperty.STRING),
                (_('Value'), GridProperty.STRING)]
        self.label = _('Extra properties for this widget')
        GridProperty.__init__(self, owner, 'extraproperties', None, cols,
                              can_insert=False)
Example #6
0
    def display(self, panel):
        GridProperty.display(self, panel)
        self.btn.Hide()
        wx.grid.EVT_GRID_CELL_CHANGE(self.grid, self.on_change_val)
        tooltip = """\
You can use this property to add some extra custom properties to this widget.

For each property "prop" with value "val", wxGlade will generate a \
"widget.SetProp(val)" line (or a "<prop>val</prop>" line for XRC).

NOTE: at the moment, this property is supported only by the following code \
generators:
    Python C++ XRC Perl"""
        self.grid.SetToolTip(wx.ToolTip(tooltip))
Example #7
0
    def __init__(self, owner):
        setattr(owner, "extraproperties", [])

        def get():
            return getattr(owner, "extraproperties")

        def set(val):
            return setattr(owner, "extraproperties", val)

        owner.access_functions["extraproperties"] = (get, set)

        cols = [(_("Property"), GridProperty.STRING), (_("Value"), GridProperty.STRING)]
        self.label = _("Extra properties for this widget")
        GridProperty.__init__(self, owner, "extraproperties", None, cols, can_insert=False)
Example #8
0
    def display(self, panel):
        GridProperty.display(self, panel)
        self.btn.Hide()
        wx.grid.EVT_GRID_CELL_CHANGE(self.grid, self.on_change_val)
        tooltip = """\
You can use this property to add some extra custom properties to this widget.

For each property "prop" with value "val", wxGlade will generate a \
"widget.SetProp(val)" line (or a "<prop>val</prop>" line for XRC).

NOTE: at the moment, this property is supported only by the following code \
generators:
    Python C++ XRC Perl"""
        self.grid.SetToolTip(wx.ToolTip(tooltip))
Example #9
0
    def __init__(self, owner):
        setattr(owner, 'extraproperties', [])

        def get():
            return getattr(owner, 'extraproperties')

        def set(val):
            return setattr(owner, 'extraproperties', val)

        owner.access_functions['extraproperties'] = (get, set)

        cols = [(_('Property'), GridProperty.STRING),
                (_('Value'), GridProperty.STRING)]
        self.label = _('Extra properties for this widget')
        GridProperty.__init__(self,
                              owner,
                              'extraproperties',
                              None,
                              cols,
                              can_insert=False)
Example #10
0
 def set_value(self, val):
     if isinstance(val, dict):
         val = [[k, val[k]] for k in sorted(val.keys())]
     GridProperty.set_value(self, val)
Example #11
0
 def remove_row(self, event):
     GridProperty.remove_row(self, event)
     self.on_change_val(event)
Example #12
0
 def add_row(self, event):
     GridProperty.add_row(self, event)
     self.on_change_val(event)
Example #13
0
 def set_value(self, val):
     if isinstance(val, dict):
         val = [[k, val[k]] for k in sorted(val.keys())]
     GridProperty.set_value(self, val)
Example #14
0
 def remove_row(self, event):
     GridProperty.remove_row(self, event)
     self.on_change_val(event)
Example #15
0
 def add_row(self, event):
     GridProperty.add_row(self, event)
     self.on_change_val(event)