diff --git a/Makefile b/Makefile
index 078a3bd0..514fb0a8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,17 @@
+#Copyright 2009-2010 Carl Gherardi
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Public License as published by
+#the Free Software Foundation, version 3 of the License.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Affero General Public License
+#along with this program. If not, see .
+#In the "official" distribution you can find the license in agpl-3.0.txt.
+
# Variable definitions
VERSION = 0.20
DATE = $(shell date +%Y%m%d)
@@ -9,3 +23,7 @@ all:
snapshot:
git tag $(VERSION)-$(DATE)
git archive --prefix=fpdb-$(VERSION)-$(DATE)/ $(VERSION)-$(DATE) | gzip -9 > ../fpdb-$(VERSION)-$(DATE).tar.gz
+
+release:
+ git tag $(VERSION)
+ git archive --prefix=fpdb-$(VERSION)/ $(VERSION) | gzip -9 > ../fpdb-$(VERSION).tar.gz
diff --git a/THANKS.txt b/THANKS.txt
deleted file mode 100644
index 7adf9825..00000000
--- a/THANKS.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-=**Thanks - Contributors to FPDB**=
-
-This page is to acknowledge the people developing and contributing to FPDB, be it with code, documentation, testing, forum support and everything else that is required to make an open source project work.
-
-Most people have found the project though the software forum at [[http://forumserver.twoplustwo.com/45/software/|2+2]] so most references to 2+2 aliases
-
-Sincere apologies to those not listed. FPDB started life in August 2008, but we only got around to putting together a proper contributers list in April 2009. Private messages and emails have been deleted so we dont have a full history of non-code based contributions
-
-==**Developers**==
-Active:
-Steffen123 - The initial code drop and project lead.
-Eratosthenes - Initial HUD code drop, release manager
-Ekdikeo - Contributor - contributed Everleaf support and much HUD work
-Sorrow - Contributor - Graphing, import framework
-mcturnbull (2+2?) - Contributor - import framework
-
-Inactive:
-Sqlcoder - SQL query guru - Graphing filters, Player Stats, Positional Stats queries + general sql optimisation work
-Bostik - Author of [[http://bostik.iki.fi/pokerstats/|PokerStats]] - Postgres linux work. PokerStats import code was the inspiration for the new framework. I'm sure well use more of his ideas in future.
-FIXME - Original windows installer/packager
-
-==Documentation==
-FIXME - Original web site guy
-FIXME - Guy who wrote the Mac install page
-FIXME - Any other wiki editors.
-
-==Other==
-Eleatic Stranger - Super tester and contributor - Our #1 tester. Tracks the git repo and works the code harder than anyone and gives great feedback and bug reports. Thankyou.
-Xaviax - Tester and honorary helpdesk - Another excellent tester tracking git, has responded to many queries in the fpdb thread on his own time.
-KayosD - Hand History donation - Carbon Poker
-freerollerjb - Hand History donation - Carbon Poker
-puru - Hand History donation - Carbon Poker
-freestailo - Hand History donation - Carbon Poker
-MoDDe (Sourceforge) - Hand History Donation - Betfair
-Jay10826 - Hand History donation - Ultimate Bet
diff --git a/docs/agpl-3.0.txt b/agpl-3.0.txt
similarity index 100%
rename from docs/agpl-3.0.txt
rename to agpl-3.0.txt
diff --git a/docs/filelist.txt b/docs/filelist.txt
deleted file mode 100644
index 15e9361a..00000000
--- a/docs/filelist.txt
+++ /dev/null
@@ -1,75 +0,0 @@
-This is partially outdated
-
-File list
-=========
-.:
-docs/ Documentation files
-pyfpdb/ The main program (in python)
-setup/ Directory with files for setting up this program
-regression-test/ Directory with test data, query scripts (in python) and the regression test script (in bash)
-utils/ A couple of things that will migrate to the main prog soon
-viewer/ Directory with the GUI (in Java)
-
-./docs:
-abbreviations.txt A list of abbreviations used and their meaning
-agpl-3.0.txt License of the program (everything under /code)
-benchmarks.txt Some benchmark results
-codingstyle.txt Some notes on formatting. Feel free to ignore.
-fdl-1.2.txt License of the documentation (the files in /)
-filelist.txt This file
-howto-import.txt Instructions on how to run the importer
-install-in-gentoo.txt Installation instructions for Gentoo GNU/Linux
-install-in-windows.txt Installation instructions for Windows
-readme-dev.txt Some notes, pointers and such for developers or anyone else interested in changing fpdb
-readme-overview.txt Some general info about this program - read that first
-readme-user.txt Instructions on how to use fpdb
-status.txt Details of support for poker types and sites
-tabledesign.html Table design with comments
-
-./pyfpdb:
-fpdb.py The main GUI. This is what the user will start and use to access the other things.
-fpdb_import.py Main import program. Calls methods in the other files.
- Takes one hand history file as input. This is the file
- you execute, do not run the other ones individually.
- Except import_gui.py of course.
-fpdb_parse_logic.py Parses a holdem/omaha/razz/stud hand.
-fpdb_save_to_db.py Just methods to store the parsed data into SQL.
- Seperate file because these calls are very unwieldy.
-fpdb_simple.py Simple methods called by the other files. Most work is
- actually done in this file to make the other ones look
- much easier than they are.
-import_gui.py GUI interface to the importer (obselete)
-
-./setup:
-insert-basedata.sql Fills sites and gametypes tables. Run this once after running the above.
-recreate-tables.sql File for mysql to recreate the tables. THIS WILL DELETE EXISTING TABLES!!!
-
-./testdata:
-should be self explanatory
-
-./utils:
-dump_db_basedata.py Prints the contents of the tables sites and gametypes
-fpdb_util_lib.py Helper methods for the utilities.
-get_DB_stats.py Prints some counts (like no. of players in the DB)
-get_player_stats.py Prints certain stats about players with CLI-passed constraints
-mysql-reset-tables.sh Reset tables for MySQL. THIS WILL DELETE EXISTING TABLES!!!
-print_hand.py Prints a hand in legible format.
-psql-interactive.sh *nix script to connect to a PostgreSQL database in
- interactive mode (note that we're currently only supporting MySQL)
-regression-test.sh Resets tables and checks manually verified hands for errors
-
-./viewer:
-todo
-
-License
-=======
-Trademarks of third parties have been used under Fair Use or similar laws.
-
-Copyright 2008 Steffen Jobbagy-Felso
-Permission is granted to copy, distribute and/or modify this
-document under the terms of the GNU Free Documentation License,
-Version 1.2 as published by the Free Software Foundation; with
-no Invariant Sections, no Front-Cover Texts, and with no Back-Cover
-Texts. A copy of the license can be found in fdl-1.2.txt
-
-The program itself is licensed under AGPLv3, see agpl-3.0.txt
diff --git a/docs/readme.txt b/docs/readme.txt
deleted file mode 100644
index e3dbac23..00000000
--- a/docs/readme.txt
+++ /dev/null
@@ -1,79 +0,0 @@
-README.txt
-updated 22 February 2010, REB
-
-fpdb - Free Poker Database
-
-The most accurate and up-to-date information on fpdb will be found in the wiki:
-http://fpdb.wiki.sourceforge.net/
-
-Other resources are:
- Mailing list: http://sourceforge.net/mailarchive/forum.php?forum_name=fpdb-main
- Chat room(irc): #fpdb on freenode.net
-
-fpdb is a free program for use with on line poker. It provides:
- Tracking of your results and statistics.
- Tracking of opponents' results statistics.
- Win/loss graphing
- Heads Up Display (HUD) with a variety of statistics
- Display of mucked cards in the HUD
-
-fpdb supports:
- Sites:
- PokerStars
- Full Tilt Poker
- Everleaf Network
- Other sites are under development and are easily added
-
- Games:
- Holdem
- Omaha (incl Hi/low)
- 7 Card Stud (incl Hi/low)
- Razz
- Triple Draw and Badugi
- Mixed Games -- HUD under development
-
- Operating Systems:
- Linux and other Unix-like, using X
- Windows
- Mac OS/X -- no support for HUD
-
- Databases:
- SQLite configured by default
- MySQL
- PostgreSQL
-
-Downloads:
- Releases: http://sourceforge.net/project/showfiles.php?group_id=226872
- Development code via git: http://www.assembla.com/spaces/free_poker_tools/trac_git_tool
-
-Developers:
- At least 10 people have contributed code or patches. Others are welcome.
-
-Source Code:
- If you received fpdb as the Windows compressed exe, then you did not
-receive souce code for fpdb or the included libraries. If you wish, you can
-obtain the source code here:
-
- fpdb: see Downloads, above.
- python: http://python.org/
- gtk: http://www.gtk.org/download.html
- pygtk: http://www.pygtk.org/downloads.html
- psycopg2: http://initd.org/pub/software/psycopg/
- mysqldb: http://sourceforge.net/projects/mysql-python/files/
- sqlalchemy: http://www.sqlalchemy.org/download.html
- numpy: http://www.scipy.org/Download
- matplotlib: http://sourceforge.net/projects/matplotlib/files/
-
-License
-=======
-Trademarks of third parties have been used under Fair Use or similar laws.
-
-Copyright 2008 Steffen Jobbagy-Felso
-Copyright 2009,2010 Ray E. Barker
-Permission is granted to copy, distribute and/or modify this
-document under the terms of the GNU Free Documentation License,
-Version 1.2 as published by the Free Software Foundation; with
-no Invariant Sections, no Front-Cover Texts, and with no Back-Cover
-Texts. A copy of the license can be found in fdl-1.2.txt
-
-fpdb itself is licensed under AGPLv3, see agpl-3.0.txt.
diff --git a/docs/release-notes.txt b/docs/release-notes.txt
deleted file mode 100644
index c8ff9444..00000000
--- a/docs/release-notes.txt
+++ /dev/null
@@ -1,93 +0,0 @@
-alpha2
-======
-Hi everyone,
-we are proud to announce the second alpha release of fpdb, the free/libre open source poker tracker. The biggest highlight is the HUD for Linux made by Ray (and perhaps Mac, not sure). But for everyone fpdb now also supports PS tournaments (SnG and MTT) and FTP ring games. There is also a new auto-importer though it currently only runs on one file per instance (but you can open multiple instances of fpdb).
-Fpdb also parses alot of new situations into the cache table for the HUD, most of which are already available through the Linux HUD. There have also been a large number of bugfixes for all kinds of things. For full details of the changes see the git commit comments.
-
-You can download fpdb at https://sourceforge.net/project/showfiles.php?group_id=226872
-
-Our website at http://fpdb.sourceforge.net/ will be updated shortly but in the meantime please note that the configuration file now resides in ~/.fpdb/default.conf on Linux/Mac and in C:\Documents and Settings\Application Data\fpdb\default.conf on Windows (on non-English Windows you have to translate the Documents and Settings, but not the Application data bit). Apart from that just follow the instructions on the site. I will be updating/improving the fpdb ebuild for Gentoo next week, please send me a PM or email if you would like a package for another Linux/BSD.
-
-To use the HUD in Linux simply run the auto importer whilst having the table open. You will also have to rename HUD_config.xml.example to HUD_config.xml and edit the database parameters in there in addition to what is written in the install guide.
-
-If you've been using fpdb alpha1 just delete the fpdb folder, follow the installation guide except for installing the dependencies, then run fpdb and run recreate tables. Note that you will have to reimport ALL your history files.
-
-For external devs (in particular Youre Toast): The table design has gone through some changes, though most of it was just renaming to make a consistent naming scheme and to make it more flexible towards stud/razz type games. I do not expect to having to make any future changes to the existing fields but I cannot yet guarantee that. There will be some additional fields in particular in the HudCache table. Please let me know if you need any further fields. I realise my naming breaks the "database designer's convention" but for this project I feel ignoring this convention for the benefit of consistent naming between Python and SQL is ok.
-
-
-Any questions and comments please post here, send me a PM or email, post a feature request or bug report on sourceforge or use any of the other means of contact listed on our webpage.
-
-Enjoy,
-The fpdb team
-
-PS: I personally will be away Sun-Tue so I probably won't be responding to anything but feel free to message me anyways, but if you post here or at SF someone else might be able to help.
-
-PPS: If you wanna know EXACTLY how this project is moving along follow the git tree over at [url]http://www.assembla.com/spaces/fpdb/trac_git_tool[/url]
-
-
-alpha1
-======
-Hi everyone,
-I am proud to announce the first release of my new poker tracking software fpdb (freepokerdb, very imaginative I know ;) ). You may wonder why I bothered when now with HM and PT3 there are at least two excellent packages to choose from.
-
-Four main reasons:
-1. Fpdb is free/libre open source software. In short, this means you don't depend on me if sth. is wrong or you want something more in this program as you can freely change it yourself. You also don't have to pay anything for it. If you like it and think I deserve to be paid just drop me a mail ;)
-2. HM and PT3 only support holdem. Fpdb initially supports Holdem and Omaha, with Stud and Razz mostly implemented and coming soon.
-3. HM and PT3 run on Windows only, and for me at least did not work in wine even after installing Mono. Fpdb runs on any plattform that has the required software, which will cover roundabout 99.9% of PCs. Currently tested plattforms are Windows XP-x86 and Gentoo GNU/Linux-amd64 as well as -x86.
- You still need to run Windows or wine to run the actual poker client though.
-4. Fpdb won't irritate you with copy prevention measures.
-
-To install it go to https://sourceforge.net/project/showfiles.php?group_id=226872 and download the zip or tar.bz2, unpack it, and follow the instructions in docs/install-in-* for your operating system (e.g. docs\install-in-windows.txt). Sourceforge lists the release files as source files, not as binary executables - this is correct, python will automagically compile as and when required.
-
-This is alpha1, as the name indicates it is still at a very early stage. The importer and database are nearing completion but the GUI in particular is not very functional yet and the HUD is missing alltogether.
-
-If anyone wishes to help with development that would be very very welcome and I've put a few notes in docs/readme-dev.txt in the download for what you could do. Or just start coding and send me the patches :)
-If you're not a programmer and you're not interested in learning it you can still help simply by trying it out and sending bug reports and feature requests. To avoid unrealistic expectations I'd like to state that it'll be a long time until fpdb reaches feature parity to established paid-for closed source software.
-
-Feature List (short now, growing fast ;) ):
-
-You can edit/add whatever you like, it's all python and SQL. The code should be fairly straightforward I think and I put some notes into readme-dev.txt but feel free to ask.
-
-Backend, Distribution
-=====================
-- Choice of MySQL/InnoDB or PostgreSQL. (not tested on PostgreSQL)
-- It is possible to run the database on one PC, the importer on another, and then access the database with the table viewer or HUD from a third PC. (note: do NOT do this unencrypted over an untrusted network like your employer's LAN or the Internet!)
-
-Site/Game Support
-=================
-- Initially only full support for PS, FTP coming soon
-- Supports Holdem, Omaha Hi and Omaha Hi/Lo. Stud and Razz coming soon.
-- Supports No Limit, Pot Limit, Fixed Limit NL, Cap NL and Cap PL
- Note that currently it does not display extra stats for NL/PL so usefulness is limited for these limit types. Suggestions welcome, I don't play these.
-- Supports ring/cash games, SnG/MTT coming soon
-
-Tableviewer (tv)
-===========
-Tv takes a history filename and loads the appropriate players' stats and displays them in a tabular format. These stats currently are:
- - VPIP, PFR and Preflop 3B/4B (3B/4B is not quite correct I think)
- - Raise and Fold % on flop, turn and river. Fold only counts hands when someone raised. This can be displayed per street or as one combined value each for aggression and folding.
- - Number of hands this is based on.
- - SD/F (aka WtSD, proportion of hands where player went to showdown after seeing flop)
- - W$wSF (Won $ when seen Flop)
- - W$@SD (Won $ at showdown)
- For all stats it also displays how many hands this particular is based on
-
-
-IMPORTANT: The database format WILL undergo more changes and at this point I am not planning to write a converter so please keep your history files so you can re-import when necessary. Independent of this you should always keep the original raw files in a safe place with any tracking software. Should you however end up loosing your files somehow let me know and I'll try to help.
-
-Please send any feedback, feature requests/suggestions, bug reports and animal names to steffen@sycamoretest.info, pick one of the contact methods listed in readme-overview.txt, send me a PM here or reply to this post.
-
-
-
-License
-=======
-Trademarks of third parties have been used under Fair Use or similar laws.
-
-Copyright 2008 Steffen Jobbagy-Felso
-Permission is granted to copy, distribute and/or modify this
-document under the terms of the GNU Free Documentation License,
-Version 1.2 as published by the Free Software Foundation; with
-no Invariant Sections, no Front-Cover Texts, and with no Back-Cover
-Texts. A copy of the license can be found in fdl-1.2.txt
-
-The program itself is licensed under AGPLv3, see agpl-3.0.txt
diff --git a/docs/tabledesign.html b/docs/tabledesign.html
deleted file mode 100644
index 86898528..00000000
--- a/docs/tabledesign.html
+++ /dev/null
@@ -1,1430 +0,0 @@
-
-
-
-
- Free Poker DB Tabledesign
-
-
-
See commit comments for version info, see status.txt for status.
-
Direct suggestions, praise and animal names to steffen@sycamoretest.info or check readme-overview.txt for more contacts
-
I decided to be generous on the sizes of the types - if computing experience shows one thing then its that it will come back to bite you in the ass if you save 2 bits in the wrong place. If performance and/or db size are too bad we can still shrink some fields.
-
Relationships are noted in the comment (need to double check that all are listed)
-
If you want more comments or if anything is confusing or bad let me know.
-
All money/cash amounts are stored in cents/pennies/whatever (e.g. $4.27 would be stored a 427). Chips are stored as-is (e.g. 3675 chips would be stored as 3675).
-
Notes on use/editing:
-
Any change to this must be carried to to the table creation code in fpdb_db.py or at least an entry to known bugs is to be made.
-
If the code (in particular the importer) and this document disagree then this document is to be considered authorative.
-
License
-Trademarks of third parties have been used under Fair Use or similar laws.
-Copyright 2008 Steffen Jobbagy-Felso
-Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 as published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license can be found in fdl-1.2.txt
-The program itself is licensed under AGPLv3, see agpl-3.0.txt
-
See readme.txt for copying
-
Table Settings
-
-
-
Field name
-
Type
-
Comment
-
-
-
version
-
smallint
-
the git version of the database (ie. table design changes and major bugfixes require a bump)
-
-
-
Table Players
-
-
-
Field name
-
Type
-
Comment
-
-
-
id
-
int
-
-
-
-
name
-
varchar(32)
-
-
-
-
siteId
-
smallint
-
references Sites.id
-
-
-
comment
-
text
-
-
-
-
commentTs
-
datetime (in UTC)
-
-
-
-
-
Table Autorates
-
An autorating is a computer-"recognised" label/category for a player. Examples could include "Calling Station" if a player has <20% each for aggression and folding postflop. Or "Tight-Aggressive/Aggressive" for players with <20% VPIP, >10% PFR and >40% postflop aggression.
-
-
-
Field name
-
Type
-
Comment
-
-
-
id
-
bigint
-
-
-
-
playerId
-
int
-
references Players.id
-
-
-
gametypeId
-
smallint
-
references Gametypes.id
-
-
-
description
-
varchar(50)
-
autorating description
-
-
-
shortDesc
-
char(8)
-
short description e.g. for display in HUD
-
-
-
ratingTime
-
datetime (in UTC)
-
timestamp of rating
-
-
-
handCount
-
int
-
number of hands rating is based on
-
-
-
-
Table Gametypes
-
-
-
Field name
-
Type
-
Comment
-
-
-
id
-
smallint
-
-
-
-
siteId
-
smallint
-
references sites.id
-
-
-
type
-
char(4)
-
valid entries:
- ring - ringgames aka cash games
- tour - tournament incl SnG
-
-
-
base
-
char(4)
-
The underlying structure. valid entries:
- hold - Holdem and Omaha
- stud - Stud and Razz
- draw - (incl Badugi)
-
-
-
category
-
varchar(9)
-
valid entries:
- holdem=Texas Hold'em
- omahahi=Omaha High only
- omahahilo=Omaha 8 or better
- razz=Razz
- studhi=7 Card Stud High only
- studhilo=7 Card Stud 8 or better
- fivedraw=Five Card Draw
- 27_1draw=2-7 Single Draw
- 27_3draw=2-7 Tripple Draw
- badugi=Badugi
-
-
-
limitType
-
char(2)
-
nl=No Limit
- cn=Cap No Limit
- pl=Pot Limit
- cp=Cap Pot Limit
- fl=Fixed Limit
-
-
-
hiLo
-
char(1)
-
Whether the game is hi, lo or both. Valid Entries:
- h - High only
- l - Low only
- s - Hi/Lo Split
cardX: can be 1 through 20, one for each card. In holdem only 1-2 of these are used, in omaha 1-4, in stud/razz 1-7, in single draw games 1-10 is used and in badugi 1-16 (4*4) is used.
-
For the draw games: the first 5 (badugi: 4) cards are the initial cards, the next 5 (badugi: 4) are after the first draw. If a player keeps some cards then those cards' spaces are filled with "k", short for "kept".
-Example 1: If a player gets 2-6 spades for his first five cards and decides to throw away the 4 and then gets a 7 of spades then the first 10 fields of cardXValue would be as follows: 2, 3, 4, 5, 6, k, k, 7, k, k
-Example 2: If a player gets 2, 3, 5, 8, J of spades for his first five cards and decides to throw away the 2 and the 3 and then gets a Q and K of spades then the first 10 fields of cardXValue would be as follows: 2, 3, 5, 8, J, Q, K, k, k, k
-Note that it will k in the space of which card was there previously, so in example 2 where the player kept the last 3 cards, the last 3 fields of the first draw (ie. card8-10Value) are replaced with k.
-
I did not separate this into an extra table because I felt the lost space is not sufficiently large. Also the benefit for searching is far less relevant.
-
ToDo: Original plan was to implement the many flags from hudcache as booleans - need to try this out as it will save space and may therefore be quicker.
-
-
-
Field Name
-
Type
-
Comment
-
-
-
id
-
bigint
-
-
-
-
handId
-
bigint
-
references Hands.id
-
-
-
playerId
-
int
-
references Players.id
-
-
-
startCash
-
int
-
-
-
position
-
char(1)
-
BB=B, SB=S, Button=0, Cutoff=1, etc.
- This is used in holdem/omaha only.
-
-
-
seatNo
-
smallint
-
The seat in which the person was sitting - necessary for HUD
int representing Holdem starting cards. Hand is stored as an int 13 * x + y where x and y
-are in range 0..12, and (x+2) and (y+2) represents rank of each card (2=2 .. 14=Ace).
-If x > y then pair is suited, if x < y then unsuited.
-Omaha and other games may need to use this as a key into another table. (to be decided ...)
-
-
-
ante
-
int
-
note: for cash this could be boolean, but in tourneys you may enter a hand with less than the full ante
-
-
-
winnings
-
int
-
winnings in this hand (bets, antes, etc. are NOT deducted, but rake already is)
-
-
-
rake
-
int
-
rake for this player for this hand (i.e. final pot(s) size = winnings + rake)
-
-
-
totalProfit
-
int
-
profit for this player for this hand ( i.e. winnings - (ante + bets) )
-
-
-
comment
-
text
-
-
-
-
commentTs
-
datetime (in UTC)
-
-
-
-
tourneysPlayersId
-
bigint
-
references TourneysPlayers.id
-
-
-
tourneyTypeId
-
bigint
-
references TourneyTypes.id (maybe this should be on Hands?)
-
-
-
wonWhenSeenStreet1(..4)
-
float
-
How many hands the player won after seeing the flop/street4 - this can be a "partial win" if the pot is split.
- To be completely clear, this stores a hand count, NOT a money amount.
- (2/3/4: Same for turn/street5, river/street6, street7)
-
-
-
wonAtSD
-
float
-
As wonWhenSeenStreet1, but for showdown.
-
-
-
street0VPI
-
int
-
did player pay to see flop, 1 or 0
-
-
-
street0Aggr
-
int
-
did player raise before flop, 1 or 0
-
-
-
street0_3BChance
-
int
-
did player have chance to 3B, 1 or 0
-
-
-
street0_3BDone
-
int
-
did player 3bet before flop, 1 or 0
-
-
-
street0_4BChance
-
int
-
did player have chance to 4B, 1 or 0
-
-
-
street0_4BDone
-
int
-
did player 4bet before flop, 1 or 0
-
-
-
other_3BStreet0
-
int
-
did other player 3bet before flop, 1 or 0
-
-
-
other_4BStreet0
-
int
-
did other player 4bet before flop, 1 or 0
-
-
-
street1Seen(/2/3/4)
-
int
-
did player see flop/street4 (.. etc)
-
-
-
sawShowdown
-
int
-
did player see showdown
-
-
-
street1Aggr
-
int
-
number of hands where player raised flop/street4
-
-
-
street2Aggr
-
int
-
number of hands where player raised turn/street5
-
-
-
street3Aggr
-
int
-
number of hands where player raised river/street6
-
-
-
street4Aggr
-
int
-
number of hands where player raised street7
-
-
-
otherRaisedStreet0
-
int
-
number of hands where someone else raised pre-flop/street3
-
-
-
otherRaisedStreet1
-
int
-
number of hands where someone else raised flop/street4
-
-
-
otherRaisedStreet2
-
int
-
number of hands where someone else raised turn/street5
-
-
-
otherRaisedStreet3
-
int
-
number of hands where someone else raised river/street6
-
-
-
otherRaisedStreet4
-
int
-
number of hands where someone else raised street7
-
-
-
foldToOtherRaisedStreet0
-
int
-
number of hands where someone else raised flop/street4 and the player folded
-
-
-
foldToOtherRaisedStreet1
-
int
-
number of hands where someone else raised flop/street4 and the player folded
-
-
-
foldToOtherRaisedStreet2
-
int
-
number of hands where someone else raised Turn/street5 and the player folded
-
-
-
foldToOtherRaisedStreet3
-
int
-
number of hands where someone else raised River/street6 and the player folded
-
-
-
foldToOtherRaisedStreet4
-
int
-
number of hands where someone else raised street7 and the player folded
-
-
-
stealAttemptChance
-
int
-
Player was in CO, BTN or SB and nobody has called yet
-
-
-
stealAttempted
-
int
-
Player took a chance per the above condition
-
-
-
foldBbToStealChance
-
int
-
Somebody tried to steal BB from player
-
-
-
foldedBbToSteal
-
int
-
Player folded BB to steal attempt
-
-
-
foldSbToStealChance
-
int
-
Somebody tried to steal SB from player
-
-
-
foldedSbToSteal
-
int
-
Player folded SB to steal attempt
-
-
-
-
street1CBChance
-
int
-
Player had chance to make continuation bet on flop/street4
-
-
-
street1CBDone
-
int
-
Player used chance to make continuation bet on flop/street4
-
-
-
street2CBChance
-
int
-
Player had chance to make continuation bet on turn/street5
-
-
-
street2CBDone
-
int
-
Player used chance to make continuation bet on turn/street5
-
-
-
street3CBChance
-
int
-
Player had chance to make continuation bet on river/street6
-
-
-
street3CBDone
-
int
-
Player used chance to make continuation bet on river/street6
-
-
-
street4CBChance
-
int
-
Player had chance to make continuation bet on street7
-
-
-
street4CBDone
-
int
-
Player used chance to make continuation bet on street7
-
-
-
-
foldToStreet1CBChance
-
int
-
Player had chance to fold to continuation bet on this street
-
-
-
foldToStreet1CBDone
-
int
-
Player used chance to fold to continuation bet on this street
-
-
-
foldToStreet2CBChance
-
int
-
Player had chance to fold to continuation bet on this street
-
-
-
foldToStreet2CBDone
-
int
-
Player used chance to fold to continuation bet on this street
-
-
-
foldToStreet3CBChance
-
int
-
Player had chance to fold to continuation bet on this street
-
-
-
foldToStreet3CBDone
-
int
-
Player used chance to fold to continuation bet on this street
-
-
-
foldToStreet4CBChance
-
int
-
Player had chance to fold to continuation bet on this street
-
-
-
foldToStreet4CBDone
-
int
-
Player used chance to fold to continuation bet on this street
-
-
-
-
street1CheckCallRaiseChance
-
int
-
How often player had the chance to do a check-raise or a call-raise on this street
-
-
-
street1CheckCallRaiseDone
-
int
-
How often player used the chance to do a check-raise or a call-raise on this street
-
-
-
street2CheckCallRaiseChance
-
int
-
How often player had the chance to do a check-raise or a call-raise on this street
-
-
-
street2CheckCallRaiseDone
-
int
-
How often player used the chance to do a check-raise or a call-raise on this street
-
-
-
street3CheckCallRaiseChance
-
int
-
How often player had the chance to do a check-raise or a call-raise on this street
-
-
-
street3CheckCallRaiseDone
-
int
-
How often player used the chance to do a check-raise or a call-raise on this street
-
-
-
street4CheckCallRaiseChance
-
int
-
How often player had the chance to do a check-raise or a call-raise on this street
-
-
-
street4CheckCallRaiseDone
-
int
-
How often player used the chance to do a check-raise or a call-raise on this street
-
-
-
-
street0Calls
-
int
-
Number of times player called on this street
-
-
-
street1Calls
-
int
-
Number of times player called on this street
-
-
-
street2Calls
-
int
-
Number of times player called on this street
-
-
-
street3Calls
-
int
-
Number of times player called on this street
-
-
-
street4Calls
-
int
-
Number of times player called on this street
-
-
-
-
street0Bets
-
int
-
Number of times player bet on this street
-
-
-
street1Bets
-
int
-
Number of times player bet on this street
-
-
-
street2Bets
-
int
-
Number of times player bet on this street
-
-
-
street3Bets
-
int
-
Number of times player bet on this street
-
-
-
street4Bets
-
int
-
Number of times player bet on this street
-
-
-
-
street0Raises
-
int
-
Number of times player raised on this street
-
-
-
street1Raises
-
int
-
Number of times player raised on this street
-
-
-
street2Raises
-
int
-
Number of times player raised on this street
-
-
-
street3Raises
-
int
-
Number of times player raised on this street
-
-
-
street4Raises
-
int
-
Number of times player raised on this street
-
-
-
-
actionString
-
int
-
Experimental - idea is to store the action on this street as a string: e.g. kkBrcfC, with
- player's own choices in upper case and other players in lower case. k=check, b=bet, c=call,
- r=raise. (Perhaps NL would miss out bet sizes for this?) It would then be possible to do complex
- ad-hoc queries using queries like: actionString like '%B%r%C%
-
-
-
-
-
Table HudCache
-
-
-
Field Name
-
Type
-
Comment
-
-
-
id
-
bigint
-
-
-
-
gametypeId
-
smallint
-
references gametypes.id
-
-
-
playerId
-
int
-
references players.id
-
-
-
activeSeats
-
smallint
-
range 2-10
-
-
-
position
-
char(1)
-
Position for which this row applies. In this table this can be B(BB), S(SB), D(Dealer/Button), C(Cutoff), M(Middle - the 3 before cutoff) or E (Early - the 3 before Middle)
-
-
-
tourneyTypeId
-
smallint
-
References TourneyTypes.id
-
-
-
HDs
-
int
-
number of hands this player played in this gametype with this number of seats
-
-
-
wonWhenSeenStreet1(/2/3/4)
-
float
-
How many hands the player won after seeing the flop/street4 - this can be a "partial win" if the pot is split.
- To be completely clear, this stores a hand count, NOT a money amount.
- (/2/3/4: Same for turn/street5, river/street6, street7)
-
-
-
wonAtSD
-
float
-
As wonWhenSeenStreet1, but for showdown.
-
-
-
street0VPI
-
int
-
number of hands where player paid to see flop
- Please note that this already includes street0Aggr!
- To calculate limp just deduct street0Aggr from this number
-
-
-
street0Aggr
-
int
-
number of hands where player raised before flop
-
-
-
street0_3BChance
-
int
-
number of hands where player had chance to 3B before flop
-
-
-
street0_3BDone
-
int
-
number of hands where player 3bet before flop
-
-
-
street0_4BChance
-
int
-
number of hands where player had chance to 4B before flop
-
-
-
street0_4BDone
-
int
-
number of hands where player 4bet before flop
-
-
-
street1Seen
-
int
-
number of hands where player saw flop/street4
-
-
-
street2Seen
-
int
-
number of hands where player saw turn/street5
-
-
-
street3Seen
-
int
-
number of hands where player saw river/street6
-
-
-
street4Seen
-
int
-
number of hands where player saw street7
-
-
-
sawShowdown
-
int
-
number of hands where player saw showdown
-
-
-
street1Aggr
-
int
-
number of hands where player raised flop/street4
-
-
-
street2Aggr
-
int
-
number of hands where player raised turn/street5
-
-
-
street3Aggr
-
int
-
number of hands where player raised river/street6
-
-
-
street4Aggr
-
int
-
number of hands where player raised street7
-
-
-
otherRaisedStreet0
-
int
-
number of hands where someone else raised pre-flop/street3
-
-
-
otherRaisedStreet1
-
int
-
number of hands where someone else raised flop/street4
-
-
-
otherRaisedStreet2
-
int
-
number of hands where someone else raised turn/street5
-
-
-
otherRaisedStreet3
-
int
-
number of hands where someone else raised river/street6
-
-
-
otherRaisedStreet4
-
int
-
number of hands where someone else raised street7
-
-
-
foldToOtherRaisedStreet0
-
int
-
number of hands where someone else raised pre-flop/street3 and the player folded
-
-
-
foldToOtherRaisedStreet1
-
int
-
number of hands where someone else raised flop/street4 and the player folded
-
-
-
foldToOtherRaisedStreet2
-
int
-
number of hands where someone else raised Turn/street5 and the player folded
-
-
-
foldToOtherRaisedStreet3
-
int
-
number of hands where someone else raised River/street6 and the player folded
-
-
-
foldToOtherRaisedStreet4
-
int
-
number of hands where someone else raised street7 and the player folded
-
-
-
stealAttemptChance
-
int
-
Player was in CO, BTN or SB and nobody has called yet
-
-
-
stealAttempted
-
int
-
Player took a chance per the above condition
-
-
-
foldBbToStealChance
-
int
-
Somebody tried to steal BB from player
-
-
-
foldedBbToSteal
-
int
-
Player folded BB to steal attempt
-
-
-
foldSbToStealChance
-
int
-
Somebody tried to steal SB from player
-
-
-
foldedSbToSteal
-
int
-
Player folded SB to steal attempt
-
-
-
-
street1CBChance
-
int
-
Player had chance to make continuation bet on flop/street4
-
-
-
street1CBDone
-
int
-
Player used chance to make continuation bet on flop/street4
-
-
-
street2CBChance
-
int
-
Player had chance to make continuation bet on turn/street5
-
-
-
street2CBDone
-
int
-
Player used chance to make continuation bet on turn/street5
-
-
-
street3CBChance
-
int
-
Player had chance to make continuation bet on river/street6
-
-
-
street3CBDone
-
int
-
Player used chance to make continuation bet on river/street6
-
-
-
street4CBChance
-
int
-
Player had chance to make continuation bet on street7
-
-
-
street4CBDone
-
int
-
Player used chance to make continuation bet on street7
-
-
-
-
foldToStreet1CBChance
-
int
-
Player had chance to fold to continuation bet on this street
-
-
-
foldToStreet1CBDone
-
int
-
Player used chance to fold to continuation bet on this street
-
-
-
foldToStreet2CBChance
-
int
-
Player had chance to fold to continuation bet on this street
-
-
-
foldToStreet2CBDone
-
int
-
Player used chance to fold to continuation bet on this street
-
-
-
foldToStreet3CBChance
-
int
-
Player had chance to fold to continuation bet on this street
-
-
-
foldToStreet3CBDone
-
int
-
Player used chance to fold to continuation bet on this street
-
-
-
foldToStreet4CBChance
-
int
-
Player had chance to fold to continuation bet on this street
-
-
-
foldToStreet4CBDone
-
int
-
Player used chance to fold to continuation bet on this street
-
-
-
-
totalProfit
-
int
-
how much money in cents the player made
-
-
-
-
street1CheckCallRaiseChance
-
int
-
How often player had the chance to do a check-raise or a call-raise on this street
-
-
-
street1CheckCallRaiseDone
-
int
-
How often player used the chance to do a check-raise or a call-raise on this street
-
-
-
street2CheckCallRaiseChance
-
int
-
How often player had the chance to do a check-raise or a call-raise on this street
-
-
-
street2CheckCallRaiseDone
-
int
-
How often player used the chance to do a check-raise or a call-raise on this street
-
-
-
street3CheckCallRaiseChance
-
int
-
How often player had the chance to do a check-raise or a call-raise on this street
-
-
-
street3CheckCallRaiseDone
-
int
-
How often player used the chance to do a check-raise or a call-raise on this street
-
-
-
street4CheckCallRaiseChance
-
int
-
How often player had the chance to do a check-raise or a call-raise on this street
-
-
-
street4CheckCallRaiseDone
-
int
-
How often player used the chance to do a check-raise or a call-raise on this street
-
-
-
-
street0Calls
-
int
-
Number of times player called on this street
-
-
-
street1Calls
-
int
-
Number of times player called on this street
-
-
-
street2Calls
-
int
-
Number of times player called on this street
-
-
-
street3Calls
-
int
-
Number of times player called on this street
-
-
-
street4Calls
-
int
-
Number of times player called on this street
-
-
-
-
street0Bets
-
int
-
Number of times player bet on this street
-
-
-
street1Bets
-
int
-
Number of times player bet on this street
-
-
-
street2Bets
-
int
-
Number of times player bet on this street
-
-
-
street3Bets
-
int
-
Number of times player bet on this street
-
-
-
street4Bets
-
int
-
Number of times player bet on this street
-
-
-
-
street0Raises
-
int
-
Number of times player raised on this street
-
-
-
street1Raises
-
int
-
Number of times player raised on this street
-
-
-
street2Raises
-
int
-
Number of times player raised on this street
-
-
-
street3Raises
-
int
-
Number of times player raised on this street
-
-
-
street4Raises
-
int
-
Number of times player raised on this street
-
-
-
-
-
Table HandsActions
-
Did separate this into an extra table because it makes SELECTing across different streets so much easier. Also the space saving will be very large.
-
-
-
Field Name
-
Type
-
Comment
-
-
-
id
-
bigint
-
-
-
-
handPlayerId
-
bigint
-
references HandsPlayers.id
-
-
-
street
-
smallint
-
street number, 0-3 (preflop, flop, turn, river) for holdem/omaha or 0-4 for razz/stud
-1 for seen showdown
-
-
-
actionNo
-
smallint
-
action number, this is counted from zero for each street but across all players (e.g. in a heads up where the SB calls and the BB raises and the SB calls again would have numbers 0 and 1 for blinds, 2 and 4 for call and 3 for bet)
- Note that the blinds are counted as an action, so if the SB stays in the hand it'll always be action #0
-
-
-
action
-
char(5)
-
Bet stands for bring in, complete, bet, double bet, raise and double raise, since they all - technically - do the same thing. Unbet is used for when an uncalled bet is returned, this will have a negative value for amount.
-
Other valid values: blind call check fold
-
-
-
allIn
-
boolean
-
Whether the player went all-in on this action
-
-
-
amount
-
int
-
amount put into the middle for this action
-
-
-
comment
-
text
-
-
-
-
commentTs
-
datetime (in UTC)
-
-
-
-
-
Tournament Tables
-
-
Table Tourneys
-
-
-
Field name
-
Type
-
Comment
-
-
-
id
-
int
-
-
-
-
tourneyTypeId
-
smallint
-
References TourneyTypes.id
-
-
-
siteTourneyNo
-
bigint
-
-
-
-
entries
-
int
-
-1 if unknown
-
-
-
prizepool
-
int
-
Need this as separate field to support rebuy/addon
-1 if unknown
-
-
-
startTime
-
datetime (in UTC)
-
Empty if unknown
-
-
-
comment
-
text
-
-
-
-
commentTs
-
datetime (in UTC)
-
-
-
-
-
Table TourneyTypes
-
-
-
Field name
-
Type
-
Comment
-
-
-
id
-
int
-
-
-
-
siteId
-
smallint
-
References Sites.id
-
-
-
buyin
-
int
-
Buy-in in cents. Without rebuy/add-on
-
-
-
fee
-
int
-
-
-
-
knockout
-
int
-
-
-
-
rebuyOrAddon
-
boolean
-
Whether rebuys or add-ons are possible
-
-
-
-
Table TourneysPlayers
-
-
-
Field Name
-
Type
-
Comment
-
-
-
id
-
bigint
-
-
-
-
tourneyId
-
int
-
References Tourneys.id
-
-
-
playerId
-
int
-
References Players.id
-
-
-
payinAmount
-
int
-
Buyin, fee, rebuys and add-ons
-
-
-
rank
-
int
-
Finishing rank
-
-
-
winnings
-
signed int
-
Winnings (not profit) by this player, -1 if unknown.
-
-
-
comment
-
text
-
-
-
-
commentTs
-
datetime (in UTC)
-
-
-
-
-
Possible Changes
-
-
-
Table
-
Comment
-
-
-
BoardCards
-
Remove as these attributes are now stored on Hands
-
-
-
HandsActions
-
Remove if/when these attributes are stored on Hands or elsewhere
-
-
-
HandsPlayers
-
Move tourneyTypeId field to Hands table.
-
-
-
Comments
-
Comment fields on various tables should probably be moved to a single comment table. Aim
- should be to where possible reduce tables to a list of fixed length not-null columns and have
- the larger, sparser comment columns in a dedicated table. (May not be possible or practical but
- something to aim at.)
-
-
-
-
diff --git a/docs/fdl-1.2.txt b/fdl-1.2.txt
similarity index 100%
rename from docs/fdl-1.2.txt
rename to fdl-1.2.txt
diff --git a/files/fpdb.desktop b/files/fpdb.desktop
index eed85047..71380ac3 100644
--- a/files/fpdb.desktop
+++ b/files/fpdb.desktop
@@ -5,5 +5,5 @@ Exec=/usr/bin/fpdb
Icon=fpdb-icon.png
Terminal=true
Type=Application
-Categories=Utility
+Categories=Utility;GTK;Application
diff --git a/gpl-2.0.txt b/gpl-2.0.txt
new file mode 100644
index 00000000..d159169d
--- /dev/null
+++ b/gpl-2.0.txt
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ , 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/gpl-3.0.txt b/gpl-3.0.txt
new file mode 100644
index 00000000..94a9ed02
--- /dev/null
+++ b/gpl-3.0.txt
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/packaging/debian/changelog b/packaging/debian/changelog
index 4bacf635..e95fd1c5 100644
--- a/packaging/debian/changelog
+++ b/packaging/debian/changelog
@@ -1,3 +1,19 @@
+free-poker-tools (0.20~git20100630) unstable; urgency=low
+
+ * Snapshot release
+ * Executable names have been changed to accommodate for some win32
+ trouble cases; install these files manually to build-tree
+ * Improved statistics
+
+ -- Mika Bostrom Wed, 16 Jun 2010 08:10:00 +0300
+
+free-poker-tools (0.20~git20100305) unstable; urgency=low
+
+ * New snapshot
+ * Version bumped to 0.20
+
+ -- Mika Bostrom Fri, 05 Mar 2010 08:38:52 +0200
+
free-poker-tools (0.12~git20100122) unstable; urgency=low
* New snapshot release with reworked import code
diff --git a/packaging/debian/copyright b/packaging/debian/copyright
index 8796c11a..76023159 100644
--- a/packaging/debian/copyright
+++ b/packaging/debian/copyright
@@ -2,6 +2,6 @@ This package was debianised by Mika Bostrom
Upstream authors: ...
-License: AGPL
+License: AGPL3; partially GPL2 or higher
-Copyright (C) 2008- The FPDB developers
+Copyright (C) 2008-2010 The FPDB developers
diff --git a/packaging/debian/links b/packaging/debian/links
index 5a4601a7..148aad4f 100644
--- a/packaging/debian/links
+++ b/packaging/debian/links
@@ -1 +1 @@
-/usr/share/pyshared/fpdb/fpdb.py /usr/bin/fpdb
+/usr/share/pyshared/fpdb/fpdb.pyw /usr/bin/fpdb
diff --git a/packaging/debian/python-fpdb.postinst b/packaging/debian/python-fpdb.postinst
index 9680be90..99d25018 100644
--- a/packaging/debian/python-fpdb.postinst
+++ b/packaging/debian/python-fpdb.postinst
@@ -3,4 +3,4 @@
# When installed into .../fpdb/ the script gets mode 644
# Note: "dh_fixperms -Xfpdb.py" did not work, hence this hack
chmod 755 /usr/bin/fpdb
-chmod 755 /usr/share/pyshared/fpdb/HUD_main.py
+chmod 755 /usr/share/pyshared/fpdb/HUD_main.pyw
diff --git a/packaging/debian/rules b/packaging/debian/rules
index 2ae2c776..9106c7bc 100755
--- a/packaging/debian/rules
+++ b/packaging/debian/rules
@@ -23,6 +23,13 @@ install: build
dh_installdirs
#
python setup.py install --root=debian/$(PACKAGE) --prefix=/usr --no-compile
+ # Copy *.pyw manually in packaging tree
+ cp pyfpdb/*.pyw debian/$(PACKAGE)/usr/lib/python2.6/site-packages/fpdb/
+ # Remove scripts that are only useful in win32
+ rm debian/$(PACKAGE)/usr/lib/python2.6/site-packages/fpdb//windows_make_bats.py
+ rm debian/$(PACKAGE)/usr/lib/python2.6/site-packages/fpdb/makeexe.py
+ rm debian/$(PACKAGE)/usr/lib/python2.6/site-packages/fpdb/py2exe_setup.py
+
binary-indep: build install
dh_testdir
diff --git a/packaging/gentoo/fpdb-0.10.ebuild b/packaging/gentoo/fpdb-0.10.ebuild
deleted file mode 100644
index a41f653b..00000000
--- a/packaging/gentoo/fpdb-0.10.ebuild
+++ /dev/null
@@ -1,62 +0,0 @@
-# Copyright 1999-2008 Gentoo Foundation
-# Gentoo had nothing to do with the production of this ebuild, but I'm pre-emptively transferring all copyrights (as far as legally possible under my local jurisdiction) to them.
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/games-util/fpdb/fpdb-0.10.ebuild,v 1.0 2009/1/30 steffen@sycamoretest.info Exp $
-
-NEED_PYTHON=2.3
-
-#inherit distutils
-
-MY_P="fpdb-${PV}"
-DESCRIPTION="A database program to track your online poker games"
-HOMEPAGE="https://sourceforge.net/projects/fpdb/"
-SRC_URI="mirror://sourceforge/fpdb/${MY_P}.tar.bz2"
-
-LICENSE="AGPL-3"
-SLOT="0"
-KEYWORDS="~amd64 ~x86"
-#note: this should work on other architectures too, please send me your experiences
-IUSE=""
-
-RDEPEND="virtual/mysql
- dev-python/mysql-python
- >=x11-libs/gtk+-2.10
- dev-python/pygtk
- dev-python/numpy
- dev-python/matplotlib"
-
-DEPEND="${RDEPEND}"
-
-src_install() {
- DIRINST="${D}usr/share/games/fpdb/"
- mkdir -p "${DIRINST}"
- cp -R * "${DIRINST}" || die
-
- DIRBIN="${D}usr/games/bin/"
- mkdir -p "${DIRBIN}"
- #echo "pathes"
- #echo "${DIRINST}pyfpdb/fpdb.py"
- #echo "${DIRBIN}fpdb.py"
- #echo
- echo "cd /usr/share/games/fpdb/pyfpdb/ && python fpdb.py" > "${DIRBIN}fpdb" || die
- chmod 755 "${DIRBIN}fpdb" || die
-}
-
-#src_test() {
-#}
-
-pkg_postinst() {
- elog "Fpdb has been installed and can be called by executing /usr/games/bin/fpdb"
- elog "You need to perform a couple more steps manually."
- elog "Please also make sure you followed instructions from previous emerges, in particular make sure you configured mysql and set a root pw for it"
- elog "Now run this command to connect to MySQL: mysql --user=root --password=yourPassword"
- elog "In the mysql command line interface you need to type these two lines (make sure you get the ; at the end)"
- elog "In the second line replace \"newPassword\" with a password of your choice"
- elog "CREATE DATABASE fpdb;"
- elog "GRANT ALL PRIVILEGES ON fpdb.* TO 'fpdb'@'localhost' IDENTIFIED BY 'newPassword' WITH GRANT OPTION;"
- elog "Finally copy the default config file from ${DIRINST}docs/default.conf to ~/.fpdb/ for every user that is to use fpdb."
- elog "You will need to edit the default.conf, in particular you need to replace the password with what you entered in the \"GRANT ALL...\""
- elog "Finally run the GUI and click the menu database -> recreate tables"
- elog "That's it! See our webpage at http://fpdb.sourceforge.net for more documentation"
- elog " "
-}
diff --git a/packaging/gentoo/fpdb-0.20-r1.ebuild b/packaging/gentoo/fpdb-0.20-r1.ebuild
new file mode 100644
index 00000000..988a90b1
--- /dev/null
+++ b/packaging/gentoo/fpdb-0.20-r1.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# created by Steffen Schaumburg, steffen@schaumburger.info
+
+EAPI="2"
+NEED_PYTHON=2.5
+
+#inherit distutils
+
+DESCRIPTION="A database program to track your online poker games"
+HOMEPAGE="http://fpdb.sourceforge.net/"
+#SRC_URI="mirror://sourceforge/fpdb/${MY_P}.tar.bz2"
+
+LICENSE="AGPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+#note: this should work on other architectures too, please send me your experiences
+
+IUSE="graphing mysql postgres sqlite"
+RDEPEND="
+ mysql? ( virtual/mysql
+ dev-python/mysql-python )
+ postgres? ( dev-db/postgresql-server
+ dev-python/psycopg )
+ sqlite? ( dev-lang/python[sqlite]
+ dev-python/numpy )
+ >=x11-libs/gtk+-2.10
+ dev-python/pygtk
+ graphing? ( dev-python/numpy
+ dev-python/matplotlib[gtk] )
+ dev-python/python-xlib"
+DEPEND="${RDEPEND}"
+
+#src_install() {
+# DIRINST="${D}usr/share/games/fpdb/"
+# mkdir -p "${DIRINST}"
+# cp -R * "${DIRINST}" || die
+#
+# DIRBIN="${D}usr/games/bin/"
+# mkdir -p "${DIRBIN}"
+# #echo "pathes"
+# #echo "${DIRINST}pyfpdb/fpdb.py"
+# #echo "${DIRBIN}fpdb.py"
+# #echo
+# echo "cd /usr/share/games/fpdb/pyfpdb/ && python fpdb.py" > "${DIRBIN}fpdb" || die
+# chmod 755 "${DIRBIN}fpdb" || die
+#}
+
+#src_test() {
+#}
+
+pkg_postinst() {
+ elog "Fpdb's dependencies have been installed. Please visit fpdb.sourceforge.net"
+ elog "and download and unpack the archive.You can then start fpdb by running run_fpdb.py."
+ elog "Note that if you really want to use mysql or postgresql you will have to create"
+ elog "the database and user yourself and enter it into the fpdb config."
+}
diff --git a/packaging/windows/MySqlPython1.2.2WalkthroughPython26.txt b/packaging/windows/MySqlPython1.2.2WalkthroughPython26.txt
new file mode 100644
index 00000000..2a71b673
--- /dev/null
+++ b/packaging/windows/MySqlPython1.2.2WalkthroughPython26.txt
@@ -0,0 +1,134 @@
+Create MySqlPython version 1.2.2 windows installer for Python26
+
+This walkthrough is derived from excellent installation instructions released under GNU Free Documentation License 1.2. The original work is here ... http://www.bcspcsonline.com/wiki/index.php?title=MySQL-5.1.34_Python-2.6_Module_Build_Instructions The Wiki author appears to be "Irondesk"
+
+This version by Gimick on 29th June 2010
+Content is available under GNU Free Documentation License 1.2
+
+Step 0 Get a fresh XP installation
+----------------------------------
+
+0.1/ Using XPhome 32bit
+
+
+Step 1, VisualStudio 2008 express install
+-----------------------------------------
+
+1.1/ Get the ISO CD from here ... http://www.microsoft.com/express/Downloads/#2008-All
+
+1.2/ Run and install Visual C++ only, don't bother with the additional packages offered
+
+This package will run 30 days before registration is needed
+
+
+Step 2, setup Mysql Server
+--------------------------
+
+2.1/ Install MySQL server runtime ... http://downloads.mysql.com/archives/mysql-5.1/mysql-5.1.34-win32.msi
+
+Choose Typical, choose configure, choose Standard Configuration, choose all defaults, supply admin username/password.
+
+
+Step 3, more installs
+----------------------
+
+3.1/ install the following in sequence (accept all default options) there should be no errors !
+
+Python 2.6.5 ... http://www.python.org/ftp/python/2.6.5/python-2.6.5.msi
+7zip 914 ... http://sourceforge.net/projects/sevenzip/files/7-Zip/9.14/7z914.exe/download
+
+
+Step 4, grab Mysql server Source
+--------------------------------
+
+4.1/ Download ... http://downloads.mysql.com/archives/mysql-5.1/mysql-noinstall-5.1.34-win32.zip
+4.2/ Unpacking Desktop\mysqlsource (use 7zip)
+4.3/ Copy the following source directories to the MySql installation:
+
+dos> xcopy Desktop\mysqlsource\mysql-5.1.34-win32\data\* "c:\Program Files\MySQL\MySQL Server 5.1\data" /I/E/F/H
+dos> xcopy Desktop\mysqlsource\mysql-5.1.34-win32\Embedded\* "c:\Program Files\MySQL\MySQL Server 5.1\Embedded" /I/E/F/H
+dos> xcopy Desktop\mysqlsource\mysql-5.1.34-win32\include\* "c:\Program Files\MySQL\MySQL Server 5.1\include" /I/E/F/H
+dos> xcopy Desktop\mysqlsource\mysql-5.1.34-win32\lib\* "c:\Program Files\MySQL\MySQL Server 5.1\lib" /I/E/F/H
+dos> xcopy Desktop\mysqlsource\mysql-5.1.34-win32\mysql-test\* "c:\Program Files\MySQL\MySQL Server 5.1\mysql-test" /I/E/F/H
+dos> xcopy Desktop\mysqlsource\mysql-5.1.34-win32\sql-bench\* "c:\Program Files\MySQL\MySQL Server 5.1\sql-bench" /I/E/F/H
+
+4.4/ You can delete Destop\mysqlsource, is no longer needed.
+
+
+Step 5, grab Mysql-python source
+--------------------------------
+
+5.1/ get download
+MySql for python ... http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.2/MySQL-python-1.2.2.tar.gz/download
+
+5.2/ extract MySQL-python-1.2.2 directory to the Desktop using 7zip
+(note: use 7zip, open the gz, then open the tar, then extract the directory found inside there)
+
+Desktop\MySQL-python-1.2.2 should now exist
+
+
+Step 6, get python build tools
+------------------------------
+
+6.1/ get Easy Setup installer
+Easy setup installer ... http://peak.telecommunity.com/dist/ez_setup.py
+
+6.2/ Check the DEFAULT VERSION specified in Easy Setup and get the corresponding setuptools (version c11 in this case)
+Setuptools version 11 ... http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg
+
+6.3/ Put both of these files into Desktop\MySQL-python-1.2.2, overwriting any existing files
+
+
+Step 7, install the build tool
+------------------------------
+
+dos> cd Desktop\MySQL-python-1.2.2
+dos> c:\Python26\python.exe ez_setup.py setuptools-0.6c11-py2.6.egg
+
+
+Step 8, Tweak the configuration
+-------------------------------
+
+dos> cd Desktop\MySQL-python-1.2.2
+
+8.1/ dos> write site.cfg
+
+Change registry_key = SOFTWARE\MySQL AB\MySQL Server 5.0
+ to registry_key = SOFTWARE\MySQL AB\MySQL Server 5.1
+
+8.2/ dos> write _mysql.c
+
+Find the following lines
+
+...
+#include
+#include
+...
+
+Insert an additional winsock2 line
+
+...
+#include
+#include
+#include
+...
+
+
+Step 9, build
+-------------
+
+dos> cd Desktop\MySQL-python-1.2.2
+
+9.1/ dos> c:\python26\python.exe setup.py build
+
+* Note: You will probably get a bunch of warnings and maybe a manifest error, these are ok as long as there are no errors in compiling or linking.
+* Note: This will generate the "MySQL-python-1.2.2/build" folder
+
+9.2/ dos> c:\python26\python.exe setup.py bdist_wininst
+
+
+Step 10, done
+-------------
+
+10.1/ the \dist directory will contain MySQL-python-1.2.2.win32-py2.6.exe !!!!!
+10.2/ rename to MySQL-python-1.2.2.win32-py2.6-fpdb0.20.exe
diff --git a/packaging/windows/MySqlPython1.2.3WalkthroughPython26.txt b/packaging/windows/MySqlPython1.2.3WalkthroughPython26.txt
new file mode 100644
index 00000000..410fa4a8
--- /dev/null
+++ b/packaging/windows/MySqlPython1.2.3WalkthroughPython26.txt
@@ -0,0 +1,125 @@
+Create MySqlPython version 1.2.3 windows installer for Python26
+
+This walkthrough is derived from excellent installation instructions released under GNU Free Documentation License 1.2. The original work is here ... http://www.bcspcsonline.com/wiki/index.php?title=MySQL-5.1.34_Python-2.6_Module_Build_Instructions The Wiki author appears to be "Irondesk"
+
+This version by Gimick on 29th June 2010
+Content is available under GNU Free Documentation License 1.2
+
+Premamble
+---------
+
+
+The FPDB exe needs to build against the MySql-Python project. Unfortunately, for python 2.6 there is no official installer for windows, and none is ever likely to be provided.
+
+Community builds are available, but to reduce third-party dependencies, we will build our own here.
+
+Step 0 Get a fresh XP installation
+----------------------------------
+
+0.1/ Using XPhome 32bit
+
+
+Step 1, VisualStudio 2008 express install
+-----------------------------------------
+
+1.1/ Get the ISO CD from here ... http://www.microsoft.com/express/Downloads/#2008-All
+
+1.2/ Run and install Visual C++ only, don't bother with the additional packages offered
+
+This package will run 30 days before registration is needed
+
+
+Step 2, setup Mysql Server
+--------------------------
+
+2.1/ Install MySQL server runtime ... http://downloads.mysql.com/archives/mysql-5.1/mysql-5.1.34-win32.msi
+
+Choose Typical, choose configure, choose Standard Configuration, choose all defaults, supply admin username/password.
+
+
+Step 3, more installs
+----------------------
+
+3.1/ install the following in sequence (accept all default options) there should be no errors !
+
+Python 2.6.5 ... http://www.python.org/ftp/python/2.6.5/python-2.6.5.msi
+7zip 914 ... http://sourceforge.net/projects/sevenzip/files/7-Zip/9.14/7z914.exe/download
+
+
+Step 4, grab Mysql server Source
+--------------------------------
+
+4.1/ Download ... http://downloads.mysql.com/archives/mysql-5.1/mysql-noinstall-5.1.34-win32.zip
+4.2/ Unpacking Desktop\mysqlsource (use 7zip)
+4.3/ Copy the following source directories to the MySql installation:
+
+dos> xcopy Desktop\mysqlsource\mysql-5.1.34-win32\data\* "c:\Program Files\MySQL\MySQL Server 5.1\data" /I/E/F/H
+dos> xcopy Desktop\mysqlsource\mysql-5.1.34-win32\Embedded\* "c:\Program Files\MySQL\MySQL Server 5.1\Embedded" /I/E/F/H
+dos> xcopy Desktop\mysqlsource\mysql-5.1.34-win32\include\* "c:\Program Files\MySQL\MySQL Server 5.1\include" /I/E/F/H
+dos> xcopy Desktop\mysqlsource\mysql-5.1.34-win32\lib\* "c:\Program Files\MySQL\MySQL Server 5.1\lib" /I/E/F/H
+dos> xcopy Desktop\mysqlsource\mysql-5.1.34-win32\mysql-test\* "c:\Program Files\MySQL\MySQL Server 5.1\mysql-test" /I/E/F/H
+dos> xcopy Desktop\mysqlsource\mysql-5.1.34-win32\sql-bench\* "c:\Program Files\MySQL\MySQL Server 5.1\sql-bench" /I/E/F/H
+
+4.4/ You can delete Destop\mysqlsource, is no longer needed.
+
+
+Step 5, grab Mysql-python source
+--------------------------------
+
+5.1/ get download
+MySql for python ... http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.2/MySQL-python-1.2.3.tar.gz/download
+
+5.2/ extract MySQL-python-1.2.3 directory to the Desktop using 7zip
+(note: use 7zip, open the gz, then open the tar, then extract the directory found inside there)
+
+Desktop\MySQL-python-1.2.3 should now exist
+
+
+Step 6, get python build tools
+------------------------------
+
+6.1/ get Easy Setup installer
+Easy setup installer ... http://peak.telecommunity.com/dist/ez_setup.py
+
+6.2/ Check the DEFAULT VERSION specified in Easy Setup and get the corresponding setuptools (version c11 in this case)
+Setuptools version 11 ... http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg
+
+6.3/ Put both of these files into Desktop\MySQL-python-1.2.3, overwriting any existing files
+
+
+Step 7, install the build tool
+------------------------------
+
+dos> cd Desktop\MySQL-python-1.2.3
+dos> c:\Python26\python.exe ez_setup.py setuptools-0.6c11-py2.6.egg
+
+
+Step 8, Tweak the configuration
+-------------------------------
+
+dos> cd Desktop\MySQL-python-1.2.3
+
+8.1/ dos> write site.cfg
+
+Change registry_key = SOFTWARE\MySQL AB\MySQL Server 5.0
+ to registry_key = SOFTWARE\MySQL AB\MySQL Server 5.1
+
+
+Step 9, build
+-------------
+
+dos> cd Desktop\MySQL-python-1.2.3
+
+9.1/ dos> c:\python26\python.exe setup.py build
+
+* Note: You will probably get a bunch of warnings and maybe a manifest error, these are ok as long as there are no errors in compiling or linking.
+* Note: This will generate the "MySQL-python-1.2.3/build" folder
+
+9.2/ dos> c:\python26\python.exe setup.py bdist_wininst
+
+
+Step 10, done
+-------------
+
+10.1/ the \dist directory will contain MySQL-python-1.2.3.win32-py2.6.exe !!!!!
+10.2/ rename to MySQL-python-1.2.3.win32-py2.6-fpdb0.20.exe
diff --git a/packaging/windows/fpdbEnvInstaller2.au3 b/packaging/windows/fpdbEnvInstaller2.au3
index 73b7cb92..081ca7a1 100644
--- a/packaging/windows/fpdbEnvInstaller2.au3
+++ b/packaging/windows/fpdbEnvInstaller2.au3
@@ -1,3 +1,18 @@
+; Copyright 2008-2010 Michael
+; This program is free software: you can redistribute it and/or modify
+; it under the terms of the GNU Affero General Public License as published by
+; the Free Software Foundation, version 3 of the License.
+;
+; This program is distributed in the hope that it will be useful,
+; but WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+; GNU General Public License for more details.
+;
+; You should have received a copy of the GNU Affero General Public License
+; along with this program. If not, see .
+; In the "official" distribution you can find the license in agpl-3.0.txt.
+
+
;"%programfiles%\MySQL\MySQL Server 5.0\bin\mysqld" --remove
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Includes
diff --git a/packaging/windows/py2exeWalkthroughPython26.txt b/packaging/windows/py2exeWalkthroughPython26.txt
new file mode 100644
index 00000000..e379cdae
--- /dev/null
+++ b/packaging/windows/py2exeWalkthroughPython26.txt
@@ -0,0 +1,213 @@
+PY2EXE walkthrough for Python 2.6 & FPDB 0.20
+created on 22nd June 2010 by Gimick
+
+This walkthrough is derived from comments in the py2exe script made by Ray and SqlCoder
+Additional information, formatting, updating to Python 2.6 and sequencing added by Gimick
+Content is available under the the GNU Affero General Public License version 3
+
+
+
+Step 0 Get a fresh XP installation
+----------------------------------
+
+0.1/ Using XPhome or Pro 32bit
+
+0.2/ Ensure the CPU supports SSE2 instruction set or better.
+
+
+Step 1, dependency install
+--------------------------
+
+1.1/ install the following in sequence (accept all default options) there should be no errors !
+
+Python 2.6.5 ... http://www.python.org/ftp/python/2.6.5/python-2.6.5.msi
+pywin 214 ... http://sourceforge.net/projects/pywin32/files/pywin32/Build%20214/pywin32-214.win32-py2.6.exe/download
+matplotlib 0.99.3 ... http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-0.99.3/matplotlib-0.99.3.win32-py2.6.exe/download
+pygtk 2.16.0 ... http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.16/pygtk-2.16.0.win32-py2.6.exe
+pycairo 1.8.6 ... http://ftp.gnome.org/pub/GNOME/binaries/win32/pycairo/1.8/pycairo-1.8.6.win32-py2.6.exe
+pyGobject 2.20.0 ... http://ftp.gnome.org/pub/GNOME/binaries/win32/pygobject/2.20/pygobject-2.20.0.win32-py2.6.exe
+py2exe 0.6.9 ... http://sourceforge.net/projects/py2exe/files/py2exe/0.6.9/py2exe-0.6.9.win32-py2.6.exe/download
+psycopg2 ... http://www.stickpeople.com/projects/python/win-psycopg/psycopg2-2.2.1.win32-py2.6-pg8.4.3-release.exe
+(Note: stickpeople is the offical repository, not a community build)
+
+1.2/ MySQL
+
+MySQL-python-1.2.3.win32-py2.6-fpdb0.20.exe ... http://www.mediafire.com/file/iodnnnznmj1/MySQL-python-1.2.3.win32-py2.6-fpdb0.20.exe
+
+This is an intaller built from source by gimick. There are no official mysql-python2.6 build for windows.
+
+Community builds are also available from some developers. see www.codegood.com for example.
+
+
+Step 2 Setup GTK
+-----------------
+
+There are quite a few GTK packages needed, and rather than install them individually, I used the official AllinOne from the GTK project.
+
+2,1/ Create a new folder c:\GTK
+
+2.2/ Extract the following zip file into c:\GTK
+
+GTK+ all in one 2.20.0 ... http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.20/gtk+-bundle_2.20.0-20100406_win32.zip
+
+2.3/ If everything has worked, you should have c:\GTK\bin \etc \lib \src and so on created.
+
+
+Step 3 Set GTK into the PATH variable
+-------------------------------------
+
+The path for GTK isn't set by default, so need to let the o/s know where the GTK stuff is.
+
+3.1/ Rightclick on mycomputer to show system properties
+3.2/ select advanced/environment Variables
+3.3/ in "system variables" NOT "user variables" do the following
+3.3.1/ create a new item as name: GTK_BASEPATH value: c:\GTK
+3.3.2/ edit the item "path", press home to get to the first character and insert the following text, (no quotes, including semicolon) %GTK_BASEPATH%\bin;
+
+3.4/ to check, open command prompt and do:
+
+dos>path ... system should respond with ... PATH=c:\GTK\bin;C:\WIN........
+
+3.5/ Give it a spin to test (hopefully an application will start, if not, something has gone wrong)
+
+dos> gtk-demo
+
+
+Step 4 Get the fpdb GIT tree
+----------------------------
+
+4.1/ Best to take a copy to work with; following steps will assume that the fpdb folder is on the Desktop
+
+
+5.3/ Install correct Numpy for this build
+-----------------------------------------
+
+Numpy needs special handling, as by default it will install an optimised version for the SSE level of your CPU (SSE3, SSE2 or noSSE). This means that the completed package will not run on an older CPU.
+
+For this reason, do not just run the installer downloaded.
+
+5.3.1/ download the package to the Desktop
+
+numpy 1.4.1 ... http://sourceforge.net/projects/numpy/files/NumPy/1.4.1/numpy-1.4.1-win32-superpack-python2.6.exe/download
+
+5.3.2/ remove any existing numpy installation
+
+Go to the control panel and uninstall "Python2.6 numpy-1.4.1"
+
+5.3.3/ If you are wanting to build a package which works on all CPU's, install noSSE as follows:
+
+dos> cd Desktop
+dos> numpy-1.4.1-win32-superpack-python2.6.exe /arch nosse
+
+5.3.4/ If you are wanting to build a package which works on SSE2 and better CPU's, install SSE2 as follows:
+
+dos> cd Desktop
+dos> numpy-1.4.1-win32-superpack-python2.6.exe /arch sse2
+
+5.3.4/ At the end of the installation, click on "show details" to confirm the installation.
+
+For no SSE:
+
+"Target CPU handles SSE2"
+"Target CPU handles SSE3"
+"nosse install (arch value: nosse)"
+"Install NO SSE"
+Extract: numpy-1.4.1-nosse.exe... 100%
+Execute: "C:\DOCUME~1\user\LOCALS~1\Temp\numpy-1.4.1-nosse.exe"
+Completed
+
+For SSE2:
+
+"Target CPU handles SSE2"
+"Target CPU handles SSE3"
+"sse2 install (arch value: sse2)"
+"Install SSE 2"
+Extract: numpy-1.4.1-sse2.exe... 100%
+Execute: "C:\DOCUME~1\user\LOCALS~1\Temp\numpy-1.4.1-sse2.exe"
+Completed
+
+
+Step 6 Run py2exe to generate fpdb.exe
+--------------------------------------
+
+6.1/ Run the script to create the fpdb.exe bundle
+
+dos> cd Desktop\fpdb\pyfpdb
+dos> c:\python26\python.exe py2exe_setup.py py2exe
+
+wait a while, watch lots of copying and whatever.
+
+6.2/ You should next get prompted for the GTK folder.
+c:\GTK
+
+6.3/ If there are no errors reported, it has probably worked, we will test soon.
+
+Build notes:
+
+There is a warning about dll's not included "umath.pyd - c:\Python26\lib\site-packages\numpy\core\umath.pyd" - reason for this is not understood at present. (Umath is apparently included in the built package).
+
+
+Step 7 not currently used
+-------------------------
+
+Has been deleted
+
+
+Step 8 Drag out the completed bundle
+------------------------------------
+
+py2exe creates a new folder for the created software bundle, drag this out to the desktop for ease of working.
+As far as I know you cannot rerun the build if the fpdb-yyyymmdd-exe exists in the tree, so dragging this out
+also allows the build to re-run at step 6.
+
+8.1/ Drag Desktop\fpdb\pyfpdb\fpdb-yyyymmdd-exe to Desktop\
+
+
+Step 9 Initial run
+------------------
+
+9.1/ Open the Desktop\fpdb-yyyymmdd-exe folder
+9.2/ In explorer...tools...folder options...View uncheck "Hide extensions for known file types"
+9.3/ Double click run_fpdb.bat
+9.4/ check the contents of pyfpdb\fpdb.exe.log, deal with any errors thrown
+
+9.5/ hopefully, fpdb will run
+9.6/ Try out a few options, deal with any errors reported
+
+Observe that the msvcp90.dll was provided by the python runtime package, so we don't have to install the separate package from Microsoft. End-users will, however need the dependency.
+
+
+Step 11 pruning
+---------------
+
+11.1/ The generated folder is 100+MB and can be pruned by removing the following directories:
+
+pyfpdb/lib/glib-2.0
+pyfpdb/lib/pkgconfig
+pyfpdb/share/aclocal
+pyfpdb/share/doc
+pyfpdb/share/glib-2.0
+pyfpdb/share/gtk-2.0
+pyfpdb/share/gtk-doc
+pyfpdb/share/locale
+pyfpdb/share/man
+
+
+Step 12 rename folder
+---------------------
+
+Rename the folder to something meaningful to the community. If you have built for NoSSE, append noSSE to the directory name.
+
+
+Step 13 Compress to executable archive
+--------------------------------------
+
+13.1/ Download and install 7zip 914 ... http://sourceforge.net/projects/sevenzip/files/7-Zip/9.14/7z914.exe/download
+13.2/ Rightclick on fpdb executable folder, select 7zip Add to archive... select SFX archive option switch
+13.3/ Test the created exe file
+
+Step 14 If you need to build again for a different SSE level
+------------------------------------------------------------
+
+Go back to step 5 and run again.
+
diff --git a/pyfpdb/AbsoluteToFpdb.py b/pyfpdb/AbsoluteToFpdb.py
index b1cf7ded..26aea7e8 100755
--- a/pyfpdb/AbsoluteToFpdb.py
+++ b/pyfpdb/AbsoluteToFpdb.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Copyright 2008, Carl Gherardi
+# Copyright 2008-2010, Carl Gherardi
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -177,7 +177,7 @@ or None if we fail to get the info """
# TODO: (1-on-1) does have that info in the game type line
if self.HORSEHand:
hand.maxseats = 8
- hand.starttime = datetime.datetime.strptime(m.group('DATETIME'), "%Y-%m-%d %H:%M:%S")
+ hand.startTime = datetime.datetime.strptime(m.group('DATETIME'), "%Y-%m-%d %H:%M:%S")
return
def readPlayerStacks(self, hand):
diff --git a/pyfpdb/AlchemyFacilities.py b/pyfpdb/AlchemyFacilities.py
index c8284efb..157d68f2 100644
--- a/pyfpdb/AlchemyFacilities.py
+++ b/pyfpdb/AlchemyFacilities.py
@@ -1,4 +1,20 @@
+#!/usr/bin/python
# -*- coding: utf-8 -*-
+
+#Copyright 2009-2010 Grigorij Indigirkin
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Public License as published by
+#the Free Software Foundation, version 3 of the License.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Affero General Public License
+#along with this program. If not, see .
+#In the "official" distribution you can find the license in agpl-3.0.txt.
+
from decimal import Decimal
from sqlalchemy import types
diff --git a/pyfpdb/AlchemyMappings.py b/pyfpdb/AlchemyMappings.py
index c2e088a9..15cdf70d 100644
--- a/pyfpdb/AlchemyMappings.py
+++ b/pyfpdb/AlchemyMappings.py
@@ -1,4 +1,20 @@
+#!/usr/bin/python
# -*- coding: utf-8 -*-
+
+#Copyright 2009-2010 Grigorij Indigirkin
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Public License as published by
+#the Free Software Foundation, version 3 of the License.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Affero General Public License
+#along with this program. If not, see .
+#In the "official" distribution you can find the license in agpl-3.0.txt.
+
"""@package AlchemyMappings
This package contains all classes to be mapped and mappers themselves
"""
@@ -34,8 +50,8 @@ class Gametype(MappedBase):
@staticmethod
def get_or_create(session, siteId, gametype):
map = zip(
- ['type', 'base', 'category', 'limitType', 'smallBlind', 'bigBlind', 'smallBet', 'bigBet'],
- ['type', 'base', 'category', 'limitType', 'sb', 'bb', 'dummy', 'dummy', ])
+ ['type', 'base', 'category', 'limitType', 'smallBlind', 'bigBlind', 'smallBet', 'bigBet', 'currency'],
+ ['type', 'base', 'category', 'limitType', 'sb', 'bb', 'dummy', 'dummy', 'currency'])
gametype = dict([(new, gametype.get(old)) for new, old in map ])
hilo = "h"
@@ -152,8 +168,8 @@ class HandInternal(DerivedStats):
'speed': 'speed',
'maxSeats': 'maxseats',
'knockout': 'isKO',
- 'rebuyOrAddon': 'isRebuy',
- 'headsUp': 'isHU',
+ 'rebuy': 'isRebuy',
+ 'addOn': 'isAddOn',
'shootout': 'isShootout',
'matrix': 'isMatrix',
'sng': 'isSNG',
@@ -177,15 +193,15 @@ class HandInternal(DerivedStats):
setattr(tour, col, hand_val)
elif col == 'koBounty':
setattr(tour, col, max(db_val, hand_val))
- elif col == 'tourStartTime' and hand.handStart:
- setattr(tour, col, min(db_val, hand.handStart))
+ elif col == 'tourStartTime' and hand.startTime:
+ setattr(tour, col, min(db_val, hand.startTime))
if tour.entries is None and tour_type.sng:
tour.entries = tour_type.maxSeats
# fetch and update tourney players
for hp in self.handPlayers:
- tp = TourneyPlayer.get_or_create(session, tour.id, hp.playerId)
+ tp = TourneysPlayer.get_or_create(session, tour.id, hp.playerId)
# FIXME: other TourneysPlayers should be added here
session.flush()
@@ -340,18 +356,20 @@ class HandPlayer(MappedBase):
class Site(object):
"""Class reflecting Players db table"""
INITIAL_DATA = [
- (1 , 'Full Tilt Poker','USD'),
- (2 , 'PokerStars', 'USD'),
- (3 , 'Everleaf', 'USD'),
- (4 , 'Win2day', 'USD'),
- (5 , 'OnGame', 'USD'),
- (6 , 'UltimateBet', 'USD'),
- (7 , 'Betfair', 'USD'),
- (8 , 'Absolute', 'USD'),
- (9 , 'PartyPoker', 'USD'),
- (10, 'Partouche', 'EUR'),
+ (1 , 'Full Tilt Poker','FT'),
+ (2 , 'PokerStars', 'PS'),
+ (3 , 'Everleaf', 'EV'),
+ (4 , 'Win2day', 'W2'),
+ (5 , 'OnGame', 'OG'),
+ (6 , 'UltimateBet', 'UB'),
+ (7 , 'Betfair', 'BF'),
+ (8 , 'Absolute', 'AB'),
+ (9 , 'PartyPoker', 'PP'),
+ (10, 'Partouche', 'PA'),
+ (11, 'Carbon', 'CA'),
+ (12, 'PKR', 'PK'),
]
- INITIAL_DATA_KEYS = ('id', 'name', 'currency')
+ INITIAL_DATA_KEYS = ('id', 'name', 'code')
INITIAL_DATA_DICTS = [ dict(zip(INITIAL_DATA_KEYS, datum)) for datum in INITIAL_DATA ]
@@ -372,7 +390,7 @@ class Tourney(MappedBase):
class TourneyType(MappedBase):
- """Class reflecting TourneysType db table"""
+ """Class reflecting TourneyType db table"""
@classmethod
def get_or_create(cls, session, **kwargs):
@@ -380,12 +398,12 @@ class TourneyType(MappedBase):
Required kwargs:
buyin fee speed maxSeats knockout
- rebuyOrAddon headsUp shootout matrix sng
+ rebuy addOn shootout matrix sng currency
"""
return get_or_create(cls, session, **kwargs)[0]
-class TourneyPlayer(MappedBase):
+class TourneysPlayer(MappedBase):
"""Class reflecting TourneysPlayers db table"""
@classmethod
@@ -437,7 +455,7 @@ mapper (Gametype, gametypes_table, properties={
})
mapper (Player, players_table, properties={
'playerHands': relation(HandPlayer, backref='player'),
- 'playerTourney': relation(TourneyPlayer, backref='player'),
+ 'playerTourney': relation(TourneysPlayer, backref='player'),
})
mapper (Site, sites_table, properties={
'gametypes': relation(Gametype, backref = 'site'),
@@ -455,7 +473,7 @@ mapper (Tourney, tourneys_table)
mapper (TourneyType, tourney_types_table, properties={
'tourneys': relation(Tourney, backref='type'),
})
-mapper (TourneyPlayer, tourneys_players_table)
+mapper (TourneysPlayer, tourneys_players_table)
class LambdaKeyDict(defaultdict):
"""Operates like defaultdict but passes key argument to the factory function"""
diff --git a/pyfpdb/AlchemyTables.py b/pyfpdb/AlchemyTables.py
index 3165a480..84c4b9f0 100644
--- a/pyfpdb/AlchemyTables.py
+++ b/pyfpdb/AlchemyTables.py
@@ -1,4 +1,20 @@
+#!/usr/bin/python
# -*- coding: utf-8 -*-
+
+#Copyright 2009-2010 Grigorij Indigirkin
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Public License as published by
+#the Free Software Foundation, version 3 of the License.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Affero General Public License
+#along with this program. If not, see .
+#In the "official" distribution you can find the license in agpl-3.0.txt.
+
"""@package AlchemyTables
Contains all sqlalchemy tables
"""
@@ -29,6 +45,7 @@ autorates_table = Table('Autorates', metadata,
gametypes_table = Table('Gametypes', metadata,
Column('id', SmallInteger, primary_key=True),
Column('siteId', SmallInteger, ForeignKey("Sites.id"), nullable=False), # SMALLINT
+ Column('currency', String(4), nullable=False), # varchar(4) NOT NULL
Column('type', String(4), nullable=False), # char(4) NOT NULL
Column('base', String(4), nullable=False), # char(4) NOT NULL
Column('category', String(9), nullable=False), # varchar(9) NOT NULL
@@ -48,7 +65,7 @@ hands_table = Table('Hands', metadata,
Column('tableName', String(30), nullable=False),
Column('siteHandNo', BigIntColumn, nullable=False),
Column('gametypeId', SmallInteger, ForeignKey('Gametypes.id'), nullable=False),
- Column('handStart', DateTime, nullable=False),
+ Column('startTime', DateTime, nullable=False),
Column('importTime', DateTime, nullable=False),
Column('seats', SmallInteger, nullable=False),
Column('maxSeats', SmallInteger, nullable=False),
@@ -338,7 +355,7 @@ settings_table = Table('Settings', metadata,
sites_table = Table('Sites', metadata,
Column('id', SmallInteger, primary_key=True),
Column('name', String(32), nullable=False), # varchar(32) NOT NULL
- Column('currency', String(3), nullable=False), # char(3) NOT NULL
+ Column('code', String(2), nullable=False), # char(2) NOT NULL
mysql_charset='utf8',
mysql_engine='InnoDB',
)
@@ -352,17 +369,11 @@ tourneys_table = Table('Tourneys', metadata,
Column('prizepool', Integer), # INT NOT NULL
Column('tourStartTime', DateTime), # DATETIME NOT NULL
Column('tourEndTime', DateTime), # DATETIME
- Column('buyinChips', Integer), # INT
Column('tourneyName', String(40)), # varchar(40)
# Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn
Column('matrixIdProcessed',SmallInteger, default=0), # TINYINT UNSIGNED DEFAULT 0
- Column('rebuyChips', Integer, default=0), # INT DEFAULT 0
- Column('addonChips', Integer, default=0), # INT DEFAULT 0
- Column('rebuyAmount', MoneyColumn, default=0), # INT DEFAULT 0
- Column('addonAmount', MoneyColumn, default=0), # INT DEFAULT 0
- Column('totalRebuys', Integer, default=0), # INT DEFAULT 0
- Column('totalAddons', Integer, default=0), # INT DEFAULT 0
- Column('koBounty', Integer, default=0), # INT DEFAULT 0
+ Column('totalRebuyCount', Integer, default=0), # INT DEFAULT 0
+ Column('totalAddOnCount', Integer, default=0), # INT DEFAULT 0
Column('comment', Text), # TEXT
Column('commentTs', DateTime), # DATETIME
mysql_charset='utf8',
@@ -374,36 +385,46 @@ Index('siteTourneyNo', tourneys_table.c.siteTourneyNo, tourneys_table.c.tourneyT
tourney_types_table = Table('TourneyTypes', metadata,
Column('id', Integer, primary_key=True),
Column('siteId', SmallInteger, ForeignKey("Sites.id"), nullable=False),
+ Column('currency', String(4), nullable=False), # varchar(4) NOT NULL
Column('buyin', Integer, nullable=False), # INT NOT NULL
- Column('fee', Integer, nullable=False, default=0), # INT NOT NULL
+ Column('fee', Integer, nullable=False), # INT NOT NULL
+ Column('buyInChips', Integer, nullable=False), # INT NOT NULL
Column('maxSeats', Boolean, nullable=False, default=-1), # INT NOT NULL DEFAULT -1
+ Column('rebuy', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
+ Column('rebuyCost', Integer), # INT
+ Column('rebuyChips', Integer), # INT
+ Column('addOn', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
+ Column('addOnCost', Integer), # INT
+ Column('addOnChips', Integer), # INT
Column('knockout', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
- Column('rebuyOrAddon', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
+ Column('koBounty', Integer), # INT
Column('speed', String(10)), # varchar(10)
- Column('headsUp', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
Column('shootout', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
Column('matrix', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
Column('sng', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
+ Column('satellite', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
+ Column('doubleOrNothing', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
+ Column('guarantee', Integer, nullable=False, default=0), # INT NOT NULL DEFAULT 0
mysql_charset='utf8',
mysql_engine='InnoDB',
)
Index('tourneyTypes_all',
tourney_types_table.c.siteId, tourney_types_table.c.buyin, tourney_types_table.c.fee,
- tourney_types_table.c.maxSeats, tourney_types_table.c.knockout, tourney_types_table.c.rebuyOrAddon,
- tourney_types_table.c.speed, tourney_types_table.c.headsUp, tourney_types_table.c.shootout,
- tourney_types_table.c.matrix, tourney_types_table.c.sng)
+ tourney_types_table.c.maxSeats, tourney_types_table.c.knockout, tourney_types_table.c.rebuy,
+ tourney_types_table.c.addOn, tourney_types_table.c.speed,
+ tourney_types_table.c.shootout, tourney_types_table.c.matrix, tourney_types_table.c.sng)
tourneys_players_table = Table('TourneysPlayers', metadata,
Column('id', BigIntColumn, primary_key=True),
Column('tourneyId', Integer, ForeignKey("Tourneys.id"), nullable=False),
Column('playerId', Integer, ForeignKey("Players.id"), nullable=False),
- Column('payinAmount', Integer), # INT NOT NULL
Column('rank', Integer), # INT NOT NULL
Column('winnings', Integer), # INT NOT NULL
- Column('nbRebuys', Integer, default=0), # INT DEFAULT 0
- Column('nbAddons', Integer, default=0), # INT DEFAULT 0
- Column('nbKO', Integer, default=0), # INT DEFAULT 0
+ Column('winningsCurrency', Text), # TEXT
+ Column('rebuyCount', Integer, default=0), # INT DEFAULT 0
+ Column('addOnCount', Integer, default=0), # INT DEFAULT 0
+ Column('koCount', Integer, default=0), # INT DEFAULT 0
Column('comment', Text), # TEXT
Column('commentTs', DateTime), # DATETIME
mysql_charset='utf8',
diff --git a/pyfpdb/Anonymise.py b/pyfpdb/Anonymise.py
old mode 100644
new mode 100755
index 32036b1e..6b7e7352
--- a/pyfpdb/Anonymise.py
+++ b/pyfpdb/Anonymise.py
@@ -1,10 +1,30 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+#Copyright 2009-2010 Carl Gherardi
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Public License as published by
+#the Free Software Foundation, version 3 of the License.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Affero General Public License
+#along with this program. If not, see .
+#In the "official" distribution you can find the license in agpl-3.0.txt.
+
import os
import re
import codecs
import Options
import HandHistoryConverter
+import Configuration
+import sys
(options, argv) = Options.fpdb_options()
+config = Configuration.Config()
filter = options.hhc
@@ -13,7 +33,7 @@ filter_name = filter.replace("ToFpdb", "")
mod = __import__(filter)
obj = getattr(mod, filter_name, None)
-hhc = obj(autostart=False)
+hhc = obj(config, autostart=False)
if os.path.exists(options.infile):
in_fh = codecs.open(options.infile, 'r', "utf8")
@@ -25,13 +45,24 @@ else:
m = hhc.re_PlayerInfo.finditer(filecontents)
+outfile = options.infile+".anon"
+print "Output being written to", outfile
+
+savestdout = sys.stdout
+fsock = open(outfile,"w")
+sys.stdout = fsock
+
players = []
for a in m:
players = players + [a.group('PNAME')]
uniq = set(players)
-for i, name in enumerate(uniq, 1):
+for i, name in enumerate(uniq):
filecontents = filecontents.replace(name, 'Player%d' %i)
print filecontents
+
+sys.stdout = savestdout
+fsock.close()
+
diff --git a/pyfpdb/BetfairToFpdb.py b/pyfpdb/BetfairToFpdb.py
index b308d071..5305c1c1 100755
--- a/pyfpdb/BetfairToFpdb.py
+++ b/pyfpdb/BetfairToFpdb.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Copyright 2008, Carl Gherardi
+# Copyright 2008-2010, Carl Gherardi
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -105,7 +105,7 @@ class Betfair(HandHistoryConverter):
logging.debug("HID %s, Table %s" % (m.group('HID'), m.group('TABLE')))
hand.handid = m.group('HID')
hand.tablename = m.group('TABLE')
- hand.starttime = datetime.datetime.strptime(m.group('DATETIME'), "%A, %B %d, %H:%M:%S GMT %Y")
+ hand.startTime = datetime.datetime.strptime(m.group('DATETIME'), "%A, %B %d, %H:%M:%S GMT %Y")
#hand.buttonpos = int(m.group('BUTTON'))
def readPlayerStacks(self, hand):
diff --git a/pyfpdb/CarbonToFpdb.py b/pyfpdb/CarbonToFpdb.py
index 0640d157..9239ab12 100644
--- a/pyfpdb/CarbonToFpdb.py
+++ b/pyfpdb/CarbonToFpdb.py
@@ -21,7 +21,7 @@
# This code is based heavily on EverleafToFpdb.py, by Carl Gherardi
#
-# OUTSTANDING MATTERS
+# TODO:
#
# -- No siteID assigned
# -- No support for games other than NL hold 'em cash. Hand histories for other
@@ -79,7 +79,7 @@ class Carbon(HandHistoryConverter):
#re_Antes = ???
#re_BringIn = ???
re_HeroCards = re.compile(r'', re.MULTILINE)
+ re_Action = re.compile(r'timestamp="[0-9]+" )?player="(?P[0-9])"( amount="(?P[.0-9]+)")?/>', re.MULTILINE)
re_ShowdownAction = re.compile(r'', re.MULTILINE)
re_CollectPot = re.compile(r'', re.MULTILINE)
@@ -156,7 +156,7 @@ or None if we fail to get the info """
hand.handid = m.group('HID1') + m.group('HID2')
hand.tablename = m.group('TABLE')[:-1]
hand.maxseats = 2 # This value may be increased as necessary
- hand.starttime = datetime.datetime.strptime(m.group('DATETIME')[:12],
+ hand.startTime = datetime.datetime.strptime(m.group('DATETIME')[:12],
'%Y%m%d%H%M')
# Check that the hand is complete up to the awarding of the pot; if
# not, the hand is unparseable
diff --git a/pyfpdb/Card.py b/pyfpdb/Card.py
index 46d56262..eae7447f 100755
--- a/pyfpdb/Card.py
+++ b/pyfpdb/Card.py
@@ -1,6 +1,7 @@
#!/usr/bin/python
+# -*- coding: utf-8 -*-
-#Copyright 2008 Carl Gherardi
+#Copyright 2008-2010 Carl Gherardi
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
@@ -12,8 +13,7 @@
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see .
-#In the "official" distribution you can find the license in
-#agpl-3.0.txt in the docs folder of the package.
+#In the "official" distribution you can find the license in agpl-3.0.txt.
# From fpdb_simple
diff --git a/pyfpdb/Charset.py b/pyfpdb/Charset.py
index 9c49f505..fcba6f98 100644
--- a/pyfpdb/Charset.py
+++ b/pyfpdb/Charset.py
@@ -1,4 +1,5 @@
#!/usr/bin/python
+# -*- coding: utf-8 -*-
#Copyright 2010 Mika Bostrom
#This program is free software: you can redistribute it and/or modify
@@ -12,8 +13,7 @@
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see .
-#In the "official" distribution you can find the license in
-#agpl-3.0.txt in the docs folder of the package.
+#In the "official" distribution you can find the license in agpl-3.0.txt.
# Error logging
import sys
@@ -26,7 +26,9 @@ import Configuration
encoder_to_utf = codecs.lookup('utf-8')
encoder_to_sys = codecs.lookup(Configuration.LOCALE_ENCODING)
+coder_hex = codecs.lookup('hex_codec')
+hex_coding = False #FIXME: Should only be on if db is not UTF8 - test in Database.py?
# I'm saving a few cycles with this one
not_needed1, not_needed2, not_needed3 = False, False, False
if Configuration.LOCALE_ENCODING == 'UTF8':
@@ -75,3 +77,19 @@ def to_gui(s):
except UnicodeEncodeError:
sys.stderr.write('Could not encode: "%s"\n' % s)
raise
+
+def to_hex(s):
+ try:
+ out = coder_hex.encode(s)[0]
+ return out
+ except UnicodeDecodeError:
+ sys.stderr.write('Could not convert: "%s"\n' % s)
+ return s
+
+def from_hex(s):
+ try:
+ out = coder_hex.decode(s)[0]
+ return out
+ except UnicodeDecodeError:
+ sys.stderr.write('Could not convert: "%s"\n' % s)
+ return s
diff --git a/pyfpdb/Configuration.py b/pyfpdb/Configuration.py
index ee957e2d..ea2a8a78 100755
--- a/pyfpdb/Configuration.py
+++ b/pyfpdb/Configuration.py
@@ -4,7 +4,7 @@
Handles HUD configuration files.
"""
-# Copyright 2008, 2009, Ray E. Barker
+# Copyright 2008-2010, Ray E. Barker
#
# This program is free software; you can redistribute it and/or modify
@@ -32,6 +32,7 @@ import string
import traceback
import shutil
import locale
+import re
import xml.dom.minidom
from xml.dom.minidom import Node
@@ -248,6 +249,8 @@ class Site:
self.enabled = string_to_bool(node.getAttribute("enabled"), default=True)
self.xpad = node.getAttribute("xpad")
self.ypad = node.getAttribute("ypad")
+ self.xshift = node.getAttribute("xshift")
+ self.yshift = node.getAttribute("yshift")
self.layout = {}
print "Loading site", self.site_name
@@ -259,6 +262,8 @@ class Site:
# Site defaults
self.xpad = 1 if self.xpad == "" else int(self.xpad)
self.ypad = 0 if self.ypad == "" else int(self.ypad)
+ self.xshift = 1 if self.xshift == "" else int(self.xshift)
+ self.yshift = 0 if self.yshift == "" else int(self.yshift)
self.font_size = 7 if self.font_size == "" else int(self.font_size)
self.hudopacity = 1.0 if self.hudopacity == "" else float(self.hudopacity)
@@ -296,12 +301,18 @@ class Game:
self.cols = int( node.getAttribute("cols") )
self.xpad = node.getAttribute("xpad")
self.ypad = node.getAttribute("ypad")
+ self.xshift = node.getAttribute("xshift")
+ self.yshift = node.getAttribute("yshift")
# Defaults
if self.xpad == "": self.xpad = 1
else: self.xpad = int(self.xpad)
if self.ypad == "": self.ypad = 0
else: self.ypad = int(self.ypad)
+ if self.xshift == "": self.xshift = 1
+ else: self.xshift = int(self.xshift)
+ if self.yshift == "": self.yshift = 0
+ else: self.yshift = int(self.yshift)
aux_text = node.getAttribute("aux")
aux_list = aux_text.split(',')
@@ -334,6 +345,8 @@ class Game:
temp = temp + " cols = %d\n" % self.cols
temp = temp + " xpad = %d\n" % self.xpad
temp = temp + " ypad = %d\n" % self.ypad
+ temp = temp + " xshift = %d\n" % self.xshift
+ temp = temp + " yshift = %d\n" % self.yshift
temp = temp + " aux = %s\n" % self.aux
for stat in self.stats.keys():
@@ -421,6 +434,19 @@ class Import:
return " interval = %s\n callFpdbHud = %s\n hhArchiveBase = %s\n saveActions = %s\n fastStoreHudCache = %s\n" \
% (self.interval, self.callFpdbHud, self.hhArchiveBase, self.saveActions, self.fastStoreHudCache)
+class Email:
+ def __init__(self, node):
+ self.node = node
+ self.host= node.getAttribute("host")
+ self.username = node.getAttribute("username")
+ self.password = node.getAttribute("password")
+ self.useSsl = node.getAttribute("useSsl")
+ self.folder = node.getAttribute("folder")
+
+ def __str__(self):
+ return " host = %s\n username = %s\n password = %s\n useSsl = %s\n folder = %s\n" \
+ % (self.host, self.username, self.password, self.useSsl, self.folder)
+
class HudUI:
def __init__(self, node):
self.node = node
@@ -580,6 +606,10 @@ class Config:
imp = Import(node = imp_node)
self.imp = imp
+ for email_node in doc.getElementsByTagName("email"):
+ email = Email(node = email_node)
+ self.email = email
+
for hui_node in doc.getElementsByTagName('hud_ui'):
hui = HudUI(node = hui_node)
self.ui = hui
@@ -662,7 +692,34 @@ class Config:
pass
with open(file, 'w') as f:
- self.doc.writexml(f)
+ #self.doc.writexml(f)
+ f.write( self.wrap_long_lines( self.doc.toxml() ) )
+
+ def wrap_long_lines(self, s):
+ lines = [ self.wrap_long_line(l) for l in s.splitlines() ]
+ return('\n'.join(lines) + '\n')
+
+ def wrap_long_line(self, l):
+ if 'config_wrap_len' in self.general:
+ wrap_len = int(self.general['config_wrap_len'])
+ else:
+ wrap_len = -1 # < 0 means no wrap
+
+ if wrap_len >= 0 and len(l) > wrap_len:
+ m = re.compile('\s+\S+\s+')
+ mo = m.match(l)
+ if mo:
+ indent_len = mo.end()
+ #print "indent = %s (%s)" % (indent_len, l[0:indent_len])
+ indent = '\n' + ' ' * indent_len
+ m = re.compile('(\S+="[^"]+"\s+)')
+ parts = [x for x in m.split(l[indent_len:]) if x]
+ if len(parts) > 1:
+ #print "parts =", parts
+ l = l[0:indent_len] + indent.join(parts)
+ return(l)
+ else:
+ return(l)
def edit_layout(self, site_name, max, width = None, height = None,
fav_seat = None, locations = None):
@@ -951,6 +1008,8 @@ class Config:
parms["enabled"] = self.supported_sites[site].enabled
parms["xpad"] = self.supported_sites[site].xpad
parms["ypad"] = self.supported_sites[site].ypad
+ parms["xshift"] = self.supported_sites[site].xshift
+ parms["yshift"] = self.supported_sites[site].yshift
return parms
def set_site_parameters(self, site_name, converter = None, decoder = None,
@@ -1002,6 +1061,8 @@ class Config:
param['cols'] = self.supported_games[name].cols
param['xpad'] = self.supported_games[name].xpad
param['ypad'] = self.supported_games[name].ypad
+ param['xshift'] = self.supported_games[name].xshift
+ param['yshift'] = self.supported_games[name].yshift
param['aux'] = self.supported_games[name].aux
return param
diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py
index 8939d4b3..513c4ee9 100644
--- a/pyfpdb/Database.py
+++ b/pyfpdb/Database.py
@@ -1,9 +1,10 @@
#!/usr/bin/env python
+# -*- coding: utf-8 -*-
"""Database.py
Create and manage the database objects.
"""
-# Copyright 2008, Ray E. Barker
+# Copyright 2008-2010, Ray E. Barker
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +22,7 @@ Create and manage the database objects.
########################################################################
-# ToDo: - rebuild indexes / vacuum option
+# TODO: - rebuild indexes / vacuum option
# - check speed of get_stats_from_hand() - add log info
# - check size of db, seems big? (mysql)
# - investigate size of mysql db (200K for just 7K hands? 2GB for 140K hands?)
@@ -52,7 +53,6 @@ log = logging.getLogger("db")
# FreePokerTools modules
import SQL
import Card
-import Tourney
import Charset
from Exceptions import *
import Configuration
@@ -74,7 +74,7 @@ except ImportError:
use_numpy = False
-DB_VERSION = 119
+DB_VERSION = 131
# Variance created as sqlite has a bunch of undefined aggregate functions.
@@ -140,6 +140,8 @@ class Database:
, {'tab':'TourneysPlayers', 'col':'playerId', 'drop':0}
#, {'tab':'TourneysPlayers', 'col':'tourneyId', 'drop':0} unique indexes not dropped
, {'tab':'TourneyTypes', 'col':'siteId', 'drop':0}
+ , {'tab':'Backings', 'col':'tourneysPlayerId', 'drop':0}
+ , {'tab':'Backings', 'col':'playerId', 'drop':0}
]
, [ # indexes for sqlite (list index 4)
{'tab':'Hands', 'col':'gametypeId', 'drop':0}
@@ -154,6 +156,8 @@ class Database:
, {'tab':'Tourneys', 'col':'tourneyTypeId', 'drop':1}
, {'tab':'TourneysPlayers', 'col':'playerId', 'drop':0}
, {'tab':'TourneyTypes', 'col':'siteId', 'drop':0}
+ , {'tab':'Backings', 'col':'tourneysPlayerId', 'drop':0}
+ , {'tab':'Backings', 'col':'playerId', 'drop':0}
]
]
@@ -193,7 +197,7 @@ class Database:
# alter table t add constraint c foreign key (fkcol) references tab(rcol)
# (fkcol is used for foreigh key name)
- # mysql to list indexes:
+ # mysql to list indexes: (CG - "LIST INDEXES" should work too)
# SELECT table_name, index_name, non_unique, column_name
# FROM INFORMATION_SCHEMA.STATISTICS
# WHERE table_name = 'tbl_name'
@@ -223,6 +227,7 @@ class Database:
# Note: index names must be unique across a schema
# CREATE INDEX idx ON tab(col)
# DROP INDEX idx
+ # SELECT * FROM PG_INDEXES
# SQLite notes:
@@ -289,6 +294,34 @@ class Database:
self.connection.rollback() # make sure any locks taken so far are released
#end def __init__
+ def dumpDatabase(self, filename):
+ dumpFile = open(filename, 'w')
+
+ result="Database dump version " + str(DB_VERSION)+"\n\n"
+
+ tables=self.cursor.execute(self.sql.query['list_tables'])
+ tables=self.cursor.fetchall()
+ dumpFile.write(result)
+
+ for table in tables:
+ table=table[0]
+ print "table:", table
+ result="###################\nTable "+table+"\n###################\n"
+ rows=self.cursor.execute(self.sql.query['get'+table])
+ rows=self.cursor.fetchall()
+ columnNames=self.cursor.description
+ if not rows:
+ result+="empty table\n"
+ else:
+ for row in rows:
+ for columnNumber in range(len(columnNames)):
+ result+=(" "+columnNames[columnNumber][0]+"="+str(row[columnNumber])+"\n")
+ result+="\n"
+ result+="\n"
+ dumpFile.write(result)
+ dumpFile.close()
+ #end def dumpDatabase
+
# could be used by hud to change hud style
def set_hud_style(self, style):
self.hud_style = style
@@ -552,6 +585,24 @@ class Database:
c.execute(self.sql.query['get_hand_info'], new_hand_id)
return c.fetchall()
+ def getHandCount(self):
+ c = self.connection.cursor()
+ c.execute(self.sql.query['getHandCount'])
+ return c.fetchone()[0]
+ #end def getHandCount
+
+ def getTourneyCount(self):
+ c = self.connection.cursor()
+ c.execute(self.sql.query['getTourneyCount'])
+ return c.fetchone()[0]
+ #end def getTourneyCount
+
+ def getTourneyTypeCount(self):
+ c = self.connection.cursor()
+ c.execute(self.sql.query['getTourneyTypeCount'])
+ return c.fetchone()[0]
+ #end def getTourneyCount
+
def get_actual_seat(self, hand_id, name):
c = self.connection.cursor()
c.execute(self.sql.query['get_actual_seat'], (hand_id, name))
@@ -801,17 +852,18 @@ class Database:
#print "session stat_dict =", stat_dict
#return stat_dict
- def get_player_id(self, config, site, player_name):
+ def get_player_id(self, config, siteName, playerName):
c = self.connection.cursor()
- #print "get_player_id: player_name =", player_name, type(player_name)
- p_name = Charset.to_utf8(player_name)
- c.execute(self.sql.query['get_player_id'], (p_name, site))
+ siteNameUtf = Charset.to_utf8(siteName)
+ playerNameUtf = Charset.to_utf8(playerName)
+ #print "db.get_player_id siteName",siteName,"playerName",playerName
+ c.execute(self.sql.query['get_player_id'], (playerNameUtf, siteNameUtf))
row = c.fetchone()
if row:
return row[0]
else:
return None
-
+
def get_player_names(self, config, site_id=None, like_player_name="%"):
"""Fetch player names from players. Use site_id and like_player_name if provided"""
@@ -1055,7 +1107,7 @@ class Database:
key = "`" + inner[j][0] + "_" + m.group() + "`"
c.execute("ALTER TABLE " + inner[j][0] + " DROP FOREIGN KEY " + key)
self.commit()
- #end drop_referential_inegrity
+ #end drop_referential_inegrity
def recreate_tables(self):
"""(Re-)creates the tables of the current DB"""
@@ -1075,7 +1127,7 @@ class Database:
c = self.get_cursor()
c.execute(self.sql.query['createSettingsTable'])
- log.debug(self.sql.query['createSitesTable'])
+ log.debug("Creating tables")
c.execute(self.sql.query['createSitesTable'])
c.execute(self.sql.query['createGametypesTable'])
c.execute(self.sql.query['createPlayersTable'])
@@ -1087,8 +1139,10 @@ class Database:
c.execute(self.sql.query['createHandsPlayersTable'])
c.execute(self.sql.query['createHandsActionsTable'])
c.execute(self.sql.query['createHudCacheTable'])
+ c.execute(self.sql.query['createBackingsTable'])
- # create unique indexes:
+ # Create unique indexes:
+ log.debug("Creating unique indexes")
c.execute(self.sql.query['addTourneyIndex'])
c.execute(self.sql.query['addHandsIndex'])
c.execute(self.sql.query['addPlayersIndex'])
@@ -1162,7 +1216,8 @@ class Database:
self.connection.set_isolation_level(0) # allow table/index operations to work
for idx in self.indexes[self.backend]:
if self.backend == self.MYSQL_INNODB:
- print "creating mysql index ", idx['tab'], idx['col']
+ print "Creating mysql index %s %s" %(idx['tab'], idx['col'])
+ log.debug("Creating mysql index %s %s" %(idx['tab'], idx['col']))
try:
s = "create index %s on %s(%s)" % (idx['col'],idx['tab'],idx['col'])
self.get_cursor().execute(s)
@@ -1170,21 +1225,23 @@ class Database:
print " create idx failed: " + str(sys.exc_info())
elif self.backend == self.PGSQL:
# mod to use tab_col for index name?
- print "creating pg index ", idx['tab'], idx['col']
+ print "Creating pgsql index %s %s" %(idx['tab'], idx['col'])
+ log.debug("Creating pgsql index %s %s" %(idx['tab'], idx['col']))
try:
s = "create index %s_%s_idx on %s(%s)" % (idx['tab'], idx['col'], idx['tab'], idx['col'])
self.get_cursor().execute(s)
except:
print " create idx failed: " + str(sys.exc_info())
elif self.backend == self.SQLITE:
- log.debug("Creating sqlite index %s %s" % (idx['tab'], idx['col']))
+ print "Creating sqlite index %s %s" %(idx['tab'], idx['col'])
+ log.debug("Creating sqlite index %s %s" %(idx['tab'], idx['col']))
try:
s = "create index %s_%s_idx on %s(%s)" % (idx['tab'], idx['col'], idx['tab'], idx['col'])
self.get_cursor().execute(s)
except:
log.debug("Create idx failed: " + str(sys.exc_info()))
else:
- print "Only MySQL, Postgres and SQLite supported so far"
+ print "Unknown database: MySQL, Postgres and SQLite supported"
return -1
if self.backend == self.PGSQL:
self.connection.set_isolation_level(1) # go back to normal isolation level
@@ -1215,8 +1272,15 @@ class Database:
% (idx['tab'],idx['col']) )
except:
print " drop idx failed: " + str(sys.exc_info())
+ elif self.backend == self.SQLITE:
+ print "Dropping sqlite index ", idx['tab'], idx['col']
+ try:
+ self.get_cursor().execute( "drop index %s_%s_idx"
+ % (idx['tab'],idx['col']) )
+ except:
+ print " drop idx failed: " + str(sys.exc_info())
else:
- print "Only MySQL and Postgres supported so far"
+ print "Only MySQL, Postgres and SQLITE supported, what are you trying to use?"
return -1
if self.backend == self.PGSQL:
self.connection.set_isolation_level(1) # go back to normal isolation level
@@ -1331,29 +1395,30 @@ class Database:
def fillDefaultData(self):
c = self.get_cursor()
c.execute("INSERT INTO Settings (version) VALUES (%s);" % (DB_VERSION))
- c.execute("INSERT INTO Sites (name,currency) VALUES ('Full Tilt Poker', 'USD')")
- c.execute("INSERT INTO Sites (name,currency) VALUES ('PokerStars', 'USD')")
- c.execute("INSERT INTO Sites (name,currency) VALUES ('Everleaf', 'USD')")
- c.execute("INSERT INTO Sites (name,currency) VALUES ('Win2day', 'USD')")
- c.execute("INSERT INTO Sites (name,currency) VALUES ('OnGame', 'USD')")
- c.execute("INSERT INTO Sites (name,currency) VALUES ('UltimateBet', 'USD')")
- c.execute("INSERT INTO Sites (name,currency) VALUES ('Betfair', 'USD')")
- c.execute("INSERT INTO Sites (name,currency) VALUES ('Absolute', 'USD')")
- c.execute("INSERT INTO Sites (name,currency) VALUES ('PartyPoker', 'USD')")
- c.execute("INSERT INTO Sites (name,currency) VALUES ('Partouche', 'EUR')")
- c.execute("INSERT INTO Sites (name,currency) VALUES ('Carbon', 'USD')")
- c.execute("INSERT INTO Sites (name,currency) VALUES ('PKR', 'USD')")
+ c.execute("INSERT INTO Sites (name,code) VALUES ('Full Tilt Poker', 'FT')")
+ c.execute("INSERT INTO Sites (name,code) VALUES ('PokerStars', 'PS')")
+ c.execute("INSERT INTO Sites (name,code) VALUES ('Everleaf', 'EV')")
+ c.execute("INSERT INTO Sites (name,code) VALUES ('Win2day', 'W2')")
+ c.execute("INSERT INTO Sites (name,code) VALUES ('OnGame', 'OG')")
+ c.execute("INSERT INTO Sites (name,code) VALUES ('UltimateBet', 'UB')")
+ c.execute("INSERT INTO Sites (name,code) VALUES ('Betfair', 'BF')")
+ c.execute("INSERT INTO Sites (name,code) VALUES ('Absolute', 'AB')")
+ c.execute("INSERT INTO Sites (name,code) VALUES ('PartyPoker', 'PP')")
+ c.execute("INSERT INTO Sites (name,code) VALUES ('Partouche', 'PA')")
+ c.execute("INSERT INTO Sites (name,code) VALUES ('Carbon', 'CA')")
+ c.execute("INSERT INTO Sites (name,code) VALUES ('PKR', 'PK')")
if self.backend == self.SQLITE:
- c.execute("INSERT INTO TourneyTypes (id, siteId, buyin, fee) VALUES (NULL, 1, 0, 0);")
+ c.execute("""INSERT INTO TourneyTypes (id, siteId, currency, buyin, fee, category, limitType,
+ buyInChips, maxSeats, knockout, rebuy, addOn, speed, shootout, matrix)
+ VALUES (NULL, 1, 'USD', 0, 0, "NA", "NA", 0, 0, 0, 0, 0, NULL, 0, 0);""")
elif self.backend == self.PGSQL:
- c.execute("""insert into TourneyTypes(siteId, buyin, fee, maxSeats, knockout
- ,rebuyOrAddon, speed, headsUp, shootout, matrix)
- values (1, 0, 0, 0, False, False, null, False, False, False);""")
+ c.execute("""insert into TourneyTypes(siteId, currency, buyin, fee, category, limitType,
+ buyInChips, maxSeats, knockout, rebuy, addOn, speed, shootout, matrix)
+ values (1, 'USD', 0, 0, "NA", "NA", 0, 0, False, False, False, null, False, False);""")
elif self.backend == self.MYSQL_INNODB:
- c.execute("""insert into TourneyTypes(id, siteId, buyin, fee, maxSeats, knockout
- ,rebuyOrAddon, speed, headsUp, shootout, matrix)
- values (DEFAULT, 1, 0, 0, 0, False, False, null, False, False, False);""")
-
+ c.execute("""insert into TourneyTypes(id, siteId, currency, buyin, fee, category, limitType,
+ buyInChips, maxSeats, knockout, rebuy, addOn, speed, shootout, matrix)
+ values (DEFAULT, 1, 'USD', 0, 0, "NA", "NA", 0, 0, False, False, False, null, False, False);""")
#end def fillDefaultData
def rebuild_indexes(self, start=None):
@@ -1361,6 +1426,7 @@ class Database:
self.createAllIndexes()
self.dropAllForeignKeys()
self.createAllForeignKeys()
+ #end def rebuild_indexes
def rebuild_hudcache(self, h_start=None, v_start=None):
"""clears hudcache and rebuilds from the individual handsplayers records"""
@@ -1390,9 +1456,9 @@ class Database:
where = ""
else:
where = "where ( hp.playerId not in " + str(tuple(self.hero_ids.values())) \
- + " and h.handStart > '" + v_start + "')" \
+ + " and h.startTime > '" + v_start + "')" \
+ " or ( hp.playerId in " + str(tuple(self.hero_ids.values())) \
- + " and h.handStart > '" + h_start + "')"
+ + " and h.startTime > '" + h_start + "')"
rebuild_sql = self.sql.query['rebuildHudCache'].replace('', where)
self.get_cursor().execute(self.sql.query['clearHudCache'])
@@ -1508,7 +1574,7 @@ class Database:
p['gameTypeId'],
p['siteHandNo'],
0, # tourneyId: 0 means not a tourney hand
- p['handStart'],
+ p['startTime'],
datetime.today(), #importtime
p['seats'],
p['maxSeats'],
@@ -1546,6 +1612,7 @@ class Database:
pids[p],
pdata[p]['startCash'],
pdata[p]['seatNo'],
+ pdata[p]['sitout'],
pdata[p]['card1'],
pdata[p]['card2'],
pdata[p]['card3'],
@@ -1621,7 +1688,12 @@ class Database:
pdata[p]['street3CheckCallRaiseChance'],
pdata[p]['street3CheckCallRaiseDone'],
pdata[p]['street4CheckCallRaiseChance'],
- pdata[p]['street4CheckCallRaiseDone']
+ pdata[p]['street4CheckCallRaiseDone'],
+ pdata[p]['street0Raises'],
+ pdata[p]['street1Raises'],
+ pdata[p]['street2Raises'],
+ pdata[p]['street3Raises'],
+ pdata[p]['street4Raises']
) )
q = self.sql.query['store_hands_players']
@@ -1650,7 +1722,7 @@ class Database:
#print "DEBUG: %s %s %s" %(hid, pids, pdata)
inserts = []
for p in pdata:
- line = [0]*61
+ line = [0]*76
line[0] = 1 # HDs
if pdata[p]['street0VPI']: line[1] = 1
@@ -1707,13 +1779,29 @@ class Database:
if pdata[p]['street3CheckCallRaiseDone']: line[52] = 1
if pdata[p]['street4CheckCallRaiseChance']: line[53] = 1
if pdata[p]['street4CheckCallRaiseDone']: line[54] = 1
- line[55] = gid # gametypeId
- line[56] = pids[p] # playerId
- line[57] = len(pids) # activeSeats
+ if pdata[p]['street0Calls']: line[55] = 1
+ if pdata[p]['street1Calls']: line[56] = 1
+ if pdata[p]['street2Calls']: line[57] = 1
+ if pdata[p]['street3Calls']: line[58] = 1
+ if pdata[p]['street4Calls']: line[59] = 1
+ if pdata[p]['street0Bets']: line[60] = 1
+ if pdata[p]['street1Bets']: line[61] = 1
+ if pdata[p]['street2Bets']: line[62] = 1
+ if pdata[p]['street3Bets']: line[63] = 1
+ if pdata[p]['street4Bets']: line[64] = 1
+ if pdata[p]['street0Raises']: line[65] = 1
+ if pdata[p]['street1Raises']: line[66] = 1
+ if pdata[p]['street2Raises']: line[67] = 1
+ if pdata[p]['street3Raises']: line[68] = 1
+ if pdata[p]['street4Raises']: line[69] = 1
+
+ line[70] = gid # gametypeId
+ line[71] = pids[p] # playerId
+ line[72] = len(pids) # activeSeats
pos = {'B':'B', 'S':'S', 0:'D', 1:'C', 2:'M', 3:'M', 4:'M', 5:'E', 6:'E', 7:'E', 8:'E', 9:'E' }
- line[58] = pos[pdata[p]['position']]
- line[59] = pdata[p]['tourneyTypeId']
- line[60] = styleKey # styleKey
+ line[73] = pos[pdata[p]['position']]
+ line[74] = pdata[p]['tourneyTypeId']
+ line[75] = styleKey # styleKey
inserts.append(line)
@@ -1759,8 +1847,9 @@ class Database:
hilo = "s"
elif game['category'] in ['razz','27_3draw','badugi']:
hilo = "l"
- tmp = self.insertGameTypes( (siteid, game['type'], game['base'], game['category'], game['limitType'], hilo,
+ tmp = self.insertGameTypes( (siteid, 'USD', game['type'], game['base'], game['category'], game['limitType'], hilo,
int(Decimal(game['sb'])*100), int(Decimal(game['bb'])*100), 0, 0) )
+ #FIXME: recognise currency
return tmp[0]
def getSqlPlayerIDs(self, pnames, siteid):
@@ -1820,48 +1909,6 @@ class Database:
# Finish of NEWIMPORT CODE
#################################
-
-
- def store_tourneys_players(self, tourney_id, player_ids, payin_amounts, ranks, winnings):
- try:
- result=[]
- cursor = self.get_cursor()
- #print "in store_tourneys_players. tourney_id:",tourney_id
- #print "player_ids:",player_ids
- #print "payin_amounts:",payin_amounts
- #print "ranks:",ranks
- #print "winnings:",winnings
- for i in xrange(len(player_ids)):
- try:
- cursor.execute("savepoint ins_tplayer")
- cursor.execute("""INSERT INTO TourneysPlayers
- (tourneyId, playerId, payinAmount, rank, winnings) VALUES (%s, %s, %s, %s, %s)""".replace('%s', self.sql.query['placeholder']),
- (tourney_id, player_ids[i], payin_amounts[i], ranks[i], winnings[i]))
-
- tmp = self.get_last_insert_id(cursor)
- result.append(tmp)
- #print "created new tourneys_players.id:", tmp
- except:
- cursor.execute("rollback to savepoint ins_tplayer")
- cursor.execute("SELECT id FROM TourneysPlayers WHERE tourneyId=%s AND playerId+0=%s".replace('%s', self.sql.query['placeholder'])
- ,(tourney_id, player_ids[i]))
- tmp = cursor.fetchone()
- #print "tried SELECTing tourneys_players.id:", tmp
- try:
- len(tmp)
- result.append(tmp[0])
- except:
- print "tplayer id not found for tourney,player %s,%s" % (tourney_id, player_ids[i])
- pass
- except:
- raise FpdbError( "store_tourneys_players error: " + str(sys.exc_value) )
-
- cursor.execute("release savepoint ins_tplayer")
- #print "store_tourneys_players returning", result
- return result
- #end def store_tourneys_players
-
-
# read HandToWrite objects from q and insert into database
def insert_queue_hands(self, q, maxwait=10, commitEachHand=True):
n,fails,maxTries,firstWait = 0,0,4,0.1
@@ -1937,59 +1984,117 @@ class Database:
print "***Error sending finish: "+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
# end def send_finish_msg():
- def tRecogniseTourneyType(self, tourney):
- log.debug("Database.tRecogniseTourneyType")
- typeId = 1
+ def createOrUpdateTourneyType(self, hand):#note: this method is used on Hand and TourneySummary objects
+ tourneyTypeId = 1
+
# Check if Tourney exists, and if so retrieve TTypeId : in that case, check values of the ttype
cursor = self.get_cursor()
cursor.execute (self.sql.query['getTourneyTypeIdByTourneyNo'].replace('%s', self.sql.query['placeholder']),
- (tourney.tourNo, tourney.siteId)
+ (hand.tourNo, hand.siteId)
)
result=cursor.fetchone()
expectedValues = { 1 : "buyin", 2 : "fee", 4 : "isKO", 5 : "isRebuy", 6 : "speed",
- 7 : "isHU", 8 : "isShootout", 9 : "isMatrix" }
- typeIdMatch = True
+ 7 : "isShootout", 8 : "isMatrix" }
+ tourneyTypeIdMatch = True
try:
- len(result)
- typeId = result[0]
- log.debug("Tourney found in db with Tourney_Type_ID = %d" % typeId)
+ tourneyTypeId = result[0]
+ log.debug("Tourney found in db with Tourney_Type_ID = %d" % tourneyTypeId)
for ev in expectedValues :
- if ( getattr( tourney, expectedValues.get(ev) ) <> result[ev] ):
- log.debug("TypeId mismatch : wrong %s : Tourney=%s / db=%s" % (expectedValues.get(ev), getattr( tourney, expectedValues.get(ev)), result[ev]) )
- typeIdMatch = False
+ if ( getattr( hand, expectedValues.get(ev) ) <> result[ev] ):
+ log.debug("TypeId mismatch : wrong %s : Tourney=%s / db=%s" % (expectedValues.get(ev), getattr( hand, expectedValues.get(ev)), result[ev]) )
+ tourneyTypeIdMatch = False
#break
except:
# Tourney not found : a TourneyTypeId has to be found or created for that specific tourney
- typeIdMatch = False
-
- if typeIdMatch == False :
- # Check for an existing TTypeId that matches tourney info (buyin/fee, knockout, rebuy, speed, matrix, shootout)
- # if not found create it
- log.debug("Searching for a TourneyTypeId matching TourneyType data")
+ tourneyTypeIdMatch = False
+
+ if tourneyTypeIdMatch == False :
+ # Check for an existing TTypeId that matches tourney info, if not found create it
cursor.execute (self.sql.query['getTourneyTypeId'].replace('%s', self.sql.query['placeholder']),
- (tourney.siteId, tourney.buyin, tourney.fee, tourney.isKO,
- tourney.isRebuy, tourney.speed, tourney.isHU, tourney.isShootout, tourney.isMatrix)
+ (hand.siteId, hand.buyinCurrency, hand.buyin, hand.fee, hand.gametype['category'], hand.gametype['limitType'], hand.isKO,
+ hand.isRebuy, hand.isRebuy, hand.speed, hand.isShootout, hand.isMatrix)
)
result=cursor.fetchone()
try:
- len(result)
- typeId = result[0]
- log.debug("Existing Tourney Type Id found : %d" % typeId)
+ tourneyTypeId = result[0]
except TypeError: #this means we need to create a new entry
- log.debug("Tourney Type Id not found : create one")
- cursor.execute (self.sql.query['insertTourneyTypes'].replace('%s', self.sql.query['placeholder']),
- (tourney.siteId, tourney.buyin, tourney.fee, tourney.isKO, tourney.isRebuy,
- tourney.speed, tourney.isHU, tourney.isShootout, tourney.isMatrix)
+ cursor.execute (self.sql.query['insertTourneyType'].replace('%s', self.sql.query['placeholder']),
+ (hand.siteId, hand.buyinCurrency, hand.buyin, hand.fee, hand.gametype['category'], hand.gametype['limitType'], hand.buyInChips,
+ hand.isKO, hand.isRebuy,
+ hand.isAddOn, hand.speed, hand.isShootout, hand.isMatrix)
)
- typeId = self.get_last_insert_id(cursor)
-
- return typeId
- #end def tRecogniseTourneyType
+ tourneyTypeId = self.get_last_insert_id(cursor)
+ return tourneyTypeId
+ #end def createOrUpdateTourneyType
+
+ def createOrUpdateTourney(self, hand, source):#note: this method is used on Hand and TourneySummary objects
+ cursor = self.get_cursor()
+ cursor.execute (self.sql.query['getTourneyIdByTourneyNo'].replace('%s', self.sql.query['placeholder']),
+ (hand.siteId, hand.tourNo))
+ result=cursor.fetchone()
+ if result != None and len(result)==1:
+ tourneyId = result[0]
+ else:
+ if source=="HHC":
+ cursor.execute (self.sql.query['insertTourney'].replace('%s', self.sql.query['placeholder']),
+ (hand.tourneyTypeId, hand.tourNo, None, None,
+ hand.startTime, None, None, None, None, None))
+ elif source=="TS":
+ cursor.execute (self.sql.query['insertTourney'].replace('%s', self.sql.query['placeholder']),
+ (hand.tourneyTypeId, hand.tourNo, hand.entries, hand.prizepool,
+ hand.startTime, hand.endTime, hand.tourneyName, hand.matrixIdProcessed, hand.totalRebuyCount, hand.totalAddOnCount))
+ else:
+ raise FpdbParseError("invalid source in Database.createOrUpdateTourney")
+ tourneyId = self.get_last_insert_id(cursor)
+ return tourneyId
+ #end def createOrUpdateTourney
+ def createOrUpdateTourneysPlayers(self, hand, source):#note: this method is used on Hand and TourneySummary objects
+ tourneysPlayersIds=[]
+ for player in hand.players:
+ if source=="TS": #TODO remove this horrible hack
+ playerId = hand.dbid_pids[player]
+ elif source=="HHC":
+ playerId = hand.dbid_pids[player[1]]
+ else:
+ raise FpdbParseError("invalid source in Database.createOrUpdateTourneysPlayers")
+
+ cursor = self.get_cursor()
+ cursor.execute (self.sql.query['getTourneysPlayersId'].replace('%s', self.sql.query['placeholder']),
+ (hand.tourneyId, playerId))
+ result=cursor.fetchone()
+
+ if result != None and len(result)==1:
+ tourneysPlayersIds.append(result[0])
+ else:
+ if source=="HHC":
+ cursor.execute (self.sql.query['insertTourneysPlayer'].replace('%s', self.sql.query['placeholder']),
+ (hand.tourneyId, playerId, None, None, None, None, None, None))
+ elif source=="TS":
+ #print "all values: tourneyId",hand.tourneyId, "playerId",playerId, "rank",hand.ranks[player], "winnings",hand.winnings[player], "winCurr",hand.winningsCurrency[player], hand.rebuyCounts[player], hand.addOnCounts[player], hand.koCounts[player]
+ if hand.ranks[player]:
+ cursor.execute (self.sql.query['insertTourneysPlayer'].replace('%s', self.sql.query['placeholder']),
+ (hand.tourneyId, playerId, int(hand.ranks[player]), int(hand.winnings[player]), hand.winningsCurrency[player],
+ hand.rebuyCounts[player], hand.addOnCounts[player], hand.koCounts[player]))
+ else:
+ cursor.execute (self.sql.query['insertTourneysPlayer'].replace('%s', self.sql.query['placeholder']),
+ (hand.tourneyId, playerId, None, None, None,
+ hand.rebuyCounts[player], hand.addOnCounts[player], hand.koCounts[player]))
+ tourneysPlayersIds.append(self.get_last_insert_id(cursor))
+ return tourneysPlayersIds
+ #end def createOrUpdateTourneysPlayers
+
+ def getTourneyTypesIds(self):
+ c = self.connection.cursor()
+ c.execute(self.sql.query['getTourneyTypesIds'])
+ result = c.fetchall()
+ return result
+ #end def getTourneyTypesIds
+#end class Database
# Class used to hold all the data needed to write a hand to the db
# mainParser() in fpdb_parse_logic.py creates one of these and then passes it to
@@ -2036,12 +2141,11 @@ class HandToWrite:
self.maxSeats = None
self.tableName = None
self.seatNos = None
- self.payin_amounts = None # tourney import was complaining mightily about this missing
except:
print "htw.init error: " + str(sys.exc_info())
raise
# end def __init__
-
+
def set_all( self, config, settings, base, category, siteTourneyNo, buyin
, fee, knockout, entries, prizepool, tourneyStartTime
, isTourney, tourneyTypeId, siteID, siteHandNo
diff --git a/pyfpdb/DatabaseManager.py b/pyfpdb/DatabaseManager.py
deleted file mode 100644
index 150415ce..00000000
--- a/pyfpdb/DatabaseManager.py
+++ /dev/null
@@ -1,810 +0,0 @@
-"""Database manager
-
-@todo: (gtk) how to validate user input in gtk.Dialog? as soon as the user clicks ok the dialog is dead. we use a while loop as workaround. not nice
-@todo: (fpdb) we need the application name 'fpdb' from somewhere to put it in dialog titles
-@todo: (fpdb) config object should be initialized globally and accessible from all modules via Configuration.py
-
-@todo: (all dialogs) save/restore size and pos
-
-@todo: (WidgetDatabaseManager) give database status meaningful colors
-@todo: (WidgetDatabaseManager) implement database purging
-@todo: (WidgetDatabaseManager) implement database export
-@todo: (WidgetDatabaseManager) what to do on database doubleclick?
-@todo: (WidgetDatabaseManager) context menu for database tree
-@todo: (WidgetDatabaseManager) initializing/validating databases may take a while. how to give feedback?
-
-"""
-
-import os
-import pygtk
-pygtk.require('2.0')
-import gtk
-import gobject
-
-#*******************************************************************************************************
-class DatabaseManager(gobject.GObject):
- DatabaseTypes = {}
-
- @classmethod
- def from_fpdb(klass, data, defaultDatabaseType=None):
-
- #NOTE: if no databases are present in config fpdb fails with
- # Traceback (most recent call last):
- # File "/home/me2/Scr/Repos/fpdb-mme/pyfpdb/DatabaseManager.py", line 783, in
- # databaseManager = DatabaseManager.from_fpdb('', defaultDatabaseType=DatabaseTypeSqLite)
- # File "/home/me2/Scr/Repos/fpdb-mme/pyfpdb/DatabaseManager.py", line 36, in from_fpdb
- # config = Configuration.Config(file=options.config, dbname=options.dbname)
- # File "/home/me2/Scr/Repos/fpdb-mme/pyfpdb/Configuration.py", line 436, in __init__
- # db = self.get_db_parameters()
- # File "/home/me2/Scr/Repos/fpdb-mme/pyfpdb/Configuration.py", line 583, in get_db_parameters
- # name = self.db_selected
- # AttributeError: Config instance has no attribute 'db_selected'
- import sys
- import Options
- import Configuration
- #NOTE: fpdb should perform this globally
- (options, argv) = Options.fpdb_options()
- config = Configuration.Config(file=options.config, dbname=options.dbname)
- #TODO: handle no database present
- defaultDatabaseName = config.get_db_parameters().get('db-databaseName', None)
- #TODO: fpdb stores databases in no particular order. this has to be fixed somehow
- databases = []
- for name, fpdbDatabase in config.supported_databases.items():
- databaseKlass = klass.DatabaseTypes.get(fpdbDatabase.db_server, None)
- #NOTE: Config does not seem to validate user input, so anything may end up here
- if databaseKlass is None:
- raise ValueError('Unknown databasetype: %s' % fpdbDatabase.db_server)
-
- database = databaseKlass()
- if database.Type == 'sqlite':
- database.name = fpdbDatabase.db_name
- database.file = fpdbDatabase.db_server
- else:
- database.name = fpdbDatabase.db_name
- database.host = fpdbDatabase.db_server
- #NOTE: fpdbDatabase.db_ip is no is a string
- database.port = int(fpdbDatabase.db_ip)
- database.user = fpdbDatabase.db_user
- database.password = fpdbDatabase.db_pass
- databases.append(database)
-
- return klass(databases=databases, defaultDatabaseType=defaultDatabaseType)
-
- def to_fpdb(self):
- pass
-
-
- def __init__(self, databases=None, defaultDatabaseType=None):
- gobject.GObject.__init__(self)
-
- self._defaultDatabaseType = defaultDatabaseType
- self._databases = [] if databases is None else list(databases)
- self._activeDatabase = None
- def __iter__(self):
- return iter(self._databases)
- def set_default_database_type(self, databaseType):
- self._defaultDatabaseType = defaultDatabaseType
- def get_default_database_type(self):
- return self._defaultDatabaseType
- def database_from_id(self, idDatabase):
- for database in self._databases:
- if idDatabase == self.database_id(database):
- return database
- def database_id(self, database):
- return id(database)
- def add_database(self, database):
- if database in self._databases:
- raise ValueError('database already registered')
- self._databases.append(database)
- def remove_database(self, database):
- self._databases.remove(database)
-
- def activate_database(self, database):
- if self._activeDatabase is not None:
- self._activeDatabase.status = self._activeDatabase.StatusInactive
- #TODO: finalize database
- self.emit('database-deactivated', self.database_id(self._activeDatabase) )
-
- database.status = database.StatusActive
- #TODO: activate database
- self._activeDatabase = database
- self.emit('database-activated', self.database_id(database) )
-
- def active_database(self):
- return self._activeDatabase
-
-# register DatabaseManager signals
-gobject.type_register(DatabaseManager)
-gobject.signal_new('database-activated', DatabaseManager, gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (int, ))
-gobject.signal_new('database-deactivated', DatabaseManager, gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (int, ))
-gobject.signal_new('database-error', DatabaseManager, gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (int, ))
-
-class DatabaseTypeMeta(type):
- def __new__(klass, name, bases, kws):
- newKlass = type.__new__(klass, name, bases, kws)
- if newKlass.Type is not None:
- if newKlass.Type in DatabaseManager.DatabaseTypes:
- raise ValueError('data base type already registered for: %s' % newKlass.Type)
- DatabaseManager.DatabaseTypes[newKlass.Type] = newKlass
- return newKlass
-
-class DatabaseTypeBase(object):
- __metaclass__ = DatabaseTypeMeta
- Type = None
- StatusActive = 'active'
- StatusInactive = 'inactive'
- StatusError = 'error' #TODO: not implemented
-
- #TODO: not happy with returning error string. just being too lazy to impl dozens of error codes for later translation
- def init_new_database(self):
- """initializes a new empty database
- @return: (str) error if something goes wrong, None otherwise
- """
- raise NotImplementedError()
-
- def validate_database(self):
- """checks if the database is valid
- @return: (str) error if something goes wrong, None otherwise
- """
- raise NotImplementedError()
-
-class DatabaseTypePostgres(DatabaseTypeBase):
- Type = 'postgresql'
- @classmethod
- def display_name(klass):
- return 'Postgres'
- def __init__(self, name='', host='localhost', port=5432, user='postgres', password='', database='fpdb'):
- self.name = name
- self.host = host
- self.port = port
- self.user = user
- self.password = password
- self.database = database
- self.status = self.StatusInactive
-
- #TODO: implement
- def init_new_database(self):
- pass
-
- #TODO: implement
- def validate_database(self):
- pass
-
-class DatabaseTypeMysql(DatabaseTypeBase):
- Type = 'mysql'
- @classmethod
- def display_name(klass):
- return 'MySql'
- def __init__(self, name='', host='localhost', port=3306, user='root', password='', database='fpdb'):
- self.name = name
- self.host = host
- self.port = port
- self.user = user
- self.password = password
- self.database = database
- self.status = self.StatusInactive
-
- #TODO: implement
- def init_new_database(self):
- pass
-
- #TODO: implement
- def validate_database(self):
- pass
-
-
-class DatabaseTypeSqLite(DatabaseTypeBase):
- Type = 'sqlite'
- @classmethod
- def display_name(klass):
- return 'SqLite'
- def __init__(self, name='', host='', file='', database='fpdb'):
- self.name = name
- self.file = file
- self.status = self.StatusInactive
-
- def init_new_database(self):
- # make shure all attrs are specified
- if not self.file:
- return 'no database file specified'
- # create file if necessary (this will truncate file if it exists)
- try:
- open(self.file, 'w').close()
- except IOError:
- return 'can not write file'
-
- #TODO: init tables (...)
-
-
- def validate_database(self):
- pass
- #TODO: check if tables (...) exist
-
-
-
-#TODO: how do we want to handle unsupported database types?
-# ..uncomment to remove unsupported database types
-#try: import psycopg2
-#except ImportError: del DatabaseManager.DatabaseTypes['postgres']
-#try: import MySQLdb
-#except ImportError: del DatabaseManager.DatabaseTypes['mysql']
-#try: import sqlite3
-#except ImportError: del DatabaseManager.DatabaseTypes['sqlite']
-
-#***************************************************************************************************************************
-#TODO: there is no title (on linux), wtf?
-def DialogError(parent=None, msg=''):
- dlg = gtk.MessageDialog(
- parent=parent,
- flags=gtk.DIALOG_MODAL|gtk.DIALOG_DESTROY_WITH_PARENT,
- type=gtk.MESSAGE_ERROR,
- buttons=gtk.BUTTONS_OK,
- message_format=msg,
- )
- dlg.run()
- dlg.destroy()
- return None
-
-
-#TODO: derrive from gtk.VBox?
-class WidgetDatabaseProperties(gtk.VBox):
-
- ModeNew = 0
- ModeEdit = 1
- ModeAdd = 2
-
- class SqLiteFileChooserButton(gtk.HBox):
- #NOTE: for some weird reason it is impossible to let the user choose a non exiting filename with gtk.FileChooserButton, so impl our own on the fly
- def __init__(self, widgetDatabaseProperties, parentWidget):
- gtk.HBox.__init__(self)
- self.set_homogeneous(False)
-
- self.parentWidget = parentWidget
- self.widgetDatabaseProperties = widgetDatabaseProperties
- self.entry = gtk.Entry()
- self.button = gtk.Button('...')
- self.button.connect('clicked', self.on_button_clicked)
-
- # layout widgets
- self.pack_start(self.entry, True, True)
- self.pack_start(self.button, False, False)
-
- def get_filename(self):
- return self.entry.get_text()
-
- def set_filename(self, name):
- self.entry.set_text(name)
-
- def on_button_clicked(self, button):
- if self.widgetDatabaseProperties.mode == WidgetDatabaseProperties.ModeAdd:
- action = gtk.FILE_CHOOSER_ACTION_OPEN
- elif self.widgetDatabaseProperties.mode == WidgetDatabaseProperties.ModeNew:
- action = gtk.FILE_CHOOSER_ACTION_SAVE
- else:
- raise ValueError('unsupported dialog mode')
- dlg = gtk.FileChooserDialog(
- title='Choose an exiting database file or type in name of a new one',
- parent=self.parentWidget,
- action=action,
- buttons=(
- gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
- gtk.STOCK_OK, gtk.RESPONSE_OK,
- ),
- backend=None
- )
- dlg.set_default_response(gtk.RESPONSE_OK)
- dlg.set_do_overwrite_confirmation(True)
- if dlg.run() == gtk.RESPONSE_OK:
- fileName = dlg.get_filename()
- self.set_filename(fileName)
- dlg.destroy()
-
-
- #TODO: bit ugly this thingy. try to find a better way to map database attrs to gtk widgets
- class FieldWidget(object):
- def __init__(self, text='', attrDatabase='', widget=None, attrGet=None, attrSet=None, defaultValue=None, canEdit=False, tooltip=''):
- """
- @param canEdit: True if the user can edit the attr in edit mode, False otherwise
- """
- self._label = gtk.Label(text)
- self._attrDatabase = attrDatabase
- self._widget = widget
- self._defaultValue = defaultValue
- self._attrGetter=None,
- self._attrGet = attrGet
- self._attrSet = attrSet
- self._canEdit = canEdit
-
- self._label.set_tooltip_text(tooltip)
- self._widget.set_tooltip_text(tooltip)
-
- def widget(self):
- return self._widget
- def label(self):
- return self._label
- def is_sensitive(self, database):
- return hasattr(database, self._attrDatabase)
- def can_edit(self):
- return self._canEdit
- def set_sensitive(self, flag):
- self._label.set_sensitive(flag)
- self._widget.set_sensitive(flag)
- def value_from_database(self, database):
- getattr(self._widget, self._attrSet)( getattr(database, self._attrDatabase) )
- def value_to_database(self, database):
- setattr(database, self._attrDatabase, getattr(self._widget, self._attrGet)() )
- def reset_value(self):
- getattr(self._widget, self._attrSet)(self._defaultValue)
-
- def __init__(self, databaseManager, database, mode=ModeEdit, parentWidget=None):
- gtk.VBox.__init__(self)
-
- self.databaseManager = databaseManager
- self.database = database
- self.mode = mode
- self.parentWidget = parentWidget
- self.fieldWidgets = (
- self.FieldWidget(
- text='Name:',
- attrDatabase='name',
- widget=gtk.Entry(),
- defaultValue='',
- attrGet='get_text',
- attrSet='set_text',
- canEdit=True,
- tooltip='Any name you like to name the database '
- ),
- self.FieldWidget(
- text='File:',
- attrDatabase='file',
- widget=self.SqLiteFileChooserButton(self, self.parentWidget),
- defaultValue='',
- attrGet='get_filename',
- attrSet='set_filename',
- canEdit=False,
- tooltip='Fully qualified path of the file to hold the database '
- ),
- self.FieldWidget(
- text='Host:',
- attrDatabase='host',
- widget=gtk.Entry(),
- defaultValue='',
- attrGet='get_text',
- attrSet='set_text',
- canEdit=False,
- tooltip='Host the database is located at'
- ),
- self.FieldWidget(
- text='Port:',
- attrDatabase='port',
- widget=gtk.SpinButton(adjustment=gtk.Adjustment(value=0, lower=0, upper=999999, step_incr=1, page_incr=10) ),
- defaultValue=0,
- attrGet='get_value',
- attrSet='set_value',
- canEdit=False,
- tooltip='Port to use to connect to the host'
- ),
- self.FieldWidget(
- text='User:',
- attrDatabase='user',
- widget=gtk.Entry(),
- defaultValue='',
- attrGet='get_text',
- attrSet='set_text',
- canEdit=False,
- tooltip='User name used to login to the host'
- ),
- self.FieldWidget(
- text='Pwd:',
- attrDatabase='password',
- widget=gtk.Entry(),
- defaultValue='',
- attrGet='get_text',
- attrSet='set_text',
- canEdit=False,
- tooltip='Password used to login to the host'
- ),
- self.FieldWidget(
- text='Db:',
- attrDatabase='database',
- widget=gtk.Entry(),
- defaultValue='',
- attrGet='get_text',
- attrSet='set_text',
- canEdit=False,
- tooltip='Name of the database'
- ),
- )
-
- # setup database type combo
- self.comboType = gtk.ComboBox()
- listStore= gtk.ListStore(str, str)
- self.comboType.set_model(listStore)
- cell = gtk.CellRendererText()
- self.comboType.pack_start(cell, True)
- self.comboType.add_attribute(cell, 'text', 0)
- self.comboType.connect('changed', self.on_combo_type_changed)
-
- # fill database type combo with available database klasses. we store (databaseDisplayName, databaseType) in our model for later lookup
- iCurrentDatabase = 0
- databaseTypes = [(klass.display_name(), klass.Type) for klass in databaseManager.DatabaseTypes.values()]
- databaseTypes.sort()
- for i, (databaseDisplayName, databaseType) in enumerate(databaseTypes):
- listStore.append( (databaseDisplayName, databaseType) )
- if databaseType == self.database.Type:
- iCurrentDatabase = i
- if self.mode == self.ModeEdit or len(databaseTypes) < 2:
- self.comboType.set_button_sensitivity(gtk.SENSITIVITY_OFF)
-
- # init and layout field widgets
- self.pack_start(self.comboType, False, False, 2)
- table = gtk.Table(rows=len(self.fieldWidgets) +1, columns=2, homogeneous=False)
- self.pack_start(table, False, False, 2)
- for i,fieldWidget in enumerate(self.fieldWidgets):
- table.attach(fieldWidget.label(), 0, 1, i, i+1, xoptions=gtk.FILL)
- table.attach(fieldWidget.widget(), 1, 2, i, i+1)
-
- # init widget
- self.comboType.set_active(iCurrentDatabase)
- self._adjust_widgets(self.database)
-
- def _adjust_widgets(self, database):
- for fieldWidget in self.fieldWidgets:
- isSensitive = fieldWidget.is_sensitive(database)
- if isSensitive:
- fieldWidget.value_from_database(database)
- else:
- fieldWidget.reset_value()
- if self.mode == self.ModeEdit:
- isSensitive = isSensitive and fieldWidget.can_edit()
- fieldWidget.set_sensitive(isSensitive)
-
-
- def on_combo_type_changed(self, combo):
- i = self.comboType.get_active()
- if i < 0:
- return
-
- # check if we need to init a new database
- currentDatabaseType = self.comboType.get_model()[i][1]
- if currentDatabaseType == self.database.Type:
- return
-
- # create new empty database
- #NOTE: we dont register it in DatabaseManager
- self.database = self.databaseManager.DatabaseTypes[currentDatabaseType]()
- self._adjust_widgets(self.database)
-
-
- def get_database(self):
- for fieldWidget in self.fieldWidgets:
- if fieldWidget.is_sensitive(self.database):
- fieldWidget.value_to_database(self.database)
- return self.database
-
-
-class DialogDatabaseProperties(gtk.Dialog):
- def __init__(self, databaseManager, database, parent=None, mode=WidgetDatabaseProperties.ModeEdit, title=''):
- gtk.Dialog.__init__(self,
- title=title,
- parent=parent,
- flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
- buttons=(
- gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
- gtk.STOCK_OK, gtk.RESPONSE_ACCEPT,
- )
- )
- self.connect('response', self.on_dialog_response)
-
- # setup widget
- self.widgetDatabaseProperties = WidgetDatabaseProperties(databaseManager,database, mode=mode, parentWidget=self)
- self.vbox.pack_start(self.widgetDatabaseProperties, True, True)
- self.show_all()
-
- def get_widget_database_properties(self):
- return self.widgetDatabaseProperties
-
- def on_dialog_response(self, dlg, responseId):
- if responseId == gtk.RESPONSE_REJECT:
- pass
- elif responseId == gtk.RESPONSE_ACCEPT:
- pass
-
-
-#TODO: derrive from gtk.VBox?
-# ..is there a way to derrive from gtk.Widget or similar? this would make parentWidget kw obsolete
-class WidgetDatabaseManager(gtk.VBox):
- """
- """
-
- def __init__(self, databaseManager, parentWidget=None):
- gtk.VBox.__init__(self)
-
- self.parentWidget = parentWidget
- self.databaseManager = databaseManager
- self.databaseManager.connect('database-activated', self.on_database_manager_database_activated)
- self.databaseManager.connect('database-deactivated', self.on_database_manager_database_deactivated)
- self.databaseStatusNames = {
- DatabaseTypeBase.StatusActive: 'Active',
- DatabaseTypeBase.StatusInactive: 'Inactive',
- DatabaseTypeBase.StatusError: 'Error',
- }
-
-
- #TODO: dono how to make word wrap work as expected
- self.labelInfo = gtk.Label('database management')
- self.labelInfo.set_line_wrap(True)
- self.labelInfo.set_selectable(True)
- self.labelInfo.set_single_line_mode(False)
- self.labelInfo.set_alignment(0, 0)
-
- # database management buttons
-
- #TODO: bit messy the distinction New/Add/Edit. we'd have to pass three flags to DialogDatabaseProperties
- # to handle this. maybe drop Edit (is just a Remove + Add), to keep things simple
- self.buttonDatabaseActivate = gtk.Button("Activate")
- self.buttonDatabaseActivate.set_tooltip_text('activates the database')
- self.buttonDatabaseActivate.connect('clicked', self.on_button_database_activate_clicked)
- self.buttonDatabaseActivate.set_sensitive(False)
- self.buttonDatabaseNew = gtk.Button("New..")
- self.buttonDatabaseNew.set_tooltip_text('creates a new database')
- self.buttonDatabaseNew.connect('clicked', self.on_button_database_new_clicked)
- self.buttonDatabaseAdd = gtk.Button("Add..")
- self.buttonDatabaseAdd.set_tooltip_text('adds an existing database')
- self.buttonDatabaseAdd.connect('clicked', self.on_button_database_add_clicked)
- self.buttonDatabaseEdit = gtk.Button("Edit..")
- self.buttonDatabaseEdit.set_tooltip_text('edit database settings')
- self.buttonDatabaseEdit.connect('clicked', self.on_button_database_edit_clicked)
- self.buttonDatabaseEdit.set_sensitive(False)
- self.buttonDatabaseRemove = gtk.Button("Remove")
- self.buttonDatabaseRemove.set_tooltip_text('removes the database from the list')
- self.buttonDatabaseRemove.set_sensitive(False)
- self.buttonDatabaseRemove.connect('clicked', self.on_button_database_remove_clicked)
-
- #TODO: i dont think we should do any real database management here. maybe drop it
- #self.buttonDatabaseDelete = gtk.Button("Delete")
- #self.buttonDatabaseDelete.set_tooltip_text('removes the database from the list and deletes it')
- #self.buttonDatabaseDelete.set_sensitive(False)
-
- # init database tree
- self.treeDatabases = gtk.TreeView()
- treeDatabaseColumns = ( # name, displayName, dataType
- ('name', 'Name', str),
- ('status', 'Status', str),
- ('type', 'Type', str),
- ('_id', '', int),
- )
- self.treeDatabaseColumns = {} # name --> index
- store = gtk.ListStore( *[i[2] for i in treeDatabaseColumns] )
- self.treeDatabases.set_model(store)
- for i, (name, displayName, dataType) in enumerate(treeDatabaseColumns):
- col = gtk.TreeViewColumn(displayName, gtk.CellRendererText(), text=i)
- self.treeDatabases.append_column(col)
- if name.startswith('_'):
- col.set_visible(False)
- self.treeDatabaseColumns[name] = i
- self.treeDatabases.get_selection().connect('changed', self.on_tree_databases_selection_changed)
-
- # layout widgets
- vbox = gtk.VBox(self)
- vbox.pack_start(self.labelInfo, False, False, 2)
- vbox.pack_start(gtk.HSeparator(), False, False, 2)
- hbox = gtk.HBox()
- self.add(hbox)
- hbox.set_homogeneous(False)
- vbox = gtk.VBox()
- hbox.pack_start(vbox, False, False, 2)
- vbox.pack_start(self.buttonDatabaseActivate, False, False, 2)
- vbox.pack_start(self.buttonDatabaseNew, False, False, 2)
- vbox.pack_start(self.buttonDatabaseAdd, False, False, 2)
- vbox.pack_start(self.buttonDatabaseEdit, False, False, 2)
- vbox.pack_start(self.buttonDatabaseRemove, False, False, 2)
- #vbox.pack_start(self.buttonDatabaseDelete, False, False, 2)
- box = gtk.VBox()
- vbox.pack_start(box, True, True, 0)
-
- hbox.pack_start(gtk.VSeparator(), False, False, 2)
- hbox.pack_end(self.treeDatabases, True, True, 2)
-
- self.show_all()
-
- # init widget
- model = self.treeDatabases.get_model()
- for database in self.databaseManager:
- it = model.append()
- model.set_value(it, self.treeDatabaseColumns['name'], database.name)
- model.set_value(it, self.treeDatabaseColumns['status'], self.databaseStatusNames[database.status] )
- model.set_value(it, self.treeDatabaseColumns['type'], database.display_name() )
- model.set_value(it, self.treeDatabaseColumns['_id'], self.databaseManager.database_id(database))
-
-
- def on_database_manager_database_activated(self, databaseManager, idDatabase):
- database = self.databaseManager.database_from_id(idDatabase)
- model = self.treeDatabases.get_model()
- for row in iter(model):
- if row[self.treeDatabaseColumns['_id']] == idDatabase:
- row[self.treeDatabaseColumns['status']] = self.databaseStatusNames[database.StatusActive]
- break
- else:
- raise ValueError('database not found')
-
-
- def on_database_manager_database_deactivated(self, databaseManager, idDatabase):
- database = self.databaseManager.database_from_id(idDatabase)
- model = self.treeDatabases.get_model()
- for row in iter(model):
- if row[self.treeDatabaseColumns['_id']] == idDatabase:
- row[self.treeDatabaseColumns['status']] = self.databaseStatusNames[database.StatusInactive]
- break
- else:
- raise ValueError('database not found')
-
-
- def on_button_database_activate_clicked(self, button):
- selection = self.treeDatabases.get_selection()
- if selection is None:
- return
-
- model, it = selection.get_selected()
- idDatabase = model.get_value(it, self.treeDatabaseColumns['_id'])
- database = self.databaseManager.database_from_id(idDatabase)
- self.databaseManager.activate_database(database)
-
-
- #TODO: for some reason i have to click OK/Cancel twice to close the dialog
- def on_button_database_new_clicked(self, button):
- databaseKlass = self.databaseManager.get_default_database_type()
- if databaseKlass is None:
- raise ValueError('no default database type set')
- database = databaseKlass()
-
- while True:
- dlg = DialogDatabaseProperties(
- self.databaseManager,
- database,
- parent=self.parentWidget,
- mode=WidgetDatabaseProperties.ModeNew,
- title='New database'
- )
- response = dlg.run()
- if response == gtk.RESPONSE_ACCEPT:
- database = dlg.get_widget_database_properties().get_database()
- #TODO: initing may or may not take a while. how to handle?
- error = database.init_new_database()
- if error:
- DialogError(parent=dlg, msg=error)
- dlg.destroy()
- continue
- else:
- database = None
- dlg.destroy()
- break
-
-
- if database is None:
- return
-
- self.databaseManager.add_database(database)
- model = self.treeDatabases.get_model()
- it = model.append()
- model.set_value(it, self.treeDatabaseColumns['name'], database.name)
- model.set_value(it, self.treeDatabaseColumns['status'], self.databaseStatusNames[database.status] )
- model.set_value(it, self.treeDatabaseColumns['type'], database.display_name() )
- model.set_value(it, self.treeDatabaseColumns['_id'], self.databaseManager.database_id(database))
-
-
- def on_button_database_add_clicked(self, button):
- databaseKlass = self.databaseManager.get_default_database_type()
- if databaseKlass is None:
- raise ValueError('no defult database type set')
- database = databaseKlass()
-
- while True:
- dlg = DialogDatabaseProperties(
- self.databaseManager,
- database,
- parent=self.parentWidget,
- mode=WidgetDatabaseProperties.ModeAdd,
- title='Add database'
- )
- response = dlg.run()
- if response == gtk.RESPONSE_ACCEPT:
- database = dlg.get_widget_database_properties().get_database()
- #TODO: validating may or may not take a while. how to handle?
- error = database.validate_database()
- if error:
- DialogError(parent=self.parentWidget, msg=error)
- dlg.destroy()
- continue
- else:
- database = None
- dlg.destroy()
- break
-
- if database is None:
- return
-
- self.databaseManager.add_database(database)
- model = self.treeDatabases.get_model()
- it = model.append()
- model.set_value(it, self.treeDatabaseColumns['name'], database.name)
- model.set_value(it, self.treeDatabaseColumns['status'], self.databaseStatusNames[database.status] )
- model.set_value(it, self.treeDatabaseColumns['type'], database.display_name() )
- model.set_value(it, self.treeDatabaseColumns['_id'], self.databaseManager.database_id(database))
- dlg.destroy()
-
- def on_button_database_edit_clicked(self, button):
- selection = self.treeDatabases.get_selection()
- if selection is None:
- return
-
- model, it = selection.get_selected()
- idDatabase = model.get_value(it, self.treeDatabaseColumns['_id'])
- database = self.databaseManager.database_from_id(idDatabase)
- dlg = DialogDatabaseProperties(
- self.databaseManager,
- database,
- parent=self.parentWidget,
- mode=WidgetDatabaseProperties.ModeEdit,
- title='Edit database'
- )
- response = dlg.run()
- if response == gtk.RESPONSE_REJECT:
- pass
- elif response == gtk.RESPONSE_ACCEPT:
- database = dlg.get_database()
- selection = self.treeDatabases.get_selection()
- if selection is not None:
- model, it = selection.get_selected()
- model.set_value(it, self.treeDatabaseColumns['name'], database.name)
- dlg.destroy()
-
-
- def on_button_database_remove_clicked(self, button):
- selection = self.treeDatabases.get_selection()
- if selection is None:
- return
-
- model, it = selection.get_selected()
- #TODO: finalize database
- model.remove(it)
-
-
- def on_tree_databases_selection_changed(self, treeSelection):
- hasSelection = bool(treeSelection.count_selected_rows())
-
- # enable/disable selection dependend widgets
- self.buttonDatabaseActivate.set_sensitive(hasSelection)
- self.buttonDatabaseEdit.set_sensitive(hasSelection)
- self.buttonDatabaseRemove.set_sensitive(hasSelection)
- #self.buttonDatabaseDelete.set_sensitive(hasSelection)
-
-
-class DialogDatabaseManager(gtk.Dialog):
- def __init__(self, databaseManager, parent=None):
- gtk.Dialog.__init__(self,
- title="Databases",
- parent=parent,
- flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
- buttons=(
- gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
- gtk.STOCK_OK, gtk.RESPONSE_ACCEPT,
- ))
- #self.set_size_request(260, 250)
- self.widgetDatabaseManager = WidgetDatabaseManager(databaseManager, parentWidget=self)
- self.vbox.pack_start(self.widgetDatabaseManager, True, True)
- self.show_all()
-
-#**************************************************************************************************
-if __name__ == '__main__':
- databaseManager = DatabaseManager.from_fpdb('', defaultDatabaseType=DatabaseTypeSqLite)
-
- #d = DialogDatabaseProperties(
- # DatabaseManager(defaultDatabaseType=DatabaseTypeSqLite),
- #database=DatabaseTypePostgres(),
- # database=None,
- # )
- d = DialogDatabaseManager(databaseManager)
- d.connect("destroy", gtk.main_quit)
- d.run()
- #gtk.main()
diff --git a/pyfpdb/DerivedStats.py b/pyfpdb/DerivedStats.py
index 327b8de2..96928486 100644
--- a/pyfpdb/DerivedStats.py
+++ b/pyfpdb/DerivedStats.py
@@ -1,6 +1,7 @@
#!/usr/bin/python
+# -*- coding: utf-8 -*-
-#Copyright 2008 Carl Gherardi
+#Copyright 2008-2010 Carl Gherardi
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
@@ -12,8 +13,7 @@
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see .
-#In the "official" distribution you can find the license in
-#agpl-3.0.txt in the docs folder of the package.
+#In the "official" distribution you can find the license in agpl-3.0.txt.
#fpdb modules
import Card
@@ -62,17 +62,18 @@ class DerivedStats():
for i in range(5):
self.handsplayers[player[1]]['street%dCalls' % i] = 0
self.handsplayers[player[1]]['street%dBets' % i] = 0
+ self.handsplayers[player[1]]['street%dRaises' % i] = 0
for i in range(1,5):
self.handsplayers[player[1]]['street%dCBChance' %i] = False
self.handsplayers[player[1]]['street%dCBDone' %i] = False
self.handsplayers[player[1]]['street%dCheckCallRaiseChance' %i] = False
self.handsplayers[player[1]]['street%dCheckCallRaiseDone' %i] = False
+ self.handsplayers[player[1]]['otherRaisedStreet%d' %i] = False
+ self.handsplayers[player[1]]['foldToOtherRaisedStreet%d' %i] = False
#FIXME - Everything below this point is incomplete.
self.handsplayers[player[1]]['tourneyTypeId'] = 1
for i in range(1,5):
- self.handsplayers[player[1]]['otherRaisedStreet%d' %i] = False
- self.handsplayers[player[1]]['foldToOtherRaisedStreet%d' %i] = False
self.handsplayers[player[1]]['foldToStreet%dCBChance' %i] = False
self.handsplayers[player[1]]['foldToStreet%dCBDone' %i] = False
@@ -96,7 +97,7 @@ class DerivedStats():
self.hands['tableName'] = hand.tablename
self.hands['siteHandNo'] = hand.handid
self.hands['gametypeId'] = None # Leave None, handled later after checking db
- self.hands['handStart'] = hand.starttime # format this!
+ self.hands['startTime'] = hand.startTime # format this!
self.hands['importTime'] = None
self.hands['seats'] = self.countPlayers(hand)
self.hands['maxSeats'] = hand.maxseats
@@ -138,7 +139,10 @@ class DerivedStats():
for player in hand.players:
self.handsplayers[player[1]]['seatNo'] = player[0]
self.handsplayers[player[1]]['startCash'] = int(100 * Decimal(player[2]))
+ self.handsplayers[player[1]]['sitout'] = False #TODO: implement actual sitout detection
+ # XXX: enumerate(list, start=x) is python 2.6 syntax; 'start'
+ #for i, street in enumerate(hand.actionStreets[2:], start=1):
for i, street in enumerate(hand.actionStreets[2:]):
self.seen(self.hand, i+1)
@@ -146,6 +150,8 @@ class DerivedStats():
self.aggr(self.hand, i)
self.calls(self.hand, i)
self.bets(self.hand, i)
+ if i>0:
+ self.folds(self.hand, i)
# Winnings is a non-negative value of money collected from the pot, which already includes the
# rake taken out. hand.collectees is Decimal, database requires cents
@@ -368,8 +374,8 @@ class DerivedStats():
name = self.lastBetOrRaiser(hand.actionStreets[i+1])
if name:
chance = self.noBetsBefore(hand.actionStreets[i+2], name)
- self.handsplayers[name]['street%dCBChance' % (i+1)] = True
if chance == True:
+ self.handsplayers[name]['street%dCBChance' % (i+1)] = True
self.handsplayers[name]['street%dCBDone' % (i+1)] = self.betStreet(hand.actionStreets[i+2], name)
def calcCheckCallRaise(self, hand):
@@ -380,6 +386,7 @@ class DerivedStats():
CG: CheckCall would be a much better name for this.
"""
+ # XXX: enumerate(list, start=x) is python 2.6 syntax; 'start'
#for i, street in enumerate(hand.actionStreets[2:], start=1):
for i, street in enumerate(hand.actionStreets[2:]):
actions = hand.actions[hand.actionStreets[i+1]]
@@ -408,10 +415,16 @@ class DerivedStats():
def aggr(self, hand, i):
aggrers = set()
+ others = set()
# Growl - actionStreets contains 'BLINDSANTES', which isn't actually an action street
+
+ firstAggrMade=False
for act in hand.actions[hand.actionStreets[i+1]]:
+ if firstAggrMade:
+ others.add(act[0])
if act[1] in ('completes', 'bets', 'raises'):
aggrers.add(act[0])
+ firstAggrMade=True
for player in hand.players:
#print "DEBUG: actionStreet[%s]: %s" %(hand.actionStreets[i+1], i)
@@ -419,6 +432,17 @@ class DerivedStats():
self.handsplayers[player[1]]['street%sAggr' % i] = True
else:
self.handsplayers[player[1]]['street%sAggr' % i] = False
+
+ if len(aggrers)>0 and i>0:
+ for playername in others:
+ self.handsplayers[playername]['otherRaisedStreet%s' % i] = True
+ #print "otherRaised detected on handid "+str(hand.handid)+" for "+playername+" on street "+str(i)
+
+ if i > 0 and len(aggrers) > 0:
+ for playername in others:
+ self.handsplayers[playername]['otherRaisedStreet%s' % i] = True
+ #print "DEBUG: otherRaised detected on handid %s for %s on actionStreet[%s]: %s"
+ # %(hand.handid, playername, hand.actionStreets[i+1], i)
def calls(self, hand, i):
callers = []
@@ -429,10 +453,17 @@ class DerivedStats():
# CG - I'm sure this stat is wrong
# Best guess is that raise = 2 bets
def bets(self, hand, i):
- betters = []
for act in hand.actions[hand.actionStreets[i+1]]:
if act[1] in ('bets'):
self.handsplayers[act[0]]['street%sBets' % i] = 1 + self.handsplayers[act[0]]['street%sBets' % i]
+
+ def folds(self, hand, i):
+ for act in hand.actions[hand.actionStreets[i+1]]:
+ if act[1] in ('folds'):
+ if self.handsplayers[act[0]]['otherRaisedStreet%s' % i] == True:
+ self.handsplayers[act[0]]['foldToOtherRaisedStreet%s' % i] = True
+ #print "DEBUG: fold detected on handid %s for %s on actionStreet[%s]: %s"
+ # %(hand.handid, act[0],hand.actionStreets[i+1], i)
def countPlayers(self, hand):
pass
@@ -505,9 +536,14 @@ class DerivedStats():
"""Returns true if player bet/raised the street as their first action"""
betOrRaise = False
for act in self.hand.actions[street]:
- if act[0] == player and act[1] in ('bets', 'raises'):
- betOrRaise = True
- else:
+ if act[0] == player:
+ if act[1] in ('bets', 'raises'):
+ betOrRaise = True
+ else:
+ # player found but did not bet or raise as their first action
+ pass
break
+ #else:
+ # haven't found player's first action yet
return betOrRaise
diff --git a/pyfpdb/EverleafToFpdb.py b/pyfpdb/EverleafToFpdb.py
index 5dd8d041..b16980ed 100755
--- a/pyfpdb/EverleafToFpdb.py
+++ b/pyfpdb/EverleafToFpdb.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Copyright 2008, Carl Gherardi
+# Copyright 2008-2010, Carl Gherardi
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -154,7 +154,7 @@ or None if we fail to get the info """
# 2008/11/10 3:58:52 ET
#TODO: Do conversion from GMT to ET
#TODO: Need some date functions to convert to different timezones (Date::Manip for perl rocked for this)
- hand.starttime = datetime.datetime.strptime(m.group('DATETIME'), "%Y/%m/%d - %H:%M:%S")
+ hand.startTime = datetime.datetime.strptime(m.group('DATETIME'), "%Y/%m/%d - %H:%M:%S")
return
def readPlayerStacks(self, hand):
diff --git a/pyfpdb/Exceptions.py b/pyfpdb/Exceptions.py
index 789c7b83..34b3bade 100644
--- a/pyfpdb/Exceptions.py
+++ b/pyfpdb/Exceptions.py
@@ -1,3 +1,20 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+#Copyright 2009-2010 Matt Turnbull
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Public License as published by
+#the Free Software Foundation, version 3 of the License.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Affero General Public License
+#along with this program. If not, see .
+#In the "official" distribution you can find the license in agpl-3.0.txt.
+
class FpdbError(Exception):
def __init__(self, value):
self.value = value
diff --git a/pyfpdb/Filters.py b/pyfpdb/Filters.py
index 15fccd1c..b211b698 100644
--- a/pyfpdb/Filters.py
+++ b/pyfpdb/Filters.py
@@ -1,6 +1,7 @@
#!/usr/bin/python
+# -*- coding: utf-8 -*-
-#Copyright 2008 Steffen Jobbagy-Felso
+#Copyright 2010 Steffen Schaumburg
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
@@ -12,919 +13,10 @@
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see .
-#In the "official" distribution you can find the license in
-#agpl-3.0.txt in the docs folder of the package.
+#In the "official" distribution you can find the license in agpl-3.0.txt.
import threading
-import pygtk
-pygtk.require('2.0')
-import gtk
-import os
-import sys
-from optparse import OptionParser
-from time import *
-import gobject
-#import pokereval
-
-import logging
-# logging has been set up in fpdb.py or HUD_main.py, use their settings:
-log = logging.getLogger("filter")
-
-
-import Configuration
-import Database
-import SQL
-import Charset
-
class Filters(threading.Thread):
- def __init__(self, db, config, qdict, display = {}, debug=True):
- # config and qdict are now redundant
- self.debug = debug
- self.db = db
- self.cursor = db.cursor
- self.sql = db.sql
- self.conf = db.config
- self.display = display
-
- # text used on screen stored here so that it can be configured
- self.filterText = {'limitsall':'All', 'limitsnone':'None', 'limitsshow':'Show _Limits'
- ,'seatsbetween':'Between:', 'seatsand':'And:', 'seatsshow':'Show Number of _Players'
- ,'playerstitle':'Hero:', 'sitestitle':'Sites:', 'gamestitle':'Games:'
- ,'limitstitle':'Limits:', 'seatstitle':'Number of Players:'
- ,'groupstitle':'Grouping:', 'posnshow':'Show Position Stats:'
- ,'datestitle':'Date:'
- ,'groupsall':'All Players'
- ,'limitsFL':'FL', 'limitsNL':'NL', 'limitsPL':'PL', 'ring':'Ring', 'tour':'Tourney'
- }
-
- gen = self.conf.get_general_params()
- self.day_start = 0
- if 'day_start' in gen:
- self.day_start = float(gen['day_start'])
-
- # Outer Packing box
- self.mainVBox = gtk.VBox(False, 0)
-
- self.label = {}
- self.callback = {}
-
- self.make_filter()
-
- def make_filter(self):
- self.sites = {}
- self.games = {}
- self.limits = {}
- self.seats = {}
- self.groups = {}
- self.siteid = {}
- self.heroes = {}
- self.boxes = {}
-
- for site in self.conf.get_supported_sites():
- #Get db site id for filtering later
- self.cursor.execute(self.sql.query['getSiteId'], (site,))
- result = self.db.cursor.fetchall()
- if len(result) == 1:
- self.siteid[site] = result[0][0]
- else:
- print "Either 0 or more than one site matched - EEK"
-
- # For use in date ranges.
- self.start_date = gtk.Entry(max=12)
- self.end_date = gtk.Entry(max=12)
- self.start_date.set_property('editable', False)
- self.end_date.set_property('editable', False)
-
- # For use in groups etc
- self.sbGroups = {}
- self.numHands = 0
-
- playerFrame = gtk.Frame()
- playerFrame.set_label_align(0.0, 0.0)
- vbox = gtk.VBox(False, 0)
-
- self.fillPlayerFrame(vbox, self.display)
- playerFrame.add(vbox)
-
- sitesFrame = gtk.Frame()
- sitesFrame.set_label_align(0.0, 0.0)
- vbox = gtk.VBox(False, 0)
-
- self.fillSitesFrame(vbox)
- sitesFrame.add(vbox)
-
- # Game types
- gamesFrame = gtk.Frame()
- gamesFrame.set_label_align(0.0, 0.0)
- gamesFrame.show()
- vbox = gtk.VBox(False, 0)
-
- self.fillGamesFrame(vbox)
- gamesFrame.add(vbox)
-
- # Limits
- limitsFrame = gtk.Frame()
- limitsFrame.show()
- vbox = gtk.VBox(False, 0)
- self.cbLimits = {}
- self.cbNoLimits = None
- self.cbAllLimits = None
- self.cbFL = None
- self.cbNL = None
- self.cbPL = None
- self.rb = {} # radio buttons for ring/tour
- self.type = None # ring/tour
- self.types = {} # list of all ring/tour values
-
- self.fillLimitsFrame(vbox, self.display)
- limitsFrame.add(vbox)
-
- # Seats
- seatsFrame = gtk.Frame()
- seatsFrame.show()
- vbox = gtk.VBox(False, 0)
- self.sbSeats = {}
-
- self.fillSeatsFrame(vbox, self.display)
- seatsFrame.add(vbox)
-
- # Groups
- groupsFrame = gtk.Frame()
- groupsFrame.show()
- vbox = gtk.VBox(False, 0)
-
- self.fillGroupsFrame(vbox, self.display)
- groupsFrame.add(vbox)
-
- # Date
- dateFrame = gtk.Frame()
- dateFrame.set_label_align(0.0, 0.0)
- dateFrame.show()
- vbox = gtk.VBox(False, 0)
-
- self.fillDateFrame(vbox)
- dateFrame.add(vbox)
-
- # Buttons
- self.Button1=gtk.Button("Unnamed 1")
- self.Button1.set_sensitive(False)
-
- self.Button2=gtk.Button("Unnamed 2")
- self.Button2.set_sensitive(False)
-
- self.mainVBox.add(playerFrame)
- self.mainVBox.add(sitesFrame)
- self.mainVBox.add(gamesFrame)
- self.mainVBox.add(limitsFrame)
- self.mainVBox.add(seatsFrame)
- self.mainVBox.add(groupsFrame)
- self.mainVBox.add(dateFrame)
- self.mainVBox.add(self.Button1)
- self.mainVBox.add(self.Button2)
-
- self.mainVBox.show_all()
-
- # Should do this cleaner
- if "Heroes" not in self.display or self.display["Heroes"] == False:
- playerFrame.hide()
- if "Sites" not in self.display or self.display["Sites"] == False:
- sitesFrame.hide()
- if "Games" not in self.display or self.display["Games"] == False:
- gamesFrame.hide()
- if "Limits" not in self.display or self.display["Limits"] == False:
- limitsFrame.hide()
- if "Seats" not in self.display or self.display["Seats"] == False:
- seatsFrame.hide()
- if "Groups" not in self.display or self.display["Groups"] == False:
- groupsFrame.hide()
- if "Dates" not in self.display or self.display["Dates"] == False:
- dateFrame.hide()
- if "Button1" not in self.display or self.display["Button1"] == False:
- self.Button1.hide()
- if "Button2" not in self.display or self.display["Button2"] == False:
- self.Button2.hide()
-
- if 'button1' in self.label and self.label['button1']:
- self.Button1.set_label( self.label['button1'] )
- if 'button2' in self.label and self.label['button2']:
- self.Button2.set_label( self.label['button2'] )
- if 'button1' in self.callback and self.callback['button1']:
- self.Button1.connect("clicked", self.callback['button1'], "clicked")
- self.Button1.set_sensitive(True)
- if 'button2' in self.callback and self.callback['button2']:
- self.Button2.connect("clicked", self.callback['button2'], "clicked")
- self.Button2.set_sensitive(True)
-
- # make sure any locks on db are released:
- self.db.rollback()
-
- def get_vbox(self):
- """returns the vbox of this thread"""
- return self.mainVBox
- #end def get_vbox
-
- def getNumHands(self):
- return self.numHands
-
- def getSites(self):
- return self.sites
-
- def getGames(self):
- return self.games
-
- def getSiteIds(self):
- return self.siteid
-
- def getHeroes(self):
- return self.heroes
-
- def getLimits(self):
- ltuple = []
- for l in self.limits:
- if self.limits[l] == True:
- ltuple.append(l)
- return ltuple
-
- def getType(self):
- return(self.type)
-
- def getSeats(self):
- if 'from' in self.sbSeats:
- self.seats['from'] = self.sbSeats['from'].get_value_as_int()
- if 'to' in self.sbSeats:
- self.seats['to'] = self.sbSeats['to'].get_value_as_int()
- return self.seats
-
- def getGroups(self):
- return self.groups
-
- def getDates(self):
- return self.__get_dates()
-
- def registerButton1Name(self, title):
- self.Button1.set_label(title)
- self.label['button1'] = title
-
- def registerButton1Callback(self, callback):
- self.Button1.connect("clicked", callback, "clicked")
- self.Button1.set_sensitive(True)
- self.callback['button1'] = callback
-
- def registerButton2Name(self, title):
- self.Button2.set_label(title)
- self.label['button2'] = title
-
- def registerButton2Callback(self, callback):
- self.Button2.connect("clicked", callback, "clicked")
- self.Button2.set_sensitive(True)
- self.callback['button2'] = callback
-
- def cardCallback(self, widget, data=None):
- log.debug( "%s was toggled %s" % (data, ("OFF", "ON")[widget.get_active()]) )
-
- def createPlayerLine(self, hbox, site, player):
- log.debug('add:"%s"' % player)
- label = gtk.Label(site +" id:")
- hbox.pack_start(label, False, False, 3)
-
- pname = gtk.Entry()
- pname.set_text(player)
- pname.set_width_chars(20)
- hbox.pack_start(pname, False, True, 0)
- pname.connect("changed", self.__set_hero_name, site)
-
- # Added EntryCompletion but maybe comboBoxEntry is more flexible? (e.g. multiple choices)
- completion = gtk.EntryCompletion()
- pname.set_completion(completion)
- liststore = gtk.ListStore(gobject.TYPE_STRING)
- completion.set_model(liststore)
- completion.set_text_column(0)
- names = self.db.get_player_names(self.conf, self.siteid[site]) # (config=self.conf, site_id=None, like_player_name="%")
- for n in names: # list of single-element "tuples"
- _n = Charset.to_gui(n[0])
- _nt = (_n, )
- liststore.append(_nt)
-
- self.__set_hero_name(pname, site)
-
- def __set_hero_name(self, w, site):
- _name = w.get_text()
- # get_text() returns a str but we want internal variables to be unicode:
- _guiname = unicode(_name)
- self.heroes[site] = _guiname
-# log.debug("setting heroes[%s]: %s"%(site, self.heroes[site]))
-
- def __set_num_hands(self, w, val):
- try:
- self.numHands = int(w.get_text())
- except:
- self.numHands = 0
-# log.debug("setting numHands:", self.numHands)
-
- def createSiteLine(self, hbox, site):
- cb = gtk.CheckButton(site)
- cb.connect('clicked', self.__set_site_select, site)
- cb.set_active(True)
- hbox.pack_start(cb, False, False, 0)
-
- def createGameLine(self, hbox, game):
- cb = gtk.CheckButton(game)
- cb.connect('clicked', self.__set_game_select, game)
- hbox.pack_start(cb, False, False, 0)
- cb.set_active(True)
-
- def createLimitLine(self, hbox, limit, ltext):
- cb = gtk.CheckButton(str(ltext))
- cb.connect('clicked', self.__set_limit_select, limit)
- hbox.pack_start(cb, False, False, 0)
- if limit != "none":
- cb.set_active(True)
- return(cb)
-
- def __set_site_select(self, w, site):
- #print w.get_active()
- self.sites[site] = w.get_active()
- log.debug("self.sites[%s] set to %s" %(site, self.sites[site]))
-
- def __set_game_select(self, w, game):
- #print w.get_active()
- self.games[game] = w.get_active()
- log.debug("self.games[%s] set to %s" %(game, self.games[game]))
-
- def __set_limit_select(self, w, limit):
- #print w.get_active()
- self.limits[limit] = w.get_active()
- log.debug("self.limit[%s] set to %s" %(limit, self.limits[limit]))
- if limit.isdigit() or (len(limit) > 2 and (limit[-2:] == 'nl' or limit[-2:] == 'fl' or limit[-2:] == 'pl')):
- if self.limits[limit]:
- if self.cbNoLimits is not None:
- self.cbNoLimits.set_active(False)
- else:
- if self.cbAllLimits is not None:
- self.cbAllLimits.set_active(False)
- if not self.limits[limit]:
- if limit.isdigit():
- if self.cbFL is not None:
- self.cbFL.set_active(False)
- elif (len(limit) > 2 and (limit[-2:] == 'nl')):
- if self.cbNL is not None:
- self.cbNL.set_active(False)
- else:
- if self.cbPL is not None:
- self.cbPL.set_active(False)
- elif limit == "all":
- if self.limits[limit]:
- #for cb in self.cbLimits.values():
- # cb.set_active(True)
- if self.cbFL is not None:
- self.cbFL.set_active(True)
- if self.cbNL is not None:
- self.cbNL.set_active(True)
- if self.cbPL is not None:
- self.cbPL.set_active(True)
- elif limit == "none":
- if self.limits[limit]:
- for cb in self.cbLimits.values():
- cb.set_active(False)
- if self.cbNL is not None:
- self.cbNL.set_active(False)
- if self.cbFL is not None:
- self.cbFL.set_active(False)
- if self.cbPL is not None:
- self.cbPL.set_active(False)
- elif limit == "fl":
- if not self.limits[limit]:
- # only toggle all fl limits off if they are all currently on
- # this stops turning one off from cascading into 'fl' box off
- # and then all fl limits being turned off
- all_fl_on = True
- for cb in self.cbLimits.values():
- t = cb.get_children()[0].get_text()
- if t.isdigit():
- if not cb.get_active():
- all_fl_on = False
- found = {'ring':False, 'tour':False}
- for cb in self.cbLimits.values():
- #print "cb label: ", cb.children()[0].get_text()
- t = cb.get_children()[0].get_text()
- if t.isdigit():
- if self.limits[limit] or all_fl_on:
- cb.set_active(self.limits[limit])
- found[self.types[t]] = True
- if self.limits[limit]:
- if not found[self.type]:
- if self.type == 'ring':
- if 'tour' in self.rb:
- self.rb['tour'].set_active(True)
- elif self.type == 'tour':
- if 'ring' in self.rb:
- self.rb['ring'].set_active(True)
- elif limit == "nl":
- if not self.limits[limit]:
- # only toggle all nl limits off if they are all currently on
- # this stops turning one off from cascading into 'nl' box off
- # and then all nl limits being turned off
- all_nl_on = True
- for cb in self.cbLimits.values():
- t = cb.get_children()[0].get_text()
- if "nl" in t and len(t) > 2:
- if not cb.get_active():
- all_nl_on = False
- found = {'ring':False, 'tour':False}
- for cb in self.cbLimits.values():
- t = cb.get_children()[0].get_text()
- if "nl" in t and len(t) > 2:
- if self.limits[limit] or all_nl_on:
- cb.set_active(self.limits[limit])
- found[self.types[t]] = True
- if self.limits[limit]:
- if not found[self.type]:
- if self.type == 'ring':
- if 'tour' in self.rb:
- self.rb['tour'].set_active(True)
- elif self.type == 'tour':
- if 'ring' in self.rb:
- self.rb['ring'].set_active(True)
- elif limit == "pl":
- if not self.limits[limit]:
- # only toggle all nl limits off if they are all currently on
- # this stops turning one off from cascading into 'nl' box off
- # and then all nl limits being turned off
- all_nl_on = True
- for cb in self.cbLimits.values():
- t = cb.get_children()[0].get_text()
- if "pl" in t and len(t) > 2:
- if not cb.get_active():
- all_nl_on = False
- found = {'ring':False, 'tour':False}
- for cb in self.cbLimits.values():
- t = cb.get_children()[0].get_text()
- if "pl" in t and len(t) > 2:
- if self.limits[limit] or all_nl_on:
- cb.set_active(self.limits[limit])
- found[self.types[t]] = True
- if self.limits[limit]:
- if not found[self.type]:
- if self.type == 'ring':
- if 'tour' in self.rb:
- self.rb['tour'].set_active(True)
- elif self.type == 'tour':
- if 'ring' in self.rb:
- self.rb['ring'].set_active(True)
- elif limit == "ring":
- log.debug("set", limit, "to", self.limits[limit])
- if self.limits[limit]:
- self.type = "ring"
- for cb in self.cbLimits.values():
- #print "cb label: ", cb.children()[0].get_text()
- if self.types[cb.get_children()[0].get_text()] == 'tour':
- cb.set_active(False)
- elif limit == "tour":
- log.debug( "set", limit, "to", self.limits[limit] )
- if self.limits[limit]:
- self.type = "tour"
- for cb in self.cbLimits.values():
- #print "cb label: ", cb.children()[0].get_text()
- if self.types[cb.get_children()[0].get_text()] == 'ring':
- cb.set_active(False)
-
- def __set_seat_select(self, w, seat):
- #print "__set_seat_select: seat =", seat, "active =", w.get_active()
- self.seats[seat] = w.get_active()
- log.debug( "self.seats[%s] set to %s" %(seat, self.seats[seat]) )
-
- def __set_group_select(self, w, group):
- #print "__set_seat_select: seat =", seat, "active =", w.get_active()
- self.groups[group] = w.get_active()
- log.debug( "self.groups[%s] set to %s" %(group, self.groups[group]) )
-
- def fillPlayerFrame(self, vbox, display):
- top_hbox = gtk.HBox(False, 0)
- vbox.pack_start(top_hbox, False, False, 0)
- lbl_title = gtk.Label(self.filterText['playerstitle'])
- lbl_title.set_alignment(xalign=0.0, yalign=0.5)
- top_hbox.pack_start(lbl_title, expand=True, padding=3)
- showb = gtk.Button(label="refresh", stock=None, use_underline=True)
- showb.set_alignment(xalign=1.0, yalign=0.5)
- showb.connect('clicked', self.__refresh, 'players')
-
- vbox1 = gtk.VBox(False, 0)
- vbox.pack_start(vbox1, False, False, 0)
- self.boxes['players'] = vbox1
-
- for site in self.conf.get_supported_sites():
- hBox = gtk.HBox(False, 0)
- vbox1.pack_start(hBox, False, True, 0)
-
- player = self.conf.supported_sites[site].screen_name
- _pname = Charset.to_gui(player)
- self.createPlayerLine(hBox, site, _pname)
-
- if "GroupsAll" in display and display["GroupsAll"] == True:
- hbox = gtk.HBox(False, 0)
- vbox1.pack_start(hbox, False, False, 0)
- cb = gtk.CheckButton(self.filterText['groupsall'])
- cb.connect('clicked', self.__set_group_select, 'allplayers')
- hbox.pack_start(cb, False, False, 0)
- self.sbGroups['allplayers'] = cb
- self.groups['allplayers'] = False
-
- lbl = gtk.Label('Min # Hands:')
- lbl.set_alignment(xalign=1.0, yalign=0.5)
- hbox.pack_start(lbl, expand=True, padding=3)
-
- phands = gtk.Entry()
- phands.set_text('0')
- phands.set_width_chars(8)
- hbox.pack_start(phands, False, False, 0)
- phands.connect("changed", self.__set_num_hands, site)
- top_hbox.pack_start(showb, expand=False, padding=1)
-
- def fillSitesFrame(self, vbox):
- top_hbox = gtk.HBox(False, 0)
- top_hbox.show()
- vbox.pack_start(top_hbox, False, False, 0)
-
- lbl_title = gtk.Label(self.filterText['sitestitle'])
- lbl_title.set_alignment(xalign=0.0, yalign=0.5)
- top_hbox.pack_start(lbl_title, expand=True, padding=3)
-
- showb = gtk.Button(label="hide", stock=None, use_underline=True)
- showb.set_alignment(xalign=1.0, yalign=0.5)
- showb.connect('clicked', self.__toggle_box, 'sites')
- showb.show()
- top_hbox.pack_start(showb, expand=False, padding=1)
-
- vbox1 = gtk.VBox(False, 0)
- self.boxes['sites'] = vbox1
- vbox.pack_start(vbox1, False, False, 0)
-
- for site in self.conf.get_supported_sites():
- hbox = gtk.HBox(False, 0)
- vbox1.pack_start(hbox, False, True, 0)
- self.createSiteLine(hbox, site)
- #Get db site id for filtering later
- #self.cursor.execute(self.sql.query['getSiteId'], (site,))
- #result = self.db.cursor.fetchall()
- #if len(result) == 1:
- # self.siteid[site] = result[0][0]
- #else:
- # print "Either 0 or more than one site matched - EEK"
-
- def fillGamesFrame(self, vbox):
- top_hbox = gtk.HBox(False, 0)
- vbox.pack_start(top_hbox, False, False, 0)
- lbl_title = gtk.Label(self.filterText['gamestitle'])
- lbl_title.set_alignment(xalign=0.0, yalign=0.5)
- top_hbox.pack_start(lbl_title, expand=True, padding=3)
- showb = gtk.Button(label="hide", stock=None, use_underline=True)
- showb.set_alignment(xalign=1.0, yalign=0.5)
- showb.connect('clicked', self.__toggle_box, 'games')
- top_hbox.pack_start(showb, expand=False, padding=1)
-
- vbox1 = gtk.VBox(False, 0)
- vbox.pack_start(vbox1, False, False, 0)
- self.boxes['games'] = vbox1
-
- self.cursor.execute(self.sql.query['getGames'])
- result = self.db.cursor.fetchall()
- if len(result) >= 1:
- for line in result:
- hbox = gtk.HBox(False, 0)
- vbox1.pack_start(hbox, False, True, 0)
- self.createGameLine(hbox, line[0])
- else:
- print "INFO: No games returned from database"
- log.info("No games returned from database")
-
- def fillLimitsFrame(self, vbox, display):
- top_hbox = gtk.HBox(False, 0)
- vbox.pack_start(top_hbox, False, False, 0)
- lbl_title = gtk.Label(self.filterText['limitstitle'])
- lbl_title.set_alignment(xalign=0.0, yalign=0.5)
- top_hbox.pack_start(lbl_title, expand=True, padding=3)
- showb = gtk.Button(label="hide", stock=None, use_underline=True)
- showb.set_alignment(xalign=1.0, yalign=0.5)
- showb.connect('clicked', self.__toggle_box, 'limits')
-
- vbox1 = gtk.VBox(False, 0)
- vbox.pack_start(vbox1, False, False, 0)
- self.boxes['limits'] = vbox1
-
- self.cursor.execute(self.sql.query['getLimits3'])
- # selects limitType, bigBlind
- result = self.db.cursor.fetchall()
- found = {'nl':False, 'fl':False, 'pl':False, 'ring':False, 'tour':False}
-
- if len(result) >= 1:
- hbox = gtk.HBox(True, 0)
- vbox1.pack_start(hbox, False, False, 0)
- vbox2 = gtk.VBox(False, 0)
- hbox.pack_start(vbox2, False, False, 0)
- vbox3 = gtk.VBox(False, 0)
- hbox.pack_start(vbox3, False, False, 0)
- for i, line in enumerate(result):
- if "UseType" in self.display:
- if line[0] != self.display["UseType"]:
- continue
- hbox = gtk.HBox(False, 0)
- if i <= len(result)/2:
- vbox2.pack_start(hbox, False, False, 0)
- else:
- vbox3.pack_start(hbox, False, False, 0)
- if True: #line[0] == 'ring':
- if line[1] == 'fl':
- name = str(line[2])
- found['fl'] = True
- elif line[1] == 'pl':
- name = str(line[2])+line[1]
- found['pl'] = True
- else:
- name = str(line[2])+line[1]
- found['nl'] = True
- self.cbLimits[name] = self.createLimitLine(hbox, name, name)
- self.types[name] = line[0]
- found[line[0]] = True # type is ring/tour
- self.type = line[0] # if only one type, set it now
- if "LimitSep" in display and display["LimitSep"] == True and len(result) >= 2:
- hbox = gtk.HBox(True, 0)
- vbox1.pack_start(hbox, False, False, 0)
- vbox2 = gtk.VBox(False, 0)
- hbox.pack_start(vbox2, False, False, 0)
- vbox3 = gtk.VBox(False, 0)
- hbox.pack_start(vbox3, False, False, 0)
-
- hbox = gtk.HBox(False, 0)
- vbox2.pack_start(hbox, False, False, 0)
- self.cbAllLimits = self.createLimitLine(hbox, 'all', self.filterText['limitsall'])
- hbox = gtk.HBox(False, 0)
- vbox2.pack_start(hbox, False, False, 0)
- self.cbNoLimits = self.createLimitLine(hbox, 'none', self.filterText['limitsnone'])
-
- dest = vbox3 # for ring/tour buttons
- if "LimitType" in display and display["LimitType"] == True and found['nl'] and found['fl']:
- #if found['fl']:
- hbox = gtk.HBox(False, 0)
- vbox3.pack_start(hbox, False, False, 0)
- self.cbFL = self.createLimitLine(hbox, 'fl', self.filterText['limitsFL'])
- #if found['nl']:
- hbox = gtk.HBox(False, 0)
- vbox3.pack_start(hbox, False, False, 0)
- self.cbNL = self.createLimitLine(hbox, 'nl', self.filterText['limitsNL'])
- hbox = gtk.HBox(False, 0)
- vbox3.pack_start(hbox, False, False, 0)
- self.cbPL = self.createLimitLine(hbox, 'pl', self.filterText['limitsPL'])
- dest = vbox2 # for ring/tour buttons
- else:
- print "INFO: No games returned from database"
- log.info("No games returned from database")
-
- if "Type" in display and display["Type"] == True and found['ring'] and found['tour']:
- rb1 = gtk.RadioButton(None, self.filterText['ring'])
- rb1.connect('clicked', self.__set_limit_select, 'ring')
- rb2 = gtk.RadioButton(rb1, self.filterText['tour'])
- rb2.connect('clicked', self.__set_limit_select, 'tour')
- top_hbox.pack_start(rb1, False, False, 0) # (child, expand, fill, padding)
- top_hbox.pack_start(rb2, True, True, 0) # child uses expand space if fill is true
-
- self.rb['ring'] = rb1
- self.rb['tour'] = rb2
- #print "about to set ring to true"
- rb1.set_active(True)
- # set_active doesn't seem to call this for some reason so call manually:
- self.__set_limit_select(rb1, 'ring')
- self.type = 'ring'
- top_hbox.pack_start(showb, expand=False, padding=1)
-
- def fillSeatsFrame(self, vbox, display):
- hbox = gtk.HBox(False, 0)
- vbox.pack_start(hbox, False, False, 0)
- lbl_title = gtk.Label(self.filterText['seatstitle'])
- lbl_title.set_alignment(xalign=0.0, yalign=0.5)
- hbox.pack_start(lbl_title, expand=True, padding=3)
- showb = gtk.Button(label="hide", stock=None, use_underline=True)
- showb.set_alignment(xalign=1.0, yalign=0.5)
- showb.connect('clicked', self.__toggle_box, 'seats')
- hbox.pack_start(showb, expand=False, padding=1)
-
- vbox1 = gtk.VBox(False, 0)
- vbox.pack_start(vbox1, False, False, 0)
- self.boxes['seats'] = vbox1
-
- hbox = gtk.HBox(False, 0)
- vbox1.pack_start(hbox, False, True, 0)
-
- lbl_from = gtk.Label(self.filterText['seatsbetween'])
- lbl_to = gtk.Label(self.filterText['seatsand'])
- adj1 = gtk.Adjustment(value=2, lower=2, upper=10, step_incr=1, page_incr=1, page_size=0)
- sb1 = gtk.SpinButton(adjustment=adj1, climb_rate=0.0, digits=0)
- adj2 = gtk.Adjustment(value=10, lower=2, upper=10, step_incr=1, page_incr=1, page_size=0)
- sb2 = gtk.SpinButton(adjustment=adj2, climb_rate=0.0, digits=0)
-
- hbox.pack_start(lbl_from, expand=False, padding=3)
- hbox.pack_start(sb1, False, False, 0)
- hbox.pack_start(lbl_to, expand=False, padding=3)
- hbox.pack_start(sb2, False, False, 0)
-
- self.sbSeats['from'] = sb1
- self.sbSeats['to'] = sb2
-
- def fillGroupsFrame(self, vbox, display):
- hbox = gtk.HBox(False, 0)
- vbox.pack_start(hbox, False, False, 0)
- lbl_title = gtk.Label(self.filterText['groupstitle'])
- lbl_title.set_alignment(xalign=0.0, yalign=0.5)
- hbox.pack_start(lbl_title, expand=True, padding=3)
- showb = gtk.Button(label="hide", stock=None, use_underline=True)
- showb.set_alignment(xalign=1.0, yalign=0.5)
- showb.connect('clicked', self.__toggle_box, 'groups')
- hbox.pack_start(showb, expand=False, padding=1)
-
- vbox1 = gtk.VBox(False, 0)
- vbox.pack_start(vbox1, False, False, 0)
- self.boxes['groups'] = vbox1
-
- hbox = gtk.HBox(False, 0)
- vbox1.pack_start(hbox, False, False, 0)
- cb = self.createLimitLine(hbox, 'show', self.filterText['limitsshow'])
-
- hbox = gtk.HBox(False, 0)
- vbox1.pack_start(hbox, False, True, 0)
- cb = gtk.CheckButton(self.filterText['posnshow'])
- cb.connect('clicked', self.__set_group_select, 'posn')
- hbox.pack_start(cb, False, False, 0)
- self.sbGroups['posn'] = cb
- self.groups['posn'] = False
-
- if "SeatSep" in display and display["SeatSep"] == True:
- hbox = gtk.HBox(False, 0)
- vbox1.pack_start(hbox, False, True, 0)
- cb = gtk.CheckButton(self.filterText['seatsshow'])
- cb.connect('clicked', self.__set_seat_select, 'show')
- hbox.pack_start(cb, False, False, 0)
- self.sbSeats['show'] = cb
- self.seats['show'] = False
-
- def fillCardsFrame(self, vbox):
- hbox1 = gtk.HBox(True,0)
- hbox1.show()
- vbox.pack_start(hbox1, True, True, 0)
-
- cards = [ "A", "K","Q","J","T","9","8","7","6","5","4","3","2" ]
-
- for j in range(0, len(cards)):
- hbox1 = gtk.HBox(True,0)
- hbox1.show()
- vbox.pack_start(hbox1, True, True, 0)
- for i in range(0, len(cards)):
- if i < (j + 1):
- suit = "o"
- else:
- suit = "s"
- button = gtk.ToggleButton("%s%s%s" %(cards[i], cards[j], suit))
- button.connect("toggled", self.cardCallback, "%s%s%s" %(cards[i], cards[j], suit))
- hbox1.pack_start(button, True, True, 0)
- button.show()
-
- def fillDateFrame(self, vbox):
- # Hat tip to Mika Bostrom - calendar code comes from PokerStats
- top_hbox = gtk.HBox(False, 0)
- vbox.pack_start(top_hbox, False, False, 0)
- lbl_title = gtk.Label(self.filterText['datestitle'])
- lbl_title.set_alignment(xalign=0.0, yalign=0.5)
- top_hbox.pack_start(lbl_title, expand=True, padding=3)
- showb = gtk.Button(label="hide", stock=None, use_underline=True)
- showb.set_alignment(xalign=1.0, yalign=0.5)
- showb.connect('clicked', self.__toggle_box, 'dates')
- top_hbox.pack_start(showb, expand=False, padding=1)
-
- vbox1 = gtk.VBox(False, 0)
- vbox.pack_start(vbox1, False, False, 0)
- self.boxes['dates'] = vbox1
-
- hbox = gtk.HBox()
- vbox1.pack_start(hbox, False, True, 0)
-
- lbl_start = gtk.Label('From:')
-
- btn_start = gtk.Button()
- btn_start.set_image(gtk.image_new_from_stock(gtk.STOCK_INDEX, gtk.ICON_SIZE_BUTTON))
- btn_start.connect('clicked', self.__calendar_dialog, self.start_date)
-
- hbox.pack_start(lbl_start, expand=False, padding=3)
- hbox.pack_start(btn_start, expand=False, padding=3)
- hbox.pack_start(self.start_date, expand=False, padding=2)
-
- #New row for end date
- hbox = gtk.HBox()
- vbox1.pack_start(hbox, False, True, 0)
-
- lbl_end = gtk.Label(' To:')
- btn_end = gtk.Button()
- btn_end.set_image(gtk.image_new_from_stock(gtk.STOCK_INDEX, gtk.ICON_SIZE_BUTTON))
- btn_end.connect('clicked', self.__calendar_dialog, self.end_date)
-
- btn_clear = gtk.Button(label=' Clear Dates ')
- btn_clear.connect('clicked', self.__clear_dates)
-
- hbox.pack_start(lbl_end, expand=False, padding=3)
- hbox.pack_start(btn_end, expand=False, padding=3)
- hbox.pack_start(self.end_date, expand=False, padding=2)
-
- hbox.pack_start(btn_clear, expand=False, padding=15)
-
- def __refresh(self, widget, entry):
- for w in self.mainVBox.get_children():
- w.destroy()
- self.make_filter()
-
- def __toggle_box(self, widget, entry):
- if self.boxes[entry].props.visible:
- self.boxes[entry].hide()
- widget.set_label("show")
- else:
- self.boxes[entry].show()
- widget.set_label("hide")
-
- def __calendar_dialog(self, widget, entry):
- d = gtk.Window(gtk.WINDOW_TOPLEVEL)
- d.set_title('Pick a date')
-
- vb = gtk.VBox()
- cal = gtk.Calendar()
- vb.pack_start(cal, expand=False, padding=0)
-
- btn = gtk.Button('Done')
- btn.connect('clicked', self.__get_date, cal, entry, d)
-
- vb.pack_start(btn, expand=False, padding=4)
-
- d.add(vb)
- d.set_position(gtk.WIN_POS_MOUSE)
- d.show_all()
-
- def __clear_dates(self, w):
- self.start_date.set_text('')
- self.end_date.set_text('')
-
- def __get_dates(self):
- # self.day_start gives user's start of day in hours
- offset = int(self.day_start * 3600) # calc day_start in seconds
-
- t1 = self.start_date.get_text()
- t2 = self.end_date.get_text()
-
- if t1 == '':
- t1 = '1970-01-01'
- if t2 == '':
- t2 = '2020-12-12'
-
- s1 = strptime(t1, "%Y-%m-%d") # make time_struct
- s2 = strptime(t2, "%Y-%m-%d")
- e1 = mktime(s1) + offset # s1 is localtime, but returned time since epoch is UTC, then add the
- e2 = mktime(s2) + offset # s2 is localtime, but returned time since epoch is UTC
- e2 = e2 + 24 * 3600 - 1 # date test is inclusive, so add 23h 59m 59s to e2
-
- adj_t1 = strftime("%Y-%m-%d %H:%M:%S", gmtime(e1)) # make adjusted string including time
- adj_t2 = strftime("%Y-%m-%d %H:%M:%S", gmtime(e2))
- log.info("t1="+t1+" adj_t1="+adj_t1+'.')
-
- return (adj_t1, adj_t2)
-
- def __get_date(self, widget, calendar, entry, win):
- # year and day are correct, month is 0..11
- (year, month, day) = calendar.get_date()
- month += 1
- ds = '%04d-%02d-%02d' % (year, month, day)
- entry.set_text(ds)
- win.destroy()
-
-def main(argv=None):
- """main can also be called in the python interpreter, by supplying the command line as the argument."""
- if argv is None:
- argv = sys.argv[1:]
-
- def destroy(*args): # call back for terminating the main eventloop
- gtk.main_quit()
-
- parser = OptionParser()
- (options, argv) = parser.parse_args(args = argv)
-
- config = Configuration.Config()
- db = None
-
- db = Database.Database()
- db.do_connect(config)
-
- qdict = SQL.SQL(db.get_backend_name())
-
- i = Filters(db, config, qdict)
- main_window = gtk.Window()
- main_window.connect('destroy', destroy)
- main_window.add(i.get_vbox())
- main_window.show()
- gtk.main()
-
-if __name__ == '__main__':
- sys.exit(main())
+ pass
+#end class Filters
diff --git a/pyfpdb/FpdbSQLQueries.py b/pyfpdb/FpdbSQLQueries.py
deleted file mode 100644
index b47f45eb..00000000
--- a/pyfpdb/FpdbSQLQueries.py
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/usr/bin/python
-
-#Copyright 2008 Steffen Jobbagy-Felso
-#This program is free software: you can redistribute it and/or modify
-#it under the terms of the GNU Affero General Public License as published by
-#the Free Software Foundation, version 3 of the License.
-#
-#This program is distributed in the hope that it will be useful,
-#but WITHOUT ANY WARRANTY; without even the implied warranty of
-#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-#GNU General Public License for more details.
-#
-#You should have received a copy of the GNU Affero General Public License
-#along with this program. If not, see .
-#In the "official" distribution you can find the license in
-#agpl-3.0.txt in the docs folder of the package.
-
-
-############################################################################
-#
-# File for DB queries used in fpdb
-#
-
-import sys
-import os
-
-class FpdbSQLQueries:
-
- def __init__(self, db):
- self.query = {}
- self.dbname = db
-
-
- if(self.dbname == 'MySQL InnoDB' or self.dbname == 'PostgreSQL'):
- self.query['set tx level'] = """SET SESSION TRANSACTION
- ISOLATION LEVEL READ COMMITTED"""
- elif(self.dbname == 'SQLite'):
- self.query['set tx level'] = """ """
-
-
- if(self.dbname == 'MySQL InnoDB') or (self.dbname == 'PostgreSQL'):
- self.query['getSiteId'] = """SELECT id from Sites where name = %s"""
- elif(self.dbname == 'SQLite'):
- self.query['getSiteId'] = """SELECT id from Sites where name = %s"""
-
- if(self.dbname == 'MySQL InnoDB') or (self.dbname == 'PostgreSQL') or (self.dbname == 'SQLite'):
- self.query['getGames'] = """SELECT DISTINCT category from Gametypes"""
-
- if(self.dbname == 'MySQL InnoDB') or (self.dbname == 'PostgreSQL') or (self.dbname == 'SQLite'):
- self.query['getLimits'] = """SELECT DISTINCT bigBlind from Gametypes ORDER by bigBlind DESC"""
-
-
-if __name__== "__main__":
- from optparse import OptionParser
-
- print "FpdbSQLQueries starting from CLI"
-
- #process CLI parameters
- usage = "usage: %prog [options]"
- parser = OptionParser()
- parser.add_option("-t", "--type", dest="dbtype", help="Available 'MySQL InnoDB', 'PostgreSQL', 'SQLite'(default: MySQL InnoDB)", default="MySQL InnoDB")
- parser.add_option("-s", "--show", action="store_true", dest="showsql", help="Show full SQL output")
- parser.add_option("-v", "--verbose", action="store_true", dest="verbose")
-
-
- (options, args) = parser.parse_args()
-
- if options.verbose:
- print """No additional output available in this file"""
-
- obj = FpdbSQLQueries(options.dbtype)
-
- print "Available Queries for '" + options.dbtype + "':"
-
- for key in obj.query:
- print " " + key
- if options.showsql:
- print obj.query[key]
diff --git a/pyfpdb/FulltiltToFpdb.py b/pyfpdb/FulltiltToFpdb.py
index d6a9057c..ce34daa8 100755
--- a/pyfpdb/FulltiltToFpdb.py
+++ b/pyfpdb/FulltiltToFpdb.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Copyright 2008, Carl Gherardi
+# Copyright 2008-2010, Carl Gherardi
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,6 +20,7 @@
import logging
from HandHistoryConverter import *
+#import TourneySummary
# Fulltilt HH Format converter
@@ -27,7 +28,7 @@ class Fulltilt(HandHistoryConverter):
sitename = "Fulltilt"
filetype = "text"
- codepage = ["utf-16", "cp1252"]
+ codepage = ["utf-16", "cp1252", "utf-8"]
siteId = 1 # Needs to match id entry in Sites database
# Static regexes
@@ -66,7 +67,7 @@ class Fulltilt(HandHistoryConverter):
''', re.VERBOSE)
re_Button = re.compile('^The button is in seat #(?P