def __init__(self, lib_dir=None, passive=True, config=None, status_callback=None, ports_callback=None, monitor_callback=None, change_callback=None, do_create_block_factory=True, blockfactory=None) : """ default value for ALL meta is None, stick with it """ super(Workbench, self).__init__(lib_dir=lib_dir, do_create_block_factory=do_create_block_factory, blockfactory=blockfactory) self.config = config all_in_one_arduino_dir = self.config.get("Path", "all_in_one_arduino_dir") if config else "" self.__board = None self.__port = None self.__board_types = build.get_board_types(all_in_one_arduino_dir=all_in_one_arduino_dir) self.__blob = None self.__blob_time = None self.__callbacks = {} self.__callbacks["status"] = status_callback self.__callbacks["ports"] = ports_callback self.__callbacks["monitor"] = monitor_callback self.__change_callback = change_callback self.__port_check_time = 1.0 self.__ports = [] self.__should_finish = False self.__messages = Queue() self.__jobs = Queue() #XXX if not passive : self.set_port_list(build.get_ports()) if passive or not Workbench.MULTITHREADED : print("running single-threaded!!!") else : self.tmr = Thread(target=self.__timer_thread) self.tmr.start()
def rescan_ports(self) : self.set_port_list(build.get_ports())