Skip to content
Snippets Groups Projects
Commit c1b05990 authored by Vincent Texier's avatar Vincent Texier
Browse files

Fixed #70 exception on membership expiration alert

 Open a messagebox for better alerting user
parent 5617496a
No related branches found
No related tags found
No related merge requests found
......@@ -176,16 +176,21 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget):
join_date = self.community.get_block(join_block).mediantime
parameters = self.community.get_parameters()
expiration_date = join_date + parameters['sigValidity']
current_time = QDateTime().currentDateTime()
current_time = time.time()
sig_validity = self.community.get_parameters()['sigValidity']
warning_expiration_time = int(sig_validity / 3)
will_expire_soon = (current_time > expiration_date*1000 - warning_expiration_time*1000)
will_expire_soon = (current_time > expiration_date - warning_expiration_time)
text = "Connected : Block {0}".format(block_number['number'])
self.status_label.setText(text)
text = "Connected : Block {0}".format(block_number)
if will_expire_soon:
days = QDateTime().currentDateTime().daysTo(QDateTime(expiration_date*1000))
text += " - Warning : Membership expiration in {0}".format(days)
self.status_label.setText(text)
days = QDateTime().currentDateTime().daysTo(QDateTime.fromTime_t(expiration_date))
QMessageBox.warning(
self,
"Membership expiration",
"Warning : Membership expiration in {0} days".format(days),
QMessageBox.Ok
)
def refresh_wallets(self):
if self.app.current_account:
......
......@@ -80,7 +80,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.label_time = QLabel("", self)
self.statusbar.addPermanentWidget(self.status_label)
self.statusbar.addPermanentWidget(self.status_label, 1)
self.statusbar.addPermanentWidget(self.label_time)
self.statusbar.addPermanentWidget(self.combo_referential)
self.update_time()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment