本文整理汇总了Python中pyasm.web.WidgetSettings.set_value_by_key方法的典型用法代码示例。如果您正苦于以下问题:Python WidgetSettings.set_value_by_key方法的具体用法?Python WidgetSettings.set_value_by_key怎么用?Python WidgetSettings.set_value_by_key使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.web.WidgetSettings
的用法示例。
在下文中一共展示了WidgetSettings.set_value_by_key方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute
# 需要导入模块: from pyasm.web import WidgetSettings [as 别名]
# 或者: from pyasm.web.WidgetSettings import set_value_by_key [as 别名]
def execute(my):
class_names = my.kwargs.get("class_names")
attrs_list = my.kwargs.get("attrs_list")
kwargs_list = my.kwargs.get("kwargs_list")
xml = Xml()
xml.create_doc("config")
root = xml.get_root_node()
view = xml.create_element("tab")
xml.append_child(root, view)
for class_name, attrs, kwargs in zip(class_names, attrs_list, kwargs_list):
element = xml.create_element("element")
xml.append_child(view, element)
for key, value in attrs.items():
xml.set_attribute(element, key, value)
display = xml.create_element("display")
xml.append_child(element, display)
xml.set_attribute(display, "class", class_name)
for key, value in kwargs.items():
attr = xml.create_text_element(key, value, node=display)
xml.append_child(display, attr)
xml_string = xml.to_string()
from pyasm.web import WidgetSettings
WidgetSettings.set_value_by_key("tab", xml_string)
示例2: set_persistent_value
# 需要导入模块: from pyasm.web import WidgetSettings [as 别名]
# 或者: from pyasm.web.WidgetSettings import set_value_by_key [as 别名]
def set_persistent_value(my):
filter_data = FilterData.get_from_cgi()
json = filter_data.serialize()
# use widget settings instead
# Using solely TableLayoutWdg will result in having no search view
if my.view:
key = SearchWdg._get_key(my.search_type, my.view)
WidgetSettings.set_value_by_key(key, json)
#value = WidgetSettings.get_value_by_key(key)
#print "value: ", value
return
示例3: set_persistent_value
# 需要导入模块: from pyasm.web import WidgetSettings [as 别名]
# 或者: from pyasm.web.WidgetSettings import set_value_by_key [as 别名]
def set_persistent_value(my):
filter_data = FilterData.get_from_cgi()
json = filter_data.serialize()
# use widget settings instead
key = SearchWdg._get_key(my.search_type, my.view)
WidgetSettings.set_value_by_key(key, json)
#value = WidgetSettings.get_value_by_key(key)
#print "value: ", value
return
示例4: get_display
# 需要导入模块: from pyasm.web import WidgetSettings [as 别名]
# 或者: from pyasm.web.WidgetSettings import set_value_by_key [as 别名]
def get_display(my):
top = my.top
top.add_class("spt_changelist_content")
my.set_as_panel(top)
top.add_color("color", "color")
top.add_color("background", "background")
#top.add_border()
#top.add_style("padding", "10px")
top.add_style("min-width: 600px")
top.add_style("min-height: 400px")
top.add_behavior( {
'type': 'load',
'cbjs_action': scm_get_onload_js()
} )
sync_dir = Environment.get_sandbox_dir()
# HARD CODED
project = Project.get()
depot = project.get_value("location", no_exception=True)
if not depot:
depot = project.get_code()
location = '//%s' % depot
changelist = my.kwargs.get("changelist")
if not changelist:
changelist = WidgetSettings.get_value_by_key("current_changelist")
else:
WidgetSettings.set_value_by_key("current_changelist", changelist)
if not changelist:
changelist = 'default'
changelists = my.kwargs.get("changelists")
if not changelists:
changelists = []
elif isinstance(changelists, basestring):
changelists = changelists.replace("'", '"')
changelists = jsonloads(changelists)
top.add_behavior( {
'type': 'load',
'sync_dir': sync_dir,
'depot': depot,
'cbjs_action': '''
spt.scm.sync_dir = bvr.sync_dir;
spt.scm.depot = bvr.depot;
'''
} )
inner = DivWdg()
top.add(inner)
table = Table()
inner.add(table)
table.add_style("width: 100%")
table.add_color("background", "background", -3)
table.add_row()
th = table.add_header("")
th = table.add_header("Changelist")
th.add_style("text-align: left")
th = table.add_header("Description")
th.add_style("text-align: left")
th = table.add_header("# Items")
th.add_style("text-align: left")
th = table.add_header("Status")
th.add_style("text-align: left")
th = table.add_header("View")
th.add_style("text-align: left")
th = table.add_header("Delete")
th.add_style("text-align: left")
#table.set_unique_id()
#table.add_smart_styles("spt_changelist_item", {
# 'text-align: right'
# } ))
bgcolor = table.get_color("background", -8)
table.add_relay_behavior( {
'type': 'mouseover',
'bvr_match_class': 'spt_changelist_item',
'bgcolor': bgcolor,
'cbjs_action': '''
bvr.src_el.setStyle("background-color", bvr.bgcolor);
'''
} )
table.add_relay_behavior( {
'type': 'mouseout',
'bvr_match_class': 'spt_changelist_item',
'cbjs_action': '''
bvr.src_el.setStyle("background-color", '');
'''
#.........这里部分代码省略.........
示例5: clear_search_data
# 需要导入模块: from pyasm.web import WidgetSettings [as 别名]
# 或者: from pyasm.web.WidgetSettings import set_value_by_key [as 别名]
def clear_search_data(search_type, view=None):
DbContainer.abort_thread_sql(force=True)
key = SearchWdg._get_key(search_type, view)
WidgetSettings.set_value_by_key(key, '')
示例6: get_display
# 需要导入模块: from pyasm.web import WidgetSettings [as 别名]
# 或者: from pyasm.web.WidgetSettings import set_value_by_key [as 别名]
def get_display(my):
top = my.top
top.add_class("spt_branch_content")
my.set_as_panel(top)
top.add_color("color", "color")
top.add_color("background", "background")
#top.add_border()
#top.add_style("padding", "10px")
top.add_style("min-width: 600px")
top.add_style("min-height: 400px")
top.add_behavior( {
'type': 'load',
'cbjs_action': scm_get_onload_js()
} )
sync_dir = Environment.get_sandbox_dir()
project = Project.get()
depot = project.get_value("location", no_exception=True)
if not depot:
depot = project.get_code()
location = '//%s' % depot
branch = my.kwargs.get("branch")
if not branch:
branch = WidgetSettings.get_value_by_key("current_branch")
else:
WidgetSettings.set_value_by_key("current_branch", branch)
if not branch:
branch = 'main'
branches = my.kwargs.get("branches")
if not branches:
branches = []
elif isinstance(branches, basestring):
branches = branches.replace("'", '"')
branches = jsonloads(branches)
top.add_behavior( {
'type': 'load',
'depot': depot,
'sync_dir': sync_dir,
'cbjs_action': '''
spt.scm.sync_dir = bvr.sync_dir;
spt.scm.depot = bvr.depot;
'''
} )
inner = DivWdg()
top.add(inner)
table = Table()
inner.add(table)
table.add_style("width: 100%")
table.add_row()
th = table.add_header("")
th = table.add_header("Branches")
th.add_style("text-align: left")
th = table.add_header("Options")
th.add_style("text-align: left")
th = table.add_header("Owner")
th.add_style("text-align: left")
th = table.add_header("Check-out")
th.add_style("text-align: left")
bgcolor = table.get_color("background", -8)
table.add_relay_behavior( {
'type': 'mouseover',
'bvr_match_class': 'spt_branch_item',
'bgcolor': bgcolor,
'cbjs_action': '''
bvr.src_el.setStyle("background-color", bvr.bgcolor);
'''
} )
table.add_relay_behavior( {
'type': 'mouseout',
'bvr_match_class': 'spt_branch_item',
'cbjs_action': '''
bvr.src_el.setStyle("background-color", '');
'''
} )
table.add_relay_behavior( {
'type': 'mouseup',
'bvr_match_class': "spt_branch_radio",
'cbjs_action': '''
var value = bvr.src_el.value;
#.........这里部分代码省略.........
示例7: get_display
# 需要导入模块: from pyasm.web import WidgetSettings [as 别名]
# 或者: from pyasm.web.WidgetSettings import set_value_by_key [as 别名]
def get_display(my):
top = my.top
top.add_class("spt_workspace_content")
my.set_as_panel(top)
top.add_color("color", "color")
top.add_color("background", "background")
top.add_style("min-width: 600px")
top.add_style("min-height: 400px")
# NOTE: is there ever a time when this is not loaded already?
top.add_behavior( {
'type': 'load',
'cbjs_action': scm_get_onload_js()
} )
sync_dir = Environment.get_sandbox_dir()
project = Project.get()
depot = project.get_value("location", no_exception=True)
if not depot:
depot = project.get_code()
location = '//%s' % depot
workspace = my.kwargs.get("workspace")
if not workspace:
workspace = WidgetSettings.get_value_by_key("current_workspace")
else:
WidgetSettings.set_value_by_key("current_workspace", workspace)
if not workspace:
workspace = 'main'
workspaces = my.kwargs.get("workspaces")
if not workspaces:
workspaces = []
elif isinstance(workspaces, basestring):
workspaces = workspaces.replace("'", '"')
workspaces = jsonloads(workspaces)
top.add_behavior( {
'type': 'load',
'depot': depot,
'sync_dir': sync_dir,
'cbjs_action': '''
spt.scm.sync_dir = bvr.sync_dir;
spt.scm.depot = bvr.depot;
'''
} )
inner = DivWdg()
top.add(inner)
table = Table()
inner.add(table)
table.add_style("width: 100%")
table.add_row()
th = table.add_header("")
th = table.add_header("Workspaces")
th.add_style("text-align: left")
th = table.add_header("Description")
th.add_style("text-align: left")
th = table.add_header("Owner")
th.add_style("text-align: left")
th = table.add_header("Root")
th.add_style("text-align: left")
bgcolor = table.get_color("background", -8)
table.add_relay_behavior( {
'type': 'mouseover',
'bvr_match_class': 'spt_workspace_item',
'bgcolor': bgcolor,
'cbjs_action': '''
bvr.src_el.setStyle("background-color", bvr.bgcolor);
'''
} )
table.add_relay_behavior( {
'type': 'mouseout',
'bvr_match_class': 'spt_workspace_item',
'cbjs_action': '''
bvr.src_el.setStyle("background-color", '');
'''
} )
table.add_relay_behavior( {
'type': 'mouseup',
#.........这里部分代码省略.........