本文整理汇总了Python中lucterios.framework.xfercomponents.XferCompLabelForm.set_select方法的典型用法代码示例。如果您正苦于以下问题:Python XferCompLabelForm.set_select方法的具体用法?Python XferCompLabelForm.set_select怎么用?Python XferCompLabelForm.set_select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lucterios.framework.xfercomponents.XferCompLabelForm
的用法示例。
在下文中一共展示了XferCompLabelForm.set_select方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fillresponse
# 需要导入模块: from lucterios.framework.xfercomponents import XferCompLabelForm [as 别名]
# 或者: from lucterios.framework.xfercomponents.XferCompLabelForm import set_select [as 别名]
def fillresponse(self):
if self.getparam("CONFIRME") is None:
dlg = self.create_custom()
img = XferCompImage('img')
img.set_value(self.icon_path())
img.set_location(0, 0)
dlg.add_component(img)
lbl = XferCompLabelForm('title')
lbl.set_value_as_title(self.caption)
lbl.set_location(1, 0, 2)
dlg.add_component(lbl)
lbl = XferCompLabelForm('lbl_record')
lbl.set_value_as_name(_('record'))
lbl.set_location(1, 1)
dlg.add_component(lbl)
lbl = XferCompLabelForm('record')
lbl.set_value(six.text_type(self.item))
lbl.set_location(2, 1)
dlg.add_component(lbl)
lbl = XferCompLabelForm('lbl_current')
lbl.set_value_as_name(_('current model'))
lbl.set_location(1, 2)
dlg.add_component(lbl)
lbl = XferCompLabelForm('current')
lbl.set_value(self.item.__class__._meta.verbose_name)
lbl.set_location(2, 2)
dlg.add_component(lbl)
lbl = XferCompLabelForm('lbl_newmodel')
lbl.set_value_as_name(_('new model'))
lbl.set_location(1, 3)
dlg.add_component(lbl)
lbl = XferCompSelect('newmodel')
lbl.set_select(self.item.__class__.get_select_contact_type(False))
lbl.set_location(2, 3)
dlg.add_component(lbl)
dlg.add_action(self.get_action(_('Ok'), "images/ok.png"),
{'close': CLOSE_YES, 'modal': FORMTYPE_MODAL, 'params': {'CONFIRME': 'YES'}})
dlg.add_action(WrapAction(_("Cancel"), "images/cancel.png"), {})
else:
new_model = apps.get_model(self.getparam('newmodel'))
field_id_name = "%s_ptr_id" % self.model.__name__.lower()
new_object = new_model(**{field_id_name: self.item.pk})
new_object.save()
new_object.__dict__.update(self.item.__dict__)
new_object.save()
self.redirect_action(
ActionsManage.get_act_changed(self.model.__name__, 'show', '', ''), {})