-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwindow.py
153 lines (93 loc) · 4.78 KB
/
window.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
import glob, os, sys
from PyQt4 import QtGui, QtCore
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from neuron_editor import NeuronEditor
#from rat_tools import RatTools
class Window(QtGui.QMainWindow):
def __init__(self):
super(Window, self).__init__()
self.setGeometry(50, 50, 500, 300)
#self.setWindowTitle("OpenNeuron")
self.setWindowIcon(QtGui.QIcon('pythonlogo.png'))
#Set widget to show up with viewbox
toolMenu = QtGui.QMenuBar()
toolMenu.setNativeMenuBar(False) # <--Sets the menu with the widget; otherwise shows up as global (i.e. at top desktop screen)
self.setMenuBar(toolMenu)
#***** TEXT PARAMETERS FIELDS ******
self.animal_name_text=''
self.rec_name_text=''
#Load default experiment
#self.animal.rec_length = self.animal.tsf.n_vd_samples/float(self.animal.tsf.SampleFrequency)
#Menu Item Lists
self.make_menu()
#LOAD CENTRAL WIDGET
self.central_widget = QtGui.QStackedWidget()
self.setCentralWidget(self.central_widget)
#SET DEFAULT WIDGET TO PROCESS
#self.load_widget = Load(self)
#self.central_widget.addWidget(self.load_widget)
self.show()
def make_menu(self):
#PROCESSING MENUS
cnmfCaiman = QtGui.QAction("&CNMF - CaIman", self)
cnmfCaiman.setStatusTip('CNMF - CaImAn')
cnmfCaiman.triggered.connect(self.cnmf_caiman)
#REVIEW MENUS
reviewNeurons = QtGui.QAction("&Review ROIs", self)
reviewNeurons.setStatusTip('Review ROIs')
reviewNeurons.triggered.connect(self.review_neurons)
#ENSEMBLE MENUS
viewEnsembles = QtGui.QAction("&Review ROIs", self)
viewEnsembles.setStatusTip('Review ROIs')
viewEnsembles.triggered.connect(self.view_ensembles)
exitApplication = QtGui.QAction("&Exit Application", self)
exitApplication.setStatusTip('Exit')
exitApplication.triggered.connect(self.close_application)
#MAKE TOP BAR MENUO
mainMenu = self.menuBar()
fileMenu = mainMenu.addMenu('&File')
fileMenu.addAction(exitApplication)
fileMenu = mainMenu.addMenu('Process')
fileMenu.addAction(cnmfCaiman)
fileMenu = mainMenu.addMenu('Review')
fileMenu.addAction(reviewNeurons)
fileMenu = mainMenu.addMenu('Ensembles')
fileMenu.addAction(viewEnsembles)
#********************************************************************************
#***************************** LOAD FILE MENUS **********************************
#********************************************************************************
def cnmf_caiman(self):
#print "... clicked on cnmf_caiman...."
print "... running cnmf_caiman..."
return
self.load_widget.load_mouse(self) #Pass main widget to subwidgets as it contains needed parameters.
self.exp_type = 'mouse'
#RESTART Process widget with updated info; SEEMS THERE IS A BETTER WAY TO DO THIS
self.load_widget = Neuron(self)
self.central_widget.addWidget(self.load_widget)
self.central_widget.setCurrentWidget(self.load_widget)
def review_neurons(self):
print "... clicked on view_patches...."
#self.load_widget.load_mouse_lever(self) #Pass main widget to subwidgets as it contains needed parameters.
#self.exp_type = 'mouse_lever'
#RESTART Process widget with updated info; SEEMS THERE IS A BETTER WAY TO DO THIS
self.load_widget = NeuronEditor(self)
self.central_widget.addWidget(self.load_widget)
self.central_widget.setCurrentWidget(self.load_widget)
def view_ensembles(self):
print "... clicked on view_patches.... NOT IMPLEMENTED"
#RESTART Process widget with updated info; SEEMS THERE IS A BETTER WAY TO DO THIS
#self.load_widget = NeuronEditor(self)
#self.central_widget.addWidget(self.load_widget)
#self.central_widget.setCurrentWidget(self.load_widget)
def close_application(self):
print("...clean exit, good job! ")
sys.exit()
#************************************************************************
#************************* EXP TOOLS MENUS ******************************
#************************************************************************
def ophys_tools(self):
ophys_widget = EventTriggeredImaging(self)
self.central_widget.addWidget(ophys_widget)
self.central_widget.setCurrentWidget(ophys_widget)