1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00

Exposed the Randomize Card Placement option.

This commit is contained in:
Joe R 2022-01-20 17:21:24 -05:00
parent bc8eb4270c
commit 27e2813d0e
2 changed files with 20 additions and 8 deletions

View file

@ -89,7 +89,7 @@ class AbstractCard:
# Move the card to absolute position (x, y). # Move the card to absolute position (x, y).
dx, dy = 0, 0 dx, dy = 0, 0
if self.game.app.opt.randomize_place: if self.game.app.opt.randomize_place:
d = 1 d = 3
dx, dy = randint(-d, d), randint(-d, d) dx, dy = randint(-d, d), randint(-d, d)
self.moveBy(x - self.x + dx, y - self.y + dy) self.moveBy(x - self.x + dx, y - self.y + dy)

View file

@ -175,6 +175,7 @@ class PysolMenubarTkCommon:
preserve_aspect_ratio=tkinter.BooleanVar(), preserve_aspect_ratio=tkinter.BooleanVar(),
spread_stacks=tkinter.BooleanVar(), spread_stacks=tkinter.BooleanVar(),
center_layout=tkinter.BooleanVar(), center_layout=tkinter.BooleanVar(),
save_games_geometry=tkinter.BooleanVar(),
cardback=tkinter.IntVar(), cardback=tkinter.IntVar(),
tabletile=tkinter.IntVar(), tabletile=tkinter.IntVar(),
animations=tkinter.IntVar(), animations=tkinter.IntVar(),
@ -184,6 +185,7 @@ class PysolMenubarTkCommon:
shade=tkinter.BooleanVar(), shade=tkinter.BooleanVar(),
shade_filled_stacks=tkinter.BooleanVar(), shade_filled_stacks=tkinter.BooleanVar(),
shrink_face_down=tkinter.BooleanVar(), shrink_face_down=tkinter.BooleanVar(),
randomize_place=tkinter.BooleanVar(),
toolbar=tkinter.IntVar(), toolbar=tkinter.IntVar(),
toolbar_style=tkinter.StringVar(), toolbar_style=tkinter.StringVar(),
toolbar_relief=tkinter.StringVar(), toolbar_relief=tkinter.StringVar(),
@ -192,7 +194,6 @@ class PysolMenubarTkCommon:
statusbar=tkinter.BooleanVar(), statusbar=tkinter.BooleanVar(),
num_cards=tkinter.BooleanVar(), num_cards=tkinter.BooleanVar(),
helpbar=tkinter.BooleanVar(), helpbar=tkinter.BooleanVar(),
save_games_geometry=tkinter.BooleanVar(),
splashscreen=tkinter.BooleanVar(), splashscreen=tkinter.BooleanVar(),
demo_logo=tkinter.BooleanVar(), demo_logo=tkinter.BooleanVar(),
mouse_type=tkinter.StringVar(), mouse_type=tkinter.StringVar(),
@ -222,6 +223,7 @@ class PysolMenubarTkCommon:
tkopt.highlight_not_matching.set(opt.highlight_not_matching) tkopt.highlight_not_matching.set(opt.highlight_not_matching)
tkopt.shrink_face_down.set(opt.shrink_face_down) tkopt.shrink_face_down.set(opt.shrink_face_down)
tkopt.shade_filled_stacks.set(opt.shade_filled_stacks) tkopt.shade_filled_stacks.set(opt.shade_filled_stacks)
tkopt.randomize_place.set(opt.randomize_place)
tkopt.mahjongg_show_removed.set(opt.mahjongg_show_removed) tkopt.mahjongg_show_removed.set(opt.mahjongg_show_removed)
tkopt.shisen_show_hint.set(opt.shisen_show_hint) tkopt.shisen_show_hint.set(opt.shisen_show_hint)
tkopt.accordion_deal_all.set(opt.accordion_deal_all) tkopt.accordion_deal_all.set(opt.accordion_deal_all)
@ -231,6 +233,7 @@ class PysolMenubarTkCommon:
tkopt.preserve_aspect_ratio.set(opt.preserve_aspect_ratio) tkopt.preserve_aspect_ratio.set(opt.preserve_aspect_ratio)
tkopt.spread_stacks.set(opt.spread_stacks) tkopt.spread_stacks.set(opt.spread_stacks)
tkopt.center_layout.set(opt.center_layout) tkopt.center_layout.set(opt.center_layout)
tkopt.save_games_geometry.set(opt.save_games_geometry)
tkopt.cardback.set(self.app.cardset.backindex) tkopt.cardback.set(self.app.cardset.backindex)
tkopt.tabletile.set(self.app.tabletile_index) tkopt.tabletile.set(self.app.tabletile_index)
tkopt.animations.set(opt.animations) tkopt.animations.set(opt.animations)
@ -247,7 +250,6 @@ class PysolMenubarTkCommon:
tkopt.statusbar.set(opt.statusbar) tkopt.statusbar.set(opt.statusbar)
tkopt.num_cards.set(opt.num_cards) tkopt.num_cards.set(opt.num_cards)
tkopt.helpbar.set(opt.helpbar) tkopt.helpbar.set(opt.helpbar)
tkopt.save_games_geometry.set(opt.save_games_geometry)
tkopt.demo_logo.set(opt.demo_logo) tkopt.demo_logo.set(opt.demo_logo)
tkopt.splashscreen.set(opt.splashscreen) tkopt.splashscreen.set(opt.splashscreen)
tkopt.mouse_type.set(opt.mouse_type) tkopt.mouse_type.set(opt.mouse_type)
@ -598,6 +600,10 @@ class PysolMenubarTkCommon:
label=n_("Shade &filled stacks"), label=n_("Shade &filled stacks"),
variable=self.tkopt.shade_filled_stacks, variable=self.tkopt.shade_filled_stacks,
command=self.mOptShadeFilledStacks) command=self.mOptShadeFilledStacks)
submenu.add_checkbutton(
label=n_("&Randomize card placement"),
variable=self.tkopt.randomize_place,
command=self.mOptRandomizePlace)
submenu = MfxMenu(menu, label=n_("A&nimations")) submenu = MfxMenu(menu, label=n_("A&nimations"))
submenu.add_radiobutton( submenu.add_radiobutton(
label=n_("&None"), variable=self.tkopt.animations, value=0, label=n_("&None"), variable=self.tkopt.animations, value=0,
@ -1592,6 +1598,17 @@ Unsupported game for import.
self.app.opt.center_layout = not self.app.opt.center_layout self.app.opt.center_layout = not self.app.opt.center_layout
self._updateCardSize() self._updateCardSize()
def mOptRandomizePlace(self, *event):
if self._cancelDrag(break_pause=False):
return
self.app.opt.randomize_place = self.tkopt.randomize_place.get()
self._updateCardSize()
def mOptSaveGamesGeometry(self, *event):
if self._cancelDrag(break_pause=False):
return
self.app.opt.save_games_geometry = self.tkopt.save_games_geometry.get()
def _mOptCardback(self, index): def _mOptCardback(self, index):
if self._cancelDrag(break_pause=False): if self._cancelDrag(break_pause=False):
return return
@ -1689,11 +1706,6 @@ Unsupported game for import.
if self.app.helpbar.show(show, resize=resize): if self.app.helpbar.show(show, resize=resize):
self.top.update_idletasks() self.top.update_idletasks()
def mOptSaveGamesGeometry(self, *event):
if self._cancelDrag(break_pause=False):
return
self.app.opt.save_games_geometry = self.tkopt.save_games_geometry.get()
def mOptDemoLogo(self, *event): def mOptDemoLogo(self, *event):
if self._cancelDrag(break_pause=False): if self._cancelDrag(break_pause=False):
return return