def currentChanged(self, current, previous): QTreeView.currentChanged(self, current, previous) device_path = self.model().itemFromIndex(current).data() logging.debug('device selected: ' + device_path) device_props_tree_widget.clear() device_props_tree_widget.addTopLevelItems([ item for item in iter_device_props_tree_items( device_path, devices_dict[device_path]) ]) device_props_tree_widget.expandAll() if self.history_push_flag: self.history_push(device_path) self.history_push_flag = True