diff --git a/pysollib/tk/playeroptionsdialog.py b/pysollib/tk/playeroptionsdialog.py index 57758e32..fe480923 100644 --- a/pysollib/tk/playeroptionsdialog.py +++ b/pysollib/tk/playeroptionsdialog.py @@ -27,7 +27,7 @@ __all__ = ['PlayerOptionsDialog'] import Tkinter # PySol imports -from pysollib.mygettext import _, n_ +from pysollib.mygettext import _ from pysollib.mfxutil import KwStruct, Struct # Toolkit imports @@ -62,7 +62,7 @@ class SelectUserNameDialog(MfxDialog): focus = self.createButtons(bottom_frame, kw) self.mainloop(focus, kw.timeout) - #if listbox.curselection(): + # if listbox.curselection(): # self.username = listbox.get(listbox.curselection()) def updateUserName(self, *args): @@ -79,7 +79,6 @@ class SelectUserNameDialog(MfxDialog): return MfxDialog.initKw(self, kw) - class PlayerOptionsDialog(MfxDialog): def __init__(self, parent, title, app, **kw): kw = self.initKw(kw) @@ -98,7 +97,7 @@ class PlayerOptionsDialog(MfxDialog): frame = Tkinter.Frame(top_frame) frame.pack(expand=True, fill='both', padx=5, pady=10) widget = Tkinter.Label(frame, text=_("\nPlease enter your name"), - #justify='left', anchor='w', + # justify='left', anchor='w', takefocus=0) widget.grid(row=0, column=0, columnspan=2, sticky='ew', padx=0, pady=5) w = kw.get("e_width", 30) # width in characters @@ -115,9 +114,9 @@ class PlayerOptionsDialog(MfxDialog): anchor='w', text=_("Update statistics and logs")) widget.grid(row=3, column=0, columnspan=2, sticky='ew', padx=0, pady=5) -### widget = Tkinter.Checkbutton(frame, variable=self.win_animation_var, -### text="Win animation") -### widget.pack(side='top', padx=kw.padx, pady=kw.pady) + # widget = Tkinter.Checkbutton(frame, variable=self.win_animation_var, + # text="Win animation") + # widget.pack(side='top', padx=kw.padx, pady=kw.pady) frame.columnconfigure(0, weight=1) # self.player = self.player_var.get() @@ -164,10 +163,10 @@ def playeroptionsdialog_main(args): wm_withdraw(tk) tk.update() d = PlayerOptionsDialog(tk, "Player options", app) - print d.status, d.button, ":", d.player, d.update_stats + print(d.status, d.button, ":", d.player, d.update_stats) return 0 + if __name__ == "__main__": import sys sys.exit(playeroptionsdialog_main(sys.argv)) - diff --git a/pysollib/tk/progressbar.py b/pysollib/tk/progressbar.py index 95881703..008fd165 100644 --- a/pysollib/tk/progressbar.py +++ b/pysollib/tk/progressbar.py @@ -47,7 +47,7 @@ class PysolProgressBar: self.frame = Tkinter.Frame(self.top, relief='flat', bd=0, takefocus=0) self.cframe = Tkinter.Frame(self.frame, relief='sunken', bd=1, - takefocus=0) + takefocus=0) self.canvas = Tkinter.Canvas(self.cframe, width=width, height=height, takefocus=0, bd=0, highlightthickness=0) self.scale = self.canvas.create_rectangle(-10, -10, 0, height, @@ -58,10 +58,12 @@ class PysolProgressBar: self.cframe.grid_configure(column=0, row=0, sticky="ew") if images: self.f1 = Tkinter.Label(self.frame, image=images[0]) - self.f1.grid_configure(column=0, row=0, sticky="ew", ipadx=8, ipady=4) + self.f1.grid_configure( + column=0, row=0, sticky="ew", ipadx=8, ipady=4) self.cframe.grid_configure(column=1, row=0, sticky="ew", padx=8) self.f2 = Tkinter.Label(self.frame, image=images[1]) - self.f2.grid_configure(column=2, row=0, sticky="ew", ipadx=8, ipady=4) + self.f2.grid_configure( + column=2, row=0, sticky="ew", ipadx=8, ipady=4) self.top.config(cursor="watch") self.pack() if 1: @@ -91,8 +93,8 @@ class PysolProgressBar: def update(self, percent=None, step=1): self.steps_sum += step - ##print self.steps_sum - step = step/self.norm + # print self.steps_sum + step /= self.norm if self.top is None: # already destroyed return if percent is None: @@ -105,7 +107,7 @@ class PysolProgressBar: c = self.canvas width, height = c.winfo_reqwidth(), c.winfo_reqheight() c.coords(self.scale, -10, -10, - (self.percent * width ) / 100.0, height) + (self.percent * width) / 100.0, height) if self.text >= 0: c.coords(self.text, width/2, height/2) c.itemconfig(self.text, text="%d %%" % int(round(self.percent))) @@ -120,7 +122,8 @@ class PysolProgressBar: class TestProgressBar: def __init__(self, parent): self.parent = parent - self.progress = PysolProgressBar(None, parent, title="Progress", color="#008200") + self.progress = PysolProgressBar( + None, parent, title="Progress", color="#008200") self.progress.pack(ipadx=10, ipady=10) self.progress.frame.after(1000, self.update) @@ -131,16 +134,16 @@ class TestProgressBar: self.progress.update(step=1) self.progress.frame.after(30, self.update) + def progressbar_main(args): from pysollib.ui.tktile.tkutil import wm_withdraw tk = Tkinter.Tk() wm_withdraw(tk) - pb = TestProgressBar(tk) + TestProgressBar(tk) tk.mainloop() return 0 + if __name__ == "__main__": import sys sys.exit(progressbar_main(sys.argv)) - - diff --git a/tests/style/py-flake8.t b/tests/style/py-flake8.t index e3789e6f..77f0739a 100644 --- a/tests/style/py-flake8.t +++ b/tests/style/py-flake8.t @@ -27,7 +27,7 @@ my %skip = # my $cmd = shell_quote( 'flake8', '.' ); my $cmd = shell_quote( 'flake8', - grep { not exists $skip{$_} } glob('./*.py ./scripts/*.py ./tests/board_gen/*.py ./pysollib/*.py ./pysollib/[cmgpuw]*/{*/*.py,*.py} ./pysollib/tile/*.py ./pysollib/tk/[a-m]*.py ./pysollib/ui/tktile/*.py') ); + grep { not exists $skip{$_} } glob('./*.py ./scripts/*.py ./tests/board_gen/*.py ./pysollib/*.py ./pysollib/[cmgpuw]*/{*/*.py,*.py} ./pysollib/tile/*.py ./pysollib/tk/[a-p]*.py ./pysollib/ui/tktile/*.py') ); # TEST eq_or_diff( scalar(`$cmd`), '', "flake8 is happy with the code." );