def _load_controls(self, wnd): BaseDialog._load_controls(self, wnd) self._items_lctrl = self[self._items_list_control] self['tc_title'].SetValidator(Validator(self._proxy, 'title')) self['tc_note'].SetValidator(Validator(self._proxy, 'note')) self['colorselect'].SetValidator(ValidatorColorStr(self._proxy, 'bg_color', with_alpha=True))
def __init__(self, parent, dlg_name): self._displayed_item = None # aktualnie wuświetlany obiekt class _Proxy(object): """ Proxy class that allow use validators on dynamically changed objects. """ # pylint: disable=W0212, E0213, R0903 def __getattr__(selfi, key): if not self._displayed_item: return "" return getattr(self._displayed_item, key) def __setattr__(selfi, key, val): setattr(self._displayed_item, key, val) self._proxy = _Proxy() self._current_selected_uuid = None self._session = Session() self._items_lctrl = None BaseDialog.__init__(self, parent, dlg_name, save_pos=False) wx.CallAfter(self._refresh_list)
def _on_ok(self, evt): BaseDialog._on_ok(self, evt)
def _create_bindings(self, wnd): BaseDialog._create_bindings(self, wnd) wnd.Bind(wx.EVT_BUTTON, self._on_add_item, id=wx.ID_ADD) wnd.Bind(wx.EVT_BUTTON, self._on_del_item, id=wx.ID_DELETE) self._items_lctrl.Bind(wx.EVT_LISTBOX, self._on_list_item_activate) wnd.Bind(wx.EVT_BUTTON, self._on_btn_delete, self['btn_deleted'])