本文整理汇总了Python中UI.messages方法的典型用法代码示例。如果您正苦于以下问题:Python UI.messages方法的具体用法?Python UI.messages怎么用?Python UI.messages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UI
的用法示例。
在下文中一共展示了UI.messages方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: import UI [as 别名]
# 或者: from UI import messages [as 别名]
def run(self):
UI.welcome()
self.loadFiles()
UI.messages(self.msgList)
quit = False
#If any of the files did not load, program quits
if self.allData == None:
quit = True
while quit == False:
line = raw_input("~~> ")
self.msgList=[]
if line == "":
pass
elif line == "cmd" or line == "c" or line == "h" or line == "help":
UI.cmds()
elif line[0:2] == "ls":
if len(line) > 3:
self.ls(line[3:])
else:
self.ls(None)
elif line[0:3] == "sel":
if len(line) > 4:
self.sel(line[4:])
else:
self.sel(None)
elif line[0:5] == "sparm":
if len(line) > 6:
self.sparm(line[6:])
else:
self.sparm(None)
elif line[0:4] == "stat":
if len(line) > 5:
self.stat(line[5:])
else:
self.stat(None)
elif line.find("graph") != -1:
if len(line) > 6:
self.graph(line[6:])
else:
self.graph(None)
elif line[0] == "q":
quit = True
else:
self.msgList.append("command not found")
UI.messages([])
示例2: ls
# 需要导入模块: import UI [as 别名]
# 或者: from UI import messages [as 别名]
def ls(self,parms):
lsDict = {}
self.msgList = []
if parms == None:
lsDict = None
elif parms[0:3] == "-as":
lsDict = self.allData.setOfStations()
#add header entry to provide information on what is in the dict
lsDict["Head"] = "station"
elif parms[0:3] == "-ss":
if self.selectedData != None:
lsDict = self.selectedData.setOfStations()
lsDict["Head"] = "station"
else:
lsDict["Head"] = "No stations currently selected. Use sel to make selection"
elif parms[0:3] == "-ap":
lsDict = self.allData.countAllParm()
lsDict["Head"] = "parm"
elif parms[0:3] == "-sp":
if self.allData.selectParm != []:
#if there are stations selected, display the counts for the selected stations
# otherwise, display counts for all data available
if self.selectedData != None:
lsDict = self.selectedData.countSelectParm()
lsDict["Head"] = "parm"
self.msgList.append("*Counts on currently selected stations")
else:
lsDict= self.allData.countSelectParm()
lsDict["Head"] = "parm"
self.msgList.append("*Counts on all available data (no stations selected)")
else:
lsDict["Head"] = "No parameters currently selected. Use sparm to make selection"
elif parms[0:3] == "-ar":
lsDict = self.allData.countAllRivers()
lsDict["Head"] = "river"
elif parms[0:3] == "-sr":
if self.selectedData != None:
lsDict = self.selectedData.countAllRivers()
lsDict["Head"] = "river"
else:
lsDict["Head"] = "No stations currently selected. Use sel to make selection"
elif parms[0:3] == "-ac":
cities = self.allData.cityDict.keys()
for i in cities:
lsDict[i] = ""
lsDict["Head"] = "city"
else:
lsDict["Head"] = "That list option does not exist."
UI.ls(lsDict)
UI.messages(self.msgList)
示例3: graph
# 需要导入模块: import UI [as 别名]
# 或者: from UI import messages [as 别名]
def graph(self,parms):
if parms == None:
UI.graph(None)
else:
if self.selectedData == None:
self.msgList.append("No stations currently selected")
if self.allData.selectParm == []:
self.msgList.append("No parameters currently selected")
if self.selectedData != None and self.allData.selectParm != []:
parms = parms.split(" ")
if len(parms) == 2:
filename = parms[1]
if parms[0] == "-scatter":
if len(self.allData.selectParm) > 1:
self.selectedData.selectScatter(filename)
self.msgList.append("Scatter plots generated.")
else:
self.msgList.append("Must have at least two selected paramters.")
elif parms[0] == "-hist":
self.selectedData.selectHistograms(filename)
self.msgList.append("Histogram generated.")
elif parms[0] == "-bar" or parms[0] == "-box":
self.msgList.append("Need to provide filename")
else:
self.msgList.append("That graph option does not exist.")
elif len(parms) == 3:
filename = parms[2]
if parms[0] == "-bar":
if parms[1] == "all":
self.selectedData.selectBarPlot(filename)
self.msgList.append("Bar plots generated.")
elif parms[1] == "river":
self.selectedData.selectRiverBarPlots(filename)
self.msgList.append("Bar plots generated.")
else:
self.msgList.append("That graph option does not exist.")
elif parms[0] == "-box":
if parms[1] == "m":
self.selectedData.selectBoxPlots(filename,"Month")
self.msgList.append("Box plots generated.")
elif parms[1] == "y":
self.selectedData.selectBoxPlots(filename,"Year")
self.msgList.append("Box plots generated.")
elif parms[1] == "r":
self.selectedData.selectBoxPlots(filename,"River")
self.msgList.append("Box plots generated.")
else:
self.msgList.append("That graph option does not exist.")
else:
self.msgList.append("That graph option does not exist.")
UI.messages(self.msgList)
self.msgList = []