~martin-decky/helenos/rcu

« back to all changes in this revision

Viewing changes to tools/xtui.py

  • Committer: Martin Decky
  • Date: 2010-01-04 23:19:22 UTC
  • Revision ID: martin@hefaistos.decky.cz-20100104231922-ciddeg5vqrp1jjza
add support for implicit choices even in text-based configuration

Show diffs side-by-side

added added

removed removed

Lines of Context:
212
212
                if (position != None):
213
213
                        sys.stdout.write("Selection[%s]: " % str(position + 1))
214
214
                else:
215
 
                        sys.stdout.write("Selection: ")
 
215
                        if (cnt > 0):
 
216
                                sys.stdout.write("Selection[1]: ")
 
217
                        else:
 
218
                                sys.stdout.write("Selection[0]: ")
216
219
                inp = sys.stdin.readline()
217
220
                
218
221
                if (not inp):
221
224
                if (not inp.strip()):
222
225
                        if (position != None):
223
226
                                return (None, position)
224
 
                        continue
 
227
                        else:
 
228
                                if (cnt > 0):
 
229
                                        inp = '1'
 
230
                                else:
 
231
                                        inp = '0'
225
232
                
226
233
                if (inp.strip() == 'q'):
227
234
                        return ('cancel', None)