예제 #1
0
 def showlist(self, control, msg, items, prefix):
     if isinstance(items[0], basestring):
         items = [(i, '', 'OFF') for i in items]
     else:
         items = [(k, prefix + v, s) for k, v, s in items]
     extra = self.calc_height(msg) + flatten(items)
     return shlex.split(self.run(control, msg, extra).value)
예제 #2
0
 def menu(self, msg='', items=(), prefix=' - '):
     if isinstance(items[0], basestring):
         items = [(i, '') for i in items]
     else:
         items = [(k, prefix + v) for k, v in items]
     extra = self.calc_height(msg) + flatten(items)
     return self.run('menu', msg, extra).value
예제 #3
0
 def showlist(self, control, msg, items, prefix):
     if isinstance(items[0], basestring):
         items = [(i, '', 'OFF') for i in items]
     else:
         items = [(k, prefix + v, s) for k, v, s in items]
     extra = self.calc_height(msg) + flatten(items)
     return shlex.split(self.run(control, msg, extra).value)
예제 #4
0
 def menu(self, msg='', items=(), prefix=' - '):
     if isinstance(items[0], basestring):
         items = [(i, '') for i in items]
     else:
         items = [(k, prefix + v) for k, v in items]
     extra = self.calc_height(msg) + flatten(items)
     return self.run('menu', msg, extra).value
예제 #5
0
파일: test_base.py 프로젝트: marwano/utile
 def test_flatten(self):
     self.assertEqual(flatten([(0, 1), (2, 3)]), [0, 1, 2, 3])