Commit Graph
100 Commits
Author SHA1 Message Date
Mika Bostrom 8d78e11a4f Add support for specifying DB port
In case someone needs to connect to a DB engine in non-standard port,
defining the TCP port is required. This is a rare corner case which
should only arise when a given DB host runs multiple versions of the
same DB engine.

However, the support is relatively straightforward to implement and it
shouldn't conflict with any other options.
2011-01-16 10:43:36 +02:00
Mika Bostrom 02a087c5b0 Merge branch 'steffen' 2011-01-01 16:07:14 +02:00
Mika Bostrom 0a256f18a3 Update debian/changelog for 0.21-rc2 2010-12-28 18:38:33 +02:00
Mika Bostrom a9c0593eb5 Demote postgres/mysql to suggestions
For most users we only need to depend on sqlite bindings anyway.
2010-12-22 06:02:02 +02:00
Mika Bostrom a10d6d6286 Update changelog to 0.21-rc1 2010-12-06 17:31:50 +02:00
Mika Bostrom ba7af5cde3 Merge branch 'steffen' 2010-11-07 16:20:17 +02:00
Mika Bostrom 8524caf76b Make HUD_main +x again 2010-10-19 17:09:32 +03:00
Mika Bostrom 66606a28d7 Merge branches 'steffen' and 'master' 2010-09-11 14:50:03 +03:00
Mika Bostrom 1a515534b4 Try to fix profit/100 2010-08-31 11:40:21 +03:00
Mika Bostrom 2b97d938f1 Fix HUD bug with specified decimals
If any stat in HUD had manually specified number of decimal places, the
entire hand processing stopped when the first such stat was encountered.

Now really do the decimal place formatting as it was supposed to work.
Also, for future reference: tuples are immutable - you can't overwrite
any tuple member. Hence the need for new routine, __stat_override()
2010-08-30 12:38:08 +03:00
Mika Bostrom 18a863a5de Merge branch 'steffen' 2010-08-30 08:12:28 +03:00
Mika Bostrom e66e3a001f Merge branch 'steffen' 2010-08-29 22:17:38 +03:00
Mika Bostrom cf1d8fb5e8 Add comment on decimal place override 2010-08-29 20:00:16 +02:00
Mika Bostrom a75ba5a288 Return "hard" NA for missing/incalculable stats
It makes very little sense to do a format string for nothing but zeroes
in case of unknown values. Simply return a set of 'NA' strings in place
of usual stats. This makes the error cases consistent throughout
Stats.py
2010-08-29 20:00:06 +02:00
Mika Bostrom 8265d9fc6e Remove trailing percent symbols from HUD values
The values that are displayed in the HUD box included the '%' symbol if
these values were percentages. This clutters the HUD for those who don't
need such extra characters.

This patch removes the trailing '%' from result[1]. The default
formatting for HUD values is '%3.1f' and if decimal places need to be
changed, the code for those is now simpler. A user who wishes to show a
percent symbol after any given stat value, can edit HUD_config.xml and
assign such stats the hudsuffix="%" attribute.

This patch also changes the way the tooltip strings are constructed.
Instead of appending the percent symbol to generated string, the '%' is
now generated in place by the format-string stanza '%%'.
2010-08-29 19:59:58 +02:00
Mika Bostrom f27396ea12 Generalise .po file updates
This should catch all future translations too
2010-08-29 20:18:01 +03:00
Mika Bostrom bd842f9b1b Merge branch 'master' into hudstatview 2010-08-27 12:34:36 +03:00
Mika Bostrom d44b9494fb py2exe script moved to packaging/windows 2010-08-27 09:11:50 +03:00
Mika Bostrom 7acc8e1135 Update changelog for snapshot 2010-08-27 08:27:16 +03:00
Mika Bostrom c7ee9269be Merge branch 'steffen' 2010-08-27 08:25:59 +03:00
Mika Bostrom af1ac8316b Merge branch 'steffen' 2010-08-26 23:09:00 +03:00
Mika Bostrom d85358483b Update changelog 2010-08-25 10:06:06 +03:00
Mika Bostrom 9949185214 Modify build script to install locales
When fpdb is built, the prebuilt .mo files from locale/$LANG/$TYPE/ are
now automatically copied to target directory. For debian builds this
means that all locales are placed in $INSTROOT/usr/share/locale and
should be instantly usable for inclusion.
2010-08-23 23:39:01 +03:00
Mika Bostrom d2483b8866 Add comment on decimal place override 2010-08-22 14:12:29 +03:00
Mika Bostrom 4a92638941 Return "hard" NA for missing/incalculable stats
It makes very little sense to do a format string for nothing but zeroes
in case of unknown values. Simply return a set of 'NA' strings in place
of usual stats. This makes the error cases consistent throughout
Stats.py
2010-08-22 13:57:01 +03:00
Mika Bostrom b4a08af2b1 Remove trailing percent symbols from HUD values
The values that are displayed in the HUD box included the '%' symbol if
these values were percentages. This clutters the HUD for those who don't
need such extra characters.

This patch removes the trailing '%' from result[1]. The default
formatting for HUD values is '%3.1f' and if decimal places need to be
changed, the code for those is now simpler. A user who wishes to show a
percent symbol after any given stat value, can edit HUD_config.xml and
assign such stats the hudsuffix="%" attribute.

This patch also changes the way the tooltip strings are constructed.
Instead of appending the percent symbol to generated string, the '%' is
now generated in place by the format-string stanza '%%'.
2010-08-22 13:09:26 +03:00
Mika Bostrom bf2eaa772c Fix window visibility
This fixes the FPDB main window visibility with window managers that use
workspaces instead of virtual desktop(s). On such a system the
application receives WINDOW_STATE_ICONIFIED event when the workspace is
switched. This hides the window.

It wouldn't be too big a problem if the window wouldn't occasionally get
stuck in a "hide-me-loop", where any attempt to unhide/present the
window again triggers the hide routine. The two state events, _ICONIFIED
and _WITHDRAWN are not the same or even mutually exclusive. As such the
old event mask test simply did not cover all the possibilities.

Also, the property 'visible' does not necessarily match reality. It can
be set to true for iconified windows, and false to a visible window. So
a better solution is to not rely on the property, but just track the
wanted visibility state in our own code.

After this simple refactoring, the application window finally seems to
behave properly. [Also, widget.present() automatically calls .show(), so
we can kill one redundant operation.]
2010-08-21 14:24:34 +03:00
Mika Bostrom f1b051a99a Update changelog 2010-08-17 08:25:23 +03:00
Mika Bostrom f18cc00c0d Move sample copying after fallback test
Only try to copy the example HUD_config.xml after fallback has been
tested against, and even then only on platform where the debian path can
exist
2010-08-17 08:18:46 +03:00
Mika Bostrom c49565fcb1 Fix config file copying for debian package
If there is no config file in ~/.fpdb/ copy it from the package's
/usr/share path
2010-08-17 07:56:00 +03:00
Mika Bostrom 62ddab3232 makeexe.py has been removed 2010-08-14 09:29:07 +03:00
Mika Bostrom 9bfe110e46 Bump changelog for .904 snapshot 2010-08-14 09:24:45 +03:00
Mika Bostrom 0166a1857c Merge branch 'master' of git://git.assembla.com/fpdb 2010-08-13 10:48:48 +03:00
Mika Bostrom 7056d271d6 Merge branch 'steffen' 2010-08-04 19:06:50 +03:00
Mika Bostrom 15605efd24 Update changelog for .903 snapshot 2010-08-03 17:48:47 +03:00
Mika Bostrom ff835a0427 Update changelog for 0.20.902 snapshot 2010-07-24 09:06:40 +03:00
Mika Bostrom 9a9832b784 Merge branch 'master' of git://git.assembla.com/fpdb 2010-07-24 09:05:49 +03:00
Mika Bostrom 9eba555fe5 Update changelog and version for snapshot 2010-07-22 23:33:34 +03:00
Mika Bostrom d50030e479 Merge branch 'master' of git://git.assembla.com/fpdb 2010-07-22 23:29:24 +03:00
Mika Bostrom 1c45aa25a1 Merge branch 'packagingfix'
Conflicts:
	packaging/debian/changelog

Merge changelog manually
2010-07-22 09:02:15 +03:00
Mika Bostrom 19d400c0b1 Update changelog, release version 2010-07-22 08:48:05 +03:00
Mika Bostrom 3ed0476709 Merge branch 'master' of git://git.assembla.com/fpdb 2010-07-22 08:44:13 +03:00
Mika Bostrom f0b3dcb7a8 Update debian packaging
Changelog bump for new snapshot, and executable script renames that were
done for win32 setups.
(cherry picked from commit a5a507ece7)

Signed-off-by: steffen123 <steffen@schaumburger.info>
2010-07-08 22:16:49 +02:00
Mika Bostrom 2808f71f7e Bump changelog and version for new upload 2010-07-08 21:32:57 +03:00
Mika Bostrom 701a30249a Ubuntu/Debian do not have pythonX symlinks 2010-07-08 21:29:18 +03:00
Mika Bostrom 7ed40cdb5a File 'THANKS.txt' has been removed from tree 2010-07-08 11:27:57 +03:00
Mika Bostrom 6443c7f1d8 Update version to 0.20 2010-07-08 11:26:16 +03:00
Mika Bostrom 22fb033823 Update debian packaging for new snapshot
* Deal with .pyw file extensions, because distutils doesn't
* Remove unnecessary win32-only build files from fpdb/*
* Tweak .desktop file for better menu integration
* Assume that build happens with python2.6
2010-07-02 12:32:05 +03:00
Mika Bostrom 8411f3ed09 Merge branch 'master' of git://git.assembla.com/fpdboz 2010-06-29 10:26:20 +03:00
Mika Bostrom a5a507ece7 Update debian packaging
Changelog bump for new snapshot, and executable script renames that were
done for win32 setups.
2010-06-16 08:16:06 +03:00
Mika Bostrom d56d3009b6 Merge branch 'master' of git://git.assembla.com/fpdboz 2010-06-05 10:13:04 +03:00
Mika Bostrom 18036fb2cc Merge branch 'master' of git://git.assembla.com/fpdboz 2010-06-04 06:43:58 +03:00
Mika Bostrom b482148d2a Kill trailing whitespace 2010-05-24 09:26:19 +03:00
Mika Bostrom 2503cd1b6c Fix what looks like a thinko
The stat 'fold_f' probably should do a "float(foo)/float(bar)" division
because there is no function called "fold"
2010-05-13 06:57:59 +03:00
Mika Bostrom ed1b24a38f Merge branch 'master' of git://git.assembla.com/fpdboz 2010-05-04 20:13:59 +03:00
Mika Bostrom 6883e5c6e3 Merge branch 'master' of git://git.assembla.com/fpdboz 2010-04-16 08:12:12 +03:00
Mika Bostrom dcbb90def6 Update changelog and bump version 2010-03-05 08:39:54 +02:00
Mika Bostrom 35fbeab061 Merge branch 'master' of git://git.assembla.com/fpdboz 2010-03-05 08:35:16 +02:00
Mika Bostrom ff0e595d37 Merge branch 'master' of git://trac-git.assembla.com/fpdb-sql 2010-03-04 17:48:29 +02:00
Mika Bostrom 2856b90828 Merge branch 'master' of git://git.assembla.com/fpdboz 2010-03-04 16:03:11 +02:00
Mika Bostrom 4042fc6c40 Use sqlcoder's fix for position map
The values for pdata[p]['position'] come from DerivedStats.py, where the
value was explicitly cast to a string. This way it should work again and
use the cleaner code from sqlcoder instead.
2010-02-27 17:41:52 +02:00
Mika Bostrom f04d91d712 Merge branch 'master' of git://trac-git.assembla.com/fpdb-sql 2010-02-27 17:40:21 +02:00
Mika Bostrom 72730291f0 Fix HUD-cache updates on Postgres
The value in pdata[p]['position'] is a string. Change the 'pos'
dictionary keys to strings, and to prevent potential breakage on other
databases, always enforce that the looked up key is first converted to
string.
2010-02-27 09:37:44 +02:00
Mika Bostrom 94ab5849fa Modify display of 'n' in HUD for large numbers
When sample size grows to larger than 1000, use "X.Yk" notation to
show the approximate value.
2010-02-07 20:10:26 +02:00
Mika Bostrom ff9305924c Use proper encoding name
When system is unicode, the second item in locale.getdefaultlocale() is
"UTF8", not "utf-8".
2010-01-26 20:31:11 +01:00
Mika Bostrom 7f04ed88f4 Use proper encoding name
When system is unicode, the second item in locale.getdefaultlocale() is
"UTF8", not "utf-8".
2010-01-26 08:01:46 +02:00
Mika Bostrom 12367d6f37 Merge branch 'master' of git://git.assembla.com/fpdboz 2010-01-25 19:03:21 +02:00
Mika Bostrom b58edb53ae Write charmap-related errors directly to stderr
This change is needed to skip a nasty behaviour: if the string triggered
a decoding error, it will trigger one *AGAIN* if the string is printed
to console. By writing directly to sys.stderr we skip the
locale/conversion issues and get the troublesome string directly in a
file where it is stored as a raw sequence of octets.
2010-01-24 21:28:08 +01:00
Mika Bostrom 2c7287c351 Add new encoder
This encoder is used to handle input from HH conversion, which needs to
end up as UTF-8 in the database. Switch the open-coded routine from
Database.py to this common routine so all encodings now take place in
the same file.
2010-01-24 21:27:40 +01:00
Mika Bostrom 860b5737b7 Use common encoding routine everywhere
The string/locale manipulation in Database.py was open-coded and did not
use Charset.to_utf8() like the rest of the code.
2010-01-24 21:27:35 +01:00
Mika Bostrom 85c9070ec8 Write charmap-related errors directly to stderr
This change is needed to skip a nasty behaviour: if the string triggered
a decoding error, it will trigger one *AGAIN* if the string is printed
to console. By writing directly to sys.stderr we skip the
locale/conversion issues and get the troublesome string directly in a
file where it is stored as a raw sequence of octets.
2010-01-24 22:17:03 +02:00
Mika Bostrom 33277ce68b Add new encoder
This encoder is used to handle input from HH conversion, which needs to
end up as UTF-8 in the database. Switch the open-coded routine from
Database.py to this common routine so all encodings now take place in
the same file.
2010-01-24 21:11:46 +02:00
Mika Bostrom 6dcec48005 Use common encoding routine everywhere
The string/locale manipulation in Database.py was open-coded and did not
use Charset.to_utf8() like the rest of the code.
2010-01-24 19:59:49 +02:00
Mika Bostrom c36c60155c Use a different "unicoder" for db strings
It seems that running encoder.encode() on a latin1/latin9 string results
in, yes a bloody UnicodeDecodeError. Decode error on .encode()...
Really. This way the modification from non-unicode string to real
unicode appears to work better.
2010-01-24 13:35:10 +01:00
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 8b012a3af3 Update debian/changelog for snapshot 2010-01-22 09:27:09 +02:00
Mika Bostrom 9aa52ce6a8 Merge branch 'master' of git://git.assembla.com/fpdboz
Conflicts:
	pyfpdb/Card.py

Resolve by removing stray empty lines
2010-01-22 09:24:19 +02:00
Mika Bostrom 91cd2d2599 Remove erroneous encoding
This string should not be encoded, it seems.
2010-01-21 22:05:24 +02:00
Mika Bostrom 29d5204bee Add missing import
GuiPlayerStats.py didn't import the new Charset module but tried to use
the functions.
2010-01-21 21:52:22 +02:00
Mika Bostrom 04c345ae1f Use a different "unicoder" for db strings
It seems that running encoder.encode() on a latin1/latin9 string results
in, yes a bloody UnicodeDecodeError. Decode error on .encode()...
Really. This way the modification from non-unicode string to real
unicode appears to work better.
2010-01-21 21:46:14 +02:00
Mika Bostrom dd12da302d Merge branch 'good'
Conflicts:
	pyfpdb/test_PokerStars.py

Resolve by copying sorrow's version on top-
2010-01-21 21:34:54 +02:00
Mika Bostrom dda00b6b10 Catch character encoding errors 2010-01-21 21:31:19 +02:00
Mika Bostrom a841603460 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-21 21:24:55 +02:00
Mika Bostrom e915b0b62c Allow to bypass codec
If the system (display) locale is UTF-8, there is no need to encode to
either direction. In fact, running the .encode() routine appears to
mangle a valid UTF-8 string to a worse condition, effectively breaking
it.
2010-01-21 21:23:13 +02:00
Mika Bostrom 34bf2bd8e9 Use better function name 2010-01-21 18:12:45 +02: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 7ec58ad5c2 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-19 19:26:31 +02:00
Mika Bostrom cb172e15ae 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-19 19:25:36 +02:00
Mika Bostrom 7f568a52b9 Merge branch 'newstats' into good 2010-01-16 13:56:20 +02:00
Mika Bostrom 1f43d8db48 Merge branch 'stats' of git://git.assembla.com/fpdboz into newstats 2010-01-16 13:35:53 +02:00
Mika Bostrom cdd7e6dce2 Merge branch 'stats' of git://git.assembla.com/fpdboz into newstats 2010-01-16 06:37:21 +02: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 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
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
Mika Bostrom 17aae75f01 Merge branch 'stats' of git://git.assembla.com/fpdboz into newstats 2009-12-23 19:25:06 +02:00
Mika Bostrom 00305e34b6 Merge branch 'stats' of git://git.assembla.com/fpdboz into newstats 2009-12-23 17:30:54 +02:00
Mika Bostrom 6f084e73da Merge branch 'stats' of git://git.assembla.com/fpdboz into newstats 2009-12-22 22:19:35 +02:00
Mika Bostrom 1a4de58e33 Merge branch 'master' into good 2009-12-19 10:23:23 +02:00
Mika Bostrom da03de49dd Merge branch 'master' into good 2009-12-18 09:53:40 +02:00