Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c3f4b54

Browse files
author
Steve Chaplin
committed
'SC'
svn path=/trunk/matplotlib/; revision=2086
1 parent 6fb1dc9 commit c3f4b54

1 file changed

Lines changed: 14 additions & 15 deletions

File tree

lib/matplotlib/backends/backend_gtk.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def fn_name(): return sys._getframe(1).f_code.co_name
5555
# ref gtk+/gtk/gtkwidget.h
5656
def GTK_WIDGET_DRAWABLE(w):
5757
flags = w.flags();
58-
return flags & gtk.VISIBLE !=0 and flags & gtk.MAPPED != 0
58+
return flags & gtk.VISIBLE != 0 and flags & gtk.MAPPED != 0
5959

6060

6161
def draw_if_interactive():
@@ -64,7 +64,7 @@ def draw_if_interactive():
6464
"""
6565
if matplotlib.is_interactive():
6666
figManager = Gcf.get_active()
67-
if figManager != None:
67+
if figManager is not None:
6868
figManager.canvas.draw()
6969

7070
def show(mainloop=True):
@@ -235,7 +235,7 @@ def idle_draw(*args):
235235
self.draw()
236236
self._idleID = 0
237237
return False
238-
if self._idleID==0:
238+
if self._idleID == 0:
239239
self._idleID = gobject.idle_add(idle_draw)
240240

241241

@@ -427,7 +427,7 @@ def __init__(self, canvas, num):
427427
w = int (self.canvas.figure.bbox.width())
428428
h = int (self.canvas.figure.bbox.height())
429429

430-
if self.toolbar != None:
430+
if self.toolbar is not None:
431431
self.toolbar.show()
432432
self.vbox.pack_end(self.toolbar, False, False)
433433

@@ -444,15 +444,15 @@ def destroy(*args):
444444

445445
def notify_axes_change(fig):
446446
'this will be called whenever the current axes is changed'
447-
if self.toolbar != None: self.toolbar.update()
447+
if self.toolbar is not None: self.toolbar.update()
448448
self.canvas.figure.add_axobserver(notify_axes_change)
449449

450450
self.canvas.grab_focus()
451451

452452
def destroy(self, *args):
453453
if _debug: print 'FigureManagerGTK.%s' % fn_name()
454454
self.window.destroy()
455-
if Gcf.get_num_fig_managers()==0 and not matplotlib.is_interactive():
455+
if Gcf.get_num_fig_managers() == 0 and not matplotlib.is_interactive():
456456
gtk.main_quit()
457457

458458

@@ -469,9 +469,9 @@ def full_screen_toggle (self):
469469
def _get_toolbar(self, canvas):
470470
# must be inited after the window, drawingArea and figure
471471
# attrs are set
472-
if matplotlib.rcParams['toolbar']=='classic':
472+
if matplotlib.rcParams['toolbar'] == 'classic':
473473
toolbar = NavigationToolbar (canvas, self.window)
474-
elif matplotlib.rcParams['toolbar']=='toolbar2':
474+
elif matplotlib.rcParams['toolbar'] == 'toolbar2':
475475
toolbar = NavigationToolbar2GTK (canvas, self.window)
476476
else:
477477
toolbar = None
@@ -506,8 +506,8 @@ def __init__(self, canvas, window):
506506
self._idleId = 0
507507

508508
def set_message(self, s):
509-
if self._idleId==0: self.message.set_label(s)
510-
509+
if self._idleId == 0:
510+
self.message.set_label(s)
511511

512512
def set_cursor(self, cursor):
513513
self.canvas.window.set_cursor(cursord[cursor])
@@ -556,7 +556,7 @@ def idle_draw(*args):
556556
drawable.draw_rectangle(gc, False, *rect)
557557
self._idleId = 0
558558
return False
559-
if self._idleId==0:
559+
if self._idleId == 0:
560560
self._idleId = gobject.idle_add(idle_draw)
561561

562562

@@ -1021,7 +1021,7 @@ def cb_cbox_changed (cbox, data=None):
10211021
def get_filename_from_user (self):
10221022
filename = None
10231023
while True:
1024-
if self.run() != gtk.RESPONSE_OK:
1024+
if self.run() is not gtk.RESPONSE_OK:
10251025
filename = None
10261026
break
10271027
filename = self.get_filename()
@@ -1246,10 +1246,9 @@ def on_dialog_lineprops_cancelbutton_clicked(self, button):
12461246

12471247

12481248
def error_msg_gtk(msg, parent=None):
1249-
1250-
if parent: # find the toplevel gtk.Window
1249+
if parent is not None: # find the toplevel gtk.Window
12511250
parent = parent.get_toplevel()
1252-
if not parent.flags() & gtk.TOPLEVEL:
1251+
if parent.flags() & gtk.TOPLEVEL == 0:
12531252
parent = None
12541253

12551254
if not is_string_like(msg):

0 commit comments

Comments
 (0)