mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
flake8
This commit is contained in:
parent
9c0e70d7aa
commit
414d78aff7
5 changed files with 33 additions and 49 deletions
|
@ -21,15 +21,13 @@
|
||||||
#
|
#
|
||||||
# ---------------------------------------------------------------------------##
|
# ---------------------------------------------------------------------------##
|
||||||
|
|
||||||
import sys, os
|
|
||||||
import Tkinter
|
import Tkinter
|
||||||
|
|
||||||
from pysollib.settings import TOOLKIT, USE_TILE
|
from pysollib.settings import TOOLKIT, USE_TILE
|
||||||
|
from pysollib.macosx.appSupport import hideTkConsole
|
||||||
|
from common import base_init_root_window, BaseTkSettings
|
||||||
if USE_TILE:
|
if USE_TILE:
|
||||||
from pysollib.tile import ttk
|
from pysollib.tile import ttk
|
||||||
from pysollib.macosx.appSupport import hideTkConsole
|
|
||||||
|
|
||||||
from common import base_init_root_window, BaseTkSettings
|
|
||||||
|
|
||||||
|
|
||||||
def init_root_window(root, app):
|
def init_root_window(root, app):
|
||||||
|
@ -49,10 +47,9 @@ def init_root_window(root, app):
|
||||||
ttk.Scrollbar = Tkinter.Scrollbar
|
ttk.Scrollbar = Tkinter.Scrollbar
|
||||||
|
|
||||||
else: # pure Tk
|
else: # pure Tk
|
||||||
#root.option_add(...)
|
# root.option_add(...)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class TkSettings(BaseTkSettings):
|
class TkSettings(BaseTkSettings):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- mode: python; coding: utf-8; -*-
|
# -*- mode: python; coding: utf-8; -*-
|
||||||
# ---------------------------------------------------------------------------##
|
# ---------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer
|
# Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer
|
||||||
# Copyright (C) 2003 Mt. Hood Playing Card Co.
|
# Copyright (C) 2003 Mt. Hood Playing Card Co.
|
||||||
|
@ -19,11 +19,12 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
# ---------------------------------------------------------------------------##
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
import sys, os, traceback
|
import os
|
||||||
|
import traceback
|
||||||
|
|
||||||
from pysollib.mygettext import _, n_
|
from pysollib.mygettext import _
|
||||||
from pysollib.settings import TITLE
|
from pysollib.settings import TITLE
|
||||||
from pysollib.settings import VERSION
|
from pysollib.settings import VERSION
|
||||||
from pysollib.settings import TOOLKIT, USE_TILE
|
from pysollib.settings import TOOLKIT, USE_TILE
|
||||||
|
@ -42,7 +43,7 @@ def init_tile(app, top):
|
||||||
if os.path.exists(os.path.join(d, t, 'pkgIndex.tcl')):
|
if os.path.exists(os.path.join(d, t, 'pkgIndex.tcl')):
|
||||||
try:
|
try:
|
||||||
top.tk.eval('package require ttk::theme::'+t)
|
top.tk.eval('package require ttk::theme::'+t)
|
||||||
#print 'load theme:', t
|
# print 'load theme:', t
|
||||||
except:
|
except:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
pass
|
pass
|
||||||
|
@ -79,13 +80,11 @@ def get_font_name(font):
|
||||||
|
|
||||||
|
|
||||||
def base_init_root_window(root, app):
|
def base_init_root_window(root, app):
|
||||||
#root.wm_group(root)
|
# root.wm_group(root)
|
||||||
root.wm_title(TITLE + ' ' + VERSION)
|
root.wm_title(TITLE + ' ' + VERSION)
|
||||||
root.wm_iconname(TITLE + ' ' + VERSION)
|
root.wm_iconname(TITLE + ' ' + VERSION)
|
||||||
# set minsize
|
# set minsize
|
||||||
sw, sh, sd = (root.winfo_screenwidth(),
|
sw, sh = (root.winfo_screenwidth(), root.winfo_screenheight())
|
||||||
root.winfo_screenheight(),
|
|
||||||
root.winfo_screendepth())
|
|
||||||
if sw < 640 or sh < 480:
|
if sw < 640 or sh < 480:
|
||||||
root.wm_minsize(400, 300)
|
root.wm_minsize(400, 300)
|
||||||
else:
|
else:
|
||||||
|
@ -116,5 +115,3 @@ class BaseTkSettings:
|
||||||
toolbar_separator_relief = 'sunken'
|
toolbar_separator_relief = 'sunken'
|
||||||
toolbar_borderwidth = 1
|
toolbar_borderwidth = 1
|
||||||
toolbar_button_borderwidth = 1
|
toolbar_button_borderwidth = 1
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- mode: python; coding: utf-8; -*-
|
# -*- mode: python; coding: utf-8; -*-
|
||||||
# ---------------------------------------------------------------------------##
|
# ---------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer
|
# Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer
|
||||||
# Copyright (C) 2003 Mt. Hood Playing Card Co.
|
# Copyright (C) 2003 Mt. Hood Playing Card Co.
|
||||||
|
@ -19,16 +19,13 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
# ---------------------------------------------------------------------------##
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
import sys, os
|
|
||||||
|
|
||||||
from pysollib.settings import TOOLKIT, USE_TILE
|
from pysollib.settings import TOOLKIT, USE_TILE
|
||||||
|
from common import base_init_root_window, BaseTkSettings
|
||||||
if USE_TILE:
|
if USE_TILE:
|
||||||
from pysollib.tile import ttk
|
from pysollib.tile import ttk
|
||||||
|
|
||||||
from common import base_init_root_window, BaseTkSettings
|
|
||||||
|
|
||||||
|
|
||||||
def init_root_window(root, app):
|
def init_root_window(root, app):
|
||||||
base_init_root_window(root, app)
|
base_init_root_window(root, app)
|
||||||
|
@ -41,13 +38,13 @@ def init_root_window(root, app):
|
||||||
color = style.lookup('.', 'background')
|
color = style.lookup('.', 'background')
|
||||||
if color:
|
if color:
|
||||||
root.tk_setPalette(color)
|
root.tk_setPalette(color)
|
||||||
##root.option_add('*Menu.foreground', 'black')
|
# root.option_add('*Menu.foreground', 'black')
|
||||||
root.option_add('*Menu.activeBackground', '#08246b')
|
root.option_add('*Menu.activeBackground', '#08246b')
|
||||||
root.option_add('*Menu.activeForeground', 'white')
|
root.option_add('*Menu.activeForeground', 'white')
|
||||||
if theme == 'winnative':
|
if theme == 'winnative':
|
||||||
style.configure('Toolbutton', padding=2)
|
style.configure('Toolbutton', padding=2)
|
||||||
else:
|
else:
|
||||||
#root.option_add(...)
|
# root.option_add(...)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,4 +55,3 @@ class TkSettings(BaseTkSettings):
|
||||||
toolbar_borderwidth = 2
|
toolbar_borderwidth = 2
|
||||||
if USE_TILE:
|
if USE_TILE:
|
||||||
toolbar_button_padding = (2, 0)
|
toolbar_button_padding = (2, 0)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- mode: python; coding: utf-8; -*-
|
# -*- mode: python; coding: utf-8; -*-
|
||||||
# ---------------------------------------------------------------------------##
|
# ---------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer
|
# Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer
|
||||||
# Copyright (C) 2003 Mt. Hood Playing Card Co.
|
# Copyright (C) 2003 Mt. Hood Playing Card Co.
|
||||||
|
@ -19,20 +19,17 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
# ---------------------------------------------------------------------------##
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
import sys, os, traceback
|
import os
|
||||||
|
import traceback
|
||||||
import Tkinter
|
|
||||||
import tkFont
|
|
||||||
|
|
||||||
from pysollib.settings import TITLE
|
from pysollib.settings import TITLE
|
||||||
from pysollib.settings import TOOLKIT, USE_TILE
|
from pysollib.settings import TOOLKIT, USE_TILE
|
||||||
|
from common import base_init_root_window, BaseTkSettings, get_font_name
|
||||||
if USE_TILE:
|
if USE_TILE:
|
||||||
from pysollib.tile import ttk
|
from pysollib.tile import ttk
|
||||||
|
|
||||||
from common import base_init_root_window, BaseTkSettings, get_font_name
|
|
||||||
|
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
# * Init root window
|
# * Init root window
|
||||||
|
@ -42,11 +39,11 @@ def init_root_window(root, app):
|
||||||
|
|
||||||
base_init_root_window(root, app)
|
base_init_root_window(root, app)
|
||||||
|
|
||||||
## if TOOLKIT == 'tk':
|
# if TOOLKIT == 'tk':
|
||||||
## window.wm_iconbitmap("@"+filename)
|
# window.wm_iconbitmap("@"+filename)
|
||||||
## window.wm_iconmask("@"+filename)
|
# window.wm_iconmask("@"+filename)
|
||||||
|
|
||||||
##root.self.wm_maxsize(9999, 9999) # unlimited
|
# root.self.wm_maxsize(9999, 9999) # unlimited
|
||||||
if TOOLKIT == 'gtk':
|
if TOOLKIT == 'gtk':
|
||||||
pass
|
pass
|
||||||
elif USE_TILE:
|
elif USE_TILE:
|
||||||
|
@ -93,7 +90,7 @@ def init_root_window(root, app):
|
||||||
root.option_add('*Text.foreground', 'black', 60)
|
root.option_add('*Text.foreground', 'black', 60)
|
||||||
root.option_add('*selectForeground', 'white', 60)
|
root.option_add('*selectForeground', 'white', 60)
|
||||||
root.option_add('*selectBackground', '#0a5f89', 60)
|
root.option_add('*selectBackground', '#0a5f89', 60)
|
||||||
root.option_add('*inactiveSelectBackground', '#0a5f89', 60) # Tk-8.5
|
root.option_add('*inactiveSelectBackground', '#0a5f89', 60) # Tk-8.5
|
||||||
|
|
||||||
color = style.lookup('TEntry', 'selectbackground', ['focus'])
|
color = style.lookup('TEntry', 'selectbackground', ['focus'])
|
||||||
if color:
|
if color:
|
||||||
|
@ -110,7 +107,7 @@ def init_root_window(root, app):
|
||||||
# use font from xrdb
|
# use font from xrdb
|
||||||
fn = get_font_name(font)
|
fn = get_font_name(font)
|
||||||
if fn:
|
if fn:
|
||||||
##root.option_add('*font', font)
|
# root.option_add('*font', font)
|
||||||
style.configure('.', font=font)
|
style.configure('.', font=font)
|
||||||
app.opt.fonts['default'] = fn
|
app.opt.fonts['default'] = fn
|
||||||
# treeview heading
|
# treeview heading
|
||||||
|
@ -138,16 +135,16 @@ def init_root_window(root, app):
|
||||||
root.option_add('*Text.foreground', 'black', 60)
|
root.option_add('*Text.foreground', 'black', 60)
|
||||||
root.option_add('*selectForeground', 'white', 60)
|
root.option_add('*selectForeground', 'white', 60)
|
||||||
root.option_add('*selectBackground', '#0a5f89', 60)
|
root.option_add('*selectBackground', '#0a5f89', 60)
|
||||||
root.option_add('*inactiveSelectBackground', '#0a5f89', 60) # Tk-8.5
|
root.option_add('*inactiveSelectBackground', '#0a5f89', 60) # Tk-8.5
|
||||||
root.option_add('*selectBorderWidth', 0, 60)
|
root.option_add('*selectBorderWidth', 0, 60)
|
||||||
##root.option_add('*borderWidth', '1', 50)
|
# root.option_add('*borderWidth', '1', 50)
|
||||||
##root.option_add('*Button.borderWidth', '1', 50)
|
# root.option_add('*Button.borderWidth', '1', 50)
|
||||||
root.option_add('*Scrollbar.elementBorderWidth', 1, 60)
|
root.option_add('*Scrollbar.elementBorderWidth', 1, 60)
|
||||||
root.option_add('*Scrollbar.borderWidth', 1, 60)
|
root.option_add('*Scrollbar.borderWidth', 1, 60)
|
||||||
root.option_add('*Menu.borderWidth', 1, 60)
|
root.option_add('*Menu.borderWidth', 1, 60)
|
||||||
root.option_add('*Menu.activeBorderWidth', 1, 60)
|
root.option_add('*Menu.activeBorderWidth', 1, 60)
|
||||||
#root.option_add('*Button.HighlightBackground', '#595d59')
|
# root.option_add('*Button.HighlightBackground', '#595d59')
|
||||||
#root.option_add('*Button.HighlightThickness', '1')
|
# root.option_add('*Button.HighlightThickness', '1')
|
||||||
font = root.option_get('font', TITLE)
|
font = root.option_get('font', TITLE)
|
||||||
if font:
|
if font:
|
||||||
fn = get_font_name(font)
|
fn = get_font_name(font)
|
||||||
|
@ -158,8 +155,5 @@ def init_root_window(root, app):
|
||||||
'roman', 'normal')
|
'roman', 'normal')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TkSettings(BaseTkSettings):
|
class TkSettings(BaseTkSettings):
|
||||||
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' or $_ eq './pysollib/tile/ttk.py') } glob('./pysollib/*.py ./pysollib/[cmp]*/*.py ./pysollib/tile/*.py') );
|
grep { not($_ eq './pysollib/pysoltk.py' or $_ eq './pysollib/tile/ttk.py') } glob('./pysollib/*.py ./pysollib/[cmpw]*/*.py ./pysollib/tile/*.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