Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dea6221

Browse filesBrowse files
authored
Merge pull request #20701 from QuLogic/gtk-cleanup
Small cleanup to GTK backend
2 parents 758eb36 + d7889a2 commit dea6221
Copy full SHA for dea6221

File tree

Expand file treeCollapse file tree

2 files changed

+20
-19
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+20
-19
lines changed

‎.github/workflows/tests.yml

Copy file name to clipboardExpand all lines: .github/workflows/tests.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ jobs:
219219
run: |
220220
${{ matrix.XVFB_RUN }} python -mpytest -raR -n auto \
221221
--maxfail=50 --timeout=300 --durations=25 \
222-
--cov-report= --cov=lib --log-level=DEBUG
222+
--cov-report=xml --cov=lib --log-level=DEBUG
223223
224224
- name: Filter C coverage
225225
run: |

‎lib/matplotlib/backends/backend_gtk3.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_gtk3.py
+19-18Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
from matplotlib._pylab_helpers import Gcf
1010
from matplotlib.backend_bases import (
1111
_Backend, FigureCanvasBase, FigureManagerBase, NavigationToolbar2,
12-
TimerBase, ToolContainerBase, cursors)
12+
TimerBase, ToolContainerBase)
13+
from matplotlib.backend_tools import Cursors
1314
from matplotlib.figure import Figure
1415
from matplotlib.widgets import SubplotTool
1516

@@ -33,16 +34,16 @@
3334
_log = logging.getLogger(__name__)
3435

3536
backend_version = "%s.%s.%s" % (
36-
Gtk.get_major_version(), Gtk.get_micro_version(), Gtk.get_minor_version())
37+
Gtk.get_major_version(), Gtk.get_minor_version(), Gtk.get_micro_version())
3738

3839
try:
3940
_display = Gdk.Display.get_default()
4041
cursord = { # deprecated in Matplotlib 3.5.
41-
cursors.MOVE: Gdk.Cursor.new_from_name(_display, "move"),
42-
cursors.HAND: Gdk.Cursor.new_from_name(_display, "pointer"),
43-
cursors.POINTER: Gdk.Cursor.new_from_name(_display, "default"),
44-
cursors.SELECT_REGION: Gdk.Cursor.new_from_name(_display, "crosshair"),
45-
cursors.WAIT: Gdk.Cursor.new_from_name(_display, "wait"),
42+
Cursors.MOVE: Gdk.Cursor.new_from_name(_display, "move"),
43+
Cursors.HAND: Gdk.Cursor.new_from_name(_display, "pointer"),
44+
Cursors.POINTER: Gdk.Cursor.new_from_name(_display, "default"),
45+
Cursors.SELECT_REGION: Gdk.Cursor.new_from_name(_display, "crosshair"),
46+
Cursors.WAIT: Gdk.Cursor.new_from_name(_display, "wait"),
4647
}
4748
except TypeError as exc:
4849
cursord = {} # deprecated in Matplotlib 3.5.
@@ -90,13 +91,13 @@ def _create_application():
9091
@functools.lru_cache()
9192
def _mpl_to_gtk_cursor(mpl_cursor):
9293
name = {
93-
cursors.MOVE: "move",
94-
cursors.HAND: "pointer",
95-
cursors.POINTER: "default",
96-
cursors.SELECT_REGION: "crosshair",
97-
cursors.WAIT: "wait",
98-
cursors.RESIZE_HORIZONTAL: "ew-resize",
99-
cursors.RESIZE_VERTICAL: "ns-resize",
94+
Cursors.MOVE: "move",
95+
Cursors.HAND: "pointer",
96+
Cursors.POINTER: "default",
97+
Cursors.SELECT_REGION: "crosshair",
98+
Cursors.WAIT: "wait",
99+
Cursors.RESIZE_HORIZONTAL: "ew-resize",
100+
Cursors.RESIZE_VERTICAL: "ns-resize",
100101
}[mpl_cursor]
101102
return Gdk.Cursor.new_from_name(Gdk.Display.get_default(), name)
102103

@@ -263,7 +264,7 @@ def _get_key(self, event):
263264
for key_mask, prefix in modifiers:
264265
if event.state & key_mask:
265266
if not (prefix == 'shift' and unikey.isprintable()):
266-
key = '{0}+{1}'.format(prefix, key)
267+
key = f'{prefix}+{key}'
267268
return key
268269

269270
def configure_event(self, widget, event):
@@ -577,7 +578,7 @@ def save_figure(self, *args):
577578
ff = Gtk.FileFilter()
578579
ff.set_name(name)
579580
for fmt in fmts:
580-
ff.add_pattern("*." + fmt)
581+
ff.add_pattern(f'*.{fmt}')
581582
dialog.add_filter(ff)
582583
if self.canvas.get_default_filetype() in fmts:
583584
dialog.set_filter(ff)
@@ -587,7 +588,7 @@ def on_notify_filter(*args):
587588
name = dialog.get_filter().get_name()
588589
fmt = self.canvas.get_supported_filetypes_grouped()[name][0]
589590
dialog.set_current_name(
590-
str(Path(dialog.get_current_name()).with_suffix("." + fmt)))
591+
str(Path(dialog.get_current_name()).with_suffix(f'.{fmt}')))
591592

592593
dialog.set_current_folder(mpl.rcParams["savefig.directory"])
593594
dialog.set_current_name(self.canvas.get_default_filename())
@@ -678,7 +679,7 @@ def toggle_toolitem(self, name, toggled):
678679

679680
def remove_toolitem(self, name):
680681
if name not in self._toolitems:
681-
self.toolmanager.message_event('%s Not in toolbar' % name, self)
682+
self.toolmanager.message_event(f'{name} not in toolbar', self)
682683
return
683684

684685
for group in self._groups:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.