本文整理匯總了Python中rpc.RPCProxy.fields_view_get方法的典型用法代碼示例。如果您正苦於以下問題:Python RPCProxy.fields_view_get方法的具體用法?Python RPCProxy.fields_view_get怎麽用?Python RPCProxy.fields_view_get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rpc.RPCProxy
的用法示例。
在下文中一共展示了RPCProxy.fields_view_get方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Screen
# 需要導入模塊: from rpc import RPCProxy [as 別名]
# 或者: from rpc.RPCProxy import fields_view_get [as 別名]
#.........這裏部分代碼省略.........
self.view_to_load = view_type[1:]
view_id = False
if view_ids:
view_id = view_ids.pop(0)
if view_type[0] in ('tree','graph','calendar'):
self.screen_container.help = help
self.help_mode = view_type[0]
view = self.add_view_id(view_id, view_type[0], help=help)
self.screen_container.set(view.widget)
self.display()
def context_update(self, ctx={}, dmn=[]):
self.context = self.context_init.copy()
self.context.update(rpc.session.context)
self.context.update(ctx)
self.domain = self.domain_init[:]
self.domain += dmn
def readonly_get(self):
return self._readonly
def readonly_set(self, value):
self._readonly = value
self.models._readonly = value
readonly = property(readonly_get, readonly_set)
def search_active(self, active=True, show_search=True):
if active:
if not self.filter_widget:
if not self.search_view:
self.search_view = rpc.session.rpc_exec_auth('/object', 'execute',
self.name, 'fields_view_get', False, 'search',
self.context)
self.filter_widget = widget_search.form(self.search_view['arch'],
self.search_view['fields'], self.name, self.window,
self.domain, (self, self.search_filter))
self.screen_container.add_filter(self)
if active and show_search:
self.screen_container.show_filter()
else:
self.screen_container.hide_filter()
def update_scroll(self, *args):
offset = self.offset
limit = self.screen_container.get_limit()
if self.screen_container.but_previous:
if offset<=0:
self.screen_container.but_previous.set_sensitive(False)
else:
self.screen_container.but_previous.set_sensitive(True)
if self.screen_container.but_next:
if not limit or offset+limit>=self.search_count:
self.screen_container.but_next.set_sensitive(False)
else:
self.screen_container.but_next.set_sensitive(True)
if self.win_search:
self.win_search_callback()
def search_offset_next(self, *args):
offset=self.offset
limit = self.screen_container.get_limit()
self.offset = offset+limit
示例2: Screen
# 需要導入模塊: from rpc import RPCProxy [as 別名]
# 或者: from rpc.RPCProxy import fields_view_get [as 別名]
class Screen(signal_event.signal_event):
def __init__(self, model_name, view_ids=None, view_type=None,
parent=None, context=None, views_preload=None, tree_saves=True,
domain=None, create_new=False, row_activate=None, hastoolbar=False,
default_get=None, show_search=False, window=None, limit=80,
readonly=False, is_wizard=False):
if view_ids is None:
view_ids = []
if view_type is None:
view_type = ['tree', 'form']
if context is None:
context = {}
if views_preload is None:
views_preload = {}
if domain is None:
domain = []
if default_get is None:
default_get = {}
super(Screen, self).__init__()
self.show_search = show_search
self.search_count = 0
self.hastoolbar = hastoolbar
self.default_get=default_get
if not row_activate:
self.row_activate = lambda self,screen=None: self.switch_view(screen, 'form')
else:
self.row_activate = row_activate
self.create_new = create_new
self.name = model_name
self.domain = domain
self.latest_search = []
self.views_preload = views_preload
self.resource = model_name
self.rpc = RPCProxy(model_name)
self.context = context
self.context.update(rpc.session.context)
self.views = []
self.fields = {}
self.view_ids = view_ids
self.models = None
self.parent=parent
self.window=window
self.is_wizard = is_wizard
models = ModelRecordGroup(model_name, self.fields, parent=self.parent, context=self.context, is_wizard=is_wizard)
self.models_set(models)
self.current_model = None
self.screen_container = screen_container()
self.filter_widget = None
self.widget = self.screen_container.widget_get()
self.__current_view = 0
self.tree_saves = tree_saves
self.limit = limit
self.readonly= readonly
self.view_fields = {} # Used to switch self.fields when the view switchs
if view_type:
self.view_to_load = view_type[1:]
view_id = False
if view_ids:
view_id = view_ids.pop(0)
view = self.add_view_id(view_id, view_type[0])
self.screen_container.set(view.widget)
self.display()
def readonly_get(self):
return self._readonly
def readonly_set(self, value):
self._readonly = value
self.models._readonly = value
readonly = property(readonly_get, readonly_set)
def search_active(self, active=True, show_search=True):
if active:
if not self.filter_widget:
view_form = rpc.session.rpc_exec_auth('/object', 'execute',
self.name, 'fields_view_get', False, 'form',
self.context)
view_tree = rpc.session.rpc_exec_auth('/object', 'execute',
self.name, 'fields_view_get', False, 'tree',
self.context)
dom = xml.dom.minidom.parseString(view_tree['arch'])
child_node=dom.childNodes[0].childNodes
arch=''
for i in range(1,len(child_node)):
arch += child_node[i].toxml()
#Generic case when we need to remove the last occurance of </form> from form view
view_form['arch'] = view_form['arch'][0:view_form['arch'].rfind('</form>')]
#Special case when form is replaced,we need to remove </form>
find_form = view_form['arch'].rfind('</form>')
if find_form > 0:
view_form['arch'] = view_form['arch'][0:find_form]
view_form['arch'] = view_form['arch'] + arch + '\n</form>'
#.........這裏部分代碼省略.........