protected override void OnDestroy()
 {
     base.OnDestroy();                    //releases any UI locks on the editor
     GameEvents.onEditorRestart.Remove(this.on_editor_new);
     KerbalXActionGroupInterface.close(); //destroy action group interface (if it is open)
     KerbalXImageSelector.close();        //destroy image selector (if it is open)
     KerbalXDialog.close();               //destroy dialog (if one is open)
 }
        //reset interface
        internal void reset()
        {
            KerbalX.log("Resetting UploadInterface");
            KerbalXActionGroupInterface.close();        //destroy action group interface (if it is open)
            KerbalXImageSelector.close();               //destroy image selector (if it is open)
            KerbalXDialog.close();                      //destroy dialog (if one is open)
            pictures.Clear();                           //remove all selected pictures
            selected_style_index = 0;                   //reset selected craft style to default (Ship)
            selected_craft_id    = 0;                   //reset selected_craft_id (0 is non-value Database ID)
            update_message       = null;
            List <string> keys = new List <string>(action_groups.Keys);

            foreach (string key in keys)                 //revert all values for action groups back to empty string
            {
                action_groups[key] = "";
            }
            clear_errors();                             //remove all errors (will also call autoheight, which is why this is called last)
        }