From 4763fb1238dcfc14e8132e9fed0c69670e90448a Mon Sep 17 00:00:00 2001 From: sbkaf Date: Thu, 19 Mar 2015 18:44:10 +0100 Subject: [PATCH] merge --- src/bitmessageqt/__init__.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 5c9e459e..744373d6 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -676,7 +676,23 @@ class MyForm(QtGui.QMainWindow): except: print 'There was a problem testing for a Namecoin daemon. Hiding the Fetch Namecoin ID button' #self.ui.pushButtonFetchNamecoinID.hide() - + + def updateTTL(self, sliderPosition): + TTL = int(sliderPosition ** 3.199 + 3600) + self.updateHumanFriendlyTTLDescription(TTL) + shared.config.set('bitmessagesettings', 'ttl', str(TTL)) + shared.writeKeysFile() + + def updateHumanFriendlyTTLDescription(self, TTL): + numberOfHours = int(round(TTL / (60*60))) + if numberOfHours < 48: + if numberOfHours == 1: + self.ui.labelHumanFriendlyTTLDescription.setText(_translate("MainWindow", "1 hour")) + else: + self.ui.labelHumanFriendlyTTLDescription.setText(_translate("MainWindow", "%1 hours").arg(numberOfHours)) + else: + numberOfDays = int(round(TTL / (24*60*60))) + self.ui.labelHumanFriendlyTTLDescription.setText(_translate("MainWindow", "%1 days").arg(numberOfDays)) # Show or hide the application window after clicking an item within the # tray icon or, on Windows, the try icon itself.