本文整理汇总了Python中pyasm.web.Table.get_color方法的典型用法代码示例。如果您正苦于以下问题:Python Table.get_color方法的具体用法?Python Table.get_color怎么用?Python Table.get_color使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.web.Table
的用法示例。
在下文中一共展示了Table.get_color方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import get_color [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", '');
'''
#.........这里部分代码省略.........
示例2: ResizableTableWdg
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import get_color [as 别名]
class ResizableTableWdg(BaseRefreshWdg):
def __init__(self, **kwargs):
self.table = Table()
self.table.add_style("border-collapse: collapse")
self.table.add_style("padding: 0px")
self.table.set_attr("cellpadding", "0px")
self.table.set_attr("cellspacing", "0px")
self.is_first_row = True
self.hilight = self.table.get_color("background", -40)
super(ResizableTableWdg, self).__init__(**kwargs)
def set_style(self, name, value=None):
self.table.set_style(name, value)
def set_max_width(self):
self.table.set_max_width()
def add_class(self, name):
self.table.add_class(name)
def get_display(self):
top = self.top
self.table.add_class("spt_resizable_table_top")
self.table.add_behavior( {
'type': 'load',
'cbjs_action': self.get_onload_js()
} )
self.table.add_behavior( {
'type': 'load',
'cbjs_action': '''
var resizable_cells = bvr.src_el.getElements(".spt_resizable_cell");
for (var i = 0; i < resizable_cells.length; i++) {
var resizable_el = resizable_cells[i].getElement(".spt_resizable");
if (!resizable_el) {
continue;
}
var size = resizable_cells[i].getSize();
resizable_el.setStyle("width", size.x);
resizable_el.setAttribute("width", size.x);
}
'''
} )
top.add(self.table)
return top
def set_keep_table_size(self):
self.table.add_class("spt_resizable_keep_size")
def add_color(self, color, modifier=0):
self.table.add_color(color, modifier)
def add_border(self, modifier=0):
self.table.add_border(modifier=modifier)
def add_style(self, name, value=None):
self.table.add_style(name, value=value)
def add_row(self, resize=True):
# add resize row
if not self.is_first_row and resize == True:
tr, td = self.table.add_row_cell()
td.add_style("height: 3px")
td.add_style("min-height: 3px")
td.add_style("cursor: n-resize")
tr.add_behavior( {
'type': 'drag',
'cb_set_prefix': 'spt.resizable_table.row_drag'
} )
tr.add_behavior( {
'type': 'hover',
'hilight': self.hilight,
'cbjs_action_over': '''
var color = bvr.src_el.getStyle("background-color");
bvr.src_el.setStyle("background-color", bvr.hilight);
bvr.src_el.setAttribute("spt_last_background", color);
''',
'cbjs_action_out': '''
var color = bvr.src_el.getAttribute("spt_last_background");
bvr.src_el.setStyle("background-color", color);
'''
} )
#.........这里部分代码省略.........
示例3: get_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import get_color [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;
#.........这里部分代码省略.........
示例4: get_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import get_color [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',
#.........这里部分代码省略.........