Coverage for src/robotide/application/releasenotes.py: 72%

81 statements  

« prev     ^ index     » next       coverage.py v7.8.0, created at 2025-05-06 10:40 +0100

1# -*- encoding: utf-8 -*- 

2# Copyright 2008-2015 Nokia Networks 

3# Copyright 2016- Robot Framework Foundation 

4# 

5# Licensed under the Apache License, Version 2.0 (the "License"); 

6# you may not use this file except in compliance with the License. 

7# You may obtain a copy of the License at 

8# 

9# http://www.apache.org/licenses/LICENSE-2.0 

10# 

11# Unless required by applicable law or agreed to in writing, software 

12# distributed under the License is distributed on an "AS IS" BASIS, 

13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 

14# See the License for the specific language governing permissions and 

15# limitations under the License. 

16 

17import builtins 1ab

18import os 1ab

19import re 1ab

20import time 1ab

21import wx 1ab

22from wx import Colour 1ab

23from wx.lib.ClickableHtmlWindow import PyClickableHtmlWindow 1ab

24from os.path import abspath, join, dirname 1ab

25 

26from ..action import ActionInfo 1ab

27from ..version import VERSION 1ab

28from ..widgets import HtmlDialog 1ab

29 

30_ = wx.GetTranslation # To keep linter/code analyser happy 1ab

31builtins.__dict__['_'] = wx.GetTranslation 1ab

32 

33HTML_FOREGROUND = 'foreground text' 1ab

34 

35 

36class ReleaseNotes(object): 1ab

37 """Shows release notes of the current version. 

38 

39 The release notes tab will automatically be shown once per release. 

40 The user can also view them on demand by selecting "Release Notes" 

41 from the help menu. 

42 """ 

43 

44 def __init__(self, application): 1ab

45 self.application = application 

46 settings = application.settings 

47 self.version_shown = settings.get('version_shown', '') 

48 self.general_settings = settings['General'] 

49 self._view = None 

50 self._dialog = None 

51 self.enable() 

52 

53 def enable(self): 1ab

54 self.application.frame.actions.register_action(ActionInfo(_('Help'), _('Release Notes'), 

55 self.show, 

56 doc=_('Show the release notes'))) 

57 self.application.frame.actions.register_action(ActionInfo(_('Help'), _('Offline Change Log'), 

58 self.show_changelog, 

59 doc=_('Show the offline CHANGELOG'))) 

60 self.show_if_updated() 

61 

62 def show_if_updated(self): 1ab

63 if self.version_shown != VERSION: 

64 self.show() 

65 self.application.settings['version_shown'] = VERSION 

66 

67 def show(self, event=None): 1ab

68 __ = event 

69 if not self._view: 69 ↛ 72line 69 didn't jump to line 72 because the condition on line 69 was always true

70 self._view = self._create_view() 

71 self.application.frame.notebook.AddPage(self._view, _("Release Notes"), select=False) 

72 self.application.frame.notebook.show_tab(self._view) 

73 

74 def show_changelog(self, event=None): 1ab

75 __ = event 

76 if not self._dialog: 

77 self._dialog = HtmlDialog(_('Offline Change Log'), 

78 _("Check the online version at ") + 

79 f"https://github.com/robotframework/RIDE/blob/{VERSION}/CHANGELOG.adoc") 

80 self._dialog.SetSize(800, 800) 

81 # DEBUG: If we LoadFile, we cannot change the foreground color 

82 # self._dialog.html_wnd.LoadFile(join(dirname(abspath(__file__)), "CHANGELOG.html")) 

83 with open(join(dirname(abspath(__file__)), "CHANGELOG.html"), 'r', encoding='utf-8') as change_log: 

84 content = change_log.read() 

85 fgcolor = self.general_settings[HTML_FOREGROUND] 

86 if isinstance(fgcolor, tuple): 

87 fgcolor = '#' + ''.join(hex(item)[2:] for item in fgcolor) 

88 new_content = content.replace("<body>", f'<body><div><font color="{fgcolor}">') \ 

89 .replace("</body>", "</font></div></body>") 

90 self._dialog.html_wnd.SetPage(new_content) 

91 self._dialog.html_wnd.SetBackgroundColour(self.general_settings['background help']) 

92 self._dialog.html_wnd.SetForegroundColour(fgcolor) 

93 self._dialog.Show() 

94 

95 def bring_to_front(self): 1ab

96 if self._view: 

97 self.application.frame.notebook.show_tab(self._view) 

98 

99 def _create_view(self): 1ab

100 panel = wx.Panel(self.application.frame.notebook) 

101 html_win = PyClickableHtmlWindow(panel, -1) 

102 html_win.SetStandardFonts() 

103 fgcolor = self.general_settings.get(HTML_FOREGROUND, Colour(7, 0, 70)) 

104 panel.SetForegroundColour(fgcolor) 

105 html_win.SetOwnForegroundColour(fgcolor) 

106 self.set_content(html_win, WELCOME_TEXT + RELEASE_NOTES) 

107 sizer = wx.BoxSizer(wx.VERTICAL) 

108 sizer.Add(html_win, 1, wx.EXPAND | wx.ALL, border=8) 

109 panel.SetSizer(sizer) 

110 return panel 

111 

112 def set_content(self, html_win, content): 1ab

113 bkgcolor = self.general_settings.get('background help', Colour(240, 242, 80)) 

114 fgcolor = self.general_settings.get(HTML_FOREGROUND, Colour(7, 0, 70)) 

115 if isinstance(bkgcolor, tuple): 115 ↛ 116line 115 didn't jump to line 116 because the condition on line 115 was never true

116 bkgcolor = '#' + ''.join(hex(item)[2:] for item in bkgcolor) 

117 if isinstance(fgcolor, tuple): 117 ↛ 118line 117 didn't jump to line 118 because the condition on line 117 was never true

118 fgcolor = '#' + ''.join(hex(item)[2:] for item in fgcolor) 

119 _content = f'<body bgcolor="{bkgcolor}"><div><font color="{fgcolor}">' + content + "</font></div></body>" 

120 html_win.SetPage(_content) 

121 

122 

123date = time.strftime('%d/%m/%Y', time.localtime(os.path.getmtime(__file__))) 1ab

124version = VERSION 1ab

125milestone = re.split('[ab-]', VERSION)[0] 1ab

126 

127WELCOME_TEXT = f""" 1ab

128<h2>Welcome to use RIDE version {version}</h2> 

129 

130<p>Thank you for using the <a href="https://robotframework.org/">Robot Framework</a> IDE (RIDE).</p> 

131 

132<p>Visit RIDE on the web:</p> 

133 

134<ul> 

135 <li><a href="https://github.com/robotframework/RIDE"> 

136 RIDE project page on github</a></li> 

137 <li><a href="https://github.com/robotframework/RIDE/wiki/Installation-Instructions"> 

138 Installation instructions</a></li> 

139 <li><a href="https://github.com/robotframework/RIDE/releases"> 

140 Release notes</a></li> 

141</ul> 

142""" 

143 

144# *** DO NOT EDIT THE CODE BELOW MANUALLY *** 

145# Release notes are updated automatically by package.py script whenever 

146# a numbered distribution is created. 

147RELEASE_NOTES = f""" 1ab

148 

149<div class="document"> 

150 

151<p><a class="reference external" href="https://github.com/robotframework/RIDE/">RIDE (Robot Framework IDE)</a> 

152 {VERSION} is a new release with some enhancements and bug fixes. The reference for valid arguments is 

153 <a class="reference external" href="https://robotframework.org/">Robot Framework</a> current version, 7.2.2. However,  

154 internal library code is originally based on version 3.1.2, but adapted for new versions.</p> 

155<ul class="simple"> 

156<li>This version supports Python 3.8 up to 3.13 (and also tested on 3.14.a7 with wxPython 4.2.3).</li> 

157<li>There are some changes, or known issues:<ul> 

158<!-- 

159<li>🐞 - When upgrading RIDE and activate Restart, some errors are visible about missing /language file, and behaviour 

160 is not normal. Better to close RIDE and start a new instance.</li> 

161<li>🐞 - Problems with COPY/PASTE in Text Editor have been reported when using wxPython 4.2.0, but not with  

162version 4.2.1, 4.2.2 and 4.2.3, which we now <em>recommend</em>.</li> 

163--> 

164<li>🐞 - Rename Keywords, Find Usages/Find where used are not finding all occurrences. Please, double-check findings and changes.</li> 

165<li>🐞 - Some argument types detection (and colorization) is not correct in Grid Editor.</li> 

166<li>🐞 - RIDE <strong>DOES NOT KEEP</strong> Test Suites formatting or structure, causing differences in files when used 

167 on other IDE or Editors. The option to not reformat the file is not working.</li> 

168<li>🐞 - In Grid Editor, when showing settings, scrolling down with mouse or using down is not working. You can change 

169 to Text Editor and back to Grid Editor, to restore normal behavior.</li> 

170</ul> 

171</li> 

172</ul> 

173<p><strong>New Features and Fixes Highlights</strong></p> 

174<ul class="simple"> 

175<li>Fixed white blocks on Tree due to failed animation when test execution is too rapid, causing crash on Windows.</li> 

176<li>Added Settings Editor button to Preferences dialog, to edit settings.cfg.</li> 

177<li>Created backup of settings.cfg to allow recovering some settings when broken upgrades.</li> 

178<li>Changed some informative dialogs and JSON Editor to use the customized colors.</li> 

179<li>Added current executing keyword and other statuses to TestRunner status bar.</li> 

180<li>Modified import statements to allow running RIDE without Robot Framework installed or versions older than 6.0.</li> 

181<li>Added Config Panel button to supported installed Plugins next to their name in Plugin Manager dialog.</li> 

182<li>Added Config Panel button to Plugins, working examples in Text Editor and Test Runner.</li> 

183<li>On Windows ignore false modification on files when opening Test Suites, causing confirmation dialog.</li> 

184<li>Added divided Status Bar. Left side for main window, right side for Plugins. Working example in Text Editor, 

185when selecting in Tree shows the filename in StatusBar.</li> 

186</ul> 

187<!-- <p>We hope to implement or complete features and make fixes on next major version 2.1 (in mid Autumm of 2024).</p> 

188--> 

189<p><strong>The minimal wxPython version is, 4.0.7, and RIDE supports the current version, 4.2.3, which we recommend. 

190</strong></p> 

191<p><em>Linux users are advised to install first wxPython from .whl package at</em> <a class="reference external" 

192 href="https://extras.wxpython.org/wxPython4/extras/linux/gtk3/">wxPython.org</a>, or by using the system package 

193 manager.</p> 

194<p>The <a class="reference external" href="https://github.com/robotframework/RIDE/blob/master/CHANGELOG.adoc"> 

195CHANGELOG.adoc</a> lists the changes done on the different versions.</p> 

196<p>All issues targeted for RIDE v2.2 can be found 

197from the <a class="reference external" href="https://github.com/robotframework/RIDE/issues?q=milestone%3Av2.2">issue 

198 tracker milestone</a>.</p> 

199<p>Questions and comments related to the release can be sent to the 

200<a class="reference external" href="https://groups.google.com/group/robotframework-users">robotframework-users</a> 

201 mailing list or to the channel #ride on 

202<a class="reference external" href="https://robotframework-slack-invite.herokuapp.com">Robot Framework Slack</a>, 

203 and possible bugs submitted to the <a class="reference external" href="https://github.com/robotframework/RIDE/issues"> 

204 issue tracker</a>. 

205You should see <a class="reference external" href="https://forum.robotframework.org/c/tools/ride/">Robot Framework 

206 Forum</a> if your problem is already known.</p> 

207<p>To install the latest release with <a class="reference external" href="https://pypi.org/project/pip/">pip</a> installed, just run</p> 

208<pre class="literal-block"> 

209pip install --upgrade robotframework-ride==2.1.3 

210</pre> 

211<p>to install exactly the specified release, which is the same as using</p> 

212<pre class="literal-block"> 

213pip install --upgrade robotframework-ride 

214</pre> 

215 

216<p>Alternatively you can download the source 

217distribution from <a class="reference external" href="https://pypi.python.org/pypi/robotframework-ride">PyPI</a> and 

218 install it manually. For more details and other 

219installation approaches, see the <a class="reference external" 

220 href="https://github.com/robotframework/RIDE/wiki/Installation-Instructions">installation instructions</a>. 

221If you want to help in the development of RIDE, by reporting issues in current development version, you can install 

222 with:</p> 

223<pre class="literal-block"> 

224pip install -U https://github.com/robotframework/RIDE/archive/develop.zip 

225</pre> 

226<p>Important document for helping with development is the <a class="reference external" 

227 href="https://github.com/robotframework/RIDE/blob/develop/CONTRIBUTING.adoc">CONTRIBUTING.adoc</a>.</p> 

228<p>To start RIDE from a command window, shell or terminal, just enter:</p> 

229<pre>ride</pre> 

230<p>You can also pass some arguments, like a path for a test suite file or directory.<p> 

231<pre>ride example.robot</pre> 

232<p>Another possible way to start RIDE is:</p> 

233<pre class="literal-block"> 

234python -m robotide 

235</pre> 

236<p>You can then go to <cite>Tools&gt;Create RIDE Desktop Shortcut</cite>, or run the shortcut creation script with:</p> 

237<pre class="literal-block">python -m robotide.postinstall -install</pre> 

238<p>or</p> 

239<pre class="literal-block">ride_postinstall.py -install</pre> 

240<p>RIDE {VERSION} was released on 03/May/2025.</p> 

241<!-- <br/> 

242<h3>May The Fourth Be With You!</h3> 

243<h3>Celebrate the bank holiday, 10th June, Day of Portugal, Portuguese Communities and Camões!!</h3> 

244<h3 align='center'>🇵🇹</h3> 

245--> 

246</div> 

247"""