def transferModel(self): """ Transfer the current status of the model into the PMR information object. """ pmr_info = PMR() hosts = pmr_info.hosts() host_names_remove = [name for name in hosts] host_names_new = [] active_host = None index = 0 current_item = self._model.item(index) while current_item: current_host = current_item.text() if current_host in host_names_remove: host_names_remove.remove(current_host) else: host_names_new.append(current_host) if current_item.checkState() == QtCore.Qt.Checked: active_host = current_host index += 1 current_item = self._model.item(index) pmr_info.setActiveHost(active_host) for host in host_names_remove: pmr_info.removeHost(host) for host in host_names_new: pmr_info.addHost(host)
def _updateModel(self): pmr_info = PMR() for instance in pmr_info.hosts(): self.addHost(instance, instance == pmr_info.activeHost())