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

Kivy/Android

- card selection menu grouped by cardset type
This commit is contained in:
lufebe16 2023-12-06 19:21:57 +01:00
parent 9816c15d94
commit b49f82ad02

View file

@ -870,25 +870,37 @@ class LOptionsMenuGenerator(LTreeGenerator):
# ------------------------------------------- # -------------------------------------------
# Cardsets and card backside options # Cardsets and card backside options
from pysollib.resource import CSI
rg = tv.add_node( rg = tv.add_node(
LTreeNode(text=_('Cardsets'))) LTreeNode(text=_('Cardsets')))
if rg: if rg:
self.menubar.tkopt.cardset.set(self.app.cardset.index) self.menubar.tkopt.cardset.set(self.app.cardset.index)
csm = self.app.cardset_manager csm = self.app.cardset_manager
# cnt = csm.len() cdict = {}
i = 0 i = 0
while 1: while 1:
cs = csm.get(i) cardset = csm.get(i)
if cs is None: if cardset is None: break # noqa
break t = cardset.type
if t not in cdict.keys(): cdict[t] = [] # noqa
cdict[t].append((i, cardset))
i += 1
rg1 = self.addRadioNode(tv, rg, for k in sorted(cdict.keys()):
cs.name, name = CSI.TYPE_NAME[k]
self.menubar.tkopt.cardset, i, csl = cdict[k]
self.menubar.mOptCardset) rg1 = tv.add_node(LTreeNode(text=name), rg)
if rg1: for cst in csl:
i = cst[0]
cs = cst[1]
rg2 = self.addRadioNode(
tv,rg1,cs.name,self.menubar.tkopt.cardset, # noqa
i,self.menubar.mOptCardset) # noqa
if rg2:
cbs = cs.backnames cbs = cs.backnames
self.menubar.tkopt.cardbacks[i] = IntVar() self.menubar.tkopt.cardbacks[i] = IntVar()
self.menubar.tkopt.cardbacks[i].set(cs.backindex) self.menubar.tkopt.cardbacks[i].set(cs.backindex)
@ -896,19 +908,13 @@ class LOptionsMenuGenerator(LTreeGenerator):
bcnt = len(cbs) bcnt = len(cbs)
bi = 0 bi = 0
while 1: while 1:
if bi == bcnt: if bi == bcnt: break # noqa
break
cb = cbs[bi] cb = cbs[bi]
self.addRadioNode( self.addRadioNode(tv,rg2,cb, # noqa
tv, rg1, self.menubar.tkopt.cardbacks[i],bi, # noqa
cb, self.make_vars_command( # noqa
self.menubar.tkopt.cardbacks[i], bi,
self.make_vars_command(
self.menubar.mOptSetCardback, i)) self.menubar.mOptSetCardback, i))
bi += 1 bi += 1
i += 1
yield yield
# ------------------------------------------- # -------------------------------------------
# Table background settings # Table background settings