-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get Rid of Noisy FigureManager error log (#494)
* just clone workspace, do not rename, it will get cleaned up anyway and not really impact perf * mutate axis to prevent errors being tossed in unnecessary handling of workspace rename * update with the most correct solution * updforgot a spot * move mutation to central location
- Loading branch information
Showing
4 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
def mantidAxisFactory(ax): | ||
""" | ||
Refurbish the axis object with a new rename_workspace method | ||
""" | ||
|
||
def rename_workspace(old_name, new_name): | ||
""" | ||
Rename a workspace, and update the artists, creation arguments and tracked workspaces accordingly | ||
:param new_name : the new name of workspace | ||
:param old_name : the old name of workspace | ||
""" | ||
for cargs in ax.creation_args: | ||
# NEW CHECK | ||
func_name = cargs["function"] | ||
if func_name not in ["axhline", "axvline"] and cargs["workspaces"] == old_name: | ||
cargs["workspaces"] = new_name | ||
# Alternatively, | ||
# if cargs.get("workspaces") == old_name: | ||
# cargs["workspaces"] = new_name | ||
for ws_name, ws_artist_list in list(ax.tracked_workspaces.items()): | ||
for ws_artist in ws_artist_list: | ||
if ws_artist.workspace_name == old_name: | ||
ws_artist.rename_data(new_name) | ||
if ws_name == old_name: | ||
ax.tracked_workspaces[new_name] = ax.tracked_workspaces.pop(old_name) | ||
|
||
ax.rename_workspace = rename_workspace | ||
return ax |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters