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

Compare commits

...

2 commits

Author SHA1 Message Date
Shlomi Fish
0961401105 fix tests 2019-11-13 08:39:59 +02:00
Topi Miettinen
e65c236dc9
Describe order of Ganjifa suits
Help for Dashavatara Ganjifa games refer to general Ganjifa help for
order of suits, but it was actually missing.
2019-10-27 12:44:49 +02:00
10 changed files with 50 additions and 26 deletions

View file

@ -6,8 +6,11 @@ traditionally been individually hand painted. There are any where from eight
to twelve or more suits per deck, each suit having usually twelve ranks. The
two most common Ganjifa decks are the Mughal which has eight suits and the
Dashavatara which has ten. The suits have pip cards numbered from Ace through
ten and two court cards, the Wazir and the Mir. Ganjifa solitaire games play
the same as games that use the standard deck but the larger number of different
cards in a deck (96 or 120) adds an element of complexity. The fact that each
suit has it's own color makes things quite interesting in games that use
"Alternate Color" row stacks.
ten and two court cards, the Wazir and the Mir. The order of the suits
is: Matsya, Kuchha, Varaha, Narsingha, Vamana, Parashurama, Rama,
Krishna, Buddha, and Kalanki. Ganjifa solitaire games play the same
as games that use the standard deck but the larger number of different
cards in a deck (96 or 120) adds an element of complexity. The fact
that each suit has it's own color makes things quite interesting in
games that use "Alternate Color" row stacks.
<img alt="" src="images/ganjifa.gif">

BIN
html-src/images/ganjifa.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

View file

@ -716,6 +716,7 @@ class LImageItem(BoxLayout, LBase):
def send_event_pressed_1(self, event):
if self.group and '<1>' in self.group.bindings:
self.group.bindings['<1>'](event)
def send_event_pressed_double_1(self, event):
if self.group and '<Double-1>' in self.group.bindings:
self.group.bindings['<Double-1>'](event)

View file

@ -1,4 +1,3 @@
import time
import logging
try:
import jnius
@ -15,22 +14,26 @@ except ImportError:
# wait loop removed. (Implement it in external code if needed.)
# LB191011.
class AndroidPerms(object):
def __init__(self):
if jnius is None:
return
self.PythonActivity = jnius.autoclass('org.kivy.android.PythonActivity')
self.Compat = jnius.autoclass('android.support.v4.content.ContextCompat')
self.currentActivity = jnius.cast('android.app.Activity', self.PythonActivity.mActivity)
self.PythonActivity = jnius.autoclass(
'org.kivy.android.PythonActivity')
self.Compat = jnius.autoclass(
'android.support.v4.content.ContextCompat')
self.currentActivity = jnius.cast(
'android.app.Activity', self.PythonActivity.mActivity)
def getPerm(self,permission):
def getPerm(self, permission):
if jnius is None:
return True
p = self.Compat.checkSelfPermission(self.currentActivity,permission)
p = self.Compat.checkSelfPermission(self.currentActivity, permission)
return p == 0
# check actual permissions
def getPerms(self,permissions):
def getPerms(self, permissions):
if jnius is None:
return True
haveperms = True
@ -39,7 +42,7 @@ class AndroidPerms(object):
return haveperms
# invoke the permissions dialog
def requestPerms(self,permissions):
def requestPerms(self, permissions):
if jnius is None:
return True
logging.info("androidperms: invoke permission dialog")
@ -52,10 +55,10 @@ def getStoragePerm():
return ap.getPerms(
["android.permission.WRITE_EXTERNAL_STORAGE"])
def requestStoragePerm():
ap = AndroidPerms()
#ap.requestPerms(
# ap.requestPerms(
# ["android.permission.READ_EXTERNAL_STORAGE","android.permission.WRITE_EXTERNAL_STORAGE"])
ap.requestPerms(
["android.permission.WRITE_EXTERNAL_STORAGE"])

View file

@ -48,11 +48,11 @@ from pysollib.kivy.tkutil import after_idle
from pysollib.kivy.tkutil import bind
from pysollib.mfxutil import Struct
from pysollib.mygettext import _
from pysollib.pysoltk import MfxMessageDialog
from pysollib.pysoltk import connect_game_find_card_dialog
from pysollib.settings import SELECT_GAME_MENU
from pysollib.settings import TITLE
from pysollib.pysoltk import MfxMessageDialog
# ************************************************************************
# * tk emuls:
@ -1909,7 +1909,7 @@ class PysolMenubarTk:
if self._cancelDrag(break_pause=False):
return
self.app.opt.language = self.tkopt.language.get()
d = MfxMessageDialog(
MfxMessageDialog(
self.app.top, title=_("Note"),
text=_("""\
These settings will take effect

View file

@ -635,4 +635,3 @@ class MfxScrolledCanvas(object):
# *
# ************************************************************************
# not used witch kivy. would not nun as it refers TkInter.

View file

@ -143,7 +143,11 @@ def getprefdir(package):
# high resolution clock() and sleep()
uclock = time.clock
try:
uclock = time.perf_counter
except Exception:
uclock = time.clock
usleep = time.sleep
if os.name == "posix":
uclock = time.time

View file

@ -1,7 +1,9 @@
import gettext
import sys
import six
class myLocalGettext(object):
def __init__(self, lang):
self.language = lang
@ -12,7 +14,8 @@ class myLocalGettext(object):
if self.language == "":
t = gettext.translation(domain, localedir)
else:
t = gettext.translation(domain, localedir, languages=[self.language])
t = gettext.translation(
domain, localedir, languages=[self.language])
return t
def maketext(self, msg):
@ -20,7 +23,7 @@ class myLocalGettext(object):
return six.text_type(msg, 'utf-8')
return msg
def ungettext(self,msgid1, msgid2, n):
def ungettext(self, msgid1, msgid2, n):
# unicoded ngettext
msgid1 = self.maketext(msgid1)
msgid2 = self.maketext(msgid2)
@ -36,7 +39,7 @@ class myLocalGettext(object):
else:
return t.ungettext(msgid1, msgid2, n)
def ugettext(self,message):
def ugettext(self, message):
# unicoded gettext
message = self.maketext(message)
try:
@ -48,15 +51,19 @@ class myLocalGettext(object):
else:
return t.ugettext(message)
myGettext = myLocalGettext('')
def n_(x):
return x
def fix_gettext():
gettext.ugettext = myGettext.ugettext
gettext.ungettext = myGettext.ungettext
fix_gettext()
_ = gettext.ugettext

View file

@ -30,10 +30,10 @@ import configobj
import pysollib.settings
from pysollib.mfxutil import print_err
from pysollib.mygettext import _
from pysollib.mygettext import myGettext
from pysollib.pysoltk import TOOLBAR_BUTTONS, TOOLKIT
from pysollib.resource import CSI
from pysollib.mygettext import myGettext
import six

View file

@ -7,8 +7,15 @@ import re
from sys import platform
IS_MAC = (platform == "darwin")
PY_VERS = ([] if re.search("\\bSKIP_PY2\\b",
os.getenv('TEST_TAGS', '')) else [2])+[3]
TEST_TAGS = os.getenv('TEST_TAGS', '')
def _has_tag(tag):
return re.search("\\b{}\\b".format(tag), TEST_TAGS)
PY_VERS = ([] if _has_tag('SKIP_PY2') else [2])+[3]
SKIP_GTK = _has_tag('SKIP_GTK')
module_names = []
for d, _, files in os.walk("pysollib"):
for f in files:
@ -23,7 +30,7 @@ for module_name in module_names:
continue
is_gtk = ("gtk" in module_name)
for ver in PY_VERS:
if ((not is_gtk) or (ver == 2 and (not IS_MAC))):
if ((not is_gtk) or (ver == 2 and (not IS_MAC) and (not SKIP_GTK))):
def fmt(s):
return s % {'module_name': module_name, 'ver': ver}
open(os.path.join(".", "tests", "individually-importing", fmt("import_v%(ver)d_%(module_name)s.py")), 'w').write(fmt('''#!/usr/bin/env python%(ver)d