def refresh(lctrl): units = gmOrganization.get_org_units( order_by='organization, unit, l10n_unit_category') items = [[ u['organization'], u['unit'], gmTools.coalesce(u['l10n_unit_category'], ''), u['pk_org_unit'] ] for u in units] lctrl.set_string_items(items=items) lctrl.set_data(data=units)
def refresh(lctrl): units = gmOrganization.get_org_units(order_by = 'organization, unit, l10n_unit_category') items = [ [ u['organization'], u['unit'], gmTools.coalesce(u['l10n_unit_category'], u''), u['pk_org_unit'] ] for u in units ] lctrl.set_string_items(items = items) lctrl.set_data(data = units)
def __refresh(self): msg_template = _('Units of: %s') if self.__org is None: self._BTN_add.Enable(False) self._BTN_edit.Enable(False) self._BTN_remove.Enable(False) pk = None self.message = msg_template % _('<no organization selected>') if self.__show_none_if_no_org: self._LCTRL_items.set_string_items(items = None) return else: self._BTN_add.Enable(True) pk = self.__org['pk_org'] org_str = u'%s (%s)' % ( self.__org['organization'], self.__org['l10n_category'] ) self.message = msg_template % org_str units = gmOrganization.get_org_units(order_by = 'unit, l10n_unit_category', org = pk) items = [ [ u['unit'], gmTools.coalesce(u['l10n_unit_category'], u''), u['pk_org_unit'] ] for u in units ] self._LCTRL_items.set_string_items(items) self._LCTRL_items.set_column_widths(widths = [wx.LIST_AUTOSIZE, wx.LIST_AUTOSIZE, wx.LIST_AUTOSIZE]) self._LCTRL_items.set_data(units) for idx in range(len(units)): unit = units[idx] if unit['is_praxis_branch']: self._LCTRL_items.SetItemTextColour(idx, col=wx.NamedColour('RED'))
def __refresh(self): msg_template = _('Units of: %s') if self.__org is None: self._BTN_add.Enable(False) self._BTN_edit.Enable(False) self._BTN_remove.Enable(False) pk = None self.message = msg_template % _('<no organization selected>') if self.__show_none_if_no_org: self._LCTRL_items.set_string_items(items = None) return else: self._BTN_add.Enable(True) pk = self.__org['pk_org'] org_str = '%s (%s)' % ( self.__org['organization'], self.__org['l10n_category'] ) self.message = msg_template % org_str units = gmOrganization.get_org_units(order_by = 'unit, l10n_unit_category', org = pk) items = [ [ u['unit'], gmTools.coalesce(u['l10n_unit_category'], ''), u['pk_org_unit'] ] for u in units ] self._LCTRL_items.set_string_items(items) self._LCTRL_items.set_column_widths(widths = [wx.LIST_AUTOSIZE, wx.LIST_AUTOSIZE, wx.LIST_AUTOSIZE]) self._LCTRL_items.set_data(units) for idx in range(len(units)): unit = units[idx] if unit['is_praxis_branch']: self._LCTRL_items.SetItemTextColour(idx, col=wx.Colour('RED'))