當前位置: 首頁>>代碼示例>>Python>>正文


Python Screen.load_view_to_load方法代碼示例

本文整理匯總了Python中tryton.gui.window.view_form.screen.Screen.load_view_to_load方法的典型用法代碼示例。如果您正苦於以下問題:Python Screen.load_view_to_load方法的具體用法?Python Screen.load_view_to_load怎麽用?Python Screen.load_view_to_load使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tryton.gui.window.view_form.screen.Screen的用法示例。


在下文中一共展示了Screen.load_view_to_load方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: Form

# 需要導入模塊: from tryton.gui.window.view_form.screen import Screen [as 別名]
# 或者: from tryton.gui.window.view_form.screen.Screen import load_view_to_load [as 別名]

#.........這裏部分代碼省略.........
            res = RPCExecute('model', self.model, 'read', [obj_id],
                [x[0] for x in fields], context=self.context)
        except RPCException:
            return
        message_str = ''
        for line in res:
            for (key, val) in fields:
                value = str(line.get(key, False) or '/')
                if line.get(key, False) \
                        and key in ('create_date', 'write_date'):
                    display_format = date_format() + ' %H:%M:%S'
                    date = timezoned_date(line[key])
                    value = common.datetime_strftime(date, display_format)
                message_str += val + ' ' + value + '\n'
        message_str += _('Model:') + ' ' + self.model
        message(message_str)
        return True

    def sig_remove(self, widget=None):
        if not common.MODELACCESS[self.model]['delete']:
            return
        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 sur(msg):
            if not self.screen.remove(delete=True, force_remove=True):
                self.message_info(_('Records not removed!'))
            else:
                self.message_info(_('Records removed!'), 'green')

    def sig_import(self, widget=None):
        while(self.screen.view_to_load):
            self.screen.load_view_to_load()
        fields = {}
        for name, field in self.screen.group.fields.iteritems():
            fields[name] = field.attrs
        WinImport(self.model)

    def sig_save_as(self, widget=None):
        while self.screen.view_to_load:
            self.screen.load_view_to_load()
        fields = {}
        for name, field in self.screen.group.fields.iteritems():
            fields[name] = field.attrs
        WinExport(self.model, self.ids_get(), context=self.context)

    def sig_new(self, widget=None, autosave=True):
        if not common.MODELACCESS[self.model]['create']:
            return
        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
        res_ids = self.sel_ids_get()
        try:
            new_ids = RPCExecute('model', self.model, 'copy', res_ids, {},
                context=self.context)
開發者ID:sunny414,項目名稱:tryton-client,代碼行數:70,代碼來源:form.py


注:本文中的tryton.gui.window.view_form.screen.Screen.load_view_to_load方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。