本文整理汇总了Python中pyasm.widget.TextWdg.get_value方法的典型用法代码示例。如果您正苦于以下问题:Python TextWdg.get_value方法的具体用法?Python TextWdg.get_value怎么用?Python TextWdg.get_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.widget.TextWdg
的用法示例。
在下文中一共展示了TextWdg.get_value方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_config_wdg
# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import get_value [as 别名]
def get_config_wdg(my):
widget = Widget()
search = Search("sthpw/widget_config")
div = DivWdg(css="filter_box")
span = SpanWdg(css="med")
span.add("Search Type: ")
select = FilterSelectWdg("config_search_type")
select.add_empty_option("-- Select --")
search_type_search = Search("sthpw/search_object")
search_type_search.add_order_by("search_type")
span.add(select)
project = Project.get()
project_type = project.get_base_type()
filter = search.get_regex_filter("search_type", "login|task|note|timecard", "EQ")
search_type_search.add_where(
"""
namespace = '%s' or namespace = '%s' or %s
"""
% (project_type, project.get_code(), filter)
)
select.set_search_for_options(search_type_search, value_column="search_type")
div.add(span)
search_type_value = select.get_value()
span = SpanWdg()
view_text = TextWdg("view")
view_text.set_persist_on_submit()
span.add("View: ")
span.add(view_text)
div.add(span)
widget.add(div)
view = view_text.get_value()
if view:
search.add_filter("view", view)
if search_type_value:
search.add_filter("search_type", search_type_value)
table = TableWdg("sthpw/widget_config")
table.set_search(search)
widget.add(table)
return widget
示例2: init
# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import get_value [as 别名]
def init(my):
search = Search("sthpw/queue")
search.add_order_by("priority desc")
search.add_order_by("timestamp desc")
widget = Widget()
div = DivWdg(css="filter_box")
span = SpanWdg(css="med")
from pyasm.prod.web import SearchFilterWdg
search_filter = SearchFilterWdg(columns=Queue.get_search_columns())
search_filter.alter_search(search)
span.add(search_filter)
div.add(span)
span = SpanWdg(css="med")
priority_wdg = TextWdg("priority_search")
priority_wdg.set_persistence()
priority = priority_wdg.get_value()
if priority:
search.add_filter("priority", priority)
span.add("Priority: ")
span.add(priority_wdg)
div.add(span)
select = SelectWdg("queue_state")
select.set_option("values", "|pending|locked|error|done")
select.set_option("labels", "All|pending|locked|error|done")
select.add_event("onchange", "document.form.submit()")
select.set_persistence()
span = SpanWdg(css="med")
span.add("State: ")
span.add(select)
div.add(span)
queue_state = select.get_value()
if queue_state != "":
search.add_filter("state", queue_state)
user_select = SelectWdg("user_select")
user_select.add_empty_option()
user_search = Search("sthpw/login")
user_select.set_search_for_options(user_search, "login", "login")
user_select.add_event("onchange", "document.form.submit()")
user_select.set_persistence()
div.add("User: ")
div.add(user_select)
queue_user = user_select.get_value()
if queue_user != "":
search.add_filter("login", queue_user)
search_limit = SearchLimitWdg()
search_limit.set_limit(10)
div.add(search_limit)
search_limit.alter_search(search)
widget.add(div)
sobjects = search.get_sobjects()
table = TableWdg("sthpw/queue")
table.set_sobjects(sobjects)
widget.add(table)
my.add(widget)
示例3: get_first_row_wdg
# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import get_value [as 别名]
def get_first_row_wdg(my):
# read the csv file
my.file_path = ""
div = DivWdg()
div.add( my.get_upload_wdg() )
if not my.search_type:
return div
if not my.file_path:
return div
if not my.file_path.endswith(".csv"):
div.add( "Uploaded file [%s] is not a csv file"% my.file_path)
return div
if not os.path.exists(my.file_path):
raise Exception("Path '%s' does not exists" % my.file_path)
div.add(HtmlElement.br(2))
div.add( HtmlElement.b("The following is taken from first line in the uploaded csv file. Select the appropriate column to match.") )
div.add(HtmlElement.br())
div.add( HtmlElement.b("Make sure you have all the required columns** in the csv."))
option_div = DivWdg()
option_div.add_style("float: left")
option_div.add_style("margin-right: 30px")
option_div.add("<p>3. Parsing Options:</p>")
my.search_type_obj = SearchType.get(my.search_type)
# first row and second row
option_div.add( HtmlElement.br(2) )
option_div.add("Use Title Row: ")
title_row_checkbox = FilterCheckboxWdg("has_title")
title_row_checkbox.set_default_checked()
option_div.add(title_row_checkbox)
option_div.add( HintWdg("Set this to use the first row as a title row to match up columns in the database") )
option_div.add( HtmlElement.br(2) )
option_div.add("Sample Data Row: ")
data_row_text = TextWdg("data_row")
data_row_text.set_attr("size", "3")
option_div.add(data_row_text)
option_div.add( HintWdg("Set this as a sample data row to match the columns to the database") )
option_div.add( HtmlElement.br(2) )
div.add(option_div)
my.has_title = title_row_checkbox.is_checked()
# parse the first fow
csv_parser = CsvParser(my.file_path)
if my.has_title:
csv_parser.set_has_title_row(True)
else:
csv_parser.set_has_title_row(False)
csv_parser.parse()
csv_titles = csv_parser.get_titles()
csv_data = csv_parser.get_data()
data_row = data_row_text.get_value()
if not data_row:
data_row = 0
else:
try:
data_row = int(data_row)
except ValueError:
data_row = 0
if data_row >= len(csv_data):
data_row = len(csv_data)-1
data_row_text.set_value(data_row)
table = Table()
table.set_attr("cellpadding", "10")
table.add_row()
table.add_header("CSV Column Value")
table.add_header("TACTIC Column")
table.add_header("Create New Column")
columns = my.search_type_obj.get_columns()
search_type = my.search_type_obj.get_base_search_type()
sobj = SObjectFactory.create(search_type)
required_columns = sobj.get_required_columns()
#.........这里部分代码省略.........