Skip to content

Commit 9d2a143

Browse files
Change Message box to RIDEDialog (#2936)
* Styled message box * More dialogs with style. Broken validation on New Projects * Fix dialogs colour in main and filedialog * Fix dialogs colour in ProgressDialogs * Change dialogs to use customized colors * Change dialogs to use customized colors in Treenodehandlers * Change dialogs to use customized colors in Tagdialogs * Change dialogs to use customized colors in Logger * Change dialogs to use customized colors in Run/ui * Change dialogs to use customized colors in specimporter * Change dialogs to use customized colors in testrunner * Final change dialogs to use customized colors
1 parent 5dbe3f7 commit 9d2a143

File tree

23 files changed

+192
-85
lines changed

23 files changed

+192
-85
lines changed

CHANGELOG.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ and this project adheres to http://semver.org/spec/v2.0.0.html[Semantic Versioni
1616
when selecting in Tree shows the filename in StatusBar.
1717

1818
=== Changed
19+
- Changed some informative dialogs and JSON Editor to use the customized colors.
1920
- Modified import statements to allow running RIDE without Robot Framework installed or versions older than 6.0.
2021
- On Windows ignore false modification on files when opening Test Suites, causing confirmation dialog.
2122

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.2dev19**) with:
43+
(3.8 <= python <= 3.13) Install current development version (**2.2dev20**) with:
4444

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

src/robotide/application/CHANGELOG.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
Added divided Status Bar. Left side for main window, right side for Plugins. Working example in Text Editor,
1111
when selecting in Tree shows the filename in StatusBar.
1212
</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_changed"></a>1.2. Changed</h3></div></div></div><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
13+
Changed some informative dialogs and JSON Editor to use the customized colors.
14+
</li><li class="listitem">
1315
Modified import statements to allow running RIDE without Robot Framework installed or versions older than 6.0.
1416
</li><li class="listitem">
1517
On Windows ignore false modification on files when opening Test Suites, causing confirmation dialog.

src/robotide/application/application.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919

2020
from contextlib import contextmanager
2121
from pathlib import Path
22+
23+
from pygments.styles.dracula import background
24+
2225
from ..namespace import Namespace
2326
from ..controller import Project
2427
from ..spec import librarydatabase
@@ -329,7 +332,11 @@ def _load_data(self):
329332
self.workspace_path = self.workspace_path or self._get_latest_path()
330333
if self.workspace_path:
331334
self._controller.update_default_dir(self.workspace_path)
332-
observer = LoadProgressObserver(self.frame)
335+
theme = self.settings.get_without_default('General')
336+
background = theme['background']
337+
foreground = theme['foreground']
338+
# print(f"DEBUG: application.py RIDE _load_data CALL PROGRESS {background=} {foreground=}")
339+
observer = LoadProgressObserver(self.frame, background=background, foreground=foreground)
333340
self._controller.load_data(self.workspace_path, observer)
334341

335342
@staticmethod

src/robotide/application/releasenotes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ 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>Changed some informative dialogs and JSON Editor to use the customized colors.</li>
173174
<li>Added current executing keyword and other statuses to TestRunner status bar.</li>
174175
<li>Modified import statements to allow running RIDE without Robot Framework installed or versions older than 6.0.</li>
175176
<li>Added Config Panel button to supported installed Plugins next to their name in Plugin Manager dialog.</li>
@@ -231,7 +232,7 @@ def set_content(self, html_win, content):
231232
<pre class="literal-block">python -m robotide.postinstall -install</pre>
232233
<p>or</p>
233234
<pre class="literal-block">ride_postinstall.py -install</pre>
234-
<p>RIDE {VERSION} was released on 02/April/2025.</p>
235+
<p>RIDE {VERSION} was released on 12/April/2025.</p>
235236
<!-- <br/>
236237
<h3>May The Fourth Be With You!</h3>
237238
<h3>Celebrate the bank holiday, 10th June, Day of Portugal, Portuguese Communities and Camões!!</h3>

src/robotide/context/logger.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ def _is_ignored_warning(self, msg):
7979
def _show_message(self, msg, level):
8080
try:
8181
icon = level == 'ERROR' and wx.ICON_ERROR or wx.ICON_WARNING
82-
wx.MessageBox(msg, level, icon)
82+
message_box = RIDEDialog(title=level, message=msg, style=icon)
83+
message_box.ShowModal()
8384
except wx.PyNoAppError:
8485
sys.stderr.write('%s: %s\n' % (level, msg))
8586

src/robotide/contrib/testrunner/runprofiles.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,12 @@ def _parse_windows_command(self):
341341
try:
342342
output = output.decode(os_encoding)
343343
except UnicodeDecodeError:
344-
wx.MessageBox(f"An UnicodeDecodeError occurred when processing the Arguments."
344+
message_box = RIDEDialog(title="UnicodeDecodeError",
345+
message=f"An UnicodeDecodeError occurred when processing the Arguments."
345346
f" The encoding used was '{os_encoding}'. You may try to define the environment variable"
346347
f" RIDE_ENCODING with a proper value. Other possibility, is to replace 'pythonw.exe' by "
347-
f"'python.exe' in the Desktop Shortcut.", "UnicodeDecodeError")
348+
f"'python.exe' in the Desktop Shortcut.", style=wx.OK | wx.ICON_ERROR)
349+
message_box.ShowModal()
348350
output = str(output).lstrip("b\'").lstrip('"').replace('\\r\\n', '').replace('\'', '').\
349351
replace('\\""', '\"').strip()
350352
# print(f"DEBUG: run_profiles _parse_windows_command: output ={output}")

src/robotide/contrib/testrunner/testrunnerplugin.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -460,22 +460,21 @@ def _can_start_running_tests(self):
460460

461461
@staticmethod
462462
def _ask_user_to_save_before_running():
463-
ret = wx.MessageBox(_("""There are unsaved modifications.
464-
Do you want to save all changes and run the tests?"""),
465-
_("Unsaved Modifications"),
466-
wx.ICON_QUESTION | wx.YES_NO)
467-
return ret == wx.YES
463+
message_box = RIDEDialog(title=_("Unsaved Modifications"),
464+
message=_("""There are unsaved modifications.
465+
Do you want to save all changes and run the tests?"""), style=wx.ICON_QUESTION | wx.YES_NO)
466+
ret = message_box.ShowModal()
467+
return ret == wx.ID_YES
468468

469469
def _tests_selected(self):
470470
return len(self._selected_tests) != 0
471471

472472
@staticmethod
473473
def _ask_user_to_run_anyway():
474-
ret = wx.MessageBox(_('No tests selected. \n'
475-
'Continue anyway?'),
476-
_('No tests selected'),
477-
wx.ICON_QUESTION | wx.YES_NO)
478-
return ret == wx.YES
474+
message_box = RIDEDialog(title=_('No tests selected'), message=_('No tests selected. \nContinue anyway?'),
475+
style=wx.ICON_QUESTION | wx.YES_NO)
476+
ret = message_box.ShowModal()
477+
return ret == wx.ID_YES
479478

480479
def _initialize_ui_for_running(self):
481480
self._show_notebook_tab()
@@ -1182,10 +1181,10 @@ def _enable_runner_toolbar(self, run, paused):
11821181

11831182
@staticmethod
11841183
def _notify_user_no_logs_directory():
1185-
wx.MessageBox(_("There isn't logs directory. \n"
1186-
"Please, run the tests and try again"),
1187-
_("No logs directory"),
1188-
wx.ICON_INFORMATION | wx.OK)
1184+
message_box = RIDEDialog(title=_("No logs directory"), message=_("There isn't logs directory. \n"
1185+
"Please, run the tests and try again"),
1186+
style=wx.OK | wx.ICON_INFORMATION)
1187+
message_box.ShowModal()
11891188

11901189
def on_config_panel(self):
11911190
dlg = self.config_panel(self.frame)

src/robotide/controller/ctrlcommands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ class RenameKeywordOccurrences(_ReversibleCommand):
292292

293293
def __init__(self, original_name, new_name, observer, keyword_info=None, language='En'):
294294
self._language = language[0] if isinstance(language, list) else language
295-
if self._language.lower() not in ['en', 'english']:
295+
if self._language and self._language.lower() not in ['en', 'english']:
296296
bdd_prefix = f"{obtain_bdd_prefixes(self._language)}|{BDD_ENGLISH}"
297297
else:
298298
bdd_prefix = BDD_ENGLISH

src/robotide/editor/kweditor.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,8 @@ def on_create_keyword(self, event):
10721072
try:
10731073
self._execute(add_keyword_from_cells(cells))
10741074
except ValueError as err:
1075-
wx.MessageBox(str(err))
1075+
message_box = RIDEDialog(title=_('Validation Error'), message=str(err), style=wx.ICON_ERROR|wx.OK)
1076+
message_box.ShowModal()
10761077

10771078
def _data_cells_from_current_row(self):
10781079
currow, curcol = self.selection.cell
@@ -1161,7 +1162,8 @@ def on_rename_keyword(self, event):
11611162
new_name = wx.GetTextFromUser(_('New name'), _(REN_KW), default_value=old_name)
11621163
if new_name:
11631164
self._execute(RenameKeywordOccurrences(
1164-
old_name, new_name, RenameProgressObserver(self.GetParent()), language=self._language))
1165+
old_name, new_name, RenameProgressObserver(self.GetParent(), background=self.color_background,
1166+
foreground=self.color_foreground), language=self._language))
11651167

11661168
# Add one new Dialog to edit pretty json String TODO: use better editor with more functions
11671169
def on_json_editor(self, event=None):
@@ -1171,10 +1173,16 @@ def on_json_editor(self, event=None):
11711173
dialog.SetTitle('JSON Editor')
11721174
dialog.SetSizer(wx.BoxSizer(wx.HORIZONTAL))
11731175
ok_btn = wx.Button(dialog, wx.ID_OK, _("Save"))
1176+
ok_btn.SetBackgroundColour(self.color_secondary_background)
1177+
ok_btn.SetForegroundColour(self.color_secondary_foreground)
11741178
cnl_btn = wx.Button(dialog, wx.ID_CANCEL, _("Cancel"))
1179+
cnl_btn.SetBackgroundColour(self.color_secondary_background)
1180+
cnl_btn.SetForegroundColour(self.color_secondary_foreground)
11751181
rich_text = wx.TextCtrl(dialog, wx.ID_ANY, "If supported by the native control, this is reversed, and this is"
11761182
" a different font.", size=(400, 475),
11771183
style=wx.HSCROLL | wx.TE_MULTILINE | wx.TE_NOHIDESEL)
1184+
rich_text.SetBackgroundColour(self.settings['background unknown'])
1185+
rich_text.SetForegroundColour(self.settings['text empty'])
11781186
dialog.Sizer.Add(rich_text, flag=wx.GROW, proportion=1)
11791187
dialog.Sizer.Add(ok_btn, flag=wx.ALL)
11801188
dialog.Sizer.Add(cnl_btn, flag=wx.ALL)
@@ -1197,8 +1205,9 @@ def on_json_editor(self, event=None):
11971205
try:
11981206
json.loads(content) # Yes, we need the error
11991207
except JSONDecodeError as e:
1200-
res = wx.MessageDialog(dialog, f"{_('Error in JSON:')} {e}\n\n{_('Save anyway?')}",
1201-
_("Validation Error!"), wx.YES_NO)
1208+
res = RIDEDialog(title=_('Validation Error!'),
1209+
message=f"{_('Error in JSON:')} {e}\n\n{_('Save anyway?')}",
1210+
style=wx.ICON_ERROR | wx.YES_NO)
12021211
res.InheritAttributes()
12031212
response = res.ShowModal()
12041213
if response == wx.ID_YES:

0 commit comments

Comments
 (0)