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 43968f1

Browse filesBrowse files
committed
Merge pull request #1014 from efiring/fix_qt4_icon_dup
qt4: remove duplicate file save button; and remove trailing whitespace
2 parents 6a250a9 + ad83a78 commit 43968f1
Copy full SHA for 43968f1

File tree

Expand file treeCollapse file tree

2 files changed

+35
-40
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+35
-40
lines changed

‎lib/matplotlib/backend_bases.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_bases.py
+18-18Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ def get_gid(self):
792792
Return the object identifier if one is set, None otherwise.
793793
"""
794794
return self._gid
795-
795+
796796
def get_snap(self):
797797
"""
798798
returns the snap setting which may be:
@@ -935,7 +935,7 @@ def set_gid(self, id):
935935
Sets the id.
936936
"""
937937
self._gid = id
938-
938+
939939
def set_snap(self, snap):
940940
"""
941941
Sets the snap setting which may be:
@@ -1305,11 +1305,11 @@ class MouseEvent(LocationEvent):
13051305
attributes, the following attributes are defined:
13061306
13071307
*button*
1308-
button pressed None, 1, 2, 3, 'up', 'down' (up and down are used
1308+
button pressed None, 1, 2, 3, 'up', 'down' (up and down are used
13091309
for scroll events)
13101310
13111311
*key*
1312-
the key depressed when the mouse event triggered (see
1312+
the key depressed when the mouse event triggered (see
13131313
:class:`KeyEvent`)
13141314
13151315
*step*
@@ -1347,7 +1347,7 @@ def __init__(self, name, canvas, x, y, button=None, key=None,
13471347

13481348
def __str__(self):
13491349
return ("MPL MouseEvent: xy=(%d,%d) xydata=(%s,%s) button=%d " +
1350-
"dblclick=%s inaxes=%s") % (self.x, self.y, self.xdata,
1350+
"dblclick=%s inaxes=%s") % (self.x, self.y, self.xdata,
13511351
self.ydata, self.button, self.dblclick, self.inaxes)
13521352

13531353

@@ -1403,18 +1403,18 @@ class KeyEvent(LocationEvent):
14031403
14041404
*key*
14051405
the key(s) pressed. Could be **None**, a single case sensitive ascii
1406-
character ("g", "G", "#", etc.), a special key
1407-
("control", "shift", "f1", "up", etc.) or a
1406+
character ("g", "G", "#", etc.), a special key
1407+
("control", "shift", "f1", "up", etc.) or a
14081408
combination of the above (e.g. "ctrl+alt+g", "ctrl+alt+G").
1409-
1409+
14101410
.. note::
1411-
1411+
14121412
Modifier keys will be prefixed to the pressed key and will be in the
14131413
order "ctrl", "alt", "super". The exception to this rule is when the
1414-
pressed key is itself a modifier key, therefore "ctrl+alt" and
1414+
pressed key is itself a modifier key, therefore "ctrl+alt" and
14151415
"alt+control" can both be valid key values.
1416-
1417-
1416+
1417+
14181418
Example usage::
14191419
14201420
def on_key(event):
@@ -1664,7 +1664,7 @@ def button_press_event(self, x, y, button, dblclick=False, guiEvent=None):
16641664
"""
16651665
self._button = button
16661666
s = 'button_press_event'
1667-
mouseevent = MouseEvent(s, self, x, y, button, self._key,
1667+
mouseevent = MouseEvent(s, self, x, y, button, self._key,
16681668
dblclick=dblclick, guiEvent=guiEvent)
16691669
self.callbacks.process(s, mouseevent)
16701670

@@ -2043,7 +2043,7 @@ def print_figure(self, filename, dpi=None, facecolor='w', edgecolor='w',
20432043
bbox_extra_artists = self.figure.get_default_bbox_extra_artists()
20442044

20452045
bb = [a.get_window_extent(renderer) for a in bbox_extra_artists]
2046-
2046+
20472047
if bb:
20482048
_bbox = Bbox.union([b for b in bb if b.width!=0 or b.height!=0])
20492049

@@ -2319,7 +2319,7 @@ def key_press_handler(event, canvas, toolbar=None):
23192319
# quit the figure (defaut key 'ctrl+w')
23202320
if event.key in quit_keys:
23212321
Gcf.destroy_fig(canvas.figure)
2322-
2322+
23232323
if toolbar is not None:
23242324
# home or reset mnemonic (default key 'h', 'home' and 'r')
23252325
if event.key in home_keys:
@@ -2494,12 +2494,12 @@ class NavigationToolbar2(object):
24942494
24952495
That's it, we'll do the rest!
24962496
"""
2497-
2497+
24982498
# list of toolitems to add to the toolbar, format is:
24992499
# (
25002500
# text, # the text of the button (often not visible to users)
25012501
# tooltip_text, # the tooltip shown on hover (where possible)
2502-
# image_file, # name of the image for the button (without the extension)
2502+
# image_file, # name of the image for the button (without the extension)
25032503
# name_of_method, # name of the method in NavigationToolbar2 to call
25042504
# )
25052505
toolitems = (
@@ -2608,7 +2608,7 @@ def mouse_move(self, event):
26082608

26092609
if event.inaxes and event.inaxes.get_navigate():
26102610

2611-
try:
2611+
try:
26122612
s = event.inaxes.format_coord(event.xdata, event.ydata)
26132613
except (ValueError, OverflowError):
26142614
pass

‎lib/matplotlib/backends/backend_qt4.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_qt4.py
+17-22Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -153,25 +153,25 @@ class FigureCanvasQT( QtGui.QWidget, FigureCanvasBase ):
153153
_modifier_keys = [
154154
(QtCore.Qt.MetaModifier, 'super', QtCore.Qt.Key_Meta),
155155
(QtCore.Qt.AltModifier, 'alt', QtCore.Qt.Key_Alt),
156-
(QtCore.Qt.ControlModifier, 'ctrl', QtCore.Qt.Key_Control)
156+
(QtCore.Qt.ControlModifier, 'ctrl', QtCore.Qt.Key_Control)
157157
]
158-
158+
159159
_ctrl_modifier = QtCore.Qt.ControlModifier
160-
160+
161161
if sys.platform == 'darwin':
162-
# in OSX, the control and super (aka cmd/apple) keys are switched, so
162+
# in OSX, the control and super (aka cmd/apple) keys are switched, so
163163
# switch them back.
164164
keyvald.update({
165165
QtCore.Qt.Key_Control : 'super', # cmd/apple key
166166
QtCore.Qt.Key_Meta : 'control',
167167
})
168-
168+
169169
_modifier_keys = [
170170
(QtCore.Qt.ControlModifier, 'super', QtCore.Qt.Key_Control),
171171
(QtCore.Qt.AltModifier, 'alt', QtCore.Qt.Key_Alt),
172172
(QtCore.Qt.MetaModifier, 'ctrl', QtCore.Qt.Key_Meta),
173173
]
174-
174+
175175
_ctrl_modifier = QtCore.Qt.MetaModifier
176176

177177
# map Qt button codes to MouseEvent's ones:
@@ -242,7 +242,7 @@ def mouseMoveEvent( self, event ):
242242
# flipy so y=0 is bottom of canvas
243243
y = self.figure.bbox.height - event.y()
244244
FigureCanvasBase.motion_notify_event( self, x, y )
245-
#if DEBUG: print 'mouse move'
245+
#if DEBUG: print('mouse move')
246246

247247
def mouseReleaseEvent( self, event ):
248248
x = event.x()
@@ -304,16 +304,16 @@ def _get_key( self, event ):
304304
if event.key() < 256:
305305
key = unicode(event.text())
306306
# if the control key is being pressed, we don't get the correct
307-
# characters, so interpret them directly from the event.key().
308-
# Unfortunately, this means that we cannot handle key's case
307+
# characters, so interpret them directly from the event.key().
308+
# Unfortunately, this means that we cannot handle key's case
309309
# since event.key() is not case sensitive, whereas event.text() is,
310310
# Finally, since it is not possible to get the CapsLock state
311-
# we cannot accurately compute the case of a pressed key when
311+
# we cannot accurately compute the case of a pressed key when
312312
# ctrl+shift+p is pressed.
313313
if int(event.modifiers()) & self._ctrl_modifier:
314314
# we always get an uppercase character
315315
key = chr(event.key())
316-
# if shift is not being pressed, lowercase it (as mentioned,
316+
# if shift is not being pressed, lowercase it (as mentioned,
317317
# this does not take into account the CapsLock state)
318318
if not int(event.modifiers()) & QtCore.Qt.ShiftModifier:
319319
key = key.lower()
@@ -322,9 +322,9 @@ def _get_key( self, event ):
322322
key = self.keyvald.get(event.key())
323323

324324
if key is not None:
325-
# prepend the ctrl, alt, super keys if appropriate (sorted in that order)
325+
# prepend the ctrl, alt, super keys if appropriate (sorted in that order)
326326
for modifier, prefix, Qt_key in self._modifier_keys:
327-
if event.key() != Qt_key and int(event.modifiers()) & modifier == modifier:
327+
if event.key() != Qt_key and int(event.modifiers()) & modifier == modifier:
328328
key = u'{}+{}'.format(prefix, key)
329329

330330
return key
@@ -437,7 +437,7 @@ def _show_message(self,s):
437437

438438
def full_screen_toggle(self):
439439
if self.window.isFullScreen():
440-
self.window.showNormal()
440+
self.window.showNormal()
441441
else:
442442
self.window.showFullScreen()
443443

@@ -505,20 +505,16 @@ def _init_toolbar(self):
505505
if text is None:
506506
self.addSeparator()
507507
else:
508-
a = self.addAction(self._icon(image_file + '.png'), text, getattr(self, callback))
508+
a = self.addAction(self._icon(image_file + '.png'),
509+
text, getattr(self, callback))
509510
if tooltip_text is not None:
510511
a.setToolTip(tooltip_text)
511-
512+
512513
if figureoptions is not None:
513514
a = self.addAction(self._icon("qt4_editor_options.png"),
514515
'Customize', self.edit_parameters)
515516
a.setToolTip('Edit curves line and axes parameters')
516517

517-
a = self.addAction(self._icon('filesave.png'), 'Save',
518-
self.save_figure)
519-
a.setToolTip('Save the figure')
520-
521-
522518
self.buttons = {}
523519

524520
# Add the x,y location widget at the right side of the toolbar
@@ -628,7 +624,6 @@ def save_figure(self, *args):
628624
selectedFilter = filter
629625
filters.append(filter)
630626
filters = ';;'.join(filters)
631-
632627
fname = _getSaveFileName(self, "Choose a filename to save to",
633628
start, filters, selectedFilter)
634629
if fname:

0 commit comments

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