当前位置: 首页>>代码示例>>Python>>正文


Python SPTDate.start_of_today方法代码示例

本文整理汇总了Python中pyasm.common.SPTDate.start_of_today方法的典型用法代码示例。如果您正苦于以下问题:Python SPTDate.start_of_today方法的具体用法?Python SPTDate.start_of_today怎么用?Python SPTDate.start_of_today使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyasm.common.SPTDate的用法示例。


在下文中一共展示了SPTDate.start_of_today方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: init_data

# 需要导入模块: from pyasm.common import SPTDate [as 别名]
# 或者: from pyasm.common.SPTDate import start_of_today [as 别名]
    def init_data(my):

        sobject = my.get_current_sobject()
        value = sobject.get_value(my.due_date_col)
        if not value:
            my.mode = ""
            return

        status = sobject.get_value("status")

        due_date = parser.parse(value)

        # get today's date
        from pyasm.common import SPTDate
        today = SPTDate.start_of_today()

        # get the difference
        delta = due_date - today
        diff = delta.days


        if diff < 0:
            if status.lower() in ["approved", "complete", "done"]:
                mode = "done"
            else:
                mode = "critical"
        elif diff >= 0 and diff < 1:
            mode = "today"
        else:
            mode = "due"
        
        my.mode = mode
        my.diff = diff
开发者ID:nuxping,项目名称:TACTIC,代码行数:35,代码来源:statistic_wdg.py

示例2: get_display

# 需要导入模块: from pyasm.common import SPTDate [as 别名]
# 或者: from pyasm.common.SPTDate import start_of_today [as 别名]
    def get_display(my):

        div = DivWdg()

        sobject = my.get_current_sobject()
        value = sobject.get_value("bid_end_date")
        if not value:
            return div

        status = sobject.get_value("status")

        due_date = parser.parse(value)

        # get today's date
        from pyasm.common import SPTDate
        today = SPTDate.start_of_today()

        # get the difference
        delta = due_date - today
        diff = delta.days


        if diff < 0:
            if status.lower() in ["approved", "complete", "done"]:
                mode = "done"
            else:
                mode = "critical"
        elif diff >= 0 and diff < 1:
            mode = "today"
        else:
            mode = "due"

        if mode == "critical":
            div.add_style("background: #F00")
            div.add_style("color: #FFF")
            msg = "%s Days" % (-diff)
            div.add_attr("title", msg)
            if diff == -1:
                div.add("Yesterday")
            else:
                div.add(msg)
        elif mode == "today":
            div.add_style("background: #00F")
            div.add_style("color: #FFF")
            div.add_attr("title", "Due today")
            div.add("Today")
        elif mode == "done":
            #div.add_style("background: #0F0")
            #div.add_style("color: #000")
            #div.add_attr("title", "Done")
            #div.add("Done")
            pass
        else:
            div.add_style("background: #FFF")
            div.add_style("color: #000")
            div.add_attr("title", "Due in %s days" % diff)
            if diff == 1:
                div.add("Tomorrow")
            else:
                div.add("%s Days" % diff)


        div.add_style("padding: 3px")
        div.add_style("text-align: center")
        div.add_style("margin: -3px")

        return div
开发者ID:blezek,项目名称:TACTIC,代码行数:69,代码来源:statistic_wdg.py


注:本文中的pyasm.common.SPTDate.start_of_today方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。