Skip to content

Commit

Permalink
Enable button icons (as an enableable option)
Browse files Browse the repository at this point in the history
  • Loading branch information
joeraz committed Jun 30, 2024
1 parent 3cbcc8d commit a42b76d
Show file tree
Hide file tree
Showing 20 changed files with 66 additions and 8 deletions.
Binary file added data/images/buttons/bluecurve/back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed data/images/buttons/bluecurve/cancel.gif
Binary file not shown.
Binary file removed data/images/buttons/bluecurve/new.gif
Binary file not shown.
Binary file removed data/images/buttons/bluecurve/ok.gif
Binary file not shown.
Binary file added data/images/buttons/bluecurve/reset.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/buttons/remix/back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/buttons/remix/cancel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/buttons/remix/new.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/buttons/remix/ok.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/buttons/remix/reset.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion po/de_pysol.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: PySol 0.0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-10 10:19-0500\n"
"PO-Revision-Date: 2024-06-22 12:14-0400\n"
"PO-Revision-Date: 2024-06-30 10:00-0400\n"
"Last-Translator: H. Schaekel <[email protected]>\n"
"Language-Team: German\n"
"Language: de\n"
Expand Down Expand Up @@ -5443,6 +5443,9 @@ msgid "Othe&r graphics"
msgstr ""

#: pysollib/ui/tktile/menubar.py:637
msgid "&Button icons"
msgstr ""

msgid "&Demo logo"
msgstr "&Demo logo"

Expand Down
5 changes: 4 additions & 1 deletion po/fr_pysol.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: 1.02\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-10 10:19-0500\n"
"PO-Revision-Date: 2024-06-22 12:14-0400\n"
"PO-Revision-Date: 2024-06-30 09:59-0400\n"
"Last-Translator: Eric Rausch <[email protected]>\n"
"Language-Team: French\n"
"Language: fr\n"
Expand Down Expand Up @@ -5489,6 +5489,9 @@ msgid "Othe&r graphics"
msgstr ""

#: pysollib/ui/tktile/menubar.py:637
msgid "&Button icons"
msgstr ""

msgid "&Demo logo"
msgstr "Logo de &démo"

Expand Down
5 changes: 4 additions & 1 deletion po/it_pysol.po
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ msgstr ""
"Project-Id-Version: it_pysol\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-10 10:19-0500\n"
"PO-Revision-Date: 2024-06-22 12:14-0400\n"
"PO-Revision-Date: 2024-06-30 09:59-0400\n"
"Last-Translator: Giuliano Colla <[email protected]>\n"
"Language-Team: Italiano <[email protected]>\n"
"Language: it\n"
Expand Down Expand Up @@ -5554,6 +5554,9 @@ msgid "Othe&r graphics"
msgstr ""

#: pysollib/ui/tktile/menubar.py:637
msgid "&Button icons"
msgstr ""

msgid "&Demo logo"
msgstr "&Demo logo"

Expand Down
5 changes: 4 additions & 1 deletion po/pl_pysol.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: PySolFC\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-10 10:19-0500\n"
"PO-Revision-Date: 2024-06-22 12:14-0400\n"
"PO-Revision-Date: 2024-06-30 09:58-0400\n"
"Last-Translator: Jerzy Trzeciak <[email protected]>\n"
"Language-Team: Polish <[email protected]>\n"
"Language: pl\n"
Expand Down Expand Up @@ -5505,6 +5505,9 @@ msgid "Othe&r graphics"
msgstr ""

#: pysollib/ui/tktile/menubar.py:637
msgid "&Button icons"
msgstr ""

msgid "&Demo logo"
msgstr "&Demo logo"

Expand Down
5 changes: 4 additions & 1 deletion po/pt_BR_pysol.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-10 10:19-0500\n"
"PO-Revision-Date: 2024-06-22 12:15-0400\n"
"PO-Revision-Date: 2024-06-30 09:58-0400\n"
"Last-Translator: Matheus Knack <[email protected]>\n"
"Language-Team: \n"
"Language: pt_BR\n"
Expand Down Expand Up @@ -5511,6 +5511,9 @@ msgid "Othe&r graphics"
msgstr ""

#: pysollib/ui/tktile/menubar.py:637
msgid "&Button icons"
msgstr ""

msgid "&Demo logo"
msgstr "&Logo da demo"

Expand Down
3 changes: 3 additions & 0 deletions po/pysol.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5237,6 +5237,9 @@ msgid "Othe&r graphics"
msgstr ""

#: pysollib/ui/tktile/menubar.py:637
msgid "&Button icons"
msgstr ""

msgid "&Demo logo"
msgstr ""

Expand Down
5 changes: 4 additions & 1 deletion po/ru_pysol.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-10 10:19-0500\n"
"PO-Revision-Date: 2024-06-22 12:16-0400\n"
"PO-Revision-Date: 2024-06-30 09:58-0400\n"
"Last-Translator: Skomoroh <[email protected]>\n"
"Language-Team: Russian <[email protected]>\n"
"Language: ru\n"
Expand Down Expand Up @@ -5579,6 +5579,9 @@ msgid "Othe&r graphics"
msgstr ""

#: pysollib/ui/tktile/menubar.py:637
msgid "&Button icons"
msgstr ""

msgid "&Demo logo"
msgstr "Д&емо лого"

Expand Down
11 changes: 9 additions & 2 deletions pysollib/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,12 +524,19 @@ def loadImages1(self):
MfxMessageDialog.img[f] = im

# load button images
if 0 and TOOLKIT == 'tk':
dirname = os.path.join('images', 'buttons', 'bluecurve')
MfxDialog.button_img = {}
if TOOLKIT == 'tk' and self.opt.button_icon_style != 'none':
dirname = os.path.join('images', 'buttons',
self.opt.button_icon_style)
for n, f in (
(_('&OK'), 'ok'),
(_('&Select'), 'ok'),
(_('&Cancel'), 'cancel'),
(_('&Close'), 'cancel'),
(_('&New game'), 'new'),
(_('&Back to game'), 'back'),
(_('&Reset...'), 'reset'),
(_('&Restart'), 'reset'),
):
fn = self.dataloader.findImage(f, dirname)
im = loadImage(fn)
Expand Down
3 changes: 3 additions & 0 deletions pysollib/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def calcCustomMouseButtonsBinding(binding_format):
redeal_icon_style = string
dialog_icon_style = string
tree_icon_style = string
button_icon_style = string
tile_theme = string
default_tile_theme = string
toolbar = integer(0, 4)
Expand Down Expand Up @@ -270,6 +271,7 @@ class Options:
('redeal_icon_style', 'str'),
('dialog_icon_style', 'str'),
('tree_icon_style', 'str'),
('button_icon_style', 'str'),
('tile_theme', 'str'),
('default_tile_theme', 'str'),
('toolbar', 'int'),
Expand Down Expand Up @@ -376,6 +378,7 @@ def __init__(self):
self.redeal_icon_style = 'modern'
self.dialog_icon_style = 'remix'
self.tree_icon_style = 'remix'
self.button_icon_style = 'none'
self.tile_theme = 'default'
self.default_tile_theme = 'default'
self.toolbar = 1 # 0 == hide, 1,2,3,4 == top, bottom, left, right
Expand Down
27 changes: 27 additions & 0 deletions pysollib/ui/tktile/menubar.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,20 @@ def createStatusbarMenu(menubar, menu):

def createOtherGraphicsMenu(menubar, menu):
tearoff = menu.cget('tearoff')
data_dir = os.path.join(menubar.app.dataloader.dir, 'images', 'buttons')
submenu = MfxMenu(menu, label=n_('&Button icons'), tearoff=tearoff)
styledirs = os.listdir(data_dir)
styledirs.append("none")
styledirs.sort()
for f in styledirs:
d = os.path.join(data_dir, f)
if (os.path.isdir(d) and os.path.exists(os.path.join(d))) \
or f == "none":
name = f.replace('_', ' ').capitalize()
submenu.add_radiobutton(
label=name,
variable=menubar.tkopt.button_icon_style,
value=f, command=menubar.mOptButtonIconStyle)
data_dir = os.path.join(menubar.app.dataloader.dir, 'images', 'demo')
submenu = MfxMenu(menu, label=n_('&Demo logo'), tearoff=tearoff)
styledirs = os.listdir(data_dir)
Expand Down Expand Up @@ -326,6 +340,7 @@ def _createTkOpt(self):
num_cards=tkinter.BooleanVar(),
helpbar=tkinter.BooleanVar(),
splashscreen=tkinter.BooleanVar(),
button_icon_style=tkinter.StringVar(),
demo_logo=tkinter.BooleanVar(),
demo_logo_style=tkinter.StringVar(),
pause_text_style=tkinter.StringVar(),
Expand Down Expand Up @@ -395,6 +410,7 @@ def _setOptions(self):
tkopt.statusbar.set(opt.statusbar)
# tkopt.num_cards.set(opt.num_cards)
# tkopt.helpbar.set(opt.helpbar)
tkopt.button_icon_style.set(opt.button_icon_style)
tkopt.demo_logo.set(opt.demo_logo)
if opt.demo_logo:
tkopt.demo_logo_style.set(opt.demo_logo_style)
Expand Down Expand Up @@ -1946,6 +1962,9 @@ def mOptStatusbar(self, *event):
def mOptStatusbarConfig(self, w):
self.statusbarConfig(w, self.tkopt.statusbar_vars[w].get())

def mOptButtonIconStyle(self, *event):
self.setButtonIconStyle(self.tkopt.button_icon_style.get())

def mOptDemoLogoStyle(self, *event):
self.setDemoLogoStyle(self.tkopt.demo_logo_style.get())

Expand Down Expand Up @@ -2048,6 +2067,14 @@ def setToolbarCompound(self, compound):
self.game.updateStatus(player=self.app.opt.player)
self.top.update_idletasks()

def setButtonIconStyle(self, style):
if self._cancelDrag(break_pause=False):
return
self.app.opt.button_icon_style = style
self.tkopt.button_icon_style.set(style) # update radiobutton
self.app.loadImages1()
self.app.loadImages4()

def setDemoLogoStyle(self, style):
if self._cancelDrag(break_pause=False):
return
Expand Down

0 comments on commit a42b76d

Please sign in to comment.