UI/UserInterface.py

changeset 5841
f227183ae1df
parent 5759
b9369969b8ce
child 5842
c3f41b959a65
equal deleted inserted replaced
5840:36f8973c5a8d 5841:f227183ae1df
6505 @param versions contents of the downloaded versions file (list of 6505 @param versions contents of the downloaded versions file (list of
6506 strings) 6506 strings)
6507 """ 6507 """
6508 url = "" 6508 url = ""
6509 try: 6509 try:
6510 if "-snapshot-" in VersionOnly: 6510 if "snapshot-" in VersionOnly:
6511 # check snapshot version 6511 # check snapshot version like snapshot-20170810
6512 if versions[2][0] == "6" and versions[2] > VersionOnly: 6512 if "snapshot-" in versions[2]:
6513 res = E5MessageBox.yesNo( 6513 installedSnapshotDate = VersionOnly.rsplit("-", 1)[-1]
6514 self, 6514 availableSnapshotDate = versions[2].rsplit("-", 1)[-1]
6515 self.tr("Update available"), 6515 if availableSnapshotDate > installedSnapshotDate:
6516 self.tr( 6516 res = E5MessageBox.yesNo(
6517 """The update to <b>{0}</b> of eric6 is""" 6517 self,
6518 """ available at <b>{1}</b>. Would you like to""" 6518 self.tr("Update available"),
6519 """ get it?""") 6519 self.tr(
6520 .format(versions[2], versions[3]), 6520 """The update to <b>{0}</b> of eric6 is"""
6521 yesDefault=True) 6521 """ available at <b>{1}</b>. Would you like"""
6522 url = res and versions[3] or '' 6522 """ to get it?""")
6523 elif versions[0] > VersionOnly: 6523 .format(versions[2], versions[3]),
6524 res = E5MessageBox.yesNo( 6524 yesDefault=True)
6525 self, 6525 url = res and versions[3] or ''
6526 self.tr("Update available"),
6527 self.tr(
6528 """The update to <b>{0}</b> of eric6 is"""
6529 """ available at <b>{1}</b>. Would you like to"""
6530 """ get it?""")
6531 .format(versions[0], versions[1]),
6532 yesDefault=True)
6533 url = res and versions[1] or ''
6534 else: 6526 else:
6535 if self.manualUpdatesCheck: 6527 if self.manualUpdatesCheck:
6536 E5MessageBox.information( 6528 E5MessageBox.information(
6537 self, 6529 self,
6538 self.tr("Eric6 is up to date"), 6530 self.tr("Update Check"),
6539 self.tr( 6531 self.tr(
6540 """You are using the latest version of""" 6532 """You are using a snapshot release of"""
6541 """ eric6""")) 6533 """ eric6. A more up-to-date stable release"""
6534 """ might be available."""))
6542 elif VersionOnly.startswith(("rev_", "@@")): 6535 elif VersionOnly.startswith(("rev_", "@@")):
6536 # check installation from source
6543 if self.manualUpdatesCheck: 6537 if self.manualUpdatesCheck:
6544 E5MessageBox.information( 6538 E5MessageBox.information(
6545 self, 6539 self,
6546 self.tr("Update Check"), 6540 self.tr("Update Check"),
6547 self.tr( 6541 self.tr(
6569 self, 6563 self,
6570 self.tr("Eric6 is up to date"), 6564 self.tr("Eric6 is up to date"),
6571 self.tr( 6565 self.tr(
6572 """You are using the latest version of""" 6566 """You are using the latest version of"""
6573 """ eric6""")) 6567 """ eric6"""))
6574 except IndexError: 6568 except (IndexError, TypeError):
6575 E5MessageBox.warning( 6569 E5MessageBox.warning(
6576 self, 6570 self,
6577 self.tr("Error during updates check"), 6571 self.tr("Error during updates check"),
6578 self.tr("""Could not perform updates check.""")) 6572 self.tr("""Could not perform updates check."""))
6579 6573
6704 Private method to convert a version string into a tuple. 6698 Private method to convert a version string into a tuple.
6705 6699
6706 @param version version string 6700 @param version version string
6707 @type str 6701 @type str
6708 @return version tuple 6702 @return version tuple
6709 @rtype tuple of int and str 6703 @rtype tuple of int
6710 """ 6704 """
6711 versionParts = [] 6705 versionParts = []
6712 for part in version.split("."): 6706 for part in version.split("."):
6713 part = part.strip() 6707 part = part.strip()
6714 if part: 6708 if part:
6715 try: 6709 try:
6716 part = int(part) 6710 part = int(part)
6717 except ValueError: 6711 except ValueError:
6718 # not an integer 6712 # not an integer, ignore
6719 pass 6713 continue
6720 versionParts.append(part) 6714 versionParts.append(part)
6721 return tuple(versionParts) 6715 return tuple(versionParts)
6722 6716
6723 ################################# 6717 #################################
6724 ## Below are some utility methods 6718 ## Below are some utility methods

eric ide

mercurial