Fix GUI
This commit is contained in:
parent
2cda8b266f
commit
8f6a1880e9
@ -73,12 +73,13 @@ class AddressSynchronizer(PrintError):
|
|||||||
# Verified transactions. txid -> TxMinedInfo. Access with self.lock.
|
# Verified transactions. txid -> TxMinedInfo. Access with self.lock.
|
||||||
verified_tx = storage.get('verified_tx3', {})
|
verified_tx = storage.get('verified_tx3', {})
|
||||||
self.verified_tx = {} # type: Dict[str, TxMinedInfo]
|
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,
|
self.verified_tx[txid] = TxMinedInfo(height=height,
|
||||||
conf=None,
|
conf=None,
|
||||||
timestamp=timestamp,
|
timestamp=timestamp,
|
||||||
txpos=txpos,
|
txpos=txpos,
|
||||||
header_hash=header_hash)
|
header_hash=header_hash,
|
||||||
|
flodata=flodata)
|
||||||
# Transactions pending verification. txid -> tx_height. Access with self.lock.
|
# Transactions pending verification. txid -> tx_height. Access with self.lock.
|
||||||
self.unverified_tx = defaultdict(int)
|
self.unverified_tx = defaultdict(int)
|
||||||
# true when synchronized
|
# true when synchronized
|
||||||
@ -453,7 +454,7 @@ class AddressSynchronizer(PrintError):
|
|||||||
verified_tx_to_save = {}
|
verified_tx_to_save = {}
|
||||||
for txid, tx_info in self.verified_tx.items():
|
for txid, tx_info in self.verified_tx.items():
|
||||||
verified_tx_to_save[txid] = (tx_info.height, tx_info.timestamp,
|
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)
|
self.storage.put('verified_tx3', verified_tx_to_save)
|
||||||
if write:
|
if write:
|
||||||
self.storage.write()
|
self.storage.write()
|
||||||
@ -633,7 +634,8 @@ class AddressSynchronizer(PrintError):
|
|||||||
with self.lock:
|
with self.lock:
|
||||||
if tx_hash in self.verified_tx:
|
if tx_hash in self.verified_tx:
|
||||||
info = self.verified_tx[tx_hash]
|
info = self.verified_tx[tx_hash]
|
||||||
flodata = info[4]
|
print(info)
|
||||||
|
flodata = info[5]
|
||||||
return flodata
|
return flodata
|
||||||
elif tx_hash in self.unverified_tx:
|
elif tx_hash in self.unverified_tx:
|
||||||
tx = self.transactions.get(tx_hash)
|
tx = self.transactions.get(tx_hash)
|
||||||
|
|||||||
@ -151,6 +151,20 @@
|
|||||||
data: ''
|
data: ''
|
||||||
text: ' '.join(map(''.join, zip(*[iter(self.data)]*4))) if self.data else ''
|
text: ' '.join(map(''.join, zip(*[iter(self.data)]*4))) if self.data else ''
|
||||||
|
|
||||||
|
<FLODataLabel>
|
||||||
|
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
|
||||||
|
|
||||||
<InfoBubble>
|
<InfoBubble>
|
||||||
size_hint: None, None
|
size_hint: None, None
|
||||||
width: '270dp' if root.fs else min(self.width, dp(270))
|
width: '270dp' if root.fs else min(self.width, dp(270))
|
||||||
|
|||||||
@ -40,7 +40,7 @@ from kivy.lang import Builder
|
|||||||
from .uix.dialogs.installwizard import InstallWizard
|
from .uix.dialogs.installwizard import InstallWizard
|
||||||
from .uix.dialogs import InfoBubble, crash_reporter
|
from .uix.dialogs import InfoBubble, crash_reporter
|
||||||
from .uix.dialogs import OutputList, OutputItem
|
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
|
#from kivy.core.window import Window
|
||||||
#Window.softinput_mode = 'below_target'
|
#Window.softinput_mode = 'below_target'
|
||||||
|
|||||||
@ -218,3 +218,6 @@ class TopLabel(Factory.Label):
|
|||||||
|
|
||||||
class RefLabel(TopLabel):
|
class RefLabel(TopLabel):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
class FLODataLabel(TopLabel):
|
||||||
|
pass
|
||||||
|
|||||||
@ -26,6 +26,7 @@ Builder.load_string('''
|
|||||||
status_str: ''
|
status_str: ''
|
||||||
description: ''
|
description: ''
|
||||||
outputs_str: ''
|
outputs_str: ''
|
||||||
|
flodata: ''
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
orientation: 'vertical'
|
orientation: 'vertical'
|
||||||
ScrollView:
|
ScrollView:
|
||||||
@ -66,6 +67,11 @@ Builder.load_string('''
|
|||||||
text: _('Outputs') + ':'
|
text: _('Outputs') + ':'
|
||||||
OutputList:
|
OutputList:
|
||||||
id: output_list
|
id: output_list
|
||||||
|
TopLabel:
|
||||||
|
text: _('FLO data') + ':'
|
||||||
|
FLODataLabel:
|
||||||
|
data: root.flodata
|
||||||
|
name: _('FLO data')
|
||||||
Widget:
|
Widget:
|
||||||
size_hint: 1, 0.1
|
size_hint: 1, 0.1
|
||||||
|
|
||||||
@ -109,6 +115,7 @@ class TxDialog(Factory.Popup):
|
|||||||
def update(self):
|
def update(self):
|
||||||
format_amount = self.app.format_amount_and_units
|
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)
|
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 ''
|
self.tx_hash = tx_hash or ''
|
||||||
if timestamp:
|
if timestamp:
|
||||||
self.date_label = _('Date')
|
self.date_label = _('Date')
|
||||||
|
|||||||
@ -137,6 +137,7 @@ class HistoryScreen(CScreen):
|
|||||||
status, status_str = self.app.wallet.get_tx_status(tx_hash, tx_mined_status)
|
status, status_str = self.app.wallet.get_tx_status(tx_hash, tx_mined_status)
|
||||||
icon = "atlas://electrum/gui/kivy/theming/light/" + TX_ICONS[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')
|
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 = {}
|
||||||
ri['screen'] = self
|
ri['screen'] = self
|
||||||
ri['tx_hash'] = tx_hash
|
ri['tx_hash'] = tx_hash
|
||||||
@ -144,6 +145,7 @@ class HistoryScreen(CScreen):
|
|||||||
ri['date'] = status_str
|
ri['date'] = status_str
|
||||||
ri['message'] = label
|
ri['message'] = label
|
||||||
ri['confirmations'] = tx_mined_status.conf
|
ri['confirmations'] = tx_mined_status.conf
|
||||||
|
ri['flodata'] = flodata
|
||||||
if value is not None:
|
if value is not None:
|
||||||
ri['is_mine'] = value < 0
|
ri['is_mine'] = value < 0
|
||||||
if value < 0: value = - value
|
if value < 0: value = - value
|
||||||
|
|||||||
@ -26,6 +26,7 @@
|
|||||||
confirmations: 0
|
confirmations: 0
|
||||||
date: ''
|
date: ''
|
||||||
quote_text: ''
|
quote_text: ''
|
||||||
|
flodata: ''
|
||||||
Image:
|
Image:
|
||||||
id: icon
|
id: icon
|
||||||
source: root.icon
|
source: root.icon
|
||||||
@ -46,6 +47,11 @@
|
|||||||
font_size: '14sp'
|
font_size: '14sp'
|
||||||
shorten: True
|
shorten: True
|
||||||
text: root.date + ' ' + root.message
|
text: root.date + ' ' + root.message
|
||||||
|
CardLabel:
|
||||||
|
color: .699, .699, .699, 1
|
||||||
|
font_size: '14sp'
|
||||||
|
shorten: True
|
||||||
|
text: root.flodata
|
||||||
Widget
|
Widget
|
||||||
|
|
||||||
<HistoryRecycleView>:
|
<HistoryRecycleView>:
|
||||||
|
|||||||
@ -47,6 +47,8 @@ except:
|
|||||||
print_error("qt/history_list: could not import electrum.plot. This feature needs matplotlib to be installed.")
|
print_error("qt/history_list: could not import electrum.plot. This feature needs matplotlib to be installed.")
|
||||||
plot_history = None
|
plot_history = None
|
||||||
|
|
||||||
|
import pdb
|
||||||
|
|
||||||
# note: this list needs to be kept in sync with another in kivy
|
# note: this list needs to be kept in sync with another in kivy
|
||||||
TX_ICONS = [
|
TX_ICONS = [
|
||||||
"unconfirmed.png",
|
"unconfirmed.png",
|
||||||
@ -71,6 +73,7 @@ class HistoryColumns(IntEnum):
|
|||||||
FIAT_ACQ_PRICE = 6
|
FIAT_ACQ_PRICE = 6
|
||||||
FIAT_CAP_GAINS = 7
|
FIAT_CAP_GAINS = 7
|
||||||
TXID = 8
|
TXID = 8
|
||||||
|
FLO_DATA = 9
|
||||||
|
|
||||||
class HistorySortModel(QSortFilterProxyModel):
|
class HistorySortModel(QSortFilterProxyModel):
|
||||||
def lessThan(self, source_left: QModelIndex, source_right: QModelIndex):
|
def lessThan(self, source_left: QModelIndex, source_right: QModelIndex):
|
||||||
@ -122,6 +125,7 @@ class HistoryModel(QAbstractItemModel, PrintError):
|
|||||||
conf = tx_item['confirmations']
|
conf = tx_item['confirmations']
|
||||||
txpos = tx_item['txpos_in_block'] or 0
|
txpos = tx_item['txpos_in_block'] or 0
|
||||||
height = tx_item['height']
|
height = tx_item['height']
|
||||||
|
flodata = self.parent.wallet.get_flodata(tx_hash)
|
||||||
try:
|
try:
|
||||||
status, status_str = self.tx_status_cache[tx_hash]
|
status, status_str = self.tx_status_cache[tx_hash]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@ -145,6 +149,7 @@ class HistoryModel(QAbstractItemModel, PrintError):
|
|||||||
HistoryColumns.FIAT_CAP_GAINS:
|
HistoryColumns.FIAT_CAP_GAINS:
|
||||||
tx_item['capital_gain'].value if 'capital_gain' in tx_item else None,
|
tx_item['capital_gain'].value if 'capital_gain' in tx_item else None,
|
||||||
HistoryColumns.TXID: tx_hash,
|
HistoryColumns.TXID: tx_hash,
|
||||||
|
HistoryColumns.FLO_DATA: flodata,
|
||||||
}
|
}
|
||||||
return QVariant(d[col])
|
return QVariant(d[col])
|
||||||
if role not in (Qt.DisplayRole, Qt.EditRole):
|
if role not in (Qt.DisplayRole, Qt.EditRole):
|
||||||
@ -194,6 +199,8 @@ class HistoryModel(QAbstractItemModel, PrintError):
|
|||||||
return QVariant(self.parent.fx.format_fiat(cg))
|
return QVariant(self.parent.fx.format_fiat(cg))
|
||||||
elif col == HistoryColumns.TXID:
|
elif col == HistoryColumns.TXID:
|
||||||
return QVariant(tx_hash)
|
return QVariant(tx_hash)
|
||||||
|
elif col == HistoryColumns.FLO_DATA:
|
||||||
|
return QVariant(flodata)
|
||||||
return QVariant()
|
return QVariant()
|
||||||
|
|
||||||
def parent(self, index: QModelIndex):
|
def parent(self, index: QModelIndex):
|
||||||
@ -325,6 +332,7 @@ class HistoryModel(QAbstractItemModel, PrintError):
|
|||||||
HistoryColumns.FIAT_ACQ_PRICE: fiat_acq_title,
|
HistoryColumns.FIAT_ACQ_PRICE: fiat_acq_title,
|
||||||
HistoryColumns.FIAT_CAP_GAINS: fiat_cg_title,
|
HistoryColumns.FIAT_CAP_GAINS: fiat_cg_title,
|
||||||
HistoryColumns.TXID: 'TXID',
|
HistoryColumns.TXID: 'TXID',
|
||||||
|
HistoryColumns.FLO_DATA: _('FLO Data'),
|
||||||
}[section]
|
}[section]
|
||||||
|
|
||||||
def flags(self, idx):
|
def flags(self, idx):
|
||||||
|
|||||||
@ -287,7 +287,9 @@ if __name__ == '__main__':
|
|||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# config is an object passed to the various constructors (wallet, interface, gui)
|
# config is an object passed to the various constructors (wallet, interface, gui)
|
||||||
if is_android:
|
#if True:
|
||||||
|
#if is_android:
|
||||||
|
if False:
|
||||||
config_options = {
|
config_options = {
|
||||||
'verbosity': '',
|
'verbosity': '',
|
||||||
'cmd': 'gui',
|
'cmd': 'gui',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user