Skip to content

Commit

Permalink
Version check dialog is actually kinda decent!
Browse files Browse the repository at this point in the history
  • Loading branch information
etotheipi committed Jul 12, 2012
1 parent c5d6ade commit f041845
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 28 deletions.
64 changes: 62 additions & 2 deletions ArmoryQt.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def __init__(self, parent=None):
super(ArmoryMainWindow, self).__init__(parent)



# SETUP THE WINDOWS DECORATIONS
self.lblLogoIcon = QLabel()
if USE_TESTNET:
Expand Down Expand Up @@ -94,6 +93,9 @@ def __init__(self, parent=None):
if not eulaAgreed:
DlgEULA(self,self).exec_()


self.checkForLatestVersion()

self.setupNetworking()

# setupNetworking may have set this flag if something went wrong
Expand Down Expand Up @@ -738,6 +740,64 @@ def setPreferredDateFormat(self, fmtStr):
return True


#############################################################################
def checkForLatestVersion(self):
# Download latest versions.txt file, accumulate changelog
versionFile = None
try:
import urllib2
versionLines = urllib2.urlopen(HTTP_VERSION_FILE, timeout=CLI_OPTIONS.nettimeout)
versionLines = versionLines.readlines()
except ImportError:
LOGERROR('No module urllib2 -- cannot get latest version')
return
except (urllib2.URLError, urllib2.HTTPError):
LOGERROR('Could not access latest Armory version information')
LOGERROR('Tried: %s', HTTP_VERSION_FILE)
return

try:
currLineIdx = [0]

def popNextLine(currIdx):
if currIdx[0] < len(versionLines):
outstr = versionLines[ currIdx[0] ]
currIdx[0] += 1
return outstr.strip()
else:
return None


thisVerString = getVersionString(BTCARMORY_VERSION)
changeLog = []
vernum = ''

line = popNextLine(currLineIdx)
while line != None:
if not line.startswith('#') and len(line)>0:
if line.startswith('VERSION'):
vstr = line.split(' ')[-1]
if vstr == thisVerString:
break
changeLog.append([vstr, []])
elif line.startswith('-'):
featureTitle = line[2:]
changeLog[-1][1].append([featureTitle, ''])
else:
changeLog[-1][1][-1][1] += line+' '
line = popNextLine(currLineIdx)

if len(changeLog)==0:
LOGINFO('You are running the latest version!')
else:
DlgVersionNotify(self,self, changeLog).exec_()



except:
LOGEXCEPT('Error trying to parse versions.txt file')


#############################################################################
def setupNetworking(self):

Expand Down Expand Up @@ -786,7 +846,7 @@ def uriClick_partial(a):
except ImportError:
LOGERROR('No module urllib2 -- cannot determine if internet is available')
except urllib2.URLError:
# In the extremely rare case that google might be down...
# In the extremely rare case that google might be down (or just to try again...)
try:
response=urllib2.urlopen('http://microsoft.com', timeout=CLI_OPTIONS.nettimeout)
except urllib2.URLError:
Expand Down
3 changes: 1 addition & 2 deletions armoryengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@


# Version Numbers -- numDigits [var, 2, 2, 3]
BTCARMORY_VERSION = (0, 82, 1, 0) # (Major, Minor, Minor++, even-more-minor)
BTCARMORY_VERSION = (0, 80, 0, 0) # (Major, Minor, Minor++, even-more-minor)
PYBTCADDRESS_VERSION = (1, 00, 0, 0) # (Major, Minor, Minor++, even-more-minor)
PYBTCWALLET_VERSION = (1, 35, 0, 0) # (Major, Minor, Minor++, even-more-minor)

Expand Down Expand Up @@ -197,7 +197,6 @@ def readVersionInt(verInt):

SETTINGS_PATH = CLI_OPTIONS.settingsPath
ARMORY_LOG_FILE = os.path.join(ARMORY_HOME_DIR, 'armorylog.txt')
#ARMORY_LOG_FILE_CPP = os.path.join(ARMORY_HOME_DIR, 'armorycpplog.txt')



Expand Down
5 changes: 5 additions & 0 deletions qtdefines.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
STYLE_NONE = QFrame.NoFrame

CHANGE_ADDR_DESCR_STRING = '[[ Change received ]]'

if USE_TESTNET:
HTTP_VERSION_FILE = 'https://raw.github.com/etotheipi/BitcoinArmory/logger/versions.txt'
else:
HTTP_VERSION_FILE = 'https://raw.github.com/etotheipi/BitcoinArmory/master/versions.txt'


def HLINE(style=QFrame.Plain):
Expand Down
61 changes: 61 additions & 0 deletions qtdialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9938,6 +9938,67 @@ def clickOtherOpt(self, boolState):



################################################################################
class DlgVersionNotify(ArmoryDialog):
def __init__(self, parent, main, changelog):
super(DlgVersionNotify, self).__init__(parent, main)

myVersion = getVersionString(BTCARMORY_VERSION)
latestVer = changelog[0][0]
lblDescr = QRichLabel( \
'There is a new version of Armory available! '
'<br><br>'
'<b>Current Version</b>: %s<br>'
'<b>Lastest Version</b>: %s<br><br>'
'Please visit the '
'<a href="http://bitcoinarmory.com/index.php/get-armory">Armory '
'download page</a> (http://bitcoinarmory.com/index.php/get-armory) '
'to get the most recent version.'
'<br><br>'
'Installing the latest version of Armory on top of your existing '
'version is perfectly safe. All your wallets and settings '
'will remain untouched through the update process.'
'<br><br>'
'The following is a list of changes and new features you will '
'have access to if you update:' % (myVersion, latestVer))
lblDescr.setOpenExternalLinks(True)


txtChangeLog = QTextEdit()
txtChangeLog.setReadOnly(True)

w,h = tightSizeNChar(self, 100)
w = min(w,600)
h = min(h,400)
txtChangeLog.sizeHint = lambda: QSize(w,15*h)

for versionTbl in changelog:
versionStr = versionTbl[0]
featureList = versionTbl[1]
txtChangeLog.insertHtml('<b><u>Version %s</u></b><br><br>' % versionStr)
for feat in featureList:
txtChangeLog.insertHtml('<b>%s</b><br>' % feat[0])
txtChangeLog.insertHtml('%s<br>' % feat[1])
txtChangeLog.insertHtml('<br><br>')

txtChangeLog.textCursor().movePosition(QTextCursor.Start)


dlgLayout = QVBoxLayout()
dlgLayout.addWidget(lblDescr)
dlgLayout.addWidget(txtChangeLog)
dlgLayout.setContentsMargins(20,20,20,20)

self.setLayout(dlgLayout)
self.setWindowTitle('New Version Available!')
self.setWindowIcon(QIcon(self.main.iconfile))










Expand Down
46 changes: 22 additions & 24 deletions versions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,31 @@
#-------------------------------------------------------------------------------
VERSION 0.82.1

- URI Creator
Right click on an address in your address book, or press "Create
Clickable Link" when you get a new address. Use this to email
payment requests to others, or post payment information on webpages.

- Minimize-to-system-tray
The file menu now has a "Minimize" option, and you can set it to
minimize-by-default when you click the "x" on the top window bar.

- Logging system implemented
The datadir will now have armorylog.txt which contains everything
that is normally written to the console. This makes it much easier,
especially for Windows users, to report bugs/crashes.

- Specify Change Address (Expert Mode Only!)
The send-bitcoins window now has options in the bottom-left corner
to specify how you want change outputs to be constructed. Either
recycle change into existing addresses, or specify an address.

- New "MAX" button
New button for each recipient in the send-bitcoins window. Given
the values already entered for other recipients and the transaction
fee, it will compute the max spendable balance for this recipient
and insert it into the "Amount" field.

- Version Checking and Notification
When you start Armory, it will automatically check versions.txt in
the master branch of Armory on github. It will then notify you if
Expand All @@ -23,36 +43,14 @@ VERSION 0.82.1
very few users will benefit from it anymore, it has been removed
until the new wallet format is finished.

- Added EULA Acknowledgement
All users will now be presented with a standrad "licence agreement"
- Added EULA Acknowledgement Window
All users will now be presented with a standard "licence agreement"
dialog when they open Armory the first time. If they do not agree,
Armory will close. This is done due to the lack of exposure of
Linux/OSX users to the EULA that is presented to Windows users
during installation.

#-------------------------------------------------------------------------------
VERSION 0.82

- URI Creator
Right click on an address in your address book, or press "Create
Clickable Link" when you get a new address. Use this to email
payment requests to others, or post payment information on webpages.

- Minimize-to-system-tray
The file menu now has a "Minimize" option, and you can set it to
minimize-by-default when you click the "x" on the top window bar.

- New "MAX" button
New button for each recipient in the send-bitcoins window. Given
the values already entered for other recipients and the transaction
fee, it will compute the max spendable balance for this recipient
and insert it into the "Amount" field.

- Specify Change Address (Expert Mode Only!)
The send-bitcoins window now has options in the bottom-left corner
to specify how you want change outputs to be constructed. Either
recycle change into existing addresses, or specify an address.
The


#-------------------------------------------------------------------------------
Expand Down

0 comments on commit f041845

Please sign in to comment.