Skip to content

Commit

Permalink
pep8 compliance: E251 no spaces around keyword / parameter equals
Browse files Browse the repository at this point in the history
  • Loading branch information
zothar committed Feb 22, 2012
1 parent 83e9d0b commit 7cbaf42
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 43 deletions.
20 changes: 10 additions & 10 deletions albow/dialogs.py
Expand Up @@ -23,8 +23,8 @@ class Dialog(Modal, Widget):

click_outside_response = None

def __init__(self, client = None, responses = None,
default = 0, cancel = -1, **kwds):
def __init__(self, client=None, responses=None,
default=0, cancel=-1, **kwds):
Widget.__init__(self, **kwds)
if client or responses:
rows = []
Expand All @@ -35,15 +35,15 @@ def __init__(self, client = None, responses = None,
w1 = client.width
if responses:
buttons = Row([
Button(text, action = lambda t=text: self.dismiss(t))
Button(text, action=lambda t=text: self.dismiss(t))
for text in responses])
rows.append(buttons)
w2 = buttons.width
if w1 < w2:
a = 'l'
else:
a = 'r'
contents = Column(rows, align = a)
contents = Column(rows, align=a)
m = self.margin
contents.topleft = (m, m)
self.add(contents)
Expand Down Expand Up @@ -92,19 +92,19 @@ def alert(mess, **kwds):
ask(mess, ["OK"], **kwds)


def ask(mess, responses = ["OK", "Cancel"], default = 0, cancel = -1,
wrap_width = 60, **kwds):
def ask(mess, responses=["OK", "Cancel"], default=0, cancel=-1,
wrap_width=60, **kwds):
box = Dialog(**kwds)
d = box.margin
lb = wrapped_label(mess, wrap_width)
lb.topleft = (d, d)
buts = []
for caption in responses:
but = Button(caption, action = lambda x = caption: box.dismiss(x))
but = Button(caption, action=lambda x=caption: box.dismiss(x))
buts.append(but)
brow = Row(buts, spacing = d)
brow = Row(buts, spacing=d)
lb.width = max(lb.width, brow.width)
col = Column([lb, brow], spacing = d, align ='r')
col = Column([lb, brow], spacing=d, align='r')
col.topleft = (d, d)
if default is not None:
box.enter_response = responses[default]
Expand All @@ -120,7 +120,7 @@ def ask(mess, responses = ["OK", "Cancel"], default = 0, cancel = -1,
return box.present()


def input_text(prompt, width, initial = None, **kwds):
def input_text(prompt, width, initial=None, **kwds):
box = Dialog(**kwds)
d = box.margin

Expand Down
6 changes: 3 additions & 3 deletions albow/fields.py
Expand Up @@ -18,7 +18,7 @@ class TextEditor(Widget):

_text = u""

def __init__(self, width, upper = None, **kwds):
def __init__(self, width, upper=None, **kwds):
Widget.__init__(self, **kwds)
self.set_size_for_text(width)
if upper is not None:
Expand Down Expand Up @@ -193,7 +193,7 @@ class Field(Control, TextEditor):
max = None
enter_passes = False

def __init__(self, width = None, **kwds):
def __init__(self, width=None, **kwds):
min = self.predict_attr(kwds, 'min')
max = self.predict_attr(kwds, 'max')
if 'format' in kwds:
Expand Down Expand Up @@ -258,7 +258,7 @@ def clamp_value(self, value):
if self.min is not None: value = max(value, self.min)
return value

def commit(self, notify = False):
def commit(self, notify=False):
if self.editing:
text = self._text
if text:
Expand Down
28 changes: 14 additions & 14 deletions albow/file_dialogs.py
Expand Up @@ -42,7 +42,7 @@ def __init__(self, width, client, **kwds):
font = self.predict_font(kwds)
h = font.get_linesize()
d = 2 * self.predict(kwds, 'margin')
PaletteView.__init__(self, (width - d, h), 10, 1, scrolling = True, **kwds)
PaletteView.__init__(self, (width - d, h), 10, 1, scrolling=True, **kwds)
self.client = client
self.selection = None
self.names = []
Expand Down Expand Up @@ -98,12 +98,12 @@ class FileDialog(Dialog):
default_prompt = None
up_button_text = ThemeProperty("up_button_text")

def __init__(self, prompt = None, suffixes = None, **kwds):
def __init__(self, prompt=None, suffixes=None, **kwds):
Dialog.__init__(self, **kwds)
label = None
d = self.margin
self.suffixes = suffixes or ("",)
up_button = Button(self.up_button_text, action = self.go_up)
up_button = Button(self.up_button_text, action=self.go_up)
dir_box = DirPathView(self.box_width - up_button.width - 10, self)
self.dir_box = dir_box
top_row = Row([dir_box, up_button])
Expand All @@ -119,14 +119,14 @@ def __init__(self, prompt = None, suffixes = None, **kwds):
filename_box._enter_action = filename_box.enter_action
filename_box.enter_action = self.enter_action
self.filename_box = filename_box
ctrls.append(Column([label, filename_box], align = 'l', spacing = 0))
ctrls.append(Column([label, filename_box], align='l', spacing=0))
else:
if label:
ctrls.insert(0, label)
ok_button = Button(self.ok_label, action = self.ok, enable = self.ok_enable)
ok_button = Button(self.ok_label, action=self.ok, enable=self.ok_enable)
self.ok_button = ok_button
cancel_button = Button("Cancel", action = self.cancel)
vbox = Column(ctrls, align = 'l', spacing = d)
cancel_button = Button("Cancel", action=self.cancel)
vbox = Column(ctrls, align='l', spacing=d)
vbox.topleft = (d, d)
y = vbox.bottom + d
ok_button.topleft = (vbox.left, y)
Expand Down Expand Up @@ -294,8 +294,8 @@ def filter(self, name):
return name and os.path.basename(name) == self.target


def request_new_filename(prompt = None, suffix = None, extra_suffixes = None,
directory = None, filename = None, pathname = None):
def request_new_filename(prompt=None, suffix=None, extra_suffixes=None,
directory=None, filename=None, pathname=None):
if pathname:
directory, filename = os.path.split(pathname)
if extra_suffixes:
Expand All @@ -304,7 +304,7 @@ def request_new_filename(prompt = None, suffix = None, extra_suffixes = None,
suffixes = []
if suffix:
suffixes = [suffix] + suffixes
dlog = FileSaveDialog(prompt = prompt, suffixes = suffixes)
dlog = FileSaveDialog(prompt=prompt, suffixes=suffixes)
if directory:
dlog.directory = directory
if filename:
Expand All @@ -315,8 +315,8 @@ def request_new_filename(prompt = None, suffix = None, extra_suffixes = None,
return None


def request_old_filename(suffixes = None, directory = None):
dlog = FileOpenDialog(suffixes = suffixes)
def request_old_filename(suffixes=None, directory=None):
dlog = FileOpenDialog(suffixes=suffixes)
if directory:
dlog.directory = directory
if dlog.present():
Expand All @@ -325,8 +325,8 @@ def request_old_filename(suffixes = None, directory = None):
return None


def look_for_file_or_directory(target, prompt = None, directory = None):
dlog = LookForFileDialog(target = target, prompt = prompt)
def look_for_file_or_directory(target, prompt=None, directory=None):
dlog = LookForFileDialog(target=target, prompt=prompt)
if directory:
dlog.directory = directory
if dlog.present():
Expand Down
12 changes: 6 additions & 6 deletions albow/layout.py
Expand Up @@ -77,9 +77,9 @@ class Row(RowOrColumn):
'b': (2, 'bottomleft', 'bottomright'),
}

def __init__(self, items, width = None, **kwds):
def __init__(self, items, width=None, **kwds):
"""
Row(items, align = alignment, spacing = 10, width = None, expand = None)
Row(items, align=alignment, spacing=10, width=None, expand=None)
align = 't', 'c' or 'b'
"""
RowOrColumn.__init__(self, width, items, kwds)
Expand All @@ -99,9 +99,9 @@ class Column(RowOrColumn):
'r': (2, 'topright', 'bottomright'),
}

def __init__(self, items, height = None, **kwds):
def __init__(self, items, height=None, **kwds):
"""
Column(items, align = alignment, spacing = 10, height = None, expand = None)
Column(items, align=alignment, spacing=10, height=None, expand=None)
align = 'l', 'c' or 'r'
"""
RowOrColumn.__init__(self, height, items, kwds)
Expand All @@ -113,7 +113,7 @@ class Grid(Widget):

_is_gl_container = True

def __init__(self, rows, row_spacing = 10, column_spacing = 10, **kwds):
def __init__(self, rows, row_spacing=10, column_spacing=10, **kwds):
col_widths = [0] * len(rows[0])
row_heights = [0] * len(rows)
for j, row in enumerate(rows):
Expand Down Expand Up @@ -151,7 +151,7 @@ class Frame(Widget):
border_width = 1
margin = 2

def __init__(self, client, border_spacing = None, **kwds):
def __init__(self, client, border_spacing=None, **kwds):
Widget.__init__(self, **kwds)
self.client = client
if border_spacing is not None:
Expand Down
4 changes: 2 additions & 2 deletions albow/menu.py
Expand Up @@ -27,7 +27,7 @@ class MenuItem(object):
cmd_name = "Ctrl "
option_name = "Alt "

def __init__(self, text = "", command = None):
def __init__(self, text="", command=None):
self.command = command
if "/" in text:
text, key = text.split("/", 1)
Expand Down Expand Up @@ -86,7 +86,7 @@ def present(self, client, pos):
root = get_root()
self.rect.clamp_ip(root.rect)

return Dialog.present(self, centered = False)
return Dialog.present(self, centered=False)

def command_is_enabled(self, item, focus):
cmd = item.command
Expand Down
2 changes: 1 addition & 1 deletion albow/menu_bar.py
Expand Up @@ -10,7 +10,7 @@ class MenuBar(Widget):

menus = overridable_property('menus', "List of Menu instances")

def __init__(self, menus = None, width = 0, **kwds):
def __init__(self, menus=None, width=0, **kwds):
font = self.predict_font(kwds)
height = font.get_linesize()
Widget.__init__(self, Rect(0, 0, width, height), **kwds)
Expand Down
8 changes: 4 additions & 4 deletions albow/music.py
Expand Up @@ -42,7 +42,7 @@ class PlayList(object):
If repeat is true, the list will be repeated indefinitely, otherwise
each item will only be played once."""

def __init__(self, items, random = False, repeat = False):
def __init__(self, items, random=False, repeat=False):
self.items = list(items)
self.random = random
self.repeat = repeat
Expand Down Expand Up @@ -98,13 +98,13 @@ def change_playlist(new_playlist):
current_music = None


def change_music(new_music, repeat = False):
def change_music(new_music, repeat=False):
"""Fade out any currently playing music and start playing the given
music file."""
#print "albow.music: change_music" ###
if music and new_music is not current_music:
if new_music:
new_playlist = PlayList([new_music], repeat = repeat)
new_playlist = PlayList([new_music], repeat=repeat)
else:
new_playlist = None
change_playlist(new_playlist)
Expand Down Expand Up @@ -209,7 +209,7 @@ def __init__(self):
[Label("Music Volume"), mvc],
])
buttons = Button("OK", self.ok)
contents = Column([controls, buttons], align = 'r', spacing = 20)
contents = Column([controls, buttons], align='r', spacing=20)
contents.topleft = (20, 20)
self.add(contents)
self.shrink_wrap()
Expand Down
6 changes: 3 additions & 3 deletions albow/openglwidgets.py
Expand Up @@ -71,8 +71,8 @@ def augment_mouse_event(self, event):
class GLOrtho(GLViewport):

def __init__(self, rect=None,
xmin= -1, xmax=1, ymin= -1, ymax=1,
near= -1, far=1, **kwds):
xmin=-1, xmax=1, ymin=-1, ymax=1,
near=-1, far=1, **kwds):
GLViewport.__init__(self, rect, **kwds)
self.xmin = xmin
self.xmax = xmax
Expand All @@ -87,7 +87,7 @@ def setup_projection(self):


class GLPixelOrtho(GLOrtho):
def __init__(self, rect=None, near= -1, far=1, **kwds):
def __init__(self, rect=None, near=-1, far=1, **kwds):
GLOrtho.__init__(self, rect, near, far, **kwds)
self.xmin = 0
self.ymin = 0
Expand Down

0 comments on commit 7cbaf42

Please sign in to comment.