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
|
||||
import sys, os
|
||||
import sys
|
||||
import os
|
||||
import traceback
|
||||
|
||||
# PySol imports
|
||||
|
@ -34,7 +35,10 @@ import pysollib.settings
|
|||
# Toolkit imports
|
||||
from pysollib.pysoltk import TOOLBAR_BUTTONS
|
||||
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.mygettext import _
|
||||
|
||||
if sys.version_info > (3,):
|
||||
unicode = str
|
||||
|
||||
# ************************************************************************
|
||||
# * Options
|
||||
|
@ -240,9 +244,9 @@ class Options:
|
|||
('tabletile_name', 'str'),
|
||||
('translate_game_names', 'bool'),
|
||||
('solver_presets', 'list'),
|
||||
#('toolbar_vars', 'list'),
|
||||
#('recent_gameid', 'list'),
|
||||
#('favorite_gameid', 'list'),
|
||||
# ('toolbar_vars', 'list'),
|
||||
# ('recent_gameid', 'list'),
|
||||
# ('favorite_gameid', 'list'),
|
||||
]
|
||||
|
||||
def __init__(self):
|
||||
|
@ -284,7 +288,7 @@ class Options:
|
|||
self.tile_theme = 'default'
|
||||
self.default_tile_theme = 'default'
|
||||
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_relief = 'flat'
|
||||
self.toolbar_compound = 'none' # icons only
|
||||
|
@ -309,40 +313,40 @@ class Options:
|
|||
self.sound_music_volume = 100
|
||||
self.sound_sample_buffer_size = 1 # 1 - 4 (1024 - 4096 bytes)
|
||||
self.sound_samples = {
|
||||
'areyousure' : True,
|
||||
'autodrop' : True,
|
||||
'autoflip' : True,
|
||||
'autopilotlost' : True,
|
||||
'autopilotwon' : True,
|
||||
'deal' : True,
|
||||
'dealwaste' : True,
|
||||
'droppair' : True,
|
||||
'drop' : True,
|
||||
#'extra' : True,
|
||||
'flip' : True,
|
||||
'move' : True,
|
||||
'nomove' : True,
|
||||
'redo' : True,
|
||||
'startdrag' : True,
|
||||
'turnwaste' : True,
|
||||
'undo' : True,
|
||||
'gamefinished' : False,
|
||||
'gamelost' : False,
|
||||
'gameperfect' : False,
|
||||
'gamewon' : False,
|
||||
'areyousure': True,
|
||||
'autodrop': True,
|
||||
'autoflip': True,
|
||||
'autopilotlost': True,
|
||||
'autopilotwon': True,
|
||||
'deal': True,
|
||||
'dealwaste': True,
|
||||
'droppair': True,
|
||||
'drop': True,
|
||||
# 'extra': True,
|
||||
'flip': True,
|
||||
'move': True,
|
||||
'nomove': True,
|
||||
'redo': True,
|
||||
'startdrag': True,
|
||||
'turnwaste': True,
|
||||
'undo': True,
|
||||
'gamefinished': False,
|
||||
'gamelost': False,
|
||||
'gameperfect': False,
|
||||
'gamewon': False,
|
||||
}
|
||||
# fonts
|
||||
self.fonts = {
|
||||
"default" : None,
|
||||
#"default" : ("helvetica", 12),
|
||||
"sans" : ("times", 12), # for html
|
||||
"fixed" : ("courier", 12), # for html & log
|
||||
"small" : ("helvetica", 12),
|
||||
"canvas_default" : ("helvetica", 12),
|
||||
#"canvas_card" : ("helvetica", 12),
|
||||
"canvas_fixed" : ("courier", 12),
|
||||
"canvas_large" : ("helvetica", 16),
|
||||
"canvas_small" : ("helvetica", 10),
|
||||
"default": None,
|
||||
# "default": ("helvetica", 12),
|
||||
"sans": ("times", 12), # for html
|
||||
"fixed": ("courier", 12), # for html & log
|
||||
"small": ("helvetica", 12),
|
||||
"canvas_default": ("helvetica", 12),
|
||||
# "canvas_card": ("helvetica", 12),
|
||||
"canvas_fixed": ("courier", 12),
|
||||
"canvas_large": ("helvetica", 16),
|
||||
"canvas_small": ("helvetica", 10),
|
||||
}
|
||||
# colors
|
||||
self.colors = {
|
||||
|
@ -373,7 +377,8 @@ class Options:
|
|||
self.game_holded = 0 # gameid or 0
|
||||
self.wm_maximized = 0
|
||||
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.offsets = {} # cards offsets
|
||||
#
|
||||
|
@ -409,7 +414,7 @@ class Options:
|
|||
def setDefaults(self, top=None):
|
||||
WIN_SYSTEM = pysollib.settings.WIN_SYSTEM
|
||||
# toolbar
|
||||
#if WIN_SYSTEM == 'win32':
|
||||
# if WIN_SYSTEM == 'win32':
|
||||
# self.toolbar_style = 'crystal'
|
||||
# fonts
|
||||
if WIN_SYSTEM == 'win32':
|
||||
|
@ -442,7 +447,7 @@ class Options:
|
|||
c = "Standard"
|
||||
if sw < 800 or sh < 600:
|
||||
c = "2000"
|
||||
#if sw > 1024 and sh > 768:
|
||||
# if sw > 1024 and sh > 768:
|
||||
# c = 'Dondorf'
|
||||
self.cardset = {
|
||||
# game_type: (cardset_name, back_file)
|
||||
|
@ -453,7 +458,7 @@ class Options:
|
|||
CSI.TYPE_TAROCK: ("Vienna 2K", ""),
|
||||
CSI.TYPE_HEXADECK: ("Hex A Deck", ""),
|
||||
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_DASHAVATARA_GANJIFA: ("Dashavatara Ganjifa", ""),
|
||||
CSI.TYPE_TRUMP_ONLY: ("Matrix", ""),
|
||||
|
@ -527,8 +532,7 @@ class Options:
|
|||
config['offsets'][key] = val
|
||||
|
||||
config.write()
|
||||
##config.write(sys.stdout); print
|
||||
|
||||
# config.write(sys.stdout); print
|
||||
|
||||
def _getOption(self, section, key, t):
|
||||
config = self._config
|
||||
|
@ -591,7 +595,7 @@ class Options:
|
|||
# validation
|
||||
vdt = validate.Validator()
|
||||
res = config.validate(vdt)
|
||||
##from pprint import pprint; pprint(res)
|
||||
# from pprint import pprint; pprint(res)
|
||||
if res is not True:
|
||||
for section, data in res.items():
|
||||
if data is True:
|
||||
|
@ -602,7 +606,6 @@ class Options:
|
|||
'section: "%s", key: "%s"' % (section, key))
|
||||
config[section][key] = None
|
||||
|
||||
|
||||
# general
|
||||
for key, t in self.GENERAL_OPTIONS:
|
||||
val = self._getOption('general', key, t)
|
||||
|
@ -711,5 +714,3 @@ class Options:
|
|||
self.offsets[key] = val
|
||||
except:
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ use Test::Differences qw( eq_or_diff );
|
|||
use String::ShellQuote qw/ shell_quote /;
|
||||
|
||||
# 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
|
||||
eq_or_diff( scalar(`$cmd`), '', "flake8 is happy with the code." );
|
||||
|
|
Loading…
Add table
Reference in a new issue