code: def setup(self, fname):
          
          combo_label = QLabel(_("Select a run configuration:"))
          self.combo = QComboBox()
          self.combo.setMaxVisibleItems(20)
          self.combo.setSizeAdjustPolicy(QComboBox.AdjustToMinimumContentsLength)
          self.combo.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
          
          self.stack = QStackedWidget()
  
          configurations = _get_run_configurations()
          for index, (filename, options) in enumerate(configurations):
              if fname == filename:
                  break
          else:
              # There is no run configuration for script *fname*:
              # creating a temporary configuration that will be kept only if
              # dialog changes are accepted by the user
              configurations.insert(0, (fname, RunConfiguration(fname).get()))
              index = 0
          for filename, options in configurations:
              widget = RunConfigOptions(self)
              widget.set(options)
              self.combo.addItem(filename)
              self.stack.addWidget(widget)
          self.combo.currentIndexChanged.connect(self.stack.setCurrentIndex)
          self.combo.setCurrentIndex(index)
  
          self.add_widgets(combo_label, self.combo, 10, self.stack)
          self.add_button_box(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
  
          self.setWindowTitle(_("Run configuration per file"))
docs: Setup Run Configuration dialog with filename *fname*