mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
flake 8
This commit is contained in:
parent
99ef711af1
commit
d77ef531ad
2 changed files with 61 additions and 60 deletions
|
@ -22,7 +22,8 @@
|
||||||
# ---------------------------------------------------------------------------##
|
# ---------------------------------------------------------------------------##
|
||||||
|
|
||||||
# imports
|
# imports
|
||||||
import sys, os
|
import sys
|
||||||
|
import os
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
# PySol imports
|
# PySol imports
|
||||||
|
@ -34,7 +35,10 @@ import pysollib.settings
|
||||||
# Toolkit imports
|
# Toolkit imports
|
||||||
from pysollib.pysoltk import TOOLBAR_BUTTONS
|
from pysollib.pysoltk import TOOLBAR_BUTTONS
|
||||||
|
|
||||||
from pysollib.mygettext import _, n_
|
from pysollib.mygettext import _
|
||||||
|
|
||||||
|
if sys.version_info > (3,):
|
||||||
|
unicode = str
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
# * Options
|
# * Options
|
||||||
|
@ -240,9 +244,9 @@ class Options:
|
||||||
('tabletile_name', 'str'),
|
('tabletile_name', 'str'),
|
||||||
('translate_game_names', 'bool'),
|
('translate_game_names', 'bool'),
|
||||||
('solver_presets', 'list'),
|
('solver_presets', 'list'),
|
||||||
#('toolbar_vars', 'list'),
|
# ('toolbar_vars', 'list'),
|
||||||
#('recent_gameid', 'list'),
|
# ('recent_gameid', 'list'),
|
||||||
#('favorite_gameid', 'list'),
|
# ('favorite_gameid', 'list'),
|
||||||
]
|
]
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -284,7 +288,7 @@ class Options:
|
||||||
self.tile_theme = 'default'
|
self.tile_theme = 'default'
|
||||||
self.default_tile_theme = 'default'
|
self.default_tile_theme = 'default'
|
||||||
self.toolbar = 1 # 0 == hide, 1,2,3,4 == top, bottom, lef, right
|
self.toolbar = 1 # 0 == hide, 1,2,3,4 == top, bottom, lef, right
|
||||||
##self.toolbar_style = 'default'
|
# self.toolbar_style = 'default'
|
||||||
self.toolbar_style = 'bluecurve'
|
self.toolbar_style = 'bluecurve'
|
||||||
self.toolbar_relief = 'flat'
|
self.toolbar_relief = 'flat'
|
||||||
self.toolbar_compound = 'none' # icons only
|
self.toolbar_compound = 'none' # icons only
|
||||||
|
@ -309,40 +313,40 @@ class Options:
|
||||||
self.sound_music_volume = 100
|
self.sound_music_volume = 100
|
||||||
self.sound_sample_buffer_size = 1 # 1 - 4 (1024 - 4096 bytes)
|
self.sound_sample_buffer_size = 1 # 1 - 4 (1024 - 4096 bytes)
|
||||||
self.sound_samples = {
|
self.sound_samples = {
|
||||||
'areyousure' : True,
|
'areyousure': True,
|
||||||
'autodrop' : True,
|
'autodrop': True,
|
||||||
'autoflip' : True,
|
'autoflip': True,
|
||||||
'autopilotlost' : True,
|
'autopilotlost': True,
|
||||||
'autopilotwon' : True,
|
'autopilotwon': True,
|
||||||
'deal' : True,
|
'deal': True,
|
||||||
'dealwaste' : True,
|
'dealwaste': True,
|
||||||
'droppair' : True,
|
'droppair': True,
|
||||||
'drop' : True,
|
'drop': True,
|
||||||
#'extra' : True,
|
# 'extra': True,
|
||||||
'flip' : True,
|
'flip': True,
|
||||||
'move' : True,
|
'move': True,
|
||||||
'nomove' : True,
|
'nomove': True,
|
||||||
'redo' : True,
|
'redo': True,
|
||||||
'startdrag' : True,
|
'startdrag': True,
|
||||||
'turnwaste' : True,
|
'turnwaste': True,
|
||||||
'undo' : True,
|
'undo': True,
|
||||||
'gamefinished' : False,
|
'gamefinished': False,
|
||||||
'gamelost' : False,
|
'gamelost': False,
|
||||||
'gameperfect' : False,
|
'gameperfect': False,
|
||||||
'gamewon' : False,
|
'gamewon': False,
|
||||||
}
|
}
|
||||||
# fonts
|
# fonts
|
||||||
self.fonts = {
|
self.fonts = {
|
||||||
"default" : None,
|
"default": None,
|
||||||
#"default" : ("helvetica", 12),
|
# "default": ("helvetica", 12),
|
||||||
"sans" : ("times", 12), # for html
|
"sans": ("times", 12), # for html
|
||||||
"fixed" : ("courier", 12), # for html & log
|
"fixed": ("courier", 12), # for html & log
|
||||||
"small" : ("helvetica", 12),
|
"small": ("helvetica", 12),
|
||||||
"canvas_default" : ("helvetica", 12),
|
"canvas_default": ("helvetica", 12),
|
||||||
#"canvas_card" : ("helvetica", 12),
|
# "canvas_card": ("helvetica", 12),
|
||||||
"canvas_fixed" : ("courier", 12),
|
"canvas_fixed": ("courier", 12),
|
||||||
"canvas_large" : ("helvetica", 16),
|
"canvas_large": ("helvetica", 16),
|
||||||
"canvas_small" : ("helvetica", 10),
|
"canvas_small": ("helvetica", 10),
|
||||||
}
|
}
|
||||||
# colors
|
# colors
|
||||||
self.colors = {
|
self.colors = {
|
||||||
|
@ -373,7 +377,8 @@ class Options:
|
||||||
self.game_holded = 0 # gameid or 0
|
self.game_holded = 0 # gameid or 0
|
||||||
self.wm_maximized = 0
|
self.wm_maximized = 0
|
||||||
self.save_games_geometry = False
|
self.save_games_geometry = False
|
||||||
self.games_geometry = {} # saved games geometry (gameid: (width, height))
|
# saved games geometry (gameid: (width, height))
|
||||||
|
self.games_geometry = {}
|
||||||
self.game_geometry = (0, 0) # game geometry before exit
|
self.game_geometry = (0, 0) # game geometry before exit
|
||||||
self.offsets = {} # cards offsets
|
self.offsets = {} # cards offsets
|
||||||
#
|
#
|
||||||
|
@ -409,7 +414,7 @@ class Options:
|
||||||
def setDefaults(self, top=None):
|
def setDefaults(self, top=None):
|
||||||
WIN_SYSTEM = pysollib.settings.WIN_SYSTEM
|
WIN_SYSTEM = pysollib.settings.WIN_SYSTEM
|
||||||
# toolbar
|
# toolbar
|
||||||
#if WIN_SYSTEM == 'win32':
|
# if WIN_SYSTEM == 'win32':
|
||||||
# self.toolbar_style = 'crystal'
|
# self.toolbar_style = 'crystal'
|
||||||
# fonts
|
# fonts
|
||||||
if WIN_SYSTEM == 'win32':
|
if WIN_SYSTEM == 'win32':
|
||||||
|
@ -442,7 +447,7 @@ class Options:
|
||||||
c = "Standard"
|
c = "Standard"
|
||||||
if sw < 800 or sh < 600:
|
if sw < 800 or sh < 600:
|
||||||
c = "2000"
|
c = "2000"
|
||||||
#if sw > 1024 and sh > 768:
|
# if sw > 1024 and sh > 768:
|
||||||
# c = 'Dondorf'
|
# c = 'Dondorf'
|
||||||
self.cardset = {
|
self.cardset = {
|
||||||
# game_type: (cardset_name, back_file)
|
# game_type: (cardset_name, back_file)
|
||||||
|
@ -453,7 +458,7 @@ class Options:
|
||||||
CSI.TYPE_TAROCK: ("Vienna 2K", ""),
|
CSI.TYPE_TAROCK: ("Vienna 2K", ""),
|
||||||
CSI.TYPE_HEXADECK: ("Hex A Deck", ""),
|
CSI.TYPE_HEXADECK: ("Hex A Deck", ""),
|
||||||
CSI.TYPE_MUGHAL_GANJIFA: ("Mughal Ganjifa", ""),
|
CSI.TYPE_MUGHAL_GANJIFA: ("Mughal Ganjifa", ""),
|
||||||
##CSI.TYPE_NAVAGRAHA_GANJIFA: ("Navagraha Ganjifa", ""),
|
# CSI.TYPE_NAVAGRAHA_GANJIFA: ("Navagraha Ganjifa", ""),
|
||||||
CSI.TYPE_NAVAGRAHA_GANJIFA: ("Dashavatara Ganjifa", ""),
|
CSI.TYPE_NAVAGRAHA_GANJIFA: ("Dashavatara Ganjifa", ""),
|
||||||
CSI.TYPE_DASHAVATARA_GANJIFA: ("Dashavatara Ganjifa", ""),
|
CSI.TYPE_DASHAVATARA_GANJIFA: ("Dashavatara Ganjifa", ""),
|
||||||
CSI.TYPE_TRUMP_ONLY: ("Matrix", ""),
|
CSI.TYPE_TRUMP_ONLY: ("Matrix", ""),
|
||||||
|
@ -527,8 +532,7 @@ class Options:
|
||||||
config['offsets'][key] = val
|
config['offsets'][key] = val
|
||||||
|
|
||||||
config.write()
|
config.write()
|
||||||
##config.write(sys.stdout); print
|
# config.write(sys.stdout); print
|
||||||
|
|
||||||
|
|
||||||
def _getOption(self, section, key, t):
|
def _getOption(self, section, key, t):
|
||||||
config = self._config
|
config = self._config
|
||||||
|
@ -591,7 +595,7 @@ class Options:
|
||||||
# validation
|
# validation
|
||||||
vdt = validate.Validator()
|
vdt = validate.Validator()
|
||||||
res = config.validate(vdt)
|
res = config.validate(vdt)
|
||||||
##from pprint import pprint; pprint(res)
|
# from pprint import pprint; pprint(res)
|
||||||
if res is not True:
|
if res is not True:
|
||||||
for section, data in res.items():
|
for section, data in res.items():
|
||||||
if data is True:
|
if data is True:
|
||||||
|
@ -602,7 +606,6 @@ class Options:
|
||||||
'section: "%s", key: "%s"' % (section, key))
|
'section: "%s", key: "%s"' % (section, key))
|
||||||
config[section][key] = None
|
config[section][key] = None
|
||||||
|
|
||||||
|
|
||||||
# general
|
# general
|
||||||
for key, t in self.GENERAL_OPTIONS:
|
for key, t in self.GENERAL_OPTIONS:
|
||||||
val = self._getOption('general', key, t)
|
val = self._getOption('general', key, t)
|
||||||
|
@ -711,5 +714,3 @@ class Options:
|
||||||
self.offsets[key] = val
|
self.offsets[key] = val
|
||||||
except:
|
except:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ use Test::Differences qw( eq_or_diff );
|
||||||
use String::ShellQuote qw/ shell_quote /;
|
use String::ShellQuote qw/ shell_quote /;
|
||||||
|
|
||||||
# my $cmd = shell_quote( 'flake8', '.' );
|
# my $cmd = shell_quote( 'flake8', '.' );
|
||||||
my $cmd = shell_quote( 'flake8', glob('./pysollib/[a-m]*.py') );
|
my $cmd = shell_quote( 'flake8', glob('./pysollib/[a-o]*.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