20 import urllib.request
as urllib2
21 import xmlrpc.client
as xmlrpclib
26 from ..
import version
27 from ..utils.versioncomparator
import cmp_versions
28 from ..widgets
import ButtonWithHandler, HtmlWindow, RIDEDialog
33 _CHECK_FOR_UPDATES_SETTING =
"check for updates"
37 _LAST_UPDATE_CHECK_SETTING =
"last update check"
42 VERSION = version.VERSION
43 SECONDS_IN_WEEK = 60*60*24*7
53 if self.
_settings_settings.get(_CHECK_FOR_UPDATES_SETTING,
None)
is None:
54 self.
_settings_settings[_CHECK_FOR_UPDATES_SETTING] =
True
56 return self.
_settings_settings[_CHECK_FOR_UPDATES_SETTING]
and \
60 self.
_settings_settings[_LAST_UPDATE_CHECK_SETTING] = time.time()
64 except Exception
as e:
75 return self.
_get_response_get_response((
'robotframework-ride',),
'package_releases')[0]
78 from time
import sleep
80 return self.
_get_response_get_response((
'robotframework-ride', version),
'release_data')[
'download_url']
83 xmlparm = xmlrpclib.dumps(params, method)
84 req = urllib2.Request(
'https://pypi.python.org/pypi',
85 xmlparm.encode(
'utf-8'),
86 {
'Content-Type':
'text/xml'})
87 data = urllib2.urlopen(req, timeout=1).read()
88 xml = xmlrpclib.loads(data)[0][0]
94 HtmlWindow.__init__(self, parent, size)
95 if "gtk2" or "gtk3" in wx.PlatformInfo:
96 self.SetStandardFonts()
99 wx.LaunchDefaultBrowser(link.GetHref())
106 RIDEDialog.__init__(self, title=
"Update available", size=(400, 400),
107 style=wx.DEFAULT_FRAME_STYLE | wx.FRAME_FLOAT_ON_PARENT)
109 self.SetLayoutDirection(wx.Layout_LeftToRight)
110 self.SetBackgroundColour(Colour(self.color_background))
111 self.SetForegroundColour(Colour(self.color_foreground))
112 sizer = wx.BoxSizer(orient=wx.VERTICAL)
114 hwin.set_content(f
"New version {version} available from <a href=\"{url}\">{url}</a><br/>"
115 f
"See this version <a href=\"https://github.com/robotframework/RIDE/blob/master/doc"
116 f
"/releasenotes/ride-{version}.rst\">Release Notes</a><br/><br/>"
117 f
"You can update with the command:<br/><b>pip install -U robotframework-ride</b>"
118 f
"<br/><br/>See the latest development <a href=\"https://github.com/robotframework/RIDE"
119 f
"/blob/master/CHANGELOG.adoc\">CHANGELOG</a>")
120 irep = hwin.GetInternalRepresentation()
121 hwin.SetSize((irep.GetWidth()+25, irep.GetHeight()+20))
123 checkbox = wx.CheckBox(self, -1, label=
"I\'m using another method for RIDE updates\n and "
124 "do not need automatic update checks")
125 checkbox.Bind(wx.EVT_CHECKBOX, handler=self.
OnCheckboxChangeOnCheckboxChange)
127 button = ButtonWithHandler(self, label=
"remind me later", handler=self.
OnRemindMeLaterOnRemindMeLater)
128 button.SetBackgroundColour(Colour(self.color_secondary_background))
129 button.SetForegroundColour(Colour(self.color_secondary_foreground))
132 self.CentreOnParent(wx.BOTH)
142 self.
_settings_settings[_CHECK_FOR_UPDATES_SETTING] =
not event.IsChecked()
def __init__(self, parent, size=(600, 400))
def OnLinkClicked(self, link)
def __init__(self, version, url, settings)
def OnCheckboxChange(self, event)
def OnRemindMeLater(self, event)
def _get_response(self, params, method)
def _get_download_url(self, version)
def _get_newest_version(self)
def __init__(self, settings)
def notify_update_if_needed(self, update_notification_callback)
def _is_new_version_available(self)
def cmp_versions(version1, version2)