forked from michaelmarty/UniDec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Launcher.py
158 lines (129 loc) · 5.18 KB
/
Launcher.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
import warnings
warnings.simplefilter(action="ignore", category=FutureWarning)
import wx
from unidec_modules.unidec_presbase import UniDecPres
from unidec_modules.unidec_enginebase import UniDecEngine
import multiprocessing
import GUniDec
import datacollector
from metaunidec import mudpres
from import_wizard import ImportWizard
from metaunidec.meta_import_wizard.meta_import_wizard import ImportWizard as HDF5Wizard
from metaunidec.ultrameta import DataCollector as UMDC
import wx.py as py
import sys
import os
class UniDecLauncher(UniDecPres):
"""
Main UniDec GUI Application.
Presenter contains UniDec engine at self.eng and main GUI window at self.view
"""
def __init__(self, *args, **kwargs):
"""
Initialize App
:param args:
:param kwargs:
:return: UniDecApp object
"""
UniDecPres.__init__(self, *args, **kwargs)
self.init(*args, **kwargs)
def init(self, *args, **kwargs):
self.view = Lview(self)
self.view.Bind(wx.EVT_CLOSE, self.on_close)
def on_close(self, e=None):
self.quit_application()
self.view.Destroy()
sys.exit()
class Lview(wx.Frame):
def __init__(self, parent):
self.eng = UniDecEngine()
wx.Frame.__init__(self, None, title="UniDec Launcher Version " + str(self.eng.version))
sizer = wx.GridBagSizer(wx.HORIZONTAL)
panel = wx.Panel(self)
button1 = wx.Button(panel, -1, "UniDec\n\nDeconvolve MS and IM-MS")
button2 = wx.Button(panel, -1, "Data Collector\n\nVisualize multiple spectra\nExtract Trends\nFit Kd's")
button3 = wx.Button(panel, -1, "Import Wizard\n\nBatch convert Waters Raw to Txt")
button4 = wx.Button(panel, -1, "MetaUniDec\n\nBatch process and visualize MS spectra")
button5 = wx.Button(panel, -1, "UniDec API Shell\n\nScript UniDec processing using command line interface")
button6 = wx.Button(panel, -1, "HDF5 Import Wizard\n\nImport Data into HDF5 for MetaUniDec")
button7 = wx.Button(panel, -1, "UltraMeta Data Collector\n\nVisualize Multiple HDF5 Data Sets\nFit Trends")
html = wx.html.HtmlWindow(panel, -1, size=(330,260))
pathtofile = os.path.dirname(os.path.abspath(__file__))
self.imagepath = os.path.join(pathtofile, "UniDecLogoMR.png")
#print(self.imagepath)
html.SetPage(
"<html><body>"
#"<h1>UniDec</h1>"
"<img src=\"" + self.imagepath +"\" alt=\"PNG Icon\" height=\"200\" width=\"290\">"
"<p>Please Cite: Marty et al. Anal. Chem. 2015. "
"DOI: 10.1021/acs.analchem.5b00140.</p>"
"</body></html>"
)
sizer.Add(button1, (0, 0), flag=wx.EXPAND)
sizer.Add(button2, (1, 0), flag=wx.EXPAND)
sizer.Add(button3, (2, 0), flag=wx.EXPAND)
sizer.Add(button4, (0, 1), flag=wx.EXPAND)
sizer.Add(button6, (2, 1), flag=wx.EXPAND)
sizer.Add(button7, (1, 1), flag=wx.EXPAND)
sizer.Add(button5, (3, 0), span=(1, 2), flag=wx.EXPAND)
sizer.Add(html, (0, 2), span=(4, 2))
self.Bind(wx.EVT_BUTTON, self.button1, button1)
self.Bind(wx.EVT_BUTTON, self.button2, button2)
self.Bind(wx.EVT_BUTTON, self.button3, button3)
self.Bind(wx.EVT_BUTTON, self.button4, button4)
self.Bind(wx.EVT_BUTTON, self.button5, button5)
self.Bind(wx.EVT_BUTTON, self.button6, button6)
self.Bind(wx.EVT_BUTTON, self.button7, button7)
panel.SetSizer(sizer)
sizer.Fit(self)
self.Centre()
self.Show(True)
def button1(self, e=None):
print("Launching UniDec")
app = GUniDec.UniDecApp()
app.start()
def button2(self, e=None):
print("Launching Data Collector")
app = wx.App(False)
frame = datacollector.DataCollector(None, "Collect Data")
app.MainLoop()
def button3(self, e=None):
print("Launching Waters Converter Wizard")
app = wx.App(False)
frame = ImportWizard(None)
frame.Show()
app.MainLoop()
def button4(self, e=None):
print("Launching MetaUniDec")
app = mudpres.UniDecApp()
app.start()
def button5(self, e=None):
print("Launching Scripting Shell")
app = Shell()
app.start()
def button6(self, e=None):
print("Launching HDF5 Import Wizard")
app = wx.App(False)
frame = HDF5Wizard(None)
frame.Show()
app.MainLoop()
def button7(self, e=None):
print("Launching UltraMeta Data Collector")
app = wx.App(False)
frame = UMDC(None, "UltraMeta Data Collector")
app.MainLoop()
class Shell(object):
def __init__(self, *args, **kwargs):
self.__wx_app = wx.App(redirect=True)
self.shell = py.shell.Shell(wx.Frame(None))
self.shellwindow = py.shell.ShellFrame(self.shell, title="UniDecShell").Show()
# self.shell.Execute('app=UniDecApp()')
# self.shell.Execute('app.start()')
# self.shellwindow.Center()
# self.shell.setFocus()
self.__wx_app.MainLoop()
if __name__ == '__main__':
# app2 = Shell()
multiprocessing.freeze_support()
app = UniDecLauncher()
app.start()