Skip to content

Commit

Permalink
Protect ProgressBar
Browse files Browse the repository at this point in the history
  • Loading branch information
HelioGuilherme66 committed Dec 29, 2024
1 parent eff2795 commit 86474d5
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
3 changes: 2 additions & 1 deletion src/robotide/controller/ctrlcommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,8 @@ def _params(self):
def _execute(self, context):
self._observer.notify()
self._occurrences = self._find_occurrences(context) if self._occurrences is None else self._occurrences
print(f"DEBUG: ctlcommands.py RenameKeywordOccurrences _execute: found occurrences= {self._occurrences}")
print(f"DEBUG: ctlcommands.py RenameKeywordOccurrences _execute: found occurrences= {self._occurrences}\n"
f"CONTEXT:{context}")
self._replace_keywords_in(self._occurrences)
context.update_namespace()
self._notify_values_changed(self._occurrences, old_name=self._original_name)
Expand Down
4 changes: 2 additions & 2 deletions src/robotide/editor/macroeditors.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ def _create_kweditor(self):
self._editors.append(self.kweditor)

def _name_changed(self, message):
print(f"DEBUG: macroeditors.py TestCaseEditor _name_changed ENTER {message}\n"
f" {message.item.name=} {self.controller}")
print(f"DEBUG: macroeditors.py TestCaseEditor _name_changed ENTER {message}\n")
if message.item == self.controller:
self.header.SetLabel(message.item.name)
print(f"DEBUG: macroeditors.py TestCaseEditor _name_changed DONE {message.item.name=} {self.controller}")

def close(self):
for editor in self._editors:
Expand Down
10 changes: 8 additions & 2 deletions src/robotide/ui/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ def notify(self):
self._progressbar.Pulse()

def finish(self):
self._progressbar.Destroy()
try:
self._progressbar.Destroy()
except RuntimeError:
pass
if hasattr(context.LOG, 'report_parsing_errors'):
context.LOG.report_parsing_errors()

Expand All @@ -55,5 +58,8 @@ def __init__(self, frame):

def notify(self):
if time.time() - self._notification_occured > 0.1:
self._progressbar.Pulse()
try:
self._progressbar.Pulse()
except RuntimeError:
pass
self._notification_occured = time.time()
21 changes: 11 additions & 10 deletions utest/controller/test_z_rename_keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,16 +260,8 @@ def setUp(self):
print(f"DEBUG: setUp() dir self.project_ctrl ={dir(self.project_ctrl)}"
f"\nself.app.project={dir(self.app.project)} ")

self.ts1 = datafilereader.get_ctrl_by_name('Suite01',
self.app.project.datafiles)
self.ts3 = datafilereader.get_ctrl_by_name('Suite02',
self.app.project.datafiles)
# cls.resu = datafilereader.get_ctrl_by_name(
# datafilereader.SIMPLE_TEST_SUITE_RESOURCE_NAME,
# cls.project_ctrl.datafiles)
self.res00 = datafilereader.get_ctrl_by_name('External Res', self.app.project.datafiles) # OK
self.res01 = datafilereader.get_ctrl_by_name('Res01', self.app.project.datafiles)
self.res02 = datafilereader.get_ctrl_by_name('Res02', self.app.project.datafiles)
self._get_controllers()

# self.ctrl = self.ts1
# self.suites = self.ctrl.suites
self.app.tree.populate(self.app.project)
Expand All @@ -283,6 +275,13 @@ def setUp(self):
# Uncomment next line (and MainLoop in tests) if you want to see the app
self.frame.Show()

def _get_controllers(self):
self.ts1 = datafilereader.get_ctrl_by_name('Suite01', self.app.project.datafiles)
self.ts3 = datafilereader.get_ctrl_by_name('Suite02', self.app.project.datafiles)
self.res00 = datafilereader.get_ctrl_by_name('External Res', self.app.project.datafiles) # OK
self.res01 = datafilereader.get_ctrl_by_name('Res01', self.app.project.datafiles)
self.res02 = datafilereader.get_ctrl_by_name('Res02', self.app.project.datafiles)

def _register(self, iclass, eclass):
self._registered_editors[iclass] = eclass

Expand Down Expand Up @@ -412,6 +411,8 @@ def test_rename_suite_setup_kw(self):

# myobject.execute(self.project_ctrl.setting_table)
# After Rename
self._get_controllers()

print(f"Result from Rename myobject={myobject}")
ts_list = []
if isinstance(self.ts1, list):
Expand Down

0 comments on commit 86474d5

Please sign in to comment.