def __init__(self, *, window: 'ElectrumWindow', inputs, outputs, output_value: Union[int, str], is_sweep: bool): WindowModalDialog.__init__(self, window, _("BitPost Confirm Transaction")) self.main_window = window self.inputs = inputs self.outputs = outputs self.output_value = output_value self.delay = None self.target = None self.txs = [] self.config = window.config self.wallet = window.wallet self.not_enough_funds = False self.no_dynfee_estimates = False self.needs_update = False self.is_sweep = is_sweep self.password_required = self.wallet.has_keystore_encryption( ) and not is_sweep self.num_txs = int(window.config.get('bitpost_num_txs')) self.imax_fees = 0 self.imax_size = 0 self.build_gui()
def __init__(self, parent, title=None): WindowModalDialog.__init__(self, parent, title=title) vbox = QVBoxLayout(self) cron_list = CronPaymentsList(parent) vbox.addWidget(cron_list) vbox.addStretch() vbox.addLayout(Buttons(QPushButton('Edit'), QPushButton('Delete'), )) vbox.addStretch() vbox.addLayout(Buttons(CloseButton(self), ))
def __init__(self, *, window: 'ElectrumWindow', txs, password, is_sweep): WindowModalDialog.__init__(self, window, _('BitPost Transactions Preview')) self.setMinimumSize(800, 600) self.main_window = window self.txs = txs self.password_required = self.main_window.wallet.has_keystore_encryption( ) and not is_sweep self.is_send = False vbox = QVBoxLayout() self.setLayout(vbox) lbox = QListWidget() items = [] for tx in txs: inputs = tx.inputs() outputs = tx.outputs() fee = tx.get_fee() fiat = False text = "fee: {}".format(fee) if self.main_window.fx and self.main_window.fx.is_enabled(): fiat = Exchange(self.main_window.fx) text += fiat.str_exchange(fee) text += "\t\tvbyte: {}\n".format(tx.estimated_size()) tmp = "fee/vbyte: {}".format(round(fee / tx.estimated_size(), 2)) if fiat: tmp += fiat.str_exchange(fee / tx.estimated_size()) text += tmp if len(tmp) > 22: tab = "\t" else: tab = "\t\t" text += "{}total size: {}\n".format(tab, tx.estimated_total_size()) text += "INPUTS:\n" for i in inputs: text += "{}:{} = {}".format(i.prevout.txid.hex(), i.prevout.out_idx, i.value_sats()) if fiat: text += fiat.str_exchange(i.value_sats()) text += "\n" text += "OUTPUTS:\n" for o in outputs: text += "{} = {}".format(o.address, o.value) if fiat: text += fiat.str_exchange(o.value) text += "\n" items.append(text) lbox.addItems(items) vbox.addWidget(lbox) self.send_button = QPushButton(_('Send')) self.send_button.clicked.connect(self.on_send) self.send_button.setDefault(True) self.pw_label = QLabel(_('Password')) self.pw_label.setVisible(self.password_required) self.pw = PasswordLineEdit(password) self.pw.setVisible(self.password_required) vbox.addLayout( Buttons(CancelButton(self), self.pw_label, self.pw, self.send_button))
def __init__(self, main_win, outputs): WindowModalDialog.__init__(self, main_win, title=_("New scheduled payment"),) vbox = QVBoxLayout(self) self.setMinimumSize(400, 150) minute_label = HelpLabel(_('minute:'), _(''' Defines a specific minute for an hour. Allowed characters: "*" any value "," value list separator "-" range of values "/" step values 0-59 allowed values ''')) hour_label = HelpLabel(_('hour:'), _(''' Defines a specific hour during the day. Allowed characters: "*" any value "," value list separator "-" range of values "/" step values 0-23 allowed values ''')) day_label = HelpLabel(_('day of month:'), _(''' Defines the day number for the month. Allowed characters: "*" any value "," value list separator "-" range of values "/" step values 0-31 allowed values ''')) month_label = HelpLabel(_('month:'), _(''' Defines a month during the year. Allowed characters: "*" any value "," value list separator "-" range of values "/" step values 1-12 allowed values ''')) week_label = HelpLabel(_('day of week:'), _(''' Specifies the day of the week. Allowed characters: "*" any value "," value list separator "-" range of values "/" step values 0-6 allowed values ''')) self.minute_edit = QLineEdit('*') self.minute_edit.setFixedWidth(30) self.minute_edit.textChanged.connect(self.update_schedule_details) self.hour_edit = QLineEdit('*') self.hour_edit.setFixedWidth(30) self.hour_edit.textChanged.connect(self.update_schedule_details) self.day_edit = QLineEdit('*') self.day_edit.setFixedWidth(30) self.day_edit.textChanged.connect(self.update_schedule_details) self.month_edit = QLineEdit('*') self.month_edit.setFixedWidth(30) self.month_edit.textChanged.connect(self.update_schedule_details) self.week_edit = QLineEdit('*') self.week_edit.setFixedWidth(30) self.week_edit.textChanged.connect(self.update_schedule_details) grid = QGridLayout() grid.addWidget(minute_label, 0, 0, alignment=Qt.AlignCenter) grid.addWidget(hour_label, 0, 1, alignment=Qt.AlignCenter) grid.addWidget(day_label, 0, 2, alignment=Qt.AlignCenter) grid.addWidget(month_label, 0, 3, alignment=Qt.AlignCenter) grid.addWidget(week_label, 0, 4, alignment=Qt.AlignCenter) grid.addWidget(self.minute_edit, 1, 0, alignment=Qt.AlignCenter) grid.addWidget(self.hour_edit, 1, 1, alignment=Qt.AlignCenter) grid.addWidget(self.day_edit, 1, 2, alignment=Qt.AlignCenter) grid.addWidget(self.month_edit, 1, 3, alignment=Qt.AlignCenter) grid.addWidget(self.week_edit, 1, 4, alignment=Qt.AlignCenter) every_day = QPushButton('every day') every_day.clicked.connect(lambda: self.set_as_text('0 0 * * *')) every_week = QPushButton('every week') every_week.clicked.connect(lambda: self.set_as_text('0 0 * * 0')) every_month = QPushButton('every month') every_month.clicked.connect(lambda: self.set_as_text('0 0 1 * *')) every_year = QPushButton('every year') every_year.clicked.connect(lambda: self.set_as_text('0 0 1 1 *')) self.schedule_details = QLabel('') vbox.addLayout(grid) vbox.addLayout(Buttons(every_day, every_week, every_month, every_year)) vbox.addWidget(self.schedule_details) vbox.addStretch() vbox.addLayout(Buttons(CloseButton(self), OkButton(self))) self.update_schedule_details()