From 9f71aa864fd6753817cc7a6461d2ff08ec9a34a0 Mon Sep 17 00:00:00 2001 From: Daniel Narvaez Date: Sun, 5 May 2013 01:26:28 +0200 Subject: [PATCH 1/3] Remove various unused bits --- src/sugar3/activity/htmlactivity.py | 1 - src/sugar3/dispatch/saferef.py | 2 +- src/sugar3/graphics/colorbutton.py | 1 - src/sugar3/graphics/radiotoolbutton.py | 1 - src/sugar3/graphics/toggletoolbutton.py | 1 - src/sugar3/graphics/toolbutton.py | 1 - tests/test_uitree.py | 1 - 7 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/sugar3/activity/htmlactivity.py b/src/sugar3/activity/htmlactivity.py index ac6acc74..38beed55 100644 --- a/src/sugar3/activity/htmlactivity.py +++ b/src/sugar3/activity/htmlactivity.py @@ -18,7 +18,6 @@ import json import os -from gi.repository import Gtk from gi.repository import GConf from gi.repository import WebKit2 from gwebsockets.server import Server diff --git a/src/sugar3/dispatch/saferef.py b/src/sugar3/dispatch/saferef.py index 8bcfd8a1..3be5a3f7 100644 --- a/src/sugar3/dispatch/saferef.py +++ b/src/sugar3/dispatch/saferef.py @@ -121,7 +121,7 @@ class BoundMethodWeakref(object): except Exception, e: try: traceback.print_exc() - except AttributeError, err: + except AttributeError: print '''Exception during saferef %s cleanup function %s: %s'''%( self, function, e ) diff --git a/src/sugar3/graphics/colorbutton.py b/src/sugar3/graphics/colorbutton.py index 1d2faf8d..409e9855 100644 --- a/src/sugar3/graphics/colorbutton.py +++ b/src/sugar3/graphics/colorbutton.py @@ -545,7 +545,6 @@ class ColorToolButton(Gtk.ToolItem): title = GObject.property(type=str, getter=get_title, setter=set_title) def do_draw(self, cr): - child = self.get_child() if self._palette and self._palette.is_up(): allocation = self.get_allocation() # draw a black background, has been done by the engine before diff --git a/src/sugar3/graphics/radiotoolbutton.py b/src/sugar3/graphics/radiotoolbutton.py index a51a39a6..09b26ad1 100644 --- a/src/sugar3/graphics/radiotoolbutton.py +++ b/src/sugar3/graphics/radiotoolbutton.py @@ -131,7 +131,6 @@ class RadioToolButton(Gtk.RadioToolButton): type=object, setter=set_palette_invoker, getter=get_palette_invoker) def do_draw(self, cr): - child = self.get_child() if self.palette and self.palette.is_up(): allocation = self.get_allocation() # draw a black background, has been done by the engine before diff --git a/src/sugar3/graphics/toggletoolbutton.py b/src/sugar3/graphics/toggletoolbutton.py index 0c4e5920..6d3c7bd4 100644 --- a/src/sugar3/graphics/toggletoolbutton.py +++ b/src/sugar3/graphics/toggletoolbutton.py @@ -125,7 +125,6 @@ class ToggleToolButton(Gtk.ToggleToolButton): getter=get_accelerator) def do_draw(self, cr): - child = self.get_child() if self.palette and self.palette.is_up(): allocation = self.get_allocation() # draw a black background, has been done by the engine before diff --git a/src/sugar3/graphics/toolbutton.py b/src/sugar3/graphics/toolbutton.py index 522d6538..4a9feeeb 100644 --- a/src/sugar3/graphics/toolbutton.py +++ b/src/sugar3/graphics/toolbutton.py @@ -163,7 +163,6 @@ class ToolButton(Gtk.ToolButton): type=object, setter=set_palette_invoker, getter=get_palette_invoker) def do_draw(self, cr): - child = self.get_child() if self.palette and self.palette.is_up(): allocation = self.get_allocation() # draw a black background, has been done by the engine before diff --git a/tests/test_uitree.py b/tests/test_uitree.py index d640e10d..1104a433 100644 --- a/tests/test_uitree.py +++ b/tests/test_uitree.py @@ -35,7 +35,6 @@ class TestUITree(unittest.TestCase): def show_window1(): from gi.repository import Gtk - from gi.repository import GLib window = Gtk.Window() window.set_title("window1") From 55a072470f68dbd9dc55e22c238eb6d0e1ea18fc Mon Sep 17 00:00:00 2001 From: Daniel Narvaez Date: Sun, 5 May 2013 01:27:31 +0200 Subject: [PATCH 2/3] Silence pyflake --- src/sugar3/dispatch/__init__.py | 1 + src/sugar3/graphics/palette.py | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/sugar3/dispatch/__init__.py b/src/sugar3/dispatch/__init__.py index 4b0f57d4..3a26a6b3 100644 --- a/src/sugar3/dispatch/__init__.py +++ b/src/sugar3/dispatch/__init__.py @@ -7,3 +7,4 @@ Heavily modified for Django's purposes. """ from sugar3.dispatch.dispatcher import Signal +assert Signal diff --git a/src/sugar3/graphics/palette.py b/src/sugar3/graphics/palette.py index c6c00bc3..a8b10f87 100644 --- a/src/sugar3/graphics/palette.py +++ b/src/sugar3/graphics/palette.py @@ -38,7 +38,12 @@ from sugar3.graphics.palettemenu import PaletteMenuItem # Import these for backwards compatibility from sugar3.graphics.palettewindow import MouseSpeedDetector, Invoker, \ WidgetInvoker, CursorInvoker, ToolInvoker, CellRendererInvoker - +assert MouseSpeedDetector +assert Invoker +assert WidgetInvoker +assert CursorInvoker +assert ToolInvoker +assert CellRendererInvoker class _HeaderItem(Gtk.MenuItem): """A MenuItem with a custom child widget that gets all the From fab8f9608856663c386449fcf7cb83277b42d27e Mon Sep 17 00:00:00 2001 From: Daniel Narvaez Date: Sun, 5 May 2013 01:29:52 +0200 Subject: [PATCH 3/3] Run pyflakes on make check --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index 2240471f..fe037da6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,6 +17,7 @@ EXTRA_DIST = \ SUBDIRS = bin src po check: test + pyflakes $(top_srcdir) test: cd $(top_srcdir)/tests && \