Skip to content

Commit

Permalink
inputs list update
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Jul 11, 2018
1 parent c36105b commit 21a36a6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
14 changes: 12 additions & 2 deletions shuffle/qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ def __init__(self, window):
QWidget.__init__(self)
self.window = window
self.timer = QtCore.QTimer()
self.update_inputs_timer = QtCore.QTimer()
self.waiting_timeout = 180
self.timer.timeout.connect(self.tick)
self.update_inputs_timer.timeout.connect(self.update_inputs)
self.update_inputs_timer.start(15000)
self.coinshuffle_fee_constant = 1000
# This is for debug
# self.coinshuffle_fee_constant = 1000
Expand Down Expand Up @@ -106,6 +109,11 @@ def __init__(self, window):
vbox.addLayout(hbox)
vbox.addStretch(1)


def update_inputs(self):
self.coinshuffle_inputs.update(self.window.wallet)
self.coinshuffle_outputs.update(self.window.wallet)

def tick(self):
self.waiting_timeout -= 1
if self.waiting_timeout > 0:
Expand Down Expand Up @@ -153,18 +161,20 @@ def disable_coinshuffle_settings(self):


def process_protocol_messages(self, message):

if message.startswith("Error"):
self.pThread.join()
self.coinshuffle_text_output.setTextColor(QColor('red'))
self.coinshuffle_text_output.append(message)
self.enable_coinshuffle_settings()
self.coinshuffle_cancel_button.setEnabled(False)
self.coinshuffle_inputs.update(self.window.wallet)
self.coinshuffle_outputs.update(self.window.wallet)
self.timer.stop()
elif message[-17:] == "complete protocol":
self.coinshuffle_text_output.append(message)
self.pThread.done.set()
tx = self.pThread.protocol.tx
if tx:
# self.window.show_transaction(tx)
self.pThread.join()
else:
print("No tx: " + str(tx.raw))
Expand Down
22 changes: 10 additions & 12 deletions shuffle/shuffle.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
from electroncash_gui.qt.util import *
from electroncash.i18n import _
from .client import ProtocolThread
# from electroncash.bitcoin import regenerate_key
# from electroncash.address import Address

class AmountSelect(QGroupBox):

Expand Down Expand Up @@ -81,13 +79,13 @@ def amounted_value(self, value):

def update(self, wallet):
current_input = self.get_input_address()
currentindex = self.currentIndex()
self.clear_addresses()
self.setItmes(wallet)
if current_input in self.inputsArray:
self.setCurrentIndex(self.inputsArray.index(current_input))
else:
self.setCurrentIndex(0)
for i, input in enumerate(self.inputsArray):
if current_input.to_string(Address.FMT_LEGACY) == input['address'].to_string(Address.FMT_LEGACY):
self.setCurrentIndex(i)
return
self.setCurrentIndex(0)

def clear_addresses(self):
self.inputsArray = []
Expand Down Expand Up @@ -131,13 +129,13 @@ def get_output_address(self, fmt=Address.FMT_LEGACY):

def update(self, wallet):
current_output = self.get_output_address()
currentindex = self.currentIndex()
self.clear_addresses()
self.setItems(wallet)
if current_output in self.outputsArray:
self.setCurrentIndex(self.outputsArray.index(current_output))
else:
self.setCurrentIndex(0)
for i, output in enumerate(self.outputsArray):
if current_output == output.to_string(Address.FMT_LEGACY):
self.setCurrentIndex(i)
return
self.setCurrentIndex(0)


class ConsoleLogger(QObject):
Expand Down

0 comments on commit 21a36a6

Please sign in to comment.