def _ui_field_select_rows(self): # combo boxes to select mapping for remaining fields self.mapping_field_selections = [] for field_name in self.file_field_names: # nid can only be used as a join key if field_name == "nid": continue hbox = QHBoxLayout() hbox.setAlignment(Qt.AlignLeft) hbox.addWidget(QLabel("{} -> ".format(field_name))) field_selection = QComboBox() field_selection.addItems([NOTHING_VALUE] + self.note_field_names) width = field_selection.minimumSizeHint().width() field_selection.view().setMinimumWidth(width) if field_name in self.note_field_names and \ field_name != self.note_join_key_selection.currentText(): field_selection.setCurrentText(field_name) else: field_selection.setCurrentText(NOTHING_VALUE) field_selection.currentIndexChanged.connect( lambda _, fs=field_selection: self._combobox_changed(fs)) hbox.addWidget(field_selection) self.mapping_field_selections.append(field_selection) yield hbox