本文整理汇总了Python中pyasm.web.WidgetSettings.get_key_value方法的典型用法代码示例。如果您正苦于以下问题:Python WidgetSettings.get_key_value方法的具体用法?Python WidgetSettings.get_key_value怎么用?Python WidgetSettings.get_key_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.web.WidgetSettings
的用法示例。
在下文中一共展示了WidgetSettings.get_key_value方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_tab_key
# 需要导入模块: from pyasm.web import WidgetSettings [as 别名]
# 或者: from pyasm.web.WidgetSettings import get_key_value [as 别名]
def set_tab_key(my,tab_key):
''' set the name of the tab for redirection. If one value is passed in,
it assumes it's one the current set of subtabs. To jump to a tab from
a totally different category, pass in a dict using set_redirect or
get_redirect_script'''
web = WebContainer.get_web()
my.tab_key = tab_key
redirect = Container.get(my.TAB_REDIRECT)
if not redirect:
# find it from the web form
redirect = web.get_form_value(my.TAB_REDIRECT)
if redirect:
redirect_dict = {}
redirect = redirect.split(',')
# expecting key, value pairs
for idx, item in enumerate(redirect):
if idx % 2 == 0:
redirect_dict[item] = redirect[idx+1]
redirect = redirect_dict
if redirect:
if isinstance(redirect, dict):
for key, value in redirect.items():
# set only the relevant key
if key == tab_key:
web.set_form_value(key, value)
break
else:
web.set_form_value(tab_key, redirect)
web.set_form_value('is_form_submitted','init')
# this implicitly sets the tab value
class_name = my.__class__.__name__
my.tab_value = WidgetSettings.get_key_value(class_name,my.tab_key)