本文整理汇总了Python中pyasm.common.Common.get_display_title方法的典型用法代码示例。如果您正苦于以下问题:Python Common.get_display_title方法的具体用法?Python Common.get_display_title怎么用?Python Common.get_display_title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.common.Common
的用法示例。
在下文中一共展示了Common.get_display_title方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: filter_line_handler
# 需要导入模块: from pyasm.common import Common [as 别名]
# 或者: from pyasm.common.Common import get_display_title [as 别名]
def filter_line_handler(my, path, line):
'''NOT used now'''
return line
# this is only called if the project code is different from the
# template code
file_name = os.path.basename(path)
if file_name in ['sthpw_project.spt']:
# change codes to project code
if line.startswith('''insert.set_value('code','''):
line = '''insert.set_value('code', """%s""")\n''' % my.project_code
elif line.startswith('''insert.set_value('title','''):
title = Common.get_display_title(my.project_code)
line = '''insert.set_value('title', """%s""")\n''' % title
elif line.startswith('''insert.set_value('is_template','''):
if my.is_template:
line = '''insert.set_value('is_template', """true""")\n'''
else:
line = '''insert.set_value('is_template', """false""")\n'''
elif file_name in ['sthpw_schema.spt']:
if line.startswith('''insert.set_value('code','''):
line = '''insert.set_value('code', """%s""")\n''' % my.project_code
elif file_name in ['sthpw_pipeline.spt']:
if line.startswith('''insert.set_value('project_code','''):
line = '''insert.set_value('project_code', """%s""")\n''' % my.project_code
return line
示例2: get_data
# 需要导入模块: from pyasm.common import Common [as 别名]
# 或者: from pyasm.common.Common import get_display_title [as 别名]
def get_data(my, sobject):
values = []
labels = []
if not my.config:
return values, labels
for element in my.elements:
options = my.config.get_display_options(element)
attrs = my.config.get_element_attributes(element)
label = attrs.get('title')
if not label:
label = Common.get_display_title(element)
labels.append(label)
expression = options.get("expression")
if not expression:
value = 0
else:
value = Search.eval(expression, sobject, single=True)
values.append(value)
return values, labels
示例3: get_related_wdg
# 需要导入模块: from pyasm.common import Common [as 别名]
# 或者: from pyasm.common.Common import get_display_title [as 别名]
def get_related_wdg(my, aliases):
div = DivWdg()
div.add("<b>Related links</b>:  ")
div.add_style("margin-top: 5px")
div.add_style("margin-bottom: 5px")
div.add_style("margin-left: 10px")
titles = [Common.get_display_title(x.replace("-"," ")) for x in aliases]
for alias, title in zip(aliases, titles):
link_div = SpanWdg()
div.add(link_div)
link_div.add_color("background", "background")
link_div.add(title)
link_div.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
spt.help.set_top();
spt.help.load_alias("%s");
''' % alias
} )
link_div.add_class("spt_link")
link_div.add_class("hand")
return div
示例4: get_title
# 需要导入模块: from pyasm.common import Common [as 别名]
# 或者: from pyasm.common.Common import get_display_title [as 别名]
def get_title(self):
if self.title:
title = self.title
title = title.replace(r'\n','<br/>')
if self.title.find("->") != -1:
parts = self.title.split("->")
title = parts[-1]
else:
title = self.name
if self.name.find("->") != -1:
parts = self.name.split("->")
title = parts[-1]
if not title:
title = ""
else:
title = Common.get_display_title(title)
title = _(title)
from pyasm.web import DivWdg
div = DivWdg()
div.add_attr("title", title)
div.add_style("margin-top", "6px")
div.add(title)
return div
示例5: set_all_tasks
# 需要导入模块: from pyasm.common import Common [as 别名]
# 或者: from pyasm.common.Common import get_display_title [as 别名]
def set_all_tasks(my, sobject, process, status):
tasks = Task.get_by_sobject(sobject, process=process)
title = status.replace("-", " ")
title = title.replace("_", " ")
title = Common.get_display_title(title)
for task in tasks:
task.set_value("status", title)
task.commit()
示例6: get_info_wdg
# 需要导入模块: from pyasm.common import Common [as 别名]
# 或者: from pyasm.common.Common import get_display_title [as 别名]
def get_info_wdg(self, sobject):
div = DivWdg()
div.add_style("margin: 10px 20px 20px 20px")
div.add_style("padding: 0px 20px")
#div.add_color("background", "background", -3)
#div.add_border()
#div.add_color("color", "color3")
#div.set_round_corners(5)
div.add_style("height", "100%")
div.add_style("position: relative")
element_names = self.element_names
config = self.config
table = Table()
table.add_style("height", "100%")
div.add(table)
for element_name in element_names:
table.add_row()
title = Common.get_display_title(element_name)
td = table.add_cell("%s: " % title)
td.add_style("width: 200px")
td.add_style("padding: 5px")
element = config.get_display_widget(element_name)
if self.first:
try:
element.handle_layout_behaviors(self.layout_wdg)
except Exception as e:
print "e :", e
pass
element.set_sobject(sobject)
element.preprocess()
td = table.add_cell(element)
td.add_style("padding: 5px")
#value = sobject.get_value(element_name, no_exception=True) or "N/A"
#table.add_cell(value)
show_notes = self.kwargs.get("show_notes")
if show_notes in [True, 'true']:
div.add("<br/>")
from tactic.ui.widget import DiscussionWdg
search_key = sobject.get_search_key()
notes_wdg = DiscussionWdg(search_key=search_key)
notes_wdg.set_sobject(sobject)
div.add(notes_wdg)
return div
示例7: configure_category
# 需要导入模块: from pyasm.common import Common [as 别名]
# 或者: from pyasm.common.Common import get_display_title [as 别名]
def configure_category(my, title, category, options, options_type = {}):
div = DivWdg()
title_wdg = DivWdg()
div.add(title_wdg)
#from tactic.ui.widget.swap_display_wdg import SwapDisplayWdg
#swap = SwapDisplayWdg()
#div.add(swap)
title_wdg.add("<b>%s</b>" % title)
table = Table()
div.add(table)
#table.add_color("color", "color")
table.add_style("color: #000")
table.add_style("margin: 20px")
for option in options:
table.add_row()
display_title = Common.get_display_title(option)
td = table.add_cell("%s: " % display_title)
td.add_style("width: 150px")
option_type = options_type.get(option)
validation_scheme = ""
#add selectWdg for those options whose type is bool
if option_type == 'bool':
text = SelectWdg(name="%s/%s" % (category, option))
text.set_option('values','true|false')
text.set_option('empty','true')
text.add_style("margin-left: 0px")
elif option.endswith('password'):
text = PasswordInputWdg(name="%s/%s" % (category, option))
# dealing with options whose type is number
else:
if option_type == 'number':
validation_scheme = 'INTEGER'
else:
validation_scheme = ""
text = TextInputWdg(name="%s/%s" % (category, option), validation_scheme=validation_scheme, read_only="false")
value = Config.get_value(category, option)
if value:
text.set_value(value)
table.add_cell(text)
return div
示例8: get_info_wdg
# 需要导入模块: from pyasm.common import Common [as 别名]
# 或者: from pyasm.common.Common import get_display_title [as 别名]
def get_info_wdg(my, sobject):
div = DivWdg()
div.add_style("margin: 10px 20px 20px 20px")
div.add_style("padding: 20px")
div.add_color("background", "background", -3)
div.add_border()
div.add_color("color", "color3")
div.set_round_corners(5)
div.add_style("height", "100%")
div.add_style("position: relative")
element_names = my.kwargs.get("element_names")
if not element_names:
element_names = ["code","name","description",]
else:
element_names = element_names.split(",")
view = "table"
from pyasm.widget import WidgetConfigView
search_type = sobject.get_search_type()
config = WidgetConfigView.get_by_search_type(search_type, view)
table = Table()
table.add_style("height", "100%")
div.add(table)
for element_name in element_names:
table.add_row()
title = Common.get_display_title(element_name)
td = table.add_cell("%s: " % title)
td.add_style("width: 200px")
td.add_style("padding: 5px")
element = config.get_display_widget(element_name)
element.set_sobject(sobject)
element.preprocess()
td = table.add_cell(element)
td.add_style("padding: 5px")
#value = sobject.get_value(element_name, no_exception=True) or "N/A"
#table.add_cell(value)
div.add("<br/>")
from tactic.ui.widget import DiscussionWdg
search_key = sobject.get_search_key()
notes_wdg = DiscussionWdg(search_key=search_key)
notes_wdg.set_sobject(sobject)
div.add(notes_wdg)
return div
示例9: get_title
# 需要导入模块: from pyasm.common import Common [as 别名]
# 或者: from pyasm.common.Common import get_display_title [as 别名]
def get_title(my):
'''Returns a widget containing the title to be displayed for this
column'''
if my.title:
title = my.title
return title
title = my.name
if not title:
title = ""
return title
title = Common.get_display_title(title)
return title
示例10: _get_title
# 需要导入模块: from pyasm.common import Common [as 别名]
# 或者: from pyasm.common.Common import get_display_title [as 别名]
def _get_title(my, config, element_name):
attributes = config.get_element_attributes(element_name)
title = attributes.get("title")
if not title:
title = Common.get_display_title(element_name)
if '.' in title:
parts = title.split('.', 1)
title = parts[1]
if not title or title == ' ':
title = "(%s)" % element_name
return title
示例11: register
# 需要导入模块: from pyasm.common import Common [as 别名]
# 或者: from pyasm.common.Common import get_display_title [as 别名]
def register(my, name, db_resource, tables=None):
db_name = db_resource.get_database()
project_code = "db_resource/%s" % db_name
# create a virtual project
project = SearchType.create("sthpw/project")
# FIXME: what is this conflicts with an existing project
project.set_value("code", project_code)
project.set_value("db_resource", db_resource)
# put this sobject into the cache
from pyasm.biz import Project
key = "sthpw/project|%s" % project_code
Project.cache_sobject(key, project)
if tables == None:
# introspect and resister all of the tables
sql = DbContainer.get(db_resource)
table_info = sql.get_table_info()
if table_info.get("spt_search_type"):
print "has search_type"
tables = table_info.keys()
for table in tables:
# FIXME: how is this created
search_type = "table/%s?project=%s" % (table, db_name)
#search_type_obj = SearchType.create("config/search_type")
search_type_obj = SearchType.create("sthpw/search_type")
search_type_obj.set_value("search_type", "table/%s" % table)
search_type_obj.set_value("title", Common.get_display_title(table) )
search_type_obj.set_value("table_name", table)
search_type_obj.set_value("database", db_name)
SearchType.set_virtual(search_type, search_type_obj)
my.db_resources[name] = db_resource
示例12: handle_headers
# 需要导入模块: from pyasm.common import Common [as 别名]
# 或者: from pyasm.common.Common import get_display_title [as 别名]
def handle_headers(my, table):
# this comes from refresh
widths = my.kwargs.get("column_widths")
# Add the headers
tr = table.add_row()
tr.add_class("spt_table_header_row")
for i, widget in enumerate(my.widgets):
widget_name = widget.get_name()
th = table.add_header()
th.add_style("text-align: left")
th.add_attr("spt_element_name", widget_name)
header_div = DivWdg()
th.add(header_div)
th.add_style("padding: 3px")
th.add_gradient("background", "background", -5, -10)
th.add_border()
if my.mode == 'widget':
value = widget.get_title()
else:
element = widget_name
value = Common.get_display_title(element)
header_div.add(value)
if widths and len(widths) > i:
th.add_style("width", widths[i])
width_set = True
width = widths[i]
else: # get width from definition
width = my.attributes[i].get("width")
if width:
th.add_style("width", width)
width_set = True
if width:
th.add_style("min-width", width)
else:
th.add_style("overflow","hidden")
widget.handle_th(th, i)
示例13: get_title
# 需要导入模块: from pyasm.common import Common [as 别名]
# 或者: from pyasm.common.Common import get_display_title [as 别名]
def get_title(my):
if my.title:
title = my.title
title = title.replace(r'\n','<br/>')
else:
title = my.name
if not title:
title = ""
else:
title = Common.get_display_title(title)
from pyasm.web import DivWdg
div = DivWdg()
div.add_attr("title", title)
div.add(title)
return div
# FIXME: not sure about autofit here? This should be a mode
"""
示例14: get_title
# 需要导入模块: from pyasm.common import Common [as 别名]
# 或者: from pyasm.common.Common import get_display_title [as 别名]
def get_title(my):
if my.title:
title = my.title
title = title.replace(r'\n','<br/>')
else:
title = my.name
if not title:
title = ""
else:
title = Common.get_display_title(title)
title = _(title)
from pyasm.web import DivWdg
div = DivWdg()
div.add_attr("title", title)
div.add(title)
return div
示例15: get_custom_menu
# 需要导入模块: from pyasm.common import Common [as 别名]
# 或者: from pyasm.common.Common import get_display_title [as 别名]
def get_custom_menu(my):
menu_items = []
for tool in my.custom_tools:
view = tool.get_value("view")
title = tool.get_value("title")
if not title:
title = Common.get_display_title(view)
menu_item = {
"type": "action",
"label": title,
"bvr_cb": {
"title": title,
"view": view,
"cbjs_action": """
var activator = spt.smenu.get_activator(bvr);
var layout = activator.getParent(".spt_layout");
var selected = spt.table.get_selected_search_keys();
var kwargs = {
view: bvr.view,
search_keys: selected
}
var class_name = 'tactic.ui.panel.CustomLayoutWdg';
try {
spt.panel.load_popup(bvr.title, class_name, kwargs);
} catch(e) {
spt.alert(spt.exception.handler(e));
}
""",
},
}
menu_items.append(menu_item)
return {"menu_tag_suffix": "CUSTOM", "width": 210, "opt_spec_list": menu_items}