Commit 21aeb191 authored by Johan Dahlin's avatar Johan Dahlin Committed by Johan Dahlin
Browse files

PEP8: Remove whitespace before (

https://bugzilla.gnome.org/show_bug.cgi?id=672627
parent b04d2099
......@@ -44,7 +44,7 @@ class EntryBufferApp:
label = Gtk.Label()
label.set_markup('Entries share a buffer. Typing in one is reflected in the other.')
vbox.pack_start (label, False, False, 0)
vbox.pack_start(label, False, False, 0)
# create a buffer
buffer = Gtk.EntryBuffer()
......
......@@ -45,7 +45,7 @@ class EntryBufferApp:
label = Gtk.Label()
label.set_markup('Completion demo, try writing <b>total</b> or <b>gnome</b> for example.')
vbox.pack_start (label, False, False, 0)
vbox.pack_start(label, False, False, 0)
#create our entry
entry = Gtk.Entry()
......
......@@ -114,7 +114,7 @@ class SearchboxApp:
entry.progress_pulse()
return True
def search_progress_done (self, entry):
def search_progress_done(self, entry):
entry.set_progress_fraction(0.0)
def finish_search(self, button, entry):
......@@ -151,7 +151,7 @@ class SearchboxApp:
def clear_entry(self, entry):
entry.set_text('')
def search_by_name (self, item, entry):
def search_by_name(self, item, entry):
entry.set_icon_from_stock(Gtk.EntryIconPosition.PRIMARY,
Gtk.STOCK_FIND)
entry.set_icon_tooltip_text(Gtk.EntryIconPosition.PRIMARY,
......@@ -159,8 +159,8 @@ class SearchboxApp:
'Click here to change the search type')
def search_by_description(self, item, entry):
entry.set_icon_from_stock (Gtk.EntryIconPosition.PRIMARY,
Gtk.STOCK_EDIT)
entry.set_icon_from_stock(Gtk.EntryIconPosition.PRIMARY,
Gtk.STOCK_EDIT)
entry.set_icon_tooltip_text(Gtk.EntryIconPosition.PRIMARY,
'Search by description\n' + \
'Click here to change the search type')
......@@ -212,7 +212,7 @@ class SearchboxApp:
entry.set_icon_sensitive(Gtk.EntryIconPosition.SECONDARY, has_text)
button.set_sensitive(has_text)
def activate_cb (self, entry, button):
def activate_cb(self, entry, button):
if self.search_progress_id != 0:
return
self.start_search(button, entry)
......@@ -242,7 +242,7 @@ class SearchboxApp:
item = Gtk.MenuItem.new_with_label('Search by')
item.show()
item.set_submenu(search_menu)
menu.append (item)
menu.append(item)
def main(demoapp=None):
......
......@@ -65,7 +65,7 @@ class IconviewEditApp:
self.window.show_all()
def set_cell_color (self, cell_layout, cell, tree_model, iter_, icon_view):
def set_cell_color(self, cell_layout, cell, tree_model, iter_, icon_view):
# FIXME return single element instead of tuple
text = tree_model.get(iter_, self.COL_TEXT)[0]
......@@ -82,7 +82,7 @@ class IconviewEditApp:
cell.props.pixbuf = pixbuf
def edited (self, cell, path_string, text, icon_view):
def edited(self, cell, path_string, text, icon_view):
model = icon_view.get_model()
path = Gtk.TreePath(path_string)
......
......@@ -91,7 +91,7 @@ class ListStoreApp:
self.window.show_all()
self.window.connect('delete-event', self.window_closed)
self.timeout = GObject.timeout_add (80, self.spinner_timeout)
self.timeout = GObject.timeout_add(80, self.spinner_timeout)
def window_closed(self, window, event):
if self.timeout != 0:
......
......@@ -71,11 +71,11 @@ class DialogsApp:
hbox.pack_start(table, False, False, 0)
label = Gtk.Label.new_with_mnemonic("_Entry 1")
table.attach_defaults (label, 0, 1, 0, 1)
table.attach_defaults(label, 0, 1, 0, 1)
self.entry1 = Gtk.Entry()
table.attach_defaults(self.entry1, 1, 2, 0, 1)
label.set_mnemonic_widget (self.entry1)
label.set_mnemonic_widget(self.entry1)
label = Gtk.Label.new_with_mnemonic("E_ntry 2")
......@@ -95,7 +95,7 @@ class DialogsApp:
(Gtk.STOCK_OK, Gtk.ResponseType.OK,
"_Non-stock Button", Gtk.ResponseType.CANCEL))
content_area = dialog.get_content_area ()
content_area = dialog.get_content_area()
hbox = Gtk.HBox(spacing=8)
hbox.set_border_width(8)
content_area.pack_start(hbox, False, False, 0)
......@@ -117,10 +117,10 @@ class DialogsApp:
label.set_mnemonic_widget(local_entry1)
label = Gtk.Label.new_with_mnemonic("E_ntry 2")
table.attach_defaults (label, 0, 1, 1, 2)
table.attach_defaults(label, 0, 1, 1, 2)
local_entry2 = Gtk.Entry()
local_entry2.set_text (self.entry2.get_text())
local_entry2.set_text(self.entry2.get_text())
table.attach_defaults(local_entry2, 1, 2, 1, 2)
label.set_mnemonic_widget(local_entry2)
......@@ -140,7 +140,7 @@ class DialogsApp:
Gtk.MessageType.INFO,
Gtk.ButtonsType.OK,
"This message box has been popped up the following\nnumber of times:")
dialog.format_secondary_text ('%d' % self.dialog_counter)
dialog.format_secondary_text('%d' % self.dialog_counter)
dialog.run()
self.dialog_counter += 1
......
......@@ -43,27 +43,27 @@ class PickersApp:
label.set_alignment(0.0, 0.5)
picker = Gtk.ColorButton()
table.attach_defaults(label, 0, 1, 0, 1)
table.attach_defaults (picker, 1, 2, 0, 1)
table.attach_defaults(picker, 1, 2, 0, 1)
label = Gtk.Label('Font:')
label.set_alignment(0.0, 0.5)
picker = Gtk.FontButton()
table.attach_defaults(label, 0, 1, 1, 2)
table.attach_defaults (picker, 1, 2, 1, 2)
table.attach_defaults(picker, 1, 2, 1, 2)
label = Gtk.Label('File:')
label.set_alignment(0.0, 0.5)
picker = Gtk.FileChooserButton.new('Pick a File',
Gtk.FileChooserAction.OPEN)
table.attach_defaults(label, 0, 1, 2, 3)
table.attach_defaults (picker, 1, 2, 2, 3)
table.attach_defaults(picker, 1, 2, 2, 3)
label = Gtk.Label('Folder:')
label.set_alignment(0.0, 0.5)
picker = Gtk.FileChooserButton.new('Pick a Folder',
Gtk.FileChooserAction.SELECT_FOLDER)
table.attach_defaults(label, 0, 1, 3, 4)
table.attach_defaults (picker, 1, 2, 3, 4)
table.attach_defaults(picker, 1, 2, 3, 4)
self.window.show_all()
......
......@@ -127,8 +127,8 @@ class PixbufApp:
r = radius + (radius / 3.0) * math.sin(f * 2.0 * math.pi)
xpos = math.floor (xmid + r * math.cos(ang) - iw / 2.0 + 0.5)
ypos = math.floor (ymid + r * math.sin(ang) - ih / 2.0 + 0.5)
xpos = math.floor(xmid + r * math.cos(ang) - iw / 2.0 + 0.5)
ypos = math.floor(ymid + r * math.sin(ang) - ih / 2.0 + 0.5)
if i & 1:
k = math.sin(f * 2.0 * math.pi)
......
......@@ -131,8 +131,8 @@ class PrintingApp:
layout.set_ellipsize(Pango.EllipsizeMode.START)
(text_width, text_height) = layout.get_pixel_size()
cr.move_to ((width - text_width) / 2,
(self.HEADER_HEIGHT - text_height) / 2)
cr.move_to((width - text_width) / 2,
(self.HEADER_HEIGHT - text_height) / 2)
PangoCairo.show_layout(cr, layout)
page_str = "%d/%d" % (page_num + 1, print_data['num_pages'])
......@@ -150,7 +150,7 @@ class PrintingApp:
desc.set_size(print_data['font_size'] * Pango.SCALE)
layout.set_font_description(desc)
cr.move_to (0, self.HEADER_HEIGHT + self.HEADER_GAP)
cr.move_to(0, self.HEADER_HEIGHT + self.HEADER_GAP)
lines_pp = int(print_data['lines_per_page'])
num_lines = print_data['num_lines']
data_lines = print_data['lines']
......@@ -163,7 +163,7 @@ class PrintingApp:
layout.set_text(data_lines[line], -1)
PangoCairo.show_layout(cr, layout)
cr.rel_move_to (0, font_size)
cr.rel_move_to(0, font_size)
line += 1
def end_print(self, operation, print_ctx, print_data):
......
......@@ -139,7 +139,7 @@ class RotatedTextApp:
'''
return attrs
def rotated_text_draw (self, da, cairo_ctx):
def rotated_text_draw(self, da, cairo_ctx):
# Create a cairo context and set up a transformation matrix so that the user
# space coordinates for the centered square where we draw are [-RADIUS, RADIUS],
# [-RADIUS, RADIUS].
......
......@@ -136,7 +136,7 @@ class GtkDemoWindow(Gtk.Window):
super(GtkDemoWindow, self).__init__(type=Gtk.WindowType.TOPLEVEL)
self.set_title('PyGI GTK+ Code Demos')
self.set_default_size (600, 400)
self.set_default_size(600, 400)
self.setup_default_icon()
hbox = Gtk.HBox(homogeneous=False, spacing=0)
......@@ -198,7 +198,7 @@ class GtkDemoWindow(Gtk.Window):
raise IOError('Cannot find demo data file "%s"' % base)
def setup_default_icon(self):
filename = self.find_file ('gtk-logo-rgb.gif')
filename = self.find_file('gtk-logo-rgb.gif')
pixbuf = GdkPixbuf.Pixbuf.new_from_file(filename)
transparent = pixbuf.add_alpha(True, 0xff, 0xff, 0xff)
list = []
......
......@@ -197,7 +197,7 @@ class IntrospectionModule(object):
path = repository.get_typelib_path(self._namespace)
return "<IntrospectionModule %r from %r>" % (self._namespace, path)
def __dir__ (self):
def __dir__(self):
# Python's default dir() is just dir(self.__class__) + self.__dict__.keys()
result = set(dir(self.__class__))
result.update(self.__dict__.keys())
......@@ -243,7 +243,7 @@ class DynamicModule(object):
return getattr(self._introspection_module, name)
def __dir__ (self):
def __dir__(self):
# Python's default dir() is just dir(self.__class__) + self.__dict__.keys()
result = set(dir(self.__class__))
result.update(self.__dict__.keys())
......
......@@ -39,7 +39,7 @@ class FontDescription(Pango.FontDescription):
def __new__(cls, string=None):
if string is not None:
return Pango.font_description_from_string (string)
return Pango.font_description_from_string(string)
else:
return Pango.FontDescription.__new__(cls)
......
......@@ -271,10 +271,10 @@ def enable_gtk(version='2.0'):
def __init__(self, **kwds):
Gtk.ComboBox.__init__(self, has_entry=True, **kwds)
def set_text_column (self, text_column):
def set_text_column(self, text_column):
self.set_entry_text_column(text_column)
def get_text_column (self):
def get_text_column(self):
return self.get_entry_text_column()
Gtk.ComboBoxEntry = ComboBoxEntry
......
......@@ -161,12 +161,12 @@ class TestEverything(unittest.TestCase):
def test_ptrarray(self):
# transfer container
result = Everything.test_garray_container_return()
self.assertEquals (result, ['regress'])
self.assertEquals(result, ['regress'])
result = None
# transfer full
result = Everything.test_garray_full_return()
self.assertEquals (result, ['regress'])
self.assertEquals(result, ['regress'])
result = None
def test_struct_gpointer(self):
......
......@@ -601,7 +601,7 @@ class TestGtk(unittest.TestCase):
self.assertEquals(Gtk.ActionGroup, overrides.Gtk.ActionGroup)
self.assertRaises(TypeError, Gtk.ActionGroup)
action_group = Gtk.ActionGroup (name='TestActionGroup')
action_group = Gtk.ActionGroup(name='TestActionGroup')
callback_data = "callback data"
def test_action_callback_data(action, user_data):
......@@ -610,7 +610,7 @@ class TestGtk(unittest.TestCase):
def test_radio_action_callback_data(action, current, user_data):
self.assertEquals(user_data, callback_data)
action_group.add_actions ([
action_group.add_actions([
('test-action1', None, 'Test Action 1',
None, None, test_action_callback_data),
('test-action2', Gtk.STOCK_COPY, 'Test Action 2',
......@@ -652,9 +652,9 @@ class TestGtk(unittest.TestCase):
menubar = ui.get_widget("/menubar1")
self.assertEquals(type(menubar), Gtk.MenuBar)
ag = Gtk.ActionGroup (name="ag1")
ag = Gtk.ActionGroup(name="ag1")
ui.insert_action_group(ag)
ag2 = Gtk.ActionGroup (name="ag2")
ag2 = Gtk.ActionGroup(name="ag2")
ui.insert_action_group(ag2)
groups = ui.get_action_groups()
self.assertEquals(ag, groups[-2])
......@@ -741,21 +741,21 @@ class TestGtk(unittest.TestCase):
self.assertEquals(Gtk.RecentChooserDialog, overrides.Gtk.RecentChooserDialog)
# Gtk.Dialog
dialog = Gtk.Dialog (title='Foo',
flags=Gtk.DialogFlags.MODAL,
buttons=('test-button1', 1))
dialog = Gtk.Dialog(title='Foo',
flags=Gtk.DialogFlags.MODAL,
buttons=('test-button1', 1))
self.assertTrue(isinstance(dialog, Gtk.Dialog))
self.assertTrue(isinstance(dialog, Gtk.Window))
dialog.add_buttons ('test-button2', 2, Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)
dialog.add_buttons('test-button2', 2, Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)
self.assertEquals('Foo', dialog.get_title())
self.assertTrue(dialog.get_modal())
button = dialog.get_widget_for_response (1)
button = dialog.get_widget_for_response(1)
self.assertEquals('test-button1', button.get_label())
button = dialog.get_widget_for_response (2)
button = dialog.get_widget_for_response(2)
self.assertEquals('test-button2', button.get_label())
button = dialog.get_widget_for_response (Gtk.ResponseType.CLOSE)
button = dialog.get_widget_for_response(Gtk.ResponseType.CLOSE)
self.assertEquals(Gtk.STOCK_CLOSE, button.get_label())
# Gtk.AboutDialog
......@@ -764,10 +764,10 @@ class TestGtk(unittest.TestCase):
self.assertTrue(isinstance(dialog, Gtk.Window))
# Gtk.MessageDialog
dialog = Gtk.MessageDialog (title='message dialog test',
flags=Gtk.DialogFlags.MODAL,
buttons=Gtk.ButtonsType.OK,
message_format='dude!')
dialog = Gtk.MessageDialog(title='message dialog test',
flags=Gtk.DialogFlags.MODAL,
buttons=Gtk.ButtonsType.OK,
message_format='dude!')
self.assertTrue(isinstance(dialog, Gtk.Dialog))
self.assertTrue(isinstance(dialog, Gtk.Window))
......@@ -791,19 +791,19 @@ class TestGtk(unittest.TestCase):
self.assertEquals('color selection dialog test', dialog.get_title())
# Gtk.FileChooserDialog
dialog = Gtk.FileChooserDialog (title='file chooser dialog test',
buttons=('test-button1', 1),
action=Gtk.FileChooserAction.SAVE)
dialog = Gtk.FileChooserDialog(title='file chooser dialog test',
buttons=('test-button1', 1),
action=Gtk.FileChooserAction.SAVE)
self.assertTrue(isinstance(dialog, Gtk.Dialog))
self.assertTrue(isinstance(dialog, Gtk.Window))
dialog.add_buttons ('test-button2', 2, Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)
dialog.add_buttons('test-button2', 2, Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)
self.assertEquals('file chooser dialog test', dialog.get_title())
button = dialog.get_widget_for_response (1)
button = dialog.get_widget_for_response(1)
self.assertEquals('test-button1', button.get_label())
button = dialog.get_widget_for_response (2)
button = dialog.get_widget_for_response(2)
self.assertEquals('test-button2', button.get_label())
button = dialog.get_widget_for_response (Gtk.ResponseType.CLOSE)
button = dialog.get_widget_for_response(Gtk.ResponseType.CLOSE)
self.assertEquals(Gtk.STOCK_CLOSE, button.get_label())
action = dialog.get_property('action')
self.assertEquals(Gtk.FileChooserAction.SAVE, action)
......@@ -817,19 +817,19 @@ class TestGtk(unittest.TestCase):
# Gtk.RecentChooserDialog
test_manager = Gtk.RecentManager()
dialog = Gtk.RecentChooserDialog (title='recent chooser dialog test',
buttons=('test-button1', 1),
manager=test_manager)
dialog = Gtk.RecentChooserDialog(title='recent chooser dialog test',
buttons=('test-button1', 1),
manager=test_manager)
self.assertTrue(isinstance(dialog, Gtk.Dialog))
self.assertTrue(isinstance(dialog, Gtk.Window))
dialog.add_buttons ('test-button2', 2, Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)
dialog.add_buttons('test-button2', 2, Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)
self.assertEquals('recent chooser dialog test', dialog.get_title())
button = dialog.get_widget_for_response (1)
button = dialog.get_widget_for_response(1)
self.assertEquals('test-button1', button.get_label())
button = dialog.get_widget_for_response (2)
button = dialog.get_widget_for_response(2)
self.assertEquals('test-button2', button.get_label())
button = dialog.get_widget_for_response (Gtk.ResponseType.CLOSE)
button = dialog.get_widget_for_response(Gtk.ResponseType.CLOSE)
self.assertEquals(Gtk.STOCK_CLOSE, button.get_label())
class TestClass(GObject.GObject):
......@@ -1566,7 +1566,7 @@ class TestGtk(unittest.TestCase):
def test_text_buffer(self):
self.assertEquals(Gtk.TextBuffer, overrides.Gtk.TextBuffer)
buffer = Gtk.TextBuffer()
tag = buffer.create_tag ('title', font='Sans 18')
tag = buffer.create_tag('title', font='Sans 18')
self.assertEquals(tag.props.name, 'title')
self.assertEquals(tag.props.font, 'Sans 18')
......@@ -1624,7 +1624,7 @@ class TestGtk(unittest.TestCase):
self.assertEquals(Gtk.TextIter, overrides.Gtk.TextIter)
buffer = Gtk.TextBuffer()
buffer.set_text('Hello Jane Hello Bob')
tag = buffer.create_tag ('title', font='Sans 18')
tag = buffer.create_tag('title', font='Sans 18')
(start, end) = buffer.get_bounds()
start.forward_chars(10)
buffer.apply_tag(tag, start, end)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment