def on_module_changed(self, item): # todo: handle exception # Check first if the checkbox have changed need_update = False new_state = item.checkState(0) == QtCore.Qt.Checked new_text = item.text(0) module = item.rig if item._checked != new_state: item._checked = new_state # Handle checkbox change if new_state: self._build(module) else: self._unbuild(module) need_update = True ui_shared._update_network(self._rig, item=item) # Check if the name have changed if (item._name != new_text): item._name = new_text module.name = new_text # Update directly the network value instead of re-exporting it if hasattr(item, "net"): name_attr = item.net.attr("name") name_attr.set(new_text) # Ensure to only refresh the UI and not recreate all if need_update: self.refresh_ui()
def on_unlock_selected(self): need_update = False for item in self.ui.treeWidget.selectedItems(): val = item.rig if isinstance(val, classModule.Module) and val.locked: need_update = True val.locked = False if need_update: ui_shared._update_network(self._rig) self.update()
def on_rebuild_selected(self): for qItem in self.ui.treeWidget.selectedItems(): val = qItem.rig self._unbuild(val) self._build(val) ui_shared._update_network(self._rig)
def on_build_selected(self): for val in self.get_selected_modules(): self._build(val) ui_shared._update_network(self._rig) self.update()