Beispiel #1
0
    def on_click_refresh(self):
        self.devices = find_vial_devices(self.via_stack_json,
                                         self.sideload_vid, self.sideload_pid)
        self.combobox_devices.clear()

        for dev in self.devices:
            self.combobox_devices.addItem(dev.title())
Beispiel #2
0
    def on_click_refresh(self):
        self.devices = find_vial_devices(self.via_stack_json, self.sideload_vid, self.sideload_pid)
        self.combobox_devices.clear()

        for dev in self.devices:
            self.combobox_devices.addItem(dev.title())

        if self.devices:
            self.lbl_no_devices.hide()
            self.tabs.show()
        else:
            self.lbl_no_devices.show()
            self.tabs.hide()
Beispiel #3
0
    def update(self, check_protocol=False):
        if self.locked:
            return

        new_devices = find_vial_devices(self.via_stack_json,
                                        self.sideload_vid,
                                        self.sideload_pid,
                                        quiet=True,
                                        check_protocol=check_protocol)

        # if the set of the devices didn't change at all, don't need to update the combobox
        old_paths = set(d.desc["path"] for d in self.devices)
        new_paths = set(d.desc["path"] for d in new_devices)
        if old_paths == new_paths:
            return

        # trigger update and report whether a hard-reload is needed (if current device went away)
        self.devices = new_devices
        old_path = "blank"
        if self.current_device is not None:
            old_path = self.current_device.desc["path"]
        self.devices_updated.emit(new_devices, old_path not in new_paths)
Beispiel #4
0
 def find_device_with_uid(self, cls, uid):
     devices = find_vial_devices({"definitions": {}})
     for dev in devices:
         if isinstance(dev, cls) and dev.get_uid() == uid:
             return dev
     return None