def gui(): """remove libraries by GUI.""" sel = psidialogs.multi_choice(libraries(), 'select libraries to remove from %s!' % libraries_dir(), title='remove boards') print('%s selected' % sel) if sel: if psidialogs.ask_yes_no('Do you really want to remove selected libraries?\n' + '\n'.join(sel)): for x in sel: remove_lib(x) print('%s was removed' % x)
def ynbox(message="Shall I continue?", title=""): """Original doc: Display a message box with choices of Yes and No. The default is "Yes". Returns returns 1 if "Yes" is chosen, or if the dialog is cancelled (which is interpreted as choosing the default). Otherwise returns 0. If invoked without a message parameter, displays a generic request for a confirmation that the user wishes to continue. So it can be used this way: if ynbox(): pass # continue else: sys.exit(0) # exit the program """ return psidialogs.ask_yes_no(message=message, title=title)
def gui(): """remove libraries by GUI.""" sel = psidialogs.multi_choice(libraries(), 'select libraries to remove from %s!' % libraries_dir(), title='remove boards') print('%s selected' % sel) if sel: if psidialogs.ask_yes_no( 'Do you really want to remove selected libraries?\n' + '\n'.join(sel)): for x in sel: remove_lib(x) print('%s was removed' % x)
def askyesno(title=None, message=None, **options): """Original doc: Ask a question; return true if the answer is yes""" return psidialogs.ask_yes_no(title=title, message=message)