本文整理汇总了Python中view.View.days_str方法的典型用法代码示例。如果您正苦于以下问题:Python View.days_str方法的具体用法?Python View.days_str怎么用?Python View.days_str使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类view.View
的用法示例。
在下文中一共展示了View.days_str方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: convertDate
# 需要导入模块: from view import View [as 别名]
# 或者: from view.View import days_str [as 别名]
def convertDate(self, dictionary):
view = View()
if "day" in dictionary.keys():
dictionary["day"] = view.days_str(dictionary["day"])
if "startTime" in dictionary.keys():
dictionary["startTime"] = view.time_str(dictionary["startTime"])
if "endTime" in dictionary.keys():
dictionary["endTime"] = view.time_str(dictionary["endTime"])
示例2: Producer
# 需要导入模块: from view import View [as 别名]
# 或者: from view.View import days_str [as 别名]
#.........这里部分代码省略.........
self.savequeue()
print "Roger that. Your command queue:"
self.printqueue()
elif cmds[0]=="del":
if len(cmds)!=2:
warning = "format: del <calendar name>"
print warning
continue
else:
if not self.dataPass(cmds):
print "Wrong Input"
continue
self.queue.put({"operation":"del", "app_name":cmds[1]})
self.savequeue()
print "Roger that. Your command queue:"
self.printqueue()
elif cmds[0]=="viewlocal":
if len(cmds)!=1:
warning = "format: viewlocal"
print warning
continue
else:
print "Roger that. Your local commited log:"
self.showCalendar()
print "Your calendar:"
print self.constructCalendar().keys()
elif cmds[0]=="view":
if len(cmds)!=1:
warning = "format: view"
print warning
continue
else:
self.queue.put({"operation":"view"})
self.savequeue()
print "Roger that. Your command queue:"
self.printqueue()
elif cmds[0]=="log":
if len(cmds)!=1:
warning = "format: log"
print warning
continue
else:
print "Roger that. Your local log:"
self.showCalendar(committed = False)
elif cmds[0]=="queue":
if len(cmds)!=1:
warning = "format: queue"
print warning
continue
else:
print "Roger that. Your command FIFO queue:"
self.printqueue()
else:
print "Unknown command. Only accept add/del/view/log"
print "-" * 32
time.sleep(1)
def showCalendar(self, record = None, committed = True):
if not record: record = self.readlog()
try:
print "<" * 25
for entryID in range(10000):
if entryID in record.keys():
if committed:
if "commitVal" in record[entryID].keys():
self.convertDate(record[entryID]["commitVal"])
print entryID, " | ",
print record[entryID]["commitVal"].values()
else:
print entryID, ":",
print record[entryID]
print ">" * 25
except:
print "Empty"
def convertDate(self, dictionary):
if "day" in dictionary.keys():
dictionary["day"] = self.view.days_str(dictionary["day"])
if "startTime" in dictionary.keys():
dictionary["startTime"] = self.view.time_str(dictionary["startTime"])
if "endTime" in dictionary.keys():
dictionary["endTime"] = self.view.time_str(dictionary["endTime"])
def savequeue(self):
f = open('user.queue', 'w')
f.write(str(list(self.queue.queue)))
def printqueue(self):
print str(list(self.queue.queue))
def readqueue(self):
queue = Queue.Queue()
try:
f = open('user.queue', 'r')
for line in f:
queue.queue = deque(eval(line))
except:
""
finally:
return queue