mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
flake8
This commit is contained in:
parent
727c1765ad
commit
8a8314ce86
2 changed files with 11 additions and 40 deletions
|
@ -23,18 +23,15 @@
|
||||||
|
|
||||||
|
|
||||||
# imports
|
# imports
|
||||||
import os, re, sys
|
|
||||||
import gtk
|
import gtk
|
||||||
from gtk import gdk
|
|
||||||
|
|
||||||
# PySol imports
|
# PySol imports
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
# *
|
# *
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
|
||||||
|
|
||||||
class PysolToolbarTk:
|
class PysolToolbarTk:
|
||||||
def __init__(self, top, menubar, dir, size=0, relief=0, compound=None):
|
def __init__(self, top, menubar, dir, size=0, relief=0, compound=None):
|
||||||
self.top = top
|
self.top = top
|
||||||
|
@ -42,30 +39,7 @@ class PysolToolbarTk:
|
||||||
self.dir = dir
|
self.dir = dir
|
||||||
self.side = -1
|
self.side = -1
|
||||||
|
|
||||||
ui_info = '''
|
ui_manager = self.top.ui_manager # created in menubar.py
|
||||||
<ui>
|
|
||||||
<toolbar name='toolbar'>
|
|
||||||
<toolitem action='newgame'/>
|
|
||||||
<toolitem action='restart'/>
|
|
||||||
<separator/>
|
|
||||||
<toolitem action='open'/>
|
|
||||||
<toolitem action='save'/>
|
|
||||||
<separator/>
|
|
||||||
<toolitem action='undo'/>
|
|
||||||
<toolitem action='redo'/>
|
|
||||||
<toolitem action='shuffle'/>
|
|
||||||
<toolitem action='autodrop'/>
|
|
||||||
<toolitem action='pause'/>
|
|
||||||
<separator/>
|
|
||||||
<toolitem action='stats'/>
|
|
||||||
<toolitem action='rules'/>
|
|
||||||
<separator/>
|
|
||||||
<toolitem action='quit'/>
|
|
||||||
</toolbar>
|
|
||||||
</ui>
|
|
||||||
'''
|
|
||||||
ui_manager = self.top.ui_manager # created in menubar.py
|
|
||||||
ui_manager_id = ui_manager.add_ui_from_string(ui_info)
|
|
||||||
|
|
||||||
toolbar = ui_manager.get_widget("/toolbar")
|
toolbar = ui_manager.get_widget("/toolbar")
|
||||||
self.toolbar = toolbar
|
self.toolbar = toolbar
|
||||||
|
@ -74,18 +48,17 @@ class PysolToolbarTk:
|
||||||
|
|
||||||
self._attached = False
|
self._attached = False
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# wrappers
|
# wrappers
|
||||||
#
|
#
|
||||||
|
|
||||||
def _busy(self):
|
def _busy(self):
|
||||||
return not (self.side and self.game and not self.game.busy and self.menubar)
|
return not (self.side and self.game and not self.game.busy
|
||||||
|
and self.menubar)
|
||||||
|
|
||||||
def destroy(self):
|
def destroy(self):
|
||||||
self.toolbar.destroy()
|
self.toolbar.destroy()
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# public methods
|
# public methods
|
||||||
#
|
#
|
||||||
|
@ -122,13 +95,12 @@ class PysolToolbarTk:
|
||||||
x, y = 2, 2
|
x, y = 2, 2
|
||||||
# set orient
|
# set orient
|
||||||
if side in (1, 2):
|
if side in (1, 2):
|
||||||
orient = gtk.ORIENTATION_HORIZONTAL
|
orient = gtk.ORIENTATION_HORIZONTAL
|
||||||
else:
|
else:
|
||||||
orient = gtk.ORIENTATION_VERTICAL
|
orient = gtk.ORIENTATION_VERTICAL
|
||||||
self.toolbar.set_orientation(orient)
|
self.toolbar.set_orientation(orient)
|
||||||
if self._attached:
|
if self._attached:
|
||||||
self.top.table.remove(self.toolbar)
|
self.top.table.remove(self.toolbar)
|
||||||
row_span, column_span = 1, 1
|
|
||||||
self.top.table.attach(self.toolbar,
|
self.top.table.attach(self.toolbar,
|
||||||
x, x+1, y, y+1,
|
x, x+1, y, y+1,
|
||||||
gtk.FILL, gtk.FILL,
|
gtk.FILL, gtk.FILL,
|
||||||
|
@ -137,11 +109,11 @@ class PysolToolbarTk:
|
||||||
self._attached = True
|
self._attached = True
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
||||||
def setCursor(self, cursor):
|
def setCursor(self, cursor):
|
||||||
if self.side:
|
pass
|
||||||
if self.toolbar.window:
|
# if self.side:
|
||||||
self.toolbar.window.set_cursor(gdk.Cursor(v))
|
# if self.toolbar.window:
|
||||||
|
# self.toolbar.window.set_cursor(gdk.Cursor(v))
|
||||||
|
|
||||||
def setRelief(self, relief):
|
def setRelief(self, relief):
|
||||||
# FIXME
|
# FIXME
|
||||||
|
@ -154,4 +126,3 @@ class PysolToolbarTk:
|
||||||
def config(self, w, v):
|
def config(self, w, v):
|
||||||
# FIXME
|
# FIXME
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ use String::ShellQuote qw/ shell_quote /;
|
||||||
|
|
||||||
# my $cmd = shell_quote( 'flake8', '.' );
|
# my $cmd = shell_quote( 'flake8', '.' );
|
||||||
my $cmd = shell_quote( 'flake8',
|
my $cmd = shell_quote( 'flake8',
|
||||||
grep { not($_ eq './pysollib/pysoltk.py') } glob('./pysollib/*.py ./pysollib/[cm]*/*.py ./pysollib/pysolgtk/{[a-s]*,t[a-i]*,tk*}.py') );
|
grep { not($_ eq './pysollib/pysoltk.py') } glob('./pysollib/*.py ./pysollib/[cmp]*/*.py') );
|
||||||
|
|
||||||
# TEST
|
# TEST
|
||||||
eq_or_diff( scalar(`$cmd`), '', "flake8 is happy with the code." );
|
eq_or_diff( scalar(`$cmd`), '', "flake8 is happy with the code." );
|
||||||
|
|
Loading…
Add table
Reference in a new issue