Exemple #1
0
 def add_output(self, o):
     out_script = Script(o.scriptPubKey)
     value = Amount(o.nValue)
     item = map(lambda x: QStandardItem(x),
                [value.get_str(), out_script.get_human()])
     # Value in satoshis is stored as RawRole.
     item[0].setData(QtCore.QVariant(value.satoshis), RawRole)
     # Raw scriptPubKey is stored as RawRole.
     item[1].setData(QtCore.QVariant(out_script.get_hex()), RawRole)
     self.model.appendRow(item)
Exemple #2
0
 def add_output(self, o):
     out_script = Script(o.scriptPubKey)
     value = Amount(o.nValue)
     item = map(lambda x: QStandardItem(x), [
         value.get_str(),
         out_script.get_human()
     ])
     # Value in satoshis is stored as RawRole.
     item[0].setData(QtCore.QVariant(value.satoshis), RawRole)
     # Raw scriptPubKey is stored as RawRole.
     item[1].setData(QtCore.QVariant(out_script.get_hex()), RawRole)
     self.model.appendRow(item)
Exemple #3
0
    def create_general_tab(self):
        form = QFormLayout()

        amnt_format = QComboBox()
        amnt_format.addItems(Amount.known_formats())
        current_format = self.config.get_option('amount_format', 'satoshis')
        try:
            amnt_format.setCurrentIndex(
                Amount.known_formats().index(current_format))
        except Exception:
            amnt_format.setCurrentIndex(0)

        def set_amount_format():
            new_format = str(amnt_format.currentText())
            self.config.set_option('amount_format', new_format)

        amnt_format.currentIndexChanged.connect(set_amount_format)
        amnt_format.setToolTip('Format that transaction amounts are shown in')

        data_retriever = QComboBox()
        retrievers = self.gui.plugin_handler.get_data_retrievers()
        retriever_names = [i.name for i in retrievers]
        data_retriever.addItems(retriever_names)

        current_data_retriever = self.config.get_option(
            'data_retriever', 'Blockchain')
        try:
            idx = retriever_names.index(current_data_retriever)
            data_retriever.setCurrentIndex(idx)
        except ValueError:
            idx = retriever_names.index('Blockchain')
            data_retriever.setCurrentIndex(idx)

        def set_retriever(idx):
            new_retriever = retriever_names[idx]
            self.config.set_option('data_retriever', new_retriever)

        data_retriever.currentIndexChanged.connect(set_retriever)
        data_retriever.setToolTip('Plugin used to download blockchain data')

        form.addRow('Amount format:', amnt_format)
        form.addRow('Data Retriever:', data_retriever)

        w = QWidget()
        w.setLayout(form)
        return w
Exemple #4
0
    def create_general_tab(self):
        form = QFormLayout()

        amnt_format = QComboBox()
        amnt_format.addItems(Amount.known_formats())
        current_format = self.config.get_option('amount_format', 'satoshis')
        try:
            amnt_format.setCurrentIndex(Amount.known_formats().index(current_format))
        except Exception:
            amnt_format.setCurrentIndex(0)
        def set_amount_format():
            new_format = str(amnt_format.currentText())
            self.config.set_option('amount_format', new_format)
        amnt_format.currentIndexChanged.connect(set_amount_format)
        amnt_format.setToolTip('Format that transaction amounts are shown in')


        data_retriever = QComboBox()
        retrievers = self.gui.plugin_handler.get_data_retrievers()
        retriever_names = [i.name for i in retrievers]
        data_retriever.addItems(retriever_names)

        current_data_retriever = self.config.get_option('data_retriever', 'Blockchain')
        try:
            idx = retriever_names.index(current_data_retriever)
            data_retriever.setCurrentIndex(idx)
        except ValueError:
            idx = retriever_names.index('Blockchain')
            data_retriever.setCurrentIndex(idx)

        def set_retriever(idx):
            new_retriever = retriever_names[idx]
            self.config.set_option('data_retriever', new_retriever)
        data_retriever.currentIndexChanged.connect(set_retriever)
        data_retriever.setToolTip('Plugin used to download blockchain data')

        form.addRow('Amount format:', amnt_format)
        form.addRow('Data Retriever:', data_retriever)

        w = QWidget()
        w.setLayout(form)
        return w
Exemple #5
0
    def create_general_tab(self):
        form = QFormLayout()

        amnt_format = QComboBox()
        amnt_format.addItems(Amount.known_formats())
        current_format = self.config.get_option('amount_format', 'satoshis')
        try:
            amnt_format.setCurrentIndex(Amount.known_formats().index(current_format))
        except Exception:
            amnt_format.setCurrentIndex(0)
        def set_amount_format():
            new_format = str(amnt_format.currentText())
            self.config.set_option('amount_format', new_format)
        amnt_format.currentIndexChanged.connect(set_amount_format)
        amnt_format.setToolTip('Format that transaction amounts are shown in')

        form.addRow('Amount format:', amnt_format)

        w = QWidget()
        w.setLayout(form)
        return w
    def on_option_changed(self, key):
        if key not in ['amount_format', 'data_retriever']:
            return

        if key == 'amount_format':
            new_value = self.config.get_option('amount_format', 'satoshis')
            try:
                self.amnt_format.setCurrentIndex(Amount.known_formats().index(new_value))
            except ValueError:
                self.error('Invalid amount format chosen: "%s".' % new_value)
                self.amnt_format.setCurrentIndex(0)
        elif key == 'data_retriever':
            new_value = self.config.get_option('data_retriever', 'Blockchain')
            retrievers = self.gui.plugin_handler.get_data_retrievers()
            retriever_names = [i.name for i in retrievers]
            try:
                idx = retriever_names.index(new_value)
                self.data_retriever.setCurrentIndex(idx)
            except ValueError:
                self.error('Invalid data retriever chosen: "%s".' % new_value)
                idx = retriever_names.index('Blockchain')
                self.data_retriever.setCurrentIndex(idx)
    def create_general_tab(self):
        form = QFormLayout()

        self.amnt_format = amnt_format = QComboBox()
        amnt_format.addItems(Amount.known_formats())
        current_format = self.config.get_option('amount_format', 'satoshis')
        try:
            amnt_format.setCurrentIndex(Amount.known_formats().index(current_format))
        except ValueError:
            amnt_format.setCurrentIndex(0)
            self.warning('Invalid amount format value: "%s". Defaulting to %s.' % (current_format, str(amnt_format.currentText())))
        def set_amount_format():
            new_format = str(amnt_format.currentText())
            self.config.set_option('amount_format', new_format)
        amnt_format.currentIndexChanged.connect(set_amount_format)
        amnt_format.setToolTip('Format that transaction amounts are shown in')


        self.data_retriever = data_retriever = QComboBox()
        retrievers = self.gui.plugin_handler.get_data_retrievers()
        retriever_names = [i.name for i in retrievers]
        data_retriever.addItems(retriever_names)

        current_data_retriever = self.config.get_option('data_retriever', 'Blockchain')
        try:
            idx = retriever_names.index(current_data_retriever)
            data_retriever.setCurrentIndex(idx)
        except ValueError:
            self.warning('Invalid data retriever value: "%s". Defaulting to Blockchain.' % current_data_retriever)
            idx = retriever_names.index('Blockchain')
            data_retriever.setCurrentIndex(idx)

        def set_retriever(idx):
            new_retriever = retriever_names[idx]
            self.config.set_option('data_retriever', new_retriever)
        data_retriever.currentIndexChanged.connect(set_retriever)
        data_retriever.setToolTip('Plugin used to download blockchain data')


        self.log_level = QComboBox()
        possible_levels = ['Debug', 'Info', 'Warning', 'Error', 'Critical']
        self.log_level.addItems(possible_levels)
        current_level = self.config.get_option('log_level', 'Info').capitalize()
        if current_level not in possible_levels:
            current_level = 'Info'
        self.log_level.setCurrentIndex(possible_levels.index(current_level))
        self.log_level.setToolTip('Minimum priority for a message to be logged')

        def change_log_level():
            level = str(self.log_level.currentText())
            self.config.set_option('log_level', level)
        self.log_level.currentIndexChanged.connect(change_log_level)


        form.addRow('Amount format:', amnt_format)
        form.addRow('Data retriever:', data_retriever)
        form.addRow('Log level:', self.log_level)

        w = QWidget()
        w.setLayout(form)
        return w