Repository navigation
implementation of the copy canvas tool #10446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
f092377
18df922
86d2968
9923703
25aceea
cff56e5
2f131e1
584bf3e
e87cb47
3866f29
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1069,11 +1069,18 @@ def trigger(self, *args): | |
| QtWidgets.QMessageBox.information(None, "Help", self._get_help_html()) | ||
|
|
||
|
|
||
| class ToolCopyToClipboardQT(backend_tools.ToolCopyToClipboardBase): | ||
| def trigger(self, *args, **kwargs): | ||
| pixmap = self.canvas.grab() | ||
| qApp.clipboard().setPixmap(pixmap) | ||
|
|
||
|
|
||
| backend_tools.ToolSaveFigure = SaveFigureQt | ||
| backend_tools.ToolConfigureSubplots = ConfigureSubplotsQt | ||
| backend_tools.ToolSetCursor = SetCursorQt | ||
| backend_tools.ToolRubberband = RubberbandQt | ||
| backend_tools.ToolHelp = HelpQt | ||
| backend_tools.ToolCopyToClipboard = ToolCopyToClipboardQT | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All the backend-specific tool classes do not have the "Tool" prefix. While, in general I would recommend to keep the prefix also in the backend specific classes, in the present situation I'm +0.3 not using it for consistency with the existing code. But I'm not familiar with that part of the code and don't know if there are any explicit policies on this. Maybe someone more experienced with that code can comment on this? Same holds for the other backends.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @timhoffm you are right, we have to make the naming more consistent.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we consider the backend implementations private? If so we can clean up the naming soon and this PR goes in as is. If not, we need a deprecation cycle. In that case, I‘d prefer to remove the Tool prefix in this PR as well and change everything later together.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As the initial warning states. Tool names might change. So I don't see a problem doing all of them in a single PR |
||
|
|
||
|
|
||
| def error_msg_qt(msg, parent=None): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1421,6 +1421,7 @@ def _validate_linestyle(ls): | |
| 'keymap.xscale': [['k', 'L'], validate_stringlist], | ||
| 'keymap.all_axes': [['a'], validate_stringlist], | ||
| 'keymap.help': [['f1'], validate_stringlist], | ||
| 'keymap.copy': [('ctrl+c', 'cmd+c', 'shift+ctrl+c'), validate_stringlist], | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. list instead of tuple? (as above, basically)
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @anntzer Done |
||
|
|
||
| # sample data | ||
| 'examples.directory': ['', validate_string], | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would move this to the base class ("The current backend does not implement the copy tool.").
In fact this could even be moved to ToolBase...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done