本文整理汇总了Python中tryton.gui.window.view_form.screen.Screen.display_prev方法的典型用法代码示例。如果您正苦于以下问题:Python Screen.display_prev方法的具体用法?Python Screen.display_prev怎么用?Python Screen.display_prev使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tryton.gui.window.view_form.screen.Screen
的用法示例。
在下文中一共展示了Screen.display_prev方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: One2Many
# 需要导入模块: from tryton.gui.window.view_form.screen import Screen [as 别名]
# 或者: from tryton.gui.window.view_form.screen.Screen import display_prev [as 别名]
#.........这里部分代码省略.........
fields = product.keys()
for values in itertools.product(*product.values()):
if first:
record = first
first = None
else:
record = self.screen.new(default=False)
default_value = default.copy()
for field, value in zip(fields, values):
id_, rec_name = value
default_value[field] = id_
default_value[field + ".rec_name"] = rec_name
record.set_default(default_value)
search_set()
def _sig_edit(self, widget=None):
if not self.but_open.props.sensitive:
return
if not self._validate():
return
record = self.screen.current_record
if record:
WinForm(self.screen, lambda a: None)
def _sig_next(self, widget):
if not self._validate():
return
self.screen.display_next()
def _sig_previous(self, widget):
if not self._validate():
return
self.screen.display_prev()
def _sig_remove(self, widget, remove=False):
access = common.MODELACCESS[self.screen.model_name]
if remove:
if not access["write"] or not access["read"]:
return
else:
if not access["delete"]:
return
self.screen.remove(remove=remove)
def _sig_undelete(self, button):
self.screen.unremove()
def _sig_add(self, *args):
if not self.focus_out:
return
access = common.MODELACCESS[self.screen.model_name]
if not access["write"] or not access["read"]:
return
domain = self.field.domain_get(self.record)
context = self.field.context_get(self.record)
domain = [domain, self.record.expr_eval(self.attrs.get("add_remove"))]
removed_ids = self.field.get_removed_ids(self.record)
domain = ["OR", domain, ("id", "in", removed_ids)]
text = self.wid_text.get_text().decode("utf-8")
self.focus_out = False
sequence = None
if self.screen.current_view.view_type == "tree":
sequence = self.screen.current_view.attributes.get("sequence")
示例2: Form
# 需要导入模块: from tryton.gui.window.view_form.screen import Screen [as 别名]
# 或者: from tryton.gui.window.view_form.screen.Screen import display_prev [as 别名]
#.........这里部分代码省略.........
if autosave:
if not self.modified_save():
return
self.screen.new()
self.message_info()
self.activate_save()
def sig_copy(self, widget=None):
if not common.MODELACCESS[self.model]['create']:
return
if not self.modified_save():
return
if self.screen.copy():
self.message_info(_('Working now on the duplicated record(s).'),
gtk.MESSAGE_INFO)
def sig_save(self, widget=None):
if widget:
# Called from button so we must save the tree state
self.screen.save_tree_state()
if not (common.MODELACCESS[self.model]['write']
or common.MODELACCESS[self.model]['create']):
return
if self.screen.save_current():
self.message_info(_('Record saved.'), gtk.MESSAGE_INFO)
return True
else:
self.message_info(self.screen.invalid_message(), gtk.MESSAGE_ERROR)
return False
def sig_previous(self, widget=None):
if not self.modified_save():
return
self.screen.display_prev()
self.message_info()
self.activate_save()
def sig_next(self, widget=None):
if not self.modified_save():
return
self.screen.display_next()
self.message_info()
self.activate_save()
def sig_reload(self, test_modified=True):
if test_modified:
if not self.modified_save():
return False
else:
self.screen.save_tree_state(store=False)
self.screen.cancel_current()
set_cursor = False
record_id = (self.screen.current_record.id
if self.screen.current_record else None)
if self.screen.current_view.view_type != 'form':
self.screen.search_filter(self.screen.screen_container.get_text())
for record in self.screen.group:
if record.id == record_id:
self.screen.current_record = record
set_cursor = True
break
self.screen.display(set_cursor=set_cursor)
self.message_info()
self.activate_save()
return True
示例3: One2Many
# 需要导入模块: from tryton.gui.window.view_form.screen import Screen [as 别名]
# 或者: from tryton.gui.window.view_form.screen.Screen import display_prev [as 别名]
#.........这里部分代码省略.........
fields = product.keys()
for values in itertools.product(*product.values()):
if first:
record = first
first = None
else:
record = self.screen.new(default=False)
default_value = default.copy()
for field, value in zip(fields, values):
id_, rec_name = value
default_value[field] = id_
default_value[field + '.rec_name'] = rec_name
record.set_default(default_value)
search_set()
def _sig_edit(self, widget=None):
if not common.MODELACCESS[self.screen.model_name]['read']:
return
if not self._validate():
return
record = self.screen.current_record
if record:
WinForm(self.screen, lambda a: None)
def _sig_next(self, widget):
if not self._validate():
return
self.screen.display_next()
def _sig_previous(self, widget):
if not self._validate():
return
self.screen.display_prev()
def _sig_remove(self, widget, remove=False):
access = common.MODELACCESS[self.screen.model_name]
if remove:
if not access['write'] or not access['read']:
return
else:
if not access['delete']:
return
self.screen.remove(remove=remove)
def _sig_undelete(self, button):
self.screen.unremove()
def _sig_add(self, *args):
if not self.focus_out:
return
access = common.MODELACCESS[self.screen.model_name]
if not access['write'] or not access['read']:
return
self.view.set_value()
domain = self.field.domain_get(self.record)
context = self.field.context_get(self.record)
domain = [domain, self.record.expr_eval(self.attrs.get('add_remove'))]
removed_ids = self.field.get_removed_ids(self.record)
domain = ['OR', domain, ('id', 'in', removed_ids)]
text = self.wid_text.get_text().decode('utf-8')
self.focus_out = False
sequence = None
if self.screen.current_view.view_type == 'tree':
示例4: One2Many
# 需要导入模块: from tryton.gui.window.view_form.screen import Screen [as 别名]
# 或者: from tryton.gui.window.view_form.screen.Screen import display_prev [as 别名]
#.........这里部分代码省略.........
update_sequence()
else:
WinForm(self.screen, lambda a: update_sequence(), new=True,
many=True, context=ctx)
def _sig_edit(self, widget=None):
self.view.set_value()
record = self.screen.current_record
if record:
fields = self.screen.current_view.get_fields()
if not record.validate(fields):
self.screen.display()
return
WinForm(self.screen, lambda a: None)
def _sig_next(self, widget):
self.view.set_value()
record = self.screen.current_record
if record:
fields = self.screen.current_view.get_fields()
if not record.validate(fields):
self.screen.display()
return
self.screen.display_next()
def _sig_previous(self, widget):
self.view.set_value()
record = self.screen.current_record
if record:
fields = self.screen.current_view.get_fields()
if not record.validate(fields):
self.screen.display()
return
self.screen.display_prev()
def _sig_remove(self, widget, remove=False):
self.screen.remove(remove=remove)
def _sig_undelete(self, button):
self.screen.unremove()
def _sig_activate(self, *args):
self._sig_add()
self.wid_text.grab_focus()
def _focus_out(self, *args):
if self.wid_text.get_text():
self._sig_add()
def _sig_add(self, *args):
self.view.set_value()
domain = self.field.domain_get(self.record)
context = self.field.context_get(self.record)
domain = domain[:]
domain.extend(self.record.expr_eval(self.attrs.get('add_remove')))
removed_ids = self.field.get_removed_ids(self.record)
try:
if self.wid_text.get_text():
dom = [('rec_name', 'ilike',
'%' + self.wid_text.get_text() + '%'),
['OR', domain, ('id', 'in', removed_ids)]]
else:
dom = ['OR', domain, ('id', 'in', removed_ids)]
ids = RPCExecute('model', self.attrs['relation'], 'search', dom,
0, CONFIG['client.limit'], None, context=context)
示例5: Form
# 需要导入模块: from tryton.gui.window.view_form.screen import Screen [as 别名]
# 或者: from tryton.gui.window.view_form.screen.Screen import display_prev [as 别名]
#.........这里部分代码省略.........
return
self.screen.new()
self.message_info('')
self.activate_save()
def sig_copy(self, widget=None):
if not common.MODELACCESS[self.model]['create']:
return
if not self.modified_save():
return
res_ids = self.sel_ids_get()
try:
new_ids = RPCExecute('model', self.model, 'copy', res_ids, {},
context=self.context)
except RPCException:
return
self.screen.load(new_ids)
self.message_info(_('Working now on the duplicated record(s)!'),
'green')
def sig_save(self, widget=None):
if not common.MODELACCESS[self.model]['write']:
return
if self.screen.save_current():
self.message_info(_('Record saved!'), 'green')
return True
else:
self.message_info(_('Invalid form!'))
return False
def sig_previous(self, widget=None):
if not self.modified_save():
return
self.screen.display_prev()
self.message_info('')
self.activate_save()
def sig_next(self, widget=None):
if not self.modified_save():
return
self.screen.display_next()
self.message_info('')
self.activate_save()
def sig_reload(self, test_modified=True):
if not hasattr(self, 'screen'):
return False
if test_modified and self.screen.modified():
res = sur_3b(_('This record has been modified\n'
'do you want to save it ?'))
if res == 'ok':
self.sig_save(None)
elif res == 'ko':
pass
else:
return False
self.screen.cancel_current()
set_cursor = False
if self.screen.current_view.view_type != 'form':
obj_id = self.id_get()
self.screen.search_filter(self.screen.screen_container.get_text())
for record in self.screen.group:
if record.id == obj_id:
self.screen.current_record = record
set_cursor = True
break