pep8 compliance: E251 no spaces around keyword / parameter equals
This commit is contained in:
parent
83e9d0bd68
commit
7cbaf42a6e
@ -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 = []
|
||||
@ -35,7 +35,7 @@ class Dialog(Modal, Widget):
|
||||
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
|
||||
@ -43,7 +43,7 @@ class Dialog(Modal, Widget):
|
||||
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)
|
||||
@ -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]
|
||||
@ -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
|
||||
|
||||
|
@ -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:
|
||||
@ -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:
|
||||
@ -258,7 +258,7 @@ class Field(Control, TextEditor):
|
||||
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:
|
||||
|
@ -42,7 +42,7 @@ class FileListView(PaletteView):
|
||||
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 = []
|
||||
@ -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])
|
||||
@ -119,14 +119,14 @@ class FileDialog(Dialog):
|
||||
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)
|
||||
@ -294,8 +294,8 @@ class LookForFileDialog(FileOpenDialog):
|
||||
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:
|
||||
@ -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:
|
||||
@ -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():
|
||||
@ -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():
|
||||
|
@ -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)
|
||||
@ -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)
|
||||
@ -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):
|
||||
@ -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:
|
||||
|
@ -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)
|
||||
@ -86,7 +86,7 @@ class Menu(Dialog):
|
||||
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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
@ -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)
|
||||
@ -209,7 +209,7 @@ class MusicOptionsDialog(Dialog):
|
||||
[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()
|
||||
|
@ -71,8 +71,8 @@ import numpy
|
||||
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
|
||||
@ -87,7 +87,7 @@ class GLOrtho(GLViewport):
|
||||
|
||||
|
||||
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
|
||||
|
Reference in New Issue
Block a user