UnityMol  0.9.6-875
UnityMol viewer / In developement
LoadGUI.cs
Go to the documentation of this file.
1 using UnityEngine;
2 using Molecule.View;
3 using UnityEngine.UI;
4 using Molecule.Model;
5 using UI;
6 
7 public class LoadGUI : MonoBehaviour {
8 
9  public Toggle hetToggle;
10  public Toggle waterToggle;
11  public Toggle connect_pdbToggle;
12  public Toggle connect_calcToggle;
13  public Toggle hirerna;
14  public InputField pdb_id;
15  public InputField proxy_serv;
16  public InputField proxy_port;
17 
18 
19  void Awake(){
20 
21  }
22 
23  void Start() {
24  //Adding all listeners to the UI Objects
25  waterToggle.onValueChanged.AddListener (delegate{
26  waterToggle.GetComponent<GUILinker>().SetBool (ref UIData.readWater);
27  });
28  hetToggle.onValueChanged.AddListener (delegate{hetToggle.GetComponent<GUILinker>().SetBool (ref UIData.readHetAtom);});
29  connect_pdbToggle.onValueChanged.AddListener (delegate{
30  connect_pdbToggle.GetComponent<GUILinker>().SetBool (ref UIData.connectivity_PDB);
31  });
32  connect_calcToggle.onValueChanged.AddListener (delegate{
33  connect_calcToggle.GetComponent<GUILinker>().SetBool (ref UIData.connectivity_calc);
34  });
35 
36  pdb_id.onEndEdit.AddListener (delegate{
37  pdb_id.GetComponent<GUILinker>().SetString (ref GUIDisplay.pdbID);
38  });
39  proxy_serv.onEndEdit.AddListener (delegate {
40  proxy_serv.GetComponent<GUILinker> ().SetString (ref GUIDisplay.proxyServer);
41  });
42  proxy_port.onEndEdit.AddListener (delegate {
43  proxy_port.GetComponent<GUILinker> ().SetString (ref GUIDisplay.proxyPort);
44  });
45 
46  hirerna.onValueChanged.AddListener (isOn => {
47  UIData.loadHireRNA = isOn;
48  });
49  }
50 
51 
52  public void Fetch()
53  {
54  //clear before fetching again
55  if (UIData.isOpenFile == true) {
57  }
58 
60  UIData.fetchPDBFile = true;
61  UIData.isOpenFile = true;
62 
63 
64  UIData.atomtype=UIData.AtomType.hyperball;
65  UIData.bondtype=UIData.BondType.hyperstick;
66 
68  //TODO : Remove that and do it in the editor (add the gameobject to disactivate)
69  GameObject.Find("Canvas/Menu/Side Panel/Load Menu/Open").SetActive(false);
70 
71 
72  }
73 
74 
75  public void OpenFileCallback() {
76 
77  // Use the file explorer
78  GameObject filebro = GameObject.Find("File Bro Panel");
79  FileBro filebroscript = filebro.GetComponent<FileBro>();
80 
81  string path = filebroscript.fileToOpen;
82  if(path == "")
83  return;
84 
85  //clear before fetching again
86  if (UIData.isOpenFile == true) {
88  }
89 
90  if (UIData.loadHireRNA == false) {
91  UIData.ffType = UIData.FFType.atomic;
93  }
94  else
95  {
96  UIData.ffType = UIData.FFType.HiRERNA;
98  }
99 
100  GUIDisplay.directorypath = System.IO.Path.GetDirectoryName(path);
101  GUIDisplay.file_base_name = GUIDisplay.directorypath + System.IO.Path.DirectorySeparatorChar +
102  System.IO.Path.GetFileNameWithoutExtension(path);
103  GUIDisplay.file_extension = System.IO.Path.GetExtension(path).Substring(1);
104 
105  GUIDisplay.id = System.IO.Path.GetFileNameWithoutExtension(path);
106 
107 
108  UIData.fetchPDBFile = false;
109  UIData.isOpenFile=true;
110  UIData.atomtype=UIData.AtomType.hyperball;
111  UIData.bondtype=UIData.BondType.hyperstick;
112 
113  //TODO : Remove that and do it in the editor (add the gameobject to disactivate)
114  GameObject.Find("Canvas/Menu/Side Panel/Load Menu/Open").SetActive(false);
115  }
116 
117 
118 }
void OpenFileCallback()
Definition: LoadGUI.cs:75
Toggle waterToggle
Definition: LoadGUI.cs:10
static void InitHiRERNA()
Definition: AtomModel.cs:227
static bool fetchPDBFile
Definition: UIData.cs:93
static bool isOpenFile
Definition: UIData.cs:100
static string proxyServer
Definition: GUIDisplay.cs:109
static string id
Definition: GUIDisplay.cs:123
void Awake()
Definition: LoadGUI.cs:19
static string file_base_name
Definition: GUIDisplay.cs:120
static FFType ffType
Definition: UIData.cs:241
void Start()
Definition: LoadGUI.cs:23
static bool connectivity_calc
Definition: UIData.cs:112
static string directorypath
Definition: GUIDisplay.cs:118
InputField proxy_port
Definition: LoadGUI.cs:16
static string pdbID
Definition: GUIDisplay.cs:107
static bool loadHireRNA
Definition: UIData.cs:240
static bool readWater
Definition: UIData.cs:111
static string proxyPort
Definition: GUIDisplay.cs:110
!WiP Includes FLAGS of GUI.
Definition: UIData.cs:78
static BondType bondtype
Definition: UIData.cs:141
Toggle connect_calcToggle
Definition: LoadGUI.cs:12
!WiP manage GUI, and provide static strings for the GUI.
Definition: GUIDisplay.cs:94
string fileToOpen
Definition: FileBro.cs:11
static string file_extension
Definition: GUIDisplay.cs:121
Toggle hirerna
Definition: LoadGUI.cs:13
Toggle connect_pdbToggle
Definition: LoadGUI.cs:11
static void InitAtomic()
Inits the atomic and chains scales.
Definition: AtomModel.cs:180
static AtomType atomtype
Definition: UIData.cs:139
InputField pdb_id
Definition: LoadGUI.cs:14
InputField proxy_serv
Definition: LoadGUI.cs:15
static bool readHetAtom
Definition: UIData.cs:110
static void clearScene()
Clears the scene.
Definition: Molecule3D.cs:156
void Fetch()
Definition: LoadGUI.cs:52
Toggle hetToggle
Definition: LoadGUI.cs:9
static bool connectivity_PDB
Definition: UIData.cs:113
Definition: GUIDisplay.cs:66