def _select_driver(current): """ Display driver selection dialog. :param current: Name of currently selected driver :return: Name of newly selected driver """ print(colorize("Please select a device driver from the following list:", colorama.Fore.BLUE)) # Add None as an option to configure spreads without a device available_drivers = plugin.available_drivers() + [None] print(" [0]: Keep current ({0})".format(current)) for pos, ext in enumerate(available_drivers, 1): print(" [{0}]: {1}".format(pos, ext)) while True: selection = raw_input("Select a driver: ") if not selection or int(selection) == 0: return current if not selection.isdigit() or int(selection) > len(available_drivers): print(colorize("Please select a number in the range of 0 to {0}" .format(len(available_drivers)), colorama.Fore.RED)) continue driver = unicode(available_drivers[int(selection)-1]) print(colorize("Selected \"{0}\" as device driver".format(driver), colorama.Fore.GREEN)) return driver
def create_driver_widgets(self): self.driver_label = ttk.Label(self, text="Select a driver") self.driver_label.grid(column=0, row=2, sticky="E") self.driver_select = ttk.Combobox( self, values=plugin.available_drivers(), state="readonly") self.driver_select.bind("<<ComboboxSelected>>", self.on_update_driver) self.driver_select.grid(column=1, row=2, sticky="WE") self.orient_label = ttk.Label(self, text="Set device for target pages", state="disabled") self.orient_label.grid(column=0, row=3, columnspan=2) self.orient_odd_btn = ttk.Button( self, text="Odd pages", state="disabled", command=lambda: self.set_orientation('odd')) self.orient_odd_btn.grid(column=0, row=4) self.orient_even_btn = ttk.Button( self, text="Even pages", state="disabled", command=lambda: self.set_orientation('even')) self.orient_even_btn.grid(column=1, row=4) self.focus_label = ttk.Label(self, text="Configure focus", state="disabled") self.focus_label.grid(column=0, row=5, columnspan=2) self.focus_btn = ttk.Button(self, text="Start", state="disabled", command=self.configure_focus) self.focus_btn.grid(column=0, row=6, columnspan=2)
def _select_driver(current): """ Display driver selection dialog. :param current: Name of currently selected driver :return: Name of newly selected driver """ print( colorize("Please select a device driver from the following list:", colorama.Fore.BLUE)) # Add None as an option to configure spreads without a device available_drivers = plugin.available_drivers() + [None] print(" [0]: Keep current ({0})".format(current)) for pos, ext in enumerate(available_drivers, 1): print(" [{0}]: {1}".format(pos, ext)) while True: selection = raw_input("Select a driver: ") if not selection or int(selection) == 0: return current if not selection.isdigit() or int(selection) > len(available_drivers): print( colorize( "Please select a number in the range of 0 to {0}".format( len(available_drivers)), colorama.Fore.RED)) continue driver = unicode(available_drivers[int(selection) - 1]) print( colorize("Selected \"{0}\" as device driver".format(driver), colorama.Fore.GREEN)) return driver
def _select_driver(): print(colorize("Please select a device driver from the following list:", colorama.Fore.BLUE)) available_drivers = plugin.available_drivers() for pos, ext in enumerate(plugin.available_drivers(), 1): print(" [{0}]: {1}".format(pos, ext)) while True: selection = raw_input("Select a driver: ") if not selection.isdigit() or int(selection) > len(available_drivers): print(colorize("Please select a number in the range of 1 to {0}" .format(len(available_drivers)), colorama.Fore.RED)) continue driver = unicode(available_drivers[int(selection)-1]) print(colorize("Selected \"{0}\" as device driver".format(driver), colorama.Fore.GREEN)) return driver
def _select_driver(): print( colorize("Please select a device driver from the following list:", colorama.Fore.BLUE)) available_drivers = plugin.available_drivers() for pos, ext in enumerate(plugin.available_drivers(), 1): print(" [{0}]: {1}".format(pos, ext)) while True: selection = raw_input("Select a driver: ") if not selection.isdigit() or int(selection) > len(available_drivers): print( colorize( "Please select a number in the range of 1 to {0}".format( len(available_drivers)), colorama.Fore.RED)) continue driver = unicode(available_drivers[int(selection) - 1]) print( colorize("Selected \"{0}\" as device driver".format(driver), colorama.Fore.GREEN)) return driver