diff --git a/pysollib/winsystems/aqua.py b/pysollib/winsystems/aqua.py index 980e7a7a..51437f04 100644 --- a/pysollib/winsystems/aqua.py +++ b/pysollib/winsystems/aqua.py @@ -21,15 +21,13 @@ # # ---------------------------------------------------------------------------## -import sys, os import Tkinter from pysollib.settings import TOOLKIT, USE_TILE +from pysollib.macosx.appSupport import hideTkConsole +from common import base_init_root_window, BaseTkSettings if USE_TILE: 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): @@ -49,10 +47,9 @@ def init_root_window(root, app): ttk.Scrollbar = Tkinter.Scrollbar else: # pure Tk - #root.option_add(...) + # root.option_add(...) pass class TkSettings(BaseTkSettings): pass - diff --git a/pysollib/winsystems/common.py b/pysollib/winsystems/common.py index 4bd48b5e..fadafe08 100644 --- a/pysollib/winsystems/common.py +++ b/pysollib/winsystems/common.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- mode: python; coding: utf-8; -*- -# ---------------------------------------------------------------------------## +# --------------------------------------------------------------------------- # # Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer # Copyright (C) 2003 Mt. Hood Playing Card Co. @@ -19,11 +19,12 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# ---------------------------------------------------------------------------## +# --------------------------------------------------------------------------- -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 VERSION 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')): try: top.tk.eval('package require ttk::theme::'+t) - #print 'load theme:', t + # print 'load theme:', t except: traceback.print_exc() pass @@ -79,13 +80,11 @@ def get_font_name(font): def base_init_root_window(root, app): - #root.wm_group(root) + # root.wm_group(root) root.wm_title(TITLE + ' ' + VERSION) root.wm_iconname(TITLE + ' ' + VERSION) # set minsize - sw, sh, sd = (root.winfo_screenwidth(), - root.winfo_screenheight(), - root.winfo_screendepth()) + sw, sh = (root.winfo_screenwidth(), root.winfo_screenheight()) if sw < 640 or sh < 480: root.wm_minsize(400, 300) else: @@ -116,5 +115,3 @@ class BaseTkSettings: toolbar_separator_relief = 'sunken' toolbar_borderwidth = 1 toolbar_button_borderwidth = 1 - - diff --git a/pysollib/winsystems/win32.py b/pysollib/winsystems/win32.py index 6cd185de..7d28be98 100644 --- a/pysollib/winsystems/win32.py +++ b/pysollib/winsystems/win32.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- mode: python; coding: utf-8; -*- -# ---------------------------------------------------------------------------## +# --------------------------------------------------------------------------- # # Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer # Copyright (C) 2003 Mt. Hood Playing Card Co. @@ -19,16 +19,13 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# ---------------------------------------------------------------------------## - -import sys, os +# --------------------------------------------------------------------------- from pysollib.settings import TOOLKIT, USE_TILE +from common import base_init_root_window, BaseTkSettings if USE_TILE: from pysollib.tile import ttk -from common import base_init_root_window, BaseTkSettings - def 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') if 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.activeForeground', 'white') if theme == 'winnative': style.configure('Toolbutton', padding=2) else: - #root.option_add(...) + # root.option_add(...) pass @@ -58,4 +55,3 @@ class TkSettings(BaseTkSettings): toolbar_borderwidth = 2 if USE_TILE: toolbar_button_padding = (2, 0) - diff --git a/pysollib/winsystems/x11.py b/pysollib/winsystems/x11.py index d00c931e..badae75b 100644 --- a/pysollib/winsystems/x11.py +++ b/pysollib/winsystems/x11.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- mode: python; coding: utf-8; -*- -# ---------------------------------------------------------------------------## +# --------------------------------------------------------------------------- # # Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer # Copyright (C) 2003 Mt. Hood Playing Card Co. @@ -19,20 +19,17 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# ---------------------------------------------------------------------------## +# --------------------------------------------------------------------------- -import sys, os, traceback - -import Tkinter -import tkFont +import os +import traceback from pysollib.settings import TITLE from pysollib.settings import TOOLKIT, USE_TILE +from common import base_init_root_window, BaseTkSettings, get_font_name if USE_TILE: from pysollib.tile import ttk -from common import base_init_root_window, BaseTkSettings, get_font_name - # ************************************************************************ # * Init root window @@ -42,11 +39,11 @@ def init_root_window(root, app): base_init_root_window(root, app) -## if TOOLKIT == 'tk': -## window.wm_iconbitmap("@"+filename) -## window.wm_iconmask("@"+filename) + # if TOOLKIT == 'tk': + # window.wm_iconbitmap("@"+filename) + # window.wm_iconmask("@"+filename) - ##root.self.wm_maxsize(9999, 9999) # unlimited + # root.self.wm_maxsize(9999, 9999) # unlimited if TOOLKIT == 'gtk': pass elif USE_TILE: @@ -93,7 +90,7 @@ def init_root_window(root, app): root.option_add('*Text.foreground', 'black', 60) root.option_add('*selectForeground', 'white', 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']) if color: @@ -110,7 +107,7 @@ def init_root_window(root, app): # use font from xrdb fn = get_font_name(font) if fn: - ##root.option_add('*font', font) + # root.option_add('*font', font) style.configure('.', font=font) app.opt.fonts['default'] = fn # treeview heading @@ -138,16 +135,16 @@ def init_root_window(root, app): root.option_add('*Text.foreground', 'black', 60) root.option_add('*selectForeground', 'white', 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('*borderWidth', '1', 50) - ##root.option_add('*Button.borderWidth', '1', 50) + # root.option_add('*borderWidth', '1', 50) + # root.option_add('*Button.borderWidth', '1', 50) root.option_add('*Scrollbar.elementBorderWidth', 1, 60) root.option_add('*Scrollbar.borderWidth', 1, 60) root.option_add('*Menu.borderWidth', 1, 60) root.option_add('*Menu.activeBorderWidth', 1, 60) - #root.option_add('*Button.HighlightBackground', '#595d59') - #root.option_add('*Button.HighlightThickness', '1') + # root.option_add('*Button.HighlightBackground', '#595d59') + # root.option_add('*Button.HighlightThickness', '1') font = root.option_get('font', TITLE) if font: fn = get_font_name(font) @@ -158,8 +155,5 @@ def init_root_window(root, app): 'roman', 'normal') - class TkSettings(BaseTkSettings): pass - - diff --git a/tests/style/py-flake8.t b/tests/style/py-flake8.t index a4fc6e6d..e6c8c152 100644 --- a/tests/style/py-flake8.t +++ b/tests/style/py-flake8.t @@ -10,7 +10,7 @@ use String::ShellQuote qw/ shell_quote /; # 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 eq_or_diff( scalar(`$cmd`), '', "flake8 is happy with the code." );