From 1972e478cc12fdfaf3e897224886a858f7e39471 Mon Sep 17 00:00:00 2001 From: HelioGuilherme66 Date: Wed, 29 Jan 2025 00:17:19 +0000 Subject: [PATCH 01/75] Development version --- CHANGELOG.adoc | 2 +- src/robotide/version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 3778e4002..5b83cae0f 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -6,7 +6,7 @@ All notable changes to this project will be documented in this file. The format is based on http://keepachangelog.com/en/1.0.0/[Keep a Changelog] and this project adheres to http://semver.org/spec/v2.0.0.html[Semantic Versioning]. - +== https://github.com/robotframework/RIDE[Unreleased] == https://github.com/robotframework/RIDE/blob/master/doc/releasenotes/ride-2.1.2.rst[2.1.2] - 2025-01-28 diff --git a/src/robotide/version.py b/src/robotide/version.py index 3654b1936..9dd66e10e 100644 --- a/src/robotide/version.py +++ b/src/robotide/version.py @@ -15,4 +15,4 @@ # # Automatically generated by `tasks.py`. -VERSION = 'v2.1.2' +VERSION = 'v2.2dev2' From 716540ef27e43705932eaf527f93d546a06cb870 Mon Sep 17 00:00:00 2001 From: HelioGuilherme66 Date: Thu, 30 Jan 2025 23:44:28 +0000 Subject: [PATCH 02/75] Fix bad selection of items in Project Explorer with Right Click. --- CHANGELOG.adoc | 5 ++ README.adoc | 2 +- src/robotide/application/CHANGELOG.html | 101 ++++++++++++----------- src/robotide/application/releasenotes.py | 6 +- src/robotide/ui/treenodehandlers.py | 3 + src/robotide/version.py | 2 +- 6 files changed, 65 insertions(+), 54 deletions(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 5b83cae0f..a2b784627 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -8,6 +8,11 @@ and this project adheres to http://semver.org/spec/v2.0.0.html[Semantic Versioni == https://github.com/robotframework/RIDE[Unreleased] +=== Fixed + +- Regression fix from v2.1b1 - Fix wrong item selection, like Test Suite, when doing right-click actions in Project Explorer. + When right clicking over Tree elements, to, for example, expand or select tests, we want to keep the Editor in the same file or position. + == https://github.com/robotframework/RIDE/blob/master/doc/releasenotes/ride-2.1.2.rst[2.1.2] - 2025-01-28 === Fixed diff --git a/README.adoc b/README.adoc index 73f17fe2d..1113954d6 100644 --- a/README.adoc +++ b/README.adoc @@ -40,7 +40,7 @@ Likewise, the current version of wxPython, is 4.2.2, but RIDE is known to work w `pip install -U robotframework-ride` -(3.8 <= python <= 3.13) Install current development version (**2.1.2**) with: +(3.8 <= python <= 3.13) Install current development version (**2.2dev3**) with: `pip install -U https://github.com/robotframework/RIDE/archive/develop.zip` diff --git a/src/robotide/application/CHANGELOG.html b/src/robotide/application/CHANGELOG.html index 4d8d7a7c1..db956f91c 100644 --- a/src/robotide/application/CHANGELOG.html +++ b/src/robotide/application/CHANGELOG.html @@ -1,18 +1,21 @@ Changelog

Changelog


All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog -and this project adheres to Semantic Versioning.

<!-- == Unreleased -→

1. 2.1.2 - 2025-01-28

1.1. Fixed

  • +and this project adheres to Semantic Versioning.

    1.1. Fixed

    • +Regression fix from v2.1b1 - Fix wrong item selection, like Test Suite, when doing right-click actions in Project Explorer. + When right clicking over Tree elements, to, for example, expand or select tests, we want to keep the Editor in the same file or position. +

    2. 2.1.2 - 2025-01-28

    2.1. Fixed

    • Partial fix of no update of renaming resource prefixed keywords. Issue #1230 from 29 Jan 2013.
    • Fixed no recognition of keywords with embedded arguments and full name. Issue #1106 from 12 Sep 2012. -

    2. 2.1.1 - 2024-11-14

    2.1. Changed

    • +

    3. 2.1.1 - 2024-11-14

    3.1. Changed

    • Changed the workflow for the development versions of RIDE. Now, development versions are taken from the ``develop`` branch, and the ``master`` will stay with released version.
    • Changed the way ``configobj`` code is imported. Now is a submodule obtained from https://github.com/DiffSK/configobj. -

    2.2. Fixed

    • +

    3.2. Fixed

    • Fixed broken go to definition after editing content in resource files.
    • Fixed long arguments in fixtures appearing splitted in Grid Editor. Still, arguments info will not be correct at calling step. -

    3. 2.1 - 2024-10-13

    3.1. Added

      (2.1 - 2024-10-13)
    +

4. 2.1 - 2024-10-13

4.1. Added

  (2.1 - 2024-10-13)
 - Added a setting for a specific Browser by editing the settings.cfg file. Add the string parameter
 ``browser`` in the section ``[Plugins][[Test Runner]]``.
   (2.1b1 - 2024-09-21)
@@ -67,7 +70,7 @@
 - Added ``FOR`` scope markers (``IN``, ``IN RANGE``, ``IN ENUMERATE``, ``IN ZIP``) to auto-complete list
 - Added support to read environment variable ``ROBOT_VERSION`` to apply some conditions.
 - Added note on Test Timeout that **timeout message** is not supported since Robot v3.0.1
-- Added the note, 'Colors will be active after next RIDE restart.' to the Preferences of Test Runner.

3.2. Changed

  (2.1 - 2024-10-13)
+- Added the note, 'Colors will be active after next RIDE restart.' to the Preferences of Test Runner.

4.2. Changed

  (2.1 - 2024-10-13)
 - Changed the order of insert and delete rows in Grid Editor rows context menu.
   (2.1b1 - 2024-09-21)
 - Allow to do auto-suggestions of keywords in Text Editor without a shortcut, if you want to enable or disable this feature you can config in `Tools -> Preferences -> Text Editor -> Enable auto suggestions`.
@@ -98,7 +101,7 @@
 - Changed alias marker on library imports to consider variable ``ROBOT_VERSION``. If version is lower than 6.0, uses ``'WITH NAME'``, otherwise will use ``'AS'``
   (2.0.3 - 2023-04-16)
 - Allow to do auto-suggestions of keywords in Grid Editor without a shortcut, if you want to enable or disable this feature you can config in `Tools-> Preferences -> Grid Editor -> Enable auto suggestions`
-- Made ``\\n`` visible when editing cells in Grid Editor (problematic in Windows)

3.3. Fixed

  (2.1 - 2024-10-13)
+- Made ``\\n`` visible when editing cells in Grid Editor (problematic in Windows)

4.3. Fixed

  (2.1 - 2024-10-13)
 - Fixed recognition of variables imported from YAML, JSON and Python files.
   (2.1b1 - 2024-09-21)
 - Fixed validation of multiple arguments with default values in Grid Editor.
@@ -146,18 +149,18 @@
 - Fixed clearing or emptying fixtures (Setups, Teardowns), now removes headers and synchronizes Text Editor
 - Fixed selection and persistance of colors in File Explorer and Project Tree panels
 - Fixed not using defined color for help and HTML content
-- Fixed missing newlines in sections separation

3.4. Removed

  (2.1a3 - 2024-07-22)
+- Fixed missing newlines in sections separation

4.4. Removed

  (2.1a3 - 2024-07-22)
 - Removed support for HTML file format (obsolete since Robot Framework 3.2)
-- Removed support for old Python versions, 3.6 nd 3.7.

4. 2.1b1 - 2024-09-21

4.1. Added

  • +- Removed support for old Python versions, 3.6 nd 3.7.

5. 2.1b1 - 2024-09-21

5.1. Added

  • Added color to Test Runner Console Log final output, report and log since RF v7.1rc1.
  • Added Korean language support for UI, experimental.
  • Added option ``caret style`` to change insert caret to block or line in Text Editor, by editing ``settings.cfg``. The color of the caret is the same as setting and will be adjusted for better contrast with the background. -

4.2. Changed

  • +

5.2. Changed

  • Allow to do auto-suggestions of keywords in Text Editor without a shortcut, if you want to enable or disable this feature you can config in Tools -> Preferences -> Text Editor -> Enable auto suggestions. -

4.3. Fixed

  • +

5.3. Fixed

  • Fixed validation of multiple arguments with default values in Grid Editor.
  • Fixed on Text Editor when Saving the selection of tests to run in Test Suites (Tree) is cleared. @@ -167,7 +170,7 @@ Fixed delete variable from Test Suite settings remaining in Project Explorer.
  • Fixed obsfuscation of Libraries and Metadata panels when expanding Settings in Grid Editor and Linux systems. -

5. 2.1a3 - 2024-07-22

5.1. Added

  • +

6. 2.1a3 - 2024-07-22

6.1. Added

  • Added support for Setup in keywords, since Robot Framework version 7.0.
  • Added support for new VAR marker, since Robot Framework version 7.0. @@ -208,7 +211,7 @@ Tooltips for the fields are always shown in English.
  • Colorization for language configured files is working in Text Editor. -

5.2. Fixed

  • +

6.2. Fixed

  • Fixed multiline variables in Variables section. In Text Editor they are separated by … continuation marker. In Grid Editor use | (pipe) to separate lines.
  • @@ -223,7 +226,7 @@ Fixed wrong continuation of long chains of keywords in Setups, Teardowns or Documentation
  • Fixed New User Keyword dialog not allowing empty Arguments field -

5.3. Changed

  • +

6.3. Changed

  • Improved release packaging of RIDE, by using entry_points in setuptools configuration.
  • Parsing of clipboard content to separate by cells in Grid Editor. NOTE: Need to Apply Changes in Text Editor to be effective. @@ -231,11 +234,11 @@ Improved selection of items from Tree in Text Editor. Now finds more items and selects whole line.
  • Changed output in plugin Run Anything (Macros) to allow Zoom In/Out, and Copy content. -

5.4. Removed

  • +

6.4. Removed

  • Removed support for HTML file format (obsolete since Robot Framework 3.2)
  • Removed support for old Python versions, 3.6 nd 3.7. -

6. 2.0.8.1 - 2023-11-01

6.1. Added

  • +

7. 2.0.8.1 - 2023-11-01

7.1. Added

  • Added auto update check when development version is installed
  • Added menu option ``Help→Check for Upgrade`` which allows to force update check and install development version @@ -254,7 +257,7 @@ Added variables creation shortcuts (``Ctrl-1,2,5``) to fields Arguments in Grid Editor
  • Added support for JSON variables, by using the installed Robot Framework import method -

6.2. Fixed

  • +

7.2. Fixed

  • Fixed escaped spaces showing in Text Editor on commented cells
  • Fixed resource files dissapearing from Project tree on Windows @@ -272,7 +275,7 @@ Position of cursor in Text Editor auto-suggestions when line contains multibyte characters
  • Drag and drop of variables defined with comments between resource files -

6.3. Changed

  • +

7.3. Changed

  • Improved keywords documentation search, by adding current dir to search
  • Improved Move up/down, ``Alt-UpArrow``/``Alt-DownArrow`` in Text Editor, to have proper indentation and selection @@ -288,14 +291,14 @@ Improved keyword ``Find Usages`` to return more matches. Fails to find mixed spaces and ``_``
  • In Grid Editor ``Ctrl-Shift-4`` now replaces escaped spaces ``\\ `` by spaces -

7. 2.0.7 - 2023-08-13

7.1. Added

  • +

8. 2.0.7 - 2023-08-13

8.1. Added

  • Added indication of matching brackets, ``()``, ``{}``, ``[]``, in Text Editor
  • Added context menu to RIDE tray icon. Options Show, Hide and Close
  • Added sincronization with Project Explorer to navigate to selected item, Test Case, Keyword, Variable, in Text Editor Note: This feature is working fine in Fedora 38, but not on Windows and macOS. -

7.2. Fixed

  • +

8.2. Fixed

  • Fixed non syncronized expanding/collapse of Settings panel in Grid Editor, on Linux
  • Fixed not working the deletion of cells commented with ``\# `` in Grid Editor with ``Ctrl-Shift-D`` @@ -309,17 +312,17 @@ Fixed title of User Keyword in Grid Editor always showing ``Find Usages`` instead of the keyword name
  • Fixed renaming keywords when they were arguments of ``Run Keywords`` in Setups and Teardowns -

7.3. Changed

  • +

8.3. Changed

  • Improve Text Editor auto-suggestions to keep libraries prefixes. -

8. 2.0.6 - 2023-06-10

8.1. Added

  • +

9. 2.0.6 - 2023-06-10

9.1. Added

  • Added boolean parameter ``filter newlines`` to Grid Editor with default ``True``, to hide or show newlines in cells -

8.2. Changed

  • +

9.2. Changed

  • Changed ``tasks.py`` to test ``utest/application/test_app_main.py`` isolated from the other tests
  • Improve auto-suggestions of keywords in Grid Editor by allowing to close suggestions list with keys ARROW_LEFT or ARROW_RIGHT
  • Improve Text Editor auto-suggestions by using: selected text, text at left or at right of cursor -

9. 2.0.5 - 2023-05-08

9.1. Added

  • +

10. 2.0.5 - 2023-05-08

10.1. Added

  • Added ``FOR`` scope markers (``IN``, ``IN RANGE``, ``IN ENUMERATE``, ``IN ZIP``) to auto-complete list
  • Added support to read environment variable ``ROBOT_VERSION`` to apply some conditions. @@ -327,15 +330,15 @@ Added note on Test Timeout that timeout message is not supported since Robot v3.0.1
  • Added the note, Colors will be active after next RIDE restart. to the Preferences of Test Runner. -

9.2. Changed

  • +

10.2. Changed

  • Changed alias marker on library imports to consider variable ``ROBOT_VERSION``. If version is lower than 6.0, uses ``WITH NAME``, otherwise will use ``AS`` -

10. Fixed

  • +

11. Fixed

  • Fixed auto-indent on block commands in Text Editor -

11. 2.0.3 - 2023-04-16

11.1. Changed

  • +

12. 2.0.3 - 2023-04-16

12.1. Changed

  • Allow to do auto-suggestions of keywords in Grid Editor without a shortcut, if you want to enable or disable this feature you can config in Tools-> Preferences -> Grid Editor -> Enable auto suggestions
  • Made ``\\n`` visible when editing cells in Grid Editor (problematic in Windows) -

12. Fixed

  • +

13. Fixed

  • Fixed missing auto-enclosing when in Cell Editor in Linux
  • Fixed RIDE will crash when using third party input method in Mac OS @@ -349,7 +352,7 @@ Fixed not using defined color for help and HTML content
  • Fixed missing newlines in sections separation -

13. 2.0 - 2023-03-01

13.1. Added

  (2.0rc1 - 2023-02-26)
+

14. 2.0 - 2023-03-01

14.1. Added

  (2.0rc1 - 2023-02-26)
 - Minimal support to accept `*** Comments ***` sections (unfinished code)
 - Added insert and delete cells to Text Editor, by using ``Ctrl-Shift-I`` and ``Ctrl-Shift-D``
 - Added move up and move down rows to Text Editor, by using ``Alt-Up`` and ``Alt-Down``
@@ -402,13 +405,13 @@
 - Added enclosing text in Text Editor or selected text with certain symbols
 - Added enclosing text in Grid Editor or selected text with certain symbols
 - Added 8s timer to shortcut creation dialog on install
-- Added process memory limit on Messages Log

13.2. Removed

  (2.0b2 - 2022-09-05)
+- Added process memory limit on Messages Log

14.2. Removed

  (2.0b2 - 2022-09-05)
 - Removed ``robotframeworklexer`` dependency and local copy
 - Removed alignment flag on grid cell JSON Editor (Ctrl-Shift-J)
 - Removed moving to keyword/variable definition when doing Double-Click in grid cell
   (2.0b1 - 2020-07-26)
 - Python 2.7 support
-- wxPython/wxPhoenix version conditioning

13.3. Changed

  (2.0b3 - 2023-01-15)
+- wxPython/wxPhoenix version conditioning

14.3. Changed

  (2.0b3 - 2023-01-15)
 - Hiding items in Test Suites explorer with names starting with #
 - Disabled the Close button on the Test Suites explorer
   This was causing not being possible to restore it, unless editing the settings.cfg file.
@@ -437,7 +440,7 @@
 - Changed icon background to white
 - Made Project Tree and File Explorer panels, Plugins.
 - wx.NewId() to wx.NewIdRef()
-- Separated AppendText for Messages Log

13.4. Fixed

  (2.0rc1 - 2023-02-26)
+- Separated AppendText for Messages Log

14.4. Fixed

  (2.0rc1 - 2023-02-26)
 - Fixed blank Grid Editor at keywords with steps commented with ``\# ``, by using ``Ctrl-Shift-3 on Text Editor
   (2.0b3 - 2023-01-15)
 . Fixed low performance when opening large projects
@@ -511,7 +514,7 @@
 - Fixed Settings editor
 - Fixed blank Edit screen
 - Fixed Runner arguments parsing
-- Fixed Runner Log window Chinese and Latin encoding chars on Windows

14. 2.0rc1 - 2023-02-26

14.1. Added

  • +- Fixed Runner Log window Chinese and Latin encoding chars on Windows

15. 2.0rc1 - 2023-02-26

15.1. Added

  • Minimal support to accept *** Comments *** sections (unfinished code)
  • Added insert and delete cells to Text Editor, by using ``Ctrl-Shift-I`` and ``Ctrl-Shift-D`` @@ -519,30 +522,30 @@ Added move up and move down rows to Text Editor, by using ``Alt-Up`` and ``Alt-Down``
  • Added insert and delete rows to Text Editor, by using ``Ctrl-I`` and ``Ctrl-D`` -

14.2. Removed

14.3. Changed

14.4. Fixed

  • +

15.2. Removed

15.3. Changed

15.4. Fixed

  • Fixed blank Grid Editor at keywords with steps commented with ``\# ``, by using ``Ctrl-Shift-3 on Text Editor -

15. 2.0b3 - 2023-01-15

15.1. Added

  • +

16. 2.0b3 - 2023-01-15

16.1. Added

  • Added swap row up, by using ``Ctrl-T``
  • Added commenting/uncommenting of content with ``\# ``, by using ``Ctrl-Shift-3`` and ``Ctrl-Shift-4``
  • Added support for editing .robot and .resource files with content before sections -

15.2. Removed

  • +

16.2. Removed

  • None -

15.3. Changed

  • +

16.3. Changed

  • Hiding items in Test Suites explorer with names starting with #
  • Disabled the Close button on the Test Suites explorer This was causing not being possible to restore it, unless editing the settings.cfg file. Other reason was to prevent user to closing it, after detaching the panel, and re-attaching, which has a bug making the Tree not visible. -

15.4. Fixed

  1. +

16.4. Fixed

  1. Fixed low performance when opening large projects

    • Fixed comment and uncomment in Grid Editor when cells contain more than one variables assignement
    • Fixed console log stopping to output certain characters, like chinese and latin -

16. 2.0b2 - 2022-09-05

16.1. Added

  • +

17. 2.0b2 - 2022-09-05

17.1. Added

  • Added menu entry at Help → Offline Change Log to view this file on disk
  • Added skipped tests counter and corresponding colored icon on Project tree @@ -610,13 +613,13 @@ When editing, Ctrl-Home and Ctrl-End move cursor to start and end of cell content respectively.
  • Added Del key to clear Grid Editor cell content when in navigation mode (clear like doing Ctrl-X) -
  • 16.2. Removed

    • +

    17.2. Removed

    • Removed ``robotframeworklexer`` dependency and local copy
    • Removed alignment flag on grid cell JSON Editor (Ctrl-Shift-J)
    • Removed moving to keyword/variable definition when doing Double-Click in grid cell -

    16.3. Changed

    • +

    17.3. Changed

    • Unit tests to use ``pytest`` and removed ``nose`` dependency. Support for Python 3.10 at unit test level.
    • Prevent expanding Tests and change selection on Project tree (when right-clicking) @@ -646,7 +649,7 @@ Changed Enter button in navigation mode to start editing cell, and to move to right cell when in edit mode
    • Performance improvements for loading large test suites -

    16.4. Fixed

    • +

    17.4. Fixed

    • Fixed missing menu icons on Linux (was working on Windows)
    • Fixed removal of animation in Project tree when test run is interrupted @@ -719,7 +722,7 @@ Fixed RIDE startup crash when Tree or File Explorer plugins use opened=False setting
    • Fixed error occurring when deleting test cases on Tree -

    17. 2.0b1 - 2020-07-26

    17.1. Added

    • +

    18. 2.0b1 - 2020-07-26

    18.1. Added

    • Added CHANGELOG.adoc
    • Added ignoring log.html and report.html on reporting HTML test suites @@ -737,11 +740,11 @@ Added 8s timer to shortcut creation dialog on install
    • Added process memory limit on Messages Log -

    17.2. Removed

    • +

    18.2. Removed

    • Python 2.7 support
    • wxPython/wxPhoenix version conditioning -

    17.3. Changed

    • +

    18.3. Changed

    • Improved filesystem changes detection, with a confirmation dialog to reload workspace
    • Changed dependency on wx.Window on tree panel @@ -755,7 +758,7 @@ wx.NewId() to wx.NewIdRef()
    • Separated AppendText for Messages Log -

    17.4. Fixed

    • +

    18.4. Fixed

    • Fixed editing cells in Grid Editor on wxPython 4.1
    • Fixed not saving file after deleting text in Text Editor @@ -815,12 +818,12 @@ Fixed Runner arguments parsing
    • Fixed Runner Log window Chinese and Latin encoding chars on Windows -

    18. 1.7.4.2 - 2020-01-20

    18.1. Added

    • +

    19. 1.7.4.2 - 2020-01-20

    19.1. Added

    • wxPython version locked up to 4.0.7.post2. -

    18.2. Removed

    • +

    19.2. Removed

    • None -

    18.3. Changed

    • +

    19.3. Changed

    • None -

    18.4. Fixed

    • +

    19.4. Fixed

    • None
    diff --git a/src/robotide/application/releasenotes.py b/src/robotide/application/releasenotes.py index 5a94b0a48..81817b017 100644 --- a/src/robotide/application/releasenotes.py +++ b/src/robotide/application/releasenotes.py @@ -168,8 +168,8 @@ def set_content(self, html_win, content):

    New Features and Fixes Highlights

    @@ -224,7 +224,7 @@ def set_content(self, html_win, content):
    python -m robotide.postinstall -install

    or

    ride_postinstall.py -install
    -

    RIDE {VERSION} was released on 28/January/2025.

    +

    RIDE {VERSION} was released on 30/January/2025.

    @@ -237,7 +225,7 @@ def set_content(self, html_win, content):
    python -m robotide.postinstall -install

    or

    ride_postinstall.py -install
    -

    RIDE {VERSION} was released on 27/March/2025.

    +

    RIDE {VERSION} was released on 28/March/2025.

  • 🐞 - Rename Keywords, Find Usages/Find where used are not finding all occurrences. Please, double-check findings and changes.
  • 🐞 - Some argument types detection (and colorization) is not correct in Grid Editor.
  • 🐞 - RIDE DOES NOT KEEP Test Suites formatting or structure, causing differences in files when used @@ -168,7 +170,8 @@ def set_content(self, html_win, content):

    New Features and Fixes Highlights

      -
    • Added Preferences or Control Panel button to Plugins, working example in Text Editor.
    • +
    • Added Config Panel button to supported installed Plugins next to their name in Plugin Manager dialog.
    • +
    • Added Config Panel button to Plugins, working example in Text Editor.
    • On Windows ignore false modification on files when opening Test Suites, causing confirmation dialog.
    • Added divided Status Bar. Left side for main window, right side for Plugins. Working example in Text Editor, when selecting in Tree shows the filename in StatusBar.
    • @@ -226,7 +229,7 @@ def set_content(self, html_win, content):
      python -m robotide.postinstall -install

      or

      ride_postinstall.py -install
      -

      RIDE {VERSION} was released on 29/March/2025.

      +

      RIDE {VERSION} was released on 30/March/2025.

      lang={self._doc_language}") else: @@ -896,10 +895,10 @@ def _handle_sanity_check_failure(self, message): if self._last_answer == wx.ID_NO and time() - self._last_answer_time <= 0.2: # self.source_editor._mark_file_dirty(True) return False - # DEBUG: use widgets.Dialog - dlg = wx.MessageDialog(self._editor, f"{_('ERROR: Data sanity check failed!')}\n{_('Error at line')}" - f" {message[1]}:\n{message[0]}\n\n{_('Reset changes?')}", - _("Can not apply changes from Text Editor"), style=wx.YES | wx.NO) + dlg = RIDEDialog(title=_("Can not apply changes from Text Editor"), + message=f"{_('ERROR: Data sanity check failed!')}\n{_('Error at line')}" + f" {message[1]}:\n{message[0]}\n\n{_('Reset changes?')}", + style=wx.ICON_ERROR | wx.YES_NO) dlg.InheritAttributes() did = dlg.ShowModal() self._last_answer = did @@ -2722,7 +2721,6 @@ def set_language(self, dlanguage): try: self.language = obtain_language(dlanguage, content) except ValueError: - # wx.MessageBox(f"Error when selecting Language: {e}", 'Error') self.language = 'English' else: self.language = 'English' diff --git a/src/robotide/run/ui.py b/src/robotide/run/ui.py index 735ccbffc..f8d293441 100644 --- a/src/robotide/run/ui.py +++ b/src/robotide/run/ui.py @@ -17,7 +17,7 @@ import wx from .process import Process -from ..widgets import Label, Font, VerticalSizer, HorizontalSizer +from ..widgets import Font, VerticalSizer, HorizontalSizer, RIDEDialog from ..log import LogOutput from ..publish import RideRunnerStopped @@ -63,7 +63,8 @@ def run(self): # print(f"DEBUG: runanything.py Runner run process object={self._process}" # f"\nCommand: {self._config.command}") if self._process is None: - wx.MessageBox(f"FAILED TO RUN {self._config.command}", style=wx.ICON_ERROR) + message_box = RIDEDialog(message=f"FAILED TO RUN {self._config.command}", style=wx.ICON_ERROR) + message_box.ShowModal() return try: self._process.start() @@ -71,7 +72,8 @@ def run(self): self._pid = self._process.pid return self._pid except Exception as err: - wx.MessageBox(str(err), style=wx.ICON_ERROR) + message_box = RIDEDialog(message=str(err), style=wx.ICON_ERROR) + message_box.ShowModal() return -1 def on_timer(self, event=None): @@ -85,7 +87,8 @@ def stop(self): try: self._process.stop() except Exception as err: - wx.MessageBox(str(err), style=wx.ICON_ERROR) + message_box = RIDEDialog(message=str(err), style=wx.ICON_ERROR) + message_box.ShowModal() class _OutputWindow(wx.Panel): # wx.ScrolledWindow): diff --git a/src/robotide/spec/specimporter.py b/src/robotide/spec/specimporter.py index 9af1334d1..ce474f7e8 100644 --- a/src/robotide/spec/specimporter.py +++ b/src/robotide/spec/specimporter.py @@ -22,6 +22,7 @@ from ..action import ActionInfo from ..pluginapi import Plugin from ..publish import PUBLISHER, RideExecuteSpecXmlImport +from ..widgets import RIDEDialog from .xmlreaders import get_name_from_xml _ = wx.GetTranslation # To keep linter/code analyser happy @@ -74,8 +75,12 @@ def _store_spec(self, path): name = get_name_from_xml(path) if name: shutil.copy(path, os.path.join(context.LIBRARY_XML_DIRECTORY, name+'.xml')) - wx.MessageBox(_('Library "%s" imported\nfrom "%s"\nThis may require RIDE restart.') % (name, path), - _('Info'), wx.OK | wx.ICON_INFORMATION) + message_box = RIDEDialog(title=_('Info'), + message=_('Library "%s" imported\nfrom "%s"\nThis may require RIDE restart.') + % (name, path), style=wx.OK | wx.ICON_INFORMATION) + message_box.ShowModal() else: - wx.MessageBox(_('Could not import library from file "%s"') % path, _('Import failed'), - wx.OK | wx.ICON_ERROR) + message_box = RIDEDialog(title=_('Import failed'), + message=_('Could not import library from file "%s"') + % path, style=wx.OK | wx.ICON_ERROR) + message_box.ShowModal() diff --git a/src/robotide/ui/filedialogs.py b/src/robotide/ui/filedialogs.py index 03bdf3788..d19043c1d 100644 --- a/src/robotide/ui/filedialogs.py +++ b/src/robotide/ui/filedialogs.py @@ -291,7 +291,8 @@ def _execute(self): else CreateNewFileProject self.language = self.selected_language() cmd(self._get_path(), self._is_task_type(), self.language).execute(self._controller) - del self.dlg + if self.dlg: + del self.dlg class NewResourceDialog(_WithImmutableParent, _CreationDialog): diff --git a/src/robotide/ui/mainframe.py b/src/robotide/ui/mainframe.py index 09d3045ca..8470cc96c 100644 --- a/src/robotide/ui/mainframe.py +++ b/src/robotide/ui/mainframe.py @@ -197,12 +197,16 @@ def _create_title(message): @staticmethod def _show_validation_error(message): - wx.MessageBox(message.message, _('Validation Error'), style=wx.ICON_ERROR) + message_box = RIDEDialog(title=_('Validation Error'), message=message.message, style=wx.ICON_ERROR|wx.OK) + message_box.ShowModal() @staticmethod def _show_modification_prevented_error(message): - wx.MessageBox(_("\"%s\" is read only") % message.controller.datafile_controller.filename, - _("Modification prevented"), style=wx.ICON_ERROR) + message_box = RIDEDialog(title=_("Modification prevented"), + message=_("\"%s\" is read only") % message.controller.datafile_controller.filename, + style=wx.ICON_ERROR|wx.OK) + # message_box.CenterOnParent() + message_box.ShowModal() def _init_ui(self): """ DEBUG: @@ -401,12 +405,13 @@ def on_maximize(self, event): def _allowed_to_exit(self): if self.has_unsaved_changes(): - ret = wx.MessageBox(_("There are unsaved modifications.\n" + message_box = RIDEDialog(title=_('Warning'), message=_("There are unsaved modifications.\n" "Do you want to save your changes before " - "exiting?"), _("Warning"), wx.ICON_WARNING | wx.CANCEL | wx.YES_NO) - if ret == wx.CANCEL: + "exiting?"), style=wx.ICON_WARNING | wx.CANCEL | wx.YES_NO) + ret = message_box.execute() + if ret in (wx.CANCEL, wx.ID_CANCEL): return False - if ret == wx.YES: + if ret in (wx.YES, wx.ID_YES, wx.OK, wx.ID_OK): self.save() return True @@ -490,9 +495,10 @@ def on_open_test_suite(self, event): def check_unsaved_modifications(self): if self.has_unsaved_changes(): - ret = wx.MessageBox(_("There are unsaved modifications.\n" - "Do you want to proceed without saving?"), _("Warning"), wx.ICON_WARNING | wx.YES_NO) - return ret == wx.YES + message_box = RIDEDialog(title=_("Warning"), message=_("There are unsaved modifications.\n" + "Do you want to proceed without saving?"), style=wx.ICON_WARNING | wx.YES_NO) + ret = message_box.ShowModal() + return ret == wx.ID_YES return True def open_suite(self, path): @@ -517,7 +523,8 @@ def open_suite(self, path): else: set_lang[0] = 'en' try: - err = self.controller.load_datafile(path, LoadProgressObserver(self)) + err = self.controller.load_datafile(path, LoadProgressObserver(self, background=self.color_background, + foreground=self.color_foreground)) if isinstance(err, UserWarning): # DEBUG: raise err # Just leave message in Parser Log return False @@ -696,9 +703,10 @@ def show_confirm_reload_dlg(self, event): if self.controller.is_dirty(): msg += [_('Answering will discard unsaved changes.'), _('Answering will ignore the changes on disk.')] - ret = wx.MessageBox('\n'.join(msg), _('Files Changed On Disk'), - style=wx.YES_NO | wx.ICON_WARNING) - confirmed = ret == wx.YES + message_box = RIDEDialog(title=_('Files Changed On Disk'), message='\n'.join(msg), + style=wx.ICON_WARNING | wx.YES_NO) + ret = message_box.ShowModal() + confirmed = ret == wx.ID_YES if confirmed: # workspace_path should update after open directory/suite # There are two scenarios: diff --git a/src/robotide/ui/progress.py b/src/robotide/ui/progress.py index 04fd6c4f9..0497efb83 100644 --- a/src/robotide/ui/progress.py +++ b/src/robotide/ui/progress.py @@ -46,16 +46,23 @@ def error(self, msg): class LoadProgressObserver(ProgressObserver): - def __init__(self, frame): + def __init__(self, frame, background=None, foreground=None): ProgressObserver.__init__(self, frame, 'RIDE', 'Loading the test data') + if background and foreground: + self._progressbar.SetBackgroundColour(background) + self._progressbar.SetForegroundColour(foreground) class RenameProgressObserver(ProgressObserver): - def __init__(self, frame): + def __init__(self, frame, background=None, foreground=None): ProgressObserver.__init__(self, frame, 'RIDE', 'Renaming') - self._notification_occured = 0 + # self._notification_occured = 0.1 + if background and foreground: + self._progressbar.SetBackgroundColour(background) + self._progressbar.SetForegroundColour(foreground) + """ def notify(self): if time.time() - self._notification_occured > 0.1: try: @@ -63,3 +70,4 @@ def notify(self): except RuntimeError: pass self._notification_occured = time.time() + """ \ No newline at end of file diff --git a/src/robotide/ui/tagdialogs.py b/src/robotide/ui/tagdialogs.py index c1e9e9ed7..7ebda87c0 100644 --- a/src/robotide/ui/tagdialogs.py +++ b/src/robotide/ui/tagdialogs.py @@ -273,8 +273,10 @@ def on_delete(self, event): return tests, tag_name = self._tags_list.get_tag(self._index) tags_to_delete = self._tags[tag_name.lower()] - if wx.MessageBox(_("Delete a tag '%s' ?") % tag_name, caption=_('Confirm'), - style=wx.YES_NO | wx.ICON_QUESTION) == wx.YES: + message_box = RIDEDialog(title=_('Confirm'), message=_("Delete a tag '%s' ?") % tag_name, + style=wx.YES_NO | wx.ICON_QUESTION) + ret = message_box.ShowModal() + if ret == wx.ID_YES: for tag in tags_to_delete: tag.controller.execute(ChangeTag(tag, '')) self._execute() diff --git a/src/robotide/ui/treenodehandlers.py b/src/robotide/ui/treenodehandlers.py index 4ded5d500..b6aba4c85 100644 --- a/src/robotide/ui/treenodehandlers.py +++ b/src/robotide/ui/treenodehandlers.py @@ -23,7 +23,7 @@ from ..publish import RideOpenVariableDialog, RideTestSelectedForRunningChanged, RideSettingsChanged, PUBLISHER from ..ui.progress import LoadProgressObserver from ..usages.UsageRunner import Usages, ResourceFileUsages -from ..widgets import PopupMenuItems +from ..widgets import RIDEDialog, PopupMenuItems from .filedialogs import (AddSuiteDialog, AddDirectoryDialog, ChangeFormatDialog, NewResourceDialog, RobotFilePathDialog) from .progress import RenameProgressObserver @@ -231,7 +231,8 @@ def _is_valid_rename(self, label): @staticmethod def _show_validation_error(err_msg): - wx.MessageBox(err_msg, _('Validation Error'), style=wx.ICON_ERROR) + message_box = RIDEDialog(title=_('Validation Error'), message=err_msg, style=wx.ICON_ERROR | wx.OK) + message_box.ShowModal() class DirectoryHandler(_ActionHandler): @@ -431,8 +432,9 @@ def on_exclude(self, event): # Next is to restart the file monitoring RideSettingsChanged(keys=('Excludes', 'excluded'), old=None, new=None).publish() except filecontrollers.DirtyRobotDataException: - wx.MessageBox(_('Directory contains unsaved data!\n' - 'You must save data before excluding.')) + message_box = RIDEDialog(message=_('Directory contains unsaved data!\n' + 'You must save data before excluding.'), style=wx.ICON_WARNING | wx.OK) + message_box.ShowModal() class _FileHandlerThanCanBeRenamed(_CanBeRenamed): @@ -517,8 +519,9 @@ def on_exclude(self, event): # Next is to restart the file monitoring RideSettingsChanged(keys=('Excludes', 'excluded'), old=None, new=None).publish() except filecontrollers.DirtyRobotDataException: - wx.MessageBox(_('File contains unsaved data!\n' - 'You must save data before excluding.')) + message_box = RIDEDialog(message=_('File contains unsaved data!\n' + 'You must save data before excluding.'), style=wx.ICON_WARNING | wx.OK) + message_box.ShowModal() def on_remove_read_only(self, event): __ = event @@ -619,8 +622,9 @@ def on_exclude(self, event): # Next is to restart the file monitoring RideSettingsChanged(keys=('Excludes', 'excluded'), old=None, new=None).publish() except filecontrollers.DirtyRobotDataException: - wx.MessageBox(_('File contains unsaved data!\n' - 'You must save data before excluding.')) + message_box = RIDEDialog(message=_('File contains unsaved data!\n' + 'You must save data before excluding.'), style=wx.ICON_WARNING | wx.OK) + message_box.ShowModal() def on_remove_read_only(self, event): __ = event @@ -645,8 +649,10 @@ def on_new_test_case(self, event): dlg.Destroy() def on_delete(self, event): - if wx.MessageBox(_('Delete test case file'), caption=_('Confirm'), - style=wx.YES_NO | wx.ICON_QUESTION) == wx.YES: + message_box = RIDEDialog(title=_('Confirm'), message=_('Delete test case file'), + style=wx.YES_NO | wx.ICON_QUESTION) + ret = message_box.ShowModal() + if ret == wx.YES: self.controller.execute(ctrlcommands.DeleteFile()) def on_safe_delete(self, event): @@ -754,7 +760,9 @@ def _create_rename_command(self, new_name): # print(f"DEBUG: treenodehandlers.py UserKeywodHandler _create_rename_command controller.name={self.controller.name}" # f", new_name={new_name} info={self.controller.info}") return ctrlcommands.RenameKeywordOccurrences(self.controller.name, new_name, - RenameProgressObserver(self._tree.GetParent()), + RenameProgressObserver(self._tree.GetParent(), + background=self._tree.background, + foreground=self._tree.foreground), self.controller.info, language=self.controller.language) def on_find_usages(self, event): @@ -841,7 +849,9 @@ def on_add_resource(self, event): path = RobotFilePathDialog( self._tree.GetParent(), self.controller, self._settings).execute() if path: - self.controller.load_resource(path, LoadProgressObserver(self._tree.GetParent())) + self.controller.load_resource(path, LoadProgressObserver(self._tree.GetParent(), + background=self._tree.background, + foreground=self._tree.foreground)) class ExcludedDirectoryHandler(TestDataDirectoryHandler): diff --git a/src/robotide/ui/treeplugin.py b/src/robotide/ui/treeplugin.py index 4ae68a493..1315ba0c4 100644 --- a/src/robotide/ui/treeplugin.py +++ b/src/robotide/ui/treeplugin.py @@ -213,6 +213,9 @@ def __init__(self, parent, action_registerer, settings=None): self._RESOURCES_NODE_LABEL = _('External Resources') # print(f"DEBUG: treeplugin.py Tree after importing TreeController __init__ " # f"translated label={self._RESOURCES_NODE_LABEL}") + self.theme = settings.get_without_default('General') + self.background = self.theme['background'] + self.foreground = self.theme['foreground'] self._checkboxes_for_tests = False self._test_selection_controller = self._create_test_selection_controller() self.controller = TreeController(self, action_registerer, settings=settings, @@ -1197,9 +1200,11 @@ def _rename_resource_kw(self, new_name, old_name, resource): RideUserKeywordRenamed(datafile=controller.datafile, item=k, old_name=keyword_name).publish() controller.mark_dirty() - # print(f"DEBUG: treeplugin.py Tree _rename_resource_kw DONE CHANGING: {k.name=}") + # print(f"DEBUG: treeplugin.py Tree _rename_resource_kw DONE CHANGING: {k.name=}" + # f"background={self.background}, foreground={self.foreground}") # self.controller.mark_node_dirty(self._get_datafile_node(controller.datafile)) - self.observer = RenameProgressObserver(self.GetParent()) + self.observer = RenameProgressObserver(self.GetParent(), background=self.background, + foreground=self.foreground) RenameKeywordOccurrences(keyword_name, new_keyword_name, self.observer) self.observer.finish() self.Collapse(res_node) @@ -1207,8 +1212,11 @@ def _rename_resource_kw(self, new_name, old_name, resource): self.Refresh() self.SelectItem(node) else: - wx.MessageBox(f"Invalid keyword name: {new_keyword_name}", - "Failed Keyword Name Validation") + from ..widgets import RIDEDialog + message_box = RIDEDialog(title=_('Validation Error'), + message=_("Invalid keyword name: ") % f"{new_keyword_name}", + style=wx.ICON_ERROR | wx.OK) + message_box.ShowModal() return def _variable_moved_up(self, message): diff --git a/src/robotide/validators/__init__.py b/src/robotide/validators/__init__.py index 6b68b7963..9aef5efcc 100644 --- a/src/robotide/validators/__init__.py +++ b/src/robotide/validators/__init__.py @@ -18,6 +18,10 @@ import wx from .. import robotapi, utils +from ..widgets import RIDEDialog + +_ = wx.GetTranslation # To keep linter/code analyser happy +builtins.__dict__['_'] = wx.GetTranslation class _AbstractValidator(wx.Validator): @@ -44,7 +48,8 @@ def _validate(self, value): return NotImplemented def _show_error(self, message, title="Validation Error"): - ret = wx.MessageBox(message, title, style=wx.ICON_ERROR) + message_box = RIDEDialog(title=title, message=message, style=wx.ICON_ERROR) + ret = message_box.execute() self._set_focus_to_text_control(self.Window) return ret diff --git a/src/robotide/version.py b/src/robotide/version.py index 01d4002ed..09e704358 100644 --- a/src/robotide/version.py +++ b/src/robotide/version.py @@ -15,4 +15,4 @@ # # Automatically generated by `tasks.py`. -VERSION = 'v2.2dev19' +VERSION = 'v2.2dev20' diff --git a/src/robotide/widgets/dialog.py b/src/robotide/widgets/dialog.py index 7aaf466fa..66ae827b8 100644 --- a/src/robotide/widgets/dialog.py +++ b/src/robotide/widgets/dialog.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import builtins import webbrowser import wx @@ -20,6 +21,9 @@ from . import sizers, ButtonWithHandler +_ = wx.GetTranslation # To keep linter/code analyser happy +builtins.__dict__['_'] = wx.GetTranslation + class HtmlWindow(html.HtmlWindow): @@ -89,7 +93,8 @@ class RIDEDialog(wx.Dialog): def __init__(self, title='', parent=None, size=None, style=None, message=None): size = size or (-1, -1) - style = style or (wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) + style = style | wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER if style else (wx.DEFAULT_DIALOG_STYLE | + wx.RESIZE_BORDER ) wx.Dialog.__init__(self, parent=parent, title=title, size=size, style=style) # set Left to Right direction (while we don't have localization) self.SetLayoutDirection(wx.Layout_LeftToRight) @@ -110,18 +115,33 @@ def __init__(self, title='', parent=None, size=None, style=None, message=None): if self.message: sizer = wx.BoxSizer(wx.VERTICAL) content = wx.StaticText(self, -1, self.message) - button = wx.Button(self, wx.ID_OK, '', style=style) content.SetBackgroundColour(Colour(self.color_background)) content.SetForegroundColour(Colour(self.color_foreground)) - button.SetBackgroundColour(Colour(self.color_secondary_background)) - button.SetForegroundColour(Colour(self.color_secondary_foreground)) sizer.Add(content, 0, wx.ALL | wx.EXPAND, 3) sizer.Add(wx.StaticText(self, -1, "\n\n"), 0, wx.ALL, 3) - sizer.Add(button, 0, wx.ALIGN_CENTER | wx.BOTTOM, 5) + btn_sizer = self._create_buttons_sizer(style) + sizer.Add(btn_sizer, 0, wx.ALIGN_CENTER | wx.BOTTOM, 3) self.SetSizer(sizer) sizer.Fit(self) + self.Bind(wx.EVT_BUTTON, self.on_button) self.CenterOnParent() + def _create_buttons_sizer(self, style=0): + sizer = wx.BoxSizer(wx.HORIZONTAL) + btn_flag = False + for btn, bid, label in zip([wx.NO, wx.CANCEL, wx.YES, wx.OK], [wx.ID_NO, wx.ID_CANCEL, wx.ID_YES, wx.ID_OK], + [_('No'), _('Cancel'), _('Yes'), _('OK')]): + if btn == style & btn: + # print(f"DEBUG: dialog.py RIDEDialog _create_buttons_sizer ID={btn} label={label}") + button = wx.Button(self, id=bid, label=label) + button.SetBackgroundColour(Colour(self.color_secondary_background)) + button.SetForegroundColour(Colour(self.color_secondary_foreground)) + sizer.Add(button, 0, wx.ALIGN_CENTER | wx.BOTTOM, 5) + btn_flag = True + if not btn_flag: + return self._create_buttons_sizer(wx.OK) + return sizer + def _create_buttons(self, sizer): buttons = self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL) self.SetBackgroundColour(Colour(self.color_background)) @@ -143,10 +163,26 @@ def _create_horizontal_line(self, sizer): sizer.Add(line, border=5, flag=wx.GROW | wx.RIGHT | wx.TOP) sizer.Fit(self) + def on_button(self, event): + retval = event.GetId() + # print(f"DEBUG: dialog.py RIDEDialog on_button ={retval}") + if retval in (wx.ID_OK, wx.ID_YES): + try: + retval = self._execute() + except NotImplementedError: + pass + if retval: + self.EndModal(retval) + event.Skip() + def execute(self): - retval = None - if self.ShowModal() == wx.ID_OK: - retval = self._execute() + retval = self.ShowModal() + # print(f"DEBUG: dialog.py RIDEDialog execute RETURN MODAL retval={retval}") + if retval in (wx.ID_OK, wx.ID_YES): + try: + retval = self._execute() + except NotImplementedError: + pass self.Destroy() return retval From 7d189cc2a92bf18fea23b206990ab45f58b8c27d Mon Sep 17 00:00:00 2001 From: HelioGuilherme66 Date: Sun, 13 Apr 2025 03:31:29 +0100 Subject: [PATCH 54/75] Initial settings edit button on Preferences. Make backup of settings.cfg --- src/robotide/application/application.py | 2 -- src/robotide/preferences/__init__.py | 2 ++ src/robotide/preferences/editor.py | 15 ++++++++++++++- src/robotide/preferences/general.py | 1 + src/robotide/preferences/settings.py | 22 +++++++++++++--------- 5 files changed, 30 insertions(+), 12 deletions(-) diff --git a/src/robotide/application/application.py b/src/robotide/application/application.py index f2ed6c06e..5c9d284a1 100644 --- a/src/robotide/application/application.py +++ b/src/robotide/application/application.py @@ -20,8 +20,6 @@ from contextlib import contextmanager from pathlib import Path -from pygments.styles.dracula import background - from ..namespace import Namespace from ..controller import Project from ..spec import librarydatabase diff --git a/src/robotide/preferences/__init__.py b/src/robotide/preferences/__init__.py index fe42d12c7..223a55e02 100644 --- a/src/robotide/preferences/__init__.py +++ b/src/robotide/preferences/__init__.py @@ -49,6 +49,8 @@ def __init__(self, settings): self.settings = settings self._preference_panels = [] self._add_builtin_preferences() + self.settings_path = self.settings._default_path + print(f"DEBUG: preferences/__init__.py Preferences settings_path={self.settings_path}") @property def preference_panels(self): diff --git a/src/robotide/preferences/editor.py b/src/robotide/preferences/editor.py index 0753fa2f0..c66e4984f 100644 --- a/src/robotide/preferences/editor.py +++ b/src/robotide/preferences/editor.py @@ -36,6 +36,7 @@ from wx.lib.scrolledpanel import ScrolledPanel from .settings import RideSettings +from ..widgets import ButtonWithHandler, HorizontalSizer _ = wx.GetTranslation # To keep linter/code analyser happy builtins.__dict__['_'] = wx.GetTranslation @@ -198,16 +199,28 @@ class PanelContainer(wx.Panel): Each page has a title area, and an area for a preferences panel """ def __init__(self, *args, **kwargs): + from ..editor import customsourceeditor super(PanelContainer, self).__init__(*args, **kwargs) self._current_panel = None self._settings = RideSettings() self.settings = self._settings['General'] self.title = wx.StaticText(self, label="Your message here") + print(f"DEBUG: preferences/editor.py PanelContainer settings_path={self._settings.user_path}") + hsizer = HorizontalSizer() + config_button = ButtonWithHandler(self, _('Settings'), bitmap='wrench_orange.png', + fsize=self.settings[FONT_SIZE], + handler=lambda e: customsourceeditor.main(self._settings.user_path)) + config_button.SetBackgroundColour(self.settings['background']) + config_button.SetOwnBackgroundColour(self.settings['background']) + config_button.SetForegroundColour(self.settings['foreground']) + hsizer.Add(self.title, 0, wx.TOP | wx.LEFT | wx.EXPAND, 10) + hsizer.add_expanding(config_button, 1, 10) self.panels_container = ScrolledPanel(self, wx.ID_ANY, style=wx.TAB_TRAVERSAL) self.panels_container.SetupScrolling() sizer = wx.BoxSizer(wx.VERTICAL) - sizer.Add(self.title, 0, wx.TOP | wx.LEFT | wx.EXPAND, 4) + sizer.Add(hsizer) + # sizer.Add(self.title, 0, wx.TOP | wx.LEFT | wx.EXPAND, 4) sizer.Add(wx.StaticLine(self), 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 4) sizer.Add(self.panels_container, 1, wx.EXPAND) self.SetSizer(sizer) diff --git a/src/robotide/preferences/general.py b/src/robotide/preferences/general.py index 36fe333fd..ef686fdf9 100644 --- a/src/robotide/preferences/general.py +++ b/src/robotide/preferences/general.py @@ -86,6 +86,7 @@ def __init__(self, settings, *args, **kwargs): # don't have the time to do that right now, so this will have # to suffice. + # print(f"DEBUG: preferences/general.py GeneralPeferences settings_path={self._settings._default_path}") ui_language = self._select_ui_language() font_editor = self._create_font_editor() colors_sizer = self.create_colors_sizer() diff --git a/src/robotide/preferences/settings.py b/src/robotide/preferences/settings.py index 4a516ce85..320c534a7 100644 --- a/src/robotide/preferences/settings.py +++ b/src/robotide/preferences/settings.py @@ -49,6 +49,8 @@ def _copy_or_migrate_user_settings(settings_dir, source_path, dest_file_name): m_error = None if not os.path.exists(source_path): raise(FileNotFoundError(source_path)) + else: + shutil.copyfile(source_path, source_path + '._backup') if not dest_file_name: dest_file_name = os.path.basename(source_path) settings_path = os.path.join(settings_dir, dest_file_name) @@ -60,12 +62,12 @@ def _copy_or_migrate_user_settings(settings_dir, source_path, dest_file_name): SettingsMigrator(source_path, settings_path).migrate() # print(f"DEBUG: settings After migration {source_path} with {settings_path}") except ConfigObjError as parsing_error: - print("WARNING! corrupted configuration file replaced with defaults") + print("WARNING! corrupted configuration file replaced with defaults\n" + f"A backup of the settings is at: {source_path + '._backup'}") print(parsing_error) m_error = parsing_error shutil.copyfile(settings_path, settings_path + '_old_broken') - print("(backed up corrupted configuration file at: %s)" % - (settings_path + '_old_broken')) + print(f"(backed up corrupted configuration file at: {settings_path + '_old_broken'}") shutil.copyfile(source_path, settings_path) # print("DEBUG: source %s corrupted settings %s\n" % (source_path, settings_path)) finally: # DEBUG Try to merge some settings @@ -362,9 +364,9 @@ def __init__(self, path=None): elif path.endswith('.cfg') and os.path.exists(path): self._default_path = path # print(f"DEBUG: settings.py RideSettings SETTINGS {self._default_path=}") - user_path = initialize_settings(self._default_path) - Settings.__init__(self, user_path) - self._settings_dir = os.path.dirname(user_path) + self.user_path = initialize_settings(self._default_path) + Settings.__init__(self, self.user_path) + self._settings_dir = os.path.dirname(self.user_path) # print(f"DEBUG: RideSettings, self._settings_dir={self._settings_dir}") self.get('install root', os.path.dirname(os.path.dirname(__file__))) self.executable = self.get('executable', EXECUTABLE) @@ -372,12 +374,14 @@ def __init__(self, path=None): digest = 0 for c in EXECUTABLE: digest += ord(c) - new_user_path = user_path.replace("settings.cfg", f"settings_{digest}.cfg") - new_user_path = initialize_settings(user_path, new_user_path) + new_user_path = self.user_path.replace("settings.cfg", f"settings_{digest}.cfg") + new_user_path = initialize_settings(self.user_path, new_user_path) + self.user_path = new_user_path Settings.__init__(self, new_user_path) self._settings_dir = os.path.dirname(new_user_path) self.set('install root', os.path.dirname(os.path.dirname(__file__))) - self.executable = self.set('executable', EXECUTABLE) + self.set('executable', EXECUTABLE) + self.set('last_settings_path', self.user_path) def get_path(self, *parts): """Returns path which combines settings directory and given parts.""" From f1871722d0d7d8ce6f335f2f7e245b2bef539467 Mon Sep 17 00:00:00 2001 From: HelioGuilherme66 Date: Sun, 13 Apr 2025 21:04:46 +0100 Subject: [PATCH 55/75] Settings editor button at Preferences and backup of settings.cfg --- CHANGELOG.adoc | 2 ++ README.adoc | 2 +- src/robotide/application/releasenotes.py | 6 +++++- src/robotide/editor/customsourceeditor.py | 5 +++++ src/robotide/preferences/__init__.py | 1 - src/robotide/preferences/editor.py | 25 +++++++++++++++-------- src/robotide/preferences/settings.py | 4 ++-- src/robotide/ui/mainframe.py | 3 +++ src/robotide/version.py | 2 +- 9 files changed, 36 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index fe9373b8b..f52283f9e 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -9,6 +9,8 @@ and this project adheres to http://semver.org/spec/v2.0.0.html[Semantic Versioni == https://github.com/robotframework/RIDE[Unreleased] === Added +- Added Settings Editor button to Preferences dialog, to edit settings.cfg. +- Created backup of settings.cfg to allow recovering some settings when broken upgrades. - Added current executing keyword and other statuses to TestRunner status bar. - Added Config Panel button to supported installed Plugins next to their name in Plugin Manager dialog. - Added Config Panel button to Plugins, working examples in Text Editor and Test Runner. diff --git a/README.adoc b/README.adoc index f4cd7bfb6..d795d7ec0 100644 --- a/README.adoc +++ b/README.adoc @@ -40,7 +40,7 @@ Likewise, the current version of wxPython, is 4.2.2, but RIDE is known to work w `pip install -U robotframework-ride` -(3.8 <= python <= 3.13) Install current development version (**2.2dev20**) with: +(3.8 <= python <= 3.13) Install current development version (**2.2dev21**) with: `pip install -U https://github.com/robotframework/RIDE/archive/develop.zip` diff --git a/src/robotide/application/releasenotes.py b/src/robotide/application/releasenotes.py index 22c6c2137..4974a0687 100644 --- a/src/robotide/application/releasenotes.py +++ b/src/robotide/application/releasenotes.py @@ -170,6 +170,8 @@ def set_content(self, html_win, content):

    New Features and Fixes Highlights

      +
    • Added Settings Editor button to Preferences dialog, to edit settings.cfg.
    • +
    • Created backup of settings.cfg to allow recovering some settings when broken upgrades.
    • Changed some informative dialogs and JSON Editor to use the customized colors.
    • Added current executing keyword and other statuses to TestRunner status bar.
    • Modified import statements to allow running RIDE without Robot Framework installed or versions older than 6.0.
    • @@ -232,7 +234,9 @@ def set_content(self, html_win, content):
      python -m robotide.postinstall -install

      or

      ride_postinstall.py -install
      -

      RIDE {VERSION} was released on 12/April/2025.

      +

      RIDE {VERSION} was released on 13/April/2025.

      +
      +

      Happy International Kiss Day!

    • 🐞 - Rename Keywords, Find Usages/Find where used are not finding all occurrences. Please, double-check findings and changes.
    • 🐞 - Some argument types detection (and colorization) is not correct in Grid Editor.
    • @@ -172,6 +172,7 @@ def set_content(self, html_win, content):

    New Features and Fixes Highlights

      +
    • Fixed white blocks on Tree due to failed animation when test execution is too rapid, causing crash on Windows.
    • Added Settings Editor button to Preferences dialog, to edit settings.cfg.
    • Created backup of settings.cfg to allow recovering some settings when broken upgrades.
    • Changed some informative dialogs and JSON Editor to use the customized colors.
    • @@ -185,7 +186,7 @@ def set_content(self, html_win, content):
    -

    The minimal wxPython version is, 4.0.7, and RIDE supports the current version, 4.2.2, which we recommend. +

    The minimal wxPython version is, 4.0.7, and RIDE supports the current version, 4.2.3, which we recommend.

    Linux users are advised to install first wxPython from .whl package at wxPython.org, or by using the system package @@ -236,7 +237,7 @@ def set_content(self, html_win, content):

    python -m robotide.postinstall -install

    or

    ride_postinstall.py -install
    -

    RIDE {VERSION} was released on 21/April/2025.

    +

    RIDE {VERSION} was released on 03/May/2025.