本文整理汇总了Python中tryton.gui.window.view_form.screen.Screen.modified方法的典型用法代码示例。如果您正苦于以下问题:Python Screen.modified方法的具体用法?Python Screen.modified怎么用?Python Screen.modified使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tryton.gui.window.view_form.screen.Screen
的用法示例。
在下文中一共展示了Screen.modified方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: One2Many
# 需要导入模块: from tryton.gui.window.view_form.screen import Screen [as 别名]
# 或者: from tryton.gui.window.view_form.screen.Screen import modified [as 别名]
#.........这里部分代码省略.........
self._sig_edit(widget)
return True
if (
event.keyval in (gtk.keysyms.Delete, gtk.keysyms.KP_Delete)
and widget == self.screen.widget
and self.but_del.get_property("sensitive")
):
self._sig_remove(widget)
return True
if event.keyval == gtk.keysyms.Insert and widget == self.screen.widget:
self._sig_undelete(widget)
return True
if self.attrs.get("add_remove"):
editable = self.wid_text.get_editable()
activate_keys = [gtk.keysyms.Tab, gtk.keysyms.ISO_Left_Tab]
if not self.wid_completion:
activate_keys.append(gtk.keysyms.Return)
if widget == self.wid_text and event.keyval in activate_keys and editable and self.wid_text.get_text():
self._sig_add()
self.wid_text.grab_focus()
return False
def destroy(self):
self.screen.destroy()
def _on_activate(self):
self._sig_edit()
def switch_view(self, widget):
self.screen.switch_view()
self.color_set(self.color_name)
@property
def modified(self):
return self.screen.current_view.modified
def color_set(self, name):
super(One2Many, self).color_set(name)
widget = self._color_widget()
# if the style to apply is different from readonly then insensitive
# cellrenderers should use the default insensitive color
if name != "readonly":
widget.modify_text(gtk.STATE_INSENSITIVE, self.colors["text_color_insensitive"])
def _readonly_set(self, value):
self._readonly = value
self._set_button_sensitive()
def _set_button_sensitive(self):
access = common.MODELACCESS[self.screen.model_name]
if self.record and self.field:
field_size = self.record.expr_eval(self.attrs.get("size"))
o2m_size = len(self.field.get_eval(self.record))
size_limit = field_size is not None and o2m_size >= field_size >= 0
else:
o2m_size = None
size_limit = False
has_form = "form" in (x.view_type for x in self.screen.views) or "form" in self.screen.view_to_load
self.but_new.set_sensitive(
bool(
not self._readonly
and self.attrs.get("create", True)
and not size_limit
and access["create"]
示例2: Form
# 需要导入模块: from tryton.gui.window.view_form.screen import Screen [as 别名]
# 或者: from tryton.gui.window.view_form.screen.Screen import modified [as 别名]
#.........这里部分代码省略.........
self.screen = Screen(self.model, mode=mode, context=context,
view_ids=view_ids, domain=domain, limit=limit, order=order,
search_value=search_value, tab_domain=tab_domain,
context_model=context_model)
self.screen.widget.show()
if not name:
self.name = self.screen.current_view.title
else:
self.name = name
if self.model not in common.MODELHISTORY:
self.menu_def = self.menu_def[:]
# Remove callback to revision
self.menu_def[11] = (self.menu_def[11][:2] + (None,)
+ self.menu_def[11][3:])
self.create_tabcontent()
self.url_entry = url_entry = gtk.Entry()
url_entry.show()
url_entry.set_editable(False)
style = url_entry.get_style()
url_entry.modify_bg(gtk.STATE_ACTIVE,
style.bg[gtk.STATE_INSENSITIVE])
self.widget.pack_start(url_entry, False, False)
self.set_buttons_sensitive()
self.screen.signal_connect(self, 'record-message',
self._record_message)
self.screen.signal_connect(self, 'record-modified',
lambda *a: gobject.idle_add(self._record_modified, *a))
self.screen.signal_connect(self, 'record-saved', self._record_saved)
self.screen.signal_connect(self, 'attachment-count',
self._attachment_count)
self.screen.signal_connect(self, 'unread-note', self._unread_note)
if res_id not in (None, False):
if isinstance(res_id, (int, long)):
res_id = [res_id]
self.screen.load(res_id)
else:
if self.screen.current_view.view_type == 'form':
self.sig_new(None, autosave=False)
if self.screen.current_view.view_type \
in ('tree', 'graph', 'calendar'):
self.screen.search_filter()
self.update_revision()
def get_toolbars(self):
try:
return RPCExecute('model', self.model, 'view_toolbar_get',
context=self.screen.context)
except RPCException:
return {}
def widget_get(self):
return self.screen.widget
def __eq__(self, value):
if not value:
return False
示例3: One2Many
# 需要导入模块: from tryton.gui.window.view_form.screen import Screen [as 别名]
# 或者: from tryton.gui.window.view_form.screen.Screen import modified [as 别名]
#.........这里部分代码省略.........
self._sig_edit(widget)
return True
if (event.keyval in (gtk.keysyms.Delete, gtk.keysyms.KP_Delete)
and widget == self.screen.widget
and self.but_del.get_property('sensitive')):
self._sig_remove(widget)
return True
if event.keyval == gtk.keysyms.Insert and widget == self.screen.widget:
self._sig_undelete(widget)
return True
if self.attrs.get('add_remove'):
editable = self.wid_text.get_editable()
activate_keys = [gtk.keysyms.Tab, gtk.keysyms.ISO_Left_Tab]
if not self.wid_completion:
activate_keys.append(gtk.keysyms.Return)
if (widget == self.wid_text
and event.keyval in activate_keys
and editable
and self.wid_text.get_text()):
self._sig_add()
self.wid_text.grab_focus()
return False
def destroy(self):
self.screen.destroy()
def _on_activate(self):
self._sig_edit()
def switch_view(self, widget):
self.screen.switch_view()
@property
def modified(self):
return self.screen.current_view.modified
def _readonly_set(self, value):
self._readonly = value
self._set_button_sensitive()
def _set_button_sensitive(self):
access = common.MODELACCESS[self.screen.model_name]
if self.record and self.field:
field_size = self.record.expr_eval(self.attrs.get('size'))
o2m_size = len(self.field.get_eval(self.record))
size_limit = (field_size is not None
and o2m_size >= field_size >= 0)
else:
o2m_size = None
size_limit = False
self.but_new.set_sensitive(bool(
not self._readonly
and self.attrs.get('create', True)
and not size_limit
and access['create']))
self.but_del.set_sensitive(bool(
not self._readonly
and self.attrs.get('delete', True)
and self._position
and access['delete']))
self.but_undel.set_sensitive(bool(
not self._readonly
and not size_limit
and self._position))
self.but_open.set_sensitive(bool(
示例4: One2Many
# 需要导入模块: from tryton.gui.window.view_form.screen import Screen [as 别名]
# 或者: from tryton.gui.window.view_form.screen.Screen import modified [as 别名]
#.........这里部分代码省略.........
return super(One2Many, self)._color_widget()
def grab_focus(self):
return self.screen.widget.grab_focus()
def on_keypress(self, widget, event):
if (event.keyval == gtk.keysyms.F3) \
and self.but_new.get_property('sensitive'):
self._sig_new(widget)
return False
if event.keyval == gtk.keysyms.F2 \
and widget == self.screen.widget:
self._sig_edit(widget)
return False
if event.keyval in (gtk.keysyms.Delete, gtk.keysyms.KP_Delete) \
and widget == self.screen.widget:
self._sig_remove(widget)
return False
if event.keyval == gtk.keysyms.Insert and widget == self.screen.widget:
self._sig_undelete(widget)
return False
def destroy(self):
self.screen.destroy()
def _on_activate(self):
self._sig_edit()
def switch_view(self, widget):
self.screen.switch_view()
self.color_set(self.color_name)
@property
def modified(self):
return self.screen.current_view.modified
def color_set(self, name):
super(One2Many, self).color_set(name)
widget = self._color_widget()
# if the style to apply is different from readonly then insensitive
# cellrenderers should use the default insensitive color
if name != 'readonly':
widget.modify_text(gtk.STATE_INSENSITIVE,
self.colors['text_color_insensitive'])
def _readonly_set(self, value):
self._readonly = value
self.but_new.set_sensitive(not value)
self.but_del.set_sensitive(not value)
self.but_undel.set_sensitive(not value)
if self.attrs.get('add_remove'):
self.wid_text.set_sensitive(not value)
self.but_add.set_sensitive(not value)
self.but_remove.set_sensitive(not value)
def _sig_new(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
ctx = {}
ctx.update(self.field.context_get(self.record))
sequence = None
示例5: Form
# 需要导入模块: from tryton.gui.window.view_form.screen import Screen [as 别名]
# 或者: from tryton.gui.window.view_form.screen.Screen import modified [as 别名]
#.........这里部分代码省略.........
context = {}
self.model = model
self.res_id = res_id
self.domain = domain
self.mode = mode
self.context = context
self.auto_refresh = auto_refresh
self.view_ids = view_ids
self.dialogs = []
self.screen = Screen(self.model, mode=mode, context=self.context,
view_ids=view_ids, domain=domain, limit=limit,
readonly=bool(auto_refresh), search_value=search_value,
tab_domain=tab_domain)
self.screen.widget.show()
if not name:
self.name = self.screen.current_view.title
else:
self.name = name
self.create_tabcontent()
access = common.MODELACCESS[self.model]
for button, access_type in (
('new', 'create'),
('save', 'write'),
):
self.buttons[button].props.sensitive = access[access_type]
self.screen.signal_connect(self, 'record-message',
self._record_message)
self.screen.signal_connect(self, 'record-modified',
lambda *a: gobject.idle_add(self._record_modified, *a))
self.screen.signal_connect(self, 'record-saved', self._record_saved)
self.screen.signal_connect(self, 'attachment-count',
self._attachment_count)
if res_id not in (None, False):
if isinstance(res_id, (int, long)):
res_id = [res_id]
self.screen.load(res_id)
else:
if self.screen.current_view.view_type == 'form':
self.sig_new(None, autosave=False)
if self.screen.current_view.view_type \
in ('tree', 'graph', 'calendar'):
self.screen.search_filter()
if auto_refresh and int(auto_refresh):
gobject.timeout_add(int(auto_refresh) * 1000, self.sig_reload)
def get_toolbars(self):
try:
return RPCExecute('model', self.model, 'view_toolbar_get',
context=self.context)
except RPCException:
return {}
def widget_get(self):
return self.screen.widget
def __eq__(self, value):
if not value:
return False