def newVariable(self): from packages.vtDV3D.vtUtilities import memoryLogger memoryLogger.log("start QDefinedVariableWidget.newVariable") varProp = self.root.varProp varProp.label.setText("Load From") for i in range(varProp.originTabWidget.count()): if not str(varProp.originTabWidget.tabText(i)) in ["Edit",]: varProp.originTabWidget.setTabEnabled(i,True) else: varProp.originTabWidget.setTabEnabled(i,False) if varProp.originTabWidget.tabText(i)=="File": varProp.originTabWidget.setCurrentIndex(i) varProp.show() return varProp
def deleteVariable(self, varid): """ Remove variable from dict and project """ from packages.vtDV3D import ModuleStore from packages.vtDV3D.vtUtilities import memoryLogger memoryLogger.log("start QDefinedVariableWidget.deleteVariable") for i in range(self.varList.count()-1,-1,-1): if self.varList.item(i).getVarName() == varid: success = True #this will delete from all projects for project in self.varList.item(i).projects: controller = self.root.get_project_controller_by_name(project) if controller: if controller.remove_defined_variable(varid): self.varList.takeItem(i) else: success = False ModuleStore.removeActiveVariable( varid ) if success and varid in __main__.__dict__: del __main__.__dict__[varid] memoryLogger.log("finished QDefinedVariableWidget.deleteVariable")