本文整理汇总了Python中tryton.gui.window.view_form.screen.Screen类的典型用法代码示例。如果您正苦于以下问题:Python Screen类的具体用法?Python Screen怎么用?Python Screen使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Screen类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _sig_edit
def _sig_edit(self):
if not self.screen.current_record:
return
# Create a new screen that is not linked to the parent otherwise on the
# save of the record will trigger the save of the parent
domain = self.field.domain_get(self.record)
add_remove = self.record.expr_eval(self.attrs.get('add_remove'))
if add_remove:
domain = [domain, add_remove]
context = self.field.context_get(self.record)
screen = Screen(self.attrs['relation'], domain=domain,
view_ids=self.attrs.get('view_ids', '').split(','),
mode=['form'], views_preload=self.attrs.get('views', {}),
readonly=self.attrs.get('readonly', False),
context=context)
screen.load([self.screen.current_record.id])
def callback(result):
if result:
screen.current_record.save()
# Force a reload on next display
self.screen.current_record.cancel()
# Force a display to clear the CellCache
self.screen.display()
WinForm(screen, callback)
示例2: __init__
def __init__(self, record, callback=None):
self.resource = '%s,%s' % (record.model_name, record.id)
self.note_callback = callback
context = record.context_get()
context['resource'] = self.resource
screen = Screen('ir.note', domain=[
('resource', '=', self.resource),
], mode=['tree', 'form'], context=context,
exclude_field='resource')
super(Note, self).__init__(screen, self.callback, view_type='tree')
screen.search_filter()
示例3: __init__
def __init__(self, model_name, record_id, callback=None):
self.resource = '%s,%s' % (model_name, record_id)
self.attachment_callback = callback
screen = Screen('ir.attachment', domain=[
('resource', '=', self.resource),
], mode=['tree', 'form'], context={
'resource': self.resource,
}, exclude_field='resource')
screen.search_filter()
screen.parent = True
super(Attachment, self).__init__(screen, self.callback,
view_type='tree')
示例4: open_remote
def open_remote(self, record, create=True, changed=False, text=None,
callback=None):
field = record.group.fields[self.field_name]
relation = field.attrs['relation']
domain = field.domain_get(record)
context = field.context_get(record)
if create:
obj_id = None
elif not changed:
obj_id = field.get(record)
else:
if text:
dom = [('rec_name', 'ilike', '%' + text + '%'), domain]
else:
dom = domain
try:
ids = RPCExecute('model', relation, 'search', dom, 0, None,
None, context=context)
except RPCException:
field.set_client(record, False)
if callback:
callback()
return
if len(ids) == 1:
field.set_client(record, ids[0])
if callback:
callback()
return
self.search_remote(record, relation, ids, domain=domain,
context=context, callback=callback)
return
screen = Screen(relation, domain=domain, context=context,
mode=['form'])
def open_callback(result):
if result and screen.save_current():
value = (screen.current_record.id,
screen.current_record.rec_name())
field.set_client(record, value, force_change=True)
elif result:
screen.display()
return WinForm(screen, open_callback)
if callback:
callback()
if obj_id:
screen.load([obj_id])
WinForm(screen, open_callback)
else:
WinForm(screen, open_callback, new=True)
示例5: __init__
def __init__(self, view, attrs):
super(Many2ManySelection, self).__init__(view, attrs)
self.widget = gtk.VBox(homogeneous=False, spacing=5)
hbox = gtk.HBox(homogeneous=False, spacing=0)
hbox.set_border_width(2)
label = gtk.Label(attrs.get("string", ""))
label.set_alignment(0.0, 0.5)
hbox.pack_start(label, expand=True, fill=True)
frame = gtk.Frame()
frame.add(hbox)
frame.set_shadow_type(gtk.SHADOW_OUT)
self.widget.pack_start(frame, expand=False, fill=True)
self.screen = Screen(
attrs["relation"],
view_ids=attrs.get("view_ids", "").split(","),
mode=["tree"],
views_preload=attrs.get("views", {}),
)
self.screen.new_group()
self.treeview = self.screen.current_view.treeview
self.treeview.get_selection().connect("changed", self.changed)
self.treeview.connect("focus-out-event", lambda *a: self._focus_out())
self.treeview.connect("button-press-event", self.button_press_event)
self.treeview.connect("key-press-event", self.key_press_event)
self.widget.pack_start(self.screen.widget, expand=True, fill=True)
self.nullable_widget = False
self.init_selection()
示例6: __init__
def __init__(self, user, callback):
NoModal.__init__(self)
self.callback = callback
self.win = gtk.Dialog(_("Preferences"), self.parent, gtk.DIALOG_DESTROY_WITH_PARENT)
self.win.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
self.win.set_has_separator(False)
self.win.set_icon(TRYTON_ICON)
self.accel_group = gtk.AccelGroup()
self.win.add_accel_group(self.accel_group)
self.but_cancel = self.win.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
self.but_ok = self.win.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
self.but_ok.add_accelerator(
"clicked", self.accel_group, gtk.keysyms.Return, gtk.gdk.CONTROL_MASK, gtk.ACCEL_VISIBLE
)
self.win.set_default_response(gtk.RESPONSE_OK)
self.win.connect("response", self.response)
try:
view = RPCExecute("model", "res.user", "get_preferences_fields_view")
except RPCException:
self.win.destroy()
self.win = None
return
title = gtk.Label(_("Edit User Preferences"))
title.show()
self.win.vbox.pack_start(title, expand=False, fill=True)
self.screen = Screen("res.user", mode=[])
# Reset readonly set automaticly by MODELACCESS
self.screen.readonly = False
self.screen.group.readonly = False
self.screen.group.skip_model_access = True
self.screen.add_view(view)
self.screen.switch_view()
self.screen.new(default=False)
try:
preferences = RPCExecute("model", "res.user", "get_preferences", False)
except RPCException:
self.win.destroy()
self.win = None
return
self.screen.current_record.set(preferences)
self.screen.current_record.id = rpc._USER
self.screen.current_record.validate(softvalidation=True)
self.screen.display(set_cursor=True)
self.screen.widget.show()
self.win.vbox.pack_start(self.screen.widget)
self.win.set_title(_("Preference"))
width, height = self.parent.get_size()
self.win.set_default_size(int(width * 0.95), int(height * 0.95))
self.register()
self.win.show()
示例7: __init__
def __init__(self, model, res_id=False, domain=None, mode=None,
view_ids=None, context=None, name=False, limit=None,
auto_refresh=False, search_value=None):
super(Form, self).__init__()
if not mode:
mode = ['tree', 'form']
if domain is None:
domain = []
if view_ids is None:
view_ids = []
if context is None:
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)
self.screen.widget.show()
if not name:
self.name = self.screen.current_view.title
else:
self.name = name
self.create_tabcontent()
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)
示例8: open_remote
def open_remote(self, record, create=True, changed=False, text=None,
callback=None):
group = record.value[self.attrs['name']]
field = record.group.fields[self.attrs['name']]
relation = field.attrs['relation']
context = field.context_get(record)
access = common.MODELACCESS[relation]
if not access['read']:
return
screen = Screen(relation, mode=['tree', 'form'],
exclude_field=field.attrs.get('relation_field'))
screen.pre_validate = bool(int(self.attrs.get('pre_validate', 0)))
screen.group = group
def open_callback(result):
if callback:
callback()
WinForm(screen, open_callback, view_type='tree', context=context)
示例9: click_and_relate
def click_and_relate(self, action, value, path):
data = {}
context = {}
act = action.copy()
if not(value):
message(_('You must select a record to use the relation!'))
return False
from tryton.gui.window.view_form.screen import Screen
screen = Screen(self.screen.group.fields[
path[1].name].attrs['relation'])
screen.load([value])
encoder = PYSONEncoder()
act['domain'] = encoder.encode(screen.current_record.expr_eval(
act.get('domain', []), check_load=False))
act['context'] = encoder.encode(screen.current_record.expr_eval(
act.get('context', {}), check_load=False))
data['model'] = self.screen.model_name
data['id'] = value
data['ids'] = [value]
return Action._exec_action(act, data, context)
示例10: __init__
def __init__(self, user):
self.parent = common.get_toplevel_window()
self.win = gtk.Dialog(_("Preferences"), self.parent, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT)
self.win.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
self.win.set_has_separator(False)
self.win.set_icon(TRYTON_ICON)
self.accel_group = gtk.AccelGroup()
self.win.add_accel_group(self.accel_group)
self.but_cancel = self.win.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
self.but_ok = self.win.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
self.but_ok.add_accelerator(
"clicked", self.accel_group, gtk.keysyms.Return, gtk.gdk.CONTROL_MASK, gtk.ACCEL_VISIBLE
)
self.win.set_default_response(gtk.RESPONSE_OK)
try:
view = RPCExecute("model", "res.user", "get_preferences_fields_view")
except RPCException:
self.win.destroy()
self.win = None
return
title = gtk.Label(_("Edit User Preferences"))
title.show()
self.win.vbox.pack_start(title, expand=False, fill=True)
self.screen = Screen("res.user", mode=[])
self.screen.add_view(view)
self.screen.new(default=False)
try:
preferences = RPCExecute("model", "res.user", "get_preferences", False)
except RPCException:
self.win.destroy()
self.win = None
return
self.screen.current_record.set(preferences)
self.screen.current_record.validate(softvalidation=True)
self.screen.screen_container.set(self.screen.current_view.widget)
self.screen.display(set_cursor=True)
self.screen.widget.show()
self.win.vbox.pack_start(self.screen.widget)
self.win.set_title(_("Preference"))
width, height = self.parent.get_size()
self.win.set_default_size(int(width * 0.9), int(height * 0.9))
self.win.show()
示例11: open_remote
def open_remote(self, record, create=True, changed=False, text=None,
callback=None):
field = record.group.fields[self.attrs['name']]
relation = field.attrs['relation']
access = common.MODELACCESS[relation]
if (create
and not (self.attrs.get('create', True) and access['create'])):
return
elif not access['read']:
return
domain = field.domain_get(record)
context = field.context_get(record)
if create:
obj_id = None
elif not changed:
obj_id = field.get(record)
else:
self.search_remote(record, relation, text, domain=domain,
context=context, callback=callback).show()
return
screen = Screen(relation, domain=domain, context=context,
mode=['form'], view_ids=self.attrs.get('view_ids', '').split(','),
exclude_field=field.attrs.get('relation_field'))
def open_callback(result):
if result:
value = (screen.current_record.id,
screen.current_record.rec_name())
field.set_client(record, value, force_change=True)
if callback:
callback()
if obj_id:
screen.load([obj_id])
WinForm(screen, open_callback, save_current=True)
else:
WinForm(screen, open_callback, new=True, save_current=True)
示例12: __init__
#.........这里部分代码省略.........
hbox.pack_start(self.but_open, expand=False, fill=False)
self.but_del = gtk.Button()
tooltips.set_tip(self.but_del, _("Delete selected record <Del>"))
self.but_del.connect("clicked", self._sig_remove, False)
img_del = gtk.Image()
img_del.set_from_stock("tryton-delete", gtk.ICON_SIZE_SMALL_TOOLBAR)
img_del.set_alignment(0.5, 0.5)
self.but_del.add(img_del)
self.but_del.set_relief(gtk.RELIEF_NONE)
hbox.pack_start(self.but_del, expand=False, fill=False)
self.but_undel = gtk.Button()
tooltips.set_tip(self.but_undel, _("Undelete selected record <Ins>"))
self.but_undel.connect("clicked", self._sig_undelete)
img_undel = gtk.Image()
img_undel.set_from_stock("tryton-undo", gtk.ICON_SIZE_SMALL_TOOLBAR)
img_undel.set_alignment(0.5, 0.5)
self.but_undel.add(img_undel)
self.but_undel.set_relief(gtk.RELIEF_NONE)
hbox.pack_start(self.but_undel, expand=False, fill=False)
hbox.pack_start(gtk.VSeparator(), expand=False, fill=True)
self.but_pre = gtk.Button()
tooltips.set_tip(self.but_pre, _("Previous"))
self.but_pre.connect("clicked", self._sig_previous)
img_pre = gtk.Image()
img_pre.set_from_stock("tryton-go-previous", gtk.ICON_SIZE_SMALL_TOOLBAR)
img_pre.set_alignment(0.5, 0.5)
self.but_pre.add(img_pre)
self.but_pre.set_relief(gtk.RELIEF_NONE)
hbox.pack_start(self.but_pre, expand=False, fill=False)
self.label = gtk.Label("(0,0)")
hbox.pack_start(self.label, expand=False, fill=False)
self.but_next = gtk.Button()
tooltips.set_tip(self.but_next, _("Next"))
self.but_next.connect("clicked", self._sig_next)
img_next = gtk.Image()
img_next.set_from_stock("tryton-go-next", gtk.ICON_SIZE_SMALL_TOOLBAR)
img_next.set_alignment(0.5, 0.5)
self.but_next.add(img_next)
self.but_next.set_relief(gtk.RELIEF_NONE)
hbox.pack_start(self.but_next, expand=False, fill=False)
hbox.pack_start(gtk.VSeparator(), expand=False, fill=True)
but_switch = gtk.Button()
tooltips.set_tip(but_switch, _("Switch"))
but_switch.connect("clicked", self.switch_view)
img_switch = gtk.Image()
img_switch.set_from_stock("tryton-fullscreen", gtk.ICON_SIZE_SMALL_TOOLBAR)
img_switch.set_alignment(0.5, 0.5)
but_switch.add(img_switch)
but_switch.set_relief(gtk.RELIEF_NONE)
hbox.pack_start(but_switch, expand=False, fill=False)
if attrs.get("add_remove"):
hbox.set_focus_chain([self.wid_text])
else:
hbox.set_focus_chain([])
tooltips.enable()
frame = gtk.Frame()
frame.add(hbox)
if attrs.get("expand_toolbar"):
frame.set_shadow_type(gtk.SHADOW_NONE)
else:
frame.set_shadow_type(gtk.SHADOW_OUT)
vbox.pack_start(frame, expand=False, fill=True)
self.screen = Screen(
attrs["relation"],
mode=attrs.get("mode", "tree,form").split(","),
view_ids=attrs.get("view_ids", "").split(","),
views_preload=attrs.get("views", {}),
row_activate=self._on_activate,
readonly=self.attrs.get("readonly", False),
exclude_field=attrs.get("relation_field", None),
)
self.screen.pre_validate = bool(int(attrs.get("pre_validate", 0)))
self.screen.signal_connect(self, "record-message", self._sig_label)
if self.attrs.get("group"):
self.screen.signal_connect(
self,
"current-record-changed",
lambda screen, _: gobject.idle_add(self.group_sync, screen, screen.current_record),
)
vbox.pack_start(self.screen.widget, expand=True, fill=True)
self.screen.widget.connect("key_press_event", self.on_keypress)
if self.attrs.get("add_remove"):
self.wid_text.connect("key_press_event", self.on_keypress)
but_switch.props.sensitive = self.screen.number_of_views > 1
示例13: One2Many
#.........这里部分代码省略.........
img_next.set_alignment(0.5, 0.5)
self.but_next.add(img_next)
self.but_next.set_relief(gtk.RELIEF_NONE)
hbox.pack_start(self.but_next, expand=False, fill=False)
hbox.pack_start(gtk.VSeparator(), expand=False, fill=True)
but_switch = gtk.Button()
tooltips.set_tip(but_switch, _("Switch"))
but_switch.connect("clicked", self.switch_view)
img_switch = gtk.Image()
img_switch.set_from_stock("tryton-fullscreen", gtk.ICON_SIZE_SMALL_TOOLBAR)
img_switch.set_alignment(0.5, 0.5)
but_switch.add(img_switch)
but_switch.set_relief(gtk.RELIEF_NONE)
hbox.pack_start(but_switch, expand=False, fill=False)
if attrs.get("add_remove"):
hbox.set_focus_chain([self.wid_text])
else:
hbox.set_focus_chain([])
tooltips.enable()
frame = gtk.Frame()
frame.add(hbox)
if attrs.get("expand_toolbar"):
frame.set_shadow_type(gtk.SHADOW_NONE)
else:
frame.set_shadow_type(gtk.SHADOW_OUT)
vbox.pack_start(frame, expand=False, fill=True)
self.screen = Screen(
attrs["relation"],
mode=attrs.get("mode", "tree,form").split(","),
view_ids=attrs.get("view_ids", "").split(","),
views_preload=attrs.get("views", {}),
row_activate=self._on_activate,
readonly=self.attrs.get("readonly", False),
exclude_field=attrs.get("relation_field", None),
)
self.screen.pre_validate = bool(int(attrs.get("pre_validate", 0)))
self.screen.signal_connect(self, "record-message", self._sig_label)
if self.attrs.get("group"):
self.screen.signal_connect(
self,
"current-record-changed",
lambda screen, _: gobject.idle_add(self.group_sync, screen, screen.current_record),
)
vbox.pack_start(self.screen.widget, expand=True, fill=True)
self.screen.widget.connect("key_press_event", self.on_keypress)
if self.attrs.get("add_remove"):
self.wid_text.connect("key_press_event", self.on_keypress)
but_switch.props.sensitive = self.screen.number_of_views > 1
def _color_widget(self):
if hasattr(self.screen.current_view, "treeview"):
return self.screen.current_view.treeview
return super(One2Many, self)._color_widget()
def on_keypress(self, widget, event):
if (event.keyval == gtk.keysyms.F3) and self.but_new.get_property("sensitive"):
示例14: __init__
def __init__(self, model, callback, sel_multi=True, context=None,
domain=None, view_ids=None, views_preload=None, new=True):
NoModal.__init__(self)
if views_preload is None:
views_preload = {}
self.domain = domain or []
self.context = context or {}
self.sel_multi = sel_multi
self.callback = callback
self.win = gtk.Dialog(_('Search'), self.parent,
gtk.DIALOG_DESTROY_WITH_PARENT)
self.win.set_icon(TRYTON_ICON)
self.win.set_has_separator(True)
self.win.set_default_response(gtk.RESPONSE_APPLY)
self.win.connect('response', self.response)
self.accel_group = gtk.AccelGroup()
self.win.add_accel_group(self.accel_group)
self.but_cancel = self.win.add_button(gtk.STOCK_CANCEL,
gtk.RESPONSE_CANCEL)
self.but_find = self.win.add_button(gtk.STOCK_FIND, gtk.RESPONSE_APPLY)
if new and common.MODELACCESS[model]['create']:
self.but_new = self.win.add_button(gtk.STOCK_NEW,
gtk.RESPONSE_ACCEPT)
self.but_new.set_accel_path('<tryton>/Form/New', self.accel_group)
self.but_ok = self.win.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
self.but_ok.add_accelerator('clicked', self.accel_group,
gtk.keysyms.Return, gtk.gdk.CONTROL_MASK, gtk.ACCEL_VISIBLE)
hbox = gtk.HBox()
hbox.show()
self.win.vbox.pack_start(hbox, expand=False, fill=True)
self.win.vbox.pack_start(gtk.HSeparator(), expand=False, fill=True)
scrollwindow = gtk.ScrolledWindow()
scrollwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
self.win.vbox.pack_start(scrollwindow, expand=True, fill=True)
self.screen = Screen(model, domain=domain, mode=['tree'],
context=context, view_ids=view_ids, views_preload=views_preload,
row_activate=self.sig_activate)
self.view = self.screen.current_view
self.view.unset_editable()
# Prevent to set tree_state
self.screen.tree_states_done.add(id(self.view))
sel = self.view.treeview.get_selection()
if not sel_multi:
sel.set_mode(gtk.SELECTION_SINGLE)
else:
sel.set_mode(gtk.SELECTION_MULTIPLE)
viewport = gtk.Viewport()
viewport.set_shadow_type(gtk.SHADOW_NONE)
viewport.add(self.screen.widget)
self.screen.widget.show()
viewport.show()
scrollwindow.add(viewport)
scrollwindow.show()
self.model_name = model
self.win.set_default_size(700, 500)
self.register()
sensible_allocation = self.sensible_widget.get_allocation()
self.win.set_default_size(int(sensible_allocation.width * 0.95),
int(sensible_allocation.height * 0.95))
示例15: WinSearch
class WinSearch(NoModal):
def __init__(self, model, callback, sel_multi=True, context=None,
domain=None, view_ids=None, views_preload=None, new=True):
NoModal.__init__(self)
if views_preload is None:
views_preload = {}
self.domain = domain or []
self.context = context or {}
self.sel_multi = sel_multi
self.callback = callback
self.win = gtk.Dialog(_('Search'), self.parent,
gtk.DIALOG_DESTROY_WITH_PARENT)
self.win.set_icon(TRYTON_ICON)
self.win.set_has_separator(True)
self.win.set_default_response(gtk.RESPONSE_APPLY)
self.win.connect('response', self.response)
self.accel_group = gtk.AccelGroup()
self.win.add_accel_group(self.accel_group)
self.but_cancel = self.win.add_button(gtk.STOCK_CANCEL,
gtk.RESPONSE_CANCEL)
self.but_find = self.win.add_button(gtk.STOCK_FIND, gtk.RESPONSE_APPLY)
if new and common.MODELACCESS[model]['create']:
self.but_new = self.win.add_button(gtk.STOCK_NEW,
gtk.RESPONSE_ACCEPT)
self.but_new.set_accel_path('<tryton>/Form/New', self.accel_group)
self.but_ok = self.win.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
self.but_ok.add_accelerator('clicked', self.accel_group,
gtk.keysyms.Return, gtk.gdk.CONTROL_MASK, gtk.ACCEL_VISIBLE)
hbox = gtk.HBox()
hbox.show()
self.win.vbox.pack_start(hbox, expand=False, fill=True)
self.win.vbox.pack_start(gtk.HSeparator(), expand=False, fill=True)
scrollwindow = gtk.ScrolledWindow()
scrollwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
self.win.vbox.pack_start(scrollwindow, expand=True, fill=True)
self.screen = Screen(model, domain=domain, mode=['tree'],
context=context, view_ids=view_ids, views_preload=views_preload,
row_activate=self.sig_activate)
self.view = self.screen.current_view
self.view.unset_editable()
# Prevent to set tree_state
self.screen.tree_states_done.add(id(self.view))
sel = self.view.treeview.get_selection()
if not sel_multi:
sel.set_mode(gtk.SELECTION_SINGLE)
else:
sel.set_mode(gtk.SELECTION_MULTIPLE)
viewport = gtk.Viewport()
viewport.set_shadow_type(gtk.SHADOW_NONE)
viewport.add(self.screen.widget)
self.screen.widget.show()
viewport.show()
scrollwindow.add(viewport)
scrollwindow.show()
self.model_name = model
self.win.set_default_size(700, 500)
self.register()
sensible_allocation = self.sensible_widget.get_allocation()
self.win.set_default_size(int(sensible_allocation.width * 0.95),
int(sensible_allocation.height * 0.95))
def sig_activate(self, *args):
self.view.treeview.emit_stop_by_name('row_activated')
self.win.response(gtk.RESPONSE_OK)
return True
def destroy(self):
self.screen.destroy()
self.win.destroy()
NoModal.destroy(self)
def show(self):
self.win.show()
common.center_window(self.win, self.parent, self.sensible_widget)
def hide(self):
self.win.hide()
def response(self, win, response_id):
res = None
if response_id == gtk.RESPONSE_OK:
res = [r.id for r in self.screen.selected_records]
elif response_id == gtk.RESPONSE_APPLY:
self.screen.search_filter(self.screen.screen_container.get_text())
return
elif response_id == gtk.RESPONSE_ACCEPT:
screen = Screen(self.model_name, domain=self.domain,
context=self.context, mode=['form'])
#.........这里部分代码省略.........