本文整理汇总了Python中lucterios.framework.xfercomponents.XferCompLabelForm.set_value_as_headername方法的典型用法代码示例。如果您正苦于以下问题:Python XferCompLabelForm.set_value_as_headername方法的具体用法?Python XferCompLabelForm.set_value_as_headername怎么用?Python XferCompLabelForm.set_value_as_headername使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lucterios.framework.xfercomponents.XferCompLabelForm
的用法示例。
在下文中一共展示了XferCompLabelForm.set_value_as_headername方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fillresponse_body
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value_as_headername [as 别名]
def fillresponse_body(self):
self.get_components("title").colspan = 2
row_id = self.get_max_row() + 1
lbl = XferCompLabelForm('title_exp')
lbl.set_value_as_headername(_("Expense"))
lbl.set_location(0, row_id, 2)
self.add_component(lbl)
lbl = XferCompLabelForm('title_rev')
lbl.set_value_as_headername(_("Revenue"))
lbl.set_location(2, row_id, 2)
self.add_component(lbl)
row_id = self.get_max_row()
self.fill_grid(row_id, self.model, 'budget_revenue', self.model.objects.filter(self.filter & Q(code__regex=current_system_account().get_revenue_mask())))
self.move_components('budget_revenue', 2, 0)
self.fill_grid(row_id, self.model, 'budget_expense', self.model.objects.filter(self.filter & Q(code__regex=current_system_account().get_expence_mask())))
self.remove_component('nb_budget_expense')
self.remove_component('nb_budget_revenue')
resultat_budget = Budget.get_total(self.getparam('year'), self.getparam('cost_accounting'))
if abs(resultat_budget) > 0.0001:
row_id = self.get_max_row() + 1
lbl = XferCompLabelForm('title_result')
if resultat_budget > 0:
lbl.set_value_as_name(_('result (profit)'))
else:
lbl.set_value_as_name(_('result (deficit)'))
lbl.set_location(0, row_id)
self.add_component(lbl)
lbl = XferCompLabelForm('result')
lbl.set_value(format_devise(resultat_budget, 5))
lbl.set_location(1, row_id)
self.add_component(lbl)
示例2: edit_account_for_line
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value_as_headername [as 别名]
def edit_account_for_line(self, xfer, column, row, debit_rest, credit_rest):
num_cpt_txt = xfer.getparam('num_cpt_txt', '')
num_cpt = xfer.getparam('num_cpt', 0)
lbl = XferCompLabelForm('numCptlbl')
lbl.set_location(column, row, 3)
lbl.set_value_as_headername(_('account'))
xfer.add_component(lbl)
edt = XferCompEdit('num_cpt_txt')
edt.set_location(column, row + 1, 2)
edt.set_value(num_cpt_txt)
edt.set_size(20, 25)
edt.set_action(xfer.request, xfer.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH)
xfer.add_component(edt)
sel_val = []
current_account = None
if num_cpt_txt != '':
year = FiscalYear.get_current(xfer.getparam('year'))
sel_val, current_account = year.get_account_list(num_cpt_txt, num_cpt)
sel = XferCompSelect('num_cpt')
sel.set_location(column + 2, row + 1, 1)
sel.set_select(sel_val)
sel.set_size(20, 150)
sel.set_action(xfer.request, xfer.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH)
if current_account is not None:
sel.set_value(current_account.id)
self.item.account = current_account
self.item.set_montant(
float(xfer.getparam('debit_val', 0.0)), float(xfer.getparam('credit_val', 0.0)))
if abs(self.item.amount) < 0.0001:
self.item.set_montant(debit_rest, credit_rest)
xfer.add_component(sel)
return lbl, edt
示例3: _create_custom_for_profit
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value_as_headername [as 别名]
def _create_custom_for_profit(self, year, custom, val_profit):
from lucterios.framework.xfercomponents import XferCompImage, XferCompLabelForm, XferCompSelect
from diacamma.accounting.models import format_devise
if val_profit > 0.0001:
type_profit = 'bénéfice'
else:
type_profit = 'déficite'
img = XferCompImage("img")
img.set_location(0, 0)
img.set_value(get_icon_path("diacamma.accounting/images/account.png"))
custom.add_component(img)
lbl = XferCompLabelForm("title")
lbl.set_value_as_headername("Bénéfices et Pertes")
lbl.set_location(1, 0)
custom.add_component(lbl)
text = "{[i]}Vous avez un %s de %s.{[br/]}Vous devez definir sur quel compte l'affecter.{[br/]}{[/i]}" % (
type_profit, format_devise(val_profit, 4))
text += "{[br/]}En validant, vous commencerez '%s'{[br/]}{[br/]}{[i]}{[u]}Attention:{[/u]} Votre report à nouveau doit être totalement fait.{[/i]}" % six.text_type(
year)
lbl = XferCompLabelForm("info")
lbl.set_value(text)
lbl.set_location(0, 1, 2)
custom.add_component(lbl)
sel_cmpt = []
for account in year.chartsaccount_set.all().filter(code__startswith='10').order_by('code'):
sel_cmpt.append((account.id, six.text_type(account)))
sel = XferCompSelect("profit_account")
sel.set_select(sel_cmpt)
sel.set_location(1, 2)
custom.add_component(sel)
return custom
示例4: fill_header
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value_as_headername [as 别名]
def fill_header(self):
img = XferCompImage('img')
img.set_value(self.icon_path())
img.set_location(0, 0, 1, 2)
self.add_component(img)
select_year = self.getparam('fiscal_year')
lbl = XferCompLabelForm('lbl_title')
lbl.set_value_as_headername(_('Statistics in date of %s') % formats.date_format(date.today(), "DATE_FORMAT"))
lbl.set_location(1, 0, 2)
self.add_component(lbl)
self.item.fiscal_year = FiscalYear.get_current(select_year)
self.fill_from_model(1, 1, False, ['fiscal_year'])
fiscal_year = self.get_components('fiscal_year')
fiscal_year.set_needed(True)
fiscal_year.set_action(self.request, self.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH)
示例5: summary_member
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value_as_headername [as 别名]
def summary_member(xfer):
is_right = WrapAction.is_permission(xfer.request, 'member.change_adherent')
try:
current_adherent = Adherent.objects.get(user=xfer.request.user)
except:
current_adherent = None
if is_right or (current_adherent is not None):
row = xfer.get_max_row() + 1
lab = XferCompLabelForm('membertitle')
lab.set_value_as_infocenter(_("Adherents"))
lab.set_location(0, row, 4)
xfer.add_component(lab)
if current_adherent is not None:
ident = []
if Params.getvalue("member-numero"):
ident.append("%s %s" % (_('numeros'), current_adherent.num))
if Params.getvalue("member-licence-enabled"):
current_license = current_adherent.license
if current_license is not None:
ident.append(current_license)
row = xfer.get_max_row() + 1
lab = XferCompLabelForm('membercurrent')
lab.set_value_as_header("{[br/]}".join(ident))
lab.set_location(0, row, 4)
xfer.add_component(lab)
if is_right:
row = xfer.get_max_row() + 1
try:
current_season = Season.current_season()
dateref = current_season.date_ref
lab = XferCompLabelForm('memberseason')
lab.set_value_as_headername(six.text_type(current_season))
lab.set_location(0, row + 1, 4)
xfer.add_component(lab)
nb_adh = len(Adherent.objects.filter(Q(subscription__begin_date__lte=dateref) & Q(
subscription__end_date__gte=dateref) & Q(subscription__status=2)))
lab = XferCompLabelForm('membernb')
lab.set_value_as_header(_("Active adherents: %d") % nb_adh)
lab.set_location(0, row + 2, 4)
xfer.add_component(lab)
nb_adhcreat = len(Adherent.objects.filter(
Q(subscription__begin_date__lte=dateref) & Q(subscription__end_date__gte=dateref) & Q(subscription__status=1)))
if nb_adhcreat > 0:
lab = XferCompLabelForm('memberadhcreat')
lab.set_value_as_header(_("No validated adherents: %d") % nb_adhcreat)
lab.set_location(0, row + 3, 4)
xfer.add_component(lab)
nb_adhwait = len(Adherent.objects.filter(
Q(subscription__begin_date__lte=dateref) & Q(subscription__end_date__gte=dateref) & Q(subscription__status=0)))
if nb_adhwait > 0:
lab = XferCompLabelForm('memberadhwait')
lab.set_value_as_header(_("Adherents waiting moderation: %d") % nb_adhwait)
lab.set_location(0, row + 4, 4)
xfer.add_component(lab)
except LucteriosException as lerr:
lbl = XferCompLabelForm("member_error")
lbl.set_value_center(six.text_type(lerr))
lbl.set_location(0, row + 1, 4)
xfer.add_component(lbl)
if is_right or (current_adherent is not None):
lab = XferCompLabelForm('member')
lab.set_value_as_infocenter("{[hr/]}")
lab.set_location(0, row + 5, 4)
xfer.add_component(lab)
return True
else:
return False
示例6: fillresponse
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_value_as_headername [as 别名]
def fillresponse(self, season):
if season is None:
working_season = Season.current_season()
else:
working_season = Season.objects.get(id=season)
img = XferCompImage('img')
img.set_value(self.icon_path())
img.set_location(0, 0)
self.add_component(img)
lab = XferCompLabelForm('lbl_season')
lab.set_value_as_name(_('season'))
lab.set_location(1, 0)
self.add_component(lab)
sel = XferCompSelect('season')
sel.set_needed(True)
sel.set_select_query(Season.objects.all())
sel.set_value(working_season.id)
sel.set_location(2, 0)
sel.set_action(self.request, self.get_action('', ''), modal=FORMTYPE_REFRESH, close=CLOSE_NO)
self.add_component(sel)
stat_result = Degree.get_statistic(working_season)
if len(stat_result) == 0:
lab = XferCompLabelForm('lbl_season')
lab.set_color('red')
lab.set_value_as_infocenter(_('no degree!'))
lab.set_location(1, 1, 2)
self.add_component(lab)
else:
total = 0
pos_y = 2
for activity, sublist in stat_result:
subtotal = 0
if activity is not None:
lab = XferCompLabelForm("lblactivite_%d" % activity.id)
lab.set_italic()
lab.set_value(six.text_type(activity))
lab.set_location(0, pos_y, 3)
self.add_component(lab)
pos_y += 1
for degree_name, val in sublist:
lab = XferCompLabelForm("title_%d" % pos_y)
lab.set_value(degree_name)
lab.set_location(1, pos_y)
self.add_component(lab)
lab = XferCompLabelForm("val_%d" % pos_y)
lab.set_value(six.text_type(val))
lab.set_location(2, pos_y)
self.add_component(lab)
subtotal += val
total += val
pos_y += 1
if activity is not None:
lab = XferCompLabelForm("lblsubtotal_%d" % activity.id)
lab.set_value_as_header(_("Total"))
lab.set_location(1, pos_y)
self.add_component(lab)
lab = XferCompLabelForm("subtotal_%d" % activity.id)
lab.set_italic()
lab.set_value(six.text_type(subtotal))
lab.set_location(2, pos_y)
self.add_component(lab)
pos_y += 1
lab = XferCompLabelForm("lbltotal")
lab.set_value_as_headername(_("Total"))
lab.set_location(1, pos_y)
self.add_component(lab)
lab = XferCompLabelForm("total")
lab.set_value_as_name(six.text_type(total))
lab.set_location(2, pos_y)
self.add_component(lab)
self.add_action(DegreeStatisticPrint.get_action(TITLE_PRINT, "images/print.png"),
close=CLOSE_NO, params={'classname': self.__class__.__name__})
self.add_action(WrapAction(TITLE_CLOSE, 'images/close.png'))