diff -r ea0f0f066b1d -r 0752bdd8db77 UI/UserInterface.py --- a/UI/UserInterface.py Thu Aug 03 14:50:59 2017 +0200 +++ b/UI/UserInterface.py Fri Sep 01 12:08:17 2017 +0200 @@ -6506,39 +6506,33 @@ """ url = "" try: - if "-snapshot-" in VersionOnly: - # check snapshot version - if versions[2][0] == "6" and versions[2] > VersionOnly: - res = E5MessageBox.yesNo( - self, - self.tr("Update available"), - self.tr( - """The update to <b>{0}</b> of eric6 is""" - """ available at <b>{1}</b>. Would you like to""" - """ get it?""") - .format(versions[2], versions[3]), - yesDefault=True) - url = res and versions[3] or '' - elif versions[0] > VersionOnly: - res = E5MessageBox.yesNo( - self, - self.tr("Update available"), - self.tr( - """The update to <b>{0}</b> of eric6 is""" - """ available at <b>{1}</b>. Would you like to""" - """ get it?""") - .format(versions[0], versions[1]), - yesDefault=True) - url = res and versions[1] or '' + if "snapshot-" in VersionOnly: + # check snapshot version like snapshot-20170810 + if "snapshot-" in versions[2]: + installedSnapshotDate = VersionOnly.rsplit("-", 1)[-1] + availableSnapshotDate = versions[2].rsplit("-", 1)[-1] + if availableSnapshotDate > installedSnapshotDate: + res = E5MessageBox.yesNo( + self, + self.tr("Update available"), + self.tr( + """The update to <b>{0}</b> of eric6 is""" + """ available at <b>{1}</b>. Would you like""" + """ to get it?""") + .format(versions[2], versions[3]), + yesDefault=True) + url = res and versions[3] or '' else: if self.manualUpdatesCheck: E5MessageBox.information( self, - self.tr("Eric6 is up to date"), + self.tr("Update Check"), self.tr( - """You are using the latest version of""" - """ eric6""")) + """You are using a snapshot release of""" + """ eric6. A more up-to-date stable release""" + """ might be available.""")) elif VersionOnly.startswith(("rev_", "@@")): + # check installation from source if self.manualUpdatesCheck: E5MessageBox.information( self, @@ -6570,7 +6564,7 @@ self.tr( """You are using the latest version of""" """ eric6""")) - except IndexError: + except (IndexError, TypeError): E5MessageBox.warning( self, self.tr("Error during updates check"), @@ -6705,7 +6699,7 @@ @param version version string @type str @return version tuple - @rtype tuple of int and str + @rtype tuple of int """ versionParts = [] for part in version.split("."): @@ -6714,8 +6708,8 @@ try: part = int(part) except ValueError: - # not an integer - pass + # not an integer, ignore + continue versionParts.append(part) return tuple(versionParts) @@ -6753,13 +6747,19 @@ ## Support for desktop notifications below ########################################## - def showNotification(self, icon, heading, text): + def showNotification(self, icon, heading, text, timeout=None): """ Public method to show a desktop notification. - @param icon icon to be shown in the notification (QPixmap) - @param heading heading of the notification (string) - @param text text of the notification (string) + @param icon icon to be shown in the notification + @type QPixmap + @param heading heading of the notification + @type str + @param text text of the notification + @type str + @param timeout time in seconds the notification should be shown + (None = use configured timeout, 0 = indefinitely) + @type int """ if Preferences.getUI("NotificationsEnabled"): if self.__notification is None: @@ -6768,8 +6768,9 @@ self.__notification.setPixmap(icon) self.__notification.setHeading(heading) self.__notification.setText(text) - self.__notification.setTimeout( - Preferences.getUI("NotificationTimeout")) + if timeout is None: + timeout = Preferences.getUI("NotificationTimeout") + self.__notification.setTimeout(timeout) self.__notification.move(Preferences.getUI("NotificationPosition")) self.__notification.show()