当前位置: 首页>>代码示例>>Python>>正文


Python Screen.search_filter方法代码示例

本文整理汇总了Python中tryton.gui.window.view_form.screen.Screen.search_filter方法的典型用法代码示例。如果您正苦于以下问题:Python Screen.search_filter方法的具体用法?Python Screen.search_filter怎么用?Python Screen.search_filter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tryton.gui.window.view_form.screen.Screen的用法示例。


在下文中一共展示了Screen.search_filter方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from tryton.gui.window.view_form.screen import Screen [as 别名]
# 或者: from tryton.gui.window.view_form.screen.Screen import search_filter [as 别名]
 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()
开发者ID:coopengo,项目名称:tryton,代码行数:13,代码来源:note.py

示例2: __init__

# 需要导入模块: from tryton.gui.window.view_form.screen import Screen [as 别名]
# 或者: from tryton.gui.window.view_form.screen.Screen import search_filter [as 别名]
 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')
开发者ID:mediafactory,项目名称:tryton_client_desktop,代码行数:14,代码来源:attachment.py

示例3: WinSearch

# 需要导入模块: from tryton.gui.window.view_form.screen import Screen [as 别名]
# 或者: from tryton.gui.window.view_form.screen.Screen import search_filter [as 别名]
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'])

#.........这里部分代码省略.........
开发者ID:coopengo,项目名称:tryton,代码行数:103,代码来源:win_search.py

示例4: Action

# 需要导入模块: from tryton.gui.window.view_form.screen import Screen [as 别名]
# 或者: from tryton.gui.window.view_form.screen.Screen import search_filter [as 别名]
class Action(SignalEvent):

    def __init__(self, attrs=None, context=None):
        super(Action, self).__init__()
        self.act_id = int(attrs['name'])
        self.context = context or {}

        try:
            self.action = RPCExecute('model', 'ir.action.act_window', 'read',
                self.act_id, False)
        except RPCException:
            raise

        view_ids = None
        self.action['view_mode'] = None
        if self.action.get('views', []):
            view_ids = [x[0] for x in self.action['views']]
            self.action['view_mode'] = [x[1] for x in self.action['views']]
        elif self.action.get('view_id', False):
            view_ids = [self.action['view_id'][0]]

        if 'view_mode' in attrs:
            self.action['view_mode'] = attrs['view_mode']

        self.action.setdefault('pyson_domain', '[]')
        self.context.update(rpc.CONTEXT)
        self.context['_user'] = rpc._USER
        self.context.update(PYSONDecoder(self.context).decode(
            self.action.get('pyson_context', '{}')))

        eval_ctx = self.context.copy()
        self.context.update(PYSONDecoder(eval_ctx).decode(
            self.action.get('pyson_context', '{}')))

        self.domain = []
        self.update_domain([])

        search_context = self.context.copy()
        search_context['context'] = self.context
        search_context['_user'] = rpc._USER
        search_value = PYSONDecoder(search_context).decode(
            self.action['pyson_search_value'] or '{}')

        self.widget = gtk.Frame()
        self.widget.set_border_width(0)

        vbox = gtk.VBox(homogeneous=False, spacing=3)
        self.widget.add(vbox)

        self.title = gtk.Label()
        self.widget.set_label_widget(self.title)
        self.widget.set_label_align(0.0, 0.5)
        self.widget.show_all()

        self.screen = Screen(self.action['res_model'],
            mode=self.action['view_mode'], context=self.context,
            view_ids=view_ids, domain=self.domain,
            search_value=search_value, row_activate=self.row_activate)
        vbox.pack_start(self.screen.widget, expand=True, fill=True)
        name = self.screen.current_view.title
        self.screen.signal_connect(self, 'record-message',
            self._active_changed)

        if attrs.get('string'):
            self.title.set_text(attrs['string'])
        elif self.action.get('window_name'):
            self.title.set_text(self.action['name'])
        else:
            self.title.set_text(name)

        self.widget.set_size_request(int(attrs.get('width', -1)),
                int(attrs.get('height', -1)))

        self.screen.search_filter()

    def row_activate(self):
        if not self.screen.current_record:
            return

        def callback(result):
            if result:
                self.screen.current_record.save()
            else:
                self.screen.current_record.cancel()
        WinForm(self.screen, callback)

    def set_value(self, mode, model_field):
        self.screen.current_view.set_value()
        return True

    def display(self):
        self.screen.search_filter(self.screen.screen_container.get_text())

    def _active_changed(self, *args):
        self.signal('active-changed')

    def _get_active(self):
        if self.screen and self.screen.current_record:
            return common.EvalEnvironment(self.screen.current_record, False)

#.........这里部分代码省略.........
开发者ID:mediafactory,项目名称:tryton_client_desktop,代码行数:103,代码来源:action.py

示例5: Form

# 需要导入模块: from tryton.gui.window.view_form.screen import Screen [as 别名]
# 或者: from tryton.gui.window.view_form.screen.Screen import search_filter [as 别名]

#.........这里部分代码省略.........
                + 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
        if not isinstance(value, Form):
            return False
        return (self.model == value.model
            and self.res_id == value.res_id
            and self.domain == value.domain
            and self.mode == value.mode
            and self.view_ids == value.view_ids
            and self.screen.context == value.screen.context
            and self.name == value.name
            and self.screen.limit == value.screen.limit
            and self.screen.search_value == value.screen.search_value)

    def destroy(self):
        self.screen.destroy()

    def sig_attach(self, widget=None):
开发者ID:coopengo,项目名称:tryton,代码行数:70,代码来源:form.py

示例6: Form

# 需要导入模块: from tryton.gui.window.view_form.screen import Screen [as 别名]
# 或者: from tryton.gui.window.view_form.screen.Screen import search_filter [as 别名]

#.........这里部分代码省略.........
        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
        if not isinstance(value, Form):
            return False
        return (self.model == value.model
            and self.res_id == value.res_id
            and self.domain == value.domain
            and self.mode == value.mode
            and self.view_ids == value.view_ids
            and self.context == value.context
            and self.name == value.name
            and self.screen.limit == value.screen.limit
            and self.auto_refresh == value.auto_refresh
            and self.screen.search_value == value.screen.search_value)

    def destroy(self):
        self.screen.destroy()
开发者ID:sunny414,项目名称:tryton-client,代码行数:70,代码来源:form.py


注:本文中的tryton.gui.window.view_form.screen.Screen.search_filter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。