本文整理汇总了Python中pyasm.widget.HiddenWdg.add_style方法的典型用法代码示例。如果您正苦于以下问题:Python HiddenWdg.add_style方法的具体用法?Python HiddenWdg.add_style怎么用?Python HiddenWdg.add_style使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.widget.HiddenWdg
的用法示例。
在下文中一共展示了HiddenWdg.add_style方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from pyasm.widget import HiddenWdg [as 别名]
# 或者: from pyasm.widget.HiddenWdg import add_style [as 别名]
def get_display(my):
if not my.preprocessed:
my.preprocess()
if my.is_refresh:
top = Widget()
else:
top = DivWdg()
top.add_class("spt_work_hours_top")
hidden = HiddenWdg('workhour_data')
hidden.add_class('spt_workhour_data')
header_data = {'start_date': str(my.start_date)}
header_data = jsondumps(header_data).replace('"', """)
hidden.set_value(header_data, set_form_value=False )
top.add(hidden)
days = []
for date in my.dates:
days.append( date.strftime("%Y_%m_%d") )
today = my.today.strftime("%Y_%m_%d")
task = my.get_current_sobject()
if not my.is_refresh:
my.set_as_panel(top)
entries = my.entries.get(task.get_code())
if isinstance(task, Task):
parent = task.get_parent()
if not parent:
disabled = True
else:
disabled = False
else:
disabled = False
if not entries:
entries = {}
table = Table()
top.add(table)
if my.use_straight_time:
row_list = [my.ST_ROW]
if my.show_overtime:
row_list.append(my.OT_ROW)
prefix_list = ['','ot']
else:
row_list = [my.STT_ROW, my.ENT_ROW]
prefix_list = ['stt','ent']
text = HiddenWdg(my.get_name() )
text.add_class("spt_data")
table.add_color("color", "color")
table.add_styles("width: %spx; float: left"%my.table_width)
for row_to_draw in row_list:
tr = table.add_row()
tr.add_style('line-height','8px')
td = table.add_blank_cell()
offset_width = my.MONTH_WIDTH + my.LEFT_WIDTH+8
td.add_style("min-width: %spx" % offset_width)
td.add(text)
# go through each day and draw an input for overtime
total_hours_st = 0
total_hours_ot = 0
search_key = task.get_search_key()
# Add a label to indicate if the row is straight time or overtime
time_prefix = ''
if row_to_draw == my.OT_ROW:
time_prefix = 'ot'
div = DivWdg()
div.add("OT")
div.add_styles('text-align: right; margin-right: 4px')
td.add(div)
elif row_to_draw == my.STT_ROW:
time_prefix = 'stt'
div = DivWdg()
div.add("ST")
div.add_styles('text-align: right; margin: 0 4px 4px 0')
td.add(div)
elif row_to_draw == my.ENT_ROW:
time_prefix = 'ent'
div = DivWdg()
div.add("ET")
div.add_styles('text-align: right; margin: 0 4px 4px 0')
td.add(div)
for idx, day in enumerate(days):
day_wdg = DivWdg()
#.........这里部分代码省略.........
示例2: SearchLimitWdg
# 需要导入模块: from pyasm.widget import HiddenWdg [as 别名]
# 或者: from pyasm.widget.HiddenWdg import add_style [as 别名]
class SearchLimitWdg(Widget):
DETAIL = "detail_style"
LESS_DETAIL = "less_detail_style"
SIMPLE = "simple_style"
def __init__(self, name='search_limit', label="Showing", limit=None, refresh=True):
self.search_limit_name = name
self.label = label
if limit:
self.search_limit = int(limit)
else:
self.search_limit = None
self.fixed_offset = False
self.style = self.DETAIL
self.prefix = "search_limit"
self.refresh = refresh
self.refresh_script = 'spt.dg_table.search_cbk(evt, bvr)'
if self.refresh:
self.prev_hidden_name = 'Prev'
self.next_hidden_name = 'Next'
else:
self.prev_hidden_name = '%s_Prev' %self.label
self.next_hidden_name = '%s_Next' %self.label
self.chunk_size = 0
self.chunk_num = 0
super(SearchLimitWdg, self).__init__()
def init(self):
self.current_offset = 0
self.count = None
#self.text = TextWdg(self.search_limit_name)
self.text = HiddenWdg(self.search_limit_name)
self.text.add_style("width: 23px")
self.text.add_style("margin-bottom: -1px")
self.text.add_class("spt_search_limit_text")
self.text.set_persist_on_submit(prefix=self.prefix)
behavior = {
'type': 'keydown',
'cbjs_action': '''
if (evt.key=='enter') {
// register this as changed item
var value = bvr.src_el.value;
if (isNaN(value) || value.test(/[\.-]/)) {
spt.error('You have to use an integer.');
}
}
'''}
self.text.add_behavior(behavior)
# get the search limit that is passed in
filter_data = FilterData.get()
values = filter_data.get_values_by_prefix(self.prefix)
if not values:
# check web for embedded table
web = WebContainer.get_web()
values = {}
limit_value = web.get_form_value("search_limit")
label_value = web.get_form_value(self.label)
if limit_value:
values['search_limit'] = limit_value
if label_value:
values[self.label] = label_value
else:
values = values[0]
self.values2 = filter_data.get_values_by_prefix("search_limit_simple")
if not len(self.values2):
self.values2 = {}
elif len(self.values2) == 2:
if self.values2[0]['page']:
self.values2 = self.values2[0]
else:
self.values2 = self.values2[1]
else:
self.values2 = self.values2[0]
self.stated_search_limit = values.get("search_limit")
"""
if not self.stated_search_limit:
self.stated_search_limit = values.get("limit_select")
if not self.stated_search_limit:
self.stated_search_limit = values.get("custom_limit")
"""
if self.stated_search_limit:
self.stated_search_limit = int(self.stated_search_limit)
else:
self.stated_search_limit = 0
# reused for alter_search() later
self.values = values
#.........这里部分代码省略.........