diff --git a/data/tiles/Felt_Green.gif b/data/tiles/Felt_Green.gif new file mode 100644 index 00000000..216f3d92 Binary files /dev/null and b/data/tiles/Felt_Green.gif differ diff --git a/data/tiles/Felt_Green.png b/data/tiles/Felt_Green.png new file mode 100644 index 00000000..6399a696 Binary files /dev/null and b/data/tiles/Felt_Green.png differ diff --git a/data/tiles/Marble.gif b/data/tiles/Marble.gif new file mode 100644 index 00000000..bdfc650c Binary files /dev/null and b/data/tiles/Marble.gif differ diff --git a/data/tiles/Marble.png b/data/tiles/Marble.png new file mode 100644 index 00000000..8387892a Binary files /dev/null and b/data/tiles/Marble.png differ diff --git a/data/tiles/Wood.gif b/data/tiles/Wood.gif new file mode 100644 index 00000000..f0c2a927 Binary files /dev/null and b/data/tiles/Wood.gif differ diff --git a/data/tiles/Wood.png b/data/tiles/Wood.png new file mode 100644 index 00000000..ab65d55a Binary files /dev/null and b/data/tiles/Wood.png differ diff --git a/data/tiles/save-aspect/Mountains.jpg b/data/tiles/save-aspect/Mountains.jpg new file mode 100644 index 00000000..ef8d9cb4 Binary files /dev/null and b/data/tiles/save-aspect/Mountains.jpg differ diff --git a/pysollib/actions.py b/pysollib/actions.py index fe04330a..36eac63f 100644 --- a/pysollib/actions.py +++ b/pysollib/actions.py @@ -27,7 +27,7 @@ import os from pysollib.gamedb import GI from pysollib.help import help_about, help_html from pysollib.mfxutil import Struct, openURL -from pysollib.mfxutil import print_err, USE_PIL +from pysollib.mfxutil import USE_PIL, print_err from pysollib.mygettext import _ from pysollib.pysolrandom import construct_random from pysollib.pysoltk import AllGames_StatsDialog, SingleGame_StatsDialog diff --git a/pysollib/tile/selecttile.py b/pysollib/tile/selecttile.py index be09d4b7..54710c5c 100644 --- a/pysollib/tile/selecttile.py +++ b/pysollib/tile/selecttile.py @@ -25,6 +25,7 @@ from pysollib.mfxutil import KwStruct from pysollib.mygettext import _ from pysollib.ui.tktile.selecttree import SelectDialogTreeData +import os import six from six.moves import tkinter from six.moves import tkinter_colorchooser @@ -67,9 +68,21 @@ class SelectTileData(SelectDialogTreeData): if tile.index > 0 and tile.filename] self.no_contents = [SelectTileLeaf( None, None, _("(no tiles)"), key=None), ] - e1 = isinstance(key, str) or len(self.all_objects) <= 17 - e2 = 1 + # e1 = isinstance(key, str) or len(self.all_objects) <= 17 + # e2 = 0 self.rootnodes = ( + SelectTileNode( + None, _("All Backgrounds"), + lambda tile: 1, expanded=0), + SelectTileNode( + None, _("Textures"), + lambda tile: os.path.basename( + os.path.dirname(tile.filename)) == 'tiles', expanded=0), + SelectTileNode( + None, _("Images"), + lambda tile: (os.path.basename( + os.path.dirname(tile.filename)) in + ('stretch', 'save-aspect')), expanded=0), SelectTileNode(None, _("Solid Colors"), ( SelectTileLeaf(None, None, _("Blue"), key="#0082df"), SelectTileLeaf(None, None, _("Green"), key="#008200"), @@ -77,10 +90,7 @@ class SelectTileData(SelectDialogTreeData): SelectTileLeaf(None, None, _("Olive"), key="#868200"), SelectTileLeaf(None, None, _("Orange"), key="#f79600"), SelectTileLeaf(None, None, _("Teal"), key="#008286"), - ), expanded=e1), - SelectTileNode( - None, _("All Backgrounds"), - lambda tile: 1, expanded=e2), + ), expanded=0), ) @@ -117,10 +127,12 @@ class SelectTileDialogWithPreview(MfxDialog): self.TreeDataHolder_Class.data = self.TreeData_Class(manager, key) # self.top.wm_minsize(400, 200) - if self.top.winfo_screenwidth() >= 800: - w1, w2 = 200, 400 - else: - w1, w2 = 200, 300 + sw = self.top.winfo_screenwidth() + sh = self.top.winfo_screenheight() + + h = sh * .8 + w1, w2 = min(250, sw / 4), max(sw / 2 + ((sw / 4) - 250), sw / 2) + font = app.getFont("default") padx, pady = 4, 4 frame = ttk.Frame(top_frame) @@ -130,7 +142,8 @@ class SelectTileDialogWithPreview(MfxDialog): font=font, width=w1) self.tree.frame.pack(side="left", fill='both', expand=False, padx=padx, pady=pady) - self.preview = MfxScrolledCanvas(frame, width=w2, hbar=0, vbar=0) + self.preview = MfxScrolledCanvas(frame, width=w2, hbar=0, vbar=0, + height=h) self.preview.pack(side="right", fill='both', expand=True, padx=padx, pady=pady) self.preview.canvas.preview = 1