Skip to content

Commit

Permalink
Version checker works. And a few other fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
etotheipi committed Jul 13, 2012
1 parent f041845 commit 495882f
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 58 deletions.
55 changes: 42 additions & 13 deletions ArmoryQt.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ def __init__(self, parent=None):
DlgEULA(self,self).exec_()


self.checkForLatestVersion()

self.setupNetworking()

# setupNetworking may have set this flag if something went wrong
Expand Down Expand Up @@ -433,9 +431,12 @@ def chngDev(b):
self.menusList[MENUS.Wallets].addAction(actAddressBook)


execAbout = lambda: DlgHelpAbout(self).exec_()
actAboutWindow = self.createAction('About Armory', execAbout)
execAbout = lambda: DlgHelpAbout(self).exec_()
execVersion = lambda: self.checkForLatestVersion(wasRequested=True)
actAboutWindow = self.createAction('About Armory', execAbout)
actVersionCheck = self.createAction('Armory Version...', execVersion)
self.menusList[MENUS.Help].addAction(actAboutWindow)
self.menusList[MENUS.Help].addAction(actVersionCheck)

# Restore any main-window geometry saved in the settings file
hexgeom = self.settings.get('MainGeometry')
Expand All @@ -458,6 +459,10 @@ def chngDev(b):

if CLI_ARGS:
reactor.callLater(1, self.uriLinkClicked, CLI_ARGS[0])
elif not self.firstLoad:
# Don't need to bother the user on the first load with updating
reactor.callLater(0.2, self.checkForLatestVersion)



####################################################
Expand Down Expand Up @@ -741,8 +746,22 @@ def setPreferredDateFormat(self, fmtStr):


#############################################################################
def checkForLatestVersion(self):
def checkForLatestVersion(self, wasRequested=False):
# Download latest versions.txt file, accumulate changelog

optChkVer = self.settings.getSettingOrSetDefault('CheckVersion', 'Always')
if optChkVer.lower()=='never' and not wasRequested:
LOGINFO('User requested never check for new versions', optChkVer)
return

if wasRequested and not self.internetAvail:
QMessageBox.critical(self, 'Offline Mode', \
'You are in offline mode, which means that version information '
'cannot be retrieved from the internet. Please visit '
'www.bitcoinarmory.com from an internet-connected computer '
'to get the latest version information.', QMessageBox.Ok)
return

versionFile = None
try:
import urllib2
Expand All @@ -752,6 +771,11 @@ def checkForLatestVersion(self):
LOGERROR('No module urllib2 -- cannot get latest version')
return
except (urllib2.URLError, urllib2.HTTPError):
if wasRequested:
QMessageBox.critical(self, 'Unavailable', \
'The latest Armory version information could not be retrieved.'
'Please check www.bitcoinarmory.com for the latest version '
'information.', QMessageBox.Ok)
LOGERROR('Could not access latest Armory version information')
LOGERROR('Tried: %s', HTTP_VERSION_FILE)
return
Expand All @@ -777,24 +801,29 @@ def popNextLine(currIdx):
if not line.startswith('#') and len(line)>0:
if line.startswith('VERSION'):
vstr = line.split(' ')[-1]
if vstr == thisVerString:
if vstr==thisVerString and not wasRequested:
break
changeLog.append([vstr, []])
elif line.startswith('-'):
featureTitle = line[2:]
changeLog[-1][1].append([featureTitle, ''])
changeLog[-1][1].append([featureTitle, []])
else:
changeLog[-1][1][-1][1] += line+' '
changeLog[-1][1][-1][1].append(line)
line = popNextLine(currLineIdx)

if len(changeLog)==0:
if len(changeLog)==0 and not wasRequested:
LOGINFO('You are running the latest version!')
elif optChkVer[1:]==changeLog[0][0]:
LOGINFO('Latest version is %s -- Notify user on next version.', optChkVer)
return
else:
DlgVersionNotify(self,self, changeLog).exec_()



DlgVersionNotify(self,self, changeLog, wasRequested).exec_()
except:
if wasRequested:
QMessageBox.critical(self, 'Parse Error', \
'The version information is malformed and cannot be understood. '
'Please check www.bitcoinarmory.com for the latest version '
'information.', QMessageBox.Ok)
LOGEXCEPT('Error trying to parse versions.txt file')


Expand Down
17 changes: 7 additions & 10 deletions armoryengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
################################################################################


# Version Numbers
BTCARMORY_VERSION = (0, 80, 3, 0) # (Major, Minor, Minor++, even-more-minor)
PYBTCWALLET_VERSION = (1, 35, 0, 0) # (Major, Minor, Minor++, even-more-minor)

ARMORY_DONATION_ADDR = '1ArmoryXcfq7TnCSuZa9fQjRYwJ4bkRKfv'



Expand Down Expand Up @@ -96,12 +101,6 @@



# Version Numbers -- numDigits [var, 2, 2, 3]
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)

ARMORY_DONATION_ADDR = '1ArmoryXcfq7TnCSuZa9fQjRYwJ4bkRKfv'

def getVersionString(vquad, numPieces=4):
vstr = '%d.%02d' % vquad[:2]
Expand Down Expand Up @@ -138,7 +137,6 @@ def readVersionInt(verInt):
print '********************************************************************************'
print 'Loading Armory Engine:'
print ' Armory Version: ', getVersionString(BTCARMORY_VERSION)
print ' PyBtcAddress Version:', getVersionString(PYBTCADDRESS_VERSION)
print ' PyBtcWallet Version:', getVersionString(PYBTCWALLET_VERSION)

# Get the host operating system
Expand Down Expand Up @@ -323,7 +321,7 @@ def chopLogFile(filename, size):


# Now set loglevels
DateFormat = '%Y-%m-%d %H:%M:%S'
DateFormat = '%Y-%m-%d %H:%M'
logging.getLogger('').setLevel(logging.DEBUG)
fileFormatter = logging.Formatter('%(asctime)s (%(levelname)s) -- %(filename)s::%(lineno)d -- %(message)s', \
datefmt=DateFormat)
Expand Down Expand Up @@ -433,7 +431,6 @@ def logexcept_override(type, value, tback):
LOGINFO('************************************************************')
LOGINFO('Loading Armory Engine:')
LOGINFO(' Armory Version : ' + getVersionString(BTCARMORY_VERSION))
LOGINFO(' PyBtcAddress Version : ' + getVersionString(PYBTCADDRESS_VERSION))
LOGINFO(' PyBtcWallet Version : ' + getVersionString(PYBTCWALLET_VERSION))
LOGINFO('Detected Operating system: ' + OS_NAME)
LOGINFO(' User home-directory : ' + USER_HOME_DIR)
Expand Down Expand Up @@ -2306,7 +2303,7 @@ def chk(a):
binOut = BinaryPacker()
binOut.put(BINARY_CHUNK, self.addrStr20, width=20)
binOut.put(BINARY_CHUNK, chk(self.addrStr20), width= 4)
binOut.put(UINT32, getVersionInt(PYBTCADDRESS_VERSION))
binOut.put(UINT32, getVersionInt(PYBTCWALLET_VERSION))
binOut.put(UINT64, bitset_to_int(flags))

# Write out address-chaining parameters (for deterministic wallets)
Expand Down
92 changes: 67 additions & 25 deletions qtdialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9940,28 +9940,48 @@ def clickOtherOpt(self, boolState):

################################################################################
class DlgVersionNotify(ArmoryDialog):
def __init__(self, parent, main, changelog):
def __init__(self, parent, main, changelog, wasRequested=False):
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))
self.myVersion = getVersionString(BTCARMORY_VERSION)
self.latestVer = changelog[0][0]
lblDescr = QRichLabel('')

if self.myVersion==self.latestVer:
lblDescr = QRichLabel( \
'Your Armory installation is up-to-date!'
'<br><br>'
'<b>Installed Version</b>: %s<br>'
'<br><br>'
'When they become available, you can find and download new '
'versions of Armory from: '
'<a href="http://bitcoinarmory.com/index.php/get-armory">'
'http://bitcoinarmory.com/index.php/get-armory</a> ' % self.myVersion)
else:
lblDescr = QRichLabel( \
'<font size=4><u><b>There is a new version of Armory available!</b></u></font>'
'<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. '
'Installing over your existing '
'version is perfectly safe. All your wallets and settings '
'will remain untouched through the update process.' % \
(self.myVersion, self.latestVer))

lblDescr.setOpenExternalLinks(True)
lblDescr.setTextInteractionFlags(Qt.TextSelectableByMouse | \
Qt.TextSelectableByKeyboard)
lblChnglog = QRichLabel('')
if wasRequested:
lblChnglog = QRichLabel("<b>Changelog</b>:")
else:
lblChnglog = QRichLabel('New features added between version %s and %s:' % \
(self.myVersion,self.latestVer))



txtChangeLog = QTextEdit()
Expand All @@ -9978,22 +9998,44 @@ def __init__(self, parent, main, changelog):
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])
for dtxt in feat[1]:
txtChangeLog.insertHtml('%s<br>' % dtxt)
txtChangeLog.insertHtml('<br><br>')

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

curs = txtChangeLog.textCursor()
curs.movePosition(QTextCursor.Start)
txtChangeLog.setTextCursor(curs)

btnDNAA = QPushButton('Do not notify me of new versions')
btnDelay = QPushButton('No more reminders until next version')
btnOkay = QPushButton('Okay')
self.connect(btnDNAA, SIGNAL('clicked()'), self.clickDNAA)
self.connect(btnDelay, SIGNAL('clicked()'), self.clickDelay)
self.connect(btnOkay, SIGNAL('clicked()'), self.accept)

frmDescr = makeVertFrame([lblDescr], STYLE_SUNKEN)
frmLog = makeVertFrame([lblChnglog, 'Space(5)', txtChangeLog], STYLE_SUNKEN)
frmBtn = makeHorizFrame([btnDNAA, btnDelay, 'Stretch', btnOkay], STYLE_SUNKEN)
dlgLayout = QVBoxLayout()
dlgLayout.addWidget(lblDescr)
dlgLayout.addWidget(txtChangeLog)
dlgLayout.addWidget(frmDescr)
dlgLayout.addWidget(frmLog)
dlgLayout.addWidget(frmBtn)
dlgLayout.setContentsMargins(20,20,20,20)

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


def clickDNAA(self):
self.main.settings.set('CheckVersion', 'Never')
self.accept()

def clickDelay(self):
self.main.settings.set('CheckVersion', 'v'+self.latestVer)
self.accept()





Expand Down
16 changes: 6 additions & 10 deletions versions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#-------------------------------------------------------------------------------
VERSION 0.82.1

- URI Creator
- URL/Link 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.
Expand All @@ -18,9 +18,11 @@ VERSION 0.82.1
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.
All information normally written to console is now saved to a
log file in the Armory home directory. This makes it much easier,
to report bugs/crashes, especially for Windows users. Please use
"File"-->"Export Log File" to save a copy and send it with your
bug reports.

- Specify Change Address (Expert Mode Only!)
The send-bitcoins window now has options in the bottom-left corner
Expand All @@ -43,12 +45,6 @@ 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 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.



Expand Down

0 comments on commit 495882f

Please sign in to comment.