def __init__(self, last_directory): super().__init__(Ui_OptionsConfiguratorGen) self.logger = logging.getLogger(__name__) self.last_directory = last_directory self.selector_bindings = None self.configuration = None self.dynamic_nodes += [ DynamicNode( self.ui.classicalStatisticsGroup, visibility_condition=lambda main: main.selected_statistics == Statistics.classical, auto_updater=ClassicalStatisticsAutoUpdater(self) ), DynamicNode( self.ui.evolutionGroupBox, enabling_condition=lambda main: main.configuration.should_run_evolution ), DynamicNode( self.ui.eliteSizeSpinBox, enabling_condition=lambda main: main.configuration.rule.adding.elitism.is_used ), DynamicNode( auto_updater=RootAutoUpdater(self) ), DynamicNode( auto_updater=EvolutionAutoUpdater(self) ), DynamicNode( auto_updater=InductionAutoUpdater(self) ), DynamicNode( auto_updater=CrowdingAutoUpdater(self) ), DynamicNode( auto_updater=ElitismAutoUpdater(self) ), DynamicNode( auto_updater=RulesAutoUpdater(self) ), DynamicNode( auto_updater=MainBoxAutoUpdater(self) ) ] self.bind_logic() with BlockSignals(*self.ui.__dict__.values()) as _: feed_with_data(self.ui.algorithmVariantComboBox, list(self.ALGORITHM_VARIANTS.keys()), default_item=self.DEFAULT_ALGORITHM_VARIANT_STR) self.current_variant = self.ALGORITHM_VARIANTS[ self.ui.algorithmVariantComboBox.currentText()] self.selected_statistics = None self.init_gui()
def variant_changed__reset_gui(self): self.selected_statistics = self.current_variant.supported_statistics[0] with BlockSignals(*self.ui.__dict__.values()) as _: index = self.ui.algorithmVariantComboBox.findText(self.current_variant.name) self.ui.algorithmVariantComboBox.setCurrentIndex(index) feed_with_data(self.ui.selectedStatisticsComboBox, list(x for x in self.STATISTICS_CONFIGURATIONS if x in self.current_variant.supported_statistics), clear=True, default_item=self.selected_statistics) self.reset_gui()
def init_gui(self): self.logger.debug('init gui %s', str(self.index)) feed_with_data(self.type_widget, self.EVOLUTION_SELECTOR_NAMES, self.DEFAULT_SELECTOR) self.tournament_widget.setMinimum(1) self.tournament_widget.setMaximum(20)
def _init_gui(self, options_configurator): feed_with_data(options_configurator.ui.ruleAddingHintComboBox, self.RULE_ADDING_HINTS)