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


Python State.to_string方法代码示例

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


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

示例1: main

# 需要导入模块: from State import State [as 别名]
# 或者: from State.State import to_string [as 别名]

#.........这里部分代码省略.........
  if not (options.daemon or options.once or options.showall):
    universe.verbose = True
    show_notes = False
    state = State(generate=True, localonly=True)
    if not state.is_valid(localonly=True):
      report(colour.red + 'Problem generating state' + colour.end)
      sys.exit(1)
    # Show as a tree
    #if False:
    #  #state.aiyo.show_tree(notes=show_notes, activeonly=True)
    #  state.aiyo.show_tree(notes=show_notes, availableonly=True)

    state.active.show(show_notes=show_notes, wait_separate=True, priority_only=options.priorityonly, inbox_only=options.inboxonly)
    state.aiyo.show_error(show_notes=show_notes)

    
  # Need to contact caldav server
  if options.daemon or options.once or options.showall:
    from time import sleep
    from datetime import timedelta
    state_previous = State(load=True)
    #if not state_previous.is_valid():
    #  report(colour.red + 'Problem loading state' + colour.end)
    #  sys.exit(1)

    if options.showall:
      state = State(generate=True)
      if not state.is_valid():
        report(colour.red + 'Problem generating state' + colour.end)
        sys.exit(1)
      state.aiyo.show_tree()
      if state_previous.is_valid():
        report('-- STATE PREVIOUS')
        report(state_previous.to_string())
      report('-- STATE')
      report(state.to_string())
      sys.exit()

    if not state_previous.is_valid():
      report(colour.blue+'No previous state found, saving current state and continuing'+colour.end)
      state = State(generate=True)
      if not state.is_valid():
        report(colour.red + 'Problem generating state' + colour.end)
        sys.exit(1)
      state.save()
      state_previous = State(load=True)
      if not state_previous.is_valid():
        report(colour.red + 'Problem loading state' + colour.end)
        sys.exit(1)
      if not state_previous.is_valid():
        error('State generation and save error, exiting')
        sys.exit()

    #for t in state_previous.caldav.events:
    #  report('  ' + t.name + ' | ' + t.parents[0])

    #sys.exit()
    def task_props(state, state_previous, name, pre):
      ap = ''
      a  = ''
      cp = ''
      c  = ''
      try:
        a  = state.active.find_tasks_by_name(name=name)[0]
      except: pass
      try:
开发者ID:adamcandy,项目名称:Gaia,代码行数:70,代码来源:Server.py


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