Compare commits

...

1 Commits

Author SHA1 Message Date
Vivek Teega
e423e34c72 changes for the android app 2018-09-28 18:01:04 +05:30
7 changed files with 39 additions and 5 deletions

View File

@ -911,6 +911,14 @@ class ElectrumWindow(App):
d = LabelDialog(_('Enter description'), text, callback)
d.open()
def flodata_dialog(self, screen):
from .uix.dialogs.label_dialog import LabelDialog
text = screen.flodata
def callback(text):
screen.flodata = text
d = LabelDialog(_('Enter FLO data'), text, callback)
d.open()
def amount_dialog(self, screen, show_max):
from .uix.dialogs.amount_dialog import AmountDialog
amount = screen.amount

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

View File

@ -184,6 +184,7 @@ class SendScreen(CScreen):
self.screen.amount = self.app.format_amount_and_units(amount) if amount else ''
self.payment_request = None
self.screen.is_pr = False
self.screen.flodata = uri.get('flodata', '')
def update(self):
if self.app.wallet and self.payment_request_queued:
@ -196,6 +197,7 @@ class SendScreen(CScreen):
self.screen.address = ''
self.payment_request = None
self.screen.is_pr = False
self.screen.flodata = ''
def set_request(self, pr):
self.screen.address = pr.get_requestor()
@ -260,19 +262,20 @@ class SendScreen(CScreen):
outputs = [TxOutput(bitcoin.TYPE_ADDRESS, address, amount)]
message = self.screen.message
amount = sum(map(lambda x:x[2], outputs))
flodata = str(self.screen.flodata)
if self.app.electrum_config.get('use_rbf'):
from .dialogs.question import Question
d = Question(_('Should this transaction be replaceable?'), lambda b: self._do_send(amount, message, outputs, b))
d = Question(_('Should this transaction be replaceable?'), lambda b: self._do_send(amount, message, outputs, flodata, b))
d.open()
else:
self._do_send(amount, message, outputs, False)
def _do_send(self, amount, message, outputs, rbf):
def _do_send(self, amount, message, outputs, flodata, rbf):
# make unsigned transaction
config = self.app.electrum_config
coins = self.app.wallet.get_spendable_coins(None, config)
try:
tx = self.app.wallet.make_unsigned_transaction(coins, outputs, config, None)
tx = self.app.wallet.make_unsigned_transaction(coins, outputs, config, None, txcomment=flodata)
except NotEnoughFunds:
self.app.show_error(_("Not enough funds"))
return

View File

@ -12,6 +12,7 @@ SendScreen:
amount: ''
message: ''
is_pr: False
flodata: ''
BoxLayout
padding: '12dp', '12dp', '12dp', '12dp'
spacing: '12dp'
@ -90,6 +91,24 @@ SendScreen:
default_text: _('Fee')
text: app.fee_status
on_release: Clock.schedule_once(lambda dt: app.fee_dialog(s, True))
CardSeparator:
opacity: int(not root.is_pr)
color: blue_bottom.foreground_color
BoxLayout:
id: flodata_selection
size_hint: 1, None
height: blue_bottom.item_height
spacing: '5dp'
Image:
source: 'atlas://electrum/gui/kivy/theming/light/script'
size_hint: None, None
size: '22dp', '22dp'
pos_hint: {'center_y': .5}
BlueButton:
id: flodata
text: s.flodata if s.flodata else (_('No FLO data') if root.is_pr else _('FLO data'))
disabled: root.is_pr
on_release: Clock.schedule_once(lambda dt: app.flodata_dialog(s))
BoxLayout:
size_hint: 1, None
height: '48dp'

View File

@ -544,7 +544,7 @@ class Abstract_Wallet(AddressSynchronizer):
return dust_threshold(self.network)
def make_unsigned_transaction(self, inputs, outputs, config, fixed_fee=None,
change_addr=None, is_sweep=False, txcomment = ""):
change_addr=None, is_sweep=False, txcomment=None ):
# check outputs
i_max = None
for i, o in enumerate(outputs):
@ -563,6 +563,9 @@ class Abstract_Wallet(AddressSynchronizer):
if fixed_fee is None and config.fee_per_kb() is None:
raise NoDynamicFeeEstimates()
if txcomment is None:
txcomment = ''
for item in inputs:
self.add_input_info(item)

View File

@ -362,7 +362,8 @@ if __name__ == '__main__':
args = parser.parse_args()
# config is an object passed to the various constructors (wallet, interface, gui)
if is_android:
#if is_android:
if False:
config_options = {
'verbosity': '',
'cmd': 'gui',