mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
2to3 on pysollib/tk/[a-s]*.py
This commit is contained in:
parent
8f22447dd7
commit
f768b571ad
7 changed files with 42 additions and 36 deletions
|
@ -31,7 +31,7 @@ from pysollib.mygettext import _
|
||||||
from pysollib.mfxutil import KwStruct, Struct
|
from pysollib.mfxutil import KwStruct, Struct
|
||||||
|
|
||||||
# Toolkit imports
|
# Toolkit imports
|
||||||
from tkwidget import MfxDialog
|
from .tkwidget import MfxDialog
|
||||||
from pysollib.ui.tktile.tkutil import bind
|
from pysollib.ui.tktile.tkutil import bind
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,10 +35,10 @@ from pysollib.resource import CSI
|
||||||
|
|
||||||
# Toolkit imports
|
# Toolkit imports
|
||||||
from pysollib.ui.tktile.tkutil import loadImage
|
from pysollib.ui.tktile.tkutil import loadImage
|
||||||
from tkwidget import MfxDialog, MfxScrolledCanvas
|
from .tkwidget import MfxDialog, MfxScrolledCanvas
|
||||||
from pysollib.ui.tktile.tkcanvas import MfxCanvasImage
|
from pysollib.ui.tktile.tkcanvas import MfxCanvasImage
|
||||||
from selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode
|
from .selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode
|
||||||
from selecttree import SelectDialogTreeData, SelectDialogTreeCanvas
|
from .selecttree import SelectDialogTreeData, SelectDialogTreeCanvas
|
||||||
|
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
@ -73,7 +73,7 @@ class SelectCardsetData(SelectDialogTreeData):
|
||||||
None, None, _("(no cardsets)"), key=None), ]
|
None, None, _("(no cardsets)"), key=None), ]
|
||||||
#
|
#
|
||||||
select_by_type = None
|
select_by_type = None
|
||||||
items = CSI.TYPE.items()
|
items = list(CSI.TYPE.items())
|
||||||
items.sort(key=lambda x: x[1])
|
items.sort(key=lambda x: x[1])
|
||||||
nodes = []
|
nodes = []
|
||||||
for key, name in items:
|
for key, name in items:
|
||||||
|
@ -86,7 +86,7 @@ class SelectCardsetData(SelectDialogTreeData):
|
||||||
None, _("by Type"), tuple(nodes), expanded=1)
|
None, _("by Type"), tuple(nodes), expanded=1)
|
||||||
#
|
#
|
||||||
select_by_style = None
|
select_by_style = None
|
||||||
items = CSI.STYLE.items()
|
items = list(CSI.STYLE.items())
|
||||||
items.sort(key=lambda x: x[1])
|
items.sort(key=lambda x: x[1])
|
||||||
nodes = []
|
nodes = []
|
||||||
for key, name in items:
|
for key, name in items:
|
||||||
|
@ -102,7 +102,7 @@ class SelectCardsetData(SelectDialogTreeData):
|
||||||
None, _("by Style"), tuple(nodes))
|
None, _("by Style"), tuple(nodes))
|
||||||
#
|
#
|
||||||
select_by_nationality = None
|
select_by_nationality = None
|
||||||
items = CSI.NATIONALITY.items()
|
items = list(CSI.NATIONALITY.items())
|
||||||
items.sort(key=lambda x: x[1])
|
items.sort(key=lambda x: x[1])
|
||||||
nodes = []
|
nodes = []
|
||||||
for key, name in items:
|
for key, name in items:
|
||||||
|
@ -120,7 +120,7 @@ class SelectCardsetData(SelectDialogTreeData):
|
||||||
None, _("by Nationality"), tuple(nodes))
|
None, _("by Nationality"), tuple(nodes))
|
||||||
#
|
#
|
||||||
select_by_date = None
|
select_by_date = None
|
||||||
items = CSI.DATE.items()
|
items = list(CSI.DATE.items())
|
||||||
items.sort(key=lambda x: x[1])
|
items.sort(key=lambda x: x[1])
|
||||||
nodes = []
|
nodes = []
|
||||||
for key, name in items:
|
for key, name in items:
|
||||||
|
@ -135,7 +135,7 @@ class SelectCardsetData(SelectDialogTreeData):
|
||||||
select_by_date = SelectCardsetNode(
|
select_by_date = SelectCardsetNode(
|
||||||
None, _("by Date"), tuple(nodes))
|
None, _("by Date"), tuple(nodes))
|
||||||
#
|
#
|
||||||
self.rootnodes = filter(None, (
|
self.rootnodes = [_f for _f in (
|
||||||
SelectCardsetNode(
|
SelectCardsetNode(
|
||||||
None, _("All Cardsets"),
|
None, _("All Cardsets"),
|
||||||
lambda cs: 1, expanded=len(self.all_objects) <= 12),
|
lambda cs: 1, expanded=len(self.all_objects) <= 12),
|
||||||
|
@ -160,7 +160,7 @@ class SelectCardsetData(SelectDialogTreeData):
|
||||||
select_by_style,
|
select_by_style,
|
||||||
select_by_date,
|
select_by_date,
|
||||||
select_by_nationality,
|
select_by_nationality,
|
||||||
))
|
) if _f]
|
||||||
|
|
||||||
|
|
||||||
class SelectCardsetByTypeData(SelectDialogTreeData):
|
class SelectCardsetByTypeData(SelectDialogTreeData):
|
||||||
|
@ -170,7 +170,7 @@ class SelectCardsetByTypeData(SelectDialogTreeData):
|
||||||
self.no_contents = [SelectCardsetLeaf(
|
self.no_contents = [SelectCardsetLeaf(
|
||||||
None, None, _("(no cardsets)"), key=None), ]
|
None, None, _("(no cardsets)"), key=None), ]
|
||||||
#
|
#
|
||||||
items = CSI.TYPE.items()
|
items = list(CSI.TYPE.items())
|
||||||
items.sort(key=lambda x: x[1])
|
items.sort(key=lambda x: x[1])
|
||||||
nodes = []
|
nodes = []
|
||||||
for key, name in items:
|
for key, name in items:
|
||||||
|
@ -180,9 +180,9 @@ class SelectCardsetByTypeData(SelectDialogTreeData):
|
||||||
select_by_type = SelectCardsetNode(
|
select_by_type = SelectCardsetNode(
|
||||||
None, _("by Type"), tuple(nodes), expanded=1)
|
None, _("by Type"), tuple(nodes), expanded=1)
|
||||||
#
|
#
|
||||||
self.rootnodes = filter(None, (
|
self.rootnodes = [_f for _f in (
|
||||||
select_by_type,
|
select_by_type,
|
||||||
))
|
) if _f]
|
||||||
|
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
# imports
|
# imports
|
||||||
import os
|
import os
|
||||||
from six.moves import tkinter
|
from six.moves import tkinter
|
||||||
from UserList import UserList
|
from six.moves import UserList
|
||||||
|
|
||||||
# PySol imports
|
# PySol imports
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
|
@ -37,9 +37,9 @@ from pysollib.resource import CSI
|
||||||
|
|
||||||
# Toolkit imports
|
# Toolkit imports
|
||||||
from pysollib.ui.tktile.tkutil import unbind_destroy
|
from pysollib.ui.tktile.tkutil import unbind_destroy
|
||||||
from tkwidget import MfxDialog, MfxScrolledCanvas
|
from .tkwidget import MfxDialog, MfxScrolledCanvas
|
||||||
from selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode
|
from .selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode
|
||||||
from selecttree import SelectDialogTreeData, SelectDialogTreeCanvas
|
from .selecttree import SelectDialogTreeData, SelectDialogTreeCanvas
|
||||||
|
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
@ -81,7 +81,9 @@ class SelectGameNode(SelectDialogTreeNode):
|
||||||
class SelectGameData(SelectDialogTreeData):
|
class SelectGameData(SelectDialogTreeData):
|
||||||
def __init__(self, app):
|
def __init__(self, app):
|
||||||
SelectDialogTreeData.__init__(self)
|
SelectDialogTreeData.__init__(self)
|
||||||
self.all_games_gi = map(app.gdb.get, app.gdb.getGamesIdSortedByName())
|
self.all_games_gi = list(map(
|
||||||
|
app.gdb.get,
|
||||||
|
app.gdb.getGamesIdSortedByName()))
|
||||||
self.no_games = [SelectGameLeaf(None, None, _("(no games)"), None), ]
|
self.no_games = [SelectGameLeaf(None, None, _("(no games)"), None), ]
|
||||||
#
|
#
|
||||||
s_by_type = s_oriental = s_special = s_original = s_contrib = \
|
s_by_type = s_oriental = s_special = s_original = s_contrib = \
|
||||||
|
@ -95,7 +97,8 @@ class SelectGameData(SelectDialogTreeData):
|
||||||
):
|
):
|
||||||
gg = []
|
gg = []
|
||||||
for name, select_func in data:
|
for name, select_func in data:
|
||||||
if name is None or not filter(select_func, self.all_games_gi):
|
if name is None or not list(filter(
|
||||||
|
select_func, self.all_games_gi)):
|
||||||
continue
|
continue
|
||||||
gg.append(SelectGameNode(None, _(name), select_func))
|
gg.append(SelectGameNode(None, _(name), select_func))
|
||||||
g.append(gg)
|
g.append(gg)
|
||||||
|
@ -104,7 +107,7 @@ class SelectGameData(SelectDialogTreeData):
|
||||||
return gi.si.game_type == GI.GT_MAHJONGG
|
return gi.si.game_type == GI.GT_MAHJONGG
|
||||||
|
|
||||||
gg = None
|
gg = None
|
||||||
if filter(select_mahjongg_game, self.all_games_gi):
|
if list(filter(select_mahjongg_game, self.all_games_gi)):
|
||||||
gg = SelectGameNode(None, _("Mahjongg Games"),
|
gg = SelectGameNode(None, _("Mahjongg Games"),
|
||||||
select_mahjongg_game)
|
select_mahjongg_game)
|
||||||
g.append(gg)
|
g.append(gg)
|
||||||
|
@ -129,7 +132,8 @@ class SelectGameData(SelectDialogTreeData):
|
||||||
for name, games in GI.GAMES_BY_COMPATIBILITY:
|
for name, games in GI.GAMES_BY_COMPATIBILITY:
|
||||||
def select_func(gi, games=games):
|
def select_func(gi, games=games):
|
||||||
return gi.id in games
|
return gi.id in games
|
||||||
if name is None or not filter(select_func, self.all_games_gi):
|
if name is None or not list(filter(
|
||||||
|
select_func, self.all_games_gi)):
|
||||||
continue
|
continue
|
||||||
gg.append(SelectGameNode(None, name, select_func))
|
gg.append(SelectGameNode(None, name, select_func))
|
||||||
if 1 and gg:
|
if 1 and gg:
|
||||||
|
@ -141,7 +145,8 @@ class SelectGameData(SelectDialogTreeData):
|
||||||
for name, games in GI.GAMES_BY_PYSOL_VERSION:
|
for name, games in GI.GAMES_BY_PYSOL_VERSION:
|
||||||
def select_func(gi, games=games):
|
def select_func(gi, games=games):
|
||||||
return gi.id in games
|
return gi.id in games
|
||||||
if name is None or not filter(select_func, self.all_games_gi):
|
if name is None or not list(filter(
|
||||||
|
select_func, self.all_games_gi)):
|
||||||
continue
|
continue
|
||||||
name = _("New games in v. ") + name
|
name = _("New games in v. ") + name
|
||||||
gg.append(SelectGameNode(None, name, select_func))
|
gg.append(SelectGameNode(None, name, select_func))
|
||||||
|
@ -152,7 +157,8 @@ class SelectGameData(SelectDialogTreeData):
|
||||||
for name, games in GI.GAMES_BY_INVENTORS:
|
for name, games in GI.GAMES_BY_INVENTORS:
|
||||||
def select_func(gi, games=games):
|
def select_func(gi, games=games):
|
||||||
return gi.id in games
|
return gi.id in games
|
||||||
if name is None or not filter(select_func, self.all_games_gi):
|
if name is None or not list(filter(
|
||||||
|
select_func, self.all_games_gi)):
|
||||||
continue
|
continue
|
||||||
gg.append(SelectGameNode(None, name, select_func))
|
gg.append(SelectGameNode(None, name, select_func))
|
||||||
if 1 and gg:
|
if 1 and gg:
|
||||||
|
@ -162,7 +168,7 @@ class SelectGameData(SelectDialogTreeData):
|
||||||
ul_alternate_names = UserList(
|
ul_alternate_names = UserList(
|
||||||
list(app.gdb.getGamesTuplesSortedByAlternateName()))
|
list(app.gdb.getGamesTuplesSortedByAlternateName()))
|
||||||
#
|
#
|
||||||
self.rootnodes = filter(None, (
|
self.rootnodes = [_f for _f in (
|
||||||
SelectGameNode(None, _("All Games"), None),
|
SelectGameNode(None, _("All Games"), None),
|
||||||
SelectGameNode(None, _("Alternate Names"), ul_alternate_names),
|
SelectGameNode(None, _("Alternate Names"), ul_alternate_names),
|
||||||
SelectGameNode(None, _("Popular Games"),
|
SelectGameNode(None, _("Popular Games"),
|
||||||
|
@ -253,7 +259,7 @@ class SelectGameData(SelectDialogTreeData):
|
||||||
)),
|
)),
|
||||||
s_original,
|
s_original,
|
||||||
s_contrib,
|
s_contrib,
|
||||||
))
|
) if _f]
|
||||||
|
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
|
|
@ -24,17 +24,16 @@
|
||||||
|
|
||||||
# imports
|
# imports
|
||||||
import sys
|
import sys
|
||||||
from six.moves import tkinter
|
from six.moves import tkinter, tkinter_colorchooser
|
||||||
import tkColorChooser
|
|
||||||
|
|
||||||
# PySol imports
|
# PySol imports
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
from pysollib.mfxutil import KwStruct
|
from pysollib.mfxutil import KwStruct
|
||||||
|
|
||||||
# Toolkit imports
|
# Toolkit imports
|
||||||
from tkwidget import MfxDialog, MfxScrolledCanvas
|
from .tkwidget import MfxDialog, MfxScrolledCanvas
|
||||||
from selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode
|
from .selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode
|
||||||
from selecttree import SelectDialogTreeData, SelectDialogTreeCanvas
|
from .selecttree import SelectDialogTreeData, SelectDialogTreeCanvas
|
||||||
|
|
||||||
|
|
||||||
if sys.version_info > (3,):
|
if sys.version_info > (3,):
|
||||||
|
@ -174,9 +173,10 @@ class SelectTileDialogWithPreview(MfxDialog):
|
||||||
self.tree.n_expansions = 1 # save xyview in any case
|
self.tree.n_expansions = 1 # save xyview in any case
|
||||||
if button == 1: # "Solid color..."
|
if button == 1: # "Solid color..."
|
||||||
try:
|
try:
|
||||||
c = tkColorChooser.askcolor(master=self.top,
|
c = tkinter_colorchooser.askcolor(
|
||||||
initialcolor=self.table_color,
|
master=self.top,
|
||||||
title=_("Select table color"))
|
initialcolor=self.table_color,
|
||||||
|
title=_("Select table color"))
|
||||||
except tkinter.TclError:
|
except tkinter.TclError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -26,7 +26,7 @@ __all__ = ['SelectDialogTreeData']
|
||||||
# imports
|
# imports
|
||||||
|
|
||||||
# Toolkit imports
|
# Toolkit imports
|
||||||
from tktree import MfxTreeLeaf, MfxTreeNode, MfxTreeInCanvas
|
from .tktree import MfxTreeLeaf, MfxTreeNode, MfxTreeInCanvas
|
||||||
|
|
||||||
from pysollib.ui.tktile.selecttree import BaseSelectDialogTreeLeaf, \
|
from pysollib.ui.tktile.selecttree import BaseSelectDialogTreeLeaf, \
|
||||||
BaseSelectDialogTreeNode, SelectDialogTreeData, \
|
BaseSelectDialogTreeNode, SelectDialogTreeData, \
|
||||||
|
|
|
@ -35,7 +35,7 @@ from pysollib.pysolaudio import pysolsoundserver
|
||||||
|
|
||||||
# Toolkit imports
|
# Toolkit imports
|
||||||
from pysollib.ui.tktile.tkconst import EVENT_HANDLED
|
from pysollib.ui.tktile.tkconst import EVENT_HANDLED
|
||||||
from tkwidget import MfxDialog, MfxMessageDialog
|
from .tkwidget import MfxDialog, MfxMessageDialog
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
# *
|
# *
|
||||||
|
|
|
@ -29,7 +29,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
from six.moves import tkinter
|
from six.moves import tkinter
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
from tkwidget import MfxTooltip
|
from .tkwidget import MfxTooltip
|
||||||
from pysollib.settings import WIN_SYSTEM
|
from pysollib.settings import WIN_SYSTEM
|
||||||
|
|
||||||
if sys.version_info > (3,):
|
if sys.version_info > (3,):
|
||||||
|
|
Loading…
Add table
Reference in a new issue