示例#1
0
	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))
示例#2
0
	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)
示例#3
0
	def _on_ok(self, evt):
		BaseDialog._on_ok(self, evt)
示例#4
0
	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'])