コード例 #1
0
 def set_index(self):
     preset_names = [i.name for i in chainparams.get_presets()]
     active_params = self.config.get_option('chainparams', 'Bitcoin')
     # The config file might have changed to have a nonexistent preset.
     try:
         self.setCurrentIndex(preset_names.index(active_params))
     except ValueError:
         self.setCurrentIndex(preset_names.index('Bitcoin'))
コード例 #2
0
    def __init__(self, main_window, parent=None):
        super(ChainparamsComboBox, self).__init__(parent)
        self.gui = main_window
        self.config = self.gui.config

        preset_names = [i.name for i in chainparams.get_presets()]
        self.addItems(preset_names)
        self.set_index()

        self.currentIndexChanged.connect(self.change_params)
        self.config.optionChanged.connect(self.check_config)
        # Connect to the Chainparams plugin's signal.
        chainparams_plugin = self.gui.plugin_handler.get_plugin('Chainparams')
        if not chainparams_plugin:
            raise Exception('Chainparams plugin is not loaded.')
        chainparams_plugin.ui.paramsPresetsChanged.connect(self.reload_presets)
コード例 #3
0
 def reload_presets(self):
     """Reload the chainparams presets."""
     self.clear()
     preset_names = [i.name for i in chainparams.get_presets()]
     self.addItems(preset_names)
     self.set_index()