本文整理汇总了Python中pyasm.search.SObject.is_day_column方法的典型用法代码示例。如果您正苦于以下问题:Python SObject.is_day_column方法的具体用法?Python SObject.is_day_column怎么用?Python SObject.is_day_column使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.search.SObject
的用法示例。
在下文中一共展示了SObject.is_day_column方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from pyasm.search import SObject [as 别名]
# 或者: from pyasm.search.SObject import is_day_column [as 别名]
def get_display(my):
top = DivWdg()
value = my.get_value()
widget_type = my.get_option("type")
if widget_type in ['integer', 'float', 'timecode', 'currency']:
top.add_style("float: right")
my.justify = "right"
elif widget_type in ['date','time']:
name = my.get_name()
if value and not SObject.is_day_column(name):
value = SPTDate.convert_to_local(value)
value = str(value)
else:
top.add_style("float: left")
my.justify = "left"
top.add_style("padding-right: 3px")
top.add_style("min-height: 15px")
format = my.get_option('format')
value = my.get_format_value( value, format )
top.add(value)
return top
示例2: get_display
# 需要导入模块: from pyasm.search import SObject [as 别名]
# 或者: from pyasm.search.SObject import is_day_column [as 别名]
def get_display(my):
sobject = my.get_current_sobject()
column = my.kwargs.get('column')
if column:
name = column
else:
name = my.get_name()
value = my.get_value(name=name)
if sobject:
data_type = SearchType.get_column_type(sobject.get_search_type(), name)
else:
data_type = 'text'
if type(value) in types.StringTypes:
wiki = WikiUtil()
value = wiki.convert(value)
if name == 'id' and value == -1:
value = ''
elif data_type == "timestamp" or name == "timestamp":
if value == 'now':
value = ''
elif value:
# This date is assumed to be GMT
date = parser.parse(value)
# convert to local
if not SObject.is_day_column(name):
date = SPTDate.convert_to_local(date)
try:
encoding = locale.getlocale()[1]
value = date.strftime("%b %d, %Y - %H:%M").decode(encoding)
except:
value = date.strftime("%b %d, %Y - %H:%M")
else:
value = ''
else:
if isinstance(value, Widget):
return value
elif not isinstance(value, basestring):
try:
value + 1
except TypeError:
value = str(value)
else:
value_wdg = DivWdg()
value_wdg.add_style("float: right")
value_wdg.add_style("padding-right: 3px")
value_wdg.add( str(value) )
return value_wdg
return value
示例3: get_display
# 需要导入模块: from pyasm.search import SObject [as 别名]
# 或者: from pyasm.search.SObject import is_day_column [as 别名]
def get_display(my):
top = DivWdg()
value = my.get_value()
widget_type = my.get_option("type")
if widget_type in ['integer', 'float', 'timecode', 'currency']:
top.add_style("float: right")
my.justify = "right"
elif widget_type in ['date','time']:
name = my.get_name()
if value and not SObject.is_day_column(name):
value = my.get_timezone_value(value)
value = str(value)
else:
top.add_style("float: left")
my.justify = "left"
top.add_style("padding-right: 3px")
top.add_style("min-height: 15px")
format = my.get_option('format')
value = my.get_format_value( value, format )
top.add(value)
sobject = my.get_current_sobject()
if sobject:
column = my.kwargs.get('column')
if column:
name = column
else:
name = my.get_name()
top.add_update( {
'search_key': sobject.get_search_key(),
'column': name,
'format': format
} )
return top
示例4: get_text_value
# 需要导入模块: from pyasm.search import SObject [as 别名]
# 或者: from pyasm.search.SObject import is_day_column [as 别名]
def get_text_value(my):
value = my.get_value()
widget_type = my.get_option("type")
if widget_type in ['date','time']:
name = my.get_name()
if not SObject.is_day_column(name):
value = my.get_timezone_value(value)
value = str(value)
format = my.get_option('format')
if format == 'Checkbox':
value = str(value)
else:
value = my.get_format_value( value, format )
return value
示例5: get_display
# 需要导入模块: from pyasm.search import SObject [as 别名]
# 或者: from pyasm.search.SObject import is_day_column [as 别名]
def get_display(my):
sobject = my.get_current_sobject()
column = my.kwargs.get('column')
if column:
name = column
else:
name = my.get_name()
value = my.get_value(name=name)
if sobject:
data_type = SearchType.get_column_type(sobject.get_search_type(), name)
else:
data_type = 'text'
if type(value) in types.StringTypes:
wiki = WikiUtil()
value = wiki.convert(value)
if name == 'id' and value == -1:
value = ''
elif data_type in ["timestamp","time"] or name == "timestamp":
if value == 'now':
value = ''
elif value:
# This date is assumed to be GMT
date = parser.parse(value)
# convert to user timezone
if not SObject.is_day_column(name):
date = my.get_timezone_value(date)
try:
encoding = locale.getlocale()[1]
value = date.strftime("%b %d, %Y - %H:%M").decode(encoding)
except:
value = date.strftime("%b %d, %Y - %H:%M")
else:
value = ''
else:
if isinstance(value, Widget):
return value
elif not isinstance(value, basestring):
try:
value + 1
except TypeError:
value = str(value)
#else:
# value_wdg.add_style("float: right")
# value_wdg.add_style("padding-right: 3px")
if sobject and SearchType.column_exists(sobject.get_search_type(), name):
value_wdg = DivWdg()
value_wdg.add_update( {
'search_key': sobject.get_search_key(),
'column': name
} )
# don't call str() to prevent utf-8 encode error
value_wdg.add(value)
return value_wdg
return value
示例6: get_display
# 需要导入模块: from pyasm.search import SObject [as 别名]
# 或者: from pyasm.search.SObject import is_day_column [as 别名]
def get_display(self):
sobject = self.get_current_sobject()
column = self.kwargs.get('column')
if column:
name = column
else:
name = self.get_name()
value = self.get_value(name=name)
empty = self.get_option("empty")
if empty and self.is_editable() and not value:
from pyasm.web import SpanWdg
div = DivWdg()
div.add_style("text-align: center")
div.add_style("width: 100%")
div.add_style("white-space: nowrap" )
if empty in [True, 'true']:
div.add("--Select--")
div.add_style("opacity: 0.5")
return div
if sobject:
data_type = SearchType.get_column_type(sobject.get_search_type(), name)
else:
data_type = 'text'
if type(value) in types.StringTypes:
wiki = WikiUtil()
value = wiki.convert(value)
if name == 'id' and value == -1:
value = ''
elif data_type in ["timestamp","time"] or name == "timestamp":
if value == 'now':
value = ''
elif value:
# This date is assumed to be GMT
date = parser.parse(value)
# convert to user timezone
if not SObject.is_day_column(name):
date = self.get_timezone_value(date)
try:
encoding = locale.getlocale()[1]
value = date.strftime("%b %d, %Y - %H:%M").decode(encoding)
except:
value = date.strftime("%b %d, %Y - %H:%M")
else:
value = ''
else:
if isinstance(value, Widget):
return value
elif not isinstance(value, basestring):
try:
value + 1
except TypeError:
value = str(value)
#else:
# value_wdg.add_style("float: right")
# value_wdg.add_style("padding-right: 3px")
if sobject and SearchType.column_exists(sobject.get_search_type(), name):
value_wdg = DivWdg()
self.add_value_update(value_wdg, sobject, name)
# don't call str() to prevent utf-8 encode error
value_wdg.add(value)
value_wdg.add_style("overflow-x: hidden")
value_wdg.add_style("text-overflow: ellipsis")
# sompe properties
min_height = 25
value_wdg.add_style("min-height: %spx" % min_height)
single_line = self.get_option("single_line") or False
if single_line in ["true", True]:
value_wdg.add_style("line-height: %spx" % min_height)
value_wdg.add_style("white-space: nowrap")
#value_wdg.add_style("overflow-y: hidden")
#value_wdg.add_class("spt_scrollable")
#value_wdg.add_attr("title", value)
link_expression = self.get_option("link_expression")
if link_expression:
value_wdg.add_class("tactic_new_tab")
value_wdg.add_style("display: inline-block")
#.........这里部分代码省略.........