-
+Changed some informative dialogs and JSON Editor to use the customized colors.
+
-
Modified import statements to allow running RIDE without Robot Framework installed or versions older than 6.0.
-
On Windows ignore false modification on files when opening Test Suites, causing confirmation dialog.
diff --git a/src/robotide/application/application.py b/src/robotide/application/application.py
index 04b004a22..f2ed6c06e 100644
--- a/src/robotide/application/application.py
+++ b/src/robotide/application/application.py
@@ -19,6 +19,9 @@
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
@@ -329,7 +332,11 @@ def _load_data(self):
self.workspace_path = self.workspace_path or self._get_latest_path()
if self.workspace_path:
self._controller.update_default_dir(self.workspace_path)
- observer = LoadProgressObserver(self.frame)
+ theme = self.settings.get_without_default('General')
+ background = theme['background']
+ foreground = theme['foreground']
+ # print(f"DEBUG: application.py RIDE _load_data CALL PROGRESS {background=} {foreground=}")
+ observer = LoadProgressObserver(self.frame, background=background, foreground=foreground)
self._controller.load_data(self.workspace_path, observer)
@staticmethod
diff --git a/src/robotide/application/releasenotes.py b/src/robotide/application/releasenotes.py
index 0d39aa60b..22c6c2137 100644
--- a/src/robotide/application/releasenotes.py
+++ b/src/robotide/application/releasenotes.py
@@ -170,6 +170,7 @@ def set_content(self, html_win, content):
New Features and Fixes Highlights
+- 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.
- Added Config Panel button to supported installed Plugins next to their name in Plugin Manager dialog.
@@ -231,7 +232,7 @@ def set_content(self, html_win, content):
python -m robotide.postinstall -install
or
ride_postinstall.py -install
-
RIDE {VERSION} was released on 02/April/2025.
+
RIDE {VERSION} was released on 12/April/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