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


Python Screen.display_prev方法代码示例

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

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

示例1: form

# 需要导入模块: from widget.screen import Screen [as 别名]
# 或者: from widget.screen.Screen import display_prev [as 别名]

#.........这里部分代码省略.........
            if not self.modified_save():
                return
        self.screen.new()
        self.message_state('')

    def sig_copy(self, *args):
        if not self.modified_save():
            return
        res_id = self.id_get()
        ctx = self.context.copy()
        ctx.update(rpc.session.context)
        new_id = rpc.session.rpc_exec_auth('/object', 'execute', self.model, 'copy', res_id, {}, ctx)
        if new_id:
            self.screen.load([new_id])
            self.screen.current_view.set_cursor()
            self.message_state(_('Working now on the duplicated document !'))
        self.sig_reload()
        
    def _form_save(self, auto_continue=True):
        pass

    def sig_save(self, widget=None, sig_new=True, auto_continue=True):
        id = self.screen.save_current()
        if id:
            self.message_state(_('Document Saved.'), color="darkgreen")
        else:
            common.warning(_('Invalid form, correct red fields !'),_('Error !'))
            self.message_state(_('Invalid form, correct red fields !'), color="red")
        return bool(id)

    def sig_previous(self, widget=None):
        if not self.modified_save():
            return
        self.screen.display_prev()
        self.message_state('')

    def sig_next(self, widget=None):
        if not self.modified_save():
            return
        self.screen.display_next()
        self.message_state('')

    def sig_reload(self, test_modified=True):
        if not hasattr(self, 'screen'):
            return False
        if test_modified and self.screen.is_modified():
            res = common.sur_3b(_('This record has been modified\n' \
                    'do you want to save it ?'))
            if res == 'ok':
                self.sig_save()
            elif res == 'ko':
                pass
            else:
                return False
        if self.screen.current_view.view_type == 'form':
            self.screen.cancel_current()
            self.screen.display()
        else:
            id = self.screen.id_get()
            self.screen.search_filter()
            for model in self.screen.models:
                if model.id == id:
                    self.screen.current_model = model
                    self.screen.display()
                    break
        self.message_state('')
开发者ID:gisce,项目名称:erpclient,代码行数:70,代码来源:form.py


示例2: form

# 需要导入模块: from widget.screen import Screen [as 别名]
# 或者: from widget.screen.Screen import display_prev [as 别名]

#.........这里部分代码省略.........
    def _form_save(self, auto_continue=True):
        pass
    
    @set_tooltips
    def sig_save(self, widget=None, sig_new=True, auto_continue=True):
        res = self.screen.save_current()
        warning = False
        if isinstance(res,dict):
            id = res.get('id',False)
            warning = res.get('warning',False)
        else:
            id = res
        if id:
            self.message_state(_('Document Saved.'), color="darkgreen")
        elif len(self.screen.models.models) and res != None and self.screen.models.mfields:
            fields  = common.get_invalid_field(self.screen.current_model, self.screen)
            msg = ''
            for req, inv in fields:
                if not inv:
                    msg += req + ' (<b>invisible</b>) '
                else:
                    msg += req
                msg += '\n'
            common.warning(_('Correct following red fields !\n\n%s')  % ( msg ),_('Input Error !'), parent=self.screen.current_view.window, to_xml=False)
            self.message_state(_('Invalid form, correct red fields !'), color="red")
        if warning:
            common.warning(warning,_('Warning !'), parent=self.screen.current_view.window)
        return bool(id)

    @set_tooltips
    def sig_previous(self, widget=None):
        if not self.modified_save():
            return
        self.screen.display_prev()
        self.message_state('')
        
    @set_tooltips
    def sig_next(self, widget=None):
        if not self.modified_save():
            return
        self.screen.display_next()
        self.message_state('')

    def sig_reload(self, test_modified=True):
        if not hasattr(self, 'screen'):
            return False
        if test_modified and self.screen.is_modified():
            res = common.sur_3b(_('This record has been modified\n' \
                    'do you want to save it ?'))
            if res == 'ok':
                self.sig_save()
            elif res == 'ko':
                pass
            else:
                return False
        if self.screen.current_view.view_type == 'form':
            self.screen.cancel_current()
            self.screen.display()
        else:
            id = self.screen.id_get()
            self.screen.search_filter()
            for model in self.screen.models:
                if model.id == id:
                    self.screen.current_model = model
                    self.screen.display()
                    break
开发者ID:Ichag,项目名称:openerp-client,代码行数:70,代码来源:form.py


示例3: one2many_list

# 需要导入模块: from widget.screen import Screen [as 别名]
# 或者: from widget.screen.Screen import display_prev [as 别名]

#.........这里部分代码省略.........
            id = val.get('id', False)
            obj = service.LocalService('action.main')
            res = obj.exec_keyword(type, {'model':self.model, 'id': id or False, 'ids':[id], 'report_type': 'pdf'})
            return True
        else:
            common.message(_('You have to select a resource !'))
            return False

    def switch_view(self, btn, arg):
        self.screen.switch_view()

    def _readonly_set(self, value):
        self._readonly = value
        self.eb_new.set_sensitive(not value)
        self.eb_del.set_sensitive(not value)
        self.screen.readonly = value
        self.screen.display()

    def _sig_new(self, *args):
        _, event = args
        ctx = self._view.model.expr_eval(self.screen.default_get)
        ctx.update(self._view.model.expr_eval('dict(%s)' % self.attrs.get('context', '')))
        if event.type in (gtk.gdk.BUTTON_PRESS, gtk.gdk.KEY_PRESS):
            if (self.screen.current_view.view_type=='form') or self.screen.editable_get():
                self.screen.new(context=ctx)
                self._readonly = False
                self.screen.current_view.widget.set_sensitive(True)
            else:
                ok = 1
                dia = dialog(self.attrs['relation'], parent=self._view.model, attrs=self.attrs, model_ctx=self.screen.models._context, default_get_ctx=ctx, window=self._window, readonly=self._readonly)
                while ok:
                    ok, value = dia.run()
                    if ok:
                        self.screen.models.model_add(value)
                        value.signal('record-changed', value.parent)
                        self.screen.display()
                        dia.new()
                dia.destroy()

    def _sig_edit(self, *args):
        if self.screen.current_model:
            dia = dialog(self.attrs['relation'], parent=self._view.model,  model=self.screen.current_model, attrs=self.attrs, window=self._window, readonly=self._readonly)
            ok, value = dia.run()
            dia.destroy()

    def _sig_next(self, *args):
        _, event = args
        if event.type == gtk.gdk.BUTTON_PRESS:
            self.screen.display_next()

    def _sig_previous(self, *args):
        _, event = args
        if event.type == gtk.gdk.BUTTON_PRESS:
            self.screen.display_prev()

    def _sig_remove(self, *args):
        _, event = args
        if event.type == gtk.gdk.BUTTON_PRESS:
            if self.screen.current_view.view_type == 'form':
                msg = 'Are you sure to remove this record ?'
            else:
                msg = 'Are you sure to remove those records ?'
            if common.sur(msg):
                    self.screen.remove()
                    if not self.screen.models.models:
                        self.screen.current_view.widget.set_sensitive(False)

    def _sig_label(self, screen, signal_data):
        name = '_'
        if signal_data[0] >= 0:
            name = str(signal_data[0] + 1)
        line = '(%s/%s)' % (name, signal_data[1])
        self.label.set_text(line)

    def _sig_refresh(self, *args):
        pass

    def _sig_sequence(self, *args):
        pass

    def display(self, model, model_field):
        if not model_field:
            self.screen.current_model = None
            self.screen.display()
            return False
        super(one2many_list, self).display(model, model_field)
        new_models = model_field.get_client(model)
        if self.screen.models != new_models:
            self.screen.models_set(new_models)
            if (self.screen.current_view.view_type=='tree') and self.screen.editable_get():
                self.screen.current_model = None
        self.screen.display()
        return True

    def set_value(self, model, model_field):
        self.screen.current_view.set_value()
        if self.screen.is_modified():
            model.modified = True
            model.modified_fields.setdefault(model_field.name)
        return True
开发者ID:gisce,项目名称:erpclient,代码行数:104,代码来源:one2many_list.py



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