def apply(self, event, *args): """Apply the best results.""" #TODO: Confirmation message box? positions = [] # And add the fixed ones, if any if self.params.fixed_orientations: positions += self.params.fixed_orientations_list # Get the angles of the best one positions += model.optimization.get_angles(self.best) print "Applying best individual", self.best #This deletes everything in the list in the instrument del model.instrument.inst.positions[:] #Make sure to clear the parameters too, by giving it an empty dict() object. display_thread.clear_positions_selected() #This function does the calc. and shows a progress bar. Can be aborted too. gui_utils.do_calculation_with_progress_bar(positions) #GUI update model.messages.send_message(model.messages.MSG_POSITION_LIST_CHANGED) #Add it to the list of selected items if len(model.instrument.inst.angles) == 1: model.instrument.inst.sort_positions_by(0) display_thread.select_position_coverage(model.instrument.inst.positions, update_gui=True) if not event is None: event.Skip()
def delete_all(self): """Deletes all entries in the position list.""" #This deletes everything in the list del model.instrument.inst.positions[:] #Make sure to clear the parameters too, by giving it an empty dict() object. display_thread.clear_positions_selected() #Update the display. self.update_grid()