Commit Graph
100 Commits
Author SHA1 Message Date
Mika Bostrom cc3811b8aa Add missing import
GuiPlayerStats.py didn't import the new Charset module but tried to use
the functions.
2010-01-24 13:24:26 +01:00
Mika Bostrom 3a03bc51a2 Some character set improvements
The strings (names) as stored in database should always be UTF-8;
whatever the display locale is, we then need to convert from the storage
encoding to session encoding. When making database queries with players
names in them, the names must be reconverted to UTF-8.
2010-01-23 16:34:24 +01:00
Mika Bostrom cd71778975 Fix name display in HUD popup
The names are stored in UTF-8, so simply converting the name from UTF-8
to Configuration.LOCALE_ENCODING before putting the string in tooltip is
enough. Neat.
2010-01-21 13:56:50 +08:00
Mika Bostrom 478b82587d 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-29 13:05:03 +08:00
Mika Bostrom 20de6fe730 Clean up about window
Remove duplicates
2009-12-13 16:12:29 +02:00
Mika Bostrom fcf14f9100 Merge own master 2009-12-10 06:47:13 +02:00
Mika Bostrom 835fc98f6f Cosmetic fix
About -> Credits takes a list of strings in .set_authors() as opposed to
a single string. Now the credit popup looks about right.
2009-12-10 06:41:15 +02:00
Mika Bostrom 128fa2f356 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-06 14:08:27 +02:00
Mika Bostrom a0a6207810 Fix profit graph query
At least postgresql requires to have grouping by hp.sawShowdown as well
2009-12-02 12:29:48 +02:00
Mika Bostrom 2f742e371b Use wider try-except block
The 'temp_key' table name in hud_dict can vanish between DB roundtrips.
Enclose all three lines within try-block.
2009-11-28 10:59:44 +02:00
Mika Bostrom 81e77ebfcf Merge branch 'master' into hudfix 2009-11-28 10:58:23 +02:00
Mika Bostrom 6dec7f38f3 Fix a stupid syntax error
Use python's format-string syntax.
2009-11-27 22:21:45 +02:00
Mika Bostrom df6d9a0a56 Fix missing checks before .set_active()
Some validity tests were still missing. Also, typofix:
self.cbFl -> self.cbFL
2009-11-26 23:07:58 +02:00
Mika Bostrom cb9e2cb6e7 Try to fix two HUD main hangs
The main HUD process can hang due to unhandled exceptions, which
occurred in two separate situations:

1. Table window is closed and HUD instance killed before auto-importer
knows about it
2. Sometimes the threading can jam

These changes attempt to counter the effect of race-conditions. The
dictionary key (table name) is properly tested at the beginning of
update/create block, *but* there are two short round-trips to database
before the key is used. While these occur, the HUD instance can vanish
and thus get its key removed from the dictionary.

Also, when Tables.Table() is created, it will be populated on-demand,
and have child attributes only when such are found from the system. The
new table code pulls in data from actual windows. Again, there is a
query involved and while it runs, the table may have vanished. This
ended up as an error in this call:

foo = gtk.gdk.window_foreign_new(table.number)

The object 'table' is valid (not None) but it has been populated only
after actual table window was killed. Therefore it may not have .number
attribute, which raised an AttributeError. Now the presence of
table.number attribute is tested before the object can be sent to
create_HUD().
2009-11-25 20:31:02 +02:00
Mika Bostrom c7342e4b0f Test the correct attribute
When testing for Tables.Table validity, we actually care about the
'number' attribute, because that gets passed around on create_HUD()
2009-11-25 15:31:45 +02:00
Mika Bostrom a7163f5f8c Move return value outside try-finally block
The return value is for Glib/GTK event loop, so it should be after
try-finally sequence. The value needs to be returned every time and we
really like to have threads_enter()/threads_leave() to be invoked in
pairs.
2009-11-25 14:42:17 +02:00
Mika Bostrom 9e23346e5b Merge branch 'master' into hudfix 2009-11-25 14:41:01 +02:00
Mika Bostrom 5435c164f9 Merge branch 'master' of git://git.assembla.com/fpdboz 2009-11-25 14:40:50 +02:00
Mika Bostrom 9c591da893 Saner exit for thread-unsafe code
It can't be right that we return from threads_enter() before releasing
the global lock. Exit works properly for failure (try-finally).
2009-11-25 11:10:34 +02:00
Mika Bostrom df8e0a5899 Merge branch 'master' into hudfix 2009-11-25 08:50:30 +02:00
Mika Bostrom 8d64a720c4 Merge branch 'master' of git://git.assembla.com/fpdboz 2009-11-25 08:50:08 +02:00
Mika Bostrom 752e50ad4c Better test
Built-in function hasattr() deals with and hides the exception
2009-11-25 07:26:26 +02:00
Mika Bostrom 92918df8c5 Attempt to catch the final race
Table attributes are pulled from database but the table window itself
may have disappeared. The search parameters no longer match because
there is no window title to match against, so some attributes are not
set at all.
2009-11-25 00:12:07 +02:00
Mika Bostrom 4db9ec7e79 Merge branch 'master' into hudfix 2009-11-24 19:42:48 +02:00
Mika Bostrom 48930e1679 Merge branch 'master' of git://git.assembla.com/fpdboz 2009-11-24 19:42:39 +02:00
Mika Bostrom 52d8578841 Try to fix HUD hangs 2009-11-24 10:57:03 +02:00
Mika Bostrom 175366934b Merge branch 'good' into hudfix 2009-11-24 10:56:07 +02:00
Mika Bostrom d2c25b6d28 Fix simple error in filter code
Other parts test that the object is valid before calling
.set_active(); follow convention to eliminate needless errors
2009-11-21 23:51:18 +02:00
Mika Bostrom 615d1ea8a6 Add default style keys
It seems there is some weird way for stylekeys to remain unset. Catch
the special case and have a way to see why this happens.
2009-11-20 08:48:49 +02:00
Mika Bostrom 8ddbe15087 Merge branch 'master' of git://git.assembla.com/fpdboz 2009-11-20 08:29:43 +02:00
Mika Bostrom 9823221def Merge branch 'master' of git://git.assembla.com/fpdboz 2009-11-19 12:40:49 +02:00
Mika Bostrom ea3edb6f18 Merge branch 'master' of git://git.assembla.com/free_poker_tools 2009-11-16 20:05:22 +02:00
Mika Bostrom 2a8eaa676a Merge branch 'master' of git://git.assembla.com/free_poker_tools 2009-11-16 18:19:31 +02:00
Mika Bostrom df26fb5fc0 Merge branch 'master' of git://git.assembla.com/fpdboz 2009-11-16 14:08:39 +02:00
Mika Bostrom 6a44f1d5e2 Merge branch 'master' of git://git.assembla.com/free_poker_tools 2009-11-15 00:40:38 +02:00
Mika Bostrom e6f834e617 Catch missing table (key) in hud_dict
This may be the cause of hud and/or main app hanging when import is
stopped
2009-11-14 10:56:02 +02:00
Mika Bostrom 7f31b844ca Merge branch 'master' of git://git.assembla.com/free_poker_tools 2009-11-12 09:59:40 +02:00
Mika Bostrom 824a102691 Merge branch 'master' of git://git.assembla.com/free_poker_tools 2009-11-10 09:00:17 +02:00
Mika Bostrom 33357447be Merge branch 'master' of git://git.assembla.com/free_poker_tools 2009-11-07 08:11:01 +02:00
Mika Bostrom 17a1151954 Update debian packaging
The new table code is saner, cleaner and altogether nicer than the old
one. On linux, the routines finally use Xlib directly. Depend on
python-xlib bindings so we can use them.
2009-11-06 09:56:45 +02:00
Mika Bostrom 62a624a25a Merge branch 'master' of git://git.assembla.com/free_poker_tools 2009-11-05 20:05:44 +02:00
Mika Bostrom 0533c2f19a Merge branch 'master' of git://git.assembla.com/fpdb-eric 2009-11-04 20:24:48 +02:00
Mika Bostrom 344074d26a Merge branch 'master' of git://git.assembla.com/free_poker_tools 2009-11-04 10:54:26 +02:00
Mika Bostrom 6682edb4c0 Merge branch 'master' of git://git.assembla.com/fpdb-eric 2009-11-04 10:54:21 +02:00
Mika Bostrom 39fdcd6be3 Merge branch 'master' of git://git.assembla.com/fpdb-eric 2009-11-03 22:17:27 +02:00
Mika Bostrom 27d5ea6e6a Merge branch 'master' of git://git.assembla.com/fpdboz 2009-11-02 19:07:10 +02:00
Mika Bostrom a4c605bb92 Merge branch 'master' of git://git.assembla.com/free_poker_tools 2009-11-01 21:41:06 +02:00
Mika Bostrom 8bb5d53d7e Merge branch 'master' of git://git.assembla.com/fpdb-eric 2009-11-01 14:20:03 +02:00
Mika Bostrom 2b0d360c44 Merge branch 'master' of git://git.assembla.com/free_poker_tools 2009-11-01 14:19:54 +02:00
Mika Bostrom 0615efcf4a Merge branch 'master' of git://git.assembla.com/fpdboz 2009-10-31 08:02:49 +02:00
Mika Bostrom 485180779f Merge branch 'master' of git://git.assembla.com/fpdboz 2009-10-30 23:13:54 +02:00
Mika Bostrom ca5fea5cc5 Fix HUD start from debianized install 2009-10-30 01:51:57 +02:00
Mika Bostrom 677ec5551c Merge branch 'master' into good 2009-10-27 19:48:00 +02:00
Mika Bostrom 9886b61840 Tray icon click toggles window visibility
Many of the tools that place an icon in systray allow to toggle the
application visibility by left-clicking on the icon. Why not follow
suit?
2009-10-27 19:45:52 +02:00
Mika Bostrom fe53e8c8a7 Merge branch 'master' into good 2009-10-27 15:28:40 +02:00
Mika Bostrom 15980877dd Typofix in status icon load 2009-10-27 15:28:11 +02:00
Mika Bostrom e25e4cf9b3 Use custom tray icon instead of GTK stock
Use the "Anonymous Cards" image from openclipart.org
(http://openclipart.org/media/files/Anonymous/12230)

This same image is used in other new FPDB icons, but the combinations
with looking-glass don't look good in systray. This icon is plain enough
to work properly even when scaled really small.
2009-10-27 15:24:49 +02:00
Mika Bostrom 879506cee4 Merge branch 'master' into good 2009-10-27 06:26:25 +02:00
Mika Bostrom cba416e27a Merge branch 'master' of git://git.assembla.com/free_poker_tools 2009-10-27 06:26:04 +02:00
Mika Bostrom ca8182c37d Merge branch 'master' into good 2009-10-27 06:08:19 +02:00
Mika Bostrom fcaa1030b6 Merge branch 'master' of git://trac-git.assembla.com/fpdb-sql 2009-10-27 05:53:47 +02:00
Mika Bostrom dabbcc2d47 Merge branch 'master' of git://git.assembla.com/fpdboz 2009-10-27 05:49:59 +02:00
Mika Bostrom 3435cb106e Bump version to 0.12 in packaging 2009-10-26 17:49:37 +02:00
Mika Bostrom 7b6581de7d Merge branch 'master' into good 2009-10-26 17:09:06 +02:00
Mika Bostrom 35b24fa002 Remove a stray conflict marker 2009-10-26 16:53:18 +02:00
Mika Bostrom 27fa27f370 GTK signal handlers need to return True/False
Since we deal with minimize/expose/show/hide routines ourselves, we
don't want these signals passed any further.

NOTE: if no return type is specified, it is automatically None which
usually is translated to False. That might trigger some weird behaviour,
up to and including rare and hard to reproduce GTK crashes.
2009-10-26 13:29:32 +02:00
Mika Bostrom bb6b2ab9a2 Fix session timestamp range
PostgreSQL does automatic argument conversion/formatting when dealing
with timestamps. This simplification allows the session stats to be
generated with PostgreSQL as db backend.
2009-10-26 12:55:23 +02:00
Mika Bostrom 73262e808c Merge branch 'master' of git://git.assembla.com/fpdboz 2009-10-26 12:18:37 +02:00
Mika Bostrom 70426a70a0 Merge branch 'master' of git://git.assembla.com/fpdb-eric 2009-10-26 12:12:56 +02:00
Mika Bostrom 1dda03fda0 Merge branch 'master' of git://git.assembla.com/fpdboz 2009-10-25 21:40:55 +02:00
Mika Bostrom 2ff0935aff Include example config file in debian package 2009-10-23 13:06:33 +03:00
Mika Bostrom 6ec309a685 Provide extra path for mucked cards image
Modified:
* Mucked.py

When running from outside source tree, the image containing mucked
cards' faces could not be loaded. Provide an extra path to load from.
2009-10-22 08:44:45 +03:00
Mika Bostrom 616c07a4eb Merge branch 'master' of git://git.assembla.com/fpdboz 2009-10-21 20:29:44 +03:00
Mika Bostrom b8f19741e0 Fix packaging issues
Affected files:
* Configuration.py
* Database.py
* HandHistoryConverter.py
* fpdb_import.py

and setup.py to a lesser extent.

Logging requires a configuration file when initialising the class. If we
are executing from outside the source tree, this file is not present.
Catch config parser's error and try to provide the logging config file
from debian package path.

Update symlink target to match python-support from latest Debian and the
oncoming Ubuntu versions.
2009-10-21 20:24:46 +03:00
Mika Bostrom 89aa0fb726 Move other files to non-packaging 2009-10-21 16:42:34 +03:00
Mika Bostrom 690c00470b Add .desktop file 2009-10-21 10:18:34 +03:00
Mika Bostrom ca714ddd54 Icon graphics
Pick up graphics from icontest branch. These may be used for packaging
improvements
2009-10-21 09:19:36 +03:00
Mika Bostrom 019440a71b Merge branch 'master' into good
Conflicts:
	pyfpdb/Configuration.py
	pyfpdb/HUD_config.xml.example
2009-10-15 09:06:31 +03:00
Mika Bostrom 54d309f797 Minor fixes to hud setup code 2009-10-14 19:33:19 +03:00
Mika Bostrom a232a94eb1 Try to make hud more configurable
Modified files:
* Configuration.py
* HUD_config.xml.example
* HUD_main.py

Instead of tweaking aggregation settings directly in code, make the
values configurable through HUD_config.xml; use the newly created
<hud_ui> element for this. Retain coding convention and key-value
names as they are.
2009-10-14 16:04:09 +03:00
Mika Bostrom b3ab2c3b81 Merge branch 'master' of git://trac-git.assembla.com/fpdb-sql 2009-10-14 10:05:38 +03:00
Mika Bostrom f6016c1c0e Merge branch 'master' of git://trac-git.assembla.com/fpdb-sql 2009-10-13 10:23:48 +03:00
Mika Bostrom e1cc4d59eb Merge branch 'master' of git://git.assembla.com/fpdb-eric 2009-10-10 09:22:19 +03:00
Mika Bostrom 4634468b67 Merge branch 'master' of git://git.assembla.com/fpdboz 2009-10-10 09:13:38 +03:00
Mika Bostrom 2bc9fd59a9 Merge branch 'master' of git://trac-git.assembla.com/fpdb-sql 2009-10-10 09:13:18 +03:00
Mika Bostrom f6e1926679 Merge branch 'master' of git://trac-git.assembla.com/fpdb-sql 2009-10-07 19:59:45 +03:00
Mika Bostrom f6eb365b3c Add the default box text to example config
Now that the text on HUD's box is configurable, move the default text
from code to default/sample config.
2009-10-03 21:18:49 +03:00
Mika Bostrom 14122770ef Make hud's menu-area text configurable
By default the hud positions a little box on top-left corner of each
table. Make the text in this box user-modifiable without touching the
source.

Most likely useful for active users and those who play with smaller
tables. On shrunk table the default box may cover some of the players'
cards.
2009-10-03 21:18:39 +03:00
Mika Bostrom c77e143436 Add the default box text to example config
Now that the text on HUD's box is configurable, move the default text
from code to default/sample config.
2009-10-03 21:10:09 +03:00
Mika Bostrom 18cc51ba7a Make hud's menu-area text configurable
By default the hud positions a little box on top-left corner of each
table. Make the text in this box user-modifiable without touching the
source.

Most likely useful for active users and those who play with smaller
tables. On shrunk table the default box may cover some of the players'
cards.
2009-10-03 21:05:41 +03:00
Mika Bostrom 7eb368f221 Debian package: architecture any -> all
The installed files are scripts and even the bytecode versions are
generated on install. There is no need to build arch-dependent packages.
2009-10-03 08:17:41 +03:00
Mika Bostrom a1d5f2292f Merge branch 'master' of git://trac-git.assembla.com/fpdb-sql 2009-10-03 00:57:25 +03:00
Mika Bostrom e4969820b8 Merge branch 'master' of git://trac-git.assembla.com/fpdb-sql 2009-09-30 20:27:17 +03:00
Mika Bostrom 432c24173e Merge branch 'master' of git://trac-git.assembla.com/fpdb-sql 2009-09-29 09:11:33 +03:00
Mika Bostrom 5260f5c384 Merge branch 'master' of git://trac-git.assembla.com/fpdb-sql
Conflicts:
	pyfpdb/Database.py

Resolve by reverting to sqlcoder's version; it uses the nice insert in
fillDefaultData for each case now and having the DB backends separate
might be good for the foreseeable future.
2009-09-28 18:07:08 +03:00
Mika Bostrom 6f536d29e7 Fix import on PostgreSQL
Database.py : fillDefaultData()

Remove manual 'id' from INSERT command. In database schema,
TourneyTypes.id is a primary key and thus autoincrement. In postgres,
autoincrements are implemented as sequences - inserting a value
"manually" bypasses the sequence generation, which resulted in a
remarkably weird error.

Namely, upon the first hand to import, the insert fails due to primary
key violation. The default value from an unused sequence is 1, but a
row with such an id already exists.

The solution is to create the single row of default data values with
unspecified TourneyTypes.id, hence allowing postgres to generate the
correct id from the sequence. This way the import works again.
2009-09-24 07:08:32 +03:00
Mika Bostrom df71dcf2c7 Fix knockout variable type
fpdb_parse_logic.py : recogniseTourneyTypeId()

The column in table is of type 'boolean' but the default value was
integer '0'; this triggered an error
2009-09-23 23:44:57 +03:00
Mika Bostrom 00f8b34fff Simplify database creation
Database.py : fillDefaultData()

Sql-coder had fixed the default data insert, and in the process changed
the default type ID. Since his works in general case, I can remove my
modifications.
2009-09-23 23:36:17 +03:00
Mika Bostrom 1351cd6dd9 Use cleaner syntax in fillDefaultData 2009-09-21 15:31:19 +03:00
Mika Bostrom e54c45b7d1 Fix database creation with Postgres
* Database.py : fillDefaultData()

PostgreSQL has a rather annoying (mis)feature when dealing with boolean
data types: raw 1/0 input as integer is not automatically cast to
boolean values. Instead, one must use one of several other ways of
signifying true/false.
http://www.postgresql.org/docs/8.4/static/datatype-boolean.html
documents the available and understood formatting.

Fix by special-casing PostgreSQL and making all boolean values fed as
strings, '1' for true and '0' for false.
2009-09-19 11:44:06 +03:00