Commit Graph

3502 Commits

Author SHA1 Message Date
Mika Bostrom
3b1e67e78b Store names as UTF-8
The names should be always in UTF-8 encoding. At least for PostgreSQL
the encdoding of the database comes from the time of running 'initdb'
(which is different from 'createdb') and if the encoding was selected or
set to something else at that time, the following error will occur:

  File ".../pyfpdb/Database.py", line 1630, in <lambda>
    self.pcache = LambdaDict(lambda  key:self.insertPlayer(key, siteid))
  File ".../pyfpdb/Database.py", line 1661, in insertPlayer
    c.execute (q, (site_id, _name))
  File "/usr/lib/python2.5/encodings/iso8859_15.py", line 12, in encode
    return codecs.charmap_encode(input,errors,encoding_table)
UnicodeEncodeError: 'charmap' codec can't encode character u'\u2122' in
position 10: character maps to <undefined>

This happens because 'name' is a regular string as opposed to a valid
unicode object. By forcing the string to unicode and encoding it in
UTF-8 the error goes away. In my case the database encoding was
ISO-8859-15 (latin9) but any other "wrong" encoding would trigger the
same problem.

This is a relatively common problem in python.
2009-12-24 09:52:47 +02:00
Gerko de Roo
9a145e14ad Hmm forgot the color reset to default.
There must be a better methode
2009-12-23 21:44:55 +01:00
Gerko de Roo
7a17d96a89 Added color highlight for stats window.
high and low threshold and color can be set in the xml file
2009-12-23 21:15:55 +01:00
Gerko de Roo
f1e6b597a2 search string for table detect changed 2009-12-23 21:12:56 +01:00
Gerko de Roo
207277e55a merged 2009-12-23 20:42:48 +01:00
Gerko de Roo
bb650e81a9 import latest 2009-12-23 20:40:29 +01:00
Worros
f8dccd43a3 Add ability to import Stars archive files.
PokerStars support can provide a HH archive. The format is similar but not the same as a a standard hh format as it contains an additional line "Hand #X" between each hand.

Patch adds an option -s to GuiBulkImport, which when specified will strip these lines out and continue parsing.
2009-12-24 03:10:07 +08:00
Worros
4c49d7163b [NEWIMPORT] Syntax fix 2009-12-24 03:09:13 +08:00
Worros
ff88823c1a [NEWIMPORT] Fix syntax to be 2.5 compatible.
Python 2.6 enumerate() function contains a useful 'start' paramater,
apparently this did not exist in 2.5.

Patch frim Mika Bostrom
2009-12-24 03:09:13 +08:00
Worros
9650fe7a0d [NEWIMPORT] Add stubbed variable to insert 2009-12-24 03:09:13 +08:00
Worros
ff0872f8de Add some code to kinda detect hand cancellation
hhc.readHandInfo(self)
hhc.readPlayerStacks(self)
hhc.compilePlayerRegexs(self)
hhc.markStreets(self)

Is the order, the first correctly failing regex is markStreets
2009-12-24 03:09:12 +08:00
Worros
e18af681cb Add test hand - Hand cancelled 2009-12-24 03:09:12 +08:00
Worros
f829ed937e [NEWIMPORT] Move hud call to after database commit
HUD still doesn't quite work, but getting closer - suspect hud_cache rebuild isn't happening
2009-12-24 03:09:11 +08:00
Worros
03deefc1a3 [NEWIMPORT] Fix thinko on insertPlayer
Was returning the player name instead of id in the case where the player exists in the database, but wasn't cached already

Removing some merge gunge too
2009-12-24 03:09:11 +08:00
Worros
72cf9a61ca [NEWIMPORT] Add a commit at the end of the fpdb_import cycle 2009-12-24 03:09:10 +08:00
Worros
5e4cc1c5eb [NEWIMPORT] 'correct' the type for wonWhenSeenStreet1 2009-12-24 03:09:10 +08:00
Worros
a717eb437c [NEWIMPOR] Fix insert type for wonAtSD 2009-12-24 03:09:10 +08:00
Worros
c1464d64ff [NEWIMPORT] Fix startCash fix 2009-12-24 03:09:09 +08:00
Worros
b3d6da8339 [NEWIMPORT] Convert start stack to cents 2009-12-24 03:09:09 +08:00
Worros
f527fe60a8 Fix a couple of typos 2009-12-24 03:09:08 +08:00
Worros
22a0c75adf Fix thinko in stub 2009-12-24 03:09:08 +08:00
Worros
318cd10551 [NEWIMPORT] Move HandsPlayers insert statement into SQL.py 2009-12-24 03:09:08 +08:00
Worros
0b711628f9 [NEWIMPORT] Stub remaining HandsPlayers stats 2009-12-24 03:09:04 +08:00
sqlcoder
d0725f8787 reload profile after editing Prefs if no other tabs are open, otherwise suggest restart 2009-12-24 03:09:03 +08:00
Carl Gherardi
e62c47f963 [NEWIMPORT] Move database prep into prepInsert 2009-12-24 03:09:03 +08:00
Carl Gherardi
c8734604c7 [NEWIMPORT] Enable printInsert, disable hud pipe 2009-12-24 03:09:02 +08:00
sqlcoder
2470b9a292 add name to nodes 2009-12-24 03:09:02 +08:00
sqlcoder
eaa698eb1a default guiprefs window to larger size 2009-12-24 03:09:02 +08:00
Worros
3584e6dcc1 [NEWIMPORT] Add call to HUD for auto import
Make sure the matching db_handid is recorded in the Hand object for later use
2009-12-24 03:09:00 +08:00
Worros
135a6eaf20 Add test for Stars sawShowdown.
Test currently fails in the old import code and passes on NEWIMPORT

Tests for uncalled allin bet on river, which has been erronously marked as showdown previously
2009-12-24 03:08:59 +08:00
Worros
d4989fcd11 Make test file use real database.
Please note this could be destructive
2009-12-24 03:08:56 +08:00
Worros
68b4ebdb57 [NEWIMPORT] Fix sawShowdown stat 2009-12-24 03:08:55 +08:00
Mika Bostrom
1d53e32f1e Enclose dict key lookup in try-except block
Some recent changes moved the dictionary access outside try-except block
again. Widen the block enough again.
2009-12-24 03:08:55 +08:00
sqlcoder
9cade44472 move print message to log 2009-12-24 03:08:53 +08:00
Worros
b3f1fc2f8c Add beginings of test for sawShowdown - unfinished.
Some sort of weird commit problem going on. Conmmitiing to work on htat
2009-12-24 03:08:52 +08:00
Worros
7212760c67 Newimport - comments for a getPosition function.
Decided that I needed some test functions before I kick on
2009-12-24 03:08:51 +08:00
Worros
3f30878bbd [NEWIMPORT] Partially fix number of hands parsed reporting 2009-12-24 03:08:51 +08:00
Eric Blade
a6429957fe comment out some prints, apparently mysqlcoder and my editors do not agree well with each other on spacing. 2009-12-24 03:08:50 +08:00
Eric Blade
5913c9092a Add some basic error handling at the very beginning of startup, to deal with missing imports and such, update about box 2009-12-24 03:08:50 +08:00
Worros
117c377fff Repair recent damage to Options 2009-12-24 03:08:49 +08:00
sqlcoder
48c36c319b improve rebuild hudcache and indexes dialogs 2009-12-24 03:08:48 +08:00
Eric Blade
c38efd61ef trap IOError on hud pipe write when hud closed without autoimport stopping, turn off hud 2009-12-24 03:08:48 +08:00
Eric Blade
d3d8b4afbb ttime = float with us to ms resolution 2009-12-24 03:08:47 +08:00
Eric Blade
b3d2a95796 fix return tuple in import_file_dict, fix text from autoimport to actually show up in autoimport window 2009-12-24 03:08:44 +08:00
Mika Bostrom
17aae75f01 Merge branch 'stats' of git://git.assembla.com/fpdboz into newstats 2009-12-23 19:25:06 +02:00
Worros
0adf0a7b18 [NEWIMPORT] updateHudCache update.
Fix a couple of bugs:
    position != 2 its = 'M'
    actually commit changes to hud
2009-12-24 01:12:39 +08:00
Mika Bostrom
00305e34b6 Merge branch 'stats' of git://git.assembla.com/fpdboz into newstats 2009-12-23 17:30:54 +02:00
Worros
a0475aa4db [NEWIMPORT] Add function to update hudcache for Hand 2009-12-23 23:14:34 +08:00
Worros
a2d0657b3a [NEWIMPORT] Remove unused functions
Move old HudCache update over in preparation for fixing
2009-12-23 13:56:18 +08:00
Worros
6e9153c25c [NEWIMPORT] Copy Grigorij's code from Alchemy
Copied some of Grigorij's code verbatim for calculating additional stats, still needs adapting.

Also reorder some functions so the corresponding files are more mergeable in future.
2009-12-23 13:30:12 +08:00