add current_selection to SelectablePopup

This commit is contained in:
Nick 2011-02-10 01:11:31 +01:00
parent cd7805bfda
commit cdcab320fb
1 changed files with 5 additions and 0 deletions

View File

@ -206,6 +206,11 @@ class SelectablePopup(Popup):
self.parent.add_string(crow,"- %s%s"%(colorstr,line),self.screen,1,False,True) self.parent.add_string(crow,"- %s%s"%(colorstr,line),self.screen,1,False,True)
crow+=1 crow+=1
def current_selection(self):
"Returns a tuple of (selected index, selected data)"
idx = self._selectable_lines.index(self._selected)
return (idx,self._select_data[idx])
def add_divider(self,color="white"): def add_divider(self,color="white"):
if not self._divider: if not self._divider:
self._divider = "-"*(self.width-6)+" -" self._divider = "-"*(self.width-6)+" -"