Skip to content

Commit

Permalink
Make ara-tools default options with 2 registration types
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorTatarnikov committed Dec 16, 2024
1 parent 2b96d46 commit 75f70f5
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions brainglobe_registration/widgets/transform_select_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,25 +76,27 @@ def __init__(self, parent=None):

# Set up the table
self.setColumnCount(2)
self.setRowCount(len(self.transform_type_options))
# Set row count to one less as rigid will not be shown by default
self.setRowCount(len(self.transform_type_options) - 1)
self.setHorizontalHeaderLabels(["Transform Type", "Default File"])

# Add dropdown menus to the table for each transform type option
for i in range(len(self.transform_type_options) - 1):
# Subtract 2 to exclude the empty and rigid options
for i in range(len(self.transform_type_options) - 2):
# Create and configure the transform type dropdown menu
self.transform_type_selections.append(QComboBox())
self.transform_type_selections[i].addItems(
self.transform_type_options
)
self.transform_type_selections[i].setCurrentIndex(i + 1)
self.transform_type_selections[i].setCurrentIndex(i + 2)
self.transform_type_selections[i].currentIndexChanged.connect(
self.transform_type_signaller.map
)

# Create and configure the file option dropdown menu
self.file_selections.append(QComboBox())
self.file_selections[i].addItems(self.file_options)
self.file_selections[i].setCurrentIndex(0)
self.file_selections[i].setCurrentIndex(1)
self.file_selections[i].currentIndexChanged.connect(
self.file_signaller.map
)
Expand All @@ -118,9 +120,10 @@ def __init__(self, parent=None):
self.transform_type_signaller.map
)

# Subtract 2 to exclude the empty and rigid options
self.transform_type_signaller.setMapping(
self.transform_type_selections[-1],
len(self.transform_type_options) - 1,
len(self.transform_type_options) - 2,
)

self.file_selections.append(QComboBox())
Expand All @@ -131,19 +134,20 @@ def __init__(self, parent=None):
self.file_signaller.map
)

# Subtract 2 to exclude the empty and rigid options
self.file_signaller.setMapping(
self.file_selections[-1], len(self.transform_type_options) - 1
self.file_selections[-1], len(self.transform_type_options) - 2
)

self.setCellWidget(
len(self.transform_type_options) - 1,
len(self.transform_type_options) - 2,
0,
self.transform_type_selections[-1],
)
self.setCellWidget(
len(self.transform_type_options) - 1, 1, self.file_selections[-1]
len(self.transform_type_options) - 2, 1, self.file_selections[-1]
)
self.file_selections[-1].setEnabled(False)

self.resizeRowsToContents()
self.resizeColumnsToContents()

Expand Down

0 comments on commit 75f70f5

Please sign in to comment.