本文整理汇总了Python中UI.sel方法的典型用法代码示例。如果您正苦于以下问题:Python UI.sel方法的具体用法?Python UI.sel怎么用?Python UI.sel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UI
的用法示例。
在下文中一共展示了UI.sel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sel
# 需要导入模块: import UI [as 别名]
# 或者: from UI import sel [as 别名]
def sel(self,parms):
riverCount = {}
if parms == None:
UI.sel(None)
elif parms[0:4] == "-all":
pass
elif parms[0:6] == "-river":
if len(parms) > 7:
river = parms[7:]
#check if the river is valid
if river in self.allData.countAllRivers():
#create the selection
self.selectedData = self.allData.selectRiver(river)
self.selectionLog = [parms] #log the selection
riverCount = self.selectedData.countAllRivers()
self.msgList.append(river + " selected. "+ str(riverCount[river])\
+ " stations added to selection.")
else:
self.msgList.append("No data for specified river found.")
else:
self.msgList.append("No river specified.")
elif parms[0:4] == "-add":
if len(parms) > 5:
river = parms[5:]
if river in self.allData.countAllRivers():
#if there is no current selection, the append function will generate the selection
if self.selectedData == None:
#create the selection
self.selectedData = self.allData.selectRiver(river)
self.selectionLog = [parms] #log the selection
riverCount = self.selectedData.countAllRivers()
self.msgList.append(river + " selected. "+ str(riverCount[river])\
+ " stations added to selection.")
#self.ls("-sr")
#check that the river is valid and data has been generated for selectData
else:
#append function called on all data (which is the source of the new
# data to append to the selected data)
self.allData.addRiver(self.selectedData,river)
self.selectionLog.append(parms) #log the selection
riverCount = self.selectedData.countAllRivers()
self.msgList.append(river + "added. "+ str(riverCount[river])\
+ " stations added to selection.")
else:
self.msgList.append("No data for specified river found.")
else:
self.msgList.append("No river specified.")
elif parms[0:4] == "-rem":
if len(parms) > 5:
river = parms[5:]
if river in self.selectedData.countAllRivers():
self.allData.removeRiver(self.selectedData,river)
self.selectionLog.append(parms) #log the selection
self.msgList.append(river + " removed from selection")
#check that there are sites remainin in selection
# empty selection if not
if self.selectedData.numOfStations() == 0:
self.selectedData = None
else:
self.msgList.append("River not in selected data.")
else:
self.msgList.append("No river specified.")
elif parms[0:5] == "-city":
if len(parms) > 6:
#parse the input
city = filter(str.isalpha,parms[6:])
kms = filter(str.isdigit,parms[6:])
if city != "" and kms != "":
#check that the city is valid
if city in self.allData.cityDict:
#create the selection
self.selectedData = self.allData.selectCity(city, int(kms))
#.........这里部分代码省略.........