Skip to content

Commit

Permalink
Changed subject-layout to be stacked with top/bottom button layouts
Browse files Browse the repository at this point in the history
  • Loading branch information
jstout211 committed Oct 11, 2024
1 parent a130c71 commit 8ce416a
Showing 1 changed file with 37 additions and 7 deletions.
44 changes: 37 additions & 7 deletions nih2mne/GUI/qt_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,17 +192,50 @@ def override_mri(self):
## create the window

class BIDS_Project_Window(QMainWindow):
def __init__(self, bids_root=os.getcwd(), gridsize_row=10, gridsize_col=6,
def __init__(self, bids_root=os.getcwd(), gridsize_row=8, gridsize_col=5,
bids_project=None):
super(BIDS_Project_Window, self).__init__()
self.setGeometry(100,100, 250*gridsize_col, 100*gridsize_row)
self.setWindowTitle(f'BIDS Folder: {bids_root}')
self.gridsize_row = gridsize_row
self.gridsize_col = gridsize_col
self.bids_project = bids_project
self.initUI()
main_layout = QVBoxLayout()

# Setup up Top Button Row
top_buttons_layout = QHBoxLayout()
self.b_choose_bids_root = QPushButton('BIDS Directory')
self.b_choose_bids_root.clicked.connect(self.select_bids_root)
top_buttons_layout.addWidget(self.b_choose_bids_root)
main_layout.addLayout(top_buttons_layout)

# Add Subject Chooser Layer
subjs_layout = self.init_subjects_layout()
main_layout.addLayout(subjs_layout)

# Add Bottom Row Buttons
bottom_buttons_layout = QHBoxLayout()
self.b_run_freesurfer = QPushButton('Run Freesurfer')
self.b_run_freesurfer.clicked.connect(self.proc_freesurfer)
bottom_buttons_layout.addWidget(self.b_run_freesurfer)
main_layout.addLayout(top_buttons_layout)

def initUI(self):
# Finalize Widget and dispaly
widget = QWidget()
widget.setLayout(main_layout)
self.setCentralWidget(widget)

# def setup_full_layout(self):

def proc_freesurfer(self):
self.bids_project.run_anat_pipeline()


def select_bids_root(self):
self.bids_root = QtWidgets.QFileDialog.getExistingDirectory(self, 'Select Folder')


def init_subjects_layout(self):
subjs_layout = QGridLayout()
subject_keys = sorted(list(self.bids_project.subjects.keys()))

Expand All @@ -216,11 +249,8 @@ def initUI(self):
bids_info = self.bids_project.subjects[subject_keys[i]]
subjs_layout.addWidget(Subject_Tile(bids_info), row_idx, col_idx)
i+=1
return subjs_layout

widget = QWidget()
widget.setLayout(subjs_layout)
self.setCentralWidget(widget)

def clicked(self):
self.label.setText('you pressed the button')
self.label.adjustSize()
Expand Down

0 comments on commit 8ce416a

Please sign in to comment.