mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
2to3 on pysollib/tile/se*.py
This commit is contained in:
parent
74e0ff5bf3
commit
424afcfad3
4 changed files with 41 additions and 35 deletions
|
@ -26,7 +26,7 @@ __all__ = ['SelectCardsetDialogWithPreview']
|
||||||
# imports
|
# imports
|
||||||
import os
|
import os
|
||||||
from six.moves import tkinter
|
from six.moves import tkinter
|
||||||
import ttk
|
from . import ttk
|
||||||
|
|
||||||
# PySol imports
|
# PySol imports
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
|
@ -36,10 +36,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, PysolScale
|
from .tkwidget import MfxDialog, MfxScrolledCanvas, PysolScale
|
||||||
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
|
||||||
|
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
@ -74,7 +74,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:
|
||||||
|
@ -87,7 +87,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:
|
||||||
|
@ -103,7 +103,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:
|
||||||
|
@ -121,7 +121,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:
|
||||||
|
@ -136,7 +136,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),
|
||||||
|
@ -162,7 +162,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):
|
||||||
|
@ -172,7 +172,7 @@ class SelectCardsetByTypeData(SelectDialogTreeData):
|
||||||
self.no_contents = [SelectCardsetLeaf(None, None, _("(no cardsets)"),
|
self.no_contents = [SelectCardsetLeaf(None, None, _("(no cardsets)"),
|
||||||
key=None), ]
|
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:
|
||||||
|
@ -183,9 +183,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]
|
||||||
|
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
|
|
||||||
# imports
|
# imports
|
||||||
import os
|
import os
|
||||||
import ttk
|
from . import ttk
|
||||||
from UserList import UserList
|
from six.moves import UserList
|
||||||
|
|
||||||
# PySol imports
|
# PySol imports
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
|
@ -36,9 +36,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
|
||||||
|
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
@ -80,7 +80,8 @@ 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 = \
|
||||||
|
@ -94,7 +95,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)
|
||||||
|
@ -103,7 +105,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)
|
||||||
|
@ -128,7 +130,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:
|
||||||
|
@ -139,7 +142,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))
|
||||||
|
@ -150,7 +154,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:
|
||||||
|
@ -160,7 +165,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, expanded=0),
|
SelectGameNode(None, _("All Games"), None, expanded=0),
|
||||||
SelectGameNode(None, _("Alternate Names"), ul_alternate_names),
|
SelectGameNode(None, _("Alternate Names"), ul_alternate_names),
|
||||||
SelectGameNode(None, _("Popular Games"),
|
SelectGameNode(None, _("Popular Games"),
|
||||||
|
@ -251,7 +256,7 @@ class SelectGameData(SelectDialogTreeData):
|
||||||
)),
|
)),
|
||||||
s_original,
|
s_original,
|
||||||
s_contrib,
|
s_contrib,
|
||||||
))
|
) if _f]
|
||||||
|
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
|
|
@ -25,17 +25,17 @@
|
||||||
# imports
|
# imports
|
||||||
import sys
|
import sys
|
||||||
from six.moves import tkinter
|
from six.moves import tkinter
|
||||||
import ttk
|
from six.moves import tkinter_colorchooser
|
||||||
import tkColorChooser
|
from . import ttk
|
||||||
|
|
||||||
# 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,):
|
||||||
|
@ -175,7 +175,8 @@ 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 == 10: # "Solid color..."
|
if button == 10: # "Solid color..."
|
||||||
try:
|
try:
|
||||||
c = tkColorChooser.askcolor(master=self.top,
|
c = tkinter_colorchooser.askcolor(
|
||||||
|
master=self.top,
|
||||||
initialcolor=self.table_color,
|
initialcolor=self.table_color,
|
||||||
title=_("Select table color"))
|
title=_("Select table color"))
|
||||||
except tkinter.TclError:
|
except tkinter.TclError:
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
__all__ = ['SelectDialogTreeData']
|
__all__ = ['SelectDialogTreeData']
|
||||||
|
|
||||||
# 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, \
|
||||||
|
|
Loading…
Add table
Reference in a new issue