本文整理汇总了Python中UI.sparm方法的典型用法代码示例。如果您正苦于以下问题:Python UI.sparm方法的具体用法?Python UI.sparm怎么用?Python UI.sparm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UI
的用法示例。
在下文中一共展示了UI.sparm方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sparm
# 需要导入模块: import UI [as 别名]
# 或者: from UI import sparm [as 别名]
def sparm(self,parms):
self.msgList = []
if parms == None:
UI.sparm(None)
elif parms[0:4] == "-top":
if len(parms) > 4:
num = int(filter(str.isdigit,parms[5:]))
self.msgList.append("Top " + str(num) + " parameters were selected.")
else:
num = 5
self.msgList.append("Number of paramters to select not specified.")
self.msgList.append("Top 5 parameters were selected.")
self.allData.selectTopParm(num)
if self.selectedData != None:
self.selectedData.selectTopParm(num)
elif parms[0:4] == "-add":
if len(parms) > 4:
parameter = parms[5:]
#check that the paramter is valid
if parameter in self.allData.setOfParms():
if parameter in self.allData.selectParm:
self.msgList.append("Parameter already selected.")
else:
self.allData.addParm(parameter)
if self.selectedData != None:
self.selectedData.addParm(parameter)
self.msgList.append(parameter + " added to selection.")
else:
self.msgList.append(parameter + " not found.")
else:
self.msgList.append("No parameter to add.")
elif parms[0:4] == "-rem":
if len(parms) > 4:
parameter = parms[5:]
#check that the parameter is valid
if parameter in self.allData.selectParm:
self.allData.removeParm(parameter)
if self.selectedData != None:
self.selectedData.removeParm(parameter)
self.msgList.append(parameter + " removed.")
else:
self.msgList.append(parameter + " not in selection.")
else:
self.msgList.append("No parameter to remove.")
else:
self.msgList.append("That selection option does not exist")
if self.allData.selectParm != []:
self.msgList.append("The following parameters are currently selected:")
UI.sparm(self.msgList)
self.ls("-sp")