1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00
* updated russian translation
* misc. improvements


git-svn-id: https://pysolfc.svn.sourceforge.net/svnroot/pysolfc/PySolFC/trunk@148 39dd0a4e-7c14-0410-91b3-c4f2d318f732
This commit is contained in:
skomoroh 2007-03-06 22:47:26 +00:00
parent 3a35c4e13b
commit acf717d877
13 changed files with 941 additions and 786 deletions

View file

@ -0,0 +1,27 @@
<h1>Shamrocks</h1>
<h3>From Wikipedia, the free encyclopedia</h3>
<p>
Shamrocks is a solitaire game akin to <a href="labellelucie.html">La Belle
Lucie</a>. The object is the same as the latter: move the cards into the
foundations.
<p>
The game is layout out as in La Belle Lucie: seventeen piles of three cards
are placed on the tableau with one card counting as an eighteenth. Any card
that can be moved to the foundations should be moved and built up by suit
(starting from the ace). The top card of each pile can be used for play and
once a pile is empty, it cannot be refilled.
<p>
But its similarity to La Belle Lucie ends there. Before the game begins, each
King which is on top or middle of its respective pile is placed underneath.
(Morehead and Mott-Smith's rules to the game specifically states that a King
that is on top of a lower-ranked card of the same suit should be placed under
that lower-ranked card, no matter what else in its pile.) To play on the
tableau, a card can be placed over a card that is one rank higher or lower,
regardless of suit (a <b>6</b><img src="../images/s.gif"> can be placed on a
<b>7</b><img src="../images/c.gif"> or a <b>5</b><img src="../images/d.gif">).
However, each pile can hold no more than three cards at a time; thus no card
can be placed on a pile with three cards.
<p>
The game is won when all of the cards have been moved to the foundations.
<p>
<i>(Retrieved from <a href="http://en.wikipedia.org/wiki/Shamrocks">http://en.wikipedia.org/wiki/Shamrocks</a>)</i>

View file

@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PySol 0.0.1\n"
"POT-Creation-Date: Wed Feb 21 17:56:30 2007\n"
"POT-Creation-Date: Mon Mar 5 17:55:43 2007\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -1092,6 +1092,9 @@ msgstr ""
msgid "Flamenco"
msgstr ""
msgid "Flipper"
msgstr ""
msgid "Floating City"
msgstr ""
@ -1746,6 +1749,9 @@ msgstr ""
msgid "Legion"
msgstr ""
msgid "Leprechaun"
msgstr ""
msgid "Les Quatre Coins"
msgstr ""
@ -3114,6 +3120,9 @@ msgstr ""
msgid "Shamrocks"
msgstr ""
msgid "Shamrocks II"
msgstr ""
msgid "Shamsher"
msgstr ""
@ -3462,6 +3471,9 @@ msgstr ""
msgid "The Great Wall"
msgstr ""
msgid "The Jolly Roger"
msgstr ""
msgid "The Last Monarch"
msgstr ""

File diff suppressed because it is too large Load diff

View file

@ -5,8 +5,8 @@
msgid ""
msgstr ""
"Project-Id-Version: PySol 0.0.1\n"
"POT-Creation-Date: Wed Feb 21 17:56:30 2007\n"
"PO-Revision-Date: 2007-02-12 19:08+0300\n"
"POT-Creation-Date: Mon Mar 5 17:55:43 2007\n"
"PO-Revision-Date: 2007-03-05 18:01+0300\n"
"Last-Translator: Скоморох <skomoroh@gmail.com>\n"
"Language-Team: Russian <ru@li.org>\n"
"MIME-Version: 1.0\n"
@ -1104,6 +1104,10 @@ msgstr "Пять пирамид"
msgid "Flamenco"
msgstr "Фламенко"
#, fuzzy
msgid "Flipper"
msgstr "Dieppe"
msgid "Floating City"
msgstr "Плавающий город"
@ -1770,6 +1774,9 @@ msgstr "Le Grande Teton"
msgid "Legion"
msgstr "Легион"
msgid "Leprechaun"
msgstr ""
msgid "Les Quatre Coins"
msgstr "Les Quatre Coins"
@ -2840,7 +2847,7 @@ msgid "Princess Patience"
msgstr "Княжеский пасьянс"
msgid "Progression"
msgstr "Движение"
msgstr "Прогресс"
msgid "Provisions"
msgstr "Припасы"
@ -3149,6 +3156,10 @@ msgstr "Тенистые аллеи"
msgid "Shamrocks"
msgstr "Трилистники"
#, fuzzy
msgid "Shamrocks II"
msgstr "Трилистники"
msgid "Shamsher"
msgstr ""
@ -3506,6 +3517,10 @@ msgstr "Сад"
msgid "The Great Wall"
msgstr "Великая Стена"
#, fuzzy
msgid "The Jolly Roger"
msgstr "Дверь"
msgid "The Last Monarch"
msgstr "Последний Монарх"

File diff suppressed because it is too large Load diff

View file

@ -42,7 +42,7 @@ import traceback
from mfxutil import destruct, Struct
from mfxutil import pickle, unpickle, UnpicklingError
from mfxutil import getusername, gethomedir, getprefdir, EnvError
from mfxutil import latin1_to_ascii
from mfxutil import latin1_to_ascii, print_err
from mfxutil import Image
from util import Timer
from util import CARDSET, IMAGE_EXTENSIONS
@ -664,7 +664,7 @@ class Application:
elif self.commandline.game is not None:
gameid = self.gdb.getGameByName(self.commandline.game)
if gameid is None:
print >> sys.stderr, "WARNING: can't find game:", self.commandline.game
print_err(_("can't find game: ") + self.commandline.game)
else:
self.nextgame.id, self.nextgame.random = gameid, None
elif self.commandline.gameid is not None:
@ -1424,8 +1424,7 @@ Please select a %s type %s.
try:
loadGame(m.group(1), n)
except Exception, ex:
print >> sys.stderr, _("Error loading plugin %s: %s") % (n, ex)
sys.stderr.flush()
print_err(_("error loading plugin %s: %s") % (n, ex))
sys.path = p
@ -1456,8 +1455,9 @@ Please select a %s type %s.
return cs
def _parseCardsetConfig(self, cs, line):
_debug = True
def print_err(line, field=None, msg=''):
def perr(line, field=None, msg=''):
if not DEBUG:
return
if field:
print '_parseCardsetConfig error: line #%d, fields#%d %s' \
% (line, field, msg)
@ -1465,7 +1465,7 @@ Please select a %s type %s.
print '_parseCardsetConfig error: line #%d: %s' \
% (line, msg)
if len(line) < 6:
if _debug: print_err(1, msg='number of lines')
perr(1, msg='number of lines')
return 0
# line[0]: magic identifier, possible version information
fields = [f.strip() for f in line[0].split(';')]
@ -1474,64 +1474,64 @@ Please select a %s type %s.
if m: cs.version = int(m.group(1))
if cs.version >= 3:
if len(fields) < 5:
if _debug: print_err(1, msg='number of fields')
perr(1, msg='number of fields')
return 0
cs.ext = fields[2]
m = re.search(r"^(\d+)$", fields[3])
if not m:
if _debug: print_err(1, 3, 'not integer')
perr(1, 3, 'not integer')
return 0
cs.type = int(m.group(1))
m = re.search(r"^(\d+)$", fields[4])
if not m:
if _debug: print_err(1, 4, 'not integer')
perr(1, 4, 'not integer')
return 0
cs.ncards = int(m.group(1))
if cs.version >= 4:
if len(fields) < 6:
if _debug: print_err(1, msg='number of fields')
perr(1, msg='number of fields')
return 0
styles = fields[5].split(",")
for s in styles:
m = re.search(r"^\s*(\d+)\s*$", s)
if not m:
if _debug: print_err(1, 5, 'not integer')
perr(1, 5, 'not integer')
return 0
s = int(m.group(1))
if s not in cs.styles:
cs.styles.append(s)
if cs.version >= 5:
if len(fields) < 7:
if _debug: print_err(1, msg='number of fields')
perr(1, msg='number of fields')
return 0
m = re.search(r"^(\d+)$", fields[6])
if not m:
if _debug: print_err(1, 6, 'not integer')
perr(1, 6, 'not integer')
return 0
cs.year = int(m.group(1))
if len(cs.ext) < 2 or cs.ext[0] != ".":
if _debug: print_err(1, msg='invalid extention')
perr(1, msg='invalid extention')
return 0
# line[1]: identifier/name
if not line[1]:
if _debug: print_err(2, msg='empty line')
perr(2, msg='empty line')
return 0
cs.ident = line[1]
m = re.search(r"^(.*;)?([^;]+)$", cs.ident)
if not m:
if _debug: print_err(2, msg='invalid format')
perr(2, msg='invalid format')
return 0
cs.name = m.group(2).strip()
# line[2]: CARDW, CARDH, CARDD
m = re.search(r"^(\d+)\s+(\d+)\s+(\d+)", line[2])
if not m:
if _debug: print_err(3, msg='invalid format')
perr(3, msg='invalid format')
return 0
cs.CARDW, cs.CARDH, cs.CARDD = int(m.group(1)), int(m.group(2)), int(m.group(3))
# line[3]: CARD_UP_YOFFSET, CARD_DOWN_YOFFSET, SHADOW_XOFFSET, SHADOW_YOFFSET
m = re.search(r"^(\d+)\s+(\d+)\s+(\d+)\s+(\d+)", line[3])
if not m:
if _debug: print_err(4, msg='invalid format')
perr(4, msg='invalid format')
return 0
cs.CARD_XOFFSET = int(m.group(1))
cs.CARD_YOFFSET = int(m.group(2))
@ -1540,7 +1540,7 @@ Please select a %s type %s.
# line[4]: default background
back = line[4]
if not back:
if _debug: print_err(5, msg='empty line')
perr(5, msg='empty line')
return 0
# line[5]: all available backgrounds
cs.backnames = [f.strip() for f in line[5].split(';')]

View file

@ -152,6 +152,7 @@ class ScotchPatience(Fan):
# /***********************************************************************
# // Shamrocks
# // Shamrocks II
# ************************************************************************/
class Shamrocks(Fan):
@ -160,6 +161,27 @@ class Shamrocks(Fan):
Fan.createGame(self, playcards=4)
shallHighlightMatch = Game._shallHighlightMatch_RK
class ShamrocksII(Shamrocks):
def _shuffleHook(self, cards):
# move Kings to bottom of each stack
i, n = 0, 17
kings = []
for c in cards:
if c.rank == KING:
kings.append(i)
i += 1
for i in kings:
if i == 51:
continue
j = i % n
while j < i:
if cards[j].rank != KING:
cards[i], cards[j] = cards[j], cards[i]
break
j += n
cards.reverse()
return cards
# /***********************************************************************
# // La Belle Lucie (Midnight Oil)
@ -774,4 +796,6 @@ registerGame(GameInfo(625, FascinationFan, "Fascination Fan",
GI.GT_FAN_TYPE, 1, 6, GI.SL_BALANCED))
registerGame(GameInfo(647, Crescent, "Crescent",
GI.GT_FAN_TYPE, 2, 3, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(714, ShamrocksII, "Shamrocks II",
GI.GT_FAN_TYPE | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL))

View file

@ -167,7 +167,7 @@ class Whitehead_RowStack(SS_RowStack):
def _isAcceptableSequence(self, cards):
return isSameColorSequence(cards, self.cap.mod, self.cap.dir)
def getHelp(self):
return _('Tableau. Build down by color.')
return _('Tableau. Build down by color. Sequences of cards in the same suit can be moved as a unit.')
class Whitehead(Klondike):
RowStack_Class = Whitehead_RowStack
@ -180,6 +180,7 @@ class Whitehead(Klondike):
Klondike.startGame(self, flip=1)
shallHighlightMatch = Game._shallHighlightMatch_SS
getQuickPlayScore = Game._getSpiderQuickPlayScore
# /***********************************************************************

View file

@ -41,6 +41,7 @@ import getopt
# PySol imports
from util import DataLoader
from mfxutil import print_err
from resource import Tile
from app import Application
from pysolaudio import AbstractAudioClient, PysolSoundServerModuleClient
@ -87,8 +88,8 @@ def parse_option(argv):
"sound-mod=",
"help"])
except getopt.GetoptError, err:
print >> sys.stderr, _("%s: %s\ntry %s --help for more information") \
% (prog_name, err, prog_name)
print_err(_("%s\ntry %s --help for more information") %
(err, prog_name), 0)
return None
opts = {"help" : False,
"game" : None,
@ -131,11 +132,15 @@ def parse_option(argv):
return None
if len(args) > 1:
print >> sys.stderr, _("%s: too many files\ntry %s --help for more information") % (prog_name, prog_name)
print_err(
_("too many files\ntry %s --help for more information") %
prog_name, 0)
return None
filename = args and args[0] or None
if filename and not os.path.isfile(filename):
print >> sys.stderr, _("%s: invalid file name\ntry %s --help for more information") % (prog_name, prog_name)
print_err(
_("invalid file name\ntry %s --help for more information") %
prog_name, 0)
return None
return opts, filename
@ -173,8 +178,8 @@ def pysol_init(app, args):
if opts['gameid'] is not None:
try:
app.commandline.gameid = int(opts['gameid'])
except:
print >> sys.stderr, 'WARNING: invalid game id:', opts['gameid']
except ValueError:
print_err(_('invalid game id: ') + opts['gameid'])
# init games database
import games

View file

@ -35,7 +35,7 @@
# imports
import os, time, types
import sys, os, time, types, locale
import webbrowser
try:
@ -48,7 +48,8 @@ try:
except:
thread = None
from settings import TOOLKIT
from settings import PACKAGE, TOOLKIT
Image = ImageTk = ImageOps = None
if TOOLKIT == 'tk':
try: # PIL
@ -108,6 +109,15 @@ def format_time(t):
return "%d:%02d:%02d" % (t / 3600, (t % 3600) / 60, t % 60)
def print_err(s, level=1):
if level == 0:
ss = PACKAGE+': ERROR:'
elif level == 1:
ss = PACKAGE+': WARNING:'
print >> sys.stderr, ss, s.encode(locale.getpreferredencoding())
sys.stderr.flush()
# /***********************************************************************
# // misc. portab stuff
# ************************************************************************/

View file

@ -79,6 +79,9 @@ class StatsDialog(MfxDialog):
self.font = app.getFont('default')
self.tkfont = tkFont.Font(parent, self.font)
self.font_metrics = self.tkfont.metrics()
style = Tkinter.Style()
self.heading_font = style.lookup('Heading', 'font') # treeview heading
self.heading_tkfont = tkFont.Font(parent, self.heading_font)
self.selected_game = None
@ -339,7 +342,7 @@ class TreeFormatter(PysolStatsFormatter):
self._tabs = [tw]
font = self.tkfont
for t in arg[1:]:
tw = font.measure(t)+20
tw = font.measure(t)+8
self._tabs.append(tw)
self._tabs.append(10)
self.parent_window.tree_tabs = self._tabs
@ -486,7 +489,8 @@ class AllGamesFrame(Tkinter.Frame):
self.tree.delete(tuple(self.tree_items))
self.tree_items = []
formatter = TreeFormatter(self.app, self.tree, self,
self.dialog.tkfont, self.CHAR_W, self.CHAR_H)
self.dialog.heading_tkfont,
self.CHAR_W, self.CHAR_H)
formatter.writeStats(player, sort_by=self.sort_by)
if self.dialog.buttons:
run_button = self.dialog.buttons[0]
@ -724,15 +728,7 @@ class TopFrame(Tkinter.Frame):
left_label = Tkinter.Label(self, image=app.gimages.logos[5])
left_label.pack(side='left', expand=True, fill='both')
frame = Tkinter.LabelFrame(self, text='All games',
padding=(10,5,10,10))
frame.pack(side='top', expand=True, fill='x', padx=10, pady=10)
##frame.columnconfigure(0, weight=1)
if not self.createTopFrame(frame, player, 'all'):
Tkinter.Label(frame, text=_('No TOP for all games')
).pack(padx=10, pady=10)
frame = Tkinter.LabelFrame(self, text='Current game',
frame = Tkinter.LabelFrame(self, text=_('Current game'),
padding=(10,5,10,10))
frame.pack(side='top', expand=True, fill='x', padx=10, pady=10)
##frame.columnconfigure(0, weight=1)
@ -740,6 +736,14 @@ class TopFrame(Tkinter.Frame):
Tkinter.Label(frame, text=_('No TOP for this game')
).pack(padx=10, pady=10)
frame = Tkinter.LabelFrame(self, text=_('All games'),
padding=(10,5,10,10))
frame.pack(side='top', expand=True, fill='x', padx=10, pady=10)
##frame.columnconfigure(0, weight=1)
if not self.createTopFrame(frame, player, 'all'):
Tkinter.Label(frame, text=_('No TOP for all games')
).pack(padx=10, pady=10)
def createTopFrame(self, frame, player, gameid):
app = self.app

View file

@ -25,6 +25,7 @@ from pysollib.settings import PACKAGE
from pysollib.settings import FC_VERSION as VERSION
from pysollib.settings import TOOLKIT, USE_TILE
from pysollib.settings import DEBUG
from pysollib.mfxutil import print_err
from pysollib.tile import Tile
@ -48,7 +49,7 @@ def set_theme(app, top, theme):
style = Tile.Style(top)
all_themes = style.theme_names()
if theme not in all_themes:
print >> sys.stderr, 'WARNING: invalid theme name:', theme
print_err(_('invalid theme name: ') + theme)
theme = app.opt.default_tile_theme
style.theme_use(theme)
@ -61,7 +62,7 @@ def get_font_name(font):
try:
f = Font(font=font)
except:
print >> sys.stderr, 'invalid font name:', font
print_err(_('invalid font name: ') + font)
if DEBUG:
traceback.print_exc()
else:

View file

@ -21,6 +21,8 @@
import sys, os
import tkFont
from pysollib.settings import PACKAGE
from pysollib.settings import TOOLKIT, USE_TILE
from pysollib.tile import Tile
@ -62,6 +64,9 @@ class initRootWindow(baseInitRootWindow):
root.option_add('*font', font)
style.configure('.', font=font)
app.opt.fonts['default'] = fn
# treeview heading
f = root.tk.splitlist(root.tk.call('font', 'actual', fn))
root.tk.call('font', 'configure', 'TkHeadingFont', *f)
else:
# use font from Tile settings
font = style.lookup('.', 'font')