diff --git a/electrum/address_synchronizer.py b/electrum/address_synchronizer.py index 97d89707..ce08bd03 100644 --- a/electrum/address_synchronizer.py +++ b/electrum/address_synchronizer.py @@ -73,12 +73,13 @@ class AddressSynchronizer(PrintError): # Verified transactions. txid -> TxMinedInfo. Access with self.lock. verified_tx = storage.get('verified_tx3', {}) self.verified_tx = {} # type: Dict[str, TxMinedInfo] - for txid, (height, timestamp, txpos, header_hash) in verified_tx.items(): + for txid, (height, timestamp, txpos, header_hash, flodata) in verified_tx.items(): self.verified_tx[txid] = TxMinedInfo(height=height, conf=None, timestamp=timestamp, txpos=txpos, - header_hash=header_hash) + header_hash=header_hash, + flodata=flodata) # Transactions pending verification. txid -> tx_height. Access with self.lock. self.unverified_tx = defaultdict(int) # true when synchronized @@ -453,7 +454,7 @@ class AddressSynchronizer(PrintError): verified_tx_to_save = {} for txid, tx_info in self.verified_tx.items(): verified_tx_to_save[txid] = (tx_info.height, tx_info.timestamp, - tx_info.txpos, tx_info.header_hash) + tx_info.txpos, tx_info.header_hash, tx_info.flodata) self.storage.put('verified_tx3', verified_tx_to_save) if write: self.storage.write() @@ -633,7 +634,8 @@ class AddressSynchronizer(PrintError): with self.lock: if tx_hash in self.verified_tx: info = self.verified_tx[tx_hash] - flodata = info[4] + print(info) + flodata = info[5] return flodata elif tx_hash in self.unverified_tx: tx = self.transactions.get(tx_hash) diff --git a/electrum/gui/kivy/main.kv b/electrum/gui/kivy/main.kv index 68758449..77435d02 100644 --- a/electrum/gui/kivy/main.kv +++ b/electrum/gui/kivy/main.kv @@ -151,6 +151,20 @@ data: '' text: ' '.join(map(''.join, zip(*[iter(self.data)]*4))) if self.data else '' + + font_size: '6pt' + name: '' + data: '' + text: self.data + touched: False + padding: '10dp', '10dp' + canvas.before: + Color: + rgb: .3, .3, .3 + Rectangle: + size: self.size + pos: self.pos + size_hint: None, None width: '270dp' if root.fs else min(self.width, dp(270)) diff --git a/electrum/gui/kivy/main_window.py b/electrum/gui/kivy/main_window.py index cfe60ebd..8a72f59d 100644 --- a/electrum/gui/kivy/main_window.py +++ b/electrum/gui/kivy/main_window.py @@ -40,7 +40,7 @@ from kivy.lang import Builder from .uix.dialogs.installwizard import InstallWizard from .uix.dialogs import InfoBubble, crash_reporter from .uix.dialogs import OutputList, OutputItem -from .uix.dialogs import TopLabel, RefLabel +from .uix.dialogs import TopLabel, RefLabel, FLODataLabel #from kivy.core.window import Window #Window.softinput_mode = 'below_target' diff --git a/electrum/gui/kivy/uix/dialogs/__init__.py b/electrum/gui/kivy/uix/dialogs/__init__.py index 352675a3..426e399c 100644 --- a/electrum/gui/kivy/uix/dialogs/__init__.py +++ b/electrum/gui/kivy/uix/dialogs/__init__.py @@ -218,3 +218,6 @@ class TopLabel(Factory.Label): class RefLabel(TopLabel): pass + +class FLODataLabel(TopLabel): + pass diff --git a/electrum/gui/kivy/uix/dialogs/tx_dialog.py b/electrum/gui/kivy/uix/dialogs/tx_dialog.py index 8aacaa1e..97050031 100644 --- a/electrum/gui/kivy/uix/dialogs/tx_dialog.py +++ b/electrum/gui/kivy/uix/dialogs/tx_dialog.py @@ -26,6 +26,7 @@ Builder.load_string(''' status_str: '' description: '' outputs_str: '' + flodata: '' BoxLayout: orientation: 'vertical' ScrollView: @@ -66,6 +67,11 @@ Builder.load_string(''' text: _('Outputs') + ':' OutputList: id: output_list + TopLabel: + text: _('FLO data') + ':' + FLODataLabel: + data: root.flodata + name: _('FLO data') Widget: size_hint: 1, 0.1 @@ -109,6 +115,7 @@ class TxDialog(Factory.Popup): def update(self): format_amount = self.app.format_amount_and_units tx_hash, self.status_str, self.description, self.can_broadcast, self.can_rbf, amount, fee, height, conf, timestamp, exp_n = self.wallet.get_tx_info(self.tx) + self.flodata = self.wallet.get_flodata(tx_hash) self.tx_hash = tx_hash or '' if timestamp: self.date_label = _('Date') diff --git a/electrum/gui/kivy/uix/screens.py b/electrum/gui/kivy/uix/screens.py index ccb4303e..9917b586 100644 --- a/electrum/gui/kivy/uix/screens.py +++ b/electrum/gui/kivy/uix/screens.py @@ -137,6 +137,7 @@ class HistoryScreen(CScreen): status, status_str = self.app.wallet.get_tx_status(tx_hash, tx_mined_status) icon = "atlas://electrum/gui/kivy/theming/light/" + TX_ICONS[status] label = self.app.wallet.get_label(tx_hash) if tx_hash else _('Pruned transaction outputs') + flodata = self.app.wallet.get_flodata(tx_hash) ri = {} ri['screen'] = self ri['tx_hash'] = tx_hash @@ -144,6 +145,7 @@ class HistoryScreen(CScreen): ri['date'] = status_str ri['message'] = label ri['confirmations'] = tx_mined_status.conf + ri['flodata'] = flodata if value is not None: ri['is_mine'] = value < 0 if value < 0: value = - value diff --git a/electrum/gui/kivy/uix/ui_screens/history.kv b/electrum/gui/kivy/uix/ui_screens/history.kv index 04988a70..55e9c31a 100644 --- a/electrum/gui/kivy/uix/ui_screens/history.kv +++ b/electrum/gui/kivy/uix/ui_screens/history.kv @@ -26,6 +26,7 @@ confirmations: 0 date: '' quote_text: '' + flodata: '' Image: id: icon source: root.icon @@ -46,6 +47,11 @@ font_size: '14sp' shorten: True text: root.date + ' ' + root.message + CardLabel: + color: .699, .699, .699, 1 + font_size: '14sp' + shorten: True + text: root.flodata Widget : diff --git a/electrum/gui/qt/history_list.py b/electrum/gui/qt/history_list.py index 4ec0e384..15624f85 100644 --- a/electrum/gui/qt/history_list.py +++ b/electrum/gui/qt/history_list.py @@ -47,6 +47,8 @@ except: print_error("qt/history_list: could not import electrum.plot. This feature needs matplotlib to be installed.") plot_history = None +import pdb + # note: this list needs to be kept in sync with another in kivy TX_ICONS = [ "unconfirmed.png", @@ -71,6 +73,7 @@ class HistoryColumns(IntEnum): FIAT_ACQ_PRICE = 6 FIAT_CAP_GAINS = 7 TXID = 8 + FLO_DATA = 9 class HistorySortModel(QSortFilterProxyModel): def lessThan(self, source_left: QModelIndex, source_right: QModelIndex): @@ -122,6 +125,7 @@ class HistoryModel(QAbstractItemModel, PrintError): conf = tx_item['confirmations'] txpos = tx_item['txpos_in_block'] or 0 height = tx_item['height'] + flodata = self.parent.wallet.get_flodata(tx_hash) try: status, status_str = self.tx_status_cache[tx_hash] except KeyError: @@ -145,6 +149,7 @@ class HistoryModel(QAbstractItemModel, PrintError): HistoryColumns.FIAT_CAP_GAINS: tx_item['capital_gain'].value if 'capital_gain' in tx_item else None, HistoryColumns.TXID: tx_hash, + HistoryColumns.FLO_DATA: flodata, } return QVariant(d[col]) if role not in (Qt.DisplayRole, Qt.EditRole): @@ -194,6 +199,8 @@ class HistoryModel(QAbstractItemModel, PrintError): return QVariant(self.parent.fx.format_fiat(cg)) elif col == HistoryColumns.TXID: return QVariant(tx_hash) + elif col == HistoryColumns.FLO_DATA: + return QVariant(flodata) return QVariant() def parent(self, index: QModelIndex): @@ -325,6 +332,7 @@ class HistoryModel(QAbstractItemModel, PrintError): HistoryColumns.FIAT_ACQ_PRICE: fiat_acq_title, HistoryColumns.FIAT_CAP_GAINS: fiat_cg_title, HistoryColumns.TXID: 'TXID', + HistoryColumns.FLO_DATA: _('FLO Data'), }[section] def flags(self, idx): diff --git a/run_electrum b/run_electrum index 68040693..7dd9adc4 100755 --- a/run_electrum +++ b/run_electrum @@ -287,7 +287,9 @@ if __name__ == '__main__': args = parser.parse_args() # config is an object passed to the various constructors (wallet, interface, gui) - if is_android: + #if True: + #if is_android: + if False: config_options = { 'verbosity': '', 'cmd': 'gui',