Skip to content

Commit f187172

Browse files
Settings editor button at Preferences and backup of settings.cfg
1 parent 7d189cc commit f187172

File tree

9 files changed

+36
-14
lines changed

9 files changed

+36
-14
lines changed

CHANGELOG.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ and this project adheres to http://semver.org/spec/v2.0.0.html[Semantic Versioni
99
== https://github.com/robotframework/RIDE[Unreleased]
1010

1111
=== Added
12+
- Added Settings Editor button to Preferences dialog, to edit settings.cfg.
13+
- Created backup of settings.cfg to allow recovering some settings when broken upgrades.
1214
- Added current executing keyword and other statuses to TestRunner status bar.
1315
- Added Config Panel button to supported installed Plugins next to their name in Plugin Manager dialog.
1416
- Added Config Panel button to Plugins, working examples in Text Editor and Test Runner.

README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Likewise, the current version of wxPython, is 4.2.2, but RIDE is known to work w
4040

4141
`pip install -U robotframework-ride`
4242

43-
(3.8 <= python <= 3.13) Install current development version (**2.2dev20**) with:
43+
(3.8 <= python <= 3.13) Install current development version (**2.2dev21**) with:
4444

4545
`pip install -U https://github.com/robotframework/RIDE/archive/develop.zip`
4646

src/robotide/application/releasenotes.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ def set_content(self, html_win, content):
170170
</ul>
171171
<p><strong>New Features and Fixes Highlights</strong></p>
172172
<ul class="simple">
173+
<li>Added Settings Editor button to Preferences dialog, to edit settings.cfg.</li>
174+
<li>Created backup of settings.cfg to allow recovering some settings when broken upgrades.</li>
173175
<li>Changed some informative dialogs and JSON Editor to use the customized colors.</li>
174176
<li>Added current executing keyword and other statuses to TestRunner status bar.</li>
175177
<li>Modified import statements to allow running RIDE without Robot Framework installed or versions older than 6.0.</li>
@@ -232,7 +234,9 @@ def set_content(self, html_win, content):
232234
<pre class="literal-block">python -m robotide.postinstall -install</pre>
233235
<p>or</p>
234236
<pre class="literal-block">ride_postinstall.py -install</pre>
235-
<p>RIDE {VERSION} was released on 12/April/2025.</p>
237+
<p>RIDE {VERSION} was released on 13/April/2025.</p>
238+
<br/>
239+
<h3>Happy International Kiss Day!</h3>
236240
<!-- <br/>
237241
<h3>May The Fourth Be With You!</h3>
238242
<h3>Celebrate the bank holiday, 10th June, Day of Portugal, Portuguese Communities and Camões!!</h3>

src/robotide/editor/customsourceeditor.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import wx.stc as stc
2525
from robotide.editor.pythoneditor import PythonSTC
2626
from wx import Colour
27+
from ..widgets import ImageProvider
2728

2829
# ---------------------------------------------------------------------------
2930
# This is how you pre-establish a file filter so that the dialog
@@ -534,6 +535,10 @@ def main(filepath, frame=None):
534535
if frame is None:
535536
frame = wx.Frame(None)
536537
CodeEditorPanel(frame, None, filepath)
538+
image_provider = ImageProvider()
539+
frame.SetTitle(filepath)
540+
frame.SetIcon(wx.Icon(image_provider.RIDE_ICON))
541+
frame.CenterOnScreen()
537542
frame.Show(True)
538543
app.MainLoop()
539544
# ----------------------------------------------------------------------------

src/robotide/preferences/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ def __init__(self, settings):
5050
self._preference_panels = []
5151
self._add_builtin_preferences()
5252
self.settings_path = self.settings._default_path
53-
print(f"DEBUG: preferences/__init__.py Preferences settings_path={self.settings_path}")
5453

5554
@property
5655
def preference_panels(self):

src/robotide/preferences/editor.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@
3131
"""
3232

3333
import builtins
34+
import os.path
35+
3436
import wx
3537
from wx import Colour
3638
from wx.lib.scrolledpanel import ScrolledPanel
3739

3840
from .settings import RideSettings
39-
from ..widgets import ButtonWithHandler, HorizontalSizer
41+
from ..widgets import ButtonWithHandler
4042

4143
_ = wx.GetTranslation # To keep linter/code analyser happy
4244
builtins.__dict__['_'] = wx.GetTranslation
@@ -199,23 +201,21 @@ class PanelContainer(wx.Panel):
199201
Each page has a title area, and an area for a preferences panel
200202
"""
201203
def __init__(self, *args, **kwargs):
202-
from ..editor import customsourceeditor
203204
super(PanelContainer, self).__init__(*args, **kwargs)
204-
205+
self.parent = self.GetParent()
205206
self._current_panel = None
206207
self._settings = RideSettings()
207208
self.settings = self._settings['General']
208209
self.title = wx.StaticText(self, label="Your message here")
209-
print(f"DEBUG: preferences/editor.py PanelContainer settings_path={self._settings.user_path}")
210-
hsizer = HorizontalSizer()
210+
hsizer = wx.BoxSizer(wx.HORIZONTAL)
211211
config_button = ButtonWithHandler(self, _('Settings'), bitmap='wrench_orange.png',
212212
fsize=self.settings[FONT_SIZE],
213-
handler=lambda e: customsourceeditor.main(self._settings.user_path))
213+
handler=lambda e: self.on_edit_settings(self._settings.user_path))
214214
config_button.SetBackgroundColour(self.settings['background'])
215215
config_button.SetOwnBackgroundColour(self.settings['background'])
216216
config_button.SetForegroundColour(self.settings['foreground'])
217-
hsizer.Add(self.title, 0, wx.TOP | wx.LEFT | wx.EXPAND, 10)
218-
hsizer.add_expanding(config_button, 1, 10)
217+
hsizer.Add(config_button, 0, wx.TOP | wx.RIGHT | wx.EXPAND, 4)
218+
hsizer.Add(self.title, 0, wx.TOP | wx.LEFT | wx.EXPAND, 4)
219219
self.panels_container = ScrolledPanel(self, wx.ID_ANY, style=wx.TAB_TRAVERSAL)
220220
self.panels_container.SetupScrolling()
221221
sizer = wx.BoxSizer(wx.VERTICAL)
@@ -269,3 +269,12 @@ def ShowPanel(self, panel):
269269
def SetTitle(self, title):
270270
"""Set the title of the panel"""
271271
self.title.SetLabel(title)
272+
273+
def on_edit_settings(self, settings_path):
274+
"""Starts Text Editor for settings file and closes all if changed"""
275+
from ..editor import customsourceeditor
276+
from ..context import SETTINGS_DIRECTORY
277+
main_settings_path = os.path.join(SETTINGS_DIRECTORY, 'settings.cfg')
278+
customsourceeditor.main(main_settings_path)
279+
# DEBUG close parent test
280+
# self.parent.Close()

src/robotide/preferences/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,12 +376,12 @@ def __init__(self, path=None):
376376
digest += ord(c)
377377
new_user_path = self.user_path.replace("settings.cfg", f"settings_{digest}.cfg")
378378
new_user_path = initialize_settings(self.user_path, new_user_path)
379-
self.user_path = new_user_path
380379
Settings.__init__(self, new_user_path)
381380
self._settings_dir = os.path.dirname(new_user_path)
382381
self.set('install root', os.path.dirname(os.path.dirname(__file__)))
383382
self.set('executable', EXECUTABLE)
384-
self.set('last_settings_path', self.user_path)
383+
self.set('last_settings_path', new_user_path)
384+
self.user_path = new_user_path
385385

386386
def get_path(self, *parts):
387387
"""Returns path which combines settings directory and given parts."""

src/robotide/ui/mainframe.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,12 @@ def get_selected_datafile_controller(self):
337337
return self.tree.get_selected_datafile_controller()
338338

339339
def on_close(self, event):
340+
from ..preferences import RideSettings
340341
if self._allowed_to_exit():
341342
try:
342343
perspective = self.aui_mgr.SavePerspective()
344+
# Next restore of settings is because we may have edited from Preferences
345+
self._application.settings = RideSettings(self._application.settings_path)
343346
self._application.settings.set('AUI Perspective', perspective)
344347
# deinitialize the frame manager
345348
self.aui_mgr.UnInit()

src/robotide/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
#
1616
# Automatically generated by `tasks.py`.
1717

18-
VERSION = 'v2.2dev20'
18+
VERSION = 'v2.2dev21'

0 commit comments

Comments
 (0)