Browse Source

rearrange schedule tab layout, add view

master
Adam Gibson 9 years ago
parent
commit
93344caf65
No known key found for this signature in database
GPG Key ID: B3AE09F1E9A3197A
  1. 110
      scripts/joinmarket-qt.py

110
scripts/joinmarket-qt.py

@ -894,6 +894,10 @@ class SpendTab(QWidget):
log.debug('Looking for schedule in: ' + firstarg) log.debug('Looking for schedule in: ' + firstarg)
if not firstarg: if not firstarg:
return return
#extract raw text before processing
with open(firstarg, 'rb') as f:
rawsched = f.read()
res, schedule = get_schedule(firstarg) res, schedule = get_schedule(firstarg)
if not res: if not res:
JMQtMessageBox(self, "Not a valid JM schedule file", mbtype='crit', JMQtMessageBox(self, "Not a valid JM schedule file", mbtype='crit',
@ -901,10 +905,50 @@ class SpendTab(QWidget):
else: else:
w.statusBar().showMessage("Schedule loaded OK.") w.statusBar().showMessage("Schedule loaded OK.")
self.sch_label2.setText(os.path.basename(str(firstarg))) self.sch_label2.setText(os.path.basename(str(firstarg)))
self.sched_view.setText(rawsched)
self.schedule_set_button.setEnabled(True) self.schedule_set_button.setEnabled(True)
self.toggleButtons(False, False, True, False) self.toggleButtons(False, False, True, False)
self.loaded_schedule = schedule self.loaded_schedule = schedule
def getDonateLayout(self):
donateLayout = QHBoxLayout()
self.donateCheckBox = QCheckBox()
self.donateCheckBox.setChecked(False)
self.donateCheckBox.setMaximumWidth(30)
self.donateLimitBox = QDoubleSpinBox()
self.donateLimitBox.setMinimum(0.001)
self.donateLimitBox.setMaximum(0.100)
self.donateLimitBox.setSingleStep(0.001)
self.donateLimitBox.setDecimals(3)
self.donateLimitBox.setValue(0.010)
self.donateLimitBox.setMaximumWidth(100)
self.donateLimitBox.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
donateLayout.addWidget(self.donateCheckBox)
label1 = QLabel("Check to send change lower than: ")
label1.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
donateLayout.addWidget(label1)
donateLayout.setAlignment(label1, QtCore.Qt.AlignLeft)
donateLayout.addWidget(self.donateLimitBox)
donateLayout.setAlignment(self.donateLimitBox, QtCore.Qt.AlignLeft)
label2 = QLabel(" BTC as a donation.")
donateLayout.addWidget(label2)
label2.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
donateLayout.setAlignment(label2, QtCore.Qt.AlignLeft)
label3 = HelpLabel('More', '\n'.join(
['If the calculated change for your transaction',
'is smaller than the value you choose (default 0.01 btc)',
'then that change is sent as a donation. If your change',
'is larger than that, there will be no donation.', '',
'As well as helping the developers, this feature can,',
'in certain circumstances, improve privacy, because there',
'is no change output that can be linked with your inputs later.']),
'About the donation feature')
label3.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
donateLayout.setAlignment(label3, QtCore.Qt.AlignLeft)
donateLayout.addWidget(label3)
donateLayout.addStretch(1)
return donateLayout
def initUI(self): def initUI(self):
vbox = QVBoxLayout(self) vbox = QVBoxLayout(self)
top = QFrame() top = QFrame()
@ -925,74 +969,42 @@ class SpendTab(QWidget):
sch_layout = QGridLayout() sch_layout = QGridLayout()
sch_layout.setSpacing(4) sch_layout.setSpacing(4)
self.schedule_tab.setLayout(sch_layout) self.schedule_tab.setLayout(sch_layout)
current_schedule_layout = QHBoxLayout() current_schedule_layout = QVBoxLayout()
sch_label1=QLabel("Current schedule: ") sch_label1=QLabel("Current schedule: ")
sch_label1.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) sch_label1.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
self.sch_label2 = QLabel("None") self.sch_label2 = QLabel("None")
current_schedule_layout.addWidget(sch_label1) current_schedule_layout.addWidget(sch_label1)
current_schedule_layout.addWidget(self.sch_label2) current_schedule_layout.addWidget(self.sch_label2)
sch_layout.addLayout(current_schedule_layout, 0, 0, 1, 2) self.sched_view = QTextEdit()
self.sched_view.setReadOnly(True)
self.sched_view.setLineWrapMode(QTextEdit.NoWrap)
current_schedule_layout.addWidget(self.sched_view)
sch_layout.addLayout(current_schedule_layout, 0, 0, 1, 1)
self.schedule_set_button = QPushButton('Choose schedule file') self.schedule_set_button = QPushButton('Choose schedule file')
self.schedule_set_button.clicked.connect(self.selectSchedule) self.schedule_set_button.clicked.connect(self.selectSchedule)
self.schedule_generate_button = QPushButton('Generate tumble schedule') self.schedule_generate_button = QPushButton('Generate tumble schedule')
self.schedule_generate_button.clicked.connect(self.generateTumbleSchedule) self.schedule_generate_button.clicked.connect(self.generateTumbleSchedule)
#TODO Is it possible to re-use buttons? (start, abort)
self.sch_startButton = QPushButton('Run schedule') self.sch_startButton = QPushButton('Run schedule')
self.sch_startButton.setEnabled(False) #not runnable until schedule chosen self.sch_startButton.setEnabled(False) #not runnable until schedule chosen
self.sch_startButton.clicked.connect(self.startMultiple) self.sch_startButton.clicked.connect(self.startMultiple)
self.sch_abortButton = QPushButton('Abort') self.sch_abortButton = QPushButton('Abort')
self.sch_abortButton.setEnabled(False) self.sch_abortButton.setEnabled(False)
self.sch_abortButton.clicked.connect(self.giveUp) self.sch_abortButton.clicked.connect(self.giveUp)
sch_buttons = QHBoxLayout()
sch_buttons.addStretch(1)
sch_buttons.addWidget(self.schedule_set_button)
sch_buttons.addWidget(self.schedule_generate_button)
sch_buttons.addWidget(self.sch_startButton)
sch_buttons.addWidget(self.sch_abortButton)
sch_layout.addLayout(sch_buttons, 1, 0, 1, 2)
sch_buttons_box = QGroupBox("Actions")
sch_buttons_layout = QVBoxLayout()
sch_buttons_layout.addWidget(self.schedule_set_button)
sch_buttons_layout.addWidget(self.schedule_generate_button)
sch_buttons_layout.addWidget(self.sch_startButton)
sch_buttons_layout.addWidget(self.sch_abortButton)
sch_buttons_box.setLayout(sch_buttons_layout)
sch_layout.addWidget(sch_buttons_box, 0, 1, 1, 1)
innerTopLayout = QGridLayout() innerTopLayout = QGridLayout()
innerTopLayout.setSpacing(4) innerTopLayout.setSpacing(4)
self.single_join_tab.setLayout(innerTopLayout) self.single_join_tab.setLayout(innerTopLayout)
donateLayout = QHBoxLayout() donateLayout = self.getDonateLayout()
self.donateCheckBox = QCheckBox()
self.donateCheckBox.setChecked(False)
self.donateCheckBox.setMaximumWidth(30)
self.donateLimitBox = QDoubleSpinBox()
self.donateLimitBox.setMinimum(0.001)
self.donateLimitBox.setMaximum(0.100)
self.donateLimitBox.setSingleStep(0.001)
self.donateLimitBox.setDecimals(3)
self.donateLimitBox.setValue(0.010)
self.donateLimitBox.setMaximumWidth(100)
self.donateLimitBox.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
donateLayout.addWidget(self.donateCheckBox)
label1 = QLabel("Check to send change lower than: ")
label1.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
donateLayout.addWidget(label1)
donateLayout.setAlignment(label1, QtCore.Qt.AlignLeft)
donateLayout.addWidget(self.donateLimitBox)
donateLayout.setAlignment(self.donateLimitBox, QtCore.Qt.AlignLeft)
label2 = QLabel(" BTC as a donation.")
donateLayout.addWidget(label2)
label2.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
donateLayout.setAlignment(label2, QtCore.Qt.AlignLeft)
label3 = HelpLabel('More', '\n'.join(
['If the calculated change for your transaction',
'is smaller than the value you choose (default 0.01 btc)',
'then that change is sent as a donation. If your change',
'is larger than that, there will be no donation.', '',
'As well as helping the developers, this feature can,',
'in certain circumstances, improve privacy, because there',
'is no change output that can be linked with your inputs later.']),
'About the donation feature')
label3.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
donateLayout.setAlignment(label3, QtCore.Qt.AlignLeft)
donateLayout.addWidget(label3)
donateLayout.addStretch(1)
innerTopLayout.addLayout(donateLayout, 0, 0, 1, 2) innerTopLayout.addLayout(donateLayout, 0, 0, 1, 2)
self.widgets = getSettingsWidgets() self.widgets = getSettingsWidgets()
for i, x in enumerate(self.widgets): for i, x in enumerate(self.widgets):
@ -1051,6 +1063,10 @@ class SpendTab(QWidget):
self.startSendPayment(multiple=True) self.startSendPayment(multiple=True)
def startSendPayment(self, ignored_makers=None, multiple=False): def startSendPayment(self, ignored_makers=None, multiple=False):
if not w.wallet:
JMQtMessageBox(self, "Cannot start without a loaded wallet.",
mbtype="crit", title="Error")
return
self.aborted = False self.aborted = False
if not multiple and not self.validateSettings(): if not multiple and not self.validateSettings():
return return

Loading…
Cancel
Save