Merge branch 'master' of git://git.assembla.com/fpdboz
Conflicts: pyfpdb/py2exe_setup.py
This commit is contained in:
commit
64d76855f1
18
Makefile
18
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 <http://www.gnu.org/licenses/>.
|
||||||
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
|
|
||||||
# Variable definitions
|
# Variable definitions
|
||||||
VERSION = 0.20
|
VERSION = 0.20
|
||||||
DATE = $(shell date +%Y%m%d)
|
DATE = $(shell date +%Y%m%d)
|
||||||
|
@ -9,3 +23,7 @@ all:
|
||||||
snapshot:
|
snapshot:
|
||||||
git tag $(VERSION)-$(DATE)
|
git tag $(VERSION)-$(DATE)
|
||||||
git archive --prefix=fpdb-$(VERSION)-$(DATE)/ $(VERSION)-$(DATE) | gzip -9 > ../fpdb-$(VERSION)-$(DATE).tar.gz
|
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
|
||||||
|
|
35
THANKS.txt
35
THANKS.txt
|
@ -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
|
|
|
@ -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
|
|
|
@ -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.
|
|
|
@ -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
|
|
File diff suppressed because it is too large
Load Diff
|
@ -5,5 +5,5 @@ Exec=/usr/bin/fpdb
|
||||||
Icon=fpdb-icon.png
|
Icon=fpdb-icon.png
|
||||||
Terminal=true
|
Terminal=true
|
||||||
Type=Application
|
Type=Application
|
||||||
Categories=Utility
|
Categories=Utility;GTK;Application
|
||||||
|
|
||||||
|
|
339
gpl-2.0.txt
Normal file
339
gpl-2.0.txt
Normal file
|
@ -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.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 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.
|
674
gpl-3.0.txt
Normal file
674
gpl-3.0.txt
Normal file
|
@ -0,0 +1,674 @@
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
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.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
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
|
||||||
|
<http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
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
|
||||||
|
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
@ -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 <bostik+fpdb@bostik.iki.fi> 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 <bostik+fpdb@bostik.iki.fi> Fri, 05 Mar 2010 08:38:52 +0200
|
||||||
|
|
||||||
free-poker-tools (0.12~git20100122) unstable; urgency=low
|
free-poker-tools (0.12~git20100122) unstable; urgency=low
|
||||||
|
|
||||||
* New snapshot release with reworked import code
|
* New snapshot release with reworked import code
|
||||||
|
|
|
@ -2,6 +2,6 @@ This package was debianised by Mika Bostrom <bostik+fpdb@bostik.iki.fi>
|
||||||
|
|
||||||
Upstream authors: ...
|
Upstream authors: ...
|
||||||
|
|
||||||
License: AGPL
|
License: AGPL3; partially GPL2 or higher
|
||||||
|
|
||||||
Copyright (C) 2008- The FPDB developers
|
Copyright (C) 2008-2010 The FPDB developers
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
/usr/share/pyshared/fpdb/fpdb.py /usr/bin/fpdb
|
/usr/share/pyshared/fpdb/fpdb.pyw /usr/bin/fpdb
|
||||||
|
|
|
@ -3,4 +3,4 @@
|
||||||
# When installed into .../fpdb/ the script gets mode 644
|
# When installed into .../fpdb/ the script gets mode 644
|
||||||
# Note: "dh_fixperms -Xfpdb.py" did not work, hence this hack
|
# Note: "dh_fixperms -Xfpdb.py" did not work, hence this hack
|
||||||
chmod 755 /usr/bin/fpdb
|
chmod 755 /usr/bin/fpdb
|
||||||
chmod 755 /usr/share/pyshared/fpdb/HUD_main.py
|
chmod 755 /usr/share/pyshared/fpdb/HUD_main.pyw
|
||||||
|
|
|
@ -23,6 +23,13 @@ install: build
|
||||||
dh_installdirs
|
dh_installdirs
|
||||||
#
|
#
|
||||||
python setup.py install --root=debian/$(PACKAGE) --prefix=/usr --no-compile
|
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
|
binary-indep: build install
|
||||||
dh_testdir
|
dh_testdir
|
||||||
|
|
|
@ -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 " "
|
|
||||||
}
|
|
57
packaging/gentoo/fpdb-0.20-r1.ebuild
Normal file
57
packaging/gentoo/fpdb-0.20-r1.ebuild
Normal file
|
@ -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."
|
||||||
|
}
|
134
packaging/windows/MySqlPython1.2.2WalkthroughPython26.txt
Normal file
134
packaging/windows/MySqlPython1.2.2WalkthroughPython26.txt
Normal file
|
@ -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 <windows.h>
|
||||||
|
#include <config-win.h>
|
||||||
|
...
|
||||||
|
|
||||||
|
Insert an additional winsock2 line
|
||||||
|
|
||||||
|
...
|
||||||
|
#include <winsock2.h>
|
||||||
|
#include <windows.h>
|
||||||
|
#include <config-win.h>
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
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
|
125
packaging/windows/MySqlPython1.2.3WalkthroughPython26.txt
Normal file
125
packaging/windows/MySqlPython1.2.3WalkthroughPython26.txt
Normal file
|
@ -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
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
; In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
|
|
||||||
|
|
||||||
;"%programfiles%\MySQL\MySQL Server 5.0\bin\mysqld" --remove
|
;"%programfiles%\MySQL\MySQL Server 5.0\bin\mysqld" --remove
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; Includes
|
; Includes
|
||||||
|
|
213
packaging/windows/py2exeWalkthroughPython26.txt
Normal file
213
packaging/windows/py2exeWalkthroughPython26.txt
Normal file
|
@ -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.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# Copyright 2008, Carl Gherardi
|
# Copyright 2008-2010, Carl Gherardi
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# 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
|
# TODO: (1-on-1) does have that info in the game type line
|
||||||
if self.HORSEHand:
|
if self.HORSEHand:
|
||||||
hand.maxseats = 8
|
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
|
return
|
||||||
|
|
||||||
def readPlayerStacks(self, hand):
|
def readPlayerStacks(self, hand):
|
||||||
|
|
|
@ -1,4 +1,20 @@
|
||||||
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
|
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
from sqlalchemy import types
|
from sqlalchemy import types
|
||||||
|
|
|
@ -1,4 +1,20 @@
|
||||||
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
|
|
||||||
"""@package AlchemyMappings
|
"""@package AlchemyMappings
|
||||||
This package contains all classes to be mapped and mappers themselves
|
This package contains all classes to be mapped and mappers themselves
|
||||||
"""
|
"""
|
||||||
|
@ -34,8 +50,8 @@ class Gametype(MappedBase):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_or_create(session, siteId, gametype):
|
def get_or_create(session, siteId, gametype):
|
||||||
map = zip(
|
map = zip(
|
||||||
['type', 'base', 'category', 'limitType', 'smallBlind', 'bigBlind', 'smallBet', 'bigBet'],
|
['type', 'base', 'category', 'limitType', 'smallBlind', 'bigBlind', 'smallBet', 'bigBet', 'currency'],
|
||||||
['type', 'base', 'category', 'limitType', 'sb', 'bb', 'dummy', 'dummy', ])
|
['type', 'base', 'category', 'limitType', 'sb', 'bb', 'dummy', 'dummy', 'currency'])
|
||||||
gametype = dict([(new, gametype.get(old)) for new, old in map ])
|
gametype = dict([(new, gametype.get(old)) for new, old in map ])
|
||||||
|
|
||||||
hilo = "h"
|
hilo = "h"
|
||||||
|
@ -152,8 +168,8 @@ class HandInternal(DerivedStats):
|
||||||
'speed': 'speed',
|
'speed': 'speed',
|
||||||
'maxSeats': 'maxseats',
|
'maxSeats': 'maxseats',
|
||||||
'knockout': 'isKO',
|
'knockout': 'isKO',
|
||||||
'rebuyOrAddon': 'isRebuy',
|
'rebuy': 'isRebuy',
|
||||||
'headsUp': 'isHU',
|
'addOn': 'isAddOn',
|
||||||
'shootout': 'isShootout',
|
'shootout': 'isShootout',
|
||||||
'matrix': 'isMatrix',
|
'matrix': 'isMatrix',
|
||||||
'sng': 'isSNG',
|
'sng': 'isSNG',
|
||||||
|
@ -177,15 +193,15 @@ class HandInternal(DerivedStats):
|
||||||
setattr(tour, col, hand_val)
|
setattr(tour, col, hand_val)
|
||||||
elif col == 'koBounty':
|
elif col == 'koBounty':
|
||||||
setattr(tour, col, max(db_val, hand_val))
|
setattr(tour, col, max(db_val, hand_val))
|
||||||
elif col == 'tourStartTime' and hand.handStart:
|
elif col == 'tourStartTime' and hand.startTime:
|
||||||
setattr(tour, col, min(db_val, hand.handStart))
|
setattr(tour, col, min(db_val, hand.startTime))
|
||||||
|
|
||||||
if tour.entries is None and tour_type.sng:
|
if tour.entries is None and tour_type.sng:
|
||||||
tour.entries = tour_type.maxSeats
|
tour.entries = tour_type.maxSeats
|
||||||
|
|
||||||
# fetch and update tourney players
|
# fetch and update tourney players
|
||||||
for hp in self.handPlayers:
|
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
|
# FIXME: other TourneysPlayers should be added here
|
||||||
|
|
||||||
session.flush()
|
session.flush()
|
||||||
|
@ -340,18 +356,20 @@ class HandPlayer(MappedBase):
|
||||||
class Site(object):
|
class Site(object):
|
||||||
"""Class reflecting Players db table"""
|
"""Class reflecting Players db table"""
|
||||||
INITIAL_DATA = [
|
INITIAL_DATA = [
|
||||||
(1 , 'Full Tilt Poker','USD'),
|
(1 , 'Full Tilt Poker','FT'),
|
||||||
(2 , 'PokerStars', 'USD'),
|
(2 , 'PokerStars', 'PS'),
|
||||||
(3 , 'Everleaf', 'USD'),
|
(3 , 'Everleaf', 'EV'),
|
||||||
(4 , 'Win2day', 'USD'),
|
(4 , 'Win2day', 'W2'),
|
||||||
(5 , 'OnGame', 'USD'),
|
(5 , 'OnGame', 'OG'),
|
||||||
(6 , 'UltimateBet', 'USD'),
|
(6 , 'UltimateBet', 'UB'),
|
||||||
(7 , 'Betfair', 'USD'),
|
(7 , 'Betfair', 'BF'),
|
||||||
(8 , 'Absolute', 'USD'),
|
(8 , 'Absolute', 'AB'),
|
||||||
(9 , 'PartyPoker', 'USD'),
|
(9 , 'PartyPoker', 'PP'),
|
||||||
(10, 'Partouche', 'EUR'),
|
(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 ]
|
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 TourneyType(MappedBase):
|
||||||
"""Class reflecting TourneysType db table"""
|
"""Class reflecting TourneyType db table"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_or_create(cls, session, **kwargs):
|
def get_or_create(cls, session, **kwargs):
|
||||||
|
@ -380,12 +398,12 @@ class TourneyType(MappedBase):
|
||||||
|
|
||||||
Required kwargs:
|
Required kwargs:
|
||||||
buyin fee speed maxSeats knockout
|
buyin fee speed maxSeats knockout
|
||||||
rebuyOrAddon headsUp shootout matrix sng
|
rebuy addOn shootout matrix sng currency
|
||||||
"""
|
"""
|
||||||
return get_or_create(cls, session, **kwargs)[0]
|
return get_or_create(cls, session, **kwargs)[0]
|
||||||
|
|
||||||
|
|
||||||
class TourneyPlayer(MappedBase):
|
class TourneysPlayer(MappedBase):
|
||||||
"""Class reflecting TourneysPlayers db table"""
|
"""Class reflecting TourneysPlayers db table"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -437,7 +455,7 @@ mapper (Gametype, gametypes_table, properties={
|
||||||
})
|
})
|
||||||
mapper (Player, players_table, properties={
|
mapper (Player, players_table, properties={
|
||||||
'playerHands': relation(HandPlayer, backref='player'),
|
'playerHands': relation(HandPlayer, backref='player'),
|
||||||
'playerTourney': relation(TourneyPlayer, backref='player'),
|
'playerTourney': relation(TourneysPlayer, backref='player'),
|
||||||
})
|
})
|
||||||
mapper (Site, sites_table, properties={
|
mapper (Site, sites_table, properties={
|
||||||
'gametypes': relation(Gametype, backref = 'site'),
|
'gametypes': relation(Gametype, backref = 'site'),
|
||||||
|
@ -455,7 +473,7 @@ mapper (Tourney, tourneys_table)
|
||||||
mapper (TourneyType, tourney_types_table, properties={
|
mapper (TourneyType, tourney_types_table, properties={
|
||||||
'tourneys': relation(Tourney, backref='type'),
|
'tourneys': relation(Tourney, backref='type'),
|
||||||
})
|
})
|
||||||
mapper (TourneyPlayer, tourneys_players_table)
|
mapper (TourneysPlayer, tourneys_players_table)
|
||||||
|
|
||||||
class LambdaKeyDict(defaultdict):
|
class LambdaKeyDict(defaultdict):
|
||||||
"""Operates like defaultdict but passes key argument to the factory function"""
|
"""Operates like defaultdict but passes key argument to the factory function"""
|
||||||
|
|
|
@ -1,4 +1,20 @@
|
||||||
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
|
|
||||||
"""@package AlchemyTables
|
"""@package AlchemyTables
|
||||||
Contains all sqlalchemy tables
|
Contains all sqlalchemy tables
|
||||||
"""
|
"""
|
||||||
|
@ -29,6 +45,7 @@ autorates_table = Table('Autorates', metadata,
|
||||||
gametypes_table = Table('Gametypes', metadata,
|
gametypes_table = Table('Gametypes', metadata,
|
||||||
Column('id', SmallInteger, primary_key=True),
|
Column('id', SmallInteger, primary_key=True),
|
||||||
Column('siteId', SmallInteger, ForeignKey("Sites.id"), nullable=False), # SMALLINT
|
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('type', String(4), nullable=False), # char(4) NOT NULL
|
||||||
Column('base', 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
|
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('tableName', String(30), nullable=False),
|
||||||
Column('siteHandNo', BigIntColumn, nullable=False),
|
Column('siteHandNo', BigIntColumn, nullable=False),
|
||||||
Column('gametypeId', SmallInteger, ForeignKey('Gametypes.id'), 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('importTime', DateTime, nullable=False),
|
||||||
Column('seats', SmallInteger, nullable=False),
|
Column('seats', SmallInteger, nullable=False),
|
||||||
Column('maxSeats', SmallInteger, nullable=False),
|
Column('maxSeats', SmallInteger, nullable=False),
|
||||||
|
@ -338,7 +355,7 @@ settings_table = Table('Settings', metadata,
|
||||||
sites_table = Table('Sites', metadata,
|
sites_table = Table('Sites', metadata,
|
||||||
Column('id', SmallInteger, primary_key=True),
|
Column('id', SmallInteger, primary_key=True),
|
||||||
Column('name', String(32), nullable=False), # varchar(32) NOT NULL
|
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_charset='utf8',
|
||||||
mysql_engine='InnoDB',
|
mysql_engine='InnoDB',
|
||||||
)
|
)
|
||||||
|
@ -352,17 +369,11 @@ tourneys_table = Table('Tourneys', metadata,
|
||||||
Column('prizepool', Integer), # INT NOT NULL
|
Column('prizepool', Integer), # INT NOT NULL
|
||||||
Column('tourStartTime', DateTime), # DATETIME NOT NULL
|
Column('tourStartTime', DateTime), # DATETIME NOT NULL
|
||||||
Column('tourEndTime', DateTime), # DATETIME
|
Column('tourEndTime', DateTime), # DATETIME
|
||||||
Column('buyinChips', Integer), # INT
|
|
||||||
Column('tourneyName', String(40)), # varchar(40)
|
Column('tourneyName', String(40)), # varchar(40)
|
||||||
# Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn
|
# Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn
|
||||||
Column('matrixIdProcessed',SmallInteger, default=0), # TINYINT UNSIGNED DEFAULT 0
|
Column('matrixIdProcessed',SmallInteger, default=0), # TINYINT UNSIGNED DEFAULT 0
|
||||||
Column('rebuyChips', Integer, default=0), # INT DEFAULT 0
|
Column('totalRebuyCount', Integer, default=0), # INT DEFAULT 0
|
||||||
Column('addonChips', Integer, default=0), # INT DEFAULT 0
|
Column('totalAddOnCount', 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('comment', Text), # TEXT
|
Column('comment', Text), # TEXT
|
||||||
Column('commentTs', DateTime), # DATETIME
|
Column('commentTs', DateTime), # DATETIME
|
||||||
mysql_charset='utf8',
|
mysql_charset='utf8',
|
||||||
|
@ -374,36 +385,46 @@ Index('siteTourneyNo', tourneys_table.c.siteTourneyNo, tourneys_table.c.tourneyT
|
||||||
tourney_types_table = Table('TourneyTypes', metadata,
|
tourney_types_table = Table('TourneyTypes', metadata,
|
||||||
Column('id', Integer, primary_key=True),
|
Column('id', Integer, primary_key=True),
|
||||||
Column('siteId', SmallInteger, ForeignKey("Sites.id"), nullable=False),
|
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('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('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('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('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('shootout', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
|
||||||
Column('matrix', 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('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_charset='utf8',
|
||||||
mysql_engine='InnoDB',
|
mysql_engine='InnoDB',
|
||||||
)
|
)
|
||||||
Index('tourneyTypes_all',
|
Index('tourneyTypes_all',
|
||||||
tourney_types_table.c.siteId, tourney_types_table.c.buyin, tourney_types_table.c.fee,
|
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.maxSeats, tourney_types_table.c.knockout, tourney_types_table.c.rebuy,
|
||||||
tourney_types_table.c.speed, tourney_types_table.c.headsUp, tourney_types_table.c.shootout,
|
tourney_types_table.c.addOn, tourney_types_table.c.speed,
|
||||||
tourney_types_table.c.matrix, tourney_types_table.c.sng)
|
tourney_types_table.c.shootout, tourney_types_table.c.matrix, tourney_types_table.c.sng)
|
||||||
|
|
||||||
|
|
||||||
tourneys_players_table = Table('TourneysPlayers', metadata,
|
tourneys_players_table = Table('TourneysPlayers', metadata,
|
||||||
Column('id', BigIntColumn, primary_key=True),
|
Column('id', BigIntColumn, primary_key=True),
|
||||||
Column('tourneyId', Integer, ForeignKey("Tourneys.id"), nullable=False),
|
Column('tourneyId', Integer, ForeignKey("Tourneys.id"), nullable=False),
|
||||||
Column('playerId', Integer, ForeignKey("Players.id"), nullable=False),
|
Column('playerId', Integer, ForeignKey("Players.id"), nullable=False),
|
||||||
Column('payinAmount', Integer), # INT NOT NULL
|
|
||||||
Column('rank', Integer), # INT NOT NULL
|
Column('rank', Integer), # INT NOT NULL
|
||||||
Column('winnings', Integer), # INT NOT NULL
|
Column('winnings', Integer), # INT NOT NULL
|
||||||
Column('nbRebuys', Integer, default=0), # INT DEFAULT 0
|
Column('winningsCurrency', Text), # TEXT
|
||||||
Column('nbAddons', Integer, default=0), # INT DEFAULT 0
|
Column('rebuyCount', Integer, default=0), # INT DEFAULT 0
|
||||||
Column('nbKO', 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('comment', Text), # TEXT
|
||||||
Column('commentTs', DateTime), # DATETIME
|
Column('commentTs', DateTime), # DATETIME
|
||||||
mysql_charset='utf8',
|
mysql_charset='utf8',
|
||||||
|
|
35
pyfpdb/Anonymise.py
Normal file → Executable file
35
pyfpdb/Anonymise.py
Normal file → Executable file
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import codecs
|
import codecs
|
||||||
import Options
|
import Options
|
||||||
import HandHistoryConverter
|
import HandHistoryConverter
|
||||||
|
import Configuration
|
||||||
|
import sys
|
||||||
|
|
||||||
(options, argv) = Options.fpdb_options()
|
(options, argv) = Options.fpdb_options()
|
||||||
|
config = Configuration.Config()
|
||||||
|
|
||||||
filter = options.hhc
|
filter = options.hhc
|
||||||
|
|
||||||
|
@ -13,7 +33,7 @@ filter_name = filter.replace("ToFpdb", "")
|
||||||
mod = __import__(filter)
|
mod = __import__(filter)
|
||||||
obj = getattr(mod, filter_name, None)
|
obj = getattr(mod, filter_name, None)
|
||||||
|
|
||||||
hhc = obj(autostart=False)
|
hhc = obj(config, autostart=False)
|
||||||
|
|
||||||
if os.path.exists(options.infile):
|
if os.path.exists(options.infile):
|
||||||
in_fh = codecs.open(options.infile, 'r', "utf8")
|
in_fh = codecs.open(options.infile, 'r', "utf8")
|
||||||
|
@ -25,13 +45,24 @@ else:
|
||||||
|
|
||||||
m = hhc.re_PlayerInfo.finditer(filecontents)
|
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 = []
|
players = []
|
||||||
for a in m:
|
for a in m:
|
||||||
players = players + [a.group('PNAME')]
|
players = players + [a.group('PNAME')]
|
||||||
|
|
||||||
uniq = set(players)
|
uniq = set(players)
|
||||||
|
|
||||||
for i, name in enumerate(uniq, 1):
|
for i, name in enumerate(uniq):
|
||||||
filecontents = filecontents.replace(name, 'Player%d' %i)
|
filecontents = filecontents.replace(name, 'Player%d' %i)
|
||||||
|
|
||||||
print filecontents
|
print filecontents
|
||||||
|
|
||||||
|
sys.stdout = savestdout
|
||||||
|
fsock.close()
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# Copyright 2008, Carl Gherardi
|
# Copyright 2008-2010, Carl Gherardi
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# 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')))
|
logging.debug("HID %s, Table %s" % (m.group('HID'), m.group('TABLE')))
|
||||||
hand.handid = m.group('HID')
|
hand.handid = m.group('HID')
|
||||||
hand.tablename = m.group('TABLE')
|
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'))
|
#hand.buttonpos = int(m.group('BUTTON'))
|
||||||
|
|
||||||
def readPlayerStacks(self, hand):
|
def readPlayerStacks(self, hand):
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
# This code is based heavily on EverleafToFpdb.py, by Carl Gherardi
|
# This code is based heavily on EverleafToFpdb.py, by Carl Gherardi
|
||||||
#
|
#
|
||||||
# OUTSTANDING MATTERS
|
# TODO:
|
||||||
#
|
#
|
||||||
# -- No siteID assigned
|
# -- No siteID assigned
|
||||||
# -- No support for games other than NL hold 'em cash. Hand histories for other
|
# -- No support for games other than NL hold 'em cash. Hand histories for other
|
||||||
|
@ -79,7 +79,7 @@ class Carbon(HandHistoryConverter):
|
||||||
#re_Antes = ???
|
#re_Antes = ???
|
||||||
#re_BringIn = ???
|
#re_BringIn = ???
|
||||||
re_HeroCards = re.compile(r'<cards type="HOLE" cards="(?P<CARDS>.+)" player="(?P<PSEAT>[0-9])"', re.MULTILINE)
|
re_HeroCards = re.compile(r'<cards type="HOLE" cards="(?P<CARDS>.+)" player="(?P<PSEAT>[0-9])"', re.MULTILINE)
|
||||||
re_Action = re.compile(r'<event sequence="[0-9]+" type="(?P<ATYPE>FOLD|CHECK|CALL|BET|RAISE|ALL_IN|SIT_OUT)" player="(?P<PSEAT>[0-9])"( amount="(?P<BET>[.0-9]+)")?/>', re.MULTILINE)
|
re_Action = re.compile(r'<event sequence="[0-9]+" type="(?P<ATYPE>FOLD|CHECK|CALL|BET|RAISE|ALL_IN|SIT_OUT)" (?P<TIMESTAMP>timestamp="[0-9]+" )?player="(?P<PSEAT>[0-9])"( amount="(?P<BET>[.0-9]+)")?/>', re.MULTILINE)
|
||||||
re_ShowdownAction = re.compile(r'<cards type="SHOWN" cards="(?P<CARDS>..,..)" player="(?P<PSEAT>[0-9])"/>', re.MULTILINE)
|
re_ShowdownAction = re.compile(r'<cards type="SHOWN" cards="(?P<CARDS>..,..)" player="(?P<PSEAT>[0-9])"/>', re.MULTILINE)
|
||||||
re_CollectPot = re.compile(r'<winner amount="(?P<POT>[.0-9]+)" uncalled="(true|false)" potnumber="[0-9]+" player="(?P<PSEAT>[0-9])"', re.MULTILINE)
|
re_CollectPot = re.compile(r'<winner amount="(?P<POT>[.0-9]+)" uncalled="(true|false)" potnumber="[0-9]+" player="(?P<PSEAT>[0-9])"', re.MULTILINE)
|
||||||
re_SitsOut = re.compile(r'<event sequence="[0-9]+" type="SIT_OUT" player="(?P<PSEAT>[0-9])"/>', re.MULTILINE)
|
re_SitsOut = re.compile(r'<event sequence="[0-9]+" type="SIT_OUT" player="(?P<PSEAT>[0-9])"/>', re.MULTILINE)
|
||||||
|
@ -156,7 +156,7 @@ or None if we fail to get the info """
|
||||||
hand.handid = m.group('HID1') + m.group('HID2')
|
hand.handid = m.group('HID1') + m.group('HID2')
|
||||||
hand.tablename = m.group('TABLE')[:-1]
|
hand.tablename = m.group('TABLE')[:-1]
|
||||||
hand.maxseats = 2 # This value may be increased as necessary
|
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')
|
'%Y%m%d%H%M')
|
||||||
# Check that the hand is complete up to the awarding of the pot; if
|
# Check that the hand is complete up to the awarding of the pot; if
|
||||||
# not, the hand is unparseable
|
# not, the hand is unparseable
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/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
|
#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
|
#it under the terms of the GNU Affero General Public License as published by
|
||||||
#the Free Software Foundation, version 3 of the License.
|
#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
|
#You should have received a copy of the GNU Affero General Public License
|
||||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#In the "official" distribution you can find the license in
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
#agpl-3.0.txt in the docs folder of the package.
|
|
||||||
|
|
||||||
|
|
||||||
# From fpdb_simple
|
# From fpdb_simple
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
#Copyright 2010 Mika Bostrom
|
#Copyright 2010 Mika Bostrom
|
||||||
#This program is free software: you can redistribute it and/or modify
|
#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
|
#You should have received a copy of the GNU Affero General Public License
|
||||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#In the "official" distribution you can find the license in
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
#agpl-3.0.txt in the docs folder of the package.
|
|
||||||
|
|
||||||
# Error logging
|
# Error logging
|
||||||
import sys
|
import sys
|
||||||
|
@ -26,7 +26,9 @@ import Configuration
|
||||||
|
|
||||||
encoder_to_utf = codecs.lookup('utf-8')
|
encoder_to_utf = codecs.lookup('utf-8')
|
||||||
encoder_to_sys = codecs.lookup(Configuration.LOCALE_ENCODING)
|
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
|
# I'm saving a few cycles with this one
|
||||||
not_needed1, not_needed2, not_needed3 = False, False, False
|
not_needed1, not_needed2, not_needed3 = False, False, False
|
||||||
if Configuration.LOCALE_ENCODING == 'UTF8':
|
if Configuration.LOCALE_ENCODING == 'UTF8':
|
||||||
|
@ -75,3 +77,19 @@ def to_gui(s):
|
||||||
except UnicodeEncodeError:
|
except UnicodeEncodeError:
|
||||||
sys.stderr.write('Could not encode: "%s"\n' % s)
|
sys.stderr.write('Could not encode: "%s"\n' % s)
|
||||||
raise
|
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
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
Handles HUD configuration files.
|
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
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -32,6 +32,7 @@ import string
|
||||||
import traceback
|
import traceback
|
||||||
import shutil
|
import shutil
|
||||||
import locale
|
import locale
|
||||||
|
import re
|
||||||
import xml.dom.minidom
|
import xml.dom.minidom
|
||||||
from xml.dom.minidom import Node
|
from xml.dom.minidom import Node
|
||||||
|
|
||||||
|
@ -248,6 +249,8 @@ class Site:
|
||||||
self.enabled = string_to_bool(node.getAttribute("enabled"), default=True)
|
self.enabled = string_to_bool(node.getAttribute("enabled"), default=True)
|
||||||
self.xpad = node.getAttribute("xpad")
|
self.xpad = node.getAttribute("xpad")
|
||||||
self.ypad = node.getAttribute("ypad")
|
self.ypad = node.getAttribute("ypad")
|
||||||
|
self.xshift = node.getAttribute("xshift")
|
||||||
|
self.yshift = node.getAttribute("yshift")
|
||||||
self.layout = {}
|
self.layout = {}
|
||||||
|
|
||||||
print "Loading site", self.site_name
|
print "Loading site", self.site_name
|
||||||
|
@ -259,6 +262,8 @@ class Site:
|
||||||
# Site defaults
|
# Site defaults
|
||||||
self.xpad = 1 if self.xpad == "" else int(self.xpad)
|
self.xpad = 1 if self.xpad == "" else int(self.xpad)
|
||||||
self.ypad = 0 if self.ypad == "" else int(self.ypad)
|
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.font_size = 7 if self.font_size == "" else int(self.font_size)
|
||||||
self.hudopacity = 1.0 if self.hudopacity == "" else float(self.hudopacity)
|
self.hudopacity = 1.0 if self.hudopacity == "" else float(self.hudopacity)
|
||||||
|
|
||||||
|
@ -296,12 +301,18 @@ class Game:
|
||||||
self.cols = int( node.getAttribute("cols") )
|
self.cols = int( node.getAttribute("cols") )
|
||||||
self.xpad = node.getAttribute("xpad")
|
self.xpad = node.getAttribute("xpad")
|
||||||
self.ypad = node.getAttribute("ypad")
|
self.ypad = node.getAttribute("ypad")
|
||||||
|
self.xshift = node.getAttribute("xshift")
|
||||||
|
self.yshift = node.getAttribute("yshift")
|
||||||
|
|
||||||
# Defaults
|
# Defaults
|
||||||
if self.xpad == "": self.xpad = 1
|
if self.xpad == "": self.xpad = 1
|
||||||
else: self.xpad = int(self.xpad)
|
else: self.xpad = int(self.xpad)
|
||||||
if self.ypad == "": self.ypad = 0
|
if self.ypad == "": self.ypad = 0
|
||||||
else: self.ypad = int(self.ypad)
|
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_text = node.getAttribute("aux")
|
||||||
aux_list = aux_text.split(',')
|
aux_list = aux_text.split(',')
|
||||||
|
@ -334,6 +345,8 @@ class Game:
|
||||||
temp = temp + " cols = %d\n" % self.cols
|
temp = temp + " cols = %d\n" % self.cols
|
||||||
temp = temp + " xpad = %d\n" % self.xpad
|
temp = temp + " xpad = %d\n" % self.xpad
|
||||||
temp = temp + " ypad = %d\n" % self.ypad
|
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
|
temp = temp + " aux = %s\n" % self.aux
|
||||||
|
|
||||||
for stat in self.stats.keys():
|
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" \
|
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)
|
% (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:
|
class HudUI:
|
||||||
def __init__(self, node):
|
def __init__(self, node):
|
||||||
self.node = node
|
self.node = node
|
||||||
|
@ -580,6 +606,10 @@ class Config:
|
||||||
imp = Import(node = imp_node)
|
imp = Import(node = imp_node)
|
||||||
self.imp = imp
|
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'):
|
for hui_node in doc.getElementsByTagName('hud_ui'):
|
||||||
hui = HudUI(node = hui_node)
|
hui = HudUI(node = hui_node)
|
||||||
self.ui = hui
|
self.ui = hui
|
||||||
|
@ -662,7 +692,34 @@ class Config:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
with open(file, 'w') as f:
|
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,
|
def edit_layout(self, site_name, max, width = None, height = None,
|
||||||
fav_seat = None, locations = None):
|
fav_seat = None, locations = None):
|
||||||
|
@ -951,6 +1008,8 @@ class Config:
|
||||||
parms["enabled"] = self.supported_sites[site].enabled
|
parms["enabled"] = self.supported_sites[site].enabled
|
||||||
parms["xpad"] = self.supported_sites[site].xpad
|
parms["xpad"] = self.supported_sites[site].xpad
|
||||||
parms["ypad"] = self.supported_sites[site].ypad
|
parms["ypad"] = self.supported_sites[site].ypad
|
||||||
|
parms["xshift"] = self.supported_sites[site].xshift
|
||||||
|
parms["yshift"] = self.supported_sites[site].yshift
|
||||||
return parms
|
return parms
|
||||||
|
|
||||||
def set_site_parameters(self, site_name, converter = None, decoder = None,
|
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['cols'] = self.supported_games[name].cols
|
||||||
param['xpad'] = self.supported_games[name].xpad
|
param['xpad'] = self.supported_games[name].xpad
|
||||||
param['ypad'] = self.supported_games[name].ypad
|
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
|
param['aux'] = self.supported_games[name].aux
|
||||||
return param
|
return param
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
"""Database.py
|
"""Database.py
|
||||||
|
|
||||||
Create and manage the database objects.
|
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
|
# 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
|
# 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 speed of get_stats_from_hand() - add log info
|
||||||
# - check size of db, seems big? (mysql)
|
# - check size of db, seems big? (mysql)
|
||||||
# - investigate size of mysql db (200K for just 7K hands? 2GB for 140K hands?)
|
# - investigate size of mysql db (200K for just 7K hands? 2GB for 140K hands?)
|
||||||
|
@ -52,7 +53,6 @@ log = logging.getLogger("db")
|
||||||
# FreePokerTools modules
|
# FreePokerTools modules
|
||||||
import SQL
|
import SQL
|
||||||
import Card
|
import Card
|
||||||
import Tourney
|
|
||||||
import Charset
|
import Charset
|
||||||
from Exceptions import *
|
from Exceptions import *
|
||||||
import Configuration
|
import Configuration
|
||||||
|
@ -74,7 +74,7 @@ except ImportError:
|
||||||
use_numpy = False
|
use_numpy = False
|
||||||
|
|
||||||
|
|
||||||
DB_VERSION = 119
|
DB_VERSION = 131
|
||||||
|
|
||||||
|
|
||||||
# Variance created as sqlite has a bunch of undefined aggregate functions.
|
# 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':'playerId', 'drop':0}
|
||||||
#, {'tab':'TourneysPlayers', 'col':'tourneyId', 'drop':0} unique indexes not dropped
|
#, {'tab':'TourneysPlayers', 'col':'tourneyId', 'drop':0} unique indexes not dropped
|
||||||
, {'tab':'TourneyTypes', 'col':'siteId', 'drop':0}
|
, {'tab':'TourneyTypes', 'col':'siteId', 'drop':0}
|
||||||
|
, {'tab':'Backings', 'col':'tourneysPlayerId', 'drop':0}
|
||||||
|
, {'tab':'Backings', 'col':'playerId', 'drop':0}
|
||||||
]
|
]
|
||||||
, [ # indexes for sqlite (list index 4)
|
, [ # indexes for sqlite (list index 4)
|
||||||
{'tab':'Hands', 'col':'gametypeId', 'drop':0}
|
{'tab':'Hands', 'col':'gametypeId', 'drop':0}
|
||||||
|
@ -154,6 +156,8 @@ class Database:
|
||||||
, {'tab':'Tourneys', 'col':'tourneyTypeId', 'drop':1}
|
, {'tab':'Tourneys', 'col':'tourneyTypeId', 'drop':1}
|
||||||
, {'tab':'TourneysPlayers', 'col':'playerId', 'drop':0}
|
, {'tab':'TourneysPlayers', 'col':'playerId', 'drop':0}
|
||||||
, {'tab':'TourneyTypes', 'col':'siteId', '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)
|
# alter table t add constraint c foreign key (fkcol) references tab(rcol)
|
||||||
# (fkcol is used for foreigh key name)
|
# (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
|
# SELECT table_name, index_name, non_unique, column_name
|
||||||
# FROM INFORMATION_SCHEMA.STATISTICS
|
# FROM INFORMATION_SCHEMA.STATISTICS
|
||||||
# WHERE table_name = 'tbl_name'
|
# WHERE table_name = 'tbl_name'
|
||||||
|
@ -223,6 +227,7 @@ class Database:
|
||||||
# Note: index names must be unique across a schema
|
# Note: index names must be unique across a schema
|
||||||
# CREATE INDEX idx ON tab(col)
|
# CREATE INDEX idx ON tab(col)
|
||||||
# DROP INDEX idx
|
# DROP INDEX idx
|
||||||
|
# SELECT * FROM PG_INDEXES
|
||||||
|
|
||||||
# SQLite notes:
|
# SQLite notes:
|
||||||
|
|
||||||
|
@ -289,6 +294,34 @@ class Database:
|
||||||
self.connection.rollback() # make sure any locks taken so far are released
|
self.connection.rollback() # make sure any locks taken so far are released
|
||||||
#end def __init__
|
#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
|
# could be used by hud to change hud style
|
||||||
def set_hud_style(self, style):
|
def set_hud_style(self, style):
|
||||||
self.hud_style = style
|
self.hud_style = style
|
||||||
|
@ -552,6 +585,24 @@ class Database:
|
||||||
c.execute(self.sql.query['get_hand_info'], new_hand_id)
|
c.execute(self.sql.query['get_hand_info'], new_hand_id)
|
||||||
return c.fetchall()
|
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):
|
def get_actual_seat(self, hand_id, name):
|
||||||
c = self.connection.cursor()
|
c = self.connection.cursor()
|
||||||
c.execute(self.sql.query['get_actual_seat'], (hand_id, name))
|
c.execute(self.sql.query['get_actual_seat'], (hand_id, name))
|
||||||
|
@ -801,11 +852,12 @@ class Database:
|
||||||
#print "session stat_dict =", stat_dict
|
#print "session stat_dict =", stat_dict
|
||||||
#return 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()
|
c = self.connection.cursor()
|
||||||
#print "get_player_id: player_name =", player_name, type(player_name)
|
siteNameUtf = Charset.to_utf8(siteName)
|
||||||
p_name = Charset.to_utf8(player_name)
|
playerNameUtf = Charset.to_utf8(playerName)
|
||||||
c.execute(self.sql.query['get_player_id'], (p_name, site))
|
#print "db.get_player_id siteName",siteName,"playerName",playerName
|
||||||
|
c.execute(self.sql.query['get_player_id'], (playerNameUtf, siteNameUtf))
|
||||||
row = c.fetchone()
|
row = c.fetchone()
|
||||||
if row:
|
if row:
|
||||||
return row[0]
|
return row[0]
|
||||||
|
@ -1075,7 +1127,7 @@ class Database:
|
||||||
c = self.get_cursor()
|
c = self.get_cursor()
|
||||||
c.execute(self.sql.query['createSettingsTable'])
|
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['createSitesTable'])
|
||||||
c.execute(self.sql.query['createGametypesTable'])
|
c.execute(self.sql.query['createGametypesTable'])
|
||||||
c.execute(self.sql.query['createPlayersTable'])
|
c.execute(self.sql.query['createPlayersTable'])
|
||||||
|
@ -1087,8 +1139,10 @@ class Database:
|
||||||
c.execute(self.sql.query['createHandsPlayersTable'])
|
c.execute(self.sql.query['createHandsPlayersTable'])
|
||||||
c.execute(self.sql.query['createHandsActionsTable'])
|
c.execute(self.sql.query['createHandsActionsTable'])
|
||||||
c.execute(self.sql.query['createHudCacheTable'])
|
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['addTourneyIndex'])
|
||||||
c.execute(self.sql.query['addHandsIndex'])
|
c.execute(self.sql.query['addHandsIndex'])
|
||||||
c.execute(self.sql.query['addPlayersIndex'])
|
c.execute(self.sql.query['addPlayersIndex'])
|
||||||
|
@ -1162,7 +1216,8 @@ class Database:
|
||||||
self.connection.set_isolation_level(0) # allow table/index operations to work
|
self.connection.set_isolation_level(0) # allow table/index operations to work
|
||||||
for idx in self.indexes[self.backend]:
|
for idx in self.indexes[self.backend]:
|
||||||
if self.backend == self.MYSQL_INNODB:
|
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:
|
try:
|
||||||
s = "create index %s on %s(%s)" % (idx['col'],idx['tab'],idx['col'])
|
s = "create index %s on %s(%s)" % (idx['col'],idx['tab'],idx['col'])
|
||||||
self.get_cursor().execute(s)
|
self.get_cursor().execute(s)
|
||||||
|
@ -1170,13 +1225,15 @@ class Database:
|
||||||
print " create idx failed: " + str(sys.exc_info())
|
print " create idx failed: " + str(sys.exc_info())
|
||||||
elif self.backend == self.PGSQL:
|
elif self.backend == self.PGSQL:
|
||||||
# mod to use tab_col for index name?
|
# 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:
|
try:
|
||||||
s = "create index %s_%s_idx on %s(%s)" % (idx['tab'], idx['col'], idx['tab'], idx['col'])
|
s = "create index %s_%s_idx on %s(%s)" % (idx['tab'], idx['col'], idx['tab'], idx['col'])
|
||||||
self.get_cursor().execute(s)
|
self.get_cursor().execute(s)
|
||||||
except:
|
except:
|
||||||
print " create idx failed: " + str(sys.exc_info())
|
print " create idx failed: " + str(sys.exc_info())
|
||||||
elif self.backend == self.SQLITE:
|
elif self.backend == self.SQLITE:
|
||||||
|
print "Creating sqlite index %s %s" %(idx['tab'], idx['col'])
|
||||||
log.debug("Creating sqlite index %s %s" %(idx['tab'], idx['col']))
|
log.debug("Creating sqlite index %s %s" %(idx['tab'], idx['col']))
|
||||||
try:
|
try:
|
||||||
s = "create index %s_%s_idx on %s(%s)" % (idx['tab'], idx['col'], idx['tab'], idx['col'])
|
s = "create index %s_%s_idx on %s(%s)" % (idx['tab'], idx['col'], idx['tab'], idx['col'])
|
||||||
|
@ -1184,7 +1241,7 @@ class Database:
|
||||||
except:
|
except:
|
||||||
log.debug("Create idx failed: " + str(sys.exc_info()))
|
log.debug("Create idx failed: " + str(sys.exc_info()))
|
||||||
else:
|
else:
|
||||||
print "Only MySQL, Postgres and SQLite supported so far"
|
print "Unknown database: MySQL, Postgres and SQLite supported"
|
||||||
return -1
|
return -1
|
||||||
if self.backend == self.PGSQL:
|
if self.backend == self.PGSQL:
|
||||||
self.connection.set_isolation_level(1) # go back to normal isolation level
|
self.connection.set_isolation_level(1) # go back to normal isolation level
|
||||||
|
@ -1215,8 +1272,15 @@ class Database:
|
||||||
% (idx['tab'],idx['col']) )
|
% (idx['tab'],idx['col']) )
|
||||||
except:
|
except:
|
||||||
print " drop idx failed: " + str(sys.exc_info())
|
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:
|
else:
|
||||||
print "Only MySQL and Postgres supported so far"
|
print "Only MySQL, Postgres and SQLITE supported, what are you trying to use?"
|
||||||
return -1
|
return -1
|
||||||
if self.backend == self.PGSQL:
|
if self.backend == self.PGSQL:
|
||||||
self.connection.set_isolation_level(1) # go back to normal isolation level
|
self.connection.set_isolation_level(1) # go back to normal isolation level
|
||||||
|
@ -1331,29 +1395,30 @@ class Database:
|
||||||
def fillDefaultData(self):
|
def fillDefaultData(self):
|
||||||
c = self.get_cursor()
|
c = self.get_cursor()
|
||||||
c.execute("INSERT INTO Settings (version) VALUES (%s);" % (DB_VERSION))
|
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,code) VALUES ('Full Tilt Poker', 'FT')")
|
||||||
c.execute("INSERT INTO Sites (name,currency) VALUES ('PokerStars', 'USD')")
|
c.execute("INSERT INTO Sites (name,code) VALUES ('PokerStars', 'PS')")
|
||||||
c.execute("INSERT INTO Sites (name,currency) VALUES ('Everleaf', 'USD')")
|
c.execute("INSERT INTO Sites (name,code) VALUES ('Everleaf', 'EV')")
|
||||||
c.execute("INSERT INTO Sites (name,currency) VALUES ('Win2day', 'USD')")
|
c.execute("INSERT INTO Sites (name,code) VALUES ('Win2day', 'W2')")
|
||||||
c.execute("INSERT INTO Sites (name,currency) VALUES ('OnGame', 'USD')")
|
c.execute("INSERT INTO Sites (name,code) VALUES ('OnGame', 'OG')")
|
||||||
c.execute("INSERT INTO Sites (name,currency) VALUES ('UltimateBet', 'USD')")
|
c.execute("INSERT INTO Sites (name,code) VALUES ('UltimateBet', 'UB')")
|
||||||
c.execute("INSERT INTO Sites (name,currency) VALUES ('Betfair', 'USD')")
|
c.execute("INSERT INTO Sites (name,code) VALUES ('Betfair', 'BF')")
|
||||||
c.execute("INSERT INTO Sites (name,currency) VALUES ('Absolute', 'USD')")
|
c.execute("INSERT INTO Sites (name,code) VALUES ('Absolute', 'AB')")
|
||||||
c.execute("INSERT INTO Sites (name,currency) VALUES ('PartyPoker', 'USD')")
|
c.execute("INSERT INTO Sites (name,code) VALUES ('PartyPoker', 'PP')")
|
||||||
c.execute("INSERT INTO Sites (name,currency) VALUES ('Partouche', 'EUR')")
|
c.execute("INSERT INTO Sites (name,code) VALUES ('Partouche', 'PA')")
|
||||||
c.execute("INSERT INTO Sites (name,currency) VALUES ('Carbon', 'USD')")
|
c.execute("INSERT INTO Sites (name,code) VALUES ('Carbon', 'CA')")
|
||||||
c.execute("INSERT INTO Sites (name,currency) VALUES ('PKR', 'USD')")
|
c.execute("INSERT INTO Sites (name,code) VALUES ('PKR', 'PK')")
|
||||||
if self.backend == self.SQLITE:
|
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:
|
elif self.backend == self.PGSQL:
|
||||||
c.execute("""insert into TourneyTypes(siteId, buyin, fee, maxSeats, knockout
|
c.execute("""insert into TourneyTypes(siteId, currency, buyin, fee, category, limitType,
|
||||||
,rebuyOrAddon, speed, headsUp, shootout, matrix)
|
buyInChips, maxSeats, knockout, rebuy, addOn, speed, shootout, matrix)
|
||||||
values (1, 0, 0, 0, False, False, null, False, False, False);""")
|
values (1, 'USD', 0, 0, "NA", "NA", 0, 0, False, False, False, null, False, False);""")
|
||||||
elif self.backend == self.MYSQL_INNODB:
|
elif self.backend == self.MYSQL_INNODB:
|
||||||
c.execute("""insert into TourneyTypes(id, siteId, buyin, fee, maxSeats, knockout
|
c.execute("""insert into TourneyTypes(id, siteId, currency, buyin, fee, category, limitType,
|
||||||
,rebuyOrAddon, speed, headsUp, shootout, matrix)
|
buyInChips, maxSeats, knockout, rebuy, addOn, speed, shootout, matrix)
|
||||||
values (DEFAULT, 1, 0, 0, 0, False, False, null, False, False, False);""")
|
values (DEFAULT, 1, 'USD', 0, 0, "NA", "NA", 0, 0, False, False, False, null, False, False);""")
|
||||||
|
|
||||||
#end def fillDefaultData
|
#end def fillDefaultData
|
||||||
|
|
||||||
def rebuild_indexes(self, start=None):
|
def rebuild_indexes(self, start=None):
|
||||||
|
@ -1361,6 +1426,7 @@ class Database:
|
||||||
self.createAllIndexes()
|
self.createAllIndexes()
|
||||||
self.dropAllForeignKeys()
|
self.dropAllForeignKeys()
|
||||||
self.createAllForeignKeys()
|
self.createAllForeignKeys()
|
||||||
|
#end def rebuild_indexes
|
||||||
|
|
||||||
def rebuild_hudcache(self, h_start=None, v_start=None):
|
def rebuild_hudcache(self, h_start=None, v_start=None):
|
||||||
"""clears hudcache and rebuilds from the individual handsplayers records"""
|
"""clears hudcache and rebuilds from the individual handsplayers records"""
|
||||||
|
@ -1390,9 +1456,9 @@ class Database:
|
||||||
where = ""
|
where = ""
|
||||||
else:
|
else:
|
||||||
where = "where ( hp.playerId not in " + str(tuple(self.hero_ids.values())) \
|
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())) \
|
+ " 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_clause>', where)
|
rebuild_sql = self.sql.query['rebuildHudCache'].replace('<where_clause>', where)
|
||||||
|
|
||||||
self.get_cursor().execute(self.sql.query['clearHudCache'])
|
self.get_cursor().execute(self.sql.query['clearHudCache'])
|
||||||
|
@ -1508,7 +1574,7 @@ class Database:
|
||||||
p['gameTypeId'],
|
p['gameTypeId'],
|
||||||
p['siteHandNo'],
|
p['siteHandNo'],
|
||||||
0, # tourneyId: 0 means not a tourney hand
|
0, # tourneyId: 0 means not a tourney hand
|
||||||
p['handStart'],
|
p['startTime'],
|
||||||
datetime.today(), #importtime
|
datetime.today(), #importtime
|
||||||
p['seats'],
|
p['seats'],
|
||||||
p['maxSeats'],
|
p['maxSeats'],
|
||||||
|
@ -1546,6 +1612,7 @@ class Database:
|
||||||
pids[p],
|
pids[p],
|
||||||
pdata[p]['startCash'],
|
pdata[p]['startCash'],
|
||||||
pdata[p]['seatNo'],
|
pdata[p]['seatNo'],
|
||||||
|
pdata[p]['sitout'],
|
||||||
pdata[p]['card1'],
|
pdata[p]['card1'],
|
||||||
pdata[p]['card2'],
|
pdata[p]['card2'],
|
||||||
pdata[p]['card3'],
|
pdata[p]['card3'],
|
||||||
|
@ -1621,7 +1688,12 @@ class Database:
|
||||||
pdata[p]['street3CheckCallRaiseChance'],
|
pdata[p]['street3CheckCallRaiseChance'],
|
||||||
pdata[p]['street3CheckCallRaiseDone'],
|
pdata[p]['street3CheckCallRaiseDone'],
|
||||||
pdata[p]['street4CheckCallRaiseChance'],
|
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']
|
q = self.sql.query['store_hands_players']
|
||||||
|
@ -1650,7 +1722,7 @@ class Database:
|
||||||
#print "DEBUG: %s %s %s" %(hid, pids, pdata)
|
#print "DEBUG: %s %s %s" %(hid, pids, pdata)
|
||||||
inserts = []
|
inserts = []
|
||||||
for p in pdata:
|
for p in pdata:
|
||||||
line = [0]*61
|
line = [0]*76
|
||||||
|
|
||||||
line[0] = 1 # HDs
|
line[0] = 1 # HDs
|
||||||
if pdata[p]['street0VPI']: line[1] = 1
|
if pdata[p]['street0VPI']: line[1] = 1
|
||||||
|
@ -1707,13 +1779,29 @@ class Database:
|
||||||
if pdata[p]['street3CheckCallRaiseDone']: line[52] = 1
|
if pdata[p]['street3CheckCallRaiseDone']: line[52] = 1
|
||||||
if pdata[p]['street4CheckCallRaiseChance']: line[53] = 1
|
if pdata[p]['street4CheckCallRaiseChance']: line[53] = 1
|
||||||
if pdata[p]['street4CheckCallRaiseDone']: line[54] = 1
|
if pdata[p]['street4CheckCallRaiseDone']: line[54] = 1
|
||||||
line[55] = gid # gametypeId
|
if pdata[p]['street0Calls']: line[55] = 1
|
||||||
line[56] = pids[p] # playerId
|
if pdata[p]['street1Calls']: line[56] = 1
|
||||||
line[57] = len(pids) # activeSeats
|
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' }
|
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[73] = pos[pdata[p]['position']]
|
||||||
line[59] = pdata[p]['tourneyTypeId']
|
line[74] = pdata[p]['tourneyTypeId']
|
||||||
line[60] = styleKey # styleKey
|
line[75] = styleKey # styleKey
|
||||||
inserts.append(line)
|
inserts.append(line)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1759,8 +1847,9 @@ class Database:
|
||||||
hilo = "s"
|
hilo = "s"
|
||||||
elif game['category'] in ['razz','27_3draw','badugi']:
|
elif game['category'] in ['razz','27_3draw','badugi']:
|
||||||
hilo = "l"
|
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) )
|
int(Decimal(game['sb'])*100), int(Decimal(game['bb'])*100), 0, 0) )
|
||||||
|
#FIXME: recognise currency
|
||||||
return tmp[0]
|
return tmp[0]
|
||||||
|
|
||||||
def getSqlPlayerIDs(self, pnames, siteid):
|
def getSqlPlayerIDs(self, pnames, siteid):
|
||||||
|
@ -1820,48 +1909,6 @@ class Database:
|
||||||
# Finish of NEWIMPORT CODE
|
# 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
|
# read HandToWrite objects from q and insert into database
|
||||||
def insert_queue_hands(self, q, maxwait=10, commitEachHand=True):
|
def insert_queue_hands(self, q, maxwait=10, commitEachHand=True):
|
||||||
n,fails,maxTries,firstWait = 0,0,4,0.1
|
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])
|
print "***Error sending finish: "+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
||||||
# end def send_finish_msg():
|
# end def send_finish_msg():
|
||||||
|
|
||||||
def tRecogniseTourneyType(self, tourney):
|
def createOrUpdateTourneyType(self, hand):#note: this method is used on Hand and TourneySummary objects
|
||||||
log.debug("Database.tRecogniseTourneyType")
|
tourneyTypeId = 1
|
||||||
typeId = 1
|
|
||||||
# Check if Tourney exists, and if so retrieve TTypeId : in that case, check values of the ttype
|
# Check if Tourney exists, and if so retrieve TTypeId : in that case, check values of the ttype
|
||||||
cursor = self.get_cursor()
|
cursor = self.get_cursor()
|
||||||
cursor.execute (self.sql.query['getTourneyTypeIdByTourneyNo'].replace('%s', self.sql.query['placeholder']),
|
cursor.execute (self.sql.query['getTourneyTypeIdByTourneyNo'].replace('%s', self.sql.query['placeholder']),
|
||||||
(tourney.tourNo, tourney.siteId)
|
(hand.tourNo, hand.siteId)
|
||||||
)
|
)
|
||||||
result=cursor.fetchone()
|
result=cursor.fetchone()
|
||||||
|
|
||||||
expectedValues = { 1 : "buyin", 2 : "fee", 4 : "isKO", 5 : "isRebuy", 6 : "speed",
|
expectedValues = { 1 : "buyin", 2 : "fee", 4 : "isKO", 5 : "isRebuy", 6 : "speed",
|
||||||
7 : "isHU", 8 : "isShootout", 9 : "isMatrix" }
|
7 : "isShootout", 8 : "isMatrix" }
|
||||||
typeIdMatch = True
|
tourneyTypeIdMatch = True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
len(result)
|
tourneyTypeId = result[0]
|
||||||
typeId = result[0]
|
log.debug("Tourney found in db with Tourney_Type_ID = %d" % tourneyTypeId)
|
||||||
log.debug("Tourney found in db with Tourney_Type_ID = %d" % typeId)
|
|
||||||
for ev in expectedValues :
|
for ev in expectedValues :
|
||||||
if ( getattr( tourney, expectedValues.get(ev) ) <> result[ev] ):
|
if ( getattr( hand, 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]) )
|
log.debug("TypeId mismatch : wrong %s : Tourney=%s / db=%s" % (expectedValues.get(ev), getattr( hand, expectedValues.get(ev)), result[ev]) )
|
||||||
typeIdMatch = False
|
tourneyTypeIdMatch = False
|
||||||
#break
|
#break
|
||||||
except:
|
except:
|
||||||
# Tourney not found : a TourneyTypeId has to be found or created for that specific tourney
|
# Tourney not found : a TourneyTypeId has to be found or created for that specific tourney
|
||||||
typeIdMatch = False
|
tourneyTypeIdMatch = False
|
||||||
|
|
||||||
if typeIdMatch == False :
|
if tourneyTypeIdMatch == False :
|
||||||
# Check for an existing TTypeId that matches tourney info (buyin/fee, knockout, rebuy, speed, matrix, shootout)
|
# Check for an existing TTypeId that matches tourney info, if not found create it
|
||||||
# if not found create it
|
|
||||||
log.debug("Searching for a TourneyTypeId matching TourneyType data")
|
|
||||||
cursor.execute (self.sql.query['getTourneyTypeId'].replace('%s', self.sql.query['placeholder']),
|
cursor.execute (self.sql.query['getTourneyTypeId'].replace('%s', self.sql.query['placeholder']),
|
||||||
(tourney.siteId, tourney.buyin, tourney.fee, tourney.isKO,
|
(hand.siteId, hand.buyinCurrency, hand.buyin, hand.fee, hand.gametype['category'], hand.gametype['limitType'], hand.isKO,
|
||||||
tourney.isRebuy, tourney.speed, tourney.isHU, tourney.isShootout, tourney.isMatrix)
|
hand.isRebuy, hand.isRebuy, hand.speed, hand.isShootout, hand.isMatrix)
|
||||||
)
|
)
|
||||||
result=cursor.fetchone()
|
result=cursor.fetchone()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
len(result)
|
tourneyTypeId = result[0]
|
||||||
typeId = result[0]
|
|
||||||
log.debug("Existing Tourney Type Id found : %d" % typeId)
|
|
||||||
except TypeError: #this means we need to create a new entry
|
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['insertTourneyType'].replace('%s', self.sql.query['placeholder']),
|
||||||
cursor.execute (self.sql.query['insertTourneyTypes'].replace('%s', self.sql.query['placeholder']),
|
(hand.siteId, hand.buyinCurrency, hand.buyin, hand.fee, hand.gametype['category'], hand.gametype['limitType'], hand.buyInChips,
|
||||||
(tourney.siteId, tourney.buyin, tourney.fee, tourney.isKO, tourney.isRebuy,
|
hand.isKO, hand.isRebuy,
|
||||||
tourney.speed, tourney.isHU, tourney.isShootout, tourney.isMatrix)
|
hand.isAddOn, hand.speed, hand.isShootout, hand.isMatrix)
|
||||||
)
|
)
|
||||||
typeId = self.get_last_insert_id(cursor)
|
tourneyTypeId = self.get_last_insert_id(cursor)
|
||||||
|
return tourneyTypeId
|
||||||
|
#end def createOrUpdateTourneyType
|
||||||
|
|
||||||
return typeId
|
def createOrUpdateTourney(self, hand, source):#note: this method is used on Hand and TourneySummary objects
|
||||||
#end def tRecogniseTourneyType
|
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
|
# 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
|
# mainParser() in fpdb_parse_logic.py creates one of these and then passes it to
|
||||||
|
@ -2036,7 +2141,6 @@ class HandToWrite:
|
||||||
self.maxSeats = None
|
self.maxSeats = None
|
||||||
self.tableName = None
|
self.tableName = None
|
||||||
self.seatNos = None
|
self.seatNos = None
|
||||||
self.payin_amounts = None # tourney import was complaining mightily about this missing
|
|
||||||
except:
|
except:
|
||||||
print "htw.init error: " + str(sys.exc_info())
|
print "htw.init error: " + str(sys.exc_info())
|
||||||
raise
|
raise
|
||||||
|
|
|
@ -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 <module>
|
|
||||||
# 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()
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/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
|
#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
|
#it under the terms of the GNU Affero General Public License as published by
|
||||||
#the Free Software Foundation, version 3 of the License.
|
#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
|
#You should have received a copy of the GNU Affero General Public License
|
||||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#In the "official" distribution you can find the license in
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
#agpl-3.0.txt in the docs folder of the package.
|
|
||||||
|
|
||||||
#fpdb modules
|
#fpdb modules
|
||||||
import Card
|
import Card
|
||||||
|
@ -62,17 +62,18 @@ class DerivedStats():
|
||||||
for i in range(5):
|
for i in range(5):
|
||||||
self.handsplayers[player[1]]['street%dCalls' % i] = 0
|
self.handsplayers[player[1]]['street%dCalls' % i] = 0
|
||||||
self.handsplayers[player[1]]['street%dBets' % i] = 0
|
self.handsplayers[player[1]]['street%dBets' % i] = 0
|
||||||
|
self.handsplayers[player[1]]['street%dRaises' % i] = 0
|
||||||
for i in range(1,5):
|
for i in range(1,5):
|
||||||
self.handsplayers[player[1]]['street%dCBChance' %i] = False
|
self.handsplayers[player[1]]['street%dCBChance' %i] = False
|
||||||
self.handsplayers[player[1]]['street%dCBDone' %i] = False
|
self.handsplayers[player[1]]['street%dCBDone' %i] = False
|
||||||
self.handsplayers[player[1]]['street%dCheckCallRaiseChance' %i] = False
|
self.handsplayers[player[1]]['street%dCheckCallRaiseChance' %i] = False
|
||||||
self.handsplayers[player[1]]['street%dCheckCallRaiseDone' %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.
|
#FIXME - Everything below this point is incomplete.
|
||||||
self.handsplayers[player[1]]['tourneyTypeId'] = 1
|
self.handsplayers[player[1]]['tourneyTypeId'] = 1
|
||||||
for i in range(1,5):
|
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%dCBChance' %i] = False
|
||||||
self.handsplayers[player[1]]['foldToStreet%dCBDone' %i] = False
|
self.handsplayers[player[1]]['foldToStreet%dCBDone' %i] = False
|
||||||
|
|
||||||
|
@ -96,7 +97,7 @@ class DerivedStats():
|
||||||
self.hands['tableName'] = hand.tablename
|
self.hands['tableName'] = hand.tablename
|
||||||
self.hands['siteHandNo'] = hand.handid
|
self.hands['siteHandNo'] = hand.handid
|
||||||
self.hands['gametypeId'] = None # Leave None, handled later after checking db
|
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['importTime'] = None
|
||||||
self.hands['seats'] = self.countPlayers(hand)
|
self.hands['seats'] = self.countPlayers(hand)
|
||||||
self.hands['maxSeats'] = hand.maxseats
|
self.hands['maxSeats'] = hand.maxseats
|
||||||
|
@ -138,7 +139,10 @@ class DerivedStats():
|
||||||
for player in hand.players:
|
for player in hand.players:
|
||||||
self.handsplayers[player[1]]['seatNo'] = player[0]
|
self.handsplayers[player[1]]['seatNo'] = player[0]
|
||||||
self.handsplayers[player[1]]['startCash'] = int(100 * Decimal(player[2]))
|
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:]):
|
for i, street in enumerate(hand.actionStreets[2:]):
|
||||||
self.seen(self.hand, i+1)
|
self.seen(self.hand, i+1)
|
||||||
|
|
||||||
|
@ -146,6 +150,8 @@ class DerivedStats():
|
||||||
self.aggr(self.hand, i)
|
self.aggr(self.hand, i)
|
||||||
self.calls(self.hand, i)
|
self.calls(self.hand, i)
|
||||||
self.bets(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
|
# 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
|
# rake taken out. hand.collectees is Decimal, database requires cents
|
||||||
|
@ -368,8 +374,8 @@ class DerivedStats():
|
||||||
name = self.lastBetOrRaiser(hand.actionStreets[i+1])
|
name = self.lastBetOrRaiser(hand.actionStreets[i+1])
|
||||||
if name:
|
if name:
|
||||||
chance = self.noBetsBefore(hand.actionStreets[i+2], name)
|
chance = self.noBetsBefore(hand.actionStreets[i+2], name)
|
||||||
self.handsplayers[name]['street%dCBChance' % (i+1)] = True
|
|
||||||
if chance == 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)
|
self.handsplayers[name]['street%dCBDone' % (i+1)] = self.betStreet(hand.actionStreets[i+2], name)
|
||||||
|
|
||||||
def calcCheckCallRaise(self, hand):
|
def calcCheckCallRaise(self, hand):
|
||||||
|
@ -380,6 +386,7 @@ class DerivedStats():
|
||||||
|
|
||||||
CG: CheckCall would be a much better name for this.
|
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:], start=1):
|
||||||
for i, street in enumerate(hand.actionStreets[2:]):
|
for i, street in enumerate(hand.actionStreets[2:]):
|
||||||
actions = hand.actions[hand.actionStreets[i+1]]
|
actions = hand.actions[hand.actionStreets[i+1]]
|
||||||
|
@ -408,10 +415,16 @@ class DerivedStats():
|
||||||
|
|
||||||
def aggr(self, hand, i):
|
def aggr(self, hand, i):
|
||||||
aggrers = set()
|
aggrers = set()
|
||||||
|
others = set()
|
||||||
# Growl - actionStreets contains 'BLINDSANTES', which isn't actually an action street
|
# Growl - actionStreets contains 'BLINDSANTES', which isn't actually an action street
|
||||||
|
|
||||||
|
firstAggrMade=False
|
||||||
for act in hand.actions[hand.actionStreets[i+1]]:
|
for act in hand.actions[hand.actionStreets[i+1]]:
|
||||||
|
if firstAggrMade:
|
||||||
|
others.add(act[0])
|
||||||
if act[1] in ('completes', 'bets', 'raises'):
|
if act[1] in ('completes', 'bets', 'raises'):
|
||||||
aggrers.add(act[0])
|
aggrers.add(act[0])
|
||||||
|
firstAggrMade=True
|
||||||
|
|
||||||
for player in hand.players:
|
for player in hand.players:
|
||||||
#print "DEBUG: actionStreet[%s]: %s" %(hand.actionStreets[i+1], i)
|
#print "DEBUG: actionStreet[%s]: %s" %(hand.actionStreets[i+1], i)
|
||||||
|
@ -420,6 +433,17 @@ class DerivedStats():
|
||||||
else:
|
else:
|
||||||
self.handsplayers[player[1]]['street%sAggr' % i] = False
|
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):
|
def calls(self, hand, i):
|
||||||
callers = []
|
callers = []
|
||||||
for act in hand.actions[hand.actionStreets[i+1]]:
|
for act in hand.actions[hand.actionStreets[i+1]]:
|
||||||
|
@ -429,11 +453,18 @@ class DerivedStats():
|
||||||
# CG - I'm sure this stat is wrong
|
# CG - I'm sure this stat is wrong
|
||||||
# Best guess is that raise = 2 bets
|
# Best guess is that raise = 2 bets
|
||||||
def bets(self, hand, i):
|
def bets(self, hand, i):
|
||||||
betters = []
|
|
||||||
for act in hand.actions[hand.actionStreets[i+1]]:
|
for act in hand.actions[hand.actionStreets[i+1]]:
|
||||||
if act[1] in ('bets'):
|
if act[1] in ('bets'):
|
||||||
self.handsplayers[act[0]]['street%sBets' % i] = 1 + self.handsplayers[act[0]]['street%sBets' % i]
|
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):
|
def countPlayers(self, hand):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -505,9 +536,14 @@ class DerivedStats():
|
||||||
"""Returns true if player bet/raised the street as their first action"""
|
"""Returns true if player bet/raised the street as their first action"""
|
||||||
betOrRaise = False
|
betOrRaise = False
|
||||||
for act in self.hand.actions[street]:
|
for act in self.hand.actions[street]:
|
||||||
if act[0] == player and act[1] in ('bets', 'raises'):
|
if act[0] == player:
|
||||||
|
if act[1] in ('bets', 'raises'):
|
||||||
betOrRaise = True
|
betOrRaise = True
|
||||||
else:
|
else:
|
||||||
|
# player found but did not bet or raise as their first action
|
||||||
|
pass
|
||||||
break
|
break
|
||||||
|
#else:
|
||||||
|
# haven't found player's first action yet
|
||||||
return betOrRaise
|
return betOrRaise
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# Copyright 2008, Carl Gherardi
|
# Copyright 2008-2010, Carl Gherardi
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# 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
|
# 2008/11/10 3:58:52 ET
|
||||||
#TODO: Do conversion from GMT to 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)
|
#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
|
return
|
||||||
|
|
||||||
def readPlayerStacks(self, hand):
|
def readPlayerStacks(self, hand):
|
||||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
|
|
||||||
class FpdbError(Exception):
|
class FpdbError(Exception):
|
||||||
def __init__(self, value):
|
def __init__(self, value):
|
||||||
self.value = value
|
self.value = value
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/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
|
#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
|
#it under the terms of the GNU Affero General Public License as published by
|
||||||
#the Free Software Foundation, version 3 of the License.
|
#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
|
#You should have received a copy of the GNU Affero General Public License
|
||||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#In the "official" distribution you can find the license in
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
#agpl-3.0.txt in the docs folder of the package.
|
|
||||||
|
|
||||||
import threading
|
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):
|
class Filters(threading.Thread):
|
||||||
def __init__(self, db, config, qdict, display = {}, debug=True):
|
pass
|
||||||
# config and qdict are now redundant
|
#end class Filters
|
||||||
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())
|
|
||||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
|
||||||
#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]
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# Copyright 2008, Carl Gherardi
|
# Copyright 2008-2010, Carl Gherardi
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from HandHistoryConverter import *
|
from HandHistoryConverter import *
|
||||||
|
#import TourneySummary
|
||||||
|
|
||||||
# Fulltilt HH Format converter
|
# Fulltilt HH Format converter
|
||||||
|
|
||||||
|
@ -27,7 +28,7 @@ class Fulltilt(HandHistoryConverter):
|
||||||
|
|
||||||
sitename = "Fulltilt"
|
sitename = "Fulltilt"
|
||||||
filetype = "text"
|
filetype = "text"
|
||||||
codepage = ["utf-16", "cp1252"]
|
codepage = ["utf-16", "cp1252", "utf-8"]
|
||||||
siteId = 1 # Needs to match id entry in Sites database
|
siteId = 1 # Needs to match id entry in Sites database
|
||||||
|
|
||||||
# Static regexes
|
# Static regexes
|
||||||
|
@ -66,7 +67,7 @@ class Fulltilt(HandHistoryConverter):
|
||||||
''', re.VERBOSE)
|
''', re.VERBOSE)
|
||||||
re_Button = re.compile('^The button is in seat #(?P<BUTTON>\d+)', re.MULTILINE)
|
re_Button = re.compile('^The button is in seat #(?P<BUTTON>\d+)', re.MULTILINE)
|
||||||
re_PlayerInfo = re.compile('Seat (?P<SEAT>[0-9]+): (?P<PNAME>.{2,15}) \(\$(?P<CASH>[,.0-9]+)\)$', re.MULTILINE)
|
re_PlayerInfo = re.compile('Seat (?P<SEAT>[0-9]+): (?P<PNAME>.{2,15}) \(\$(?P<CASH>[,.0-9]+)\)$', re.MULTILINE)
|
||||||
re_TourneyPlayerInfo = re.compile('Seat (?P<SEAT>[0-9]+): (?P<PNAME>.{2,15}) \(\$?(?P<CASH>[,.0-9]+)\)(, is sitting out)?$', re.MULTILINE)
|
re_TourneysPlayerInfo = re.compile('Seat (?P<SEAT>[0-9]+): (?P<PNAME>.{2,15}) \(\$?(?P<CASH>[,.0-9]+)\)(, is sitting out)?$', re.MULTILINE)
|
||||||
re_Board = re.compile(r"\[(?P<CARDS>.+)\]")
|
re_Board = re.compile(r"\[(?P<CARDS>.+)\]")
|
||||||
|
|
||||||
#static regex for tourney purpose
|
#static regex for tourney purpose
|
||||||
|
@ -87,8 +88,8 @@ class Fulltilt(HandHistoryConverter):
|
||||||
re_TourneyBuyInChips = re.compile("Buy-In Chips: (?P<BUYINCHIPS>\d+)")
|
re_TourneyBuyInChips = re.compile("Buy-In Chips: (?P<BUYINCHIPS>\d+)")
|
||||||
re_TourneyEntries = re.compile("(?P<ENTRIES>\d+) Entries")
|
re_TourneyEntries = re.compile("(?P<ENTRIES>\d+) Entries")
|
||||||
re_TourneyPrizePool = re.compile("Total Prize Pool: (?P<PRIZEPOOL_CURRENCY>\$|)?(?P<PRIZEPOOL>[.,0-9]+)")
|
re_TourneyPrizePool = re.compile("Total Prize Pool: (?P<PRIZEPOOL_CURRENCY>\$|)?(?P<PRIZEPOOL>[.,0-9]+)")
|
||||||
re_TourneyRebuyAmount = re.compile("Rebuy: (?P<REBUY_CURRENCY>\$|)?(?P<REBUY_AMOUNT>[.,0-9]+)")
|
re_TourneyRebuyCost = re.compile("Rebuy: (?P<REBUY_CURRENCY>\$|)?(?P<REBUY_COST>[.,0-9]+)")
|
||||||
re_TourneyAddOnAmount = re.compile("Add-On: (?P<ADDON_CURRENCY>\$|)?(?P<ADDON_AMOUNT>[.,0-9]+)")
|
re_TourneyAddOnCost = re.compile("Add-On: (?P<ADDON_CURRENCY>\$|)?(?P<ADDON_COST>[.,0-9]+)")
|
||||||
re_TourneyRebuyCount = re.compile("performed (?P<REBUY_COUNT>\d+) Rebuy")
|
re_TourneyRebuyCount = re.compile("performed (?P<REBUY_COUNT>\d+) Rebuy")
|
||||||
re_TourneyAddOnCount = re.compile("performed (?P<ADDON_COUNT>\d+) Add-On")
|
re_TourneyAddOnCount = re.compile("performed (?P<ADDON_COUNT>\d+) Add-On")
|
||||||
re_TourneyRebuysTotal = re.compile("Total Rebuys: (?P<REBUY_TOTAL>\d+)")
|
re_TourneyRebuysTotal = re.compile("Total Rebuys: (?P<REBUY_TOTAL>\d+)")
|
||||||
|
@ -96,10 +97,10 @@ class Fulltilt(HandHistoryConverter):
|
||||||
re_TourneyRebuyChips = re.compile("Rebuy Chips: (?P<REBUY_CHIPS>\d+)")
|
re_TourneyRebuyChips = re.compile("Rebuy Chips: (?P<REBUY_CHIPS>\d+)")
|
||||||
re_TourneyAddOnChips = re.compile("Add-On Chips: (?P<ADDON_CHIPS>\d+)")
|
re_TourneyAddOnChips = re.compile("Add-On Chips: (?P<ADDON_CHIPS>\d+)")
|
||||||
re_TourneyKOBounty = re.compile("Knockout Bounty: (?P<KO_BOUNTY_CURRENCY>\$|)?(?P<KO_BOUNTY_AMOUNT>[.,0-9]+)")
|
re_TourneyKOBounty = re.compile("Knockout Bounty: (?P<KO_BOUNTY_CURRENCY>\$|)?(?P<KO_BOUNTY_AMOUNT>[.,0-9]+)")
|
||||||
re_TourneyCountKO = re.compile("received (?P<COUNT_KO>\d+) Knockout Bounty Award(s)?")
|
re_TourneyKoCount = re.compile("received (?P<COUNT_KO>\d+) Knockout Bounty Award(s)?")
|
||||||
re_TourneyTimeInfo = re.compile("Tournament started: (?P<STARTTIME>.*)\nTournament ((?P<IN_PROGRESS>is still in progress)?|(finished:(?P<ENDTIME>.*))?)$")
|
re_TourneyTimeInfo = re.compile("Tournament started: (?P<STARTTIME>.*)\nTournament ((?P<IN_PROGRESS>is still in progress)?|(finished:(?P<ENDTIME>.*))?)$")
|
||||||
|
|
||||||
re_TourneyPlayersSummary = re.compile("^(?P<RANK>(Still Playing|\d+))( - |: )(?P<PNAME>[^\n,]+)(, )?(?P<WINNING_CURRENCY>\$|)?(?P<WINNING>[.\d]+)?", re.MULTILINE)
|
re_TourneysPlayersSummary = re.compile("^(?P<RANK>(Still Playing|\d+))( - |: )(?P<PNAME>[^\n,]+)(, )?(?P<WINNING_CURRENCY>\$|)?(?P<WINNING>[.\d]+)?", re.MULTILINE)
|
||||||
re_TourneyHeroFinishingP = re.compile("(?P<HERO_NAME>.*) finished in (?P<HERO_FINISHING_POS>\d+)(st|nd|rd|th) place")
|
re_TourneyHeroFinishingP = re.compile("(?P<HERO_NAME>.*) finished in (?P<HERO_FINISHING_POS>\d+)(st|nd|rd|th) place")
|
||||||
|
|
||||||
#TODO: See if we need to deal with play money tourney summaries -- Not right now (they shouldn't pass the re_TourneyInfo)
|
#TODO: See if we need to deal with play money tourney summaries -- Not right now (they shouldn't pass the re_TourneyInfo)
|
||||||
|
@ -200,7 +201,7 @@ class Fulltilt(HandHistoryConverter):
|
||||||
return None
|
return None
|
||||||
hand.handid = m.group('HID')
|
hand.handid = m.group('HID')
|
||||||
hand.tablename = m.group('TABLE')
|
hand.tablename = m.group('TABLE')
|
||||||
hand.starttime = datetime.datetime.strptime(m.group('DATETIME'), "%H:%M:%S ET - %Y/%m/%d")
|
hand.startTime = datetime.datetime.strptime(m.group('DATETIME'), "%H:%M:%S ET - %Y/%m/%d")
|
||||||
|
|
||||||
if m.group("CANCELLED") or m.group("PARTIAL"):
|
if m.group("CANCELLED") or m.group("PARTIAL"):
|
||||||
raise FpdbParseError(hid=m.group('HID'))
|
raise FpdbParseError(hid=m.group('HID'))
|
||||||
|
@ -221,7 +222,14 @@ class Fulltilt(HandHistoryConverter):
|
||||||
else:
|
else:
|
||||||
hand.tourneyComment = n.group('TOURNEY_NAME') # can be None
|
hand.tourneyComment = n.group('TOURNEY_NAME') # can be None
|
||||||
if (n.group('CURRENCY') is not None and n.group('BUYIN') is not None and n.group('FEE') is not None):
|
if (n.group('CURRENCY') is not None and n.group('BUYIN') is not None and n.group('FEE') is not None):
|
||||||
hand.buyin = "%s%s+%s%s" %(n.group('CURRENCY'), n.group('BUYIN'), n.group('CURRENCY'), n.group('FEE'))
|
if n.group('CURRENCY')=="$":
|
||||||
|
hand.buyinCurrency="USD"
|
||||||
|
elif n.group('CURRENCY')==u"€":
|
||||||
|
hand.buyinCurrency="EUR"
|
||||||
|
else:
|
||||||
|
hand.buyinCurrency="NA"
|
||||||
|
hand.buyin = int(100*Decimal(n.group('BUYIN')))
|
||||||
|
hand.fee = int(100*Decimal(n.group('FEE')))
|
||||||
if n.group('TURBO') is not None :
|
if n.group('TURBO') is not None :
|
||||||
hand.speed = "Turbo"
|
hand.speed = "Turbo"
|
||||||
if n.group('SPECIAL') is not None :
|
if n.group('SPECIAL') is not None :
|
||||||
|
@ -231,7 +239,7 @@ class Fulltilt(HandHistoryConverter):
|
||||||
if special == "KO":
|
if special == "KO":
|
||||||
hand.isKO = True
|
hand.isKO = True
|
||||||
if special == "Head's Up":
|
if special == "Head's Up":
|
||||||
hand.isHU = True
|
hand.maxSeats = 2
|
||||||
if re.search("Matrix", special):
|
if re.search("Matrix", special):
|
||||||
hand.isMatrix = True
|
hand.isMatrix = True
|
||||||
if special == "Shootout":
|
if special == "Shootout":
|
||||||
|
@ -264,7 +272,7 @@ class Fulltilt(HandHistoryConverter):
|
||||||
if hand.gametype['type'] == "ring" :
|
if hand.gametype['type'] == "ring" :
|
||||||
m = self.re_PlayerInfo.finditer(pre)
|
m = self.re_PlayerInfo.finditer(pre)
|
||||||
else: #if hand.gametype['type'] == "tour"
|
else: #if hand.gametype['type'] == "tour"
|
||||||
m = self.re_TourneyPlayerInfo.finditer(pre)
|
m = self.re_TourneysPlayerInfo.finditer(pre)
|
||||||
|
|
||||||
for a in m:
|
for a in m:
|
||||||
hand.addPlayer(int(a.group('SEAT')), a.group('PNAME'), a.group('CASH'))
|
hand.addPlayer(int(a.group('SEAT')), a.group('PNAME'), a.group('CASH'))
|
||||||
|
@ -426,23 +434,23 @@ class Fulltilt(HandHistoryConverter):
|
||||||
def readSummaryInfo(self, summaryInfoList):
|
def readSummaryInfo(self, summaryInfoList):
|
||||||
self.status = True
|
self.status = True
|
||||||
|
|
||||||
m = re.search("Tournament Summary", summaryInfoList[0])
|
#m = re.search("Tournament Summary", summaryInfoList[0])
|
||||||
if m:
|
#if m:
|
||||||
# info list should be 2 lines : Tourney infos & Finsihing postions with winnings
|
# # info list should be 2 lines : Tourney infos & Finsihing postions with winnings
|
||||||
if (len(summaryInfoList) != 2 ):
|
# if (len(summaryInfoList) != 2 ):
|
||||||
log.info("Too many lines (%d) in file '%s' : '%s'" % (len(summaryInfoList), self.in_path, summaryInfoList) )
|
# log.info("Too many or too few lines (%d) in file '%s' : '%s'" % (len(summaryInfoList), self.in_path, summaryInfoList) )
|
||||||
self.status = False
|
# self.status = False
|
||||||
else:
|
# else:
|
||||||
self.tourney = Tourney.Tourney(sitename = self.sitename, gametype = None, summaryText = summaryInfoList, builtFrom = "HHC")
|
# self.tourney = TourneySummary.TourneySummary(sitename = self.sitename, gametype = None, summaryText = summaryInfoList, builtFrom = "HHC")
|
||||||
self.status = self.getPlayersPositionsAndWinnings(self.tourney)
|
# self.status = self.getPlayersPositionsAndWinnings(self.tourney)
|
||||||
if self.status == True :
|
# if self.status == True :
|
||||||
self.status = self.determineTourneyType(self.tourney)
|
# self.status = self.determineTourneyType(self.tourney)
|
||||||
#print self.tourney
|
# #print self.tourney
|
||||||
else:
|
# else:
|
||||||
log.info("Parsing NOK : rejected")
|
# log.info("Parsing NOK : rejected")
|
||||||
else:
|
#else:
|
||||||
log.info( "This is not a summary file : '%s'" % (self.in_path) )
|
# log.info( "This is not a summary file : '%s'" % (self.in_path) )
|
||||||
self.status = False
|
# self.status = False
|
||||||
|
|
||||||
return self.status
|
return self.status
|
||||||
|
|
||||||
|
@ -497,7 +505,6 @@ class Fulltilt(HandHistoryConverter):
|
||||||
if special == "KO":
|
if special == "KO":
|
||||||
tourney.isKO = True
|
tourney.isKO = True
|
||||||
if special == "Heads Up":
|
if special == "Heads Up":
|
||||||
tourney.isHU = True
|
|
||||||
tourney.maxseats = 2
|
tourney.maxseats = 2
|
||||||
if re.search("Matrix", special):
|
if re.search("Matrix", special):
|
||||||
tourney.isMatrix = True
|
tourney.isMatrix = True
|
||||||
|
@ -566,8 +573,8 @@ class Fulltilt(HandHistoryConverter):
|
||||||
dictRegex = { "BUYINCHIPS" : self.re_TourneyBuyInChips,
|
dictRegex = { "BUYINCHIPS" : self.re_TourneyBuyInChips,
|
||||||
"ENTRIES" : self.re_TourneyEntries,
|
"ENTRIES" : self.re_TourneyEntries,
|
||||||
"PRIZEPOOL" : self.re_TourneyPrizePool,
|
"PRIZEPOOL" : self.re_TourneyPrizePool,
|
||||||
"REBUY_AMOUNT" : self.re_TourneyRebuyAmount,
|
"REBUY_COST" : self.re_TourneyRebuyCost,
|
||||||
"ADDON_AMOUNT" : self.re_TourneyAddOnAmount,
|
"ADDON_COST" : self.re_TourneyAddOnCost,
|
||||||
"REBUY_TOTAL" : self.re_TourneyRebuysTotal,
|
"REBUY_TOTAL" : self.re_TourneyRebuysTotal,
|
||||||
"ADDONS_TOTAL" : self.re_TourneyAddOnsTotal,
|
"ADDONS_TOTAL" : self.re_TourneyAddOnsTotal,
|
||||||
"REBUY_CHIPS" : self.re_TourneyRebuyChips,
|
"REBUY_CHIPS" : self.re_TourneyRebuyChips,
|
||||||
|
@ -580,10 +587,10 @@ class Fulltilt(HandHistoryConverter):
|
||||||
dictHolders = { "BUYINCHIPS" : "buyInChips",
|
dictHolders = { "BUYINCHIPS" : "buyInChips",
|
||||||
"ENTRIES" : "entries",
|
"ENTRIES" : "entries",
|
||||||
"PRIZEPOOL" : "prizepool",
|
"PRIZEPOOL" : "prizepool",
|
||||||
"REBUY_AMOUNT" : "rebuyAmount",
|
"REBUY_COST" : "rebuyCost",
|
||||||
"ADDON_AMOUNT" : "addOnAmount",
|
"ADDON_COST" : "addOnCost",
|
||||||
"REBUY_TOTAL" : "totalRebuys",
|
"REBUY_TOTAL" : "totalRebuyCount",
|
||||||
"ADDONS_TOTAL" : "totalAddOns",
|
"ADDONS_TOTAL" : "totalAddOnCount",
|
||||||
"REBUY_CHIPS" : "rebuyChips",
|
"REBUY_CHIPS" : "rebuyChips",
|
||||||
"ADDON_CHIPS" : "addOnChips",
|
"ADDON_CHIPS" : "addOnChips",
|
||||||
"STARTTIME" : "starttime",
|
"STARTTIME" : "starttime",
|
||||||
|
@ -607,42 +614,39 @@ class Fulltilt(HandHistoryConverter):
|
||||||
if m is not None:
|
if m is not None:
|
||||||
mg = m.groupdict()
|
mg = m.groupdict()
|
||||||
if mg['REBUY_COUNT'] is not None :
|
if mg['REBUY_COUNT'] is not None :
|
||||||
tourney.countRebuys.update( { tourney.hero : Decimal(mg['REBUY_COUNT']) } )
|
tourney.rebuyCounts.update( { tourney.hero : Decimal(mg['REBUY_COUNT']) } )
|
||||||
m = self.re_TourneyAddOnCount.search(tourneyText)
|
m = self.re_TourneyAddOnCount.search(tourneyText)
|
||||||
if m is not None:
|
if m is not None:
|
||||||
mg = m.groupdict()
|
mg = m.groupdict()
|
||||||
if mg['ADDON_COUNT'] is not None :
|
if mg['ADDON_COUNT'] is not None :
|
||||||
tourney.countAddOns.update( { tourney.hero : Decimal(mg['ADDON_COUNT']) } )
|
tourney.addOnCounts.update( { tourney.hero : Decimal(mg['ADDON_COUNT']) } )
|
||||||
m = self.re_TourneyCountKO.search(tourneyText)
|
m = self.re_TourneyKoCount.search(tourneyText)
|
||||||
if m is not None:
|
if m is not None:
|
||||||
mg = m.groupdict()
|
mg = m.groupdict()
|
||||||
if mg['COUNT_KO'] is not None :
|
if mg['COUNT_KO'] is not None :
|
||||||
tourney.countKO.update( { tourney.hero : Decimal(mg['COUNT_KO']) } )
|
tourney.koCounts.update( { tourney.hero : Decimal(mg['COUNT_KO']) } )
|
||||||
|
|
||||||
# Deal with money amounts
|
# Deal with money amounts
|
||||||
tourney.koBounty = 100*Decimal(re.sub(u',', u'', "%s" % tourney.koBounty))
|
tourney.koBounty = 100*Decimal(re.sub(u',', u'', "%s" % tourney.koBounty))
|
||||||
tourney.prizepool = 100*Decimal(re.sub(u',', u'', "%s" % tourney.prizepool))
|
tourney.prizepool = 100*Decimal(re.sub(u',', u'', "%s" % tourney.prizepool))
|
||||||
tourney.rebuyAmount = 100*Decimal(re.sub(u',', u'', "%s" % tourney.rebuyAmount))
|
tourney.rebuyCost = 100*Decimal(re.sub(u',', u'', "%s" % tourney.rebuyCost))
|
||||||
tourney.addOnAmount = 100*Decimal(re.sub(u',', u'', "%s" % tourney.addOnAmount))
|
tourney.addOnCost = 100*Decimal(re.sub(u',', u'', "%s" % tourney.addOnCost))
|
||||||
|
|
||||||
# Calculate payin amounts and update winnings -- not possible to take into account nb of rebuys, addons or Knockouts for other players than hero on FTP
|
# Calculate payin amounts and update winnings -- not possible to take into account nb of rebuys, addons or Knockouts for other players than hero on FTP
|
||||||
for p in tourney.players :
|
for p in tourney.players :
|
||||||
tourney.payinAmounts[p] = tourney.buyin + tourney.fee + (tourney.rebuyAmount * tourney.countRebuys[p]) + (tourney.addOnAmount * tourney.countAddOns[p])
|
|
||||||
#print " player %s : payinAmount = %d" %( p, tourney.payinAmounts[p])
|
|
||||||
if tourney.isKO :
|
if tourney.isKO :
|
||||||
#tourney.incrementPlayerWinnings(tourney.players[p], Decimal(tourney.koBounty)*Decimal(tourney.countKO[p]))
|
#tourney.incrementPlayerWinnings(tourney.players[p], Decimal(tourney.koBounty)*Decimal(tourney.koCounts[p]))
|
||||||
tourney.winnings[p] += Decimal(tourney.koBounty)*Decimal(tourney.countKO[p])
|
tourney.winnings[p] += Decimal(tourney.koBounty)*Decimal(tourney.koCounts[p])
|
||||||
#print "player %s : winnings %d" % (p, tourney.winnings[p])
|
#print "player %s : winnings %d" % (p, tourney.winnings[p])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#print mg
|
#print mg
|
||||||
return True
|
return True
|
||||||
|
#end def determineTourneyType
|
||||||
|
|
||||||
def getPlayersPositionsAndWinnings(self, tourney):
|
def getPlayersPositionsAndWinnings(self, tourney):
|
||||||
playersText = tourney.summaryText[1]
|
playersText = tourney.summaryText[1]
|
||||||
#print "Examine : '%s'" %(playersText)
|
#print "Examine : '%s'" %(playersText)
|
||||||
m = self.re_TourneyPlayersSummary.finditer(playersText)
|
m = self.re_TourneysPlayersSummary.finditer(playersText)
|
||||||
|
|
||||||
for a in m:
|
for a in m:
|
||||||
if a.group('PNAME') is not None and a.group('RANK') is not None:
|
if a.group('PNAME') is not None and a.group('RANK') is not None:
|
||||||
|
@ -656,7 +660,7 @@ class Fulltilt(HandHistoryConverter):
|
||||||
else:
|
else:
|
||||||
winnings = "0"
|
winnings = "0"
|
||||||
|
|
||||||
tourney.addPlayer(rank, a.group('PNAME'), winnings, 0, 0, 0, 0)
|
tourney.addPlayer(rank, a.group('PNAME'), winnings, "USD", 0, 0, 0) #TODO: make it store actual winnings currency
|
||||||
else:
|
else:
|
||||||
print "FullTilt: Player finishing stats unreadable : %s" % a
|
print "FullTilt: Player finishing stats unreadable : %s" % a
|
||||||
|
|
||||||
|
@ -666,10 +670,10 @@ class Fulltilt(HandHistoryConverter):
|
||||||
heroName = n.group('HERO_NAME')
|
heroName = n.group('HERO_NAME')
|
||||||
tourney.hero = heroName
|
tourney.hero = heroName
|
||||||
# Is this really useful ?
|
# Is this really useful ?
|
||||||
if heroName not in tourney.finishPositions:
|
if heroName not in tourney.ranks:
|
||||||
print "FullTilt:", heroName, "not found in tourney.finishPositions ..."
|
print "FullTilt:", heroName, "not found in tourney.ranks ..."
|
||||||
elif (tourney.finishPositions[heroName] != Decimal(n.group('HERO_FINISHING_POS'))):
|
elif (tourney.ranks[heroName] != Decimal(n.group('HERO_FINISHING_POS'))):
|
||||||
print "FullTilt: Bad parsing : finish position incoherent : %s / %s" % (tourney.finishPositions[heroName], n.group('HERO_FINISHING_POS'))
|
print "FullTilt: Bad parsing : finish position incoherent : %s / %s" % (tourney.ranks[heroName], n.group('HERO_FINISHING_POS'))
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
#Copyright 2008 Steffen Jobbagy-Felso
|
#Copyright 2008-2010 Steffen Schaumburg
|
||||||
#This program is free software: you can redistribute it and/or modify
|
#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
|
#it under the terms of the GNU Affero General Public License as published by
|
||||||
#the Free Software Foundation, version 3 of the License.
|
#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
|
#You should have received a copy of the GNU Affero General Public License
|
||||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#In the "official" distribution you can find the license in
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
#agpl-3.0.txt in the docs folder of the package.
|
|
||||||
|
|
||||||
import threading
|
import threading
|
||||||
import subprocess
|
import subprocess
|
||||||
|
@ -32,11 +32,12 @@ import Configuration
|
||||||
import string
|
import string
|
||||||
|
|
||||||
class GuiAutoImport (threading.Thread):
|
class GuiAutoImport (threading.Thread):
|
||||||
def __init__(self, settings, config, sql):
|
def __init__(self, settings, config, sql, parent):
|
||||||
self.importtimer = 0
|
self.importtimer = 0
|
||||||
self.settings = settings
|
self.settings = settings
|
||||||
self.config = config
|
self.config = config
|
||||||
self.sql = sql
|
self.sql = sql
|
||||||
|
self.parent = parent
|
||||||
|
|
||||||
imp = self.config.get_import_parameters()
|
imp = self.config.get_import_parameters()
|
||||||
|
|
||||||
|
@ -138,6 +139,8 @@ class GuiAutoImport (threading.Thread):
|
||||||
#dia_chooser.set_current_folder(pathname)
|
#dia_chooser.set_current_folder(pathname)
|
||||||
dia_chooser.set_filename(current_path)
|
dia_chooser.set_filename(current_path)
|
||||||
#dia_chooser.set_select_multiple(select_multiple) #not in tv, but want this in bulk import
|
#dia_chooser.set_select_multiple(select_multiple) #not in tv, but want this in bulk import
|
||||||
|
dia_chooser.set_destroy_with_parent(True)
|
||||||
|
dia_chooser.set_transient_for(self.parent)
|
||||||
|
|
||||||
response = dia_chooser.run()
|
response = dia_chooser.run()
|
||||||
if response == gtk.RESPONSE_OK:
|
if response == gtk.RESPONSE_OK:
|
||||||
|
@ -199,10 +202,10 @@ class GuiAutoImport (threading.Thread):
|
||||||
bs = 0
|
bs = 0
|
||||||
elif os.name == 'nt':
|
elif os.name == 'nt':
|
||||||
path = sys.path[0].replace('\\','\\\\')
|
path = sys.path[0].replace('\\','\\\\')
|
||||||
command = 'python "'+path+'\\HUD_main.py" ' + self.settings['cl_options']
|
command = 'pythonw "'+path+'\\HUD_main.pyw" ' + self.settings['cl_options']
|
||||||
bs = 0
|
bs = 0
|
||||||
else:
|
else:
|
||||||
command = os.path.join(sys.path[0], 'HUD_main.py')
|
command = os.path.join(sys.path[0], 'HUD_main.pyw')
|
||||||
command = [command, ] + string.split(self.settings['cl_options'])
|
command = [command, ] + string.split(self.settings['cl_options'])
|
||||||
bs = 1
|
bs = 1
|
||||||
|
|
||||||
|
@ -210,7 +213,12 @@ class GuiAutoImport (threading.Thread):
|
||||||
print "opening pipe to HUD"
|
print "opening pipe to HUD"
|
||||||
self.pipe_to_hud = subprocess.Popen(command, bufsize=bs,
|
self.pipe_to_hud = subprocess.Popen(command, bufsize=bs,
|
||||||
stdin=subprocess.PIPE,
|
stdin=subprocess.PIPE,
|
||||||
universal_newlines=True)
|
stdout=subprocess.PIPE, # only needed for py2exe
|
||||||
|
stderr=subprocess.PIPE, # only needed for py2exe
|
||||||
|
universal_newlines=True
|
||||||
|
)
|
||||||
|
#self.pipe_to_hud.stdout.close()
|
||||||
|
#self.pipe_to_hud.stderr.close()
|
||||||
except:
|
except:
|
||||||
err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
||||||
#self.addText( "\n*** GuiAutoImport Error opening pipe: " + err[2] + "(" + str(err[1]) + "): " + str(sys.exc_info()[1]))
|
#self.addText( "\n*** GuiAutoImport Error opening pipe: " + err[2] + "(" + str(err[1]) + "): " + str(sys.exc_info()[1]))
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Copyright 2008 Steffen Jobbagy-Felso
|
#Copyright 2008-2010 Steffen Schaumburg
|
||||||
#This program is free software: you can redistribute it and/or modify
|
#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
|
#it under the terms of the GNU Affero General Public License as published by
|
||||||
#the Free Software Foundation, version 3 of the License.
|
#the Free Software Foundation, version 3 of the License.
|
||||||
|
@ -13,8 +13,7 @@
|
||||||
#
|
#
|
||||||
#You should have received a copy of the GNU Affero General Public License
|
#You should have received a copy of the GNU Affero General Public License
|
||||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# In the "official" distribution you can find the license in
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
# agpl-3.0.txt in the docs folder of the package.
|
|
||||||
|
|
||||||
# Standard Library modules
|
# Standard Library modules
|
||||||
import os
|
import os
|
||||||
|
@ -51,7 +50,7 @@ class GuiBulkImport():
|
||||||
ttime = None
|
ttime = None
|
||||||
# Does the lock acquisition need to be more sophisticated for multiple dirs?
|
# Does the lock acquisition need to be more sophisticated for multiple dirs?
|
||||||
# (see comment above about what to do if pipe already open)
|
# (see comment above about what to do if pipe already open)
|
||||||
if self.settings['global_lock'].acquire(False): # returns false immediately if lock not acquired
|
if self.settings['global_lock'].acquire(wait=False, source="GuiBulkImport"): # returns false immediately if lock not acquired
|
||||||
#try:
|
#try:
|
||||||
print "\nGlobal lock taken ..."
|
print "\nGlobal lock taken ..."
|
||||||
self.progressbar.set_text("Importing...")
|
self.progressbar.set_text("Importing...")
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
#Copyright 2008 Carl Gherardi
|
#Copyright 2008-2010 Carl Gherardi
|
||||||
#This program is free software: you can redistribute it and/or modify
|
#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
|
#it under the terms of the GNU Affero General Public License as published by
|
||||||
#the Free Software Foundation, version 3 of the License.
|
#the Free Software Foundation, version 3 of the License.
|
||||||
|
@ -13,9 +13,7 @@
|
||||||
#
|
#
|
||||||
#You should have received a copy of the GNU Affero General Public License
|
#You should have received a copy of the GNU Affero General Public License
|
||||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#In the "official" distribution you can find the license in
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
#agpl-3.0.txt in the docs folder of the package.
|
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
#Copyright 2008 Steffen Jobbagy-Felso
|
#Copyright 2008-2010 Steffen Schaumburg
|
||||||
#This program is free software: you can redistribute it and/or modify
|
#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
|
#it under the terms of the GNU Affero General Public License as published by
|
||||||
#the Free Software Foundation, version 3 of the License.
|
#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
|
#You should have received a copy of the GNU Affero General Public License
|
||||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#In the "official" distribution you can find the license in
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
#agpl-3.0.txt in the docs folder of the package.
|
|
||||||
|
|
||||||
import threading
|
import threading
|
||||||
import pygtk
|
import pygtk
|
||||||
|
@ -23,6 +23,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
from time import *
|
from time import *
|
||||||
|
from datetime import datetime
|
||||||
#import pokereval
|
#import pokereval
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -43,16 +44,17 @@ except ImportError, inst:
|
||||||
|
|
||||||
import fpdb_import
|
import fpdb_import
|
||||||
import Database
|
import Database
|
||||||
import Filters
|
import RingFilters
|
||||||
import Charset
|
import Charset
|
||||||
|
|
||||||
class GuiGraphViewer (threading.Thread):
|
class GuiGraphViewer (threading.Thread):
|
||||||
|
|
||||||
def __init__(self, querylist, config, debug=True):
|
def __init__(self, querylist, config, parent, debug=True):
|
||||||
"""Constructor for GraphViewer"""
|
"""Constructor for GraphViewer"""
|
||||||
self.sql = querylist
|
self.sql = querylist
|
||||||
self.conf = config
|
self.conf = config
|
||||||
self.debug = debug
|
self.debug = debug
|
||||||
|
self.parent = parent
|
||||||
#print "start of GraphViewer constructor"
|
#print "start of GraphViewer constructor"
|
||||||
self.db = Database.Database(self.conf, sql=self.sql)
|
self.db = Database.Database(self.conf, sql=self.sql)
|
||||||
|
|
||||||
|
@ -73,7 +75,7 @@ class GuiGraphViewer (threading.Thread):
|
||||||
"Button2" : True
|
"Button2" : True
|
||||||
}
|
}
|
||||||
|
|
||||||
self.filters = Filters.Filters(self.db, self.conf, self.sql, display = filters_display)
|
self.filters = RingFilters.RingFilters(self.db, self.conf, self.sql, display = filters_display)
|
||||||
self.filters.registerButton1Name("Refresh _Graph")
|
self.filters.registerButton1Name("Refresh _Graph")
|
||||||
self.filters.registerButton1Callback(self.generateGraph)
|
self.filters.registerButton1Callback(self.generateGraph)
|
||||||
self.filters.registerButton2Name("_Export to File")
|
self.filters.registerButton2Name("_Export to File")
|
||||||
|
@ -228,9 +230,9 @@ class GuiGraphViewer (threading.Thread):
|
||||||
self.ax.plot(blue, color='blue', label='Showdown: $%.2f' %(blue[-1]))
|
self.ax.plot(blue, color='blue', label='Showdown: $%.2f' %(blue[-1]))
|
||||||
self.ax.plot(red, color='red', label='Non-showdown: $%.2f' %(red[-1]))
|
self.ax.plot(red, color='red', label='Non-showdown: $%.2f' %(red[-1]))
|
||||||
if sys.version[0:3] == '2.5':
|
if sys.version[0:3] == '2.5':
|
||||||
self.ax.legend(loc='best', shadow=True, prop=FontProperties(size='smaller'))
|
self.ax.legend(loc='upper left', shadow=True, prop=FontProperties(size='smaller'))
|
||||||
else:
|
else:
|
||||||
self.ax.legend(loc='best', fancybox=True, shadow=True, prop=FontProperties(size='smaller'))
|
self.ax.legend(loc='upper left', fancybox=True, shadow=True, prop=FontProperties(size='smaller'))
|
||||||
|
|
||||||
self.graphBox.add(self.canvas)
|
self.graphBox.add(self.canvas)
|
||||||
self.canvas.show()
|
self.canvas.show()
|
||||||
|
@ -334,21 +336,41 @@ class GuiGraphViewer (threading.Thread):
|
||||||
def exportGraph (self, widget, data):
|
def exportGraph (self, widget, data):
|
||||||
if self.fig is None:
|
if self.fig is None:
|
||||||
return # Might want to disable export button until something has been generated.
|
return # Might want to disable export button until something has been generated.
|
||||||
|
|
||||||
dia_chooser = gtk.FileChooserDialog(title="Please choose the directory you wish to export to:",
|
dia_chooser = gtk.FileChooserDialog(title="Please choose the directory you wish to export to:",
|
||||||
action=gtk.FILE_CHOOSER_ACTION_OPEN,
|
action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
|
||||||
buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))
|
buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OK,gtk.RESPONSE_OK))
|
||||||
#TODO: Suggest path and filename to start with
|
dia_chooser.set_destroy_with_parent(True)
|
||||||
|
dia_chooser.set_transient_for(self.parent)
|
||||||
|
try:
|
||||||
|
dia_chooser.set_filename(self.exportFile) # use previously chosen export path as default
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
response = dia_chooser.run()
|
response = dia_chooser.run()
|
||||||
if response == gtk.RESPONSE_OK:
|
|
||||||
self.exportDir = dia_chooser.get_filename()
|
if response <> gtk.RESPONSE_OK:
|
||||||
print "DEBUG: self.exportDir = %s" %(self.exportDir)
|
|
||||||
elif response == gtk.RESPONSE_CANCEL:
|
|
||||||
print 'Closed, no graph exported'
|
print 'Closed, no graph exported'
|
||||||
dia_chooser.destroy()
|
dia_chooser.destroy()
|
||||||
#TODO: Check to see if file exists
|
return
|
||||||
#NOTE: Dangerous - will happily overwrite any file we have write access too
|
|
||||||
#TODO: This asks for a directory but will take a filename and overwrite it.
|
|
||||||
self.fig.savefig(self.exportDir, format="png")
|
|
||||||
|
|
||||||
|
# generate a unique filename for export
|
||||||
|
now = datetime.now()
|
||||||
|
now_formatted = now.strftime("%Y%m%d%H%M%S")
|
||||||
|
self.exportFile = dia_chooser.get_filename() + "/fpdb" + now_formatted + ".png"
|
||||||
|
dia_chooser.destroy()
|
||||||
|
|
||||||
|
#print "DEBUG: self.exportFile = %s" %(self.exportFile)
|
||||||
|
self.fig.savefig(self.exportFile, format="png")
|
||||||
|
|
||||||
|
#display info box to confirm graph created
|
||||||
|
diainfo = gtk.MessageDialog(parent=self.parent,
|
||||||
|
flags=gtk.DIALOG_DESTROY_WITH_PARENT,
|
||||||
|
type=gtk.MESSAGE_INFO,
|
||||||
|
buttons=gtk.BUTTONS_OK,
|
||||||
|
message_format="Graph created")
|
||||||
|
diainfo.format_secondary_text(self.exportFile)
|
||||||
|
diainfo.run()
|
||||||
|
diainfo.destroy()
|
||||||
|
|
||||||
|
#end of def exportGraph
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
#Copyright 2008 Carl Gherardi
|
#Copyright 2008-2010 Carl Gherardi
|
||||||
#This program is free software: you can redistribute it and/or modify
|
#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
|
#it under the terms of the GNU Affero General Public License as published by
|
||||||
#the Free Software Foundation, version 3 of the License.
|
#the Free Software Foundation, version 3 of the License.
|
||||||
|
@ -13,9 +13,7 @@
|
||||||
#
|
#
|
||||||
#You should have received a copy of the GNU Affero General Public License
|
#You should have received a copy of the GNU Affero General Public License
|
||||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#In the "official" distribution you can find the license in
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
#agpl-3.0.txt in the docs folder of the package.
|
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import Queue
|
import Queue
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/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
|
#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
|
#it under the terms of the GNU Affero General Public License as published by
|
||||||
#the Free Software Foundation, version 3 of the License.
|
#the Free Software Foundation, version 3 of the License.
|
||||||
|
@ -12,662 +13,10 @@
|
||||||
#
|
#
|
||||||
#You should have received a copy of the GNU Affero General Public License
|
#You should have received a copy of the GNU Affero General Public License
|
||||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#In the "official" distribution you can find the license in
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
#agpl-3.0.txt in the docs folder of the package.
|
|
||||||
|
|
||||||
import traceback
|
|
||||||
import threading
|
import threading
|
||||||
import pygtk
|
|
||||||
pygtk.require('2.0')
|
|
||||||
import gtk
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
from time import time, strftime
|
|
||||||
|
|
||||||
import Card
|
|
||||||
import fpdb_import
|
|
||||||
import Database
|
|
||||||
import Filters
|
|
||||||
import Charset
|
|
||||||
|
|
||||||
colalias,colshow,colheading,colxalign,colformat,coltype = 0,1,2,3,4,5
|
|
||||||
ranks = {'x':0, '2':2, '3':3, '4':4, '5':5, '6':6, '7':7, '8':8, '9':9, 'T':10, 'J':11, 'Q':12, 'K':13, 'A':14}
|
|
||||||
|
|
||||||
class GuiPlayerStats(threading.Thread):
|
class GuiPlayerStats(threading.Thread):
|
||||||
|
pass
|
||||||
def __init__(self, config, querylist, mainwin, debug=True):
|
#end class GuiPlayerStats
|
||||||
self.debug = debug
|
|
||||||
self.conf = config
|
|
||||||
self.main_window = mainwin
|
|
||||||
self.sql = querylist
|
|
||||||
|
|
||||||
self.liststore = [] # gtk.ListStore[] stores the contents of the grids
|
|
||||||
self.listcols = [] # gtk.TreeViewColumn[][] stores the columns in the grids
|
|
||||||
|
|
||||||
self.MYSQL_INNODB = 2
|
|
||||||
self.PGSQL = 3
|
|
||||||
self.SQLITE = 4
|
|
||||||
|
|
||||||
# create new db connection to avoid conflicts with other threads
|
|
||||||
self.db = Database.Database(self.conf, sql=self.sql)
|
|
||||||
self.cursor = self.db.cursor
|
|
||||||
|
|
||||||
settings = {}
|
|
||||||
settings.update(self.conf.get_db_parameters())
|
|
||||||
settings.update(self.conf.get_tv_parameters())
|
|
||||||
settings.update(self.conf.get_import_parameters())
|
|
||||||
settings.update(self.conf.get_default_paths())
|
|
||||||
|
|
||||||
# text used on screen stored here so that it can be configured
|
|
||||||
self.filterText = {'handhead':'Hand Breakdown for all levels listed above'
|
|
||||||
}
|
|
||||||
|
|
||||||
filters_display = { "Heroes" : True,
|
|
||||||
"Sites" : True,
|
|
||||||
"Games" : True,
|
|
||||||
"Limits" : True,
|
|
||||||
"LimitSep" : True,
|
|
||||||
"LimitType" : True,
|
|
||||||
"Type" : True,
|
|
||||||
"Seats" : True,
|
|
||||||
"SeatSep" : True,
|
|
||||||
"Dates" : True,
|
|
||||||
"Groups" : True,
|
|
||||||
"GroupsAll" : True,
|
|
||||||
"Button1" : True,
|
|
||||||
"Button2" : True
|
|
||||||
}
|
|
||||||
|
|
||||||
self.filters = Filters.Filters(self.db, self.conf, self.sql, display = filters_display)
|
|
||||||
self.filters.registerButton1Name("_Filters")
|
|
||||||
self.filters.registerButton1Callback(self.showDetailFilter)
|
|
||||||
self.filters.registerButton2Name("_Refresh Stats")
|
|
||||||
self.filters.registerButton2Callback(self.refreshStats)
|
|
||||||
|
|
||||||
# ToDo: store in config
|
|
||||||
# ToDo: create popup to adjust column config
|
|
||||||
# columns to display, keys match column name returned by sql, values in tuple are:
|
|
||||||
# is column displayed, column heading, xalignment, formatting, celltype
|
|
||||||
self.columns = [ ["game", True, "Game", 0.0, "%s", "str"]
|
|
||||||
, ["hand", False, "Hand", 0.0, "%s", "str"] # true not allowed for this line
|
|
||||||
, ["plposition", False, "Posn", 1.0, "%s", "str"] # true not allowed for this line (set in code)
|
|
||||||
, ["pname", False, "Name", 0.0, "%s", "str"] # true not allowed for this line (set in code)
|
|
||||||
, ["n", True, "Hds", 1.0, "%1.0f", "str"]
|
|
||||||
, ["avgseats", False, "Seats", 1.0, "%3.1f", "str"]
|
|
||||||
, ["vpip", True, "VPIP", 1.0, "%3.1f", "str"]
|
|
||||||
, ["pfr", True, "PFR", 1.0, "%3.1f", "str"]
|
|
||||||
, ["pf3", True, "PF3", 1.0, "%3.1f", "str"]
|
|
||||||
, ["steals", True, "Steals", 1.0, "%3.1f", "str"]
|
|
||||||
, ["saw_f", True, "Saw_F", 1.0, "%3.1f", "str"]
|
|
||||||
, ["sawsd", True, "SawSD", 1.0, "%3.1f", "str"]
|
|
||||||
, ["wtsdwsf", True, "WtSDwsF", 1.0, "%3.1f", "str"]
|
|
||||||
, ["wmsd", True, "W$SD", 1.0, "%3.1f", "str"]
|
|
||||||
, ["flafq", True, "FlAFq", 1.0, "%3.1f", "str"]
|
|
||||||
, ["tuafq", True, "TuAFq", 1.0, "%3.1f", "str"]
|
|
||||||
, ["rvafq", True, "RvAFq", 1.0, "%3.1f", "str"]
|
|
||||||
, ["pofafq", False, "PoFAFq", 1.0, "%3.1f", "str"]
|
|
||||||
, ["net", True, "Net($)", 1.0, "%6.2f", "cash"]
|
|
||||||
, ["bbper100", True, "bb/100", 1.0, "%4.2f", "str"]
|
|
||||||
, ["rake", True, "Rake($)", 1.0, "%6.2f", "cash"]
|
|
||||||
, ["bb100xr", True, "bbxr/100", 1.0, "%4.2f", "str"]
|
|
||||||
, ["variance", True, "Variance", 1.0, "%5.2f", "str"]
|
|
||||||
]
|
|
||||||
|
|
||||||
# Detail filters: This holds the data used in the popup window, extra values are
|
|
||||||
# added at the end of these lists during processing
|
|
||||||
# sql test, screen description, min, max
|
|
||||||
self.handtests = [ # already in filter class : ['h.seats', 'Number of Players', 2, 10]
|
|
||||||
['h.maxSeats', 'Size of Table', 2, 10]
|
|
||||||
,['h.playersVpi', 'Players who VPI', 0, 10]
|
|
||||||
,['h.playersAtStreet1', 'Players at Flop', 0, 10]
|
|
||||||
,['h.playersAtStreet2', 'Players at Turn', 0, 10]
|
|
||||||
,['h.playersAtStreet3', 'Players at River', 0, 10]
|
|
||||||
,['h.playersAtStreet4', 'Players at Street7', 0, 10]
|
|
||||||
,['h.playersAtShowdown', 'Players at Showdown', 0, 10]
|
|
||||||
,['h.street0Raises', 'Bets to See Flop', 0, 5]
|
|
||||||
,['h.street1Raises', 'Bets to See Turn', 0, 5]
|
|
||||||
,['h.street2Raises', 'Bets to See River', 0, 5]
|
|
||||||
,['h.street3Raises', 'Bets to See Street7', 0, 5]
|
|
||||||
,['h.street4Raises', 'Bets to See Showdown', 0, 5]
|
|
||||||
]
|
|
||||||
|
|
||||||
self.stats_frame = None
|
|
||||||
self.stats_vbox = None
|
|
||||||
self.detailFilters = [] # the data used to enhance the sql select
|
|
||||||
|
|
||||||
#self.main_hbox = gtk.HBox(False, 0)
|
|
||||||
#self.main_hbox.show()
|
|
||||||
self.main_hbox = gtk.HPaned()
|
|
||||||
|
|
||||||
self.stats_frame = gtk.Frame()
|
|
||||||
self.stats_frame.show()
|
|
||||||
|
|
||||||
self.stats_vbox = gtk.VPaned()
|
|
||||||
self.stats_vbox.show()
|
|
||||||
self.stats_frame.add(self.stats_vbox)
|
|
||||||
# self.fillStatsFrame(self.stats_vbox)
|
|
||||||
|
|
||||||
#self.main_hbox.pack_start(self.filters.get_vbox())
|
|
||||||
#self.main_hbox.pack_start(self.stats_frame, expand=True, fill=True)
|
|
||||||
self.main_hbox.pack1(self.filters.get_vbox())
|
|
||||||
self.main_hbox.pack2(self.stats_frame)
|
|
||||||
self.main_hbox.show()
|
|
||||||
|
|
||||||
# make sure Hand column is not displayed
|
|
||||||
[x for x in self.columns if x[0] == 'hand'][0][1] = False
|
|
||||||
self.last_pos = -1
|
|
||||||
|
|
||||||
|
|
||||||
def get_vbox(self):
|
|
||||||
"""returns the vbox of this thread"""
|
|
||||||
return self.main_hbox
|
|
||||||
|
|
||||||
def refreshStats(self, widget, data):
|
|
||||||
self.last_pos = self.stats_vbox.get_position()
|
|
||||||
try: self.stats_vbox.destroy()
|
|
||||||
except AttributeError: pass
|
|
||||||
self.liststore = []
|
|
||||||
self.listcols = []
|
|
||||||
#self.stats_vbox = gtk.VBox(False, 0)
|
|
||||||
self.stats_vbox = gtk.VPaned()
|
|
||||||
self.stats_vbox.show()
|
|
||||||
self.stats_frame.add(self.stats_vbox)
|
|
||||||
self.fillStatsFrame(self.stats_vbox)
|
|
||||||
if self.last_pos > 0:
|
|
||||||
self.stats_vbox.set_position(self.last_pos)
|
|
||||||
|
|
||||||
def fillStatsFrame(self, vbox):
|
|
||||||
sites = self.filters.getSites()
|
|
||||||
heroes = self.filters.getHeroes()
|
|
||||||
siteids = self.filters.getSiteIds()
|
|
||||||
limits = self.filters.getLimits()
|
|
||||||
type = self.filters.getType()
|
|
||||||
seats = self.filters.getSeats()
|
|
||||||
groups = self.filters.getGroups()
|
|
||||||
dates = self.filters.getDates()
|
|
||||||
games = self.filters.getGames()
|
|
||||||
sitenos = []
|
|
||||||
playerids = []
|
|
||||||
|
|
||||||
# Which sites are selected?
|
|
||||||
for site in sites:
|
|
||||||
if sites[site] == True:
|
|
||||||
sitenos.append(siteids[site])
|
|
||||||
_hname = Charset.to_utf8(heroes[site])
|
|
||||||
result = self.db.get_player_id(self.conf, site, _hname)
|
|
||||||
if result is not None:
|
|
||||||
playerids.append(int(result))
|
|
||||||
|
|
||||||
if not sitenos:
|
|
||||||
#Should probably pop up here.
|
|
||||||
print "No sites selected - defaulting to PokerStars"
|
|
||||||
sitenos = [2]
|
|
||||||
if not playerids:
|
|
||||||
print "No player ids found"
|
|
||||||
return
|
|
||||||
if not limits:
|
|
||||||
print "No limits found"
|
|
||||||
return
|
|
||||||
|
|
||||||
self.createStatsTable(vbox, playerids, sitenos, limits, type, seats, groups, dates, games)
|
|
||||||
|
|
||||||
def createStatsTable(self, vbox, playerids, sitenos, limits, type, seats, groups, dates, games):
|
|
||||||
starttime = time()
|
|
||||||
show_detail = True
|
|
||||||
|
|
||||||
# Scrolled window for summary table
|
|
||||||
swin = gtk.ScrolledWindow(hadjustment=None, vadjustment=None)
|
|
||||||
swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
|
||||||
swin.show()
|
|
||||||
vbox.pack1(swin)
|
|
||||||
|
|
||||||
# Display summary table at top of page
|
|
||||||
# 3rd parameter passes extra flags, currently includes:
|
|
||||||
# holecards - whether to display card breakdown (True/False)
|
|
||||||
# numhands - min number hands required when displaying all players
|
|
||||||
# gridnum - index for grid data structures
|
|
||||||
flags = [False, self.filters.getNumHands(), 0]
|
|
||||||
self.addGrid(swin, 'playerDetailedStats', flags, playerids
|
|
||||||
,sitenos, limits, type, seats, groups, dates, games)
|
|
||||||
|
|
||||||
if 'allplayers' in groups and groups['allplayers']:
|
|
||||||
# can't currently do this combination so skip detailed table
|
|
||||||
show_detail = False
|
|
||||||
|
|
||||||
if show_detail:
|
|
||||||
# Separator
|
|
||||||
vbox2 = gtk.VBox(False, 0)
|
|
||||||
heading = gtk.Label(self.filterText['handhead'])
|
|
||||||
heading.show()
|
|
||||||
vbox2.pack_start(heading, expand=False, padding=3)
|
|
||||||
|
|
||||||
# Scrolled window for detailed table (display by hand)
|
|
||||||
swin = gtk.ScrolledWindow(hadjustment=None, vadjustment=None)
|
|
||||||
swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
|
||||||
swin.show()
|
|
||||||
vbox2.pack_start(swin, expand=True, padding=3)
|
|
||||||
vbox.pack2(vbox2)
|
|
||||||
vbox2.show()
|
|
||||||
|
|
||||||
# Detailed table
|
|
||||||
flags[0] = True
|
|
||||||
flags[2] = 1
|
|
||||||
self.addGrid(swin, 'playerDetailedStats', flags, playerids
|
|
||||||
,sitenos, limits, type, seats, groups, dates, games)
|
|
||||||
|
|
||||||
self.db.rollback()
|
|
||||||
print "Stats page displayed in %4.2f seconds" % (time() - starttime)
|
|
||||||
#end def fillStatsFrame(self, vbox):
|
|
||||||
|
|
||||||
def reset_style_render_func(self, treeviewcolumn, cell, model, iter):
|
|
||||||
cell.set_property('foreground', 'black')
|
|
||||||
|
|
||||||
def ledger_style_render_func(self, tvcol, cell, model, iter):
|
|
||||||
str = cell.get_property('text')
|
|
||||||
if '-' in str:
|
|
||||||
str = str.replace("-", "")
|
|
||||||
str = "(%s)" %(str)
|
|
||||||
cell.set_property('text', str)
|
|
||||||
cell.set_property('foreground', 'red')
|
|
||||||
else:
|
|
||||||
cell.set_property('foreground', 'darkgreen')
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
def sortnums(self, model, iter1, iter2, nums):
|
|
||||||
try:
|
|
||||||
ret = 0
|
|
||||||
(n, grid) = nums
|
|
||||||
a = self.liststore[grid].get_value(iter1, n)
|
|
||||||
b = self.liststore[grid].get_value(iter2, n)
|
|
||||||
if 'f' in self.cols_to_show[n][4]:
|
|
||||||
try: a = float(a)
|
|
||||||
except: a = 0.0
|
|
||||||
try: b = float(b)
|
|
||||||
except: b = 0.0
|
|
||||||
if n == 0 and grid == 1: #make sure it only works on the starting hands
|
|
||||||
a1,a2,a3 = ranks[a[0]], ranks[a[1]], (a+'o')[2]
|
|
||||||
b1,b2,b3 = ranks[b[0]], ranks[b[1]], (b+'o')[2]
|
|
||||||
if a1 > b1 or ( a1 == b1 and (a2 > b2 or (a2 == b2 and a3 > b3) ) ):
|
|
||||||
ret = 1
|
|
||||||
else:
|
|
||||||
ret = -1
|
|
||||||
else:
|
|
||||||
if a < b:
|
|
||||||
ret = -1
|
|
||||||
elif a == b:
|
|
||||||
ret = 0
|
|
||||||
else:
|
|
||||||
ret = 1
|
|
||||||
#print "n =", n, "iter1[n] =", self.liststore[grid].get_value(iter1,n), "iter2[n] =", self.liststore[grid].get_value(iter2,n), "ret =", ret
|
|
||||||
except:
|
|
||||||
err = traceback.extract_tb(sys.exc_info()[2])
|
|
||||||
print "***sortnums error: " + str(sys.exc_info()[1])
|
|
||||||
print "\n".join( [e[0]+':'+str(e[1])+" "+e[2] for e in err] )
|
|
||||||
|
|
||||||
return(ret)
|
|
||||||
|
|
||||||
def sortcols(self, col, nums):
|
|
||||||
try:
|
|
||||||
#This doesn't actually work yet - clicking heading in top section sorts bottom section :-(
|
|
||||||
(n, grid) = nums
|
|
||||||
if not col.get_sort_indicator() or col.get_sort_order() == gtk.SORT_ASCENDING:
|
|
||||||
col.set_sort_order(gtk.SORT_DESCENDING)
|
|
||||||
else:
|
|
||||||
col.set_sort_order(gtk.SORT_ASCENDING)
|
|
||||||
self.liststore[grid].set_sort_column_id(n, col.get_sort_order())
|
|
||||||
self.liststore[grid].set_sort_func(n, self.sortnums, (n,grid))
|
|
||||||
for i in xrange(len(self.listcols[grid])):
|
|
||||||
self.listcols[grid][i].set_sort_indicator(False)
|
|
||||||
self.listcols[grid][n].set_sort_indicator(True)
|
|
||||||
# use this listcols[col].set_sort_indicator(True)
|
|
||||||
# to turn indicator off for other cols
|
|
||||||
except:
|
|
||||||
err = traceback.extract_tb(sys.exc_info()[2])
|
|
||||||
print "***sortcols error: " + str(sys.exc_info()[1])
|
|
||||||
print "\n".join( [e[0]+':'+str(e[1])+" "+e[2] for e in err] )
|
|
||||||
|
|
||||||
def addGrid(self, vbox, query, flags, playerids, sitenos, limits, type, seats, groups, dates, games):
|
|
||||||
counter = 0
|
|
||||||
row = 0
|
|
||||||
sqlrow = 0
|
|
||||||
if not flags: holecards,grid = False,0
|
|
||||||
else: holecards,grid = flags[0],flags[2]
|
|
||||||
|
|
||||||
tmp = self.sql.query[query]
|
|
||||||
tmp = self.refineQuery(tmp, flags, playerids, sitenos, limits, type, seats, groups, dates, games)
|
|
||||||
self.cursor.execute(tmp)
|
|
||||||
result = self.cursor.fetchall()
|
|
||||||
colnames = [desc[0].lower() for desc in self.cursor.description]
|
|
||||||
|
|
||||||
# pre-fetch some constant values:
|
|
||||||
self.cols_to_show = [x for x in self.columns if x[colshow]]
|
|
||||||
hgametypeid_idx = colnames.index('hgametypeid')
|
|
||||||
|
|
||||||
assert len(self.liststore) == grid, "len(self.liststore)="+str(len(self.liststore))+" grid-1="+str(grid)
|
|
||||||
self.liststore.append( gtk.ListStore(*([str] * len(self.cols_to_show))) )
|
|
||||||
view = gtk.TreeView(model=self.liststore[grid])
|
|
||||||
view.set_grid_lines(gtk.TREE_VIEW_GRID_LINES_BOTH)
|
|
||||||
#vbox.pack_start(view, expand=False, padding=3)
|
|
||||||
vbox.add(view)
|
|
||||||
textcell = gtk.CellRendererText()
|
|
||||||
textcell50 = gtk.CellRendererText()
|
|
||||||
textcell50.set_property('xalign', 0.5)
|
|
||||||
numcell = gtk.CellRendererText()
|
|
||||||
numcell.set_property('xalign', 1.0)
|
|
||||||
assert len(self.listcols) == grid
|
|
||||||
self.listcols.append( [] )
|
|
||||||
|
|
||||||
# Create header row eg column: ("game", True, "Game", 0.0, "%s")
|
|
||||||
for col, column in enumerate(self.cols_to_show):
|
|
||||||
if column[colalias] == 'game' and holecards:
|
|
||||||
s = [x for x in self.columns if x[colalias] == 'hand'][0][colheading]
|
|
||||||
else:
|
|
||||||
s = column[colheading]
|
|
||||||
self.listcols[grid].append(gtk.TreeViewColumn(s))
|
|
||||||
view.append_column(self.listcols[grid][col])
|
|
||||||
if column[colformat] == '%s':
|
|
||||||
if column[colxalign] == 0.0:
|
|
||||||
self.listcols[grid][col].pack_start(textcell, expand=True)
|
|
||||||
self.listcols[grid][col].add_attribute(textcell, 'text', col)
|
|
||||||
cellrend = textcell
|
|
||||||
else:
|
|
||||||
self.listcols[grid][col].pack_start(textcell50, expand=True)
|
|
||||||
self.listcols[grid][col].add_attribute(textcell50, 'text', col)
|
|
||||||
cellrend = textcell50
|
|
||||||
self.listcols[grid][col].set_expand(True)
|
|
||||||
else:
|
|
||||||
self.listcols[grid][col].pack_start(numcell, expand=True)
|
|
||||||
self.listcols[grid][col].add_attribute(numcell, 'text', col)
|
|
||||||
self.listcols[grid][col].set_expand(True)
|
|
||||||
cellrend = numcell
|
|
||||||
#self.listcols[grid][col].set_alignment(column[colxalign]) # no effect?
|
|
||||||
self.listcols[grid][col].set_clickable(True)
|
|
||||||
self.listcols[grid][col].connect("clicked", self.sortcols, (col,grid))
|
|
||||||
if col == 0:
|
|
||||||
self.listcols[grid][col].set_sort_order(gtk.SORT_DESCENDING)
|
|
||||||
self.listcols[grid][col].set_sort_indicator(True)
|
|
||||||
if column[coltype] == 'cash':
|
|
||||||
self.listcols[grid][col].set_cell_data_func(numcell, self.ledger_style_render_func)
|
|
||||||
else:
|
|
||||||
self.listcols[grid][col].set_cell_data_func(cellrend, self.reset_style_render_func)
|
|
||||||
|
|
||||||
rows = len(result) # +1 for title row
|
|
||||||
|
|
||||||
while sqlrow < rows:
|
|
||||||
treerow = []
|
|
||||||
for col,column in enumerate(self.cols_to_show):
|
|
||||||
if column[colalias] in colnames:
|
|
||||||
value = result[sqlrow][colnames.index(column[colalias])]
|
|
||||||
if column[colalias] == 'plposition':
|
|
||||||
if value == 'B':
|
|
||||||
value = 'BB'
|
|
||||||
elif value == 'S':
|
|
||||||
value = 'SB'
|
|
||||||
elif value == '0':
|
|
||||||
value = 'Btn'
|
|
||||||
else:
|
|
||||||
if column[colalias] == 'game':
|
|
||||||
if holecards:
|
|
||||||
value = Card.twoStartCardString( result[sqlrow][hgametypeid_idx] )
|
|
||||||
else:
|
|
||||||
minbb = result[sqlrow][colnames.index('minbigblind')]
|
|
||||||
maxbb = result[sqlrow][colnames.index('maxbigblind')]
|
|
||||||
value = result[sqlrow][colnames.index('limittype')] + ' ' \
|
|
||||||
+ result[sqlrow][colnames.index('category')].title() + ' ' \
|
|
||||||
+ result[sqlrow][colnames.index('name')] + ' $'
|
|
||||||
if 100 * int(minbb/100.0) != minbb:
|
|
||||||
value += '%.2f' % (minbb/100.0)
|
|
||||||
else:
|
|
||||||
value += '%.0f' % (minbb/100.0)
|
|
||||||
if minbb != maxbb:
|
|
||||||
if 100 * int(maxbb/100.0) != maxbb:
|
|
||||||
value += ' - $' + '%.2f' % (maxbb/100.0)
|
|
||||||
else:
|
|
||||||
value += ' - $' + '%.0f' % (maxbb/100.0)
|
|
||||||
else:
|
|
||||||
continue
|
|
||||||
if value and value != -999:
|
|
||||||
treerow.append(column[colformat] % value)
|
|
||||||
else:
|
|
||||||
treerow.append(' ')
|
|
||||||
iter = self.liststore[grid].append(treerow)
|
|
||||||
#print treerow
|
|
||||||
sqlrow += 1
|
|
||||||
row += 1
|
|
||||||
vbox.show_all()
|
|
||||||
|
|
||||||
#end def addGrid(self, query, vars, playerids, sitenos, limits, type, seats, groups, dates):
|
|
||||||
|
|
||||||
def refineQuery(self, query, flags, playerids, sitenos, limits, type, seats, groups, dates, games):
|
|
||||||
having = ''
|
|
||||||
if not flags:
|
|
||||||
holecards = False
|
|
||||||
numhands = 0
|
|
||||||
else:
|
|
||||||
holecards = flags[0]
|
|
||||||
numhands = flags[1]
|
|
||||||
|
|
||||||
if 'allplayers' in groups and groups['allplayers']:
|
|
||||||
nametest = "(hp.playerId)"
|
|
||||||
if holecards or groups['posn']:
|
|
||||||
pname = "'all players'"
|
|
||||||
# set flag in self.columns to not show player name column
|
|
||||||
[x for x in self.columns if x[0] == 'pname'][0][1] = False
|
|
||||||
# can't do this yet (re-write doing more maths in python instead of sql?)
|
|
||||||
if numhands:
|
|
||||||
nametest = "(-1)"
|
|
||||||
else:
|
|
||||||
pname = "p.name"
|
|
||||||
# set flag in self.columns to show player name column
|
|
||||||
[x for x in self.columns if x[0] == 'pname'][0][1] = True
|
|
||||||
if numhands:
|
|
||||||
having = ' and count(1) > %d ' % (numhands,)
|
|
||||||
else:
|
|
||||||
if playerids:
|
|
||||||
nametest = str(tuple(playerids))
|
|
||||||
nametest = nametest.replace("L", "")
|
|
||||||
nametest = nametest.replace(",)",")")
|
|
||||||
else:
|
|
||||||
nametest = "1 = 2"
|
|
||||||
pname = "p.name"
|
|
||||||
# set flag in self.columns to not show player name column
|
|
||||||
[x for x in self.columns if x[0] == 'pname'][0][1] = False
|
|
||||||
query = query.replace("<player_test>", nametest)
|
|
||||||
query = query.replace("<playerName>", pname)
|
|
||||||
query = query.replace("<havingclause>", having)
|
|
||||||
|
|
||||||
gametest = ""
|
|
||||||
q = []
|
|
||||||
for m in self.filters.display.items():
|
|
||||||
if m[0] == 'Games' and m[1]:
|
|
||||||
for n in games:
|
|
||||||
if games[n]:
|
|
||||||
q.append(n)
|
|
||||||
if len(q) > 0:
|
|
||||||
gametest = str(tuple(q))
|
|
||||||
gametest = gametest.replace("L", "")
|
|
||||||
gametest = gametest.replace(",)",")")
|
|
||||||
gametest = gametest.replace("u'","'")
|
|
||||||
gametest = "and gt.category in %s" % gametest
|
|
||||||
else:
|
|
||||||
gametest = "and gt.category IS NULL"
|
|
||||||
query = query.replace("<game_test>", gametest)
|
|
||||||
|
|
||||||
sitetest = ""
|
|
||||||
q = []
|
|
||||||
for m in self.filters.display.items():
|
|
||||||
if m[0] == 'Sites' and m[1]:
|
|
||||||
for n in sitenos:
|
|
||||||
q.append(n)
|
|
||||||
if len(q) > 0:
|
|
||||||
sitetest = str(tuple(q))
|
|
||||||
sitetest = sitetest.replace("L", "")
|
|
||||||
sitetest = sitetest.replace(",)",")")
|
|
||||||
sitetest = sitetest.replace("u'","'")
|
|
||||||
sitetest = "and gt.siteId in %s" % sitetest
|
|
||||||
else:
|
|
||||||
sitetest = "and gt.siteId IS NULL"
|
|
||||||
query = query.replace("<site_test>", sitetest)
|
|
||||||
|
|
||||||
if seats:
|
|
||||||
query = query.replace('<seats_test>', 'between ' + str(seats['from']) + ' and ' + str(seats['to']))
|
|
||||||
if 'show' in seats and seats['show']:
|
|
||||||
query = query.replace('<groupbyseats>', ',h.seats')
|
|
||||||
query = query.replace('<orderbyseats>', ',h.seats')
|
|
||||||
else:
|
|
||||||
query = query.replace('<groupbyseats>', '')
|
|
||||||
query = query.replace('<orderbyseats>', '')
|
|
||||||
else:
|
|
||||||
query = query.replace('<seats_test>', 'between 0 and 100')
|
|
||||||
query = query.replace('<groupbyseats>', '')
|
|
||||||
query = query.replace('<orderbyseats>', '')
|
|
||||||
|
|
||||||
lims = [int(x) for x in limits if x.isdigit()]
|
|
||||||
potlims = [int(x[0:-2]) for x in limits if len(x) > 2 and x[-2:] == 'pl']
|
|
||||||
nolims = [int(x[0:-2]) for x in limits if len(x) > 2 and x[-2:] == 'nl']
|
|
||||||
bbtest = "and ( (gt.limitType = 'fl' and gt.bigBlind in "
|
|
||||||
# and ( (limit and bb in()) or (nolimit and bb in ()) )
|
|
||||||
if lims:
|
|
||||||
blindtest = str(tuple(lims))
|
|
||||||
blindtest = blindtest.replace("L", "")
|
|
||||||
blindtest = blindtest.replace(",)",")")
|
|
||||||
bbtest = bbtest + blindtest + ' ) '
|
|
||||||
else:
|
|
||||||
bbtest = bbtest + '(-1) ) '
|
|
||||||
bbtest = bbtest + " or (gt.limitType = 'pl' and gt.bigBlind in "
|
|
||||||
if potlims:
|
|
||||||
blindtest = str(tuple(potlims))
|
|
||||||
blindtest = blindtest.replace("L", "")
|
|
||||||
blindtest = blindtest.replace(",)",")")
|
|
||||||
bbtest = bbtest + blindtest + ' ) '
|
|
||||||
else:
|
|
||||||
bbtest = bbtest + '(-1) ) '
|
|
||||||
bbtest = bbtest + " or (gt.limitType = 'nl' and gt.bigBlind in "
|
|
||||||
if nolims:
|
|
||||||
blindtest = str(tuple(nolims))
|
|
||||||
blindtest = blindtest.replace("L", "")
|
|
||||||
blindtest = blindtest.replace(",)",")")
|
|
||||||
bbtest = bbtest + blindtest + ' ) )'
|
|
||||||
else:
|
|
||||||
bbtest = bbtest + '(-1) ) )'
|
|
||||||
if type == 'ring':
|
|
||||||
bbtest = bbtest + " and gt.type = 'ring' "
|
|
||||||
elif type == 'tour':
|
|
||||||
bbtest = " and gt.type = 'tour' "
|
|
||||||
query = query.replace("<gtbigBlind_test>", bbtest)
|
|
||||||
|
|
||||||
if holecards: # re-use level variables for hole card query
|
|
||||||
query = query.replace("<hgameTypeId>", "hp.startcards")
|
|
||||||
query = query.replace("<orderbyhgameTypeId>"
|
|
||||||
, ",case when floor((hp.startcards-1)/13) >= mod((hp.startcards-1),13) then hp.startcards + 0.1 "
|
|
||||||
+ " else 13*mod((hp.startcards-1),13) + floor((hp.startcards-1)/13) + 1 "
|
|
||||||
+ " end desc ")
|
|
||||||
else:
|
|
||||||
query = query.replace("<orderbyhgameTypeId>", "")
|
|
||||||
groupLevels = "show" not in str(limits)
|
|
||||||
if groupLevels:
|
|
||||||
query = query.replace("<hgameTypeId>", "p.name") # need to use p.name for sqlite posn stats to work
|
|
||||||
else:
|
|
||||||
query = query.replace("<hgameTypeId>", "h.gameTypeId")
|
|
||||||
|
|
||||||
# process self.detailFilters (a list of tuples)
|
|
||||||
flagtest = ''
|
|
||||||
#self.detailFilters = [('h.seats', 5, 6)] # for debug
|
|
||||||
if self.detailFilters:
|
|
||||||
for f in self.detailFilters:
|
|
||||||
if len(f) == 3:
|
|
||||||
# X between Y and Z
|
|
||||||
flagtest += ' and %s between %s and %s ' % (f[0], str(f[1]), str(f[2]))
|
|
||||||
query = query.replace("<flagtest>", flagtest)
|
|
||||||
|
|
||||||
# allow for differences in sql cast() function:
|
|
||||||
if self.db.backend == self.MYSQL_INNODB:
|
|
||||||
query = query.replace("<signed>", 'signed ')
|
|
||||||
else:
|
|
||||||
query = query.replace("<signed>", '')
|
|
||||||
|
|
||||||
# Filter on dates
|
|
||||||
query = query.replace("<datestest>", " between '" + dates[0] + "' and '" + dates[1] + "'")
|
|
||||||
|
|
||||||
# Group by position?
|
|
||||||
if groups['posn']:
|
|
||||||
#query = query.replace("<position>", "case hp.position when '0' then 'Btn' else hp.position end")
|
|
||||||
query = query.replace("<position>", "hp.position")
|
|
||||||
# set flag in self.columns to show posn column
|
|
||||||
[x for x in self.columns if x[0] == 'plposition'][0][1] = True
|
|
||||||
else:
|
|
||||||
query = query.replace("<position>", "gt.base")
|
|
||||||
# unset flag in self.columns to hide posn column
|
|
||||||
[x for x in self.columns if x[0] == 'plposition'][0][1] = False
|
|
||||||
|
|
||||||
#print "query =\n", query
|
|
||||||
return(query)
|
|
||||||
#end def refineQuery(self, query, playerids, sitenos, limits):
|
|
||||||
|
|
||||||
def showDetailFilter(self, widget, data):
|
|
||||||
detailDialog = gtk.Dialog(title="Detailed Filters", parent=self.main_window
|
|
||||||
,flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT
|
|
||||||
,buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
|
|
||||||
gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
|
|
||||||
|
|
||||||
handbox = gtk.VBox(True, 0)
|
|
||||||
detailDialog.vbox.pack_start(handbox, False, False, 0)
|
|
||||||
handbox.show()
|
|
||||||
|
|
||||||
label = gtk.Label("Hand Filters:")
|
|
||||||
handbox.add(label)
|
|
||||||
label.show()
|
|
||||||
|
|
||||||
betweenFilters = []
|
|
||||||
for htest in self.handtests:
|
|
||||||
hbox = gtk.HBox(False, 0)
|
|
||||||
handbox.pack_start(hbox, False, False, 0)
|
|
||||||
hbox.show()
|
|
||||||
|
|
||||||
cb = gtk.CheckButton()
|
|
||||||
lbl_from = gtk.Label(htest[1])
|
|
||||||
lbl_from.set_alignment(xalign=0.0, yalign=0.5)
|
|
||||||
lbl_tween = gtk.Label('between')
|
|
||||||
lbl_to = gtk.Label('and')
|
|
||||||
adj1 = gtk.Adjustment(value=htest[2], lower=0, 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=htest[3], lower=2, upper=10, step_incr=1, page_incr=1, page_size=0)
|
|
||||||
sb2 = gtk.SpinButton(adjustment=adj2, climb_rate=0.0, digits=0)
|
|
||||||
|
|
||||||
for df in [x for x in self.detailFilters if x[0] == htest[0]]:
|
|
||||||
cb.set_active(True)
|
|
||||||
|
|
||||||
hbox.pack_start(cb, expand=False, padding=3)
|
|
||||||
hbox.pack_start(lbl_from, expand=True, padding=3)
|
|
||||||
hbox.pack_start(lbl_tween, 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)
|
|
||||||
|
|
||||||
cb.show()
|
|
||||||
lbl_from.show()
|
|
||||||
lbl_tween.show()
|
|
||||||
sb1.show()
|
|
||||||
lbl_to.show()
|
|
||||||
sb2.show()
|
|
||||||
|
|
||||||
htest[4:7] = [cb,sb1,sb2]
|
|
||||||
|
|
||||||
response = detailDialog.run()
|
|
||||||
|
|
||||||
if response == gtk.RESPONSE_ACCEPT:
|
|
||||||
self.detailFilters = []
|
|
||||||
for ht in self.handtests:
|
|
||||||
if ht[4].get_active():
|
|
||||||
self.detailFilters.append( (ht[0], ht[5].get_value_as_int(), ht[6].get_value_as_int()) )
|
|
||||||
ht[2],ht[3] = ht[5].get_value_as_int(), ht[6].get_value_as_int()
|
|
||||||
print "detailFilters =", self.detailFilters
|
|
||||||
self.refreshStats(None, None)
|
|
||||||
|
|
||||||
detailDialog.destroy()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
#Copyright 2008 Steffen Jobbagy-Felso
|
#Copyright 2008-2010 Steffen Schaumburg
|
||||||
#This program is free software: you can redistribute it and/or modify
|
#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
|
#it under the terms of the GNU Affero General Public License as published by
|
||||||
#the Free Software Foundation, version 3 of the License.
|
#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
|
#You should have received a copy of the GNU Affero General Public License
|
||||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#In the "official" distribution you can find the license in
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
#agpl-3.0.txt in the docs folder of the package.
|
|
||||||
|
|
||||||
import threading
|
import threading
|
||||||
import pygtk
|
import pygtk
|
||||||
|
@ -24,8 +24,7 @@ from time import time, strftime
|
||||||
|
|
||||||
import fpdb_import
|
import fpdb_import
|
||||||
import Database
|
import Database
|
||||||
import Filters
|
import RingFilters
|
||||||
import FpdbSQLQueries
|
|
||||||
|
|
||||||
class GuiPositionalStats (threading.Thread):
|
class GuiPositionalStats (threading.Thread):
|
||||||
def __init__(self, config, querylist, debug=True):
|
def __init__(self, config, querylist, debug=True):
|
||||||
|
@ -58,7 +57,7 @@ class GuiPositionalStats (threading.Thread):
|
||||||
"Button2" : False
|
"Button2" : False
|
||||||
}
|
}
|
||||||
|
|
||||||
self.filters = Filters.Filters(self.db, self.conf, self.sql, display = filters_display)
|
self.filters = RingFilters.RingFilters(self.db, self.conf, self.sql, display = filters_display)
|
||||||
self.filters.registerButton1Name("Refresh")
|
self.filters.registerButton1Name("Refresh")
|
||||||
self.filters.registerButton1Callback(self.refreshStats)
|
self.filters.registerButton1Callback(self.refreshStats)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
#Copyright 2008 Carl Gherardi
|
#Copyright 2008-2010 Carl Gherardi
|
||||||
#This program is free software: you can redistribute it and/or modify
|
#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
|
#it under the terms of the GNU Affero General Public License as published by
|
||||||
#the Free Software Foundation, version 3 of the License.
|
#the Free Software Foundation, version 3 of the License.
|
||||||
|
@ -13,9 +13,7 @@
|
||||||
#
|
#
|
||||||
#You should have received a copy of the GNU Affero General Public License
|
#You should have received a copy of the GNU Affero General Public License
|
||||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#In the "official" distribution you can find the license in
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
#agpl-3.0.txt in the docs folder of the package.
|
|
||||||
|
|
||||||
|
|
||||||
import xml.dom.minidom
|
import xml.dom.minidom
|
||||||
from xml.dom.minidom import Node
|
from xml.dom.minidom import Node
|
||||||
|
@ -30,10 +28,11 @@ import Configuration
|
||||||
|
|
||||||
class GuiPrefs:
|
class GuiPrefs:
|
||||||
|
|
||||||
def __init__(self, config, mainwin, dia):
|
def __init__(self, config, mainwin, dia, parentwin):
|
||||||
self.config = config
|
self.config = config
|
||||||
self.main_window = mainwin
|
self.main_window = mainwin
|
||||||
self.dialog = dia
|
self.dialog = dia
|
||||||
|
self.parent_window = parentwin #need to pass reference of parent, to set transient
|
||||||
|
|
||||||
self.tree_box = gtk.ScrolledWindow()
|
self.tree_box = gtk.ScrolledWindow()
|
||||||
self.tree_box.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
self.tree_box.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
||||||
|
@ -60,7 +59,7 @@ class GuiPrefs:
|
||||||
configColumn.pack_start(cRender, True)
|
configColumn.pack_start(cRender, True)
|
||||||
configColumn.add_attribute(cRender, 'text', 1)
|
configColumn.add_attribute(cRender, 'text', 1)
|
||||||
|
|
||||||
configColumn = gtk.TreeViewColumn("Value")
|
configColumn = gtk.TreeViewColumn("Value (double-click to change)")
|
||||||
self.configView.append_column(configColumn)
|
self.configView.append_column(configColumn)
|
||||||
cRender = gtk.CellRendererText()
|
cRender = gtk.CellRendererText()
|
||||||
configColumn.pack_start(cRender, True)
|
configColumn.pack_start(cRender, True)
|
||||||
|
@ -120,7 +119,7 @@ class GuiPrefs:
|
||||||
name = tmodel.get_value( iter, 1 )
|
name = tmodel.get_value( iter, 1 )
|
||||||
val = tmodel.get_value( iter, 2 )
|
val = tmodel.get_value( iter, 2 )
|
||||||
dia_edit = gtk.Dialog(name,
|
dia_edit = gtk.Dialog(name,
|
||||||
self.main_window,
|
self.parent_window,
|
||||||
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
|
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
|
||||||
(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
|
(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
|
||||||
gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
|
gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
|
||||||
|
@ -162,7 +161,8 @@ if __name__=="__main__":
|
||||||
(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
|
(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
|
||||||
gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT))
|
gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT))
|
||||||
dia.set_default_size(700, 500)
|
dia.set_default_size(700, 500)
|
||||||
prefs = GuiPrefs(config, win, dia.vbox)
|
pw=dia #pass parent window
|
||||||
|
prefs = GuiPrefs(config, win, dia.vbox,pw)
|
||||||
response = dia.run()
|
response = dia.run()
|
||||||
if response == gtk.RESPONSE_ACCEPT:
|
if response == gtk.RESPONSE_ACCEPT:
|
||||||
# save updated config
|
# save updated config
|
||||||
|
|
681
pyfpdb/GuiRingPlayerStats.py
Normal file
681
pyfpdb/GuiRingPlayerStats.py
Normal file
|
@ -0,0 +1,681 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
#Copyright 2008-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.
|
||||||
|
#
|
||||||
|
#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 <http://www.gnu.org/licenses/>.
|
||||||
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
|
|
||||||
|
import traceback
|
||||||
|
import threading
|
||||||
|
import pygtk
|
||||||
|
pygtk.require('2.0')
|
||||||
|
import gtk
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
from time import time, strftime
|
||||||
|
|
||||||
|
import Card
|
||||||
|
import fpdb_import
|
||||||
|
import Database
|
||||||
|
import RingFilters
|
||||||
|
import Charset
|
||||||
|
import GuiPlayerStats
|
||||||
|
|
||||||
|
colalias,colshow,colheading,colxalign,colformat,coltype = 0,1,2,3,4,5
|
||||||
|
ranks = {'x':0, '2':2, '3':3, '4':4, '5':5, '6':6, '7':7, '8':8, '9':9, 'T':10, 'J':11, 'Q':12, 'K':13, 'A':14}
|
||||||
|
|
||||||
|
class GuiRingPlayerStats (GuiPlayerStats.GuiPlayerStats):
|
||||||
|
|
||||||
|
def __init__(self, config, querylist, mainwin, debug=True):
|
||||||
|
self.debug = debug
|
||||||
|
self.conf = config
|
||||||
|
self.main_window = mainwin
|
||||||
|
self.sql = querylist
|
||||||
|
|
||||||
|
self.liststore = [] # gtk.ListStore[] stores the contents of the grids
|
||||||
|
self.listcols = [] # gtk.TreeViewColumn[][] stores the columns in the grids
|
||||||
|
|
||||||
|
self.MYSQL_INNODB = 2
|
||||||
|
self.PGSQL = 3
|
||||||
|
self.SQLITE = 4
|
||||||
|
|
||||||
|
# create new db connection to avoid conflicts with other threads
|
||||||
|
self.db = Database.Database(self.conf, sql=self.sql)
|
||||||
|
self.cursor = self.db.cursor
|
||||||
|
|
||||||
|
settings = {}
|
||||||
|
settings.update(self.conf.get_db_parameters())
|
||||||
|
settings.update(self.conf.get_tv_parameters())
|
||||||
|
settings.update(self.conf.get_import_parameters())
|
||||||
|
settings.update(self.conf.get_default_paths())
|
||||||
|
|
||||||
|
# text used on screen stored here so that it can be configured
|
||||||
|
self.filterText = {'handhead':'Hand Breakdown for all levels listed above'
|
||||||
|
}
|
||||||
|
|
||||||
|
filters_display = { "Heroes" : True,
|
||||||
|
"Sites" : True,
|
||||||
|
"Games" : True,
|
||||||
|
"Limits" : True,
|
||||||
|
"LimitSep" : True,
|
||||||
|
"LimitType" : True,
|
||||||
|
"Type" : True,
|
||||||
|
"Seats" : True,
|
||||||
|
"SeatSep" : True,
|
||||||
|
"Dates" : True,
|
||||||
|
"Groups" : True,
|
||||||
|
"GroupsAll" : True,
|
||||||
|
"Button1" : True,
|
||||||
|
"Button2" : True
|
||||||
|
}
|
||||||
|
|
||||||
|
self.filters = RingFilters.RingFilters(self.db, self.conf, self.sql, display = filters_display)
|
||||||
|
self.filters.registerButton1Name("_Filters")
|
||||||
|
self.filters.registerButton1Callback(self.showDetailFilter)
|
||||||
|
self.filters.registerButton2Name("_Refresh Stats")
|
||||||
|
self.filters.registerButton2Callback(self.refreshStats)
|
||||||
|
|
||||||
|
# ToDo: store in config
|
||||||
|
# ToDo: create popup to adjust column config
|
||||||
|
# columns to display, keys match column name returned by sql, values in tuple are:
|
||||||
|
# is column displayed, column heading, xalignment, formatting, celltype
|
||||||
|
self.columns = [ ["game", True, "Game", 0.0, "%s", "str"]
|
||||||
|
, ["hand", False, "Hand", 0.0, "%s", "str"] # true not allowed for this line
|
||||||
|
, ["plposition", False, "Posn", 1.0, "%s", "str"] # true not allowed for this line (set in code)
|
||||||
|
, ["pname", False, "Name", 0.0, "%s", "str"] # true not allowed for this line (set in code)
|
||||||
|
, ["n", True, "Hds", 1.0, "%1.0f", "str"]
|
||||||
|
, ["avgseats", False, "Seats", 1.0, "%3.1f", "str"]
|
||||||
|
, ["vpip", True, "VPIP", 1.0, "%3.1f", "str"]
|
||||||
|
, ["pfr", True, "PFR", 1.0, "%3.1f", "str"]
|
||||||
|
, ["pf3", True, "PF3", 1.0, "%3.1f", "str"]
|
||||||
|
, ["aggfac", True, "AggFac", 1.0, "%2.2f", "str"]
|
||||||
|
, ["aggfrq", True, "AggFreq", 1.0, "%3.1f", "str"]
|
||||||
|
, ["conbet", True, "ContBet", 1.0, "%3.1f", "str"]
|
||||||
|
, ["steals", True, "Steals", 1.0, "%3.1f", "str"]
|
||||||
|
, ["saw_f", True, "Saw_F", 1.0, "%3.1f", "str"]
|
||||||
|
, ["sawsd", True, "SawSD", 1.0, "%3.1f", "str"]
|
||||||
|
, ["wtsdwsf", True, "WtSDwsF", 1.0, "%3.1f", "str"]
|
||||||
|
, ["wmsd", True, "W$SD", 1.0, "%3.1f", "str"]
|
||||||
|
, ["flafq", True, "FlAFq", 1.0, "%3.1f", "str"]
|
||||||
|
, ["tuafq", True, "TuAFq", 1.0, "%3.1f", "str"]
|
||||||
|
, ["rvafq", True, "RvAFq", 1.0, "%3.1f", "str"]
|
||||||
|
, ["pofafq", False, "PoFAFq", 1.0, "%3.1f", "str"]
|
||||||
|
, ["net", True, "Net($)", 1.0, "%6.2f", "cash"]
|
||||||
|
, ["bbper100", True, "bb/100", 1.0, "%4.2f", "str"]
|
||||||
|
, ["rake", True, "Rake($)", 1.0, "%6.2f", "cash"]
|
||||||
|
, ["bb100xr", True, "bbxr/100", 1.0, "%4.2f", "str"]
|
||||||
|
, ["variance", True, "Variance", 1.0, "%5.2f", "str"]
|
||||||
|
]
|
||||||
|
|
||||||
|
# Detail filters: This holds the data used in the popup window, extra values are
|
||||||
|
# added at the end of these lists during processing
|
||||||
|
# sql test, screen description, min, max
|
||||||
|
self.handtests = [ # already in filter class : ['h.seats', 'Number of Players', 2, 10]
|
||||||
|
['h.maxSeats', 'Size of Table', 2, 10]
|
||||||
|
,['h.playersVpi', 'Players who VPI', 0, 10]
|
||||||
|
,['h.playersAtStreet1', 'Players at Flop', 0, 10]
|
||||||
|
,['h.playersAtStreet2', 'Players at Turn', 0, 10]
|
||||||
|
,['h.playersAtStreet3', 'Players at River', 0, 10]
|
||||||
|
,['h.playersAtStreet4', 'Players at Street7', 0, 10]
|
||||||
|
,['h.playersAtShowdown', 'Players at Showdown', 0, 10]
|
||||||
|
,['h.street0Raises', 'Bets to See Flop', 0, 5]
|
||||||
|
,['h.street1Raises', 'Bets to See Turn', 0, 5]
|
||||||
|
,['h.street2Raises', 'Bets to See River', 0, 5]
|
||||||
|
,['h.street3Raises', 'Bets to See Street7', 0, 5]
|
||||||
|
,['h.street4Raises', 'Bets to See Showdown', 0, 5]
|
||||||
|
]
|
||||||
|
|
||||||
|
self.stats_frame = None
|
||||||
|
self.stats_vbox = None
|
||||||
|
self.detailFilters = [] # the data used to enhance the sql select
|
||||||
|
|
||||||
|
#self.main_hbox = gtk.HBox(False, 0)
|
||||||
|
#self.main_hbox.show()
|
||||||
|
self.main_hbox = gtk.HPaned()
|
||||||
|
|
||||||
|
self.stats_frame = gtk.Frame()
|
||||||
|
self.stats_frame.show()
|
||||||
|
|
||||||
|
self.stats_vbox = gtk.VPaned()
|
||||||
|
self.stats_vbox.show()
|
||||||
|
self.stats_frame.add(self.stats_vbox)
|
||||||
|
# self.fillStatsFrame(self.stats_vbox)
|
||||||
|
|
||||||
|
#self.main_hbox.pack_start(self.filters.get_vbox())
|
||||||
|
#self.main_hbox.pack_start(self.stats_frame, expand=True, fill=True)
|
||||||
|
self.main_hbox.pack1(self.filters.get_vbox())
|
||||||
|
self.main_hbox.pack2(self.stats_frame)
|
||||||
|
self.main_hbox.show()
|
||||||
|
|
||||||
|
# make sure Hand column is not displayed
|
||||||
|
[x for x in self.columns if x[0] == 'hand'][0][1] = False
|
||||||
|
self.last_pos = -1
|
||||||
|
|
||||||
|
|
||||||
|
def get_vbox(self):
|
||||||
|
"""returns the vbox of this thread"""
|
||||||
|
return self.main_hbox
|
||||||
|
#end def get_vbox
|
||||||
|
|
||||||
|
def refreshStats(self, widget, data):
|
||||||
|
self.last_pos = self.stats_vbox.get_position()
|
||||||
|
try: self.stats_vbox.destroy()
|
||||||
|
except AttributeError: pass
|
||||||
|
self.liststore = []
|
||||||
|
self.listcols = []
|
||||||
|
#self.stats_vbox = gtk.VBox(False, 0)
|
||||||
|
self.stats_vbox = gtk.VPaned()
|
||||||
|
self.stats_vbox.show()
|
||||||
|
self.stats_frame.add(self.stats_vbox)
|
||||||
|
self.fillStatsFrame(self.stats_vbox)
|
||||||
|
if self.last_pos > 0:
|
||||||
|
self.stats_vbox.set_position(self.last_pos)
|
||||||
|
#end def refreshStats
|
||||||
|
|
||||||
|
def fillStatsFrame(self, vbox):
|
||||||
|
sites = self.filters.getSites()
|
||||||
|
heroes = self.filters.getHeroes()
|
||||||
|
siteids = self.filters.getSiteIds()
|
||||||
|
limits = self.filters.getLimits()
|
||||||
|
type = self.filters.getType()
|
||||||
|
seats = self.filters.getSeats()
|
||||||
|
groups = self.filters.getGroups()
|
||||||
|
dates = self.filters.getDates()
|
||||||
|
games = self.filters.getGames()
|
||||||
|
sitenos = []
|
||||||
|
playerids = []
|
||||||
|
|
||||||
|
# Which sites are selected?
|
||||||
|
for site in sites:
|
||||||
|
if sites[site] == True:
|
||||||
|
sitenos.append(siteids[site])
|
||||||
|
_hname = Charset.to_utf8(heroes[site])
|
||||||
|
result = self.db.get_player_id(self.conf, site, _hname)
|
||||||
|
if result is not None:
|
||||||
|
playerids.append(int(result))
|
||||||
|
|
||||||
|
if not sitenos:
|
||||||
|
#Should probably pop up here.
|
||||||
|
print "No sites selected - defaulting to PokerStars"
|
||||||
|
sitenos = [2]
|
||||||
|
if not playerids:
|
||||||
|
print "No player ids found"
|
||||||
|
return
|
||||||
|
if not limits:
|
||||||
|
print "No limits found"
|
||||||
|
return
|
||||||
|
|
||||||
|
self.createStatsTable(vbox, playerids, sitenos, limits, type, seats, groups, dates, games)
|
||||||
|
#end def fillStatsFrame
|
||||||
|
|
||||||
|
def createStatsTable(self, vbox, playerids, sitenos, limits, type, seats, groups, dates, games):
|
||||||
|
startTime = time()
|
||||||
|
show_detail = True
|
||||||
|
|
||||||
|
# Scrolled window for summary table
|
||||||
|
swin = gtk.ScrolledWindow(hadjustment=None, vadjustment=None)
|
||||||
|
swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
||||||
|
swin.show()
|
||||||
|
vbox.pack1(swin)
|
||||||
|
|
||||||
|
# Display summary table at top of page
|
||||||
|
# 3rd parameter passes extra flags, currently includes:
|
||||||
|
# holecards - whether to display card breakdown (True/False)
|
||||||
|
# numhands - min number hands required when displaying all players
|
||||||
|
# gridnum - index for grid data structures
|
||||||
|
flags = [False, self.filters.getNumHands(), 0]
|
||||||
|
self.addGrid(swin, 'playerDetailedStats', flags, playerids
|
||||||
|
,sitenos, limits, type, seats, groups, dates, games)
|
||||||
|
|
||||||
|
if 'allplayers' in groups and groups['allplayers']:
|
||||||
|
# can't currently do this combination so skip detailed table
|
||||||
|
show_detail = False
|
||||||
|
|
||||||
|
if show_detail:
|
||||||
|
# Separator
|
||||||
|
vbox2 = gtk.VBox(False, 0)
|
||||||
|
heading = gtk.Label(self.filterText['handhead'])
|
||||||
|
heading.show()
|
||||||
|
vbox2.pack_start(heading, expand=False, padding=3)
|
||||||
|
|
||||||
|
# Scrolled window for detailed table (display by hand)
|
||||||
|
swin = gtk.ScrolledWindow(hadjustment=None, vadjustment=None)
|
||||||
|
swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
||||||
|
swin.show()
|
||||||
|
vbox2.pack_start(swin, expand=True, padding=3)
|
||||||
|
vbox.pack2(vbox2)
|
||||||
|
vbox2.show()
|
||||||
|
|
||||||
|
# Detailed table
|
||||||
|
flags[0] = True
|
||||||
|
flags[2] = 1
|
||||||
|
self.addGrid(swin, 'playerDetailedStats', flags, playerids
|
||||||
|
,sitenos, limits, type, seats, groups, dates, games)
|
||||||
|
|
||||||
|
self.db.rollback()
|
||||||
|
print "Stats page displayed in %4.2f seconds" % (time() - startTime)
|
||||||
|
#end def createStatsTable
|
||||||
|
|
||||||
|
def reset_style_render_func(self, treeviewcolumn, cell, model, iter):
|
||||||
|
cell.set_property('foreground', 'black')
|
||||||
|
#end def reset_style_render_func
|
||||||
|
|
||||||
|
def ledger_style_render_func(self, tvcol, cell, model, iter):
|
||||||
|
str = cell.get_property('text')
|
||||||
|
if '-' in str:
|
||||||
|
str = str.replace("-", "")
|
||||||
|
str = "(%s)" %(str)
|
||||||
|
cell.set_property('text', str)
|
||||||
|
cell.set_property('foreground', 'red')
|
||||||
|
else:
|
||||||
|
cell.set_property('foreground', 'darkgreen')
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
def sortnums(self, model, iter1, iter2, nums):
|
||||||
|
try:
|
||||||
|
ret = 0
|
||||||
|
(n, grid) = nums
|
||||||
|
a = self.liststore[grid].get_value(iter1, n)
|
||||||
|
b = self.liststore[grid].get_value(iter2, n)
|
||||||
|
if 'f' in self.cols_to_show[n][4]:
|
||||||
|
try: a = float(a)
|
||||||
|
except: a = 0.0
|
||||||
|
try: b = float(b)
|
||||||
|
except: b = 0.0
|
||||||
|
if n == 0 and grid == 1: #make sure it only works on the starting hands
|
||||||
|
a1,a2,a3 = ranks[a[0]], ranks[a[1]], (a+'o')[2]
|
||||||
|
b1,b2,b3 = ranks[b[0]], ranks[b[1]], (b+'o')[2]
|
||||||
|
if a1 > b1 or ( a1 == b1 and (a2 > b2 or (a2 == b2 and a3 > b3) ) ):
|
||||||
|
ret = 1
|
||||||
|
else:
|
||||||
|
ret = -1
|
||||||
|
else:
|
||||||
|
if a < b:
|
||||||
|
ret = -1
|
||||||
|
elif a == b:
|
||||||
|
ret = 0
|
||||||
|
else:
|
||||||
|
ret = 1
|
||||||
|
#print "n =", n, "iter1[n] =", self.liststore[grid].get_value(iter1,n), "iter2[n] =", self.liststore[grid].get_value(iter2,n), "ret =", ret
|
||||||
|
except:
|
||||||
|
err = traceback.extract_tb(sys.exc_info()[2])
|
||||||
|
print "***sortnums error: " + str(sys.exc_info()[1])
|
||||||
|
print "\n".join( [e[0]+':'+str(e[1])+" "+e[2] for e in err] )
|
||||||
|
|
||||||
|
return(ret)
|
||||||
|
|
||||||
|
def sortcols(self, col, nums):
|
||||||
|
try:
|
||||||
|
#This doesn't actually work yet - clicking heading in top section sorts bottom section :-(
|
||||||
|
(n, grid) = nums
|
||||||
|
if not col.get_sort_indicator() or col.get_sort_order() == gtk.SORT_ASCENDING:
|
||||||
|
col.set_sort_order(gtk.SORT_DESCENDING)
|
||||||
|
else:
|
||||||
|
col.set_sort_order(gtk.SORT_ASCENDING)
|
||||||
|
self.liststore[grid].set_sort_column_id(n, col.get_sort_order())
|
||||||
|
self.liststore[grid].set_sort_func(n, self.sortnums, (n,grid))
|
||||||
|
for i in xrange(len(self.listcols[grid])):
|
||||||
|
self.listcols[grid][i].set_sort_indicator(False)
|
||||||
|
self.listcols[grid][n].set_sort_indicator(True)
|
||||||
|
# use this listcols[col].set_sort_indicator(True)
|
||||||
|
# to turn indicator off for other cols
|
||||||
|
except:
|
||||||
|
err = traceback.extract_tb(sys.exc_info()[2])
|
||||||
|
print "***sortcols error: " + str(sys.exc_info()[1])
|
||||||
|
print "\n".join( [e[0]+':'+str(e[1])+" "+e[2] for e in err] )
|
||||||
|
#end def sortcols
|
||||||
|
|
||||||
|
def addGrid(self, vbox, query, flags, playerids, sitenos, limits, type, seats, groups, dates, games):
|
||||||
|
counter = 0
|
||||||
|
row = 0
|
||||||
|
sqlrow = 0
|
||||||
|
if not flags: holecards,grid = False,0
|
||||||
|
else: holecards,grid = flags[0],flags[2]
|
||||||
|
|
||||||
|
tmp = self.sql.query[query]
|
||||||
|
tmp = self.refineQuery(tmp, flags, playerids, sitenos, limits, type, seats, groups, dates, games)
|
||||||
|
self.cursor.execute(tmp)
|
||||||
|
result = self.cursor.fetchall()
|
||||||
|
colnames = [desc[0].lower() for desc in self.cursor.description]
|
||||||
|
|
||||||
|
# pre-fetch some constant values:
|
||||||
|
self.cols_to_show = [x for x in self.columns if x[colshow]]
|
||||||
|
hgametypeid_idx = colnames.index('hgametypeid')
|
||||||
|
|
||||||
|
assert len(self.liststore) == grid, "len(self.liststore)="+str(len(self.liststore))+" grid-1="+str(grid)
|
||||||
|
self.liststore.append( gtk.ListStore(*([str] * len(self.cols_to_show))) )
|
||||||
|
view = gtk.TreeView(model=self.liststore[grid])
|
||||||
|
view.set_grid_lines(gtk.TREE_VIEW_GRID_LINES_BOTH)
|
||||||
|
#vbox.pack_start(view, expand=False, padding=3)
|
||||||
|
vbox.add(view)
|
||||||
|
textcell = gtk.CellRendererText()
|
||||||
|
textcell50 = gtk.CellRendererText()
|
||||||
|
textcell50.set_property('xalign', 0.5)
|
||||||
|
numcell = gtk.CellRendererText()
|
||||||
|
numcell.set_property('xalign', 1.0)
|
||||||
|
assert len(self.listcols) == grid
|
||||||
|
self.listcols.append( [] )
|
||||||
|
|
||||||
|
# Create header row eg column: ("game", True, "Game", 0.0, "%s")
|
||||||
|
for col, column in enumerate(self.cols_to_show):
|
||||||
|
if column[colalias] == 'game' and holecards:
|
||||||
|
s = [x for x in self.columns if x[colalias] == 'hand'][0][colheading]
|
||||||
|
else:
|
||||||
|
s = column[colheading]
|
||||||
|
self.listcols[grid].append(gtk.TreeViewColumn(s))
|
||||||
|
view.append_column(self.listcols[grid][col])
|
||||||
|
if column[colformat] == '%s':
|
||||||
|
if column[colxalign] == 0.0:
|
||||||
|
self.listcols[grid][col].pack_start(textcell, expand=True)
|
||||||
|
self.listcols[grid][col].add_attribute(textcell, 'text', col)
|
||||||
|
cellrend = textcell
|
||||||
|
else:
|
||||||
|
self.listcols[grid][col].pack_start(textcell50, expand=True)
|
||||||
|
self.listcols[grid][col].add_attribute(textcell50, 'text', col)
|
||||||
|
cellrend = textcell50
|
||||||
|
self.listcols[grid][col].set_expand(True)
|
||||||
|
else:
|
||||||
|
self.listcols[grid][col].pack_start(numcell, expand=True)
|
||||||
|
self.listcols[grid][col].add_attribute(numcell, 'text', col)
|
||||||
|
self.listcols[grid][col].set_expand(True)
|
||||||
|
cellrend = numcell
|
||||||
|
#self.listcols[grid][col].set_alignment(column[colxalign]) # no effect?
|
||||||
|
self.listcols[grid][col].set_clickable(True)
|
||||||
|
self.listcols[grid][col].connect("clicked", self.sortcols, (col,grid))
|
||||||
|
if col == 0:
|
||||||
|
self.listcols[grid][col].set_sort_order(gtk.SORT_DESCENDING)
|
||||||
|
self.listcols[grid][col].set_sort_indicator(True)
|
||||||
|
if column[coltype] == 'cash':
|
||||||
|
self.listcols[grid][col].set_cell_data_func(numcell, self.ledger_style_render_func)
|
||||||
|
else:
|
||||||
|
self.listcols[grid][col].set_cell_data_func(cellrend, self.reset_style_render_func)
|
||||||
|
|
||||||
|
rows = len(result) # +1 for title row
|
||||||
|
|
||||||
|
while sqlrow < rows:
|
||||||
|
treerow = []
|
||||||
|
for col,column in enumerate(self.cols_to_show):
|
||||||
|
if column[colalias] in colnames:
|
||||||
|
value = result[sqlrow][colnames.index(column[colalias])]
|
||||||
|
if column[colalias] == 'plposition':
|
||||||
|
if value == 'B':
|
||||||
|
value = 'BB'
|
||||||
|
elif value == 'S':
|
||||||
|
value = 'SB'
|
||||||
|
elif value == '0':
|
||||||
|
value = 'Btn'
|
||||||
|
else:
|
||||||
|
if column[colalias] == 'game':
|
||||||
|
if holecards:
|
||||||
|
value = Card.twoStartCardString( result[sqlrow][hgametypeid_idx] )
|
||||||
|
else:
|
||||||
|
minbb = result[sqlrow][colnames.index('minbigblind')]
|
||||||
|
maxbb = result[sqlrow][colnames.index('maxbigblind')]
|
||||||
|
value = result[sqlrow][colnames.index('limittype')] + ' ' \
|
||||||
|
+ result[sqlrow][colnames.index('category')].title() + ' ' \
|
||||||
|
+ result[sqlrow][colnames.index('name')] + ' $'
|
||||||
|
if 100 * int(minbb/100.0) != minbb:
|
||||||
|
value += '%.2f' % (minbb/100.0)
|
||||||
|
else:
|
||||||
|
value += '%.0f' % (minbb/100.0)
|
||||||
|
if minbb != maxbb:
|
||||||
|
if 100 * int(maxbb/100.0) != maxbb:
|
||||||
|
value += ' - $' + '%.2f' % (maxbb/100.0)
|
||||||
|
else:
|
||||||
|
value += ' - $' + '%.0f' % (maxbb/100.0)
|
||||||
|
else:
|
||||||
|
continue
|
||||||
|
if value and value != -999:
|
||||||
|
treerow.append(column[colformat] % value)
|
||||||
|
else:
|
||||||
|
treerow.append(' ')
|
||||||
|
iter = self.liststore[grid].append(treerow)
|
||||||
|
#print treerow
|
||||||
|
sqlrow += 1
|
||||||
|
row += 1
|
||||||
|
vbox.show_all()
|
||||||
|
#end def addGrid
|
||||||
|
|
||||||
|
def refineQuery(self, query, flags, playerids, sitenos, limits, type, seats, groups, dates, games):
|
||||||
|
having = ''
|
||||||
|
if not flags:
|
||||||
|
holecards = False
|
||||||
|
numhands = 0
|
||||||
|
else:
|
||||||
|
holecards = flags[0]
|
||||||
|
numhands = flags[1]
|
||||||
|
|
||||||
|
if 'allplayers' in groups and groups['allplayers']:
|
||||||
|
nametest = "(hp.playerId)"
|
||||||
|
if holecards or groups['posn']:
|
||||||
|
pname = "'all players'"
|
||||||
|
# set flag in self.columns to not show player name column
|
||||||
|
[x for x in self.columns if x[0] == 'pname'][0][1] = False
|
||||||
|
# can't do this yet (re-write doing more maths in python instead of sql?)
|
||||||
|
if numhands:
|
||||||
|
nametest = "(-1)"
|
||||||
|
else:
|
||||||
|
pname = "p.name"
|
||||||
|
# set flag in self.columns to show player name column
|
||||||
|
[x for x in self.columns if x[0] == 'pname'][0][1] = True
|
||||||
|
if numhands:
|
||||||
|
having = ' and count(1) > %d ' % (numhands,)
|
||||||
|
else:
|
||||||
|
if playerids:
|
||||||
|
nametest = str(tuple(playerids))
|
||||||
|
nametest = nametest.replace("L", "")
|
||||||
|
nametest = nametest.replace(",)",")")
|
||||||
|
else:
|
||||||
|
nametest = "1 = 2"
|
||||||
|
pname = "p.name"
|
||||||
|
# set flag in self.columns to not show player name column
|
||||||
|
[x for x in self.columns if x[0] == 'pname'][0][1] = False
|
||||||
|
query = query.replace("<player_test>", nametest)
|
||||||
|
query = query.replace("<playerName>", pname)
|
||||||
|
query = query.replace("<havingclause>", having)
|
||||||
|
|
||||||
|
gametest = ""
|
||||||
|
q = []
|
||||||
|
for m in self.filters.display.items():
|
||||||
|
if m[0] == 'Games' and m[1]:
|
||||||
|
for n in games:
|
||||||
|
if games[n]:
|
||||||
|
q.append(n)
|
||||||
|
if len(q) > 0:
|
||||||
|
gametest = str(tuple(q))
|
||||||
|
gametest = gametest.replace("L", "")
|
||||||
|
gametest = gametest.replace(",)",")")
|
||||||
|
gametest = gametest.replace("u'","'")
|
||||||
|
gametest = "and gt.category in %s" % gametest
|
||||||
|
else:
|
||||||
|
gametest = "and gt.category IS NULL"
|
||||||
|
query = query.replace("<game_test>", gametest)
|
||||||
|
|
||||||
|
sitetest = ""
|
||||||
|
q = []
|
||||||
|
for m in self.filters.display.items():
|
||||||
|
if m[0] == 'Sites' and m[1]:
|
||||||
|
for n in sitenos:
|
||||||
|
q.append(n)
|
||||||
|
if len(q) > 0:
|
||||||
|
sitetest = str(tuple(q))
|
||||||
|
sitetest = sitetest.replace("L", "")
|
||||||
|
sitetest = sitetest.replace(",)",")")
|
||||||
|
sitetest = sitetest.replace("u'","'")
|
||||||
|
sitetest = "and gt.siteId in %s" % sitetest
|
||||||
|
else:
|
||||||
|
sitetest = "and gt.siteId IS NULL"
|
||||||
|
query = query.replace("<site_test>", sitetest)
|
||||||
|
|
||||||
|
if seats:
|
||||||
|
query = query.replace('<seats_test>', 'between ' + str(seats['from']) + ' and ' + str(seats['to']))
|
||||||
|
if 'show' in seats and seats['show']:
|
||||||
|
query = query.replace('<groupbyseats>', ',h.seats')
|
||||||
|
query = query.replace('<orderbyseats>', ',h.seats')
|
||||||
|
else:
|
||||||
|
query = query.replace('<groupbyseats>', '')
|
||||||
|
query = query.replace('<orderbyseats>', '')
|
||||||
|
else:
|
||||||
|
query = query.replace('<seats_test>', 'between 0 and 100')
|
||||||
|
query = query.replace('<groupbyseats>', '')
|
||||||
|
query = query.replace('<orderbyseats>', '')
|
||||||
|
|
||||||
|
lims = [int(x) for x in limits if x.isdigit()]
|
||||||
|
potlims = [int(x[0:-2]) for x in limits if len(x) > 2 and x[-2:] == 'pl']
|
||||||
|
nolims = [int(x[0:-2]) for x in limits if len(x) > 2 and x[-2:] == 'nl']
|
||||||
|
bbtest = "and ( (gt.limitType = 'fl' and gt.bigBlind in "
|
||||||
|
# and ( (limit and bb in()) or (nolimit and bb in ()) )
|
||||||
|
if lims:
|
||||||
|
blindtest = str(tuple(lims))
|
||||||
|
blindtest = blindtest.replace("L", "")
|
||||||
|
blindtest = blindtest.replace(",)",")")
|
||||||
|
bbtest = bbtest + blindtest + ' ) '
|
||||||
|
else:
|
||||||
|
bbtest = bbtest + '(-1) ) '
|
||||||
|
bbtest = bbtest + " or (gt.limitType = 'pl' and gt.bigBlind in "
|
||||||
|
if potlims:
|
||||||
|
blindtest = str(tuple(potlims))
|
||||||
|
blindtest = blindtest.replace("L", "")
|
||||||
|
blindtest = blindtest.replace(",)",")")
|
||||||
|
bbtest = bbtest + blindtest + ' ) '
|
||||||
|
else:
|
||||||
|
bbtest = bbtest + '(-1) ) '
|
||||||
|
bbtest = bbtest + " or (gt.limitType = 'nl' and gt.bigBlind in "
|
||||||
|
if nolims:
|
||||||
|
blindtest = str(tuple(nolims))
|
||||||
|
blindtest = blindtest.replace("L", "")
|
||||||
|
blindtest = blindtest.replace(",)",")")
|
||||||
|
bbtest = bbtest + blindtest + ' ) )'
|
||||||
|
else:
|
||||||
|
bbtest = bbtest + '(-1) ) )'
|
||||||
|
if type == 'ring':
|
||||||
|
bbtest = bbtest + " and gt.type = 'ring' "
|
||||||
|
elif type == 'tour':
|
||||||
|
bbtest = " and gt.type = 'tour' "
|
||||||
|
query = query.replace("<gtbigBlind_test>", bbtest)
|
||||||
|
|
||||||
|
if holecards: # re-use level variables for hole card query
|
||||||
|
query = query.replace("<hgameTypeId>", "hp.startcards")
|
||||||
|
query = query.replace("<orderbyhgameTypeId>"
|
||||||
|
, ",case when floor((hp.startcards-1)/13) >= mod((hp.startcards-1),13) then hp.startcards + 0.1 "
|
||||||
|
+ " else 13*mod((hp.startcards-1),13) + floor((hp.startcards-1)/13) + 1 "
|
||||||
|
+ " end desc ")
|
||||||
|
else:
|
||||||
|
query = query.replace("<orderbyhgameTypeId>", "")
|
||||||
|
groupLevels = "show" not in str(limits)
|
||||||
|
if groupLevels:
|
||||||
|
query = query.replace("<hgameTypeId>", "p.name") # need to use p.name for sqlite posn stats to work
|
||||||
|
else:
|
||||||
|
query = query.replace("<hgameTypeId>", "h.gameTypeId")
|
||||||
|
|
||||||
|
# process self.detailFilters (a list of tuples)
|
||||||
|
flagtest = ''
|
||||||
|
#self.detailFilters = [('h.seats', 5, 6)] # for debug
|
||||||
|
if self.detailFilters:
|
||||||
|
for f in self.detailFilters:
|
||||||
|
if len(f) == 3:
|
||||||
|
# X between Y and Z
|
||||||
|
flagtest += ' and %s between %s and %s ' % (f[0], str(f[1]), str(f[2]))
|
||||||
|
query = query.replace("<flagtest>", flagtest)
|
||||||
|
|
||||||
|
# allow for differences in sql cast() function:
|
||||||
|
if self.db.backend == self.MYSQL_INNODB:
|
||||||
|
query = query.replace("<signed>", 'signed ')
|
||||||
|
else:
|
||||||
|
query = query.replace("<signed>", '')
|
||||||
|
|
||||||
|
# Filter on dates
|
||||||
|
query = query.replace("<datestest>", " between '" + dates[0] + "' and '" + dates[1] + "'")
|
||||||
|
|
||||||
|
# Group by position?
|
||||||
|
if groups['posn']:
|
||||||
|
#query = query.replace("<position>", "case hp.position when '0' then 'Btn' else hp.position end")
|
||||||
|
query = query.replace("<position>", "hp.position")
|
||||||
|
# set flag in self.columns to show posn column
|
||||||
|
[x for x in self.columns if x[0] == 'plposition'][0][1] = True
|
||||||
|
else:
|
||||||
|
query = query.replace("<position>", "gt.base")
|
||||||
|
# unset flag in self.columns to hide posn column
|
||||||
|
[x for x in self.columns if x[0] == 'plposition'][0][1] = False
|
||||||
|
|
||||||
|
#print "query =\n", query
|
||||||
|
return(query)
|
||||||
|
#end def refineQuery
|
||||||
|
|
||||||
|
def showDetailFilter(self, widget, data):
|
||||||
|
detailDialog = gtk.Dialog(title="Detailed Filters", parent=self.main_window
|
||||||
|
,flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT
|
||||||
|
,buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
|
||||||
|
gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
|
||||||
|
|
||||||
|
handbox = gtk.VBox(True, 0)
|
||||||
|
detailDialog.vbox.pack_start(handbox, False, False, 0)
|
||||||
|
handbox.show()
|
||||||
|
|
||||||
|
label = gtk.Label("Hand Filters:")
|
||||||
|
handbox.add(label)
|
||||||
|
label.show()
|
||||||
|
|
||||||
|
betweenFilters = []
|
||||||
|
for htest in self.handtests:
|
||||||
|
hbox = gtk.HBox(False, 0)
|
||||||
|
handbox.pack_start(hbox, False, False, 0)
|
||||||
|
hbox.show()
|
||||||
|
|
||||||
|
cb = gtk.CheckButton()
|
||||||
|
lbl_from = gtk.Label(htest[1])
|
||||||
|
lbl_from.set_alignment(xalign=0.0, yalign=0.5)
|
||||||
|
lbl_tween = gtk.Label('between')
|
||||||
|
lbl_to = gtk.Label('and')
|
||||||
|
adj1 = gtk.Adjustment(value=htest[2], lower=0, 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=htest[3], lower=2, upper=10, step_incr=1, page_incr=1, page_size=0)
|
||||||
|
sb2 = gtk.SpinButton(adjustment=adj2, climb_rate=0.0, digits=0)
|
||||||
|
|
||||||
|
for df in [x for x in self.detailFilters if x[0] == htest[0]]:
|
||||||
|
cb.set_active(True)
|
||||||
|
|
||||||
|
hbox.pack_start(cb, expand=False, padding=3)
|
||||||
|
hbox.pack_start(lbl_from, expand=True, padding=3)
|
||||||
|
hbox.pack_start(lbl_tween, 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)
|
||||||
|
|
||||||
|
cb.show()
|
||||||
|
lbl_from.show()
|
||||||
|
lbl_tween.show()
|
||||||
|
sb1.show()
|
||||||
|
lbl_to.show()
|
||||||
|
sb2.show()
|
||||||
|
|
||||||
|
htest[4:7] = [cb,sb1,sb2]
|
||||||
|
|
||||||
|
response = detailDialog.run()
|
||||||
|
|
||||||
|
if response == gtk.RESPONSE_ACCEPT:
|
||||||
|
self.detailFilters = []
|
||||||
|
for ht in self.handtests:
|
||||||
|
if ht[4].get_active():
|
||||||
|
self.detailFilters.append( (ht[0], ht[5].get_value_as_int(), ht[6].get_value_as_int()) )
|
||||||
|
ht[2],ht[3] = ht[5].get_value_as_int(), ht[6].get_value_as_int()
|
||||||
|
print "detailFilters =", self.detailFilters
|
||||||
|
self.refreshStats(None, None)
|
||||||
|
|
||||||
|
detailDialog.destroy()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
#Copyright 2008 Steffen Jobbagy-Felso
|
#Copyright 2008-2010 Steffen Schaumburg
|
||||||
#This program is free software: you can redistribute it and/or modify
|
#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
|
#it under the terms of the GNU Affero General Public License as published by
|
||||||
#the Free Software Foundation, version 3 of the License.
|
#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
|
#You should have received a copy of the GNU Affero General Public License
|
||||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#In the "official" distribution you can find the license in
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
#agpl-3.0.txt in the docs folder of the package.
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
|
@ -33,7 +33,7 @@ try:
|
||||||
from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar
|
from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar
|
||||||
from matplotlib.finance import candlestick2
|
from matplotlib.finance import candlestick2
|
||||||
|
|
||||||
from numpy import diff, nonzero, sum, cumsum, max, min
|
from numpy import diff, nonzero, sum, cumsum, max, min, append
|
||||||
# from matplotlib.dates import DateFormatter, WeekdayLocator, HourLocator, \
|
# from matplotlib.dates import DateFormatter, WeekdayLocator, HourLocator, \
|
||||||
# DayLocator, MONDAY, timezone
|
# DayLocator, MONDAY, timezone
|
||||||
|
|
||||||
|
@ -45,8 +45,7 @@ except ImportError, inst:
|
||||||
import Card
|
import Card
|
||||||
import fpdb_import
|
import fpdb_import
|
||||||
import Database
|
import Database
|
||||||
import Filters
|
import RingFilters
|
||||||
import FpdbSQLQueries
|
|
||||||
import Charset
|
import Charset
|
||||||
|
|
||||||
class GuiSessionViewer (threading.Thread):
|
class GuiSessionViewer (threading.Thread):
|
||||||
|
@ -96,7 +95,7 @@ class GuiSessionViewer (threading.Thread):
|
||||||
"Button2" : False
|
"Button2" : False
|
||||||
}
|
}
|
||||||
|
|
||||||
self.filters = Filters.Filters(self.db, self.conf, self.sql, display = filters_display)
|
self.filters = RingFilters.RingFilters(self.db, self.conf, self.sql, display = filters_display)
|
||||||
self.filters.registerButton1Name("_Refresh")
|
self.filters.registerButton1Name("_Refresh")
|
||||||
self.filters.registerButton1Callback(self.refreshStats)
|
self.filters.registerButton1Callback(self.refreshStats)
|
||||||
|
|
||||||
|
@ -184,7 +183,7 @@ class GuiSessionViewer (threading.Thread):
|
||||||
sitenos.append(siteids[site])
|
sitenos.append(siteids[site])
|
||||||
_q = self.sql.query['getPlayerId']
|
_q = self.sql.query['getPlayerId']
|
||||||
_name = Charset.to_utf8(heroes[site])
|
_name = Charset.to_utf8(heroes[site])
|
||||||
print 'DEBUG(_name) :: %s' % _name
|
#print 'DEBUG(_name) :: %s' % _name
|
||||||
self.cursor.execute(_q, (_name,)) # arg = tuple
|
self.cursor.execute(_q, (_name,)) # arg = tuple
|
||||||
result = self.db.cursor.fetchall()
|
result = self.db.cursor.fetchall()
|
||||||
if len(result) == 1:
|
if len(result) == 1:
|
||||||
|
@ -241,6 +240,9 @@ class GuiSessionViewer (threading.Thread):
|
||||||
#end def fillStatsFrame(self, vbox):
|
#end def fillStatsFrame(self, vbox):
|
||||||
|
|
||||||
def generateDatasets(self, playerids, sitenos, limits, seats):
|
def generateDatasets(self, playerids, sitenos, limits, seats):
|
||||||
|
THRESHOLD = 1800 # Minimum number of seconds between consecutive hands before being considered a new session
|
||||||
|
PADDING = 5 # Additional time in minutes to add to a session, session startup, shutdown etc (FiXME: user configurable)
|
||||||
|
|
||||||
# Get a list of all handids and their timestampts
|
# Get a list of all handids and their timestampts
|
||||||
#FIXME: Query still need to filter on blind levels
|
#FIXME: Query still need to filter on blind levels
|
||||||
|
|
||||||
|
@ -255,23 +257,31 @@ class GuiSessionViewer (threading.Thread):
|
||||||
q = q.replace("<ampersand_s>", "%s")
|
q = q.replace("<ampersand_s>", "%s")
|
||||||
|
|
||||||
self.db.cursor.execute(q)
|
self.db.cursor.execute(q)
|
||||||
THRESHOLD = 1800
|
|
||||||
hands = self.db.cursor.fetchall()
|
hands = self.db.cursor.fetchall()
|
||||||
|
|
||||||
# Take that list and create an array of the time between hands
|
# Take that list and create an array of the time between hands
|
||||||
times = map(lambda x:long(x[0]), hands)
|
times = map(lambda x:long(x[0]), hands)
|
||||||
handids = map(lambda x:int(x[1]), hands)
|
handids = map(lambda x:int(x[1]), hands)
|
||||||
winnings = map(lambda x:float(x[4]), hands)
|
winnings = map(lambda x:float(x[4]), hands)
|
||||||
print "DEBUG: len(times) %s" %(len(times))
|
#print "DEBUG: len(times) %s" %(len(times))
|
||||||
diffs = diff(times) # This array is the difference in starttime between consecutive hands
|
diffs = diff(times) # This array is the difference in starttime between consecutive hands
|
||||||
index = nonzero(diff(times) > THRESHOLD) # This array represents the indexes into 'times' for start/end times of sessions
|
diffs2 = append(diffs,THRESHOLD + 1) # Append an additional session to the end of the diffs, so the next line
|
||||||
# ie. times[index[0][0]] is the end of the first session
|
# includes an index into the last 'session'
|
||||||
|
index = nonzero(diffs2 > THRESHOLD) # This array represents the indexes into 'times' for start/end times of sessions
|
||||||
|
# times[index[0][0]] is the end of the first session,
|
||||||
#print "DEBUG: len(index[0]) %s" %(len(index[0]))
|
#print "DEBUG: len(index[0]) %s" %(len(index[0]))
|
||||||
|
if len(index[0]) > 0:
|
||||||
|
#print "DEBUG: index[0][0] %s" %(index[0][0])
|
||||||
|
#print "DEBUG: index %s" %(index)
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
index = [[0]]
|
||||||
#print "DEBUG: index %s" %(index)
|
#print "DEBUG: index %s" %(index)
|
||||||
#print "DEBUG: index[0][0] %s" %(index[0][0])
|
#print "DEBUG: index[0][0] %s" %(index[0][0])
|
||||||
|
pass
|
||||||
|
|
||||||
total = 0
|
total = 0
|
||||||
last_idx = 0
|
first_idx = 0
|
||||||
lowidx = 0
|
lowidx = 0
|
||||||
uppidx = 0
|
uppidx = 0
|
||||||
opens = []
|
opens = []
|
||||||
|
@ -281,27 +291,36 @@ class GuiSessionViewer (threading.Thread):
|
||||||
results = []
|
results = []
|
||||||
cum_sum = cumsum(winnings)
|
cum_sum = cumsum(winnings)
|
||||||
cum_sum = cum_sum/100
|
cum_sum = cum_sum/100
|
||||||
|
sid = 1
|
||||||
# Take all results and format them into a list for feeding into gui model.
|
# Take all results and format them into a list for feeding into gui model.
|
||||||
for i in range(len(index[0])):
|
for i in range(len(index[0])):
|
||||||
sid = i # Session id
|
hds = index[0][i] - first_idx + 1 # Number of hands in session
|
||||||
hds = index[0][i] - last_idx # Number of hands in session
|
|
||||||
if hds > 0:
|
if hds > 0:
|
||||||
stime = strftime("%d/%m/%Y %H:%M", localtime(times[last_idx])) # Formatted start time
|
stime = strftime("%d/%m/%Y %H:%M", localtime(times[first_idx])) # Formatted start time
|
||||||
etime = strftime("%d/%m/%Y %H:%M", localtime(times[index[0][i]])) # Formatted end time
|
etime = strftime("%d/%m/%Y %H:%M", localtime(times[index[0][i]])) # Formatted end time
|
||||||
hph = (times[index[0][i]] - times[last_idx])/60 # Hands per hour
|
minutesplayed = (times[index[0][i]] - times[first_idx])/60
|
||||||
won = sum(winnings[last_idx:index[0][i]])/100.0
|
if minutesplayed == 0:
|
||||||
hwm = max(cum_sum[last_idx:index[0][i]])
|
minutesplayed = 1
|
||||||
lwm = min(cum_sum[last_idx:index[0][i]])
|
minutesplayed = minutesplayed + PADDING
|
||||||
#print "DEBUG: range: (%s, %s) - (min, max): (%s, %s)" %(last_idx, index[0][i], hwm, lwm)
|
hph = hds*60/minutesplayed # Hands per hour
|
||||||
|
won = sum(winnings[first_idx:index[0][i]])/100.0
|
||||||
|
hwm = max(cum_sum[first_idx:index[0][i]])
|
||||||
|
lwm = min(cum_sum[first_idx:index[0][i]])
|
||||||
|
open = (sum(winnings[:first_idx]))/100
|
||||||
|
close = (sum(winnings[:index[0][i]]))/100
|
||||||
|
#print "DEBUG: range: (%s, %s) - (min, max): (%s, %s) - (open,close): (%s, %s)" %(first_idx, index[0][i], lwm, hwm, open, close)
|
||||||
|
|
||||||
results.append([sid, hds, stime, etime, hph, won])
|
results.append([sid, hds, stime, etime, hph, won])
|
||||||
opens.append((sum(winnings[:last_idx]))/100)
|
opens.append(open)
|
||||||
closes.append((sum(winnings[:index[0][i]]))/100)
|
closes.append(close)
|
||||||
highs.append(hwm)
|
highs.append(hwm)
|
||||||
lows.append(lwm)
|
lows.append(lwm)
|
||||||
#print "Hands in session %4s: %4s Start: %s End: %s HPH: %s Profit: %s" %(sid, hds, stime, etime, hph, won)
|
#print "DEBUG: Hands in session %4s: %4s Start: %s End: %s HPH: %s Profit: %s" %(sid, hds, stime, etime, hph, won)
|
||||||
total = total + (index[0][i] - last_idx)
|
total = total + (index[0][i] - first_idx)
|
||||||
last_idx = index[0][i] + 1
|
first_idx = index[0][i] + 1
|
||||||
|
sid = sid+1
|
||||||
|
else:
|
||||||
|
print "hds <= 0"
|
||||||
|
|
||||||
return (results, opens, closes, highs, lows)
|
return (results, opens, closes, highs, lows)
|
||||||
|
|
||||||
|
@ -330,11 +349,6 @@ class GuiSessionViewer (threading.Thread):
|
||||||
def generateGraph(self, opens, closes, highs, lows):
|
def generateGraph(self, opens, closes, highs, lows):
|
||||||
self.clearGraphData()
|
self.clearGraphData()
|
||||||
|
|
||||||
#FIXME: Weird - first data entry is crashing this for me
|
|
||||||
opens = opens[1:]
|
|
||||||
closes = closes[1:]
|
|
||||||
highs = highs[1:]
|
|
||||||
lows = lows[1:]
|
|
||||||
# print "DEBUG:"
|
# print "DEBUG:"
|
||||||
# print "highs = %s" % highs
|
# print "highs = %s" % highs
|
||||||
# print "lows = %s" % lows
|
# print "lows = %s" % lows
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
#Copyright 2008 Steffen Jobbagy-Felso
|
#Copyright 2008-2010 Steffen Schaumburg
|
||||||
#This program is free software: you can redistribute it and/or modify
|
#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
|
#it under the terms of the GNU Affero General Public License as published by
|
||||||
#the Free Software Foundation, version 3 of the License.
|
#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
|
#You should have received a copy of the GNU Affero General Public License
|
||||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#In the "official" distribution you can find the license in
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
#agpl-3.0.txt in the docs folder of the package.
|
|
||||||
|
|
||||||
import threading
|
import threading
|
||||||
import pygtk
|
import pygtk
|
||||||
|
@ -22,7 +22,6 @@ import gtk
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import fpdb_import
|
import fpdb_import
|
||||||
import fpdb_db
|
|
||||||
from Exceptions import *
|
from Exceptions import *
|
||||||
|
|
||||||
|
|
||||||
|
|
455
pyfpdb/GuiTourneyPlayerStats.py
Normal file
455
pyfpdb/GuiTourneyPlayerStats.py
Normal file
|
@ -0,0 +1,455 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
#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.
|
||||||
|
#
|
||||||
|
#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 <http://www.gnu.org/licenses/>.
|
||||||
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
|
|
||||||
|
#import traceback
|
||||||
|
import threading
|
||||||
|
import pygtk
|
||||||
|
pygtk.require('2.0')
|
||||||
|
import gtk
|
||||||
|
#import os
|
||||||
|
#import sys
|
||||||
|
from time import time, strftime
|
||||||
|
|
||||||
|
#import Card
|
||||||
|
#import fpdb_import
|
||||||
|
#import Database
|
||||||
|
import Charset
|
||||||
|
import TourneyFilters
|
||||||
|
import GuiPlayerStats
|
||||||
|
|
||||||
|
colalias,colshow,colheading,colxalign,colformat,coltype = 0,1,2,3,4,5
|
||||||
|
|
||||||
|
class GuiTourneyPlayerStats (GuiPlayerStats.GuiPlayerStats):
|
||||||
|
def __init__(self, config, db, sql, mainwin, debug=True):
|
||||||
|
self.conf = config
|
||||||
|
self.db = db
|
||||||
|
self.cursor = self.db.cursor
|
||||||
|
self.sql = sql
|
||||||
|
self.main_window = mainwin
|
||||||
|
self.debug = debug
|
||||||
|
|
||||||
|
self.liststore = [] # gtk.ListStore[] stores the contents of the grids
|
||||||
|
self.listcols = [] # gtk.TreeViewColumn[][] stores the columns in the grids
|
||||||
|
|
||||||
|
filters_display = { "Heroes" : True,
|
||||||
|
"Sites" : True,
|
||||||
|
#"Games" : True,
|
||||||
|
#"Limits" : True,
|
||||||
|
#"LimitSep" : True,
|
||||||
|
#"LimitType" : True,
|
||||||
|
#"Type" : True,
|
||||||
|
"Seats" : True,
|
||||||
|
#"SeatSep" : True,
|
||||||
|
"Dates" : True,
|
||||||
|
#"Groups" : True,
|
||||||
|
#"GroupsAll" : True,
|
||||||
|
#"Button1" : True,
|
||||||
|
"Button2" : True}
|
||||||
|
|
||||||
|
self.stats_frame = None
|
||||||
|
self.stats_vbox = None
|
||||||
|
self.detailFilters = [] # the data used to enhance the sql select
|
||||||
|
|
||||||
|
self.main_hbox = gtk.HPaned()
|
||||||
|
|
||||||
|
self.filters = TourneyFilters.TourneyFilters(self.db, self.conf, self.sql, display = filters_display)
|
||||||
|
#self.filters.registerButton1Name("_Filters")
|
||||||
|
#self.filters.registerButton1Callback(self.showDetailFilter)
|
||||||
|
self.filters.registerButton2Name("_Refresh Stats")
|
||||||
|
self.filters.registerButton2Callback(self.refreshStats)
|
||||||
|
|
||||||
|
# ToDo: store in config
|
||||||
|
# ToDo: create popup to adjust column config
|
||||||
|
# columns to display, keys match column name returned by sql, values in tuple are:
|
||||||
|
# is column displayed, column heading, xalignment, formatting, celltype
|
||||||
|
self.columns = [ ["siteName", True, "Site", 0.0, "%s", "str"]
|
||||||
|
#,["tourney", False, "Tourney", 0.0, "%s", "str"] # true not allowed for this line
|
||||||
|
, ["currency", True, "Curr.", 0.0, "%s", "str"]
|
||||||
|
, ["buyIn", True, "BuyIn", 1.0, "%3.2f", "str"]
|
||||||
|
, ["fee", True, "Fee", 1.0, "%3.2f", "str"]
|
||||||
|
, ["playerName", False, "Name", 0.0, "%s", "str"] # true not allowed for this line (set in code)
|
||||||
|
, ["tourneyCount", True, "#", 1.0, "%1.0f", "str"]
|
||||||
|
, ["itm", True, "ITM%", 1.0, "%3.2f", "str"]
|
||||||
|
, ["1st", False, "1st", 1.0, "%1.0f", "str"]
|
||||||
|
, ["2nd", True, "2nd", 1.0, "%1.0f", "str"]
|
||||||
|
, ["3rd", True, "3rd", 1.0, "%1.0f", "str"]
|
||||||
|
, ["unknownRank", True, "Rank?", 1.0, "%1.0f", "str"]
|
||||||
|
, ["spent", True, "Spent", 1.0, "%3.2f", "str"]
|
||||||
|
, ["won", True, "Won", 1.0, "%3.2f", "str"]
|
||||||
|
, ["roi", True, "ROI%", 1.0, "%3.0f", "str"]
|
||||||
|
, ["profitPerTourney", True,"$/Tour", 1.0, "%3.2f", "str"]]
|
||||||
|
|
||||||
|
self.stats_frame = gtk.Frame()
|
||||||
|
self.stats_frame.show()
|
||||||
|
|
||||||
|
self.stats_vbox = gtk.VPaned()
|
||||||
|
self.stats_vbox.show()
|
||||||
|
self.stats_frame.add(self.stats_vbox)
|
||||||
|
# self.fillStatsFrame(self.stats_vbox)
|
||||||
|
|
||||||
|
#self.main_hbox.pack_start(self.filters.get_vbox())
|
||||||
|
#self.main_hbox.pack_start(self.stats_frame, expand=True, fill=True)
|
||||||
|
self.main_hbox.pack1(self.filters.get_vbox())
|
||||||
|
self.main_hbox.pack2(self.stats_frame)
|
||||||
|
self.main_hbox.show()
|
||||||
|
#end def __init__
|
||||||
|
|
||||||
|
def addGrid(self, vbox, query, numTourneys, tourneyTypes, playerids, sitenos, seats, dates):
|
||||||
|
#print "start of addGrid query", query
|
||||||
|
#print "start of addGrid. numTourneys:",numTourneys,"tourneyTypes:", tourneyTypes, "playerids:",playerids
|
||||||
|
counter = 0
|
||||||
|
row = 0
|
||||||
|
sqlrow = 0
|
||||||
|
grid=numTourneys #TODO: should this be numTourneyTypes?
|
||||||
|
|
||||||
|
query = self.sql.query[query]
|
||||||
|
query = self.refineQuery(query, numTourneys, tourneyTypes, playerids, sitenos, seats, dates)
|
||||||
|
self.cursor.execute(query)
|
||||||
|
result = self.cursor.fetchall()
|
||||||
|
#print "result of the big query in addGrid:",result
|
||||||
|
colnames = [desc[0] for desc in self.cursor.description]
|
||||||
|
|
||||||
|
# pre-fetch some constant values:
|
||||||
|
#self.cols_to_show = [x for x in self.columns if x[colshow]]
|
||||||
|
#htourneytypeid_idx = colnames.index('tourneyTypeId')
|
||||||
|
self.cols_to_show = self.columns #TODO do i need above 2 lines?
|
||||||
|
|
||||||
|
assert len(self.liststore) == grid, "len(self.liststore)="+str(len(self.liststore))+" grid-1="+str(grid)
|
||||||
|
self.liststore.append( gtk.ListStore(*([str] * len(self.cols_to_show))) )
|
||||||
|
view = gtk.TreeView(model=self.liststore[grid])
|
||||||
|
view.set_grid_lines(gtk.TREE_VIEW_GRID_LINES_BOTH)
|
||||||
|
#vbox.pack_start(view, expand=False, padding=3)
|
||||||
|
vbox.add(view)
|
||||||
|
textcell = gtk.CellRendererText()
|
||||||
|
textcell50 = gtk.CellRendererText()
|
||||||
|
textcell50.set_property('xalign', 0.5)
|
||||||
|
numcell = gtk.CellRendererText()
|
||||||
|
numcell.set_property('xalign', 1.0)
|
||||||
|
assert len(self.listcols) == grid
|
||||||
|
self.listcols.append( [] )
|
||||||
|
|
||||||
|
# Create header row eg column: ("game", True, "Game", 0.0, "%s")
|
||||||
|
for col, column in enumerate(self.cols_to_show):
|
||||||
|
if column[colalias] == 'game' and holecards:
|
||||||
|
s = [x for x in self.columns if x[colalias] == 'hand'][0][colheading]
|
||||||
|
else:
|
||||||
|
s = column[colheading]
|
||||||
|
self.listcols[grid].append(gtk.TreeViewColumn(s))
|
||||||
|
view.append_column(self.listcols[grid][col])
|
||||||
|
if column[colformat] == '%s':
|
||||||
|
if column[colxalign] == 0.0:
|
||||||
|
self.listcols[grid][col].pack_start(textcell, expand=True)
|
||||||
|
self.listcols[grid][col].add_attribute(textcell, 'text', col)
|
||||||
|
cellrend = textcell
|
||||||
|
else:
|
||||||
|
self.listcols[grid][col].pack_start(textcell50, expand=True)
|
||||||
|
self.listcols[grid][col].add_attribute(textcell50, 'text', col)
|
||||||
|
cellrend = textcell50
|
||||||
|
self.listcols[grid][col].set_expand(True)
|
||||||
|
else:
|
||||||
|
self.listcols[grid][col].pack_start(numcell, expand=True)
|
||||||
|
self.listcols[grid][col].add_attribute(numcell, 'text', col)
|
||||||
|
self.listcols[grid][col].set_expand(True)
|
||||||
|
cellrend = numcell
|
||||||
|
#self.listcols[grid][col].set_alignment(column[colxalign]) # no effect?
|
||||||
|
self.listcols[grid][col].set_clickable(True)
|
||||||
|
self.listcols[grid][col].connect("clicked", self.sortCols, (col,grid))
|
||||||
|
if col == 0:
|
||||||
|
self.listcols[grid][col].set_sort_order(gtk.SORT_DESCENDING)
|
||||||
|
self.listcols[grid][col].set_sort_indicator(True)
|
||||||
|
if column[coltype] == 'cash':
|
||||||
|
self.listcols[grid][col].set_cell_data_func(numcell, self.ledger_style_render_func)
|
||||||
|
else:
|
||||||
|
self.listcols[grid][col].set_cell_data_func(cellrend, self.reset_style_render_func)
|
||||||
|
|
||||||
|
rows = len(result) # +1 for title row
|
||||||
|
|
||||||
|
while sqlrow < rows:
|
||||||
|
treerow = []
|
||||||
|
for col,column in enumerate(self.cols_to_show):
|
||||||
|
if column[colalias] in colnames:
|
||||||
|
value = result[sqlrow][colnames.index(column[colalias])]
|
||||||
|
else:
|
||||||
|
value = 111
|
||||||
|
if value and value != -999:
|
||||||
|
treerow.append(column[colformat] % value)
|
||||||
|
else:
|
||||||
|
treerow.append(' ')
|
||||||
|
#print "addGrid, just before end of big for. grid:",grid,"treerow:",treerow
|
||||||
|
iter = self.liststore[grid].append(treerow)
|
||||||
|
sqlrow += 1
|
||||||
|
row += 1
|
||||||
|
vbox.show_all()
|
||||||
|
#end def addGrid
|
||||||
|
|
||||||
|
def createStatsTable(self, vbox, tourneyTypes, playerids, sitenos, seats, dates):
|
||||||
|
startTime = time()
|
||||||
|
show_detail = True
|
||||||
|
|
||||||
|
# Scrolled window for summary table
|
||||||
|
swin = gtk.ScrolledWindow(hadjustment=None, vadjustment=None)
|
||||||
|
swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
||||||
|
swin.show()
|
||||||
|
vbox.pack1(swin)
|
||||||
|
|
||||||
|
numTourneys = self.filters.getNumTourneys()
|
||||||
|
self.addGrid(swin, 'tourneyPlayerDetailedStats', numTourneys, tourneyTypes, playerids
|
||||||
|
,sitenos, seats, dates)
|
||||||
|
|
||||||
|
#if 'allplayers' in groups and groups['allplayers']:
|
||||||
|
# can't currently do this combination so skip detailed table
|
||||||
|
show_detail = False
|
||||||
|
|
||||||
|
if show_detail:
|
||||||
|
# Separator
|
||||||
|
vbox2 = gtk.VBox(False, 0)
|
||||||
|
heading = gtk.Label(self.filterText['handhead'])
|
||||||
|
heading.show()
|
||||||
|
vbox2.pack_start(heading, expand=False, padding=3)
|
||||||
|
|
||||||
|
# Scrolled window for detailed table (display by hand)
|
||||||
|
swin = gtk.ScrolledWindow(hadjustment=None, vadjustment=None)
|
||||||
|
swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
||||||
|
swin.show()
|
||||||
|
vbox2.pack_start(swin, expand=True, padding=3)
|
||||||
|
vbox.pack2(vbox2)
|
||||||
|
vbox2.show()
|
||||||
|
|
||||||
|
# Detailed table
|
||||||
|
flags[0] = True
|
||||||
|
flags[2] = 1
|
||||||
|
self.addGrid(swin, 'playerDetailedStats', flags, playerids, sitenos, seats, dates)
|
||||||
|
|
||||||
|
self.db.rollback()
|
||||||
|
print "Stats page displayed in %4.2f seconds" % (time() - startTime)
|
||||||
|
#end def createStatsTable
|
||||||
|
|
||||||
|
def fillStatsFrame(self, vbox):
|
||||||
|
tourneyTypes = self.filters.getTourneyTypes()
|
||||||
|
#tourneys = self.tourneys.getTourneys()
|
||||||
|
sites = self.filters.getSites()
|
||||||
|
heroes = self.filters.getHeroes()
|
||||||
|
siteids = self.filters.getSiteIds()
|
||||||
|
seats = self.filters.getSeats()
|
||||||
|
dates = self.filters.getDates()
|
||||||
|
sitenos = []
|
||||||
|
playerids = []
|
||||||
|
|
||||||
|
# Which sites are selected?
|
||||||
|
for site in sites:
|
||||||
|
if sites[site] == True:
|
||||||
|
sitenos.append(siteids[site])
|
||||||
|
_hname = Charset.to_utf8(heroes[site])
|
||||||
|
result = self.db.get_player_id(self.conf, site, _hname)
|
||||||
|
if result is not None:
|
||||||
|
playerids.append(int(result))
|
||||||
|
|
||||||
|
if not sitenos:
|
||||||
|
#Should probably pop up here.
|
||||||
|
print "No sites selected - defaulting to PokerStars"
|
||||||
|
sitenos = [2]
|
||||||
|
if not playerids:
|
||||||
|
print "No player ids found"
|
||||||
|
return
|
||||||
|
|
||||||
|
self.createStatsTable(vbox, tourneyTypes, playerids, sitenos, seats, dates)
|
||||||
|
#end def fillStatsFrame
|
||||||
|
|
||||||
|
def get_vbox(self):
|
||||||
|
"""returns the vbox of this thread"""
|
||||||
|
return self.main_hbox
|
||||||
|
#end def get_vbox
|
||||||
|
|
||||||
|
def refineQuery(self, query, numTourneys, tourneyTypes, playerids, sitenos, seats, dates):
|
||||||
|
having = ''
|
||||||
|
|
||||||
|
#print "start of refinequery, playerids:",playerids
|
||||||
|
if playerids:
|
||||||
|
nametest = str(tuple(playerids))
|
||||||
|
nametest = nametest.replace("L", "")
|
||||||
|
nametest = nametest.replace(",)",")")
|
||||||
|
else:
|
||||||
|
nametest = "1 = 2"
|
||||||
|
#print "refinequery, nametest after initial creation:",nametest
|
||||||
|
pname = "p.name"
|
||||||
|
# set flag in self.columns to not show player name column
|
||||||
|
#[x for x in self.columns if x[0] == 'pname'][0][1] = False #TODO: fix and reactivate
|
||||||
|
|
||||||
|
query = query.replace("<nametest>", nametest)
|
||||||
|
query = query.replace("<playerName>", pname)
|
||||||
|
query = query.replace("<havingclause>", having)
|
||||||
|
|
||||||
|
#TODO: remove, or replace with tourneytest
|
||||||
|
#gametest = ""
|
||||||
|
#q = []
|
||||||
|
#for m in self.filters.display.items():
|
||||||
|
# if m[0] == 'Games' and m[1]:
|
||||||
|
# for n in games:
|
||||||
|
# if games[n]:
|
||||||
|
# q.append(n)
|
||||||
|
# if len(q) > 0:
|
||||||
|
# gametest = str(tuple(q))
|
||||||
|
# gametest = gametest.replace("L", "")
|
||||||
|
# gametest = gametest.replace(",)",")")
|
||||||
|
# gametest = gametest.replace("u'","'")
|
||||||
|
# gametest = "and gt.category in %s" % gametest
|
||||||
|
# else:
|
||||||
|
# gametest = "and gt.category IS NULL"
|
||||||
|
#query = query.replace("<game_test>", gametest)
|
||||||
|
|
||||||
|
sitetest = ""
|
||||||
|
q = []
|
||||||
|
for m in self.filters.display.items():
|
||||||
|
if m[0] == 'Sites' and m[1]:
|
||||||
|
for n in sitenos:
|
||||||
|
q.append(n)
|
||||||
|
if len(q) > 0:
|
||||||
|
sitetest = str(tuple(q))
|
||||||
|
sitetest = sitetest.replace("L", "")
|
||||||
|
sitetest = sitetest.replace(",)",")")
|
||||||
|
sitetest = sitetest.replace("u'","'")
|
||||||
|
sitetest = "and tt.siteId in %s" % sitetest#[1:-1]
|
||||||
|
else:
|
||||||
|
sitetest = "and tt.siteId IS NULL"
|
||||||
|
#print "refinequery, sitetest before its use for replacement:",sitetest
|
||||||
|
query = query.replace("<sitetest>", sitetest)
|
||||||
|
|
||||||
|
if seats:
|
||||||
|
query = query.replace('<seats_test>', 'between ' + str(seats['from']) + ' and ' + str(seats['to']))
|
||||||
|
if 'show' in seats and seats['show']:
|
||||||
|
query = query.replace('<groupbyseats>', ',h.seats')
|
||||||
|
query = query.replace('<orderbyseats>', ',h.seats')
|
||||||
|
else:
|
||||||
|
query = query.replace('<groupbyseats>', '')
|
||||||
|
query = query.replace('<orderbyseats>', '')
|
||||||
|
else:
|
||||||
|
query = query.replace('<seats_test>', 'between 0 and 100')
|
||||||
|
query = query.replace('<groupbyseats>', '')
|
||||||
|
query = query.replace('<orderbyseats>', '')
|
||||||
|
|
||||||
|
#lims = [int(x) for x in limits if x.isdigit()]
|
||||||
|
#potlims = [int(x[0:-2]) for x in limits if len(x) > 2 and x[-2:] == 'pl']
|
||||||
|
#nolims = [int(x[0:-2]) for x in limits if len(x) > 2 and x[-2:] == 'nl']
|
||||||
|
#bbtest = "and ( (gt.limitType = 'fl' and gt.bigBlind in "
|
||||||
|
# and ( (limit and bb in()) or (nolimit and bb in ()) )
|
||||||
|
#if lims:
|
||||||
|
# blindtest = str(tuple(lims))
|
||||||
|
# blindtest = blindtest.replace("L", "")
|
||||||
|
# blindtest = blindtest.replace(",)",")")
|
||||||
|
# bbtest = bbtest + blindtest + ' ) '
|
||||||
|
#else:
|
||||||
|
# bbtest = bbtest + '(-1) ) '
|
||||||
|
#bbtest = bbtest + " or (gt.limitType = 'pl' and gt.bigBlind in "
|
||||||
|
#if potlims:
|
||||||
|
# blindtest = str(tuple(potlims))
|
||||||
|
# blindtest = blindtest.replace("L", "")
|
||||||
|
# blindtest = blindtest.replace(",)",")")
|
||||||
|
# bbtest = bbtest + blindtest + ' ) '
|
||||||
|
#else:
|
||||||
|
# bbtest = bbtest + '(-1) ) '
|
||||||
|
#bbtest = bbtest + " or (gt.limitType = 'nl' and gt.bigBlind in "
|
||||||
|
#if nolims:
|
||||||
|
# blindtest = str(tuple(nolims))
|
||||||
|
# blindtest = blindtest.replace("L", "")
|
||||||
|
# blindtest = blindtest.replace(",)",")")
|
||||||
|
# bbtest = bbtest + blindtest + ' ) )'
|
||||||
|
#else:
|
||||||
|
# bbtest = bbtest + '(-1) ) )'
|
||||||
|
|
||||||
|
#if type == 'ring':
|
||||||
|
# bbtest = bbtest + " and gt.type = 'ring' "
|
||||||
|
#elif type == 'tour':
|
||||||
|
#bbtest = " and gt.type = 'tour' "
|
||||||
|
|
||||||
|
#query = query.replace("<gtbigBlind_test>", bbtest)
|
||||||
|
|
||||||
|
#query = query.replace("<orderbyhgameTypeId>", "")
|
||||||
|
|
||||||
|
# process self.detailFilters (a list of tuples)
|
||||||
|
flagtest = ''
|
||||||
|
#self.detailFilters = [('h.seats', 5, 6)] # for debug
|
||||||
|
if self.detailFilters:
|
||||||
|
for f in self.detailFilters:
|
||||||
|
if len(f) == 3:
|
||||||
|
# X between Y and Z
|
||||||
|
flagtest += ' and %s between %s and %s ' % (f[0], str(f[1]), str(f[2]))
|
||||||
|
query = query.replace("<flagtest>", flagtest)
|
||||||
|
|
||||||
|
# allow for differences in sql cast() function:
|
||||||
|
if self.db.backend == self.db.MYSQL_INNODB:
|
||||||
|
query = query.replace("<signed>", 'signed ')
|
||||||
|
else:
|
||||||
|
query = query.replace("<signed>", '')
|
||||||
|
|
||||||
|
# Filter on dates
|
||||||
|
query = query.replace("<datestest>", " between '" + dates[0] + "' and '" + dates[1] + "'")
|
||||||
|
|
||||||
|
# Group by position?
|
||||||
|
#if groups['posn']:
|
||||||
|
# #query = query.replace("<position>", "case hp.position when '0' then 'Btn' else hp.position end")
|
||||||
|
# query = query.replace("<position>", "hp.position")
|
||||||
|
# # set flag in self.columns to show posn column
|
||||||
|
# [x for x in self.columns if x[0] == 'plposition'][0][1] = True
|
||||||
|
#else:
|
||||||
|
# query = query.replace("<position>", "gt.base")
|
||||||
|
# # unset flag in self.columns to hide posn column
|
||||||
|
# [x for x in self.columns if x[0] == 'plposition'][0][1] = False
|
||||||
|
|
||||||
|
#print "query at end of refine query:", query
|
||||||
|
return(query)
|
||||||
|
#end def refineQuery
|
||||||
|
|
||||||
|
def refreshStats(self, widget, data):
|
||||||
|
self.last_pos = self.stats_vbox.get_position()
|
||||||
|
try: self.stats_vbox.destroy()
|
||||||
|
except AttributeError: pass
|
||||||
|
self.liststore = []
|
||||||
|
self.listcols = []
|
||||||
|
#self.stats_vbox = gtk.VBox(False, 0)
|
||||||
|
self.stats_vbox = gtk.VPaned()
|
||||||
|
self.stats_vbox.show()
|
||||||
|
self.stats_frame.add(self.stats_vbox)
|
||||||
|
self.fillStatsFrame(self.stats_vbox)
|
||||||
|
if self.last_pos > 0:
|
||||||
|
self.stats_vbox.set_position(self.last_pos)
|
||||||
|
#end def refreshStats
|
||||||
|
|
||||||
|
def reset_style_render_func(self, treeviewcolumn, cell, model, iter):
|
||||||
|
cell.set_property('foreground', 'black')
|
||||||
|
#end def reset_style_render_func
|
||||||
|
|
||||||
|
def sortCols(self, col, nums):
|
||||||
|
try:
|
||||||
|
#This doesn't actually work yet - clicking heading in top section sorts bottom section :-(
|
||||||
|
(n, grid) = nums
|
||||||
|
if not col.get_sort_indicator() or col.get_sort_order() == gtk.SORT_ASCENDING:
|
||||||
|
col.set_sort_order(gtk.SORT_DESCENDING)
|
||||||
|
else:
|
||||||
|
col.set_sort_order(gtk.SORT_ASCENDING)
|
||||||
|
self.liststore[grid].set_sort_column_id(n, col.get_sort_order())
|
||||||
|
self.liststore[grid].set_sort_func(n, self.sortnums, (n,grid))
|
||||||
|
for i in xrange(len(self.listcols[grid])):
|
||||||
|
self.listcols[grid][i].set_sort_indicator(False)
|
||||||
|
self.listcols[grid][n].set_sort_indicator(True)
|
||||||
|
# use this listcols[col].set_sort_indicator(True)
|
||||||
|
# to turn indicator off for other cols
|
||||||
|
except:
|
||||||
|
err = traceback.extract_tb(sys.exc_info()[2])
|
||||||
|
print "***sortCols error: " + str(sys.exc_info()[1])
|
||||||
|
print "\n".join( [e[0]+':'+str(e[1])+" "+e[2] for e in err] )
|
||||||
|
#end def sortCols
|
||||||
|
#end class GuiTourneyPlayerStats
|
|
@ -508,6 +508,9 @@ Left-Drag to Move"
|
||||||
<pu_stat pu_stat_name="a_freq2"> </pu_stat>
|
<pu_stat pu_stat_name="a_freq2"> </pu_stat>
|
||||||
<pu_stat pu_stat_name="a_freq3"> </pu_stat>
|
<pu_stat pu_stat_name="a_freq3"> </pu_stat>
|
||||||
<pu_stat pu_stat_name="a_freq4"> </pu_stat>
|
<pu_stat pu_stat_name="a_freq4"> </pu_stat>
|
||||||
|
<pu_stat pu_stat_name="agg_freq"> </pu_stat>
|
||||||
|
<pu_stat pu_stat_name="agg_fact"> </pu_stat>
|
||||||
|
<pu_stat pu_stat_name="cbet"> </pu_stat>
|
||||||
<pu_stat pu_stat_name="cb1"> </pu_stat>
|
<pu_stat pu_stat_name="cb1"> </pu_stat>
|
||||||
<pu_stat pu_stat_name="cb2"> </pu_stat>
|
<pu_stat pu_stat_name="cb2"> </pu_stat>
|
||||||
<pu_stat pu_stat_name="cb3"> </pu_stat>
|
<pu_stat pu_stat_name="cb3"> </pu_stat>
|
||||||
|
|
|
@ -2,6 +2,13 @@
|
||||||
|
|
||||||
<FreePokerToolsConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FreePokerToolsConfig.xsd">
|
<FreePokerToolsConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FreePokerToolsConfig.xsd">
|
||||||
|
|
||||||
|
<!-- config_wrap_len is preferred max line length in this file, -1 means no max
|
||||||
|
day_start is time that logical day starts, e.g. 5 means that any play
|
||||||
|
between 00:00 and 04:59:59 counts as being on the previous day -->
|
||||||
|
<general config_wrap_len="-1"
|
||||||
|
day_start="5"
|
||||||
|
/>
|
||||||
|
|
||||||
<import callFpdbHud = "True" interval = "10" fastStoreHudCache="False" hhArchiveBase="~/.fpdb/HandHistories/" saveActions="True"></import>
|
<import callFpdbHud = "True" interval = "10" fastStoreHudCache="False" hhArchiveBase="~/.fpdb/HandHistories/" saveActions="True"></import>
|
||||||
|
|
||||||
<!-- These values determine what stats are displayed in the HUD
|
<!-- These values determine what stats are displayed in the HUD
|
||||||
|
@ -114,6 +121,10 @@ Left-Drag to Move"
|
||||||
hudopacity="1.0"
|
hudopacity="1.0"
|
||||||
font="Sans"
|
font="Sans"
|
||||||
font_size="8"
|
font_size="8"
|
||||||
|
xpad="1"
|
||||||
|
ypad="0"
|
||||||
|
xshift="0"
|
||||||
|
yshift="0"
|
||||||
supported_games="holdem,razz,omahahi,omahahilo,studhi,studhilo">
|
supported_games="holdem,razz,omahahi,omahahilo,studhi,studhilo">
|
||||||
<layout max="8" width="792" height="546" fav_seat="0">
|
<layout max="8" width="792" height="546" fav_seat="0">
|
||||||
<location seat="1" x="684" y="61"> </location>
|
<location seat="1" x="684" y="61"> </location>
|
||||||
|
@ -559,6 +570,9 @@ Left-Drag to Move"
|
||||||
<pu_stat pu_stat_name="a_freq2"> </pu_stat>
|
<pu_stat pu_stat_name="a_freq2"> </pu_stat>
|
||||||
<pu_stat pu_stat_name="a_freq3"> </pu_stat>
|
<pu_stat pu_stat_name="a_freq3"> </pu_stat>
|
||||||
<pu_stat pu_stat_name="a_freq4"> </pu_stat>
|
<pu_stat pu_stat_name="a_freq4"> </pu_stat>
|
||||||
|
<pu_stat pu_stat_name="agg_freq"> </pu_stat>
|
||||||
|
<pu_stat pu_stat_name="agg_fact"> </pu_stat>
|
||||||
|
<pu_stat pu_stat_name="cbet"> </pu_stat>
|
||||||
<pu_stat pu_stat_name="cb1"> </pu_stat>
|
<pu_stat pu_stat_name="cb1"> </pu_stat>
|
||||||
<pu_stat pu_stat_name="cb2"> </pu_stat>
|
<pu_stat pu_stat_name="cb2"> </pu_stat>
|
||||||
<pu_stat pu_stat_name="cb3"> </pu_stat>
|
<pu_stat pu_stat_name="cb3"> </pu_stat>
|
||||||
|
@ -630,5 +644,9 @@ Left-Drag to Move"
|
||||||
<database db_ip="localhost" db_server="sqlite" db_name="fpdb.db3" db_user="fpdb" db_pass="fpdb"/>
|
<database db_ip="localhost" db_server="sqlite" db_name="fpdb.db3" db_user="fpdb" db_pass="fpdb"/>
|
||||||
</supported_databases>
|
</supported_databases>
|
||||||
|
|
||||||
|
<email>
|
||||||
|
<email host="YOUR_EMAIL_SERVER" username="YOUR_EMAIL_USERNAME" password="YOUR_EMAIL_PASSWORD" useSsl="True" folder="INBOX"/>
|
||||||
|
</email>
|
||||||
</FreePokerToolsConfig>
|
</FreePokerToolsConfig>
|
||||||
|
<!-- IMPORTANT: Please note that fpdb stores your email password in clear text.
|
||||||
|
So do not post a config containing a password on the Internet or anywhere else without removing the password! -->
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""Hud_main.py
|
# Copyright 2008-2010, Ray E. Barker
|
||||||
|
|
||||||
Main for FreePokerTools HUD.
|
|
||||||
"""
|
|
||||||
# Copyright 2008, 2009, Ray E. Barker
|
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -22,10 +19,14 @@ Main for FreePokerTools HUD.
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
# to do allow window resizing
|
"""Hud_main.py
|
||||||
# to do hud to echo, but ignore non numbers
|
|
||||||
# to do no stat window for hero
|
Main for FreePokerTools HUD.
|
||||||
# to do things to add to config.xml
|
"""
|
||||||
|
# TODO allow window resizing
|
||||||
|
# TODO hud to echo, but ignore non numbers
|
||||||
|
# TODO no stat window for hero
|
||||||
|
# TODO things to add to config.xml
|
||||||
|
|
||||||
# Standard Library modules
|
# Standard Library modules
|
||||||
import sys
|
import sys
|
|
@ -1,4 +1,20 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
#Copyright 2009-2010 Eric Blade
|
||||||
|
#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 <http://www.gnu.org/licenses/>.
|
||||||
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import thread
|
import thread
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
#Copyright 2008 Carl Gherardi
|
#Copyright 2008-2010 Carl Gherardi
|
||||||
#This program is free software: you can redistribute it and/or modify
|
#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
|
#it under the terms of the GNU Affero General Public License as published by
|
||||||
#the Free Software Foundation, version 3 of the License.
|
#the Free Software Foundation, version 3 of the License.
|
||||||
|
@ -13,8 +13,7 @@
|
||||||
#
|
#
|
||||||
#You should have received a copy of the GNU Affero General Public License
|
#You should have received a copy of the GNU Affero General Public License
|
||||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#In the "official" distribution you can find the license in
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
#agpl-3.0.txt in the docs folder of the package.
|
|
||||||
|
|
||||||
# TODO: get writehand() encoding correct
|
# TODO: get writehand() encoding correct
|
||||||
|
|
||||||
|
@ -39,7 +38,6 @@ from Exceptions import *
|
||||||
import DerivedStats
|
import DerivedStats
|
||||||
import Card
|
import Card
|
||||||
|
|
||||||
|
|
||||||
class Hand(object):
|
class Hand(object):
|
||||||
|
|
||||||
###############################################################3
|
###############################################################3
|
||||||
|
@ -58,7 +56,7 @@ class Hand(object):
|
||||||
self.siteId = self.SITEIDS[sitename]
|
self.siteId = self.SITEIDS[sitename]
|
||||||
self.stats = DerivedStats.DerivedStats(self)
|
self.stats = DerivedStats.DerivedStats(self)
|
||||||
self.gametype = gametype
|
self.gametype = gametype
|
||||||
self.starttime = 0
|
self.startTime = 0
|
||||||
self.handText = handText
|
self.handText = handText
|
||||||
self.handid = 0
|
self.handid = 0
|
||||||
self.cancelled = False
|
self.cancelled = False
|
||||||
|
@ -70,16 +68,21 @@ class Hand(object):
|
||||||
self.maxseats = None
|
self.maxseats = None
|
||||||
self.counted_seats = 0
|
self.counted_seats = 0
|
||||||
self.buttonpos = 0
|
self.buttonpos = 0
|
||||||
|
|
||||||
|
#tourney stuff
|
||||||
self.tourNo = None
|
self.tourNo = None
|
||||||
|
self.tourneyId = None
|
||||||
|
self.tourneyTypeId = None
|
||||||
self.buyin = None
|
self.buyin = None
|
||||||
|
self.buyinCurrency = None
|
||||||
|
self.buyInChips = None
|
||||||
self.fee = None # the Database code is looking for this one .. ?
|
self.fee = None # the Database code is looking for this one .. ?
|
||||||
self.level = None
|
self.level = None
|
||||||
self.mixed = None
|
self.mixed = None
|
||||||
# Some attributes for hand from a tourney
|
|
||||||
self.speed = "Normal"
|
self.speed = "Normal"
|
||||||
self.isRebuy = False
|
self.isRebuy = False
|
||||||
|
self.isAddOn = False
|
||||||
self.isKO = False
|
self.isKO = False
|
||||||
self.isHU = False
|
|
||||||
self.isMatrix = False
|
self.isMatrix = False
|
||||||
self.isShootout = False
|
self.isShootout = False
|
||||||
self.tourneyComment = None
|
self.tourneyComment = None
|
||||||
|
@ -87,6 +90,7 @@ class Hand(object):
|
||||||
self.seating = []
|
self.seating = []
|
||||||
self.players = []
|
self.players = []
|
||||||
self.posted = []
|
self.posted = []
|
||||||
|
self.tourneysPlayersIds = []
|
||||||
|
|
||||||
# Collections indexed by street names
|
# Collections indexed by street names
|
||||||
self.bets = {}
|
self.bets = {}
|
||||||
|
@ -136,8 +140,6 @@ class Hand(object):
|
||||||
("TABLE NAME", self.tablename),
|
("TABLE NAME", self.tablename),
|
||||||
("HERO", self.hero),
|
("HERO", self.hero),
|
||||||
("MAXSEATS", self.maxseats),
|
("MAXSEATS", self.maxseats),
|
||||||
("TOURNAMENT NO", self.tourNo),
|
|
||||||
("BUYIN", self.buyin),
|
|
||||||
("LEVEL", self.level),
|
("LEVEL", self.level),
|
||||||
("MIXED", self.mixed),
|
("MIXED", self.mixed),
|
||||||
("LASTBET", self.lastBet),
|
("LASTBET", self.lastBet),
|
||||||
|
@ -153,7 +155,20 @@ class Hand(object):
|
||||||
("TOTAL POT", self.totalpot),
|
("TOTAL POT", self.totalpot),
|
||||||
("TOTAL COLLECTED", self.totalcollected),
|
("TOTAL COLLECTED", self.totalcollected),
|
||||||
("RAKE", self.rake),
|
("RAKE", self.rake),
|
||||||
("START TIME", self.starttime),
|
("START TIME", self.startTime),
|
||||||
|
("TOURNAMENT NO", self.tourNo),
|
||||||
|
("TOURNEY ID", self.tourneyId),
|
||||||
|
("TOURNEY TYPE ID", self.tourneyTypeId),
|
||||||
|
("BUYIN", self.buyin),
|
||||||
|
("BUYIN CURRENCY", self.buyinCurrency),
|
||||||
|
("BUYIN CHIPS", self.buyInChips),
|
||||||
|
("FEE", self.fee),
|
||||||
|
("IS REBUY", self.isRebuy),
|
||||||
|
("IS ADDON", self.isAddOn),
|
||||||
|
("IS KO", self.isKO),
|
||||||
|
("IS MATRIX", self.isMatrix),
|
||||||
|
("IS SHOOTOUT", self.isShootout),
|
||||||
|
("TOURNEY COMMENT", self.tourneyComment),
|
||||||
)
|
)
|
||||||
|
|
||||||
structs = ( ("PLAYERS", self.players),
|
structs = ( ("PLAYERS", self.players),
|
||||||
|
@ -168,6 +183,7 @@ class Hand(object):
|
||||||
("BOARD", self.board),
|
("BOARD", self.board),
|
||||||
("DISCARDS", self.discards),
|
("DISCARDS", self.discards),
|
||||||
("HOLECARDS", self.holecards),
|
("HOLECARDS", self.holecards),
|
||||||
|
("TOURNEYS PLAYER IDS", self.tourneysPlayersIds),
|
||||||
)
|
)
|
||||||
str = ''
|
str = ''
|
||||||
for (name, var) in vars:
|
for (name, var) in vars:
|
||||||
|
@ -210,6 +226,15 @@ dealt whether they were seen in a 'dealt to' line
|
||||||
#Gametypes
|
#Gametypes
|
||||||
self.dbid_gt = db.getGameTypeId(self.siteId, self.gametype)
|
self.dbid_gt = db.getGameTypeId(self.siteId, self.gametype)
|
||||||
|
|
||||||
|
if self.tourNo!=None:
|
||||||
|
self.tourneyTypeId = db.createOrUpdateTourneyType(self)
|
||||||
|
db.commit()
|
||||||
|
self.tourneyId = db.createOrUpdateTourney(self, "HHC")
|
||||||
|
db.commit()
|
||||||
|
self.tourneysPlayersIds = db.createOrUpdateTourneysPlayers(self, "HHC")
|
||||||
|
db.commit()
|
||||||
|
#end def prepInsert
|
||||||
|
|
||||||
def insert(self, db):
|
def insert(self, db):
|
||||||
""" Function to insert Hand into database
|
""" Function to insert Hand into database
|
||||||
Should not commit, and do minimal selects. Callers may want to cache commits
|
Should not commit, and do minimal selects. Callers may want to cache commits
|
||||||
|
@ -231,17 +256,15 @@ db: a connected Database object"""
|
||||||
|
|
||||||
self.dbid_hands = db.storeHand(hh)
|
self.dbid_hands = db.storeHand(hh)
|
||||||
db.storeHandsPlayers(self.dbid_hands, self.dbid_pids, self.stats.getHandsPlayers())
|
db.storeHandsPlayers(self.dbid_hands, self.dbid_pids, self.stats.getHandsPlayers())
|
||||||
# HandsActions - all actions for all players for all streets - self.actions
|
# TODO HandsActions - all actions for all players for all streets - self.actions
|
||||||
# HudCache data can be generated from HandsActions (HandsPlayers?)
|
# HudCache data can be generated from HandsActions (HandsPlayers?)
|
||||||
# Tourneys ?
|
|
||||||
# TourneysPlayers
|
|
||||||
else:
|
else:
|
||||||
log.info("Hand.insert(): hid #: %s is a duplicate" % hh['siteHandNo'])
|
log.info("Hand.insert(): hid #: %s is a duplicate" % hh['siteHandNo'])
|
||||||
self.is_duplicate = True # i.e. don't update hudcache
|
self.is_duplicate = True # i.e. don't update hudcache
|
||||||
raise FpdbHandDuplicate(hh['siteHandNo'])
|
raise FpdbHandDuplicate(hh['siteHandNo'])
|
||||||
|
|
||||||
def updateHudCache(self, db):
|
def updateHudCache(self, db):
|
||||||
db.storeHudCache(self.dbid_gt, self.dbid_pids, self.starttime, self.stats.getHandsPlayers())
|
db.storeHudCache(self.dbid_gt, self.dbid_pids, self.startTime, self.stats.getHandsPlayers())
|
||||||
|
|
||||||
def select(self, handId):
|
def select(self, handId):
|
||||||
""" Function to create Hand object from database """
|
""" Function to create Hand object from database """
|
||||||
|
@ -274,15 +297,16 @@ If a player has None chips he won't be added."""
|
||||||
self.streets.update(match.groupdict())
|
self.streets.update(match.groupdict())
|
||||||
log.debug("markStreets:\n"+ str(self.streets))
|
log.debug("markStreets:\n"+ str(self.streets))
|
||||||
else:
|
else:
|
||||||
|
tmp = self.handText[0:100]
|
||||||
log.error("markstreets didn't match")
|
log.error("markstreets didn't match")
|
||||||
log.error(" - Assuming hand cancelled")
|
log.error(" - Assuming hand cancelled")
|
||||||
self.cancelled = True
|
self.cancelled = True
|
||||||
raise FpdbParseError
|
raise FpdbParseError("FpdbParseError: markStreets appeared to fail: First 100 chars: '%s'" % tmp)
|
||||||
|
|
||||||
def checkPlayerExists(self,player):
|
def checkPlayerExists(self,player):
|
||||||
if player not in [p[1] for p in self.players]:
|
if player not in [p[1] for p in self.players]:
|
||||||
print "checkPlayerExists", player, "fail"
|
print "DEBUG: checkPlayerExists %s fail" % player
|
||||||
raise FpdbParseError
|
raise FpdbParseError("checkPlayerExists: '%s' failed." % player)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -344,7 +368,7 @@ For sites (currently only Carbon Poker) which record "all in" as a special actio
|
||||||
self.actions['BLINDSANTES'].append(act)
|
self.actions['BLINDSANTES'].append(act)
|
||||||
|
|
||||||
if blindtype == 'both':
|
if blindtype == 'both':
|
||||||
# work with the real ammount. limit games are listed as $1, $2, where
|
# work with the real amount. limit games are listed as $1, $2, where
|
||||||
# the SB 0.50 and the BB is $1, after the turn the minimum bet amount is $2....
|
# the SB 0.50 and the BB is $1, after the turn the minimum bet amount is $2....
|
||||||
amount = self.bb
|
amount = self.bb
|
||||||
self.bets['BLINDSANTES'][player].append(Decimal(self.sb))
|
self.bets['BLINDSANTES'][player].append(Decimal(self.sb))
|
||||||
|
@ -603,10 +627,10 @@ Map the tuple self.gametype onto the pokerstars string describing it
|
||||||
gs = gs + " %s (%s) - " % (self.getGameTypeAsString(), self.getStakesAsString())
|
gs = gs + " %s (%s) - " % (self.getGameTypeAsString(), self.getStakesAsString())
|
||||||
|
|
||||||
try:
|
try:
|
||||||
timestr = datetime.datetime.strftime(self.starttime, '%Y/%m/%d %H:%M:%S ET')
|
timestr = datetime.datetime.strftime(self.startTime, '%Y/%m/%d %H:%M:%S ET')
|
||||||
except TypeError:
|
except TypeError:
|
||||||
print "*** ERROR - HAND: calling writeGameLine with unexpected STARTTIME value, expecting datetime.date object, received:", self.starttime
|
print "*** ERROR - HAND: calling writeGameLine with unexpected STARTTIME value, expecting datetime.date object, received:", self.startTime
|
||||||
print "*** Make sure your HandHistoryConverter is setting hand.starttime properly!"
|
print "*** Make sure your HandHistoryConverter is setting hand.startTime properly!"
|
||||||
print "*** Game String:", gs
|
print "*** Game String:", gs
|
||||||
return gs
|
return gs
|
||||||
else:
|
else:
|
||||||
|
@ -806,7 +830,7 @@ class HoldemOmahaHand(Hand):
|
||||||
T.h1[
|
T.h1[
|
||||||
T.span(class_='site')["%s Game #%s]" % ('PokerStars', self.handid)],
|
T.span(class_='site')["%s Game #%s]" % ('PokerStars', self.handid)],
|
||||||
T.span(class_='type_limit')[ "%s ($%s/$%s)" %(self.getGameTypeAsString(), self.sb, self.bb) ],
|
T.span(class_='type_limit')[ "%s ($%s/$%s)" %(self.getGameTypeAsString(), self.sb, self.bb) ],
|
||||||
T.span(class_='date')[ datetime.datetime.strftime(self.starttime,'%Y/%m/%d - %H:%M:%S ET') ]
|
T.span(class_='date')[ datetime.datetime.strftime(self.startTime,'%Y/%m/%d - %H:%M:%S ET') ]
|
||||||
],
|
],
|
||||||
T.h2[ "Table '%s' %d-max Seat #%s is the button" %(self.tablename,
|
T.h2[ "Table '%s' %d-max Seat #%s is the button" %(self.tablename,
|
||||||
self.maxseats, self.buttonpos)],
|
self.maxseats, self.buttonpos)],
|
||||||
|
@ -1487,9 +1511,9 @@ class Pot(object):
|
||||||
if self.sym is None:
|
if self.sym is None:
|
||||||
self.sym = "C"
|
self.sym = "C"
|
||||||
if self.total is None:
|
if self.total is None:
|
||||||
print "call Pot.end() before printing pot total"
|
print "DEBUG: call Pot.end() before printing pot total"
|
||||||
# NB if I'm sure end() is idempotent, call it here.
|
# NB if I'm sure end() is idempotent, call it here.
|
||||||
raise FpdbParseError
|
raise FpdbParseError("FpdbError in printing Hand object")
|
||||||
|
|
||||||
ret = "Total pot %s%.2f" % (self.sym, self.total)
|
ret = "Total pot %s%.2f" % (self.sym, self.total)
|
||||||
if len(self.pots) < 2:
|
if len(self.pots) < 2:
|
||||||
|
@ -1556,7 +1580,7 @@ limit 1""", {'handid':handid})
|
||||||
SELECT
|
SELECT
|
||||||
h.sitehandno as hid,
|
h.sitehandno as hid,
|
||||||
h.tablename as table,
|
h.tablename as table,
|
||||||
h.handstart as starttime
|
h.startTime as startTime
|
||||||
FROM
|
FROM
|
||||||
hands as h
|
hands as h
|
||||||
WHERE h.id = %(handid)s
|
WHERE h.id = %(handid)s
|
||||||
|
@ -1564,7 +1588,7 @@ WHERE h.id = %(handid)s
|
||||||
res = c.fetchone()
|
res = c.fetchone()
|
||||||
h.handid = res[0]
|
h.handid = res[0]
|
||||||
h.tablename = res[1]
|
h.tablename = res[1]
|
||||||
h.starttime = res[2] # automatically a datetime
|
h.startTime = res[2] # automatically a datetime
|
||||||
|
|
||||||
# PlayerStacks
|
# PlayerStacks
|
||||||
c.execute("""
|
c.execute("""
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
"""HandHistory.py
|
"""HandHistory.py
|
||||||
|
|
||||||
Parses HandHistory xml files and returns requested objects.
|
Parses HandHistory xml files and returns requested objects.
|
||||||
"""
|
"""
|
||||||
# Copyright 2008, Ray E. Barker
|
# Copyright 2008-2010, Ray E. Barker
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
#Copyright 2008 Carl Gherardi
|
#Copyright 2008-2010 Carl Gherardi
|
||||||
#This program is free software: you can redistribute it and/or modify
|
#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
|
#it under the terms of the GNU Affero General Public License as published by
|
||||||
#the Free Software Foundation, version 3 of the License.
|
#the Free Software Foundation, version 3 of the License.
|
||||||
|
@ -13,8 +13,7 @@
|
||||||
#
|
#
|
||||||
#You should have received a copy of the GNU Affero General Public License
|
#You should have received a copy of the GNU Affero General Public License
|
||||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#In the "official" distribution you can find the license in
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
#agpl-3.0.txt in the docs folder of the package.
|
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
@ -36,7 +35,6 @@ log = logging.getLogger("parser")
|
||||||
|
|
||||||
|
|
||||||
import Hand
|
import Hand
|
||||||
import Tourney
|
|
||||||
from Exceptions import FpdbParseError
|
from Exceptions import FpdbParseError
|
||||||
import Configuration
|
import Configuration
|
||||||
|
|
||||||
|
@ -62,7 +60,7 @@ class HandHistoryConverter():
|
||||||
codepage = "cp1252"
|
codepage = "cp1252"
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, config, in_path = '-', out_path = '-', follow=False, index=0, autostart=True, starsArchive=False):
|
def __init__(self, config, in_path = '-', out_path = '-', follow=False, index=0, autostart=True, starsArchive=False, ftpArchive=False):
|
||||||
"""\
|
"""\
|
||||||
in_path (default '-' = sys.stdin)
|
in_path (default '-' = sys.stdin)
|
||||||
out_path (default '-' = sys.stdout)
|
out_path (default '-' = sys.stdout)
|
||||||
|
@ -75,6 +73,7 @@ follow : whether to tail -f the input"""
|
||||||
|
|
||||||
self.index = index
|
self.index = index
|
||||||
self.starsArchive = starsArchive
|
self.starsArchive = starsArchive
|
||||||
|
self.ftpArchive = ftpArchive
|
||||||
|
|
||||||
self.in_path = in_path
|
self.in_path = in_path
|
||||||
self.out_path = out_path
|
self.out_path = out_path
|
||||||
|
@ -136,8 +135,7 @@ Otherwise, finish at EOF.
|
||||||
self.numHands += 1
|
self.numHands += 1
|
||||||
except FpdbParseError, e:
|
except FpdbParseError, e:
|
||||||
self.numErrors += 1
|
self.numErrors += 1
|
||||||
log.warning("Failed to convert hand %s" % e.hid)
|
log.warning("HHC.start(follow): processHand failed: Exception msg: '%s'" % e)
|
||||||
log.warning("Exception msg: '%s'" % str(e))
|
|
||||||
log.debug(handText)
|
log.debug(handText)
|
||||||
else:
|
else:
|
||||||
handsList = self.allHandsAsList()
|
handsList = self.allHandsAsList()
|
||||||
|
@ -151,8 +149,7 @@ Otherwise, finish at EOF.
|
||||||
self.processedHands.append(self.processHand(handText))
|
self.processedHands.append(self.processHand(handText))
|
||||||
except FpdbParseError, e:
|
except FpdbParseError, e:
|
||||||
self.numErrors += 1
|
self.numErrors += 1
|
||||||
log.warning("Failed to convert hand %s" % e.hid)
|
log.warning("HHC.start(): processHand failed: Exception msg: '%s'" % e)
|
||||||
log.warning("Exception msg: '%s'" % str(e))
|
|
||||||
log.debug(handText)
|
log.debug(handText)
|
||||||
self.numHands = len(handsList)
|
self.numHands = len(handsList)
|
||||||
endtime = time.time()
|
endtime = time.time()
|
||||||
|
@ -247,6 +244,11 @@ which it expects to find at self.re_TailSplitHands -- see for e.g. Everleaf.py.
|
||||||
m = re.compile('^Hand #\d+', re.MULTILINE)
|
m = re.compile('^Hand #\d+', re.MULTILINE)
|
||||||
self.obs = m.sub('', self.obs)
|
self.obs = m.sub('', self.obs)
|
||||||
|
|
||||||
|
if self.ftpArchive == True:
|
||||||
|
log.debug("Converting ftpArchive format to readable")
|
||||||
|
m = re.compile('^\*\*\*\*\*\*+\s#\s\d+\s\*\*\*\*\*+$', re.MULTILINE)
|
||||||
|
self.obs = m.sub('', self.obs)
|
||||||
|
|
||||||
if self.obs is None or self.obs == "":
|
if self.obs is None or self.obs == "":
|
||||||
log.info("Read no hands.")
|
log.info("Read no hands.")
|
||||||
return []
|
return []
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
"""Hello.py
|
"""Hello.py
|
||||||
|
|
||||||
Hello World demostration for Aux_Window.
|
Hello World demostration for Aux_Window.
|
||||||
"""
|
"""
|
||||||
# Copyright 2009, Ray E. Barker
|
# Copyright 2009-2010, Ray E. Barker
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
Create and manage the hud overlays.
|
Create and manage the hud overlays.
|
||||||
"""
|
"""
|
||||||
# Copyright 2008, 2009 Ray E. Barker
|
# Copyright 2008-2010 Ray E. Barker
|
||||||
|
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -87,6 +87,7 @@ class Hud:
|
||||||
(font, font_size) = config.get_default_font(self.table.site)
|
(font, font_size) = config.get_default_font(self.table.site)
|
||||||
self.colors = config.get_default_colors(self.table.site)
|
self.colors = config.get_default_colors(self.table.site)
|
||||||
self.hud_ui = config.get_hud_ui_parameters()
|
self.hud_ui = config.get_hud_ui_parameters()
|
||||||
|
self.site_params = config.get_site_parameters(self.table.site)
|
||||||
|
|
||||||
self.backgroundcolor = gtk.gdk.color_parse(self.colors['hudbgcolor'])
|
self.backgroundcolor = gtk.gdk.color_parse(self.colors['hudbgcolor'])
|
||||||
self.foregroundcolor = gtk.gdk.color_parse(self.colors['hudfgcolor'])
|
self.foregroundcolor = gtk.gdk.color_parse(self.colors['hudfgcolor'])
|
||||||
|
@ -448,6 +449,8 @@ class Hud:
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
if not win32gui.IsWindow(self.table.number):
|
if not win32gui.IsWindow(self.table.number):
|
||||||
self.parent.kill_hud(self, self.table.name)
|
self.parent.kill_hud(self, self.table.name)
|
||||||
|
self.parent.kill_hud(self, self.table.name.split(" ")[0])
|
||||||
|
#table.name is only a valid handle for ring games ! we are not killing tourney tables here.
|
||||||
return False
|
return False
|
||||||
# anyone know how to do this in unix, or better yet, trap the X11 error that is triggered when executing the get_origin() for a closed window?
|
# anyone know how to do this in unix, or better yet, trap the X11 error that is triggered when executing the get_origin() for a closed window?
|
||||||
if self.table.gdkhandle is not None:
|
if self.table.gdkhandle is not None:
|
||||||
|
@ -455,7 +458,7 @@ class Hud:
|
||||||
if self.table.x != x or self.table.y != y:
|
if self.table.x != x or self.table.y != y:
|
||||||
self.table.x = x
|
self.table.x = x
|
||||||
self.table.y = y
|
self.table.y = y
|
||||||
self.main_window.move(x, y)
|
self.main_window.move(x + self.site_params['xshift'], y + self.site_params['yshift'])
|
||||||
adj = self.adj_seats(self.hand, self.config)
|
adj = self.adj_seats(self.hand, self.config)
|
||||||
loc = self.config.get_locations(self.table.site, self.max)
|
loc = self.config.get_locations(self.table.site, self.max)
|
||||||
# TODO: is stat_windows getting converted somewhere from a list to a dict, for no good reason?
|
# TODO: is stat_windows getting converted somewhere from a list to a dict, for no good reason?
|
||||||
|
|
61
pyfpdb/IMAPEmailFetcher.py
Normal file
61
pyfpdb/IMAPEmailFetcher.py
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
import imaplib
|
||||||
|
import Configuration
|
||||||
|
import os
|
||||||
|
import pprint
|
||||||
|
|
||||||
|
pp = pprint.PrettyPrinter(indent=4)
|
||||||
|
|
||||||
|
def open_imap_connection(verbose=False):
|
||||||
|
# Read the config file
|
||||||
|
# FIXME
|
||||||
|
hostname = 'imap.gmail.com'
|
||||||
|
port = 993
|
||||||
|
username = 'slartibartfast'
|
||||||
|
password = '42'
|
||||||
|
|
||||||
|
# Connect
|
||||||
|
if verbose: print "Connecting to %s" % hostname
|
||||||
|
connection = imaplib.IMAP4_SSL(hostname)
|
||||||
|
|
||||||
|
# Login to our account
|
||||||
|
if verbose: print "Logging in as %s" % username
|
||||||
|
connection.login(username, password)
|
||||||
|
return connection
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
# Read the config file
|
||||||
|
# FIXME
|
||||||
|
folder = "INBOX"
|
||||||
|
c = open_imap_connection(verbose=True)
|
||||||
|
|
||||||
|
try:
|
||||||
|
typ, data = c.list(directory=folder)
|
||||||
|
print typ, data
|
||||||
|
|
||||||
|
c.select('INBOX', readonly=True)
|
||||||
|
|
||||||
|
typ, msg_ids = c.search(None, '(SUBJECT "Results for PokerStars Tournament *")')
|
||||||
|
print typ, msg_ids
|
||||||
|
msgidlist = msg_ids[0].split(' ')
|
||||||
|
print msgidlist
|
||||||
|
|
||||||
|
for msg in msgidlist:
|
||||||
|
print 'HEADER:'
|
||||||
|
typ, msg_data = c.fetch(msg, '(BODY.PEEK[HEADER])')
|
||||||
|
for response_part in msg_data:
|
||||||
|
if isinstance(response_part, tuple):
|
||||||
|
print response_part[1]
|
||||||
|
|
||||||
|
print 'BODY TEXT:'
|
||||||
|
typ, msg_data = c.fetch(msg, '(BODY.PEEK[TEXT])')
|
||||||
|
for response_part in msg_data:
|
||||||
|
if isinstance(response_part, tuple):
|
||||||
|
print response_part[1]
|
||||||
|
|
||||||
|
|
||||||
|
finally:
|
||||||
|
try:
|
||||||
|
c.close()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
c.logout()
|
81
pyfpdb/ImapSummaries.py
Executable file
81
pyfpdb/ImapSummaries.py
Executable file
|
@ -0,0 +1,81 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
#Copyright 2008-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.
|
||||||
|
#
|
||||||
|
#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 <http://www.gnu.org/licenses/>.
|
||||||
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
|
|
||||||
|
"""This file is to fetch summaries through IMAP and pass them on to the appropriate parser"""
|
||||||
|
#see http://docs.python.org/library/imaplib.html for the python interface
|
||||||
|
#see http://tools.ietf.org/html/rfc2060#section-6.4.4 for IMAP4 search criteria
|
||||||
|
|
||||||
|
from imaplib import IMAP4, IMAP4_SSL
|
||||||
|
import PokerStarsSummary
|
||||||
|
|
||||||
|
def splitPokerStarsSummaries(emailText):
|
||||||
|
splitSummaries=emailText.split("\nPokerStars Tournament #")[1:]
|
||||||
|
for i in range(len(splitSummaries)):
|
||||||
|
splitSummaries[i]="PokerStars Tournament #"+splitSummaries[i]
|
||||||
|
return splitSummaries
|
||||||
|
#end def emailText
|
||||||
|
|
||||||
|
def run(config, db):
|
||||||
|
#print "start of IS.run"
|
||||||
|
server=None
|
||||||
|
#try:
|
||||||
|
#print "useSSL",config.email.useSsl,"host",config.email.host
|
||||||
|
if config.email.useSsl:
|
||||||
|
server = IMAP4_SSL(config.email.host)
|
||||||
|
else:
|
||||||
|
server = IMAP4(config.email.host)
|
||||||
|
response = server.login(config.email.username, config.email.password) #TODO catch authentication error
|
||||||
|
print "response to logging in:",response
|
||||||
|
#print "server.list():",server.list() #prints list of folders
|
||||||
|
|
||||||
|
response = server.select(config.email.folder)
|
||||||
|
#print "response to selecting INBOX:",response
|
||||||
|
if response[0]!="OK":
|
||||||
|
raise error #TODO: show error message
|
||||||
|
|
||||||
|
neededMessages=[]
|
||||||
|
response, searchData = server.search(None, "SUBJECT", "PokerStars Tournament History Request")
|
||||||
|
for messageNumber in searchData[0].split(" "):
|
||||||
|
response, headerData = server.fetch(messageNumber, "(BODY[HEADER.FIELDS (SUBJECT)])")
|
||||||
|
#print "response to fetch subject:",response
|
||||||
|
if response!="OK":
|
||||||
|
raise error #TODO: show error message
|
||||||
|
if headerData[1].find("Subject: PokerStars Tournament History Request - Last x")!=1:
|
||||||
|
neededMessages.append(("PS", messageNumber))
|
||||||
|
|
||||||
|
if (len(neededMessages)==0):
|
||||||
|
raise error #TODO: show error message
|
||||||
|
for messageData in neededMessages:
|
||||||
|
response, bodyData = server.fetch(messageData[1], "(UID BODY[TEXT])")
|
||||||
|
bodyData=bodyData[0][1]
|
||||||
|
if response!="OK":
|
||||||
|
raise error #TODO: show error message
|
||||||
|
if messageData[0]=="PS":
|
||||||
|
summaryTexts=(splitPokerStarsSummaries(bodyData))
|
||||||
|
for summaryText in summaryTexts:
|
||||||
|
result=PokerStarsSummary.PokerStarsSummary(db=db, config=config, siteName=u"PokerStars", summaryText=summaryText, builtFrom = "IMAP")
|
||||||
|
#print "finished importing a PS summary with result:",result
|
||||||
|
#TODO: count results and output to shell like hand importer does
|
||||||
|
|
||||||
|
print "completed running Imap import, closing server connection"
|
||||||
|
#finally:
|
||||||
|
# try:
|
||||||
|
# server.close()
|
||||||
|
# finally:
|
||||||
|
# pass
|
||||||
|
#server.logout()
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
"""Mucked.py
|
"""Mucked.py
|
||||||
|
|
||||||
Mucked cards display for FreePokerTools HUD.
|
Mucked cards display for FreePokerTools HUD.
|
||||||
"""
|
"""
|
||||||
# Copyright 2008, 2009, Ray E. Barker
|
# Copyright 2008-2010, Ray E. Barker
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# Copyright 2008, Carl Gherardi
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2008-2010, Carl Gherardi
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -136,7 +138,7 @@ class OnGame(HandHistoryConverter):
|
||||||
#TODO: Do conversion from GMT to 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)
|
#TODO: Need some date functions to convert to different timezones (Date::Manip for perl rocked for this)
|
||||||
|
|
||||||
hand.starttime = time.strptime(m.group('DATETIME'), "%d %b %Y %I:%M %p")
|
hand.startTime = time.strptime(m.group('DATETIME'), "%d %b %Y %I:%M %p")
|
||||||
#hand.starttime = "%d/%02d/%02d %d:%02d:%02d ET" %(int(m.group('YEAR')), int(m.group('MON')), int(m.group('DAY')),
|
#hand.starttime = "%d/%02d/%02d %d:%02d:%02d ET" %(int(m.group('YEAR')), int(m.group('MON')), int(m.group('DAY')),
|
||||||
#int(m.group('HR')), int(m.group('MIN')), int(m.group('SEC')))
|
#int(m.group('HR')), int(m.group('MIN')), int(m.group('SEC')))
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
#Copyright 2008 Ray E. Barker
|
#Copyright 2008-2010 Ray E. Barker
|
||||||
#This program is free software: you can redistribute it and/or modify
|
#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
|
#it under the terms of the GNU Affero General Public License as published by
|
||||||
#the Free Software Foundation, version 3 of the License.
|
#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
|
#You should have received a copy of the GNU Affero General Public License
|
||||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#In the "official" distribution you can find the license in
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
#agpl-3.0.txt in the docs folder of the package.
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
33
pyfpdb/P5sResultsParser.py
Normal file
33
pyfpdb/P5sResultsParser.py
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
import urllib2, re
|
||||||
|
import pprint
|
||||||
|
from BeautifulSoup import BeautifulSoup
|
||||||
|
|
||||||
|
|
||||||
|
playername = ''
|
||||||
|
|
||||||
|
if playername == '':
|
||||||
|
print "You need to manually enter the playername"
|
||||||
|
exit(0)
|
||||||
|
|
||||||
|
page = urllib2.urlopen("http://www.pocketfives.com/poker-scores/%s/" %playername)
|
||||||
|
soup = BeautifulSoup(page)
|
||||||
|
|
||||||
|
results = []
|
||||||
|
|
||||||
|
for table in soup.findAll('table'):
|
||||||
|
# print "Found %s" % table
|
||||||
|
for row in table.findAll('tr'):
|
||||||
|
tmp = []
|
||||||
|
for col in row.findAll('td'):
|
||||||
|
tmp = tmp + [col.string]
|
||||||
|
#print col.string
|
||||||
|
if len(tmp) > 3 and tmp[2] <> None:
|
||||||
|
results = results + [tmp]
|
||||||
|
|
||||||
|
cols = ['TOURNAMENT', 'SITE', 'DATE', 'PRIZEPOOL', 'BUY-IN', 'PLACE', 'WON']
|
||||||
|
|
||||||
|
pp = pprint.PrettyPrinter(indent=4)
|
||||||
|
|
||||||
|
for result in results:
|
||||||
|
print "Site: %s Date: %s\tPrizepool: %s\tBuyin: %s\tPosition: %s\tWon: %s" %(result[2], result[3], result[4], result[5], result[6], result[7])
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# Copyright 2009, Grigorij Indigirkin
|
# Copyright 2009-2010, Grigorij Indigirkin
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -261,6 +261,7 @@ class PartyPoker(HandHistoryConverter):
|
||||||
if v[0] in self.pot.returned:
|
if v[0] in self.pot.returned:
|
||||||
self.collected[i][1] = Decimal(v[1]) - self.pot.returned[v[0]]
|
self.collected[i][1] = Decimal(v[1]) - self.pot.returned[v[0]]
|
||||||
self.collectees[v[0]] -= self.pot.returned[v[0]]
|
self.collectees[v[0]] -= self.pot.returned[v[0]]
|
||||||
|
self.pot.returned[v[0]] = 0
|
||||||
return origTotalPot()
|
return origTotalPot()
|
||||||
return totalPot
|
return totalPot
|
||||||
instancemethod = type(hand.totalPot)
|
instancemethod = type(hand.totalPot)
|
||||||
|
@ -280,7 +281,7 @@ class PartyPoker(HandHistoryConverter):
|
||||||
'July','August','September','October','November','December']
|
'July','August','September','October','November','December']
|
||||||
month = months.index(m2.group('M')) + 1
|
month = months.index(m2.group('M')) + 1
|
||||||
datetimestr = "%s/%s/%s %s:%s:%s" % (m2.group('Y'), month,m2.group('D'),m2.group('H'),m2.group('MIN'),m2.group('S'))
|
datetimestr = "%s/%s/%s %s:%s:%s" % (m2.group('Y'), month,m2.group('D'),m2.group('H'),m2.group('MIN'),m2.group('S'))
|
||||||
hand.starttime = datetime.datetime.strptime(datetimestr, "%Y/%m/%d %H:%M:%S")
|
hand.startTime = datetime.datetime.strptime(datetimestr, "%Y/%m/%d %H:%M:%S")
|
||||||
# FIXME: some timezone correction required
|
# FIXME: some timezone correction required
|
||||||
#tzShift = defaultdict(lambda:0, {'EDT': -5, 'EST': -6, 'MSKS': 3})
|
#tzShift = defaultdict(lambda:0, {'EDT': -5, 'EST': -6, 'MSKS': 3})
|
||||||
#hand.starttime -= datetime.timedelta(hours=tzShift[m2.group('TZ')])
|
#hand.starttime -= datetime.timedelta(hours=tzShift[m2.group('TZ')])
|
||||||
|
@ -359,8 +360,14 @@ class PartyPoker(HandHistoryConverter):
|
||||||
if hand.gametype['type'] == 'ring':
|
if hand.gametype['type'] == 'ring':
|
||||||
try:
|
try:
|
||||||
assert noSmallBlind==False
|
assert noSmallBlind==False
|
||||||
m = self.re_PostSB.search(hand.handText)
|
liveBlind = True
|
||||||
|
for m in self.re_PostSB.finditer(hand.handText):
|
||||||
|
if liveBlind:
|
||||||
hand.addBlind(m.group('PNAME'), 'small blind', m.group('SB'))
|
hand.addBlind(m.group('PNAME'), 'small blind', m.group('SB'))
|
||||||
|
liveBlind = False
|
||||||
|
else:
|
||||||
|
# Post dead blinds as ante
|
||||||
|
hand.addBlind(m.group('PNAME'), 'secondsb', m.group('SB'))
|
||||||
except: # no small blind
|
except: # no small blind
|
||||||
hand.addBlind(None, None, None)
|
hand.addBlind(None, None, None)
|
||||||
|
|
||||||
|
@ -432,7 +439,7 @@ class PartyPoker(HandHistoryConverter):
|
||||||
if street == 'PREFLOP' and \
|
if street == 'PREFLOP' and \
|
||||||
playerName in [item[0] for item in hand.actions['BLINDSANTES'] if item[2]!='ante']:
|
playerName in [item[0] for item in hand.actions['BLINDSANTES'] if item[2]!='ante']:
|
||||||
# preflop raise from blind
|
# preflop raise from blind
|
||||||
hand.addRaiseBy( street, playerName, amount )
|
hand.addCallandRaise( street, playerName, amount )
|
||||||
else:
|
else:
|
||||||
hand.addCallandRaise( street, playerName, amount )
|
hand.addCallandRaise( street, playerName, amount )
|
||||||
elif actionType == 'calls':
|
elif actionType == 'calls':
|
||||||
|
|
125
pyfpdb/PokerStarsSummary.py
Normal file
125
pyfpdb/PokerStarsSummary.py
Normal file
|
@ -0,0 +1,125 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
#Copyright 2008-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.
|
||||||
|
#
|
||||||
|
#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 <http://www.gnu.org/licenses/>.
|
||||||
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
|
|
||||||
|
"""pokerstars-specific summary parsing code"""
|
||||||
|
|
||||||
|
from decimal import Decimal
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from Exceptions import FpdbParseError
|
||||||
|
import PokerStarsToFpdb
|
||||||
|
from TourneySummary import *
|
||||||
|
|
||||||
|
class PokerStarsSummary(TourneySummary):
|
||||||
|
re_TourNo = re.compile("\#[0-9]+,")
|
||||||
|
re_Entries = re.compile("[0-9]+")
|
||||||
|
re_Prizepool = re.compile("\$[0-9]+\.[0-9]+")
|
||||||
|
re_Player = re.compile("""(?P<RANK>[0-9]+):\s(?P<NAME>.*)\s\(.*\),(\s)?(\$(?P<WINNINGS>[0-9]+\.[0-9]+))?(?P<STILLPLAYING>still\splaying)?""")
|
||||||
|
re_BuyInFee = re.compile("(?P<BUYIN>[0-9]+\.[0-9]+).*(?P<FEE>[0-9]+\.[0-9]+)")
|
||||||
|
re_FPP = re.compile("(?P<FPP>[0-9]+)\sFPP")
|
||||||
|
#note: the dollar and cent in the below line are currency-agnostic
|
||||||
|
re_Added = re.compile("(?P<DOLLAR>[0-9]+)\.(?P<CENT>[0-9]+)\s(?P<CURRENCY>[A-Z]+)(\sadded\sto\sthe\sprize\spool\sby\sPokerStars)")
|
||||||
|
re_DateTime = re.compile("(?P<Y>[0-9]{4})\/(?P<M>[0-9]{2})\/(?P<D>[0-9]{2})[\- ]+(?P<H>[0-9]+):(?P<MIN>[0-9]+):(?P<S>[0-9]+)")
|
||||||
|
# = re.compile("")
|
||||||
|
|
||||||
|
def parseSummary(self):
|
||||||
|
lines=self.summaryText.splitlines()
|
||||||
|
|
||||||
|
self.tourNo = self.re_TourNo.findall(lines[0])[0][1:-1] #ignore game and limit type as thats not recorded
|
||||||
|
#print "tourNo:",self.tourNo
|
||||||
|
|
||||||
|
if lines[1].find("$")!=-1: #TODO: move this into a method and call that from PokerStarsToFpdb.py:269 if hand.buyinCurrency=="USD" etc.
|
||||||
|
self.currency="USD"
|
||||||
|
elif lines[1].find(u"€")!=-1:
|
||||||
|
self.currency="EUR"
|
||||||
|
elif lines[1].find("FPP")!=-1:
|
||||||
|
self.currency="PSFP"
|
||||||
|
else:
|
||||||
|
raise FpdbParseError("didn't recognise buyin currency in:"+lines[1])
|
||||||
|
|
||||||
|
if self.currency=="USD" or self.currency=="EUR":
|
||||||
|
result=self.re_BuyInFee.search(lines[1])
|
||||||
|
result=result.groupdict()
|
||||||
|
self.buyin=int(100*Decimal(result['BUYIN']))
|
||||||
|
self.fee=int(100*Decimal(result['FEE']))
|
||||||
|
elif self.currency=="PSFP":
|
||||||
|
result=self.re_FPP.search(lines[1])
|
||||||
|
result=result.groupdict()
|
||||||
|
self.buyin=int(Decimal(result['FPP']))
|
||||||
|
self.fee=0
|
||||||
|
|
||||||
|
currentLine=2
|
||||||
|
self.entries = self.re_Entries.findall(lines[currentLine])[0]
|
||||||
|
currentLine+=1 #note that I chose to make the code keep state (the current line number)
|
||||||
|
#as that means it'll fail rather than silently skip potentially valuable information
|
||||||
|
#print "after entries lines[currentLine]", lines[currentLine]
|
||||||
|
|
||||||
|
result=self.re_Added.search(lines[currentLine])
|
||||||
|
if result:
|
||||||
|
result=result.groupdict()
|
||||||
|
self.added=100*int(Decimal(result['DOLLAR']))+int(Decimal(result['CENT']))
|
||||||
|
self.addedCurrency=result['CURRENCY']
|
||||||
|
#print "TODO: implement added:",self.added,self.addedCurrency
|
||||||
|
currentLine+=1
|
||||||
|
#print "after added/entries lines[currentLine]", lines[currentLine]
|
||||||
|
|
||||||
|
result=self.re_Prizepool.findall(lines[currentLine])
|
||||||
|
if result:
|
||||||
|
self.prizepool = result[0]
|
||||||
|
self.prizepool = self.prizepool[1:-3]+self.prizepool[-2:]
|
||||||
|
currentLine+=1
|
||||||
|
#print "after prizepool lines[currentLine]", lines[currentLine]
|
||||||
|
|
||||||
|
result=self.re_DateTime.search(lines[currentLine])
|
||||||
|
result=result.groupdict()
|
||||||
|
datetimestr = "%s/%s/%s %s:%s:%s" % (result['Y'], result['M'],result['D'],result['H'],result['MIN'],result['S'])
|
||||||
|
self.startTime= datetime.datetime.strptime(datetimestr, "%Y/%m/%d %H:%M:%S") # also timezone at end, e.g. " ET"
|
||||||
|
self.startTime = PokerStarsToFpdb.removeET(self.startTime)
|
||||||
|
currentLine+=1
|
||||||
|
|
||||||
|
result=self.re_DateTime.search(lines[currentLine])
|
||||||
|
if result:
|
||||||
|
result=result.groupdict()
|
||||||
|
datetimestr = "%s/%s/%s %s:%s:%s" % (result['Y'], result['M'],result['D'],result['H'],result['MIN'],result['S'])
|
||||||
|
self.endTime= datetime.datetime.strptime(datetimestr, "%Y/%m/%d %H:%M:%S") # also timezone at end, e.g. " ET"
|
||||||
|
currentLine+=1
|
||||||
|
|
||||||
|
if lines[currentLine].find("Tournament is still in progress")!=-1:
|
||||||
|
currentLine+=1
|
||||||
|
|
||||||
|
for i in range(currentLine,len(lines)-2): #lines with rank and winnings info
|
||||||
|
if lines[i].find(":")==-1:
|
||||||
|
break
|
||||||
|
result=self.re_Player.search(lines[i])
|
||||||
|
result=result.groupdict()
|
||||||
|
rank=result['RANK']
|
||||||
|
name=result['NAME']
|
||||||
|
winnings=result['WINNINGS']
|
||||||
|
|
||||||
|
if winnings:
|
||||||
|
winnings=int(100*Decimal(winnings))
|
||||||
|
else:
|
||||||
|
winnings=0
|
||||||
|
|
||||||
|
if result['STILLPLAYING']:
|
||||||
|
#print "stillplaying"
|
||||||
|
rank=None
|
||||||
|
winnings=None
|
||||||
|
|
||||||
|
self.addPlayer(rank, name, winnings, self.currency, None, None, None)#TODO: currency, ko/addon/rebuy count -> need examples!
|
||||||
|
#end def parseSummary
|
||||||
|
#end class PokerStarsSummary
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# Copyright 2008, Carl Gherardi
|
# Copyright 2008-2010, Carl Gherardi
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -22,9 +22,25 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from HandHistoryConverter import *
|
from HandHistoryConverter import *
|
||||||
|
from decimal import Decimal
|
||||||
|
|
||||||
# PokerStars HH Format
|
# PokerStars HH Format
|
||||||
|
|
||||||
|
def removeET(time):
|
||||||
|
# approximate rules for ET daylight savings time:
|
||||||
|
if ( time.month == 12 # all of Dec
|
||||||
|
or (time.month == 11 and time.day > 4) # and most of November
|
||||||
|
or time.month < 3 # and all of Jan/Feb
|
||||||
|
or (time.month == 3 and time.day < 11) ): # and 1st 10 days of March
|
||||||
|
offset = datetime.timedelta(hours=5) # are EST: assume 5 hour offset (ET without daylight saving)
|
||||||
|
else:
|
||||||
|
offset = datetime.timedelta(hours=4) # rest is EDT: assume 4 hour offset (ET with daylight saving)
|
||||||
|
# adjust time into UTC:
|
||||||
|
time = time + offset
|
||||||
|
#print " tz = %s start = %s" % (tz, str(hand.starttime))
|
||||||
|
return time
|
||||||
|
#end def removeET
|
||||||
|
|
||||||
class PokerStars(HandHistoryConverter):
|
class PokerStars(HandHistoryConverter):
|
||||||
|
|
||||||
# Class Variables
|
# Class Variables
|
||||||
|
@ -41,6 +57,30 @@ class PokerStars(HandHistoryConverter):
|
||||||
'LS' : "\$|\xe2\x82\xac|" # legal currency symbols - Euro(cp1252, utf-8)
|
'LS' : "\$|\xe2\x82\xac|" # legal currency symbols - Euro(cp1252, utf-8)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# translations from captured groups to fpdb info strings
|
||||||
|
Lim_Blinds = { '0.04': ('0.01', '0.02'), '0.10': ('0.02', '0.05'), '0.20': ('0.05', '0.10'),
|
||||||
|
'0.40': ('0.10', '0.20'), '0.50': ('0.10', '0.25'), '1.00': ('0.25', '0.50'),
|
||||||
|
'2.00': ('0.50', '1.00'), '2': ('0.50', '1.00'), '4' : ('1.00', '2.00'),
|
||||||
|
'4.00': ('1.00', '2.00'), '6': ('1.00', '3.00'), '6.00': ('1.00', '3.00'),
|
||||||
|
'10.00': ('2.00', '5.00'), '20.00': ('5.00', '10.00'), '30.00': ('10.00', '15.00'),
|
||||||
|
'60.00': ('15.00', '30.00'), '100.00': ('25.00', '50.00'), '200.00': ('50.00', '100.00'),
|
||||||
|
'400.00': ('100.00', '200.00'), '1000.00': ('250.00', '500.00')}
|
||||||
|
|
||||||
|
limits = { 'No Limit':'nl', 'Pot Limit':'pl', 'Limit':'fl', 'LIMIT':'fl' }
|
||||||
|
games = { # base, category
|
||||||
|
"Hold'em" : ('hold','holdem'),
|
||||||
|
'Omaha' : ('hold','omahahi'),
|
||||||
|
'Omaha Hi/Lo' : ('hold','omahahilo'),
|
||||||
|
'Razz' : ('stud','razz'),
|
||||||
|
'RAZZ' : ('stud','razz'),
|
||||||
|
'7 Card Stud' : ('stud','studhi'),
|
||||||
|
'7 Card Stud Hi/Lo' : ('stud','studhilo'),
|
||||||
|
'Badugi' : ('draw','badugi'),
|
||||||
|
'Triple Draw 2-7 Lowball' : ('draw','27_3draw'),
|
||||||
|
'5 Card Draw' : ('draw','fivedraw')
|
||||||
|
}
|
||||||
|
currencies = { u'€':'EUR', '$':'USD', '':'T$' }
|
||||||
|
|
||||||
# Static regexes
|
# Static regexes
|
||||||
re_GameInfo = re.compile(u"""
|
re_GameInfo = re.compile(u"""
|
||||||
PokerStars\sGame\s\#(?P<HID>[0-9]+):\s+
|
PokerStars\sGame\s\#(?P<HID>[0-9]+):\s+
|
||||||
|
@ -52,7 +92,9 @@ class PokerStars(HandHistoryConverter):
|
||||||
(?P<MIXED>HORSE|8\-Game|HOSE)?\s?\(?
|
(?P<MIXED>HORSE|8\-Game|HOSE)?\s?\(?
|
||||||
(?P<GAME>Hold\'em|Razz|RAZZ|7\sCard\sStud|7\sCard\sStud\sHi/Lo|Omaha|Omaha\sHi/Lo|Badugi|Triple\sDraw\s2\-7\sLowball|5\sCard\sDraw)\s
|
(?P<GAME>Hold\'em|Razz|RAZZ|7\sCard\sStud|7\sCard\sStud\sHi/Lo|Omaha|Omaha\sHi/Lo|Badugi|Triple\sDraw\s2\-7\sLowball|5\sCard\sDraw)\s
|
||||||
(?P<LIMIT>No\sLimit|Limit|LIMIT|Pot\sLimit)\)?,?\s
|
(?P<LIMIT>No\sLimit|Limit|LIMIT|Pot\sLimit)\)?,?\s
|
||||||
(-\sLevel\s(?P<LEVEL>[IVXLC]+)\s)?
|
(-\s)?
|
||||||
|
(Match.*)? #TODO: waiting for reply from user as to what this means
|
||||||
|
(Level\s(?P<LEVEL>[IVXLC]+)\s)?
|
||||||
\(? # open paren of the stakes
|
\(? # open paren of the stakes
|
||||||
(?P<CURRENCY>%(LS)s|)?
|
(?P<CURRENCY>%(LS)s|)?
|
||||||
(?P<SB>[.0-9]+)/(%(LS)s)?
|
(?P<SB>[.0-9]+)/(%(LS)s)?
|
||||||
|
@ -137,47 +179,26 @@ class PokerStars(HandHistoryConverter):
|
||||||
info = {}
|
info = {}
|
||||||
m = self.re_GameInfo.search(handText)
|
m = self.re_GameInfo.search(handText)
|
||||||
if not m:
|
if not m:
|
||||||
print "DEBUG: determineGameType(): did not match"
|
tmp = handText[0:100]
|
||||||
return None
|
log.error("determineGameType: Unable to recognise gametype from: '%s'" % tmp)
|
||||||
|
log.error("determineGameType: Raising FpdbParseError")
|
||||||
|
raise FpdbParseError("Unable to recognise gametype from: '%s'" % tmp)
|
||||||
|
|
||||||
mg = m.groupdict()
|
mg = m.groupdict()
|
||||||
# translations from captured groups to fpdb info strings
|
|
||||||
Lim_Blinds = { '0.04': ('0.01', '0.02'), '0.10': ('0.02', '0.05'), '0.20': ('0.05', '0.10'),
|
|
||||||
'0.50': ('0.10', '0.25'), '1.00': ('0.25', '0.50'), '2.00': ('0.50', '1.00'),
|
|
||||||
'4.00': ('1.00', '2.00'), '6.00': ('1.00', '3.00'), '10.00': ('2.00', '5.00'),
|
|
||||||
'20.00': ('5.00', '10.00'), '30.00': ('10.00', '15.00'), '60.00': ('15.00', '30.00'),
|
|
||||||
'100.00': ('25.00', '50.00'),'200.00': ('50.00', '100.00'),'400.00': ('100.00', '200.00'),
|
|
||||||
'1000.00': ('250.00', '500.00')}
|
|
||||||
|
|
||||||
|
|
||||||
limits = { 'No Limit':'nl', 'Pot Limit':'pl', 'Limit':'fl', 'LIMIT':'fl' }
|
|
||||||
games = { # base, category
|
|
||||||
"Hold'em" : ('hold','holdem'),
|
|
||||||
'Omaha' : ('hold','omahahi'),
|
|
||||||
'Omaha Hi/Lo' : ('hold','omahahilo'),
|
|
||||||
'Razz' : ('stud','razz'),
|
|
||||||
'RAZZ' : ('stud','razz'),
|
|
||||||
'7 Card Stud' : ('stud','studhi'),
|
|
||||||
'7 Card Stud Hi/Lo' : ('stud','studhilo'),
|
|
||||||
'Badugi' : ('draw','badugi'),
|
|
||||||
'Triple Draw 2-7 Lowball' : ('draw','27_3draw'),
|
|
||||||
'5 Card Draw' : ('draw','fivedraw')
|
|
||||||
}
|
|
||||||
currencies = { u'€':'EUR', '$':'USD', '':'T$' }
|
|
||||||
# I don't think this is doing what we think. mg will always have all
|
# I don't think this is doing what we think. mg will always have all
|
||||||
# the expected keys, but the ones that didn't match in the regex will
|
# the expected keys, but the ones that didn't match in the regex will
|
||||||
# have a value of None. It is OK if it throws an exception when it
|
# have a value of None. It is OK if it throws an exception when it
|
||||||
# runs across an unknown game or limit or whatever.
|
# runs across an unknown game or limit or whatever.
|
||||||
if 'LIMIT' in mg:
|
if 'LIMIT' in mg:
|
||||||
info['limitType'] = limits[mg['LIMIT']]
|
info['limitType'] = self.limits[mg['LIMIT']]
|
||||||
if 'GAME' in mg:
|
if 'GAME' in mg:
|
||||||
(info['base'], info['category']) = games[mg['GAME']]
|
(info['base'], info['category']) = self.games[mg['GAME']]
|
||||||
if 'SB' in mg:
|
if 'SB' in mg:
|
||||||
info['sb'] = mg['SB']
|
info['sb'] = mg['SB']
|
||||||
if 'BB' in mg:
|
if 'BB' in mg:
|
||||||
info['bb'] = mg['BB']
|
info['bb'] = mg['BB']
|
||||||
if 'CURRENCY' in mg:
|
if 'CURRENCY' in mg:
|
||||||
info['currency'] = currencies[mg['CURRENCY']]
|
info['currency'] = self.currencies[mg['CURRENCY']]
|
||||||
|
|
||||||
if 'TOURNO' in mg and mg['TOURNO'] is None:
|
if 'TOURNO' in mg and mg['TOURNO'] is None:
|
||||||
info['type'] = 'ring'
|
info['type'] = 'ring'
|
||||||
|
@ -185,10 +206,14 @@ class PokerStars(HandHistoryConverter):
|
||||||
info['type'] = 'tour'
|
info['type'] = 'tour'
|
||||||
|
|
||||||
if info['limitType'] == 'fl' and info['bb'] is not None and info['type'] == 'ring' and info['base'] != 'stud':
|
if info['limitType'] == 'fl' and info['bb'] is not None and info['type'] == 'ring' and info['base'] != 'stud':
|
||||||
info['sb'] = Lim_Blinds[mg['BB']][0]
|
try:
|
||||||
info['bb'] = Lim_Blinds[mg['BB']][1]
|
info['sb'] = self.Lim_Blinds[mg['BB']][0]
|
||||||
|
info['bb'] = self.Lim_Blinds[mg['BB']][1]
|
||||||
|
except KeyError:
|
||||||
|
log.error("determineGameType: Lim_Blinds has no lookup for '%s'" % mg['BB'])
|
||||||
|
log.error("determineGameType: Raising FpdbParseError")
|
||||||
|
raise FpdbParseError("Lim_Blinds has no lookup for '%s'" % mg['BB'])
|
||||||
|
|
||||||
# NB: SB, BB must be interpreted as blinds or bets depending on limit type.
|
|
||||||
return info
|
return info
|
||||||
|
|
||||||
def readHandInfo(self, hand):
|
def readHandInfo(self, hand):
|
||||||
|
@ -213,34 +238,42 @@ class PokerStars(HandHistoryConverter):
|
||||||
#2008/09/07 06:23:14 ET
|
#2008/09/07 06:23:14 ET
|
||||||
m1 = self.re_DateTime.finditer(info[key])
|
m1 = self.re_DateTime.finditer(info[key])
|
||||||
# m2 = re.search("(?P<Y>[0-9]{4})\/(?P<M>[0-9]{2})\/(?P<D>[0-9]{2})[\- ]+(?P<H>[0-9]+):(?P<MIN>[0-9]+):(?P<S>[0-9]+)", info[key])
|
# m2 = re.search("(?P<Y>[0-9]{4})\/(?P<M>[0-9]{2})\/(?P<D>[0-9]{2})[\- ]+(?P<H>[0-9]+):(?P<MIN>[0-9]+):(?P<S>[0-9]+)", info[key])
|
||||||
datetimestr = "2000/01/01 00:00:00" # default used if time not found (stops import crashing, but handstart will be wrong)
|
datetimestr = "2000/01/01 00:00:00" # default used if time not found (stops import crashing, but startTime will be wrong)
|
||||||
for a in m1:
|
for a in m1:
|
||||||
datetimestr = "%s/%s/%s %s:%s:%s" % (a.group('Y'), a.group('M'),a.group('D'),a.group('H'),a.group('MIN'),a.group('S'))
|
datetimestr = "%s/%s/%s %s:%s:%s" % (a.group('Y'), a.group('M'),a.group('D'),a.group('H'),a.group('MIN'),a.group('S'))
|
||||||
#tz = a.group('TZ') # just assume ET??
|
#tz = a.group('TZ') # just assume ET??
|
||||||
#print " tz = ", tz, " datetime =", datetimestr
|
#print " tz = ", tz, " datetime =", datetimestr
|
||||||
hand.starttime = datetime.datetime.strptime(datetimestr, "%Y/%m/%d %H:%M:%S") # also timezone at end, e.g. " ET"
|
hand.startTime = datetime.datetime.strptime(datetimestr, "%Y/%m/%d %H:%M:%S") # also timezone at end, e.g. " ET"
|
||||||
# approximate rules for ET daylight savings time:
|
hand.startTime = removeET(hand.startTime)
|
||||||
if ( hand.starttime.month == 12 # all of Dec
|
|
||||||
or (hand.starttime.month == 11 and hand.starttime.day > 4) # and most of November
|
|
||||||
or hand.starttime.month < 3 # and all of Jan/Feb
|
|
||||||
or (hand.starttime.month == 3 and hand.starttime.day < 11) ): # and 1st 10 days of March
|
|
||||||
offset = datetime.timedelta(hours=5) # are EST: assume 5 hour offset (ET without daylight saving)
|
|
||||||
else:
|
|
||||||
offset = datetime.timedelta(hours=4) # rest is EDT: assume 4 hour offset (ET with daylight saving)
|
|
||||||
# adjust time into UTC:
|
|
||||||
hand.starttime = hand.starttime + offset
|
|
||||||
#print " tz = %s start = %s" % (tz, str(hand.starttime))
|
|
||||||
if key == 'HID':
|
if key == 'HID':
|
||||||
hand.handid = info[key]
|
hand.handid = info[key]
|
||||||
if key == 'TOURNO':
|
if key == 'TOURNO':
|
||||||
hand.tourNo = info[key]
|
hand.tourNo = info[key]
|
||||||
if key == 'BUYIN':
|
if key == 'BUYIN':
|
||||||
|
if hand.tourNo!=None:
|
||||||
if info[key] == 'Freeroll':
|
if info[key] == 'Freeroll':
|
||||||
hand.buyin = '$0+$0'
|
hand.buyin = 0
|
||||||
|
hand.fee = 0
|
||||||
|
hand.buyinCurrency = "FREE"
|
||||||
else:
|
else:
|
||||||
#FIXME: The key looks like: '€0.82+€0.18 EUR'
|
#print "info[key]:",info[key]
|
||||||
# This should be parsed properly and used
|
if info[key].find("$")!=-1:
|
||||||
hand.buyin = info[key]
|
hand.buyinCurrency="USD"
|
||||||
|
elif info[key].find(u"€")!=-1:
|
||||||
|
hand.buyinCurrency="EUR"
|
||||||
|
elif info[key].find("FPP")!=-1:
|
||||||
|
hand.buyinCurrency="PSFP"
|
||||||
|
else:
|
||||||
|
raise FpdbParseError("failed to detect currency") #FIXME: handle other currencies, FPP, play money
|
||||||
|
|
||||||
|
if hand.buyinCurrency=="USD" or hand.buyinCurrency=="EUR":
|
||||||
|
info[key]=info[key][:-4]
|
||||||
|
middle=info[key].find("+")
|
||||||
|
hand.buyin = int(100*Decimal(info[key][1:middle]))
|
||||||
|
hand.fee = int(100*Decimal(info[key][middle+2:]))
|
||||||
|
elif hand.buyinCurrency=="PSFP":
|
||||||
|
hand.buyin = int(Decimal(info[key][0:-3]))
|
||||||
|
hand.fee = 0
|
||||||
if key == 'LEVEL':
|
if key == 'LEVEL':
|
||||||
hand.level = info[key]
|
hand.level = info[key]
|
||||||
|
|
||||||
|
|
948
pyfpdb/RingFilters.py
Normal file
948
pyfpdb/RingFilters.py
Normal file
|
@ -0,0 +1,948 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
#Copyright 2008-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.
|
||||||
|
#
|
||||||
|
#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 <http://www.gnu.org/licenses/>.
|
||||||
|
#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 gmtime, mktime, strftime, strptime
|
||||||
|
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
|
||||||
|
import Filters
|
||||||
|
|
||||||
|
class RingFilters(Filters.Filters):
|
||||||
|
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 (%s) - EEK" % site
|
||||||
|
|
||||||
|
# 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
|
||||||
|
#end def getNumHands
|
||||||
|
|
||||||
|
def getSites(self):
|
||||||
|
return self.sites
|
||||||
|
#end def getSites
|
||||||
|
|
||||||
|
def getGames(self):
|
||||||
|
return self.games
|
||||||
|
|
||||||
|
def getSiteIds(self):
|
||||||
|
return self.siteid
|
||||||
|
#end def getSiteIds
|
||||||
|
|
||||||
|
def getHeroes(self):
|
||||||
|
return self.heroes
|
||||||
|
#end def getHeroes
|
||||||
|
|
||||||
|
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
|
||||||
|
#end def getSeats
|
||||||
|
|
||||||
|
def getGroups(self):
|
||||||
|
return self.groups
|
||||||
|
|
||||||
|
def getDates(self):
|
||||||
|
return self.__get_dates()
|
||||||
|
#end def getDates
|
||||||
|
|
||||||
|
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
|
||||||
|
#end def registerButton2Name
|
||||||
|
|
||||||
|
def registerButton2Callback(self, callback):
|
||||||
|
self.Button2.connect("clicked", callback, "clicked")
|
||||||
|
self.Button2.set_sensitive(True)
|
||||||
|
self.callback['button2'] = callback
|
||||||
|
#end def registerButton2Callback
|
||||||
|
|
||||||
|
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]))
|
||||||
|
#end def __set_hero_name
|
||||||
|
|
||||||
|
def __set_num_hands(self, w, val):
|
||||||
|
try:
|
||||||
|
self.numHands = int(w.get_text())
|
||||||
|
except:
|
||||||
|
self.numHands = 0
|
||||||
|
#log.debug("setting numHands:", self.numHands)
|
||||||
|
#end def __set_num_hands
|
||||||
|
|
||||||
|
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]))
|
||||||
|
#end def __set_game_select
|
||||||
|
|
||||||
|
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")
|
||||||
|
#end def fillGamesFrame
|
||||||
|
|
||||||
|
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['getCashLimits'])
|
||||||
|
# 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
|
||||||
|
#end def fillSeatsFrame
|
||||||
|
|
||||||
|
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)
|
||||||
|
#end def fillDateFrame
|
||||||
|
|
||||||
|
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")
|
||||||
|
#end def __toggle_box
|
||||||
|
|
||||||
|
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()
|
||||||
|
#end def __calendar_dialog
|
||||||
|
|
||||||
|
def __clear_dates(self, w):
|
||||||
|
self.start_date.set_text('')
|
||||||
|
self.end_date.set_text('')
|
||||||
|
#end def __clear_dates
|
||||||
|
|
||||||
|
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-02'
|
||||||
|
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)
|
||||||
|
#end def __get_dates
|
||||||
|
|
||||||
|
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())
|
739
pyfpdb/SQL.py
739
pyfpdb/SQL.py
File diff suppressed because it is too large
Load Diff
|
@ -1,8 +1,9 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""Manage collecting and formatting of stats and tooltips.
|
"""Manage collecting and formatting of stats and tooltips.
|
||||||
"""
|
"""
|
||||||
# Copyright 2008, Ray E. Barker
|
# Copyright 2008-2010, Ray E. Barker
|
||||||
|
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -57,6 +58,7 @@ import re
|
||||||
# FreePokerTools modules
|
# FreePokerTools modules
|
||||||
import Configuration
|
import Configuration
|
||||||
import Database
|
import Database
|
||||||
|
import Charset
|
||||||
|
|
||||||
|
|
||||||
re_Places = re.compile("_[0-9]$")
|
re_Places = re.compile("_[0-9]$")
|
||||||
|
@ -67,7 +69,7 @@ import codecs
|
||||||
encoder = codecs.lookup(Configuration.LOCALE_ENCODING)
|
encoder = codecs.lookup(Configuration.LOCALE_ENCODING)
|
||||||
|
|
||||||
def do_tip(widget, tip):
|
def do_tip(widget, tip):
|
||||||
(_tip, _len) = encoder.encode(tip)
|
_tip = Charset.to_utf8(tip)
|
||||||
widget.set_tooltip_text(_tip)
|
widget.set_tooltip_text(_tip)
|
||||||
|
|
||||||
def do_stat(stat_dict, player = 24, stat = 'vpip'):
|
def do_stat(stat_dict, player = 24, stat = 'vpip'):
|
||||||
|
@ -113,7 +115,7 @@ def playername(stat_dict, player):
|
||||||
stat_dict[player]['screen_name'])
|
stat_dict[player]['screen_name'])
|
||||||
|
|
||||||
def vpip(stat_dict, player):
|
def vpip(stat_dict, player):
|
||||||
""" Voluntarily put $ in the pot."""
|
""" Voluntarily put $ in the pot pre-flop."""
|
||||||
stat = 0.0
|
stat = 0.0
|
||||||
try:
|
try:
|
||||||
stat = float(stat_dict[player]['vpip'])/float(stat_dict[player]['n'])
|
stat = float(stat_dict[player]['vpip'])/float(stat_dict[player]['n'])
|
||||||
|
@ -122,14 +124,14 @@ def vpip(stat_dict, player):
|
||||||
'v=%3.1f' % (100*stat) + '%',
|
'v=%3.1f' % (100*stat) + '%',
|
||||||
'vpip=%3.1f' % (100*stat) + '%',
|
'vpip=%3.1f' % (100*stat) + '%',
|
||||||
'(%d/%d)' % (stat_dict[player]['vpip'], stat_dict[player]['n']),
|
'(%d/%d)' % (stat_dict[player]['vpip'], stat_dict[player]['n']),
|
||||||
'Voluntarily Put In Pot %'
|
'Voluntarily Put In Pot Pre-Flop%'
|
||||||
)
|
)
|
||||||
except: return (stat,
|
except: return (stat,
|
||||||
'%3.1f' % (0) + '%',
|
'%3.1f' % (0) + '%',
|
||||||
'v=%3.1f' % (0) + '%',
|
'v=%3.1f' % (0) + '%',
|
||||||
'vpip=%3.1f' % (0) + '%',
|
'vpip=%3.1f' % (0) + '%',
|
||||||
'(%d/%d)' % (0, 0),
|
'(%d/%d)' % (0, 0),
|
||||||
'Voluntarily Put In Pot %'
|
'Voluntarily Put In Pot Pre-Flop%'
|
||||||
)
|
)
|
||||||
|
|
||||||
def pfr(stat_dict, player):
|
def pfr(stat_dict, player):
|
||||||
|
@ -277,7 +279,7 @@ def fold_f(stat_dict, player):
|
||||||
""" Folded flop/4th."""
|
""" Folded flop/4th."""
|
||||||
stat = 0.0
|
stat = 0.0
|
||||||
try:
|
try:
|
||||||
stat = float(stat_dict[player]['fold_2'])/fold(stat_dict[player]['saw_f'])
|
stat = float(stat_dict[player]['fold_2'])/float(stat_dict[player]['saw_f'])
|
||||||
return (stat,
|
return (stat,
|
||||||
'%3.1f' % (100*stat) + '%',
|
'%3.1f' % (100*stat) + '%',
|
||||||
'ff=%3.1f' % (100*stat) + '%',
|
'ff=%3.1f' % (100*stat) + '%',
|
||||||
|
@ -503,6 +505,91 @@ def a_freq_123(stat_dict, player):
|
||||||
'Post-Flop Aggression Freq'
|
'Post-Flop Aggression Freq'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def agg_freq(stat_dict, player):
|
||||||
|
""" Post-Flop aggression frequency."""
|
||||||
|
""" Aggression frequency % = (times bet or raised post-flop) * 100 / (times bet, raised, called, or folded post-flop) """
|
||||||
|
stat = 0.0
|
||||||
|
try:
|
||||||
|
""" Agression on the flop and all streets """
|
||||||
|
bet_raise = stat_dict[player]['aggr_1'] + stat_dict[player]['aggr_2'] + stat_dict[player]['aggr_3'] + stat_dict[player]['aggr_4']
|
||||||
|
""" number post flop streets seen, this must be number of post-flop calls !! """
|
||||||
|
post_call = stat_dict[player]['call_1'] + stat_dict[player]['call_2'] + stat_dict[player]['call_3'] + stat_dict[player]['call_4']
|
||||||
|
""" Number of post flop folds this info is not yet in the database """
|
||||||
|
post_fold = stat_dict[player]['f_freq_1'] + stat_dict[player]['f_freq_2'] + stat_dict[player]['f_freq_3'] + stat_dict[player]['f_freq_4']
|
||||||
|
|
||||||
|
stat = float (bet_raise) / float(post_call + post_fold + bet_raise)
|
||||||
|
|
||||||
|
return (stat,
|
||||||
|
'%3.1f' % (100*stat) + '%',
|
||||||
|
'afr=%3.1f' % (100*stat) + '%',
|
||||||
|
'agg_fr=%3.1f' % (100*stat) + '%',
|
||||||
|
'(%d/%d)' % (bet_raise, (post_call + post_fold + bet_raise)),
|
||||||
|
'Aggression Freq'
|
||||||
|
)
|
||||||
|
except:
|
||||||
|
return (stat,
|
||||||
|
'%2.1f' % (0) + '%',
|
||||||
|
'af=%3.1f' % (0) + '%',
|
||||||
|
'agg_f=%3.1f' % (0) + '%',
|
||||||
|
'(%d/%d)' % (0, 0),
|
||||||
|
'Aggression Freq'
|
||||||
|
)
|
||||||
|
|
||||||
|
def agg_fact(stat_dict, player):
|
||||||
|
""" Post-Flop aggression frequency."""
|
||||||
|
""" Aggression factor = (times bet or raised post-flop) / (times called post-flop) """
|
||||||
|
stat = 0.0
|
||||||
|
try:
|
||||||
|
bet_raise = stat_dict[player]['aggr_1'] + stat_dict[player]['aggr_2'] + stat_dict[player]['aggr_3'] + stat_dict[player]['aggr_4']
|
||||||
|
post_call = stat_dict[player]['call_1'] + stat_dict[player]['call_2'] + stat_dict[player]['call_3'] + stat_dict[player]['call_4']
|
||||||
|
|
||||||
|
if post_call > 0:
|
||||||
|
stat = float (bet_raise) / float(post_call)
|
||||||
|
else:
|
||||||
|
stat = float (bet_raise)
|
||||||
|
return (stat,
|
||||||
|
'%2.2f' % (stat) ,
|
||||||
|
'afa=%2.2f' % (stat) ,
|
||||||
|
'agg_fa=%2.2f' % (stat) ,
|
||||||
|
'(%d/%d)' % (bet_raise, post_call),
|
||||||
|
'Aggression Factor'
|
||||||
|
)
|
||||||
|
except:
|
||||||
|
return (stat,
|
||||||
|
'%2.2f' % (0) ,
|
||||||
|
'afa=%2.2f' % (0) ,
|
||||||
|
'agg_fa=%2.2f' % (0),
|
||||||
|
'(%d/%d)' % (0, 0),
|
||||||
|
'Aggression Factor'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def cbet(stat_dict, player):
|
||||||
|
|
||||||
|
""" Flop continuation bet."""
|
||||||
|
""" Continuation bet % = (times made a continuation bet on the flop) * 100 / (number of opportunities to make a continuation bet on the flop) """
|
||||||
|
|
||||||
|
stat = 0.0
|
||||||
|
try:
|
||||||
|
cbets = stat_dict[player]['cb_1']+stat_dict[player]['cb_2']+stat_dict[player]['cb_3']+stat_dict[player]['cb_4']
|
||||||
|
oppt = stat_dict[player]['cb_opp_1']+stat_dict[player]['cb_opp_2']+stat_dict[player]['cb_opp_3']+stat_dict[player]['cb_opp_4']
|
||||||
|
stat = float(cbets)/float(oppt)
|
||||||
|
return (stat,
|
||||||
|
'%3.1f' % (100*stat) + '%',
|
||||||
|
'cbet=%3.1f' % (100*stat) + '%',
|
||||||
|
'cbet=%3.1f' % (100*stat) + '%',
|
||||||
|
'(%d/%d)' % (cbets, oppt),
|
||||||
|
'% continuation bet '
|
||||||
|
)
|
||||||
|
except:
|
||||||
|
return (stat,
|
||||||
|
'%3.1f' % (0) + '%',
|
||||||
|
'cbet=%3.1f' % (0) + '%',
|
||||||
|
'cbet=%3.1f' % (0) + '%',
|
||||||
|
'(%d/%d)' % (0, 0),
|
||||||
|
'% continuation bet '
|
||||||
|
)
|
||||||
|
|
||||||
def cb1(stat_dict, player):
|
def cb1(stat_dict, player):
|
||||||
""" Flop continuation bet."""
|
""" Flop continuation bet."""
|
||||||
stat = 0.0
|
stat = 0.0
|
||||||
|
|
66
pyfpdb/Summaries.py
Normal file
66
pyfpdb/Summaries.py
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
#Copyright 2008-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.
|
||||||
|
#
|
||||||
|
#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 <http://www.gnu.org/licenses/>.
|
||||||
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
|
|
||||||
|
"""This file is to fetch summaries through IMAP and pass them on to the appropriate parser"""
|
||||||
|
#see http://docs.python.org/library/imaplib.html for the python interface
|
||||||
|
#see http://tools.ietf.org/html/rfc2060#section-6.4.4 for IMAP4 search criteria
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from imaplib import IMAP4_SSL
|
||||||
|
from Summaries import Summaries
|
||||||
|
from PokerStarsSummaries import PokerStarsSummaries
|
||||||
|
|
||||||
|
#TODO: move all these into the config file. until then usage is: ./ImapSummaries.py YourImapHost YourImapUser YourImapPw
|
||||||
|
configHost=sys.argv[1]
|
||||||
|
configUser=sys.argv[2]
|
||||||
|
configPw=sys.argv[3]
|
||||||
|
|
||||||
|
server = IMAP4_SSL(configHost) #TODO: optionally non-SSL
|
||||||
|
response = server.login(configUser, configPw) #TODO catch authentication error
|
||||||
|
#print "response to logging in:",response
|
||||||
|
#print "server.list():",server.list() #prints list of folders
|
||||||
|
|
||||||
|
response = server.select("INBOX")
|
||||||
|
#print "response to selecting INBOX:",response
|
||||||
|
if response[0]!="OK":
|
||||||
|
raise error #TODO: show error message
|
||||||
|
|
||||||
|
neededMessages=[]
|
||||||
|
response, searchData = server.search(None, "SUBJECT", "PokerStars Tournament History Request")
|
||||||
|
for messageNumber in searchData[0].split(" "):
|
||||||
|
response, headerData = server.fetch(messageNumber, "(BODY[HEADER.FIELDS (SUBJECT)])")
|
||||||
|
#print "response to fetch subject:",response
|
||||||
|
if response!="OK":
|
||||||
|
raise error #TODO: show error message
|
||||||
|
if headerData[1].find("Subject: PokerStars Tournament History Request - Last x")!=1:
|
||||||
|
neededMessages.append((messageNumber, "PS")
|
||||||
|
|
||||||
|
tourneys=[]
|
||||||
|
if len(neededMessages)==0:
|
||||||
|
raise error #TODO: show error message
|
||||||
|
for messageData in neededMessages:
|
||||||
|
response, bodyData = server.fetch(messageData[0], "(UID BODY[TEXT])")
|
||||||
|
if response!="OK":
|
||||||
|
raise error #TODO: show error message
|
||||||
|
if messageData[0]=="PS":
|
||||||
|
tourneys.append(PokerStarsSummaries.PokerStarsSummaries(bodyData)
|
||||||
|
|
||||||
|
for tourney in tourneys:
|
||||||
|
print "tourney:",tourney
|
||||||
|
|
||||||
|
server.close()
|
||||||
|
server.logout()
|
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Copyright (c) 2009 Eric Blade, and the FPDB team.
|
# Copyright (c) 2009-2010 Eric Blade, and the FPDB team.
|
||||||
|
|
||||||
#This program is free software: you can redistribute it and/or modify
|
#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
|
#it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -13,8 +14,7 @@
|
||||||
#
|
#
|
||||||
#You should have received a copy of the GNU Affero General Public License
|
#You should have received a copy of the GNU Affero General Public License
|
||||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#In the "official" distribution you can find the license in
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
#agpl-3.0.txt in the docs folder of the package.
|
|
||||||
|
|
||||||
import urllib, htmllib, formatter
|
import urllib, htmllib, formatter
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class SummaryParser(htmllib.HTMLParser): # derive new HTML parser
|
||||||
self.nextPool = False
|
self.nextPool = False
|
||||||
self.TourneyPool = None
|
self.TourneyPool = None
|
||||||
self.nextPlayers = False
|
self.nextPlayers = False
|
||||||
self.TourneyPlayers = None
|
self.TourneysPlayers = None
|
||||||
self.nextAllowRebuys = False
|
self.nextAllowRebuys = False
|
||||||
self.TourneyRebuys = None
|
self.TourneyRebuys = None
|
||||||
self.parseResultsA = False
|
self.parseResultsA = False
|
||||||
|
@ -134,7 +134,7 @@ class SummaryParser(htmllib.HTMLParser): # derive new HTML parser
|
||||||
if not self.nextPlayers and x == "Player Count:":
|
if not self.nextPlayers and x == "Player Count:":
|
||||||
self.nextPlayers = True
|
self.nextPlayers = True
|
||||||
elif self.nextPlayers:
|
elif self.nextPlayers:
|
||||||
self.TourneyPlayers = x
|
self.TourneysPlayers = x
|
||||||
self.nextPlayers = False
|
self.nextPlayers = False
|
||||||
|
|
||||||
if not self.nextAllowRebuys and x == "Rebuys possible?:":
|
if not self.nextAllowRebuys and x == "Rebuys possible?:":
|
||||||
|
@ -179,7 +179,7 @@ class EverleafSummary:
|
||||||
print "site=",self.parser.SiteName, "tourneyname=", self.parser.TourneyName, "tourneyid=", self.parser.TourneyId
|
print "site=",self.parser.SiteName, "tourneyname=", self.parser.TourneyName, "tourneyid=", self.parser.TourneyId
|
||||||
print "start time=",self.parser.TourneyStartTime, "end time=",self.parser.TourneyEndTime
|
print "start time=",self.parser.TourneyStartTime, "end time=",self.parser.TourneyEndTime
|
||||||
print "structure=", self.parser.TourneyStructure, "game type=",self.parser.TourneyGameType
|
print "structure=", self.parser.TourneyStructure, "game type=",self.parser.TourneyGameType
|
||||||
print "buy-in=", self.parser.TourneyBuyIn, "rebuys=", self.parser.TourneyRebuys, "total players=", self.parser.TourneyPlayers, "pool=", self.parser.TourneyPool
|
print "buy-in=", self.parser.TourneyBuyIn, "rebuys=", self.parser.TourneyRebuys, "total players=", self.parser.TourneysPlayers, "pool=", self.parser.TourneyPool
|
||||||
print "results=", self.parser.Results
|
print "results=", self.parser.Results
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
"""Discover_TableWindow.py
|
"""Discover_TableWindow.py
|
||||||
|
|
||||||
Inspects the currently open windows and finds those of interest to us--that is
|
Inspects the currently open windows and finds those of interest to us--that is
|
||||||
poker table windows from supported sites. Returns a list
|
poker table windows from supported sites. Returns a list
|
||||||
of Table_Window objects representing the windows found.
|
of Table_Window objects representing the windows found.
|
||||||
"""
|
"""
|
||||||
# Copyright 2008 - 2009, Ray E. Barker
|
# Copyright 2008-2010, Ray E. Barker
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
"""Discover_Tables.py
|
"""Discover_Tables.py
|
||||||
|
|
||||||
Inspects the currently open windows and finds those of interest to us--that is
|
Inspects the currently open windows and finds those of interest to us--that is
|
||||||
poker table windows from supported sites. Returns a list
|
poker table windows from supported sites. Returns a list
|
||||||
of Table_Window objects representing the windows found.
|
of Table_Window objects representing the windows found.
|
||||||
"""
|
"""
|
||||||
# Copyright 2008, Ray E. Barker
|
# Copyright 2008-2010, Ray E. Barker
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
"""Tables_Demo.py
|
"""Tables_Demo.py
|
||||||
|
|
||||||
Main program module to test/demo the Tables subclasses.
|
Main program module to test/demo the Tables subclasses.
|
||||||
"""
|
"""
|
||||||
# Copyright 2008 - 2009, Ray E. Barker
|
# Copyright 2008-2010, Ray E. Barker
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
"""TourneyTracker.py
|
"""TourneyTracker.py
|
||||||
Based on HUD_main .. who knows if we want to actually use this or not
|
Based on HUD_main .. who knows if we want to actually use this or not
|
||||||
"""
|
"""
|
||||||
# Copyright 2008, 2009, Eric Blade
|
# Copyright 2008-2010, Eric Blade
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -86,7 +87,7 @@ class Tournament:
|
||||||
self.buyin = summary.parser.TourneyBuyIn # need to remember to parse the Fee out of this and move it to self.fee
|
self.buyin = summary.parser.TourneyBuyIn # need to remember to parse the Fee out of this and move it to self.fee
|
||||||
self.rebuys = (summary.parser.TourneyRebuys == "yes")
|
self.rebuys = (summary.parser.TourneyRebuys == "yes")
|
||||||
self.prizepool = summary.parser.TourneyPool
|
self.prizepool = summary.parser.TourneyPool
|
||||||
self.numplayers = summary.parser.TourneyPlayers
|
self.numplayers = summary.parser.TourneysPlayers
|
||||||
|
|
||||||
self.openwindow() # let's start by getting any info we need.. meh
|
self.openwindow() # let's start by getting any info we need.. meh
|
||||||
|
|
||||||
|
|
540
pyfpdb/TourneyFilters.py
Normal file
540
pyfpdb/TourneyFilters.py
Normal file
|
@ -0,0 +1,540 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
#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.
|
||||||
|
#
|
||||||
|
#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 <http://www.gnu.org/licenses/>.
|
||||||
|
#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 gobject
|
||||||
|
#import os
|
||||||
|
#import sys
|
||||||
|
#from optparse import OptionParser
|
||||||
|
from time import gmtime, mktime, strftime, strptime
|
||||||
|
#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
|
||||||
|
import Filters
|
||||||
|
|
||||||
|
class TourneyFilters(Filters.Filters):
|
||||||
|
def __init__(self, db, config, qdict, display = {}, debug=True):
|
||||||
|
self.debug = debug
|
||||||
|
self.db = db
|
||||||
|
self.cursor = db.cursor
|
||||||
|
self.sql = db.sql
|
||||||
|
self.conf = db.config
|
||||||
|
self.display = display
|
||||||
|
|
||||||
|
self.filterText = {'playerstitle':'Hero:', 'sitestitle':'Sites:', 'seatstitle':'Number of Players:',
|
||||||
|
'seatsbetween':'Between:', 'seatsand':'And:', 'datestitle':'Date:',
|
||||||
|
'tourneyTypesTitle':'Tourney Type'}
|
||||||
|
|
||||||
|
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()
|
||||||
|
#end def __init__
|
||||||
|
|
||||||
|
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()
|
||||||
|
#end def __calendar_dialog
|
||||||
|
|
||||||
|
def __clear_dates(self, w):
|
||||||
|
self.start_date.set_text('')
|
||||||
|
self.end_date.set_text('')
|
||||||
|
#end def __clear_dates
|
||||||
|
|
||||||
|
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-02'
|
||||||
|
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)
|
||||||
|
#end def __get_dates
|
||||||
|
|
||||||
|
def __refresh(self, widget, entry):
|
||||||
|
for w in self.mainVBox.get_children():
|
||||||
|
w.destroy()
|
||||||
|
self.make_filter()
|
||||||
|
#end def __refresh
|
||||||
|
|
||||||
|
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]))
|
||||||
|
#end def __set_hero_name
|
||||||
|
|
||||||
|
def __set_num_tourneys(self, w, val):
|
||||||
|
try:
|
||||||
|
self.numTourneys = int(w.get_text())
|
||||||
|
except:
|
||||||
|
self.numTourneys = 0
|
||||||
|
print "setting numTourneys:", self.numTourneys
|
||||||
|
#end def __set_num_tourneys
|
||||||
|
|
||||||
|
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]) )
|
||||||
|
#end def __set_seat_select
|
||||||
|
|
||||||
|
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]))
|
||||||
|
#end def __set_site_select
|
||||||
|
|
||||||
|
def __set_tourney_type_select(self, w, tourneyType):
|
||||||
|
#print w.get_active()
|
||||||
|
self.tourneyTypes[tourneyType] = w.get_active()
|
||||||
|
log.debug("self.tourney_types[%s] set to %s" %(tourneyType, self.tourneyTypes[tourneyType]))
|
||||||
|
#end def __set_tourney_type_select
|
||||||
|
|
||||||
|
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")
|
||||||
|
#end def __toggle_box
|
||||||
|
|
||||||
|
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)
|
||||||
|
#end def createPlayerLine
|
||||||
|
|
||||||
|
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)
|
||||||
|
#end def createSiteLine
|
||||||
|
|
||||||
|
def createTourneyTypeLine(self, hbox, tourneyType):
|
||||||
|
cb = gtk.CheckButton(str(tourneyType))
|
||||||
|
cb.connect('clicked', self.__set_tourney_type_select, tourneyType)
|
||||||
|
hbox.pack_start(cb, False, False, 0)
|
||||||
|
cb.set_active(True)
|
||||||
|
#end def createTourneyTypeLine
|
||||||
|
|
||||||
|
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)
|
||||||
|
#end def fillDateFrame
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
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)
|
||||||
|
#end def fillPlayerFrame
|
||||||
|
|
||||||
|
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
|
||||||
|
#end def fillSeatsFrame
|
||||||
|
|
||||||
|
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)
|
||||||
|
#end def fillSitesFrame
|
||||||
|
|
||||||
|
def fillTourneyTypesFrame(self, vbox):
|
||||||
|
top_hbox = gtk.HBox(False, 0)
|
||||||
|
vbox.pack_start(top_hbox, False, False, 0)
|
||||||
|
lbl_title = gtk.Label(self.filterText['tourneyTypesTitle'])
|
||||||
|
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, 'tourneyTypes')
|
||||||
|
top_hbox.pack_start(showb, expand=False, padding=1)
|
||||||
|
|
||||||
|
vbox1 = gtk.VBox(False, 0)
|
||||||
|
vbox.pack_start(vbox1, False, False, 0)
|
||||||
|
self.boxes['tourneyTypes'] = vbox1
|
||||||
|
|
||||||
|
result = self.db.getTourneyTypesIds()
|
||||||
|
if len(result) >= 1:
|
||||||
|
for line in result:
|
||||||
|
hbox = gtk.HBox(False, 0)
|
||||||
|
vbox1.pack_start(hbox, False, True, 0)
|
||||||
|
self.createTourneyTypeLine(hbox, line[0])
|
||||||
|
else:
|
||||||
|
print "INFO: No tourney types returned from database"
|
||||||
|
log.info("No tourney types returned from database")
|
||||||
|
#end def fillTourneyTypesFrame
|
||||||
|
|
||||||
|
def getDates(self):
|
||||||
|
return self.__get_dates()
|
||||||
|
#end def getDates
|
||||||
|
|
||||||
|
def getHeroes(self):
|
||||||
|
return self.heroes
|
||||||
|
#end def getHeroes
|
||||||
|
|
||||||
|
def getNumTourneys(self):
|
||||||
|
return self.numTourneys
|
||||||
|
#end def getNumTourneys
|
||||||
|
|
||||||
|
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
|
||||||
|
#end def getSeats
|
||||||
|
|
||||||
|
def getSiteIds(self):
|
||||||
|
return self.siteid
|
||||||
|
#end def getSiteIds
|
||||||
|
|
||||||
|
def getSites(self):
|
||||||
|
return self.sites
|
||||||
|
#end def getSites
|
||||||
|
|
||||||
|
def getTourneyTypes(self):
|
||||||
|
return self.tourneyTypes
|
||||||
|
#end def getTourneyTypes
|
||||||
|
|
||||||
|
def get_vbox(self):
|
||||||
|
"""returns the vbox of this thread"""
|
||||||
|
return self.mainVBox
|
||||||
|
#end def get_vbox
|
||||||
|
|
||||||
|
def make_filter(self):
|
||||||
|
self.tourneyTypes = {}
|
||||||
|
#self.tourneys = {}
|
||||||
|
self.sites = {}
|
||||||
|
self.seats = {}
|
||||||
|
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 (%s) - EEK" % site
|
||||||
|
|
||||||
|
# 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.numTourneys = 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)
|
||||||
|
|
||||||
|
# Tourney types
|
||||||
|
tourneyTypesFrame = gtk.Frame()
|
||||||
|
tourneyTypesFrame.set_label_align(0.0, 0.0)
|
||||||
|
tourneyTypesFrame.show()
|
||||||
|
vbox = gtk.VBox(False, 0)
|
||||||
|
|
||||||
|
self.fillTourneyTypesFrame(vbox)
|
||||||
|
tourneyTypesFrame.add(vbox)
|
||||||
|
|
||||||
|
# Seats
|
||||||
|
seatsFrame = gtk.Frame()
|
||||||
|
seatsFrame.show()
|
||||||
|
vbox = gtk.VBox(False, 0)
|
||||||
|
self.sbSeats = {}
|
||||||
|
|
||||||
|
self.fillSeatsFrame(vbox, self.display)
|
||||||
|
seatsFrame.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(seatsFrame)
|
||||||
|
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 "Seats" not in self.display or self.display["Seats"] == False:
|
||||||
|
seatsFrame.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()
|
||||||
|
#end def make_filter
|
||||||
|
|
||||||
|
def registerButton2Name(self, title):
|
||||||
|
self.Button2.set_label(title)
|
||||||
|
self.label['button2'] = title
|
||||||
|
#end def registerButton2Name
|
||||||
|
|
||||||
|
def registerButton2Callback(self, callback):
|
||||||
|
self.Button2.connect("clicked", callback, "clicked")
|
||||||
|
self.Button2.set_sensitive(True)
|
||||||
|
self.callback['button2'] = callback
|
||||||
|
#end def registerButton2Callback
|
||||||
|
#end class TourneyFilters
|
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
#Copyright 2009 Stephane Alessio
|
#Copyright 2009-2010 Stephane Alessio
|
||||||
#This program is free software: you can redistribute it and/or modify
|
#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
|
#it under the terms of the GNU Affero General Public License as published by
|
||||||
#the Free Software Foundation, version 3 of the License.
|
#the Free Software Foundation, version 3 of the License.
|
||||||
|
@ -12,8 +13,9 @@
|
||||||
#
|
#
|
||||||
#You should have received a copy of the GNU Affero General Public License
|
#You should have received a copy of the GNU Affero General Public License
|
||||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#In the "official" distribution you can find the license in
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
#agpl-3.0.txt in the docs folder of the package.
|
|
||||||
|
"""parses and stores summary sections from e.g. eMail or summary files"""
|
||||||
|
|
||||||
# TODO: check to keep only the needed modules
|
# TODO: check to keep only the needed modules
|
||||||
|
|
||||||
|
@ -34,7 +36,7 @@ import Card
|
||||||
|
|
||||||
log = logging.getLogger("parser")
|
log = logging.getLogger("parser")
|
||||||
|
|
||||||
class Tourney(object):
|
class TourneySummary(object):
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
# Class Variables
|
# Class Variables
|
||||||
|
@ -45,63 +47,82 @@ class Tourney(object):
|
||||||
SITEIDS = {'Fulltilt':1, 'PokerStars':2, 'Everleaf':3, 'Win2day':4, 'OnGame':5, 'UltimateBet':6, 'Betfair':7, 'Absolute':8, 'PartyPoker':9 }
|
SITEIDS = {'Fulltilt':1, 'PokerStars':2, 'Everleaf':3, 'Win2day':4, 'OnGame':5, 'UltimateBet':6, 'Betfair':7, 'Absolute':8, 'PartyPoker':9 }
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, sitename, gametype, summaryText, builtFrom = "HHC"):
|
def __init__(self, db, config, siteName, summaryText, builtFrom = "HHC"):
|
||||||
self.sitename = sitename
|
self.db = db
|
||||||
self.siteId = self.SITEIDS[sitename]
|
self.config = config
|
||||||
self.gametype = gametype
|
self.siteName = siteName
|
||||||
self.starttime = None
|
self.siteId = self.SITEIDS[siteName]
|
||||||
self.endtime = None
|
|
||||||
self.summaryText = summaryText
|
self.summaryText = summaryText
|
||||||
self.tourneyName = None
|
self.tourneyName = None
|
||||||
|
self.tourneyTypeId = None
|
||||||
|
self.tourneyId = None
|
||||||
|
self.startTime = None
|
||||||
|
self.endTime = None
|
||||||
self.tourNo = None
|
self.tourNo = None
|
||||||
|
self.currency = None
|
||||||
self.buyin = None
|
self.buyin = None
|
||||||
self.fee = None # the Database code is looking for this one .. ?
|
self.fee = None
|
||||||
self.hero = None
|
self.hero = None
|
||||||
self.maxseats = None
|
self.maxseats = None
|
||||||
self.entries = 0
|
self.entries = 0
|
||||||
self.speed = "Normal"
|
self.speed = "Normal"
|
||||||
self.prizepool = None # Make it a dict in order to deal (eventually later) with non-money winnings : {'MONEY' : amount, 'OTHER' : Value ??}
|
self.prizepool = 0 # Make it a dict in order to deal (eventually later) with non-money winnings : {'MONEY' : amount, 'OTHER' : Value ??}
|
||||||
self.buyInChips = None
|
self.buyInChips = 0
|
||||||
self.mixed = None
|
self.mixed = None
|
||||||
self.isRebuy = False
|
self.isRebuy = False
|
||||||
|
self.isAddOn = False
|
||||||
self.isKO = False
|
self.isKO = False
|
||||||
self.isHU = False
|
|
||||||
self.isMatrix = False
|
self.isMatrix = False
|
||||||
self.isShootout = False
|
self.isShootout = False
|
||||||
self.matrixMatchId = None # For Matrix tourneys : 1-4 => match tables (traditionnal), 0 => Positional winnings info
|
self.matrixMatchId = None # For Matrix tourneys : 1-4 => match tables (traditionnal), 0 => Positional winnings info
|
||||||
|
self.matrixIdProcessed = None
|
||||||
self.subTourneyBuyin = None
|
self.subTourneyBuyin = None
|
||||||
self.subTourneyFee = None
|
self.subTourneyFee = None
|
||||||
self.rebuyChips = 0
|
self.rebuyChips = 0
|
||||||
self.addOnChips = 0
|
self.addOnChips = 0
|
||||||
self.rebuyAmount = 0
|
self.rebuyCost = 0
|
||||||
self.addOnAmount = 0
|
self.addOnCost = 0
|
||||||
self.totalRebuys = 0
|
self.totalRebuyCount = 0
|
||||||
self.totalAddOns = 0
|
self.totalAddOnCount = 0
|
||||||
self.koBounty = 0
|
self.koBounty = 0
|
||||||
self.tourneyComment = None
|
self.tourneyComment = None
|
||||||
self.players = []
|
self.players = []
|
||||||
|
self.isSng = False
|
||||||
|
self.isSatellite = False
|
||||||
|
self.isDoubleOrNothing = False
|
||||||
|
self.guarantee = 0
|
||||||
|
|
||||||
# Collections indexed by player names
|
# Collections indexed by player names
|
||||||
self.finishPositions = {}
|
self.playerIds = {}
|
||||||
|
self.tourneysPlayersIds = {}
|
||||||
|
self.ranks = {}
|
||||||
self.winnings = {}
|
self.winnings = {}
|
||||||
self.payinAmounts = {}
|
self.winningsCurrency = {}
|
||||||
self.countRebuys = {}
|
self.rebuyCounts = {}
|
||||||
self.countAddOns = {}
|
self.addOnCounts = {}
|
||||||
self.countKO = {}
|
self.koCounts = {}
|
||||||
|
|
||||||
# currency symbol for this summary
|
# currency symbol for this summary
|
||||||
self.sym = None
|
self.sym = None
|
||||||
#self.sym = self.SYMBOL[self.gametype['currency']] # save typing! delete this attr when done
|
|
||||||
|
if builtFrom=="IMAP":
|
||||||
|
self.parseSummary()
|
||||||
|
self.insertOrUpdate()
|
||||||
|
#end def __init__
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
#TODO : Update
|
#TODO : Update
|
||||||
vars = ( ("SITE", self.sitename),
|
vars = ( ("SITE", self.siteName),
|
||||||
("START TIME", self.starttime),
|
("START TIME", self.startTime),
|
||||||
("END TIME", self.endtime),
|
("END TIME", self.endTime),
|
||||||
("TOURNEY NAME", self.tourneyName),
|
("TOURNEY NAME", self.tourneyName),
|
||||||
("TOURNEY NO", self.tourNo),
|
("TOURNEY NO", self.tourNo),
|
||||||
|
("TOURNEY TYPE ID", self.tourneyTypeId),
|
||||||
|
("TOURNEY ID", self.tourneyId),
|
||||||
("BUYIN", self.buyin),
|
("BUYIN", self.buyin),
|
||||||
("FEE", self.fee),
|
("FEE", self.fee),
|
||||||
|
("CURRENCY", self.currency),
|
||||||
("HERO", self.hero),
|
("HERO", self.hero),
|
||||||
("MAXSEATS", self.maxseats),
|
("MAXSEATS", self.maxseats),
|
||||||
("ENTRIES", self.entries),
|
("ENTRIES", self.entries),
|
||||||
|
@ -109,32 +130,38 @@ class Tourney(object):
|
||||||
("PRIZE POOL", self.prizepool),
|
("PRIZE POOL", self.prizepool),
|
||||||
("STARTING CHIP COUNT", self.buyInChips),
|
("STARTING CHIP COUNT", self.buyInChips),
|
||||||
("MIXED", self.mixed),
|
("MIXED", self.mixed),
|
||||||
("REBUY ADDON", self.isRebuy),
|
("REBUY", self.isRebuy),
|
||||||
|
("ADDON", self.isAddOn),
|
||||||
("KO", self.isKO),
|
("KO", self.isKO),
|
||||||
("HU", self.isHU),
|
|
||||||
("MATRIX", self.isMatrix),
|
("MATRIX", self.isMatrix),
|
||||||
|
("MATRIX ID PROCESSED", self.matrixIdProcessed),
|
||||||
("SHOOTOUT", self.isShootout),
|
("SHOOTOUT", self.isShootout),
|
||||||
("MATRIX MATCH ID", self.matrixMatchId),
|
("MATRIX MATCH ID", self.matrixMatchId),
|
||||||
("SUB TOURNEY BUY IN", self.subTourneyBuyin),
|
("SUB TOURNEY BUY IN", self.subTourneyBuyin),
|
||||||
("SUB TOURNEY FEE", self.subTourneyFee),
|
("SUB TOURNEY FEE", self.subTourneyFee),
|
||||||
("REBUY CHIPS", self.rebuyChips),
|
("REBUY CHIPS", self.rebuyChips),
|
||||||
("ADDON CHIPS", self.addOnChips),
|
("ADDON CHIPS", self.addOnChips),
|
||||||
("REBUY AMOUNT", self.rebuyAmount),
|
("REBUY COST", self.rebuyCost),
|
||||||
("ADDON AMOUNT", self.addOnAmount),
|
("ADDON COST", self.addOnCost),
|
||||||
("TOTAL REBUYS", self.totalRebuys),
|
("TOTAL REBUYS", self.totalRebuyCount),
|
||||||
("TOTAL ADDONS", self.totalAddOns),
|
("TOTAL ADDONS", self.totalAddOnCount),
|
||||||
("KO BOUNTY", self.koBounty),
|
("KO BOUNTY", self.koBounty),
|
||||||
("TOURNEY COMMENT", self.tourneyComment)
|
("TOURNEY COMMENT", self.tourneyComment),
|
||||||
|
("SNG", self.isSng),
|
||||||
|
("SATELLITE", self.isSatellite),
|
||||||
|
("DOUBLE OR NOTHING", self.isDoubleOrNothing),
|
||||||
|
("GUARANTEE", self.guarantee)
|
||||||
)
|
)
|
||||||
|
|
||||||
structs = ( ("GAMETYPE", self.gametype),
|
structs = ( ("PLAYER IDS", self.playerIds),
|
||||||
("PLAYERS", self.players),
|
("PLAYERS", self.players),
|
||||||
("PAYIN AMOUNTS", self.payinAmounts),
|
("TOURNEYS PLAYERS IDS", self.tourneysPlayersIds),
|
||||||
("POSITIONS", self.finishPositions),
|
("RANKS", self.ranks),
|
||||||
("WINNINGS", self.winnings),
|
("WINNINGS", self.winnings),
|
||||||
("COUNT REBUYS", self.countRebuys),
|
("WINNINGS CURRENCY", self.winningsCurrency),
|
||||||
("COUNT ADDONS", self.countAddOns),
|
("COUNT REBUYS", self.rebuyCounts),
|
||||||
("NB OF KO", self.countKO)
|
("COUNT ADDONS", self.addOnCounts),
|
||||||
|
("NB OF KO", self.koCounts)
|
||||||
)
|
)
|
||||||
str = ''
|
str = ''
|
||||||
for (name, var) in vars:
|
for (name, var) in vars:
|
||||||
|
@ -143,14 +170,15 @@ class Tourney(object):
|
||||||
for (name, struct) in structs:
|
for (name, struct) in structs:
|
||||||
str = str + "\n%s =\n" % name + pprint.pformat(struct, 4)
|
str = str + "\n%s =\n" % name + pprint.pformat(struct, 4)
|
||||||
return str
|
return str
|
||||||
|
#end def __str__
|
||||||
|
|
||||||
|
def parseSummary(self): abstract
|
||||||
|
"""should fill the class variables with the parsed information"""
|
||||||
|
|
||||||
def getSummaryText(self):
|
def getSummaryText(self):
|
||||||
return self.summaryText
|
return self.summaryText
|
||||||
|
|
||||||
def prepInsert(self, db):
|
def insertOrUpdate(self):
|
||||||
pass
|
|
||||||
|
|
||||||
def insert(self, db):
|
|
||||||
# First : check all needed info is filled in the object, especially for the initial select
|
# First : check all needed info is filled in the object, especially for the initial select
|
||||||
|
|
||||||
# Notes on DB Insert
|
# Notes on DB Insert
|
||||||
|
@ -161,18 +189,29 @@ class Tourney(object):
|
||||||
# Starttime may not match the one in the Summary file : HH = time of the first Hand / could be slighltly different from the one in the summary file
|
# Starttime may not match the one in the Summary file : HH = time of the first Hand / could be slighltly different from the one in the summary file
|
||||||
# Note: If the TourneyNo could be a unique id .... this would really be a relief to deal with matrix matches ==> Ask on the IRC / Ask Fulltilt ??
|
# Note: If the TourneyNo could be a unique id .... this would really be a relief to deal with matrix matches ==> Ask on the IRC / Ask Fulltilt ??
|
||||||
|
|
||||||
dbTourneyTypeId = db.tRecogniseTourneyType(self)
|
for player in self.players:
|
||||||
logging.debug("Tourney Type ID = %d" % dbTourneyTypeId)
|
id=self.db.get_player_id(self.config, self.siteName, player)
|
||||||
dbTourneyId = db.tRecognizeTourney(self, dbTourneyTypeId)
|
if not id:
|
||||||
logging.debug("Tourney ID = %d" % dbTourneyId)
|
id=self.db.insertPlayer(player, self.siteId)
|
||||||
dbTourneysPlayersIds = db.tStoreTourneyPlayers(self, dbTourneyId)
|
self.playerIds.update({player:id})
|
||||||
logging.debug("TourneysPlayersId = %s" % dbTourneysPlayersIds)
|
|
||||||
db.tUpdateTourneysHandsPlayers(self, dbTourneysPlayersIds, dbTourneyTypeId)
|
#print "TS.insert players",self.players,"playerIds",self.playerIds
|
||||||
logging.debug("tUpdateTourneysHandsPlayers done")
|
|
||||||
logging.debug("Tourney Insert done")
|
self.buyinCurrency=self.currency
|
||||||
|
self.dbid_pids=self.playerIds #TODO:rename this field in Hand so this silly renaming can be removed
|
||||||
|
|
||||||
|
#print "TS.self before starting insert",self
|
||||||
|
self.tourneyTypeId = self.db.createOrUpdateTourneyType(self)
|
||||||
|
self.db.commit()
|
||||||
|
self.tourneyId = self.db.createOrUpdateTourney(self, "TS")
|
||||||
|
self.db.commit()
|
||||||
|
self.tourneysPlayersIds = self.db.createOrUpdateTourneysPlayers(self, "TS")
|
||||||
|
self.db.commit()
|
||||||
|
|
||||||
|
logging.debug("Tourney Insert/Update done")
|
||||||
|
|
||||||
# TO DO : Return what has been done (tourney created, updated, nothing)
|
# TO DO : Return what has been done (tourney created, updated, nothing)
|
||||||
# ?? stored = 1 if tourney is fully created / duplicates = 1, if everything was already here and correct / partial=1 if some things were already here (between tourney, tourneyPlayers and handsplayers)
|
# ?? stored = 1 if tourney is fully created / duplicates = 1, if everything was already here and correct / partial=1 if some things were already here (between tourney, tourneysPlayers and handsPlayers)
|
||||||
# if so, prototypes may need changes to know what has been done or make some kind of dict in Tourney object that could be updated during the insert process to store that information
|
# if so, prototypes may need changes to know what has been done or make some kind of dict in Tourney object that could be updated during the insert process to store that information
|
||||||
stored = 0
|
stored = 0
|
||||||
duplicates = 0
|
duplicates = 0
|
||||||
|
@ -182,82 +221,7 @@ class Tourney(object):
|
||||||
return (stored, duplicates, partial, errors, ttime)
|
return (stored, duplicates, partial, errors, ttime)
|
||||||
|
|
||||||
|
|
||||||
def old_insert_from_Hand(self, db):
|
def addPlayer(self, rank, name, winnings, winningsCurrency, rebuyCount, addOnCount, koCount):
|
||||||
""" Function to insert Hand into database
|
|
||||||
Should not commit, and do minimal selects. Callers may want to cache commits
|
|
||||||
db: a connected Database object"""
|
|
||||||
# TODO:
|
|
||||||
# Players - base playerid and siteid tuple
|
|
||||||
sqlids = db.getSqlPlayerIDs([p[1] for p in self.players], self.siteId)
|
|
||||||
|
|
||||||
#Gametypes
|
|
||||||
gtid = db.getGameTypeId(self.siteId, self.gametype)
|
|
||||||
|
|
||||||
# HudCache data to come from DerivedStats class
|
|
||||||
# HandsActions - all actions for all players for all streets - self.actions
|
|
||||||
# Hands - Summary information of hand indexed by handId - gameinfo
|
|
||||||
#This should be moved to prepInsert
|
|
||||||
hh = {}
|
|
||||||
hh['siteHandNo'] = self.handid
|
|
||||||
hh['handStart'] = self.starttime
|
|
||||||
hh['gameTypeId'] = gtid
|
|
||||||
# seats TINYINT NOT NULL,
|
|
||||||
hh['tableName'] = self.tablename
|
|
||||||
hh['maxSeats'] = self.maxseats
|
|
||||||
hh['seats'] = len(sqlids)
|
|
||||||
# Flop turn and river may all be empty - add (likely) too many elements and trim with range
|
|
||||||
boardcards = self.board['FLOP'] + self.board['TURN'] + self.board['RIVER'] + [u'0x', u'0x', u'0x', u'0x', u'0x']
|
|
||||||
cards = [Card.encodeCard(c) for c in boardcards[0:5]]
|
|
||||||
hh['boardcard1'] = cards[0]
|
|
||||||
hh['boardcard2'] = cards[1]
|
|
||||||
hh['boardcard3'] = cards[2]
|
|
||||||
hh['boardcard4'] = cards[3]
|
|
||||||
hh['boardcard5'] = cards[4]
|
|
||||||
|
|
||||||
# texture smallint,
|
|
||||||
# playersVpi SMALLINT NOT NULL, /* num of players vpi */
|
|
||||||
# Needs to be recorded
|
|
||||||
# playersAtStreet1 SMALLINT NOT NULL, /* num of players seeing flop/street4 */
|
|
||||||
# Needs to be recorded
|
|
||||||
# playersAtStreet2 SMALLINT NOT NULL,
|
|
||||||
# Needs to be recorded
|
|
||||||
# playersAtStreet3 SMALLINT NOT NULL,
|
|
||||||
# Needs to be recorded
|
|
||||||
# playersAtStreet4 SMALLINT NOT NULL,
|
|
||||||
# Needs to be recorded
|
|
||||||
# playersAtShowdown SMALLINT NOT NULL,
|
|
||||||
# Needs to be recorded
|
|
||||||
# street0Raises TINYINT NOT NULL, /* num small bets paid to see flop/street4, including blind */
|
|
||||||
# Needs to be recorded
|
|
||||||
# street1Raises TINYINT NOT NULL, /* num small bets paid to see turn/street5 */
|
|
||||||
# Needs to be recorded
|
|
||||||
# street2Raises TINYINT NOT NULL, /* num big bets paid to see river/street6 */
|
|
||||||
# Needs to be recorded
|
|
||||||
# street3Raises TINYINT NOT NULL, /* num big bets paid to see sd/street7 */
|
|
||||||
# Needs to be recorded
|
|
||||||
# street4Raises TINYINT NOT NULL, /* num big bets paid to see showdown */
|
|
||||||
# Needs to be recorded
|
|
||||||
|
|
||||||
#print "DEBUG: self.getStreetTotals = (%s, %s, %s, %s, %s)" % self.getStreetTotals()
|
|
||||||
#FIXME: Pot size still in decimal, needs to be converted to cents
|
|
||||||
(hh['street1Pot'], hh['street2Pot'], hh['street3Pot'], hh['street4Pot'], hh['showdownPot']) = self.getStreetTotals()
|
|
||||||
|
|
||||||
# comment TEXT,
|
|
||||||
# commentTs DATETIME
|
|
||||||
#print hh
|
|
||||||
handid = db.storeHand(hh)
|
|
||||||
# HandsPlayers - ? ... Do we fix winnings?
|
|
||||||
# Tourneys ?
|
|
||||||
# TourneysPlayers
|
|
||||||
|
|
||||||
pass
|
|
||||||
|
|
||||||
def select(self, tourneyId):
|
|
||||||
""" Function to create Tourney object from database """
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def addPlayer(self, rank, name, winnings, payinAmount, nbRebuys, nbAddons, nbKO):
|
|
||||||
"""\
|
"""\
|
||||||
Adds a player to the tourney, and initialises data structures indexed by player.
|
Adds a player to the tourney, and initialises data structures indexed by player.
|
||||||
rank (int) indicating the finishing rank (can be -1 if unknown)
|
rank (int) indicating the finishing rank (can be -1 if unknown)
|
||||||
|
@ -266,13 +230,29 @@ winnings (decimal) the money the player ended the tourney with (can be 0, or
|
||||||
"""
|
"""
|
||||||
log.debug("addPlayer: rank:%s - name : '%s' - Winnings (%s)" % (rank, name, winnings))
|
log.debug("addPlayer: rank:%s - name : '%s' - Winnings (%s)" % (rank, name, winnings))
|
||||||
self.players.append(name)
|
self.players.append(name)
|
||||||
self.finishPositions.update( { name : Decimal(rank) } )
|
if rank:
|
||||||
|
self.ranks.update( { name : Decimal(rank) } )
|
||||||
self.winnings.update( { name : Decimal(winnings) } )
|
self.winnings.update( { name : Decimal(winnings) } )
|
||||||
self.payinAmounts.update( {name : Decimal(payinAmount) } )
|
self.winningsCurrency.update( { name : winningsCurrency } )
|
||||||
self.countRebuys.update( {name: Decimal(nbRebuys) } )
|
else:
|
||||||
self.countAddOns.update( {name: Decimal(nbAddons) } )
|
self.ranks.update( { name : None } )
|
||||||
self.countKO.update( {name : Decimal(nbKO) } )
|
self.winnings.update( { name : None } )
|
||||||
|
self.winningsCurrency.update( { name : None } )
|
||||||
|
if rebuyCount:
|
||||||
|
self.rebuyCounts.update( {name: Decimal(rebuyCount) } )
|
||||||
|
else:
|
||||||
|
self.rebuyCounts.update( {name: None } )
|
||||||
|
|
||||||
|
if addOnCount:
|
||||||
|
self.addOnCounts.update( {name: Decimal(addOnCount) } )
|
||||||
|
else:
|
||||||
|
self.addOnCounts.update( {name: None } )
|
||||||
|
|
||||||
|
if koCount:
|
||||||
|
self.koCounts.update( {name : Decimal(koCount) } )
|
||||||
|
else:
|
||||||
|
self.koCounts.update( {name: None } )
|
||||||
|
#end def addPlayer
|
||||||
|
|
||||||
def incrementPlayerWinnings(self, name, additionnalWinnings):
|
def incrementPlayerWinnings(self, name, additionnalWinnings):
|
||||||
log.debug("incrementPlayerWinnings: name : '%s' - Add Winnings (%s)" % (name, additionnalWinnings))
|
log.debug("incrementPlayerWinnings: name : '%s' - Add Winnings (%s)" % (name, additionnalWinnings))
|
||||||
|
@ -289,35 +269,6 @@ winnings (decimal) the money the player ended the tourney with (can be 0, or
|
||||||
print "checkPlayerExists", player, "fail"
|
print "checkPlayerExists", player, "fail"
|
||||||
raise FpdbParseError
|
raise FpdbParseError
|
||||||
|
|
||||||
|
|
||||||
def getGameTypeAsString(self):
|
|
||||||
"""\
|
|
||||||
Map the tuple self.gametype onto the pokerstars string describing it
|
|
||||||
"""
|
|
||||||
# currently it appears to be something like ["ring", "hold", "nl", sb, bb]:
|
|
||||||
gs = {"holdem" : "Hold'em",
|
|
||||||
"omahahi" : "Omaha",
|
|
||||||
"omahahilo" : "Omaha Hi/Lo",
|
|
||||||
"razz" : "Razz",
|
|
||||||
"studhi" : "7 Card Stud",
|
|
||||||
"studhilo" : "7 Card Stud Hi/Lo",
|
|
||||||
"fivedraw" : "5 Card Draw",
|
|
||||||
"27_1draw" : "FIXME",
|
|
||||||
"27_3draw" : "Triple Draw 2-7 Lowball",
|
|
||||||
"badugi" : "Badugi"
|
|
||||||
}
|
|
||||||
ls = {"nl" : "No Limit",
|
|
||||||
"pl" : "Pot Limit",
|
|
||||||
"fl" : "Limit",
|
|
||||||
"cn" : "Cap No Limit",
|
|
||||||
"cp" : "Cap Pot Limit"
|
|
||||||
}
|
|
||||||
|
|
||||||
log.debug("gametype: %s" %(self.gametype))
|
|
||||||
retstring = "%s %s" %(gs[self.gametype['category']], ls[self.gametype['limitType']])
|
|
||||||
return retstring
|
|
||||||
|
|
||||||
|
|
||||||
def writeSummary(self, fh=sys.__stdout__):
|
def writeSummary(self, fh=sys.__stdout__):
|
||||||
print >>fh, "Override me"
|
print >>fh, "Override me"
|
||||||
|
|
||||||
|
@ -325,11 +276,11 @@ Map the tuple self.gametype onto the pokerstars string describing it
|
||||||
self.writeSummary(sys.stdout)
|
self.writeSummary(sys.stdout)
|
||||||
|
|
||||||
|
|
||||||
def assemble(cnxn, tourneyId):
|
def assemble(cnxn, tourneyId): #TODO: move this method to Hand or Database
|
||||||
# TODO !!
|
# TODO !!
|
||||||
c = cnxn.cursor()
|
c = cnxn.cursor()
|
||||||
|
|
||||||
# We need at least sitename, gametype, handid
|
# We need at least siteName, gametype, handid
|
||||||
# for the Hand.__init__
|
# for the Hand.__init__
|
||||||
c.execute("""
|
c.execute("""
|
||||||
select
|
select
|
||||||
|
@ -365,7 +316,7 @@ limit 1""", {'handid':handid})
|
||||||
#TODO: siteid should be in hands table - we took the scenic route through players here.
|
#TODO: siteid should be in hands table - we took the scenic route through players here.
|
||||||
res = c.fetchone()
|
res = c.fetchone()
|
||||||
gametype = {'category':res[1],'base':res[2],'type':res[3],'limitType':res[4],'hilo':res[5],'sb':res[6],'bb':res[7], 'currency':res[10]}
|
gametype = {'category':res[1],'base':res[2],'type':res[3],'limitType':res[4],'hilo':res[5],'sb':res[6],'bb':res[7], 'currency':res[10]}
|
||||||
h = HoldemOmahaHand(hhc = None, sitename=res[0], gametype = gametype, handText=None, builtFrom = "DB", handid=handid)
|
h = HoldemOmahaHand(hhc = None, siteName=res[0], gametype = gametype, handText=None, builtFrom = "DB", handid=handid)
|
||||||
cards = map(Card.valueSuitFromCard, res[11:16] )
|
cards = map(Card.valueSuitFromCard, res[11:16] )
|
||||||
if cards[0]:
|
if cards[0]:
|
||||||
h.setCommunityCards('FLOP', cards[0:3])
|
h.setCommunityCards('FLOP', cards[0:3])
|
||||||
|
@ -383,15 +334,15 @@ limit 1""", {'handid':handid})
|
||||||
SELECT
|
SELECT
|
||||||
h.sitehandno as hid,
|
h.sitehandno as hid,
|
||||||
h.tablename as table,
|
h.tablename as table,
|
||||||
h.handstart as starttime
|
h.startTime as startTime
|
||||||
FROM
|
FROM
|
||||||
hands as h
|
Hands as h
|
||||||
WHERE h.id = %(handid)s
|
WHERE h.id = %(handid)s
|
||||||
""", {'handid':handid})
|
""", {'handid':handid})
|
||||||
res = c.fetchone()
|
res = c.fetchone()
|
||||||
h.handid = res[0]
|
h.handid = res[0]
|
||||||
h.tablename = res[1]
|
h.tablename = res[1]
|
||||||
h.starttime = res[2] # automatically a datetime
|
h.startTime = res[2] # automatically a datetime
|
||||||
|
|
||||||
# PlayerStacks
|
# PlayerStacks
|
||||||
c.execute("""
|
c.execute("""
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# Copyright 2008, Carl Gherardi
|
# Copyright 2008-2010 Carl Gherardi
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -128,7 +128,7 @@ follow : whether to tail -f the input"""
|
||||||
#2008/09/07 06:23:14 ET
|
#2008/09/07 06:23:14 ET
|
||||||
m2 = re.search("(?P<Y>[0-9]{4})\/(?P<M>[0-9]{2})\/(?P<D>[0-9]{2})[\- ]+(?P<H>[0-9]+):(?P<MIN>[0-9]+):(?P<S>[0-9]+)", info[key])
|
m2 = re.search("(?P<Y>[0-9]{4})\/(?P<M>[0-9]{2})\/(?P<D>[0-9]{2})[\- ]+(?P<H>[0-9]+):(?P<MIN>[0-9]+):(?P<S>[0-9]+)", info[key])
|
||||||
datetime = "%s/%s/%s %s:%s:%s" % (m2.group('Y'), m2.group('M'),m2.group('D'),m2.group('H'),m2.group('MIN'),m2.group('S'))
|
datetime = "%s/%s/%s %s:%s:%s" % (m2.group('Y'), m2.group('M'),m2.group('D'),m2.group('H'),m2.group('MIN'),m2.group('S'))
|
||||||
hand.starttime = time.strptime(datetime, "%Y/%m/%d %H:%M:%S")
|
hand.startTime = time.strptime(datetime, "%Y/%m/%d %H:%M:%S")
|
||||||
if key == 'HID':
|
if key == 'HID':
|
||||||
hand.handid = info[key]
|
hand.handid = info[key]
|
||||||
if key == 'TABLE':
|
if key == 'TABLE':
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# Copyright 2008, Carl Gherardi
|
# Copyright 2008-2010, Carl Gherardi
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -137,7 +137,7 @@ class Win2day(HandHistoryConverter):
|
||||||
for key in info:
|
for key in info:
|
||||||
if key == 'DATETIME':
|
if key == 'DATETIME':
|
||||||
# Win2day uses UTC timestamp
|
# Win2day uses UTC timestamp
|
||||||
hand.starttime = datetime.datetime.fromtimestamp(int(info[key]))
|
hand.startTime = datetime.datetime.fromtimestamp(int(info[key]))
|
||||||
if key == 'HID':
|
if key == 'HID':
|
||||||
hand.handid = info[key]
|
hand.handid = info[key]
|
||||||
if key == 'TABLE':
|
if key == 'TABLE':
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
"""WinTables.py
|
"""WinTables.py
|
||||||
|
|
||||||
Routines for detecting and handling poker client windows for MS Windows.
|
Routines for detecting and handling poker client windows for MS Windows.
|
||||||
"""
|
"""
|
||||||
# Copyright 2008 - 2009, Ray E. Barker
|
# Copyright 2008-2010, Ray E. Barker
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
"""Discover_Tables.py
|
"""Discover_Tables.py
|
||||||
|
|
||||||
Inspects the currently open windows and finds those of interest to us--that is
|
Inspects the currently open windows and finds those of interest to us--that is
|
||||||
poker table windows from supported sites. Returns a list
|
poker table windows from supported sites. Returns a list
|
||||||
of Table_Window objects representing the windows found.
|
of Table_Window objects representing the windows found.
|
||||||
"""
|
"""
|
||||||
# Copyright 2008 - 2009, Ray E. Barker
|
# Copyright 2008-2010, Ray E. Barker
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
#Copyright 2008 Steffen Jobbagy-Felso
|
#Copyright 2008-2010 Steffen Schaumburg
|
||||||
#This program is free software: you can redistribute it and/or modify
|
#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
|
#it under the terms of the GNU Affero General Public License as published by
|
||||||
#the Free Software Foundation, version 3 of the License.
|
#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
|
#You should have received a copy of the GNU Affero General Public License
|
||||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#In the "official" distribution you can find the license in
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
#agpl-3.0.txt in the docs folder of the package.
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
@ -35,7 +35,10 @@ if os.name == 'nt' and sys.version[0:3] not in ('2.5', '2.6') and '-r' not in sy
|
||||||
os.environ['PATH'] = tmppath
|
os.environ['PATH'] = tmppath
|
||||||
print "Python " + sys.version[0:3] + ' - press return to continue\n'
|
print "Python " + sys.version[0:3] + ' - press return to continue\n'
|
||||||
sys.stdin.readline()
|
sys.stdin.readline()
|
||||||
os.execvpe('python.exe', ('python.exe', 'fpdb.py', '-r'), os.environ) # first arg is ignored (name of program being run)
|
if os.name=='nt':
|
||||||
|
os.execvpe('pythonw.exe', ('pythonw.exe', 'fpdb.pyw', '-r'), os.environ) # first arg is ignored (name of program being run)
|
||||||
|
else:
|
||||||
|
os.execvpe('python', ('python', 'fpdb.pyw', '-r'), os.environ) # first arg is ignored (name of program being run)
|
||||||
else:
|
else:
|
||||||
print "\npython 2.5 not found, please install python 2.5 or 2.6 for fpdb\n"
|
print "\npython 2.5 not found, please install python 2.5 or 2.6 for fpdb\n"
|
||||||
raw_input("Press ENTER to continue.")
|
raw_input("Press ENTER to continue.")
|
||||||
|
@ -99,7 +102,9 @@ import GuiPrefs
|
||||||
import GuiLogView
|
import GuiLogView
|
||||||
#import GuiDatabase
|
#import GuiDatabase
|
||||||
import GuiBulkImport
|
import GuiBulkImport
|
||||||
import GuiPlayerStats
|
import ImapSummaries
|
||||||
|
import GuiRingPlayerStats
|
||||||
|
import GuiTourneyPlayerStats
|
||||||
import GuiPositionalStats
|
import GuiPositionalStats
|
||||||
import GuiTableViewer
|
import GuiTableViewer
|
||||||
import GuiAutoImport
|
import GuiAutoImport
|
||||||
|
@ -110,7 +115,7 @@ import Database
|
||||||
import Configuration
|
import Configuration
|
||||||
import Exceptions
|
import Exceptions
|
||||||
|
|
||||||
VERSION = "0.12"
|
VERSION = "0.20 plus git"
|
||||||
|
|
||||||
|
|
||||||
class fpdb:
|
class fpdb:
|
||||||
|
@ -226,11 +231,12 @@ class fpdb:
|
||||||
dia = gtk.AboutDialog()
|
dia = gtk.AboutDialog()
|
||||||
dia.set_name("Free Poker Database (FPDB)")
|
dia.set_name("Free Poker Database (FPDB)")
|
||||||
dia.set_version(VERSION)
|
dia.set_version(VERSION)
|
||||||
dia.set_copyright("2008-2010, Steffen, Eratosthenes, s0rrow, EricBlade, _mt, sqlcoder, Bostik, and others")
|
dia.set_copyright("Copyright 2008-2010, Steffen, Eratosthenes, Carl Gherardi, Eric Blade, _mt, sqlcoder, Bostik, and others")
|
||||||
dia.set_comments("GTK AboutDialog comments here")
|
dia.set_comments("")
|
||||||
dia.set_license("GPL v3")
|
dia.set_license("This program is licensed under the AGPL3, see agpl-3.0.txt in the fpdb installation directory")
|
||||||
dia.set_website("http://fpdb.sourceforge.net/")
|
dia.set_website("http://fpdb.sourceforge.net/")
|
||||||
dia.set_authors(['Steffen', 'Eratosthenes', 's0rrow',
|
|
||||||
|
dia.set_authors(['Steffen', 'Eratosthenes', 'Carl Gherardi',
|
||||||
'Eric Blade', '_mt', 'sqlcoder', 'Bostik', 'and others'])
|
'Eric Blade', '_mt', 'sqlcoder', 'Bostik', 'and others'])
|
||||||
dia.set_program_name("Free Poker Database (FPDB)")
|
dia.set_program_name("Free Poker Database (FPDB)")
|
||||||
|
|
||||||
|
@ -256,6 +262,12 @@ class fpdb:
|
||||||
view.modify_font(pango.FontDescription('monospace 10'))
|
view.modify_font(pango.FontDescription('monospace 10'))
|
||||||
view.show()
|
view.show()
|
||||||
dia.vbox.pack_end(view, True, True, 2)
|
dia.vbox.pack_end(view, True, True, 2)
|
||||||
|
|
||||||
|
l = gtk.Label("Your config file is: "+self.config.file)
|
||||||
|
l.set_alignment(0.5, 0.5)
|
||||||
|
l.show()
|
||||||
|
dia.vbox.pack_end(l, True, True, 2)
|
||||||
|
|
||||||
l = gtk.Label('Version Information:')
|
l = gtk.Label('Version Information:')
|
||||||
l.set_alignment(0.5, 0.5)
|
l.set_alignment(0.5, 0.5)
|
||||||
l.show()
|
l.show()
|
||||||
|
@ -275,7 +287,7 @@ class fpdb:
|
||||||
gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT))
|
gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT))
|
||||||
dia.set_default_size(700, 500)
|
dia.set_default_size(700, 500)
|
||||||
|
|
||||||
prefs = GuiPrefs.GuiPrefs(self.config, self.window, dia.vbox)
|
prefs = GuiPrefs.GuiPrefs(self.config, self.window, dia.vbox, dia)
|
||||||
response = dia.run()
|
response = dia.run()
|
||||||
if response == gtk.RESPONSE_ACCEPT:
|
if response == gtk.RESPONSE_ACCEPT:
|
||||||
# save updated config
|
# save updated config
|
||||||
|
@ -283,17 +295,19 @@ class fpdb:
|
||||||
if len(self.nb_tab_names) == 1:
|
if len(self.nb_tab_names) == 1:
|
||||||
# only main tab open, reload profile
|
# only main tab open, reload profile
|
||||||
self.load_profile()
|
self.load_profile()
|
||||||
|
dia.destroy()
|
||||||
else:
|
else:
|
||||||
|
dia.destroy() # destroy prefs before raising warning, otherwise parent is dia rather than self.window
|
||||||
self.warning_box("Updated preferences have not been loaded because "
|
self.warning_box("Updated preferences have not been loaded because "
|
||||||
+ "windows are open. Re-start fpdb to load them.")
|
+ "windows are open. Re-start fpdb to load them.")
|
||||||
|
else:
|
||||||
dia.destroy()
|
dia.destroy()
|
||||||
|
|
||||||
def dia_maintain_dbs(self, widget, data=None):
|
def dia_maintain_dbs(self, widget, data=None):
|
||||||
self.warning_box("Unimplemented: Maintain Databases")
|
self.warning_box("Unimplemented: Maintain Databases")
|
||||||
return
|
return
|
||||||
if len(self.tab_names) == 1:
|
if len(self.tab_names) == 1:
|
||||||
if self.obtain_global_lock(): # returns true if successful
|
if self.obtain_global_lock("dia_maintain_dbs"): # returns true if successful
|
||||||
# only main tab has been opened, open dialog
|
# only main tab has been opened, open dialog
|
||||||
dia = gtk.Dialog("Maintain Databases",
|
dia = gtk.Dialog("Maintain Databases",
|
||||||
self.window,
|
self.window,
|
||||||
|
@ -315,32 +329,20 @@ class fpdb:
|
||||||
self.warning_box("Cannot open Database Maintenance window because "
|
self.warning_box("Cannot open Database Maintenance window because "
|
||||||
+ "other windows have been opened. Re-start fpdb to use this option.")
|
+ "other windows have been opened. Re-start fpdb to use this option.")
|
||||||
|
|
||||||
def dia_create_del_user(self, widget, data=None):
|
|
||||||
self.warning_box("Unimplemented: Create/Delete user")
|
|
||||||
self.obtain_global_lock()
|
|
||||||
self.release_global_lock()
|
|
||||||
|
|
||||||
def dia_database_stats(self, widget, data=None):
|
def dia_database_stats(self, widget, data=None):
|
||||||
self.warning_box("Unimplemented: Database Stats")
|
self.warning_box(str="Number of Hands: "+str(self.db.getHandCount())+
|
||||||
|
"\nNumber of Tourneys: "+str(self.db.getTourneyCount())+
|
||||||
|
"\nNumber of TourneyTypes: "+str(self.db.getTourneyTypeCount()),
|
||||||
|
diatitle="Database Statistics")
|
||||||
|
#end def dia_database_stats
|
||||||
|
|
||||||
def dia_delete_db_parts(self, widget, data=None):
|
def dia_dump_db(self, widget, data=None):
|
||||||
self.warning_box("Unimplemented: Delete Database Parts")
|
self.db.dumpDatabase("database-dump.sql")
|
||||||
self.obtain_global_lock()
|
#end def dia_database_stats
|
||||||
self.release_global_lock()
|
|
||||||
|
|
||||||
def dia_edit_profile(self, widget=None, data=None, create_default=False, path=None):
|
|
||||||
self.warning_box("Unimplemented: Edit Profile")
|
|
||||||
self.obtain_global_lock()
|
|
||||||
self.release_global_lock()
|
|
||||||
|
|
||||||
def dia_export_db(self, widget, data=None):
|
# def dia_get_db_root_credentials(self):
|
||||||
self.warning_box("Unimplemented: Export Database")
|
# """obtains db root credentials from user"""
|
||||||
self.obtain_global_lock()
|
|
||||||
self.release_global_lock()
|
|
||||||
|
|
||||||
def dia_get_db_root_credentials(self):
|
|
||||||
"""obtains db root credentials from user"""
|
|
||||||
self.warning_box("Unimplemented: Get Root Database Credentials")
|
|
||||||
# user, pw=None, None
|
# user, pw=None, None
|
||||||
#
|
#
|
||||||
# dialog=gtk.Dialog(title="DB Credentials needed", parent=None, flags=0,
|
# dialog=gtk.Dialog(title="DB Credentials needed", parent=None, flags=0,
|
||||||
|
@ -357,17 +359,12 @@ class fpdb:
|
||||||
# dialog.destroy()
|
# dialog.destroy()
|
||||||
# return (user, pw, response)
|
# return (user, pw, response)
|
||||||
|
|
||||||
def dia_import_db(self, widget, data=None):
|
|
||||||
self.warning_box("Unimplemented: Import Database")
|
|
||||||
self.obtain_global_lock()
|
|
||||||
self.release_global_lock()
|
|
||||||
|
|
||||||
def dia_licensing(self, widget, data=None):
|
def dia_licensing(self, widget, data=None):
|
||||||
self.warning_box("Unimplemented: Licensing")
|
self.warning_box("Unimplemented: Licensing")
|
||||||
|
|
||||||
def dia_load_profile(self, widget, data=None):
|
def dia_load_profile(self, widget, data=None):
|
||||||
"""Dialogue to select a file to load a profile from"""
|
"""Dialogue to select a file to load a profile from"""
|
||||||
if self.obtain_global_lock(): # returns true if successful
|
if self.obtain_global_lock("fpdb.dia_load_profile"): # returns true if successful
|
||||||
#try:
|
#try:
|
||||||
# chooser = gtk.FileChooserDialog(title="Please select a profile file to load",
|
# chooser = gtk.FileChooserDialog(title="Please select a profile file to load",
|
||||||
# action=gtk.FILE_CHOOSER_ACTION_OPEN,
|
# action=gtk.FILE_CHOOSER_ACTION_OPEN,
|
||||||
|
@ -390,14 +387,16 @@ class fpdb:
|
||||||
|
|
||||||
def dia_recreate_tables(self, widget, data=None):
|
def dia_recreate_tables(self, widget, data=None):
|
||||||
"""Dialogue that asks user to confirm that he wants to delete and recreate the tables"""
|
"""Dialogue that asks user to confirm that he wants to delete and recreate the tables"""
|
||||||
if self.obtain_global_lock(): # returns true if successful
|
if self.obtain_global_lock("fpdb.dia_recreate_tables"): # returns true if successful
|
||||||
|
|
||||||
#lock_released = False
|
#lock_released = False
|
||||||
dia_confirm = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_WARNING,
|
dia_confirm = gtk.MessageDialog(parent=self.window, flags=gtk.DIALOG_DESTROY_WITH_PARENT, type=gtk.MESSAGE_WARNING,
|
||||||
buttons=(gtk.BUTTONS_YES_NO), message_format="Confirm deleting and recreating tables")
|
buttons=(gtk.BUTTONS_YES_NO), message_format="Confirm deleting and recreating tables")
|
||||||
diastring = "Please confirm that you want to (re-)create the tables. If there already are tables in the database " \
|
diastring = "Please confirm that you want to (re-)create the tables. If there already are tables in the database " \
|
||||||
+self.db.database+" on "+self.db.host+" they will be deleted."
|
+self.db.database+" on "+self.db.host+" they will be deleted."
|
||||||
dia_confirm.format_secondary_text(diastring)#todo: make above string with bold for db, host and deleted
|
dia_confirm.format_secondary_text(diastring)#todo: make above string with bold for db, host and deleted
|
||||||
|
# disable windowclose, do not want the the underlying processing interrupted mid-process
|
||||||
|
dia_confirm.set_deletable(False)
|
||||||
|
|
||||||
response = dia_confirm.run()
|
response = dia_confirm.run()
|
||||||
dia_confirm.destroy()
|
dia_confirm.destroy()
|
||||||
|
@ -409,19 +408,32 @@ class fpdb:
|
||||||
# self.release_global_lock()
|
# self.release_global_lock()
|
||||||
# lock_released = True
|
# lock_released = True
|
||||||
self.db.recreate_tables()
|
self.db.recreate_tables()
|
||||||
|
self.release_global_lock()
|
||||||
#else:
|
#else:
|
||||||
# for other dbs use same connection as holds global lock
|
# for other dbs use same connection as holds global lock
|
||||||
# self.fdb_lock.fdb.recreate_tables()
|
# self.fdb_lock.fdb.recreate_tables()
|
||||||
|
# TODO: figure out why this seems to be necessary
|
||||||
|
dia_restart = gtk.MessageDialog(parent=self.window, flags=0, type=gtk.MESSAGE_WARNING,
|
||||||
|
buttons=(gtk.BUTTONS_OK), message_format="Restart fpdb")
|
||||||
|
diastring = "Fpdb now needs to close. Please restart it."
|
||||||
|
dia_restart.format_secondary_text(diastring)
|
||||||
|
|
||||||
|
dia_restart.run()
|
||||||
|
dia_restart.destroy()
|
||||||
|
self.quit(None, None)
|
||||||
elif response == gtk.RESPONSE_NO:
|
elif response == gtk.RESPONSE_NO:
|
||||||
|
self.release_global_lock()
|
||||||
print 'User cancelled recreating tables'
|
print 'User cancelled recreating tables'
|
||||||
#if not lock_released:
|
#if not lock_released:
|
||||||
self.release_global_lock()
|
#end def dia_recreate_tables
|
||||||
|
|
||||||
def dia_recreate_hudcache(self, widget, data=None):
|
def dia_recreate_hudcache(self, widget, data=None):
|
||||||
if self.obtain_global_lock():
|
if self.obtain_global_lock("dia_recreate_hudcache"):
|
||||||
self.dia_confirm = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_WARNING, buttons=(gtk.BUTTONS_YES_NO), message_format="Confirm recreating HUD cache")
|
self.dia_confirm = gtk.MessageDialog(parent=self.window, flags=gtk.DIALOG_DESTROY_WITH_PARENT, type=gtk.MESSAGE_WARNING, buttons=(gtk.BUTTONS_YES_NO), message_format="Confirm recreating HUD cache")
|
||||||
diastring = "Please confirm that you want to re-create the HUD cache."
|
diastring = "Please confirm that you want to re-create the HUD cache."
|
||||||
self.dia_confirm.format_secondary_text(diastring)
|
self.dia_confirm.format_secondary_text(diastring)
|
||||||
|
# disable windowclose, do not want the the underlying processing interrupted mid-process
|
||||||
|
self.dia_confirm.set_deletable(False)
|
||||||
|
|
||||||
hb1 = gtk.HBox(True, 1)
|
hb1 = gtk.HBox(True, 1)
|
||||||
self.h_start_date = gtk.Entry(max=12)
|
self.h_start_date = gtk.Entry(max=12)
|
||||||
|
@ -468,17 +480,20 @@ class fpdb:
|
||||||
self.release_global_lock()
|
self.release_global_lock()
|
||||||
|
|
||||||
def dia_rebuild_indexes(self, widget, data=None):
|
def dia_rebuild_indexes(self, widget, data=None):
|
||||||
if self.obtain_global_lock():
|
if self.obtain_global_lock("dia_rebuild_indexes"):
|
||||||
self.dia_confirm = gtk.MessageDialog(parent=None
|
self.dia_confirm = gtk.MessageDialog(parent=self.window
|
||||||
,flags=0
|
,flags=gtk.DIALOG_DESTROY_WITH_PARENT
|
||||||
,type=gtk.MESSAGE_WARNING
|
,type=gtk.MESSAGE_WARNING
|
||||||
,buttons=(gtk.BUTTONS_YES_NO)
|
,buttons=(gtk.BUTTONS_YES_NO)
|
||||||
,message_format="Confirm rebuilding database indexes")
|
,message_format="Confirm rebuilding database indexes")
|
||||||
diastring = "Please confirm that you want to rebuild the database indexes."
|
diastring = "Please confirm that you want to rebuild the database indexes."
|
||||||
self.dia_confirm.format_secondary_text(diastring)
|
self.dia_confirm.format_secondary_text(diastring)
|
||||||
|
# disable windowclose, do not want the the underlying processing interrupted mid-process
|
||||||
|
self.dia_confirm.set_deletable(False)
|
||||||
|
|
||||||
response = self.dia_confirm.run()
|
response = self.dia_confirm.run()
|
||||||
if response == gtk.RESPONSE_YES:
|
if response == gtk.RESPONSE_YES:
|
||||||
|
#FIXME these progress messages do not seem to work in *nix
|
||||||
lbl = gtk.Label(" Rebuilding Indexes ... ")
|
lbl = gtk.Label(" Rebuilding Indexes ... ")
|
||||||
self.dia_confirm.vbox.add(lbl)
|
self.dia_confirm.vbox.add(lbl)
|
||||||
lbl.show()
|
lbl.show()
|
||||||
|
@ -506,7 +521,7 @@ class fpdb:
|
||||||
"""opens the log viewer window"""
|
"""opens the log viewer window"""
|
||||||
|
|
||||||
#lock_set = False
|
#lock_set = False
|
||||||
#if self.obtain_global_lock():
|
#if self.obtain_global_lock("dia_logs"):
|
||||||
# lock_set = True
|
# lock_set = True
|
||||||
|
|
||||||
# remove members from self.threads if close messages received
|
# remove members from self.threads if close messages received
|
||||||
|
@ -550,8 +565,13 @@ class fpdb:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def __calendar_dialog(self, widget, entry):
|
def __calendar_dialog(self, widget, entry):
|
||||||
self.dia_confirm.set_modal(False)
|
# do not alter the modality of the parent
|
||||||
|
# self.dia_confirm.set_modal(False)
|
||||||
d = gtk.Window(gtk.WINDOW_TOPLEVEL)
|
d = gtk.Window(gtk.WINDOW_TOPLEVEL)
|
||||||
|
d.set_transient_for(self.dia_confirm)
|
||||||
|
d.set_destroy_with_parent(True)
|
||||||
|
d.set_modal(True)
|
||||||
|
|
||||||
d.set_title('Pick a date')
|
d.set_title('Pick a date')
|
||||||
|
|
||||||
vb = gtk.VBox()
|
vb = gtk.VBox()
|
||||||
|
@ -587,8 +607,8 @@ class fpdb:
|
||||||
|
|
||||||
def dia_regression_test(self, widget, data=None):
|
def dia_regression_test(self, widget, data=None):
|
||||||
self.warning_box("Unimplemented: Regression Test")
|
self.warning_box("Unimplemented: Regression Test")
|
||||||
self.obtain_global_lock()
|
#self.obtain_global_lock("dia_regression_test")
|
||||||
self.release_global_lock()
|
#self.release_global_lock()
|
||||||
|
|
||||||
def dia_save_profile(self, widget, data=None):
|
def dia_save_profile(self, widget, data=None):
|
||||||
self.warning_box("Unimplemented: Save Profile (try saving a HUD layout, that should do it)")
|
self.warning_box("Unimplemented: Save Profile (try saving a HUD layout, that should do it)")
|
||||||
|
@ -618,7 +638,6 @@ class fpdb:
|
||||||
<menubar name="MenuBar">
|
<menubar name="MenuBar">
|
||||||
<menu action="main">
|
<menu action="main">
|
||||||
<menuitem action="LoadProf"/>
|
<menuitem action="LoadProf"/>
|
||||||
<menuitem action="EditProf"/>
|
|
||||||
<menuitem action="SaveProf"/>
|
<menuitem action="SaveProf"/>
|
||||||
<menuitem action="Preferences"/>
|
<menuitem action="Preferences"/>
|
||||||
<separator/>
|
<separator/>
|
||||||
|
@ -627,30 +646,27 @@ class fpdb:
|
||||||
<menu action="import">
|
<menu action="import">
|
||||||
<menuitem action="sethharchive"/>
|
<menuitem action="sethharchive"/>
|
||||||
<menuitem action="bulkimp"/>
|
<menuitem action="bulkimp"/>
|
||||||
|
<menuitem action="imapsummaries"/>
|
||||||
<menuitem action="autoimp"/>
|
<menuitem action="autoimp"/>
|
||||||
<menuitem action="autorate"/>
|
|
||||||
</menu>
|
</menu>
|
||||||
<menu action="viewers">
|
<menu action="viewers">
|
||||||
<menuitem action="autoimp"/>
|
<menuitem action="autoimp"/>
|
||||||
<menuitem action="graphs"/>
|
<menuitem action="graphs"/>
|
||||||
<menuitem action="handreplay"/>
|
<menuitem action="ringplayerstats"/>
|
||||||
<menuitem action="playerdetails"/>
|
<menuitem action="tourneyplayerstats"/>
|
||||||
<menuitem action="playerstats"/>
|
|
||||||
<menuitem action="posnstats"/>
|
<menuitem action="posnstats"/>
|
||||||
<menuitem action="sessionstats"/>
|
<menuitem action="sessionstats"/>
|
||||||
<menuitem action="sessionreplay"/>
|
|
||||||
<menuitem action="tableviewer"/>
|
<menuitem action="tableviewer"/>
|
||||||
</menu>
|
</menu>
|
||||||
<menu action="database">
|
<menu action="database">
|
||||||
<menuitem action="maintaindbs"/>
|
<menuitem action="maintaindbs"/>
|
||||||
<menuitem action="createuser"/>
|
|
||||||
<menuitem action="createtabs"/>
|
<menuitem action="createtabs"/>
|
||||||
<menuitem action="rebuildhudcache"/>
|
<menuitem action="rebuildhudcache"/>
|
||||||
<menuitem action="rebuildindexes"/>
|
<menuitem action="rebuildindexes"/>
|
||||||
<menuitem action="stats"/>
|
<menuitem action="databasestats"/>
|
||||||
|
<menuitem action="dumptofile"/>
|
||||||
</menu>
|
</menu>
|
||||||
<menu action="help">
|
<menu action="help">
|
||||||
<menuitem action="Abbrev"/>
|
|
||||||
<menuitem action="Logs"/>
|
<menuitem action="Logs"/>
|
||||||
<separator/>
|
<separator/>
|
||||||
<menuitem action="About"/>
|
<menuitem action="About"/>
|
||||||
|
@ -667,32 +683,28 @@ class fpdb:
|
||||||
actiongroup.add_actions([('main', None, '_Main'),
|
actiongroup.add_actions([('main', None, '_Main'),
|
||||||
('Quit', gtk.STOCK_QUIT, '_Quit', None, 'Quit the Program', self.quit),
|
('Quit', gtk.STOCK_QUIT, '_Quit', None, 'Quit the Program', self.quit),
|
||||||
('LoadProf', None, '_Load Profile (broken)', '<control>L', 'Load your profile', self.dia_load_profile),
|
('LoadProf', None, '_Load Profile (broken)', '<control>L', 'Load your profile', self.dia_load_profile),
|
||||||
('EditProf', None, '_Edit Profile (todo)', '<control>E', 'Edit your profile', self.dia_edit_profile),
|
|
||||||
('SaveProf', None, '_Save Profile (todo)', '<control>S', 'Save your profile', self.dia_save_profile),
|
('SaveProf', None, '_Save Profile (todo)', '<control>S', 'Save your profile', self.dia_save_profile),
|
||||||
('Preferences', None, 'Pre_ferences', '<control>F', 'Edit your preferences', self.dia_preferences),
|
('Preferences', None, 'Pre_ferences', '<control>F', 'Edit your preferences', self.dia_preferences),
|
||||||
('import', None, '_Import'),
|
('import', None, '_Import'),
|
||||||
('sethharchive', None, '_Set HandHistory Archive Directory', None, 'Set HandHistory Archive Directory', self.select_hhArchiveBase),
|
('sethharchive', None, '_Set HandHistory Archive Directory', None, 'Set HandHistory Archive Directory', self.select_hhArchiveBase),
|
||||||
('bulkimp', None, '_Bulk Import', '<control>B', 'Bulk Import', self.tab_bulk_import),
|
('bulkimp', None, '_Bulk Import', '<control>B', 'Bulk Import', self.tab_bulk_import),
|
||||||
('autorate', None, 'Auto _Rating (todo)', '<control>R', 'Auto Rating (todo)', self.not_implemented),
|
('imapsummaries', None, '_Import Tourney Summaries through eMail/IMAP', '<control>I', 'Auto Import and HUD', self.import_imap_summaries),
|
||||||
('viewers', None, '_Viewers'),
|
('viewers', None, '_Viewers'),
|
||||||
('autoimp', None, '_Auto Import and HUD', '<control>A', 'Auto Import and HUD', self.tab_auto_import),
|
('autoimp', None, '_Auto Import and HUD', '<control>A', 'Auto Import and HUD', self.tab_auto_import),
|
||||||
('graphs', None, '_Graphs', '<control>G', 'Graphs', self.tabGraphViewer),
|
('graphs', None, '_Graphs', '<control>G', 'Graphs', self.tabGraphViewer),
|
||||||
('handreplay', None, 'Hand _Replayer (todo)', None, 'Hand Replayer (todo)', self.not_implemented),
|
('ringplayerstats', None, 'Ring _Player Stats (tabulated view)', '<control>P', 'Ring Player Stats (tabulated view)', self.tab_ring_player_stats),
|
||||||
('playerdetails', None, 'Player _Details (todo)', None, 'Player Details (todo)', self.not_implemented),
|
('tourneyplayerstats', None, '_Tourney Player Stats (tabulated view)', '<control>T', 'Tourney Player Stats (tabulated view)', self.tab_tourney_player_stats),
|
||||||
('playerstats', None, '_Player Stats (tabulated view)', '<control>P', 'Player Stats (tabulated view)', self.tab_player_stats),
|
|
||||||
('posnstats', None, 'P_ositional Stats (tabulated view)', '<control>O', 'Positional Stats (tabulated view)', self.tab_positional_stats),
|
('posnstats', None, 'P_ositional Stats (tabulated view)', '<control>O', 'Positional Stats (tabulated view)', self.tab_positional_stats),
|
||||||
('sessionstats', None, 'Session Stats', None, 'Session Stats', self.tab_session_stats),
|
('sessionstats', None, 'Session Stats', None, 'Session Stats', self.tab_session_stats),
|
||||||
('sessionreplay', None, '_Session Replayer (todo)', None, 'Session Replayer (todo)', self.not_implemented),
|
|
||||||
('tableviewer', None, 'Poker_table Viewer (mostly obselete)', None, 'Poker_table Viewer (mostly obselete)', self.tab_table_viewer),
|
('tableviewer', None, 'Poker_table Viewer (mostly obselete)', None, 'Poker_table Viewer (mostly obselete)', self.tab_table_viewer),
|
||||||
('database', None, '_Database'),
|
('database', None, '_Database'),
|
||||||
('maintaindbs', None, '_Maintain Databases (todo)', None, 'Maintain Databases', self.dia_maintain_dbs),
|
('maintaindbs', None, '_Maintain Databases (todo)', None, 'Maintain Databases', self.dia_maintain_dbs),
|
||||||
('createuser', None, 'Create or Delete _User (todo)', None, 'Create or Delete User', self.dia_create_del_user),
|
|
||||||
('createtabs', None, 'Create or Recreate _Tables', None, 'Create or Recreate Tables ', self.dia_recreate_tables),
|
('createtabs', None, 'Create or Recreate _Tables', None, 'Create or Recreate Tables ', self.dia_recreate_tables),
|
||||||
('rebuildhudcache', None, 'Rebuild HUD Cache', None, 'Rebuild HUD Cache', self.dia_recreate_hudcache),
|
('rebuildhudcache', None, 'Rebuild HUD Cache', None, 'Rebuild HUD Cache', self.dia_recreate_hudcache),
|
||||||
('rebuildindexes', None, 'Rebuild DB Indexes', None, 'Rebuild DB Indexes', self.dia_rebuild_indexes),
|
('rebuildindexes', None, 'Rebuild DB Indexes', None, 'Rebuild DB Indexes', self.dia_rebuild_indexes),
|
||||||
('stats', None, '_Statistics (todo)', None, 'View Database Statistics', self.dia_database_stats),
|
('databasestats', None, '_Statistics', None, 'View Database Statistics', self.dia_database_stats),
|
||||||
|
('dumptofile', None, 'Dump Database to Textfile', None, 'Dump Database to Textfile (takes much time, RAM, HD)', self.dia_dump_db),
|
||||||
('help', None, '_Help'),
|
('help', None, '_Help'),
|
||||||
('Abbrev', None, '_Abbrevations (todo)', None, 'List of Abbrevations', self.tab_abbreviations),
|
|
||||||
('Logs', None, '_Log Messages', None, 'Log and Debug Messages', self.dia_logs),
|
('Logs', None, '_Log Messages', None, 'Log and Debug Messages', self.dia_logs),
|
||||||
('About', None, 'A_bout', None, 'About the program', self.dia_about),
|
('About', None, 'A_bout', None, 'About the program', self.dia_about),
|
||||||
('License', None, '_License and Copying (todo)', None, 'License and Copying', self.dia_licensing),
|
('License', None, '_License and Copying (todo)', None, 'License and Copying', self.dia_licensing),
|
||||||
|
@ -706,6 +718,12 @@ class fpdb:
|
||||||
menubar = uimanager.get_widget('/MenuBar')
|
menubar = uimanager.get_widget('/MenuBar')
|
||||||
window.add_accel_group(accel_group)
|
window.add_accel_group(accel_group)
|
||||||
return menubar
|
return menubar
|
||||||
|
#end def get_menu
|
||||||
|
|
||||||
|
def import_imap_summaries(self, widget, data=None):
|
||||||
|
result=ImapSummaries.run(self.config, self.db)
|
||||||
|
#print "import imap summaries result:", result
|
||||||
|
#end def import_imap_summaries
|
||||||
|
|
||||||
def load_profile(self, create_db = False):
|
def load_profile(self, create_db = False):
|
||||||
"""Loads profile from the provided path name."""
|
"""Loads profile from the provided path name."""
|
||||||
|
@ -714,7 +732,7 @@ class fpdb:
|
||||||
self.warning_box( "There is an error in your config file\n" + self.config.file
|
self.warning_box( "There is an error in your config file\n" + self.config.file
|
||||||
+ "\n\nError is: " + str(self.config.file_error)
|
+ "\n\nError is: " + str(self.config.file_error)
|
||||||
, diatitle="CONFIG FILE ERROR" )
|
, diatitle="CONFIG FILE ERROR" )
|
||||||
exit()
|
sys.exit()
|
||||||
|
|
||||||
log = Configuration.get_logger("logging.conf", "fpdb", log_dir=self.config.dir_log)
|
log = Configuration.get_logger("logging.conf", "fpdb", log_dir=self.config.dir_log)
|
||||||
print "Logfile is " + os.path.join(self.config.dir_log, self.config.log_file) + "\n"
|
print "Logfile is " + os.path.join(self.config.dir_log, self.config.log_file) + "\n"
|
||||||
|
@ -810,18 +828,20 @@ class fpdb:
|
||||||
def not_implemented(self, widget, data=None):
|
def not_implemented(self, widget, data=None):
|
||||||
self.warning_box("Unimplemented menu entry")
|
self.warning_box("Unimplemented menu entry")
|
||||||
|
|
||||||
def obtain_global_lock(self):
|
def obtain_global_lock(self, source):
|
||||||
ret = self.lock.acquire(False) # will return false if lock is already held
|
ret = self.lock.acquire(source=source) # will return false if lock is already held
|
||||||
if ret:
|
if ret:
|
||||||
print "\nGlobal lock taken ..."
|
print "\nGlobal lock taken by", source
|
||||||
|
self.lockTakenBy=source
|
||||||
else:
|
else:
|
||||||
print "\nFailed to get global lock."
|
print "\nFailed to get global lock, it is currently held by", source
|
||||||
return ret
|
return ret
|
||||||
# need to release it later:
|
# need to release it later:
|
||||||
# self.lock.release()
|
# self.lock.release()
|
||||||
|
|
||||||
def quit(self, widget, data=None):
|
def quit(self, widget, data=None):
|
||||||
# TODO: can we get some / all of the stuff done in this function to execute on any kind of abort?
|
# TODO: can we get some / all of the stuff done in this function to execute on any kind of abort?
|
||||||
|
#FIXME get two "quitting normally" messages, following the addition of the self.window.destroy() call
|
||||||
print "Quitting normally"
|
print "Quitting normally"
|
||||||
# TODO: check if current settings differ from profile, if so offer to save or abort
|
# TODO: check if current settings differ from profile, if so offer to save or abort
|
||||||
try:
|
try:
|
||||||
|
@ -830,35 +850,40 @@ class fpdb:
|
||||||
except _mysql_exceptions.OperationalError: # oh, damn, we're already disconnected
|
except _mysql_exceptions.OperationalError: # oh, damn, we're already disconnected
|
||||||
pass
|
pass
|
||||||
self.statusIcon.set_visible(False)
|
self.statusIcon.set_visible(False)
|
||||||
|
|
||||||
|
self.window.destroy() # explicitly destroy to allow child windows to close cleanly
|
||||||
gtk.main_quit()
|
gtk.main_quit()
|
||||||
|
|
||||||
def release_global_lock(self):
|
def release_global_lock(self):
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
|
self.lockTakenBy=None
|
||||||
print "Global lock released.\n"
|
print "Global lock released.\n"
|
||||||
|
|
||||||
def tab_abbreviations(self, widget, data=None):
|
|
||||||
print "todo: implement tab_abbreviations"
|
|
||||||
|
|
||||||
def tab_auto_import(self, widget, data=None):
|
def tab_auto_import(self, widget, data=None):
|
||||||
"""opens the auto import tab"""
|
"""opens the auto import tab"""
|
||||||
new_aimp_thread = GuiAutoImport.GuiAutoImport(self.settings, self.config, self.sql)
|
new_aimp_thread = GuiAutoImport.GuiAutoImport(self.settings, self.config, self.sql, self.window)
|
||||||
self.threads.append(new_aimp_thread)
|
self.threads.append(new_aimp_thread)
|
||||||
aimp_tab=new_aimp_thread.get_vbox()
|
aimp_tab=new_aimp_thread.get_vbox()
|
||||||
self.add_and_display_tab(aimp_tab, "Auto Import")
|
self.add_and_display_tab(aimp_tab, "Auto Import")
|
||||||
|
|
||||||
def tab_bulk_import(self, widget, data=None):
|
def tab_bulk_import(self, widget, data=None):
|
||||||
"""opens a tab for bulk importing"""
|
"""opens a tab for bulk importing"""
|
||||||
#print "start of tab_bulk_import"
|
|
||||||
new_import_thread = GuiBulkImport.GuiBulkImport(self.settings, self.config, self.sql)
|
new_import_thread = GuiBulkImport.GuiBulkImport(self.settings, self.config, self.sql)
|
||||||
self.threads.append(new_import_thread)
|
self.threads.append(new_import_thread)
|
||||||
bulk_tab=new_import_thread.get_vbox()
|
bulk_tab=new_import_thread.get_vbox()
|
||||||
self.add_and_display_tab(bulk_tab, "Bulk Import")
|
self.add_and_display_tab(bulk_tab, "Bulk Import")
|
||||||
|
|
||||||
def tab_player_stats(self, widget, data=None):
|
def tab_ring_player_stats(self, widget, data=None):
|
||||||
new_ps_thread = GuiPlayerStats.GuiPlayerStats(self.config, self.sql, self.window)
|
new_ps_thread = GuiRingPlayerStats.GuiRingPlayerStats(self.config, self.sql, self.window)
|
||||||
self.threads.append(new_ps_thread)
|
self.threads.append(new_ps_thread)
|
||||||
ps_tab=new_ps_thread.get_vbox()
|
ps_tab=new_ps_thread.get_vbox()
|
||||||
self.add_and_display_tab(ps_tab, "Player Stats")
|
self.add_and_display_tab(ps_tab, "Ring Player Stats")
|
||||||
|
|
||||||
|
def tab_tourney_player_stats(self, widget, data=None):
|
||||||
|
new_ps_thread = GuiTourneyPlayerStats.GuiTourneyPlayerStats(self.config, self.db, self.sql, self.window)
|
||||||
|
self.threads.append(new_ps_thread)
|
||||||
|
ps_tab=new_ps_thread.get_vbox()
|
||||||
|
self.add_and_display_tab(ps_tab, "Tourney Player Stats")
|
||||||
|
|
||||||
def tab_positional_stats(self, widget, data=None):
|
def tab_positional_stats(self, widget, data=None):
|
||||||
new_ps_thread = GuiPositionalStats.GuiPositionalStats(self.config, self.sql)
|
new_ps_thread = GuiPositionalStats.GuiPositionalStats(self.config, self.sql)
|
||||||
|
@ -875,9 +900,15 @@ class fpdb:
|
||||||
def tab_main_help(self, widget, data=None):
|
def tab_main_help(self, widget, data=None):
|
||||||
"""Displays a tab with the main fpdb help screen"""
|
"""Displays a tab with the main fpdb help screen"""
|
||||||
mh_tab=gtk.Label("""Welcome to Fpdb!
|
mh_tab=gtk.Label("""Welcome to Fpdb!
|
||||||
For documentation please visit our website at http://fpdb.sourceforge.net/ or check the docs directory in the fpdb folder.
|
This program is currently in an alpha-state, so our database format is still sometimes changed.
|
||||||
Please note that default.conf is no longer needed nor used, all configuration now happens in HUD_config.xml
|
You should therefore always keep your hand history files so that you can re-import after an update, if necessary.
|
||||||
This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
|
|
||||||
|
For documentation please visit our website at http://fpdb.sourceforge.net/.
|
||||||
|
If you need help click on Contact - Get Help on our website.
|
||||||
|
Please note that default.conf is no longer needed nor used, all configuration now happens in HUD_config.xml.
|
||||||
|
|
||||||
|
This program is free/libre open source software licensed partially under the AGPL3, and partially under GPL2 or later.
|
||||||
|
You can find the full license texts in agpl-3.0.txt, gpl-2.0.txt and gpl-3.0.txt in the fpdb installation directory.""")
|
||||||
self.add_and_display_tab(mh_tab, "Help")
|
self.add_and_display_tab(mh_tab, "Help")
|
||||||
|
|
||||||
def tab_table_viewer(self, widget, data=None):
|
def tab_table_viewer(self, widget, data=None):
|
||||||
|
@ -889,7 +920,7 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
|
||||||
|
|
||||||
def tabGraphViewer(self, widget, data=None):
|
def tabGraphViewer(self, widget, data=None):
|
||||||
"""opens a graph viewer tab"""
|
"""opens a graph viewer tab"""
|
||||||
new_gv_thread = GuiGraphViewer.GuiGraphViewer(self.sql, self.config)
|
new_gv_thread = GuiGraphViewer.GuiGraphViewer(self.sql, self.config, self.window)
|
||||||
self.threads.append(new_gv_thread)
|
self.threads.append(new_gv_thread)
|
||||||
gv_tab = new_gv_thread.get_vbox()
|
gv_tab = new_gv_thread.get_vbox()
|
||||||
self.add_and_display_tab(gv_tab, "Graphs")
|
self.add_and_display_tab(gv_tab, "Graphs")
|
||||||
|
@ -903,9 +934,13 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
|
||||||
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
|
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
|
||||||
self.window.connect("delete_event", self.delete_event)
|
self.window.connect("delete_event", self.delete_event)
|
||||||
self.window.connect("destroy", self.destroy)
|
self.window.connect("destroy", self.destroy)
|
||||||
self.window.set_title("Free Poker DB - v%s or higher" % (VERSION, ))
|
self.window.set_title("Free Poker DB - v%s" % (VERSION, ))
|
||||||
self.window.set_border_width(1)
|
self.window.set_border_width(1)
|
||||||
self.window.set_default_size(900,720)
|
defx, defy = 900, 720
|
||||||
|
sx, sy = gtk.gdk.screen_width(), gtk.gdk.screen_height()
|
||||||
|
if sx < defx: defx = sx
|
||||||
|
if sy < defy: defy = sy
|
||||||
|
self.window.set_default_size(defx, defy)
|
||||||
self.window.set_resizable(True)
|
self.window.set_resizable(True)
|
||||||
|
|
||||||
self.main_vbox = gtk.VBox(False, 1)
|
self.main_vbox = gtk.VBox(False, 1)
|
||||||
|
@ -957,9 +992,11 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
|
||||||
menuItem = gtk.ImageMenuItem(gtk.STOCK_ABOUT)
|
menuItem = gtk.ImageMenuItem(gtk.STOCK_ABOUT)
|
||||||
menuItem.connect('activate', self.dia_about)
|
menuItem.connect('activate', self.dia_about)
|
||||||
self.statusMenu.append(menuItem)
|
self.statusMenu.append(menuItem)
|
||||||
|
|
||||||
menuItem = gtk.ImageMenuItem(gtk.STOCK_QUIT)
|
menuItem = gtk.ImageMenuItem(gtk.STOCK_QUIT)
|
||||||
menuItem.connect('activate', self.quit)
|
menuItem.connect('activate', self.quit)
|
||||||
self.statusMenu.append(menuItem)
|
self.statusMenu.append(menuItem)
|
||||||
|
|
||||||
self.statusIcon.connect('popup-menu', self.statusicon_menu, self.statusMenu)
|
self.statusIcon.connect('popup-menu', self.statusicon_menu, self.statusMenu)
|
||||||
self.statusIcon.set_visible(True)
|
self.statusIcon.set_visible(True)
|
||||||
|
|
||||||
|
@ -1006,7 +1043,7 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
|
||||||
self.window.present()
|
self.window.present()
|
||||||
|
|
||||||
def info_box(self, str1, str2):
|
def info_box(self, str1, str2):
|
||||||
diapath = gtk.MessageDialog( parent=None, flags=0, type=gtk.MESSAGE_INFO
|
diapath = gtk.MessageDialog( parent=self.window, flags=gtk.DIALOG_DESTROY_WITH_PARENT, type=gtk.MESSAGE_INFO
|
||||||
, buttons=(gtk.BUTTONS_OK), message_format=str1 )
|
, buttons=(gtk.BUTTONS_OK), message_format=str1 )
|
||||||
diapath.format_secondary_text(str2)
|
diapath.format_secondary_text(str2)
|
||||||
response = diapath.run()
|
response = diapath.run()
|
||||||
|
@ -1014,7 +1051,7 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def warning_box(self, str, diatitle="FPDB WARNING"):
|
def warning_box(self, str, diatitle="FPDB WARNING"):
|
||||||
diaWarning = gtk.Dialog(title=diatitle, parent=None, flags=0, buttons=(gtk.STOCK_OK,gtk.RESPONSE_OK))
|
diaWarning = gtk.Dialog(title=diatitle, parent=self.window, flags=gtk.DIALOG_DESTROY_WITH_PARENT, buttons=(gtk.STOCK_OK,gtk.RESPONSE_OK))
|
||||||
|
|
||||||
label = gtk.Label(str)
|
label = gtk.Label(str)
|
||||||
diaWarning.vbox.add(label)
|
diaWarning.vbox.add(label)
|
|
@ -1,21 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
#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 <http://www.gnu.org/licenses/>.
|
|
||||||
#In the "official" distribution you can find the license in
|
|
||||||
#agpl-3.0.txt in the docs folder of the package.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#end class fpdb_db
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
#Copyright 2008 Steffen Jobbagy-Felso
|
#Copyright 2008-2010 Steffen Schaumburg
|
||||||
#This program is free software: you can redistribute it and/or modify
|
#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
|
#it under the terms of the GNU Affero General Public License as published by
|
||||||
#the Free Software Foundation, version 3 of the License.
|
#the Free Software Foundation, version 3 of the License.
|
||||||
|
@ -12,10 +13,7 @@
|
||||||
#
|
#
|
||||||
#You should have received a copy of the GNU Affero General Public License
|
#You should have received a copy of the GNU Affero General Public License
|
||||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#In the "official" distribution you can find the license in
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
#agpl-3.0.txt in the docs folder of the package.
|
|
||||||
|
|
||||||
#see status.txt for site/games support info
|
|
||||||
|
|
||||||
# Standard Library modules
|
# Standard Library modules
|
||||||
|
|
||||||
|
@ -468,6 +466,7 @@ class Importer:
|
||||||
errors = getattr(hhc, 'numErrors')
|
errors = getattr(hhc, 'numErrors')
|
||||||
stored = getattr(hhc, 'numHands')
|
stored = getattr(hhc, 'numHands')
|
||||||
stored -= duplicates
|
stored -= duplicates
|
||||||
|
stored -= errors
|
||||||
else:
|
else:
|
||||||
# conversion didn't work
|
# conversion didn't work
|
||||||
# TODO: appropriate response?
|
# TODO: appropriate response?
|
||||||
|
@ -484,9 +483,9 @@ class Importer:
|
||||||
|
|
||||||
def printEmailErrorMessage(self, errors, filename, line):
|
def printEmailErrorMessage(self, errors, filename, line):
|
||||||
traceback.print_exc(file=sys.stderr)
|
traceback.print_exc(file=sys.stderr)
|
||||||
print "Error No.",errors,", please send the hand causing this to steffen@sycamoretest.info so I can fix it."
|
print "Error No.",errors,", please send the hand causing this to fpdb-main@lists.sourceforge.net so we can fix the problem."
|
||||||
print "Filename:", filename
|
print "Filename:", filename
|
||||||
print "Here is the first line so you can identify it. Please mention that the error was a ValueError:"
|
print "Here is the first line of the hand so you can identify it. Please mention that the error was a ValueError:"
|
||||||
print self.hand[0]
|
print self.hand[0]
|
||||||
print "Hand logged to hand-errors.txt"
|
print "Hand logged to hand-errors.txt"
|
||||||
logfile = open('hand-errors.txt', 'a')
|
logfile = open('hand-errors.txt', 'a')
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Code from http://ender.snowburst.org:4747/~jjohns/interlocks.py
|
# Code from http://ender.snowburst.org:4747/~jjohns/interlocks.py
|
||||||
# Thanks JJ!
|
# Thanks JJ!
|
||||||
|
@ -34,19 +35,24 @@ class InterProcessLockBase:
|
||||||
if not name:
|
if not name:
|
||||||
name = sys.argv[0]
|
name = sys.argv[0]
|
||||||
self.name = name
|
self.name = name
|
||||||
|
self.heldBy = None
|
||||||
|
|
||||||
def getHashedName(self):
|
def getHashedName(self):
|
||||||
return base64.b64encode(self.name).replace('=','')
|
return base64.b64encode(self.name).replace('=','')
|
||||||
|
|
||||||
def acquire_impl(self, wait): abstract
|
def acquire_impl(self, wait): abstract
|
||||||
|
|
||||||
def acquire(self, wait=False, retry_time=1):
|
def acquire(self, wait=False, retry_time=1, source=None):
|
||||||
|
if source == None:
|
||||||
|
source="Unknown"
|
||||||
if self._has_lock: # make sure 2nd acquire in same process fails
|
if self._has_lock: # make sure 2nd acquire in same process fails
|
||||||
|
print "lock already held by:",self.heldBy
|
||||||
return False
|
return False
|
||||||
while not self._has_lock:
|
while not self._has_lock:
|
||||||
try:
|
try:
|
||||||
self.acquire_impl(wait)
|
self.acquire_impl(wait)
|
||||||
self._has_lock = True
|
self._has_lock = True
|
||||||
|
self.heldBy=source
|
||||||
#print 'i have the lock'
|
#print 'i have the lock'
|
||||||
except SingleInstanceError:
|
except SingleInstanceError:
|
||||||
if not wait:
|
if not wait:
|
||||||
|
@ -58,6 +64,7 @@ class InterProcessLockBase:
|
||||||
def release(self):
|
def release(self):
|
||||||
self.release_impl()
|
self.release_impl()
|
||||||
self._has_lock = False
|
self._has_lock = False
|
||||||
|
self.heldBy=None
|
||||||
|
|
||||||
def locked(self):
|
def locked(self):
|
||||||
if self.acquire():
|
if self.acquire():
|
||||||
|
|
|
@ -1,3 +1,20 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
#Copyright 2009-2010 Eric Blade
|
||||||
|
#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 <http://www.gnu.org/licenses/>.
|
||||||
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
|
|
||||||
from distutils.core import setup
|
from distutils.core import setup
|
||||||
import py2exe
|
import py2exe
|
||||||
opts = {
|
opts = {
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""setup.py
|
"""setup.py
|
||||||
|
|
||||||
Py2exe script for fpdb.
|
Py2exe script for fpdb.
|
||||||
"""
|
"""
|
||||||
# Copyright 2009, Ray E. Barker
|
# Copyright 2009-2010, Ray E. Barker
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -39,16 +40,14 @@ Py2exe script for fpdb.
|
||||||
# MSVCP90.dll. These are somewhere in your windows install, so you
|
# MSVCP90.dll. These are somewhere in your windows install, so you
|
||||||
# can just copy them to your working folder. (or just assume other
|
# can just copy them to your working folder. (or just assume other
|
||||||
# person will have them? any copyright issues with including them?)
|
# person will have them? any copyright issues with including them?)
|
||||||
#- [ If it works, you'll have 3 new folders, build and dist and gfx. Build is
|
#- If it works, you'll have a new dir fpdb-YYYYMMDD-exe which should
|
||||||
# working space and should be deleted. Dist and gfx contain the files to be
|
|
||||||
# distributed. ]
|
|
||||||
# If it works, you'll have a new dir fpdb-XXX-YYYYMMDD-exe which should
|
|
||||||
# contain 2 dirs; gfx and pyfpdb and run_fpdb.bat
|
# contain 2 dirs; gfx and pyfpdb and run_fpdb.bat
|
||||||
#- Last, you must copy the etc/, lib/ and share/ folders from your
|
#- [ This bit is now automated:
|
||||||
|
# Last, you must copy the etc/, lib/ and share/ folders from your
|
||||||
# gtk/bin/ (just /gtk/?) folder to the pyfpdb folder. (the whole folders,
|
# gtk/bin/ (just /gtk/?) folder to the pyfpdb folder. (the whole folders,
|
||||||
# not just the contents)
|
# not just the contents) ]
|
||||||
#- You can (should) then prune the etc/, lib/ and share/ folders to
|
#- You can (should) then prune the etc/, lib/ and share/ folders to
|
||||||
# remove components we don't need.
|
# remove components we don't need. (see output at end of program run)
|
||||||
|
|
||||||
# sqlcoder notes: this worked for me with the following notes:
|
# sqlcoder notes: this worked for me with the following notes:
|
||||||
#- I used the following versions:
|
#- I used the following versions:
|
||||||
|
@ -65,6 +64,10 @@ Py2exe script for fpdb.
|
||||||
#
|
#
|
||||||
# libgobject-2.0-0.dll
|
# libgobject-2.0-0.dll
|
||||||
# libgdk-win32-2.0-0.dll
|
# libgdk-win32-2.0-0.dll
|
||||||
|
#
|
||||||
|
# Now updated to work with python 2.6 + related dependencies
|
||||||
|
# See walkthrough in packaging directory for versions used
|
||||||
|
# Updates to this script have broken python 2.5 compatibility (gio module, msvcr71 references now msvcp90)
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
@ -79,7 +82,9 @@ from datetime import date
|
||||||
|
|
||||||
origIsSystemDLL = py2exe.build_exe.isSystemDLL
|
origIsSystemDLL = py2exe.build_exe.isSystemDLL
|
||||||
def isSystemDLL(pathname):
|
def isSystemDLL(pathname):
|
||||||
if os.path.basename(pathname).lower() in ("msvcp71.dll", "dwmapi.dll"):
|
#VisC++ runtime msvcp71.dll removed; py2.6 needs msvcp90.dll which will not be distributed.
|
||||||
|
#dwmapi appears to be vista-specific file, not XP
|
||||||
|
if os.path.basename(pathname).lower() in ("dwmapi.dll"):
|
||||||
return 0
|
return 0
|
||||||
return origIsSystemDLL(pathname)
|
return origIsSystemDLL(pathname)
|
||||||
py2exe.build_exe.isSystemDLL = isSystemDLL
|
py2exe.build_exe.isSystemDLL = isSystemDLL
|
||||||
|
@ -116,11 +121,11 @@ test_and_remove('build')
|
||||||
|
|
||||||
|
|
||||||
today = date.today().strftime('%Y%m%d')
|
today = date.today().strftime('%Y%m%d')
|
||||||
print "\n" + r"Output will be created in \pyfpdb\ and \fpdb_XXX_"+today+'\\'
|
print "\n" + r"Output will be created in \pyfpdb\ and \fpdb_"+today+'\\'
|
||||||
print "Enter value for XXX (any length): ", # the comma means no newline
|
#print "Enter value for XXX (any length): ", # the comma means no newline
|
||||||
xxx = sys.stdin.readline().rstrip()
|
#xxx = sys.stdin.readline().rstrip()
|
||||||
dist_dirname = r'fpdb-' + xxx + '-' + today + '-exe'
|
dist_dirname = r'fpdb-' + today + '-exe'
|
||||||
dist_dir = r'..\fpdb-' + xxx + '-' + today + '-exe'
|
dist_dir = r'..\fpdb-' + today + '-exe'
|
||||||
print
|
print
|
||||||
|
|
||||||
test_and_remove(dist_dir)
|
test_and_remove(dist_dir)
|
||||||
|
@ -128,21 +133,16 @@ test_and_remove(dist_dir)
|
||||||
setup(
|
setup(
|
||||||
name = 'fpdb',
|
name = 'fpdb',
|
||||||
description = 'Free Poker DataBase',
|
description = 'Free Poker DataBase',
|
||||||
version = '0.12',
|
version = '0.20',
|
||||||
|
|
||||||
console = [ {'script': 'fpdb.py', "icon_resources": [(1, "../gfx/fpdb_large_icon.ico")]},
|
windows = [ {'script': 'fpdb.pyw', "icon_resources": [(1, "../gfx/fpdb_large_icon.ico")]},
|
||||||
{'script': 'HUD_main.py', },
|
{'script': 'HUD_main.pyw', },
|
||||||
{'script': 'Configuration.py', },
|
{'script': 'Configuration.py', }
|
||||||
{'script': 'Tables.py', },
|
|
||||||
{'script': 'Stats.py', },
|
|
||||||
{'script': 'Hello.py', },
|
|
||||||
{'script': 'GuiBulkImport.py', },
|
|
||||||
{'script': 'GuiAutoImport.py', }
|
|
||||||
],
|
],
|
||||||
|
|
||||||
options = {'py2exe': {
|
options = {'py2exe': {
|
||||||
'packages' : ['encodings', 'matplotlib'],
|
'packages' : ['encodings', 'matplotlib'],
|
||||||
'includes' : ['cairo', 'pango', 'pangocairo', 'atk', 'gobject'
|
'includes' : ['gio', 'cairo', 'pango', 'pangocairo', 'atk', 'gobject'
|
||||||
,'matplotlib.numerix.random_array'
|
,'matplotlib.numerix.random_array'
|
||||||
,'AbsoluteToFpdb', 'BetfairToFpdb'
|
,'AbsoluteToFpdb', 'BetfairToFpdb'
|
||||||
,'CarbonToFpdb', 'EverleafToFpdb'
|
,'CarbonToFpdb', 'EverleafToFpdb'
|
||||||
|
@ -152,12 +152,13 @@ setup(
|
||||||
],
|
],
|
||||||
'excludes' : ['_tkagg', '_agg2', 'cocoaagg', 'fltkagg'], # surely we need this? '_gtkagg'
|
'excludes' : ['_tkagg', '_agg2', 'cocoaagg', 'fltkagg'], # surely we need this? '_gtkagg'
|
||||||
'dll_excludes': ['libglade-2.0-0.dll', 'libgdk-win32-2.0-0.dll'
|
'dll_excludes': ['libglade-2.0-0.dll', 'libgdk-win32-2.0-0.dll'
|
||||||
,'libgobject-2.0-0.dll'],
|
,'libgobject-2.0-0.dll', 'msvcr90.dll', 'MSVCP90.dll', 'MSVCR90.dll','msvcr90.dll'],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
# files in 2nd value in tuple are moved to dir named in 1st value
|
# files in 2nd value in tuple are moved to dir named in 1st value
|
||||||
data_files = [('', ['HUD_config.xml.example', 'Cards01.png', 'logging.conf', '../docs/readme.txt'])
|
#data_files updated for new locations of licences + readme nolonger exists
|
||||||
|
data_files = [('', ['HUD_config.xml.example', 'Cards01.png', 'logging.conf', '../agpl-3.0.txt', '../fdl-1.2.txt', '../THANKS.txt', '../readme.txt'])
|
||||||
,(dist_dir, [r'..\run_fpdb.bat'])
|
,(dist_dir, [r'..\run_fpdb.bat'])
|
||||||
,( dist_dir + r'\gfx', glob.glob(r'..\gfx\*.*') )
|
,( dist_dir + r'\gfx', glob.glob(r'..\gfx\*.*') )
|
||||||
# line below has problem with fonts subdir ('not a regular file')
|
# line below has problem with fonts subdir ('not a regular file')
|
||||||
|
@ -168,10 +169,11 @@ setup(
|
||||||
|
|
||||||
os.rename('dist', 'pyfpdb')
|
os.rename('dist', 'pyfpdb')
|
||||||
|
|
||||||
print '\n' + 'If py2exe was successful add the \\etc \\lib and \\share dirs '
|
# these instructions no longer needed:
|
||||||
print 'from your gtk dir to \\%s\\pyfpdb\\\n' % dist_dirname
|
#print '\n' + 'If py2exe was successful add the \\etc \\lib and \\share dirs '
|
||||||
print 'Also copy libgobject-2.0-0.dll and libgdk-win32-2.0-0.dll from <gtk_dir>\\bin'
|
#print 'from your gtk dir to \\%s\\pyfpdb\\\n' % dist_dirname
|
||||||
print 'into there'
|
#print 'Also copy libgobject-2.0-0.dll and libgdk-win32-2.0-0.dll from <gtk_dir>\\bin'
|
||||||
|
#print 'into there'
|
||||||
|
|
||||||
dest = os.path.join(dist_dirname, 'pyfpdb')
|
dest = os.path.join(dist_dirname, 'pyfpdb')
|
||||||
#print "try renaming pyfpdb to", dest
|
#print "try renaming pyfpdb to", dest
|
||||||
|
@ -180,7 +182,7 @@ dest = dest.replace('\\', '\\\\')
|
||||||
os.rename( 'pyfpdb', dest )
|
os.rename( 'pyfpdb', dest )
|
||||||
|
|
||||||
|
|
||||||
print "Enter directory name for GTK 2.14 (e.g. c:\code\gtk_2.14.7-20090119)\n: ", # the comma means no newline
|
print "Enter directory name for GTK (e.g. c:\code\gtk_2.14.7-20090119)\n: ", # the comma means no newline
|
||||||
gtk_dir = sys.stdin.readline().rstrip()
|
gtk_dir = sys.stdin.readline().rstrip()
|
||||||
|
|
||||||
|
|
||||||
|
@ -212,4 +214,24 @@ dest_dir = os.path.join(dest, 'share')
|
||||||
dest_dir = dest_dir.replace('\\', '\\\\')
|
dest_dir = dest_dir.replace('\\', '\\\\')
|
||||||
shutil.copytree( src_dir, dest_dir )
|
shutil.copytree( src_dir, dest_dir )
|
||||||
|
|
||||||
|
print "\nIf py2exe was successful you should now have a new dir"
|
||||||
|
print dist_dirname+" in your pyfpdb dir"
|
||||||
|
print """
|
||||||
|
The following dirs can probably removed to make the final package smaller:
|
||||||
|
|
||||||
|
pyfpdb/lib/glib-2.0
|
||||||
|
pyfpdb/lib/gtk-2.0/include
|
||||||
|
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
|
||||||
|
pyfpdb/share/themes/Default
|
||||||
|
|
||||||
|
Use 7-zip to zip up the distribution and create a self extracting archive and that's it!
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,665 @@
|
||||||
|
Full Tilt Poker Game #11111111813: Table Fpdb - $2/$4 Ante $0.40 - Limit Stud Hi - 13:14:27 ET - 2010/06/10
|
||||||
|
Seat 1: Player4 ($7.40)
|
||||||
|
Seat 2: Player13 ($77.20)
|
||||||
|
Seat 3: Player1 ($111.80)
|
||||||
|
Seat 5: Player5 ($118.70)
|
||||||
|
Seat 7: Player6 ($36.30)
|
||||||
|
Player1 antes $0.40
|
||||||
|
Player4 antes $0.40
|
||||||
|
Player13 antes $0.40
|
||||||
|
Player5 antes $0.40
|
||||||
|
Player6 antes $0.40
|
||||||
|
*** 3RD STREET ***
|
||||||
|
Dealt to Player4 [9c]
|
||||||
|
Dealt to Player13 [8s]
|
||||||
|
Dealt to Player1 [Ac 9h] [3s]
|
||||||
|
Dealt to Player5 [3c]
|
||||||
|
Dealt to Player6 [Qs]
|
||||||
|
Player5 is low with [3c]
|
||||||
|
Player5 brings in for $0.50
|
||||||
|
Player6 folds
|
||||||
|
Player4 completes it to $2
|
||||||
|
Player14 sits down
|
||||||
|
Player13 folds
|
||||||
|
Player1 folds
|
||||||
|
Player14 adds $152
|
||||||
|
Player5 calls $1.50
|
||||||
|
*** 4TH STREET ***
|
||||||
|
Dealt to Player4 [9c] [9d]
|
||||||
|
Dealt to Player5 [3c] [8d]
|
||||||
|
Player4 bets $4
|
||||||
|
Player5 folds
|
||||||
|
Uncalled bet of $4 returned to Player4
|
||||||
|
Player4 mucks
|
||||||
|
Player4 wins the pot ($6)
|
||||||
|
*** SUMMARY ***
|
||||||
|
Total pot $6 | Rake $0
|
||||||
|
Seat 1: Player4 collected ($6), mucked
|
||||||
|
Seat 2: Player13 folded on 3rd St.
|
||||||
|
Seat 3: Player1 folded on 3rd St.
|
||||||
|
Seat 5: Player5 folded on 4th St.
|
||||||
|
Seat 7: Player6 folded on 3rd St.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Full Tilt Poker Game #11111111538: Table Fpdb - $2/$4 Ante $0.40 - Limit Stud Hi - 13:15:56 ET - 2010/06/10
|
||||||
|
Seat 1: Player4 ($12.60)
|
||||||
|
Seat 2: Player13 ($89.90)
|
||||||
|
Seat 3: Player1 ($110.60)
|
||||||
|
Seat 5: Player5 ($115.50)
|
||||||
|
Seat 6: Player14 ($138.70)
|
||||||
|
Seat 7: Player6 ($35.10)
|
||||||
|
Player1 antes $0.40
|
||||||
|
Player4 antes $0.40
|
||||||
|
Player13 antes $0.40
|
||||||
|
Player5 antes $0.40
|
||||||
|
Player14 antes $0.40
|
||||||
|
Player6 antes $0.40
|
||||||
|
*** 3RD STREET ***
|
||||||
|
Dealt to Player4 [Qc]
|
||||||
|
Dealt to Player13 [5s]
|
||||||
|
Dealt to Player1 [6c 5d] [3d]
|
||||||
|
Dealt to Player5 [9d]
|
||||||
|
Dealt to Player14 [8h]
|
||||||
|
Dealt to Player6 [Ts]
|
||||||
|
Player1 is low with [3d]
|
||||||
|
Player1 brings in for $0.50
|
||||||
|
Player5 folds
|
||||||
|
Player14 folds
|
||||||
|
Player6 completes it to $2
|
||||||
|
Player4 folds
|
||||||
|
Player13 folds
|
||||||
|
Player1 calls $1.50
|
||||||
|
*** 4TH STREET ***
|
||||||
|
Dealt to Player1 [6c 5d 3d] [7c]
|
||||||
|
Dealt to Player6 [Ts] [6d]
|
||||||
|
Player6 bets $2
|
||||||
|
Player1 calls $2
|
||||||
|
*** 5TH STREET ***
|
||||||
|
Dealt to Player1 [6c 5d 3d 7c] [Qd]
|
||||||
|
Dealt to Player6 [Ts 6d] [9s]
|
||||||
|
Player1 checks
|
||||||
|
Player6 bets $4
|
||||||
|
Player1 folds
|
||||||
|
Uncalled bet of $4 returned to Player6
|
||||||
|
Player6 mucks
|
||||||
|
Player6 wins the pot ($10.40)
|
||||||
|
*** SUMMARY ***
|
||||||
|
Total pot $10.40 | Rake $0
|
||||||
|
Seat 1: Player4 folded on 3rd St.
|
||||||
|
Seat 2: Player13 folded on 3rd St.
|
||||||
|
Seat 3: Player1 folded on 5th St.
|
||||||
|
Seat 5: Player5 folded on 3rd St.
|
||||||
|
Seat 6: Player14 folded on 3rd St.
|
||||||
|
Seat 7: Player6 collected ($10.40), mucked
|
||||||
|
|
||||||
|
|
||||||
|
Full Tilt Poker Game #11111111649: Table Fpdb - $2/$4 Ante $0.40 - Limit Stud Hi - 13:17:24 ET - 2010/06/10
|
||||||
|
Seat 1: Player4 ($16.30)
|
||||||
|
Seat 2: Player13 ($88.70)
|
||||||
|
Seat 3: Player1 ($107.30)
|
||||||
|
Seat 5: Player5 ($114.30)
|
||||||
|
Seat 6: Player14 ($135.50)
|
||||||
|
Seat 7: Player6 ($40.30)
|
||||||
|
Player1 antes $0.40
|
||||||
|
Player4 antes $0.40
|
||||||
|
Player13 antes $0.40
|
||||||
|
Player5 antes $0.40
|
||||||
|
Player14 antes $0.40
|
||||||
|
Player6 antes $0.40
|
||||||
|
*** 3RD STREET ***
|
||||||
|
Dealt to Player4 [9s]
|
||||||
|
Dealt to Player13 [9h]
|
||||||
|
Dealt to Player1 [8h Kd] [6s]
|
||||||
|
Dealt to Player5 [4c]
|
||||||
|
Dealt to Player14 [8d]
|
||||||
|
Dealt to Player6 [6c]
|
||||||
|
Player5 is low with [4c]
|
||||||
|
Player10 sits down
|
||||||
|
Player10 adds $40
|
||||||
|
Player5 brings in for $0.50
|
||||||
|
Player14 folds
|
||||||
|
Player6 folds
|
||||||
|
Player4 folds
|
||||||
|
Player13 completes it to $2
|
||||||
|
Player1 folds
|
||||||
|
Player5 folds
|
||||||
|
Uncalled bet of $1.50 returned to Player13
|
||||||
|
Player13 mucks
|
||||||
|
Player13 wins the pot ($3.40)
|
||||||
|
*** SUMMARY ***
|
||||||
|
Total pot $3.40 | Rake $0
|
||||||
|
Seat 1: Player4 folded on 3rd St.
|
||||||
|
Seat 2: Player13 collected ($3.40), mucked
|
||||||
|
Seat 3: Player1 folded on 3rd St.
|
||||||
|
Seat 5: Player5 folded on 3rd St.
|
||||||
|
Seat 6: Player14 folded on 3rd St.
|
||||||
|
Seat 7: Player6 folded on 3rd St.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Full Tilt Poker Game #11111112277: Table Fpdb - $2/$4 Ante $0.40 - Limit Stud Hi - 13:17:41 ET - 2010/06/10
|
||||||
|
Seat 1: Player4 ($15.90)
|
||||||
|
Seat 2: Player13 ($91.20)
|
||||||
|
Seat 3: Player1 ($106.90)
|
||||||
|
Seat 5: Player5 ($113.40)
|
||||||
|
Seat 6: Player14 ($135.10)
|
||||||
|
Seat 7: Player6 ($39.90)
|
||||||
|
Seat 8: Player10 ($40)
|
||||||
|
Player1 antes $0.40
|
||||||
|
Player4 antes $0.40
|
||||||
|
Player13 antes $0.40
|
||||||
|
Player5 antes $0.40
|
||||||
|
Player14 antes $0.40
|
||||||
|
Player6 antes $0.40
|
||||||
|
Player10 antes $0.40
|
||||||
|
*** 3RD STREET ***
|
||||||
|
Dealt to Player4 [Qs]
|
||||||
|
Dealt to Player13 [8s]
|
||||||
|
Dealt to Player1 [3h 9c] [Ah]
|
||||||
|
Dealt to Player5 [Qc]
|
||||||
|
Dealt to Player14 [Kc]
|
||||||
|
Dealt to Player6 [Jh]
|
||||||
|
Dealt to Player10 [6d]
|
||||||
|
Player10 is low with [6d]
|
||||||
|
Player10 brings in for $0.50
|
||||||
|
Player4 folds
|
||||||
|
Player13 folds
|
||||||
|
Player1 folds
|
||||||
|
Player5 completes it to $2
|
||||||
|
Player14 raises to $4
|
||||||
|
Player6 folds
|
||||||
|
Player10 calls $3.50
|
||||||
|
Player5 calls $2
|
||||||
|
*** 4TH STREET ***
|
||||||
|
Dealt to Player5 [Qc] [3c]
|
||||||
|
Dealt to Player14 [Kc] [Kh]
|
||||||
|
Dealt to Player10 [6d] [Td]
|
||||||
|
Player14 has 15 seconds left to act
|
||||||
|
Player14 bets $4
|
||||||
|
Player10 folds
|
||||||
|
Player5 folds
|
||||||
|
Uncalled bet of $4 returned to Player14
|
||||||
|
Player14 mucks
|
||||||
|
Player14 wins the pot ($14.80)
|
||||||
|
*** SUMMARY ***
|
||||||
|
Total pot $14.80 | Rake $0
|
||||||
|
Seat 1: Player4 folded on 3rd St.
|
||||||
|
Seat 2: Player13 folded on 3rd St.
|
||||||
|
Seat 3: Player1 folded on 3rd St.
|
||||||
|
Seat 5: Player5 folded on 4th St.
|
||||||
|
Seat 6: Player14 collected ($14.80), mucked
|
||||||
|
Seat 7: Player6 folded on 3rd St.
|
||||||
|
Seat 8: Player10 folded on 4th St.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Full Tilt Poker Game #11111110428: Table Fpdb - $2/$4 Ante $0.40 - Limit Stud Hi - 13:18:23 ET - 2010/06/10
|
||||||
|
Seat 1: Player4 ($15.50)
|
||||||
|
Seat 2: Player13 ($90.80)
|
||||||
|
Seat 3: Player1 ($106.50)
|
||||||
|
Seat 5: Player5 ($109)
|
||||||
|
Seat 6: Player14 ($145.50)
|
||||||
|
Seat 7: Player6 ($39.50)
|
||||||
|
Seat 8: Player10 ($35.60)
|
||||||
|
Player10 antes $0.40
|
||||||
|
Player13 antes $0.40
|
||||||
|
Player1 antes $0.40
|
||||||
|
Player4 antes $0.40
|
||||||
|
Player5 antes $0.40
|
||||||
|
Player14 antes $0.40
|
||||||
|
Player6 antes $0.40
|
||||||
|
*** 3RD STREET ***
|
||||||
|
Dealt to Player4 [Th]
|
||||||
|
Dealt to Player13 [Kc]
|
||||||
|
Dealt to Player1 [Kh 9c] [5h]
|
||||||
|
Dealt to Player5 [6h]
|
||||||
|
Dealt to Player14 [Js]
|
||||||
|
Dealt to Player6 [Ac]
|
||||||
|
Dealt to Player10 [Ah]
|
||||||
|
Player1 is low with [5h]
|
||||||
|
Player1 brings in for $0.50
|
||||||
|
Player5 folds
|
||||||
|
Player14 folds
|
||||||
|
Player6 folds
|
||||||
|
Player10 completes it to $2
|
||||||
|
Player4 calls $2
|
||||||
|
Player13 folds
|
||||||
|
Player1 folds
|
||||||
|
*** 4TH STREET ***
|
||||||
|
Dealt to Player4 [Th] [4h]
|
||||||
|
Dealt to Player10 [Ah] [3c]
|
||||||
|
Player10 bets $2
|
||||||
|
Player4 calls $2
|
||||||
|
*** 5TH STREET ***
|
||||||
|
Dealt to Player4 [Th 4h] [9h]
|
||||||
|
Dealt to Player10 [Ah 3c] [8h]
|
||||||
|
Player10 has 15 seconds left to act
|
||||||
|
Player10 bets $4
|
||||||
|
Player4 raises to $8
|
||||||
|
Player10 folds
|
||||||
|
Uncalled bet of $4 returned to Player4
|
||||||
|
Player4 mucks
|
||||||
|
Player4 wins the pot ($19.30)
|
||||||
|
*** SUMMARY ***
|
||||||
|
Total pot $19.30 | Rake $0
|
||||||
|
Seat 1: Player4 collected ($19.30), mucked
|
||||||
|
Seat 2: Player13 folded on 3rd St.
|
||||||
|
Seat 3: Player1 folded on 3rd St.
|
||||||
|
Seat 5: Player5 folded on 3rd St.
|
||||||
|
Seat 6: Player14 folded on 3rd St.
|
||||||
|
Seat 7: Player6 folded on 3rd St.
|
||||||
|
Seat 8: Player10 folded on 5th St.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Full Tilt Poker Game #11111112961: Table Fpdb - $2/$4 Ante $0.40 - Limit Stud Hi - 13:19:27 ET - 2010/06/10
|
||||||
|
Seat 1: Player4 ($26)
|
||||||
|
Seat 2: Player13 ($90)
|
||||||
|
Seat 3: Player1 ($105.20)
|
||||||
|
Seat 5: Player5 ($108.20)
|
||||||
|
Seat 6: Player14 ($144.70)
|
||||||
|
Seat 7: Player6 ($41.50)
|
||||||
|
Seat 8: Player10 ($26.80)
|
||||||
|
Player4 antes $0.40
|
||||||
|
Player13 antes $0.40
|
||||||
|
Player1 antes $0.40
|
||||||
|
Player5 antes $0.40
|
||||||
|
Player10 antes $0.40
|
||||||
|
Player14 antes $0.40
|
||||||
|
Player6 antes $0.40
|
||||||
|
*** 3RD STREET ***
|
||||||
|
Dealt to Player4 [9d]
|
||||||
|
Dealt to Player13 [Qs]
|
||||||
|
Dealt to Player1 [9h 9s] [5c]
|
||||||
|
Dealt to Player5 [Th]
|
||||||
|
Dealt to Player14 [6c]
|
||||||
|
Dealt to Player6 [2d]
|
||||||
|
Dealt to Player10 [Qh]
|
||||||
|
Player6 is low with [2d]
|
||||||
|
Player6 brings in for $0.50
|
||||||
|
Player10 folds
|
||||||
|
Player4 folds
|
||||||
|
Player13 folds
|
||||||
|
Player1 completes it to $2
|
||||||
|
Player5 folds
|
||||||
|
Player14 folds
|
||||||
|
Player6 calls $1.50
|
||||||
|
*** 4TH STREET ***
|
||||||
|
Dealt to Player1 [9h 9s 5c] [3s]
|
||||||
|
Dealt to Player6 [2d] [Ah]
|
||||||
|
Player6 checks
|
||||||
|
Player1 bets $2
|
||||||
|
Player6 calls $2
|
||||||
|
*** 5TH STREET ***
|
||||||
|
Dealt to Player1 [9h 9s 5c 3s] [Kh]
|
||||||
|
Dealt to Player6 [2d Ah] [Kc]
|
||||||
|
Player6 checks
|
||||||
|
Player1 bets $4
|
||||||
|
Player6 raises to $8
|
||||||
|
Player1 calls $4
|
||||||
|
*** 6TH STREET ***
|
||||||
|
Dealt to Player1 [9h 9s 5c 3s Kh] [5d]
|
||||||
|
Dealt to Player6 [2d Ah Kc] [4d]
|
||||||
|
Player1 bets $4
|
||||||
|
Player6 calls $4
|
||||||
|
*** 7TH STREET ***
|
||||||
|
Dealt to Player1 [9h 9s 5c 3s Kh 5d] [8s]
|
||||||
|
Player1 bets $4
|
||||||
|
Player6 calls $4
|
||||||
|
*** SHOW DOWN ***
|
||||||
|
Player1 shows [9s 9h 5c 3s Kh 5d 8s] two pair, Nines and Fives
|
||||||
|
Player6 shows [Ad Kd 2d Ah Kc 4d 8h] two pair, Aces and Kings
|
||||||
|
Player6 wins the pot ($40.80) with two pair, Aces and Kings
|
||||||
|
*** SUMMARY ***
|
||||||
|
Total pot $42.80 | Rake $2
|
||||||
|
Seat 1: Player4 folded on 3rd St.
|
||||||
|
Seat 2: Player13 folded on 3rd St.
|
||||||
|
Seat 3: Player1 showed [9s 9h 5c 3s Kh 5d 8s] and lost with two pair, Nines and Fives
|
||||||
|
Seat 5: Player5 folded on 3rd St.
|
||||||
|
Seat 6: Player14 folded on 3rd St.
|
||||||
|
Seat 7: Player6 showed [Ad Kd 2d Ah Kc 4d 8h] and won ($40.80) with two pair, Aces and Kings
|
||||||
|
Seat 8: Player10 folded on 3rd St.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Full Tilt Poker Game #11111110018: Table Fpdb - $2/$4 Ante $0.40 - Limit Stud Hi - 13:26:21 ET - 2010/06/10
|
||||||
|
Seat 1: Player12 ($66.10)
|
||||||
|
Seat 2: Player13 ($85.50)
|
||||||
|
Seat 3: Player1 ($81.10)
|
||||||
|
Seat 4: Player11 ($283.75)
|
||||||
|
Seat 5: Player5 ($109.40)
|
||||||
|
Seat 6: Player14 ($140.20)
|
||||||
|
Seat 7: Player6 ($59.80)
|
||||||
|
Seat 8: Player10 ($62.10)
|
||||||
|
Player10 antes $0.40
|
||||||
|
Player13 antes $0.40
|
||||||
|
Player1 antes $0.40
|
||||||
|
Player5 antes $0.40
|
||||||
|
Player14 antes $0.40
|
||||||
|
Player12 antes $0.40
|
||||||
|
Player11 antes $0.40
|
||||||
|
Player6 antes $0.40
|
||||||
|
*** 3RD STREET ***
|
||||||
|
Dealt to Player12 [Qh]
|
||||||
|
Dealt to Player13 [Kd]
|
||||||
|
Dealt to Player1 [2d Kc] [5h]
|
||||||
|
Dealt to Player11 [9d]
|
||||||
|
Dealt to Player5 [6d]
|
||||||
|
Dealt to Player14 [Ad]
|
||||||
|
Dealt to Player6 [6h]
|
||||||
|
Dealt to Player10 [7h]
|
||||||
|
Player1 is low with [5h]
|
||||||
|
Player1 brings in for $0.50
|
||||||
|
Player11 folds
|
||||||
|
Player5 folds
|
||||||
|
Player14 folds
|
||||||
|
Player6 folds
|
||||||
|
Player10 folds
|
||||||
|
Player12 folds
|
||||||
|
Player13 completes it to $2
|
||||||
|
Player1 folds
|
||||||
|
Uncalled bet of $1.50 returned to Player13
|
||||||
|
Player13 mucks
|
||||||
|
Player13 wins the pot ($4.20)
|
||||||
|
*** SUMMARY ***
|
||||||
|
Total pot $4.20 | Rake $0
|
||||||
|
Seat 1: Player12 folded on 3rd St.
|
||||||
|
Seat 2: Player13 collected ($4.20), mucked
|
||||||
|
Seat 3: Player1 folded on 3rd St.
|
||||||
|
Seat 4: Player11 folded on 3rd St.
|
||||||
|
Seat 5: Player5 folded on 3rd St.
|
||||||
|
Seat 6: Player14 folded on 3rd St.
|
||||||
|
Seat 7: Player6 folded on 3rd St.
|
||||||
|
Seat 8: Player10 folded on 3rd St.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Full Tilt Poker Game #11111111146: Table Fpdb - $2/$4 Ante $0.40 - Limit Stud Hi - 13:26:47 ET - 2010/06/10
|
||||||
|
Seat 1: Player12 ($65.70)
|
||||||
|
Seat 2: Player13 ($88.80)
|
||||||
|
Seat 3: Player1 ($80.20)
|
||||||
|
Seat 4: Player11 ($283.35)
|
||||||
|
Seat 5: Player5 ($109)
|
||||||
|
Seat 6: Player14 ($139.80)
|
||||||
|
Seat 7: Player6 ($59.40)
|
||||||
|
Seat 8: Player10 ($61.70)
|
||||||
|
Player10 antes $0.40
|
||||||
|
Player1 antes $0.40
|
||||||
|
Player13 antes $0.40
|
||||||
|
Player5 antes $0.40
|
||||||
|
Player11 antes $0.40
|
||||||
|
Player12 antes $0.40
|
||||||
|
Player14 antes $0.40
|
||||||
|
Player6 antes $0.40
|
||||||
|
*** 3RD STREET ***
|
||||||
|
Dealt to Player12 [Qd]
|
||||||
|
Dealt to Player13 [5c]
|
||||||
|
Dealt to Player1 [4d 3s] [9s]
|
||||||
|
Dealt to Player11 [Ks]
|
||||||
|
Dealt to Player5 [2c]
|
||||||
|
Dealt to Player14 [3d]
|
||||||
|
Dealt to Player6 [2h]
|
||||||
|
Dealt to Player10 [2d]
|
||||||
|
Player5 is low with [2c]
|
||||||
|
Player5 brings in for $0.50
|
||||||
|
Player14 folds
|
||||||
|
Player6 folds
|
||||||
|
Player10 folds
|
||||||
|
Player12 folds
|
||||||
|
Player13 folds
|
||||||
|
Player1 folds
|
||||||
|
Player11 completes it to $2
|
||||||
|
Player5 calls $1.50
|
||||||
|
*** 4TH STREET ***
|
||||||
|
Dealt to Player11 [Ks] [Ah]
|
||||||
|
Dealt to Player5 [2c] [5s]
|
||||||
|
Player11 bets $2
|
||||||
|
Player5 folds
|
||||||
|
Uncalled bet of $2 returned to Player11
|
||||||
|
Player11 mucks
|
||||||
|
Player11 wins the pot ($7.20)
|
||||||
|
*** SUMMARY ***
|
||||||
|
Total pot $7.20 | Rake $0
|
||||||
|
Seat 1: Player12 folded on 3rd St.
|
||||||
|
Seat 2: Player13 folded on 3rd St.
|
||||||
|
Seat 3: Player1 folded on 3rd St.
|
||||||
|
Seat 4: Player11 collected ($7.20), mucked
|
||||||
|
Seat 5: Player5 folded on 4th St.
|
||||||
|
Seat 6: Player14 folded on 3rd St.
|
||||||
|
Seat 7: Player6 folded on 3rd St.
|
||||||
|
Seat 8: Player10 folded on 3rd St.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Full Tilt Poker Game #11111111633: Table Fpdb - $2/$4 Ante $0.40 - Limit Stud Hi - 13:37:55 ET - 2010/06/10
|
||||||
|
Seat 1: Player12 ($72)
|
||||||
|
Seat 2: Player9 ($40), is sitting out
|
||||||
|
Seat 3: Player1 ($89.20)
|
||||||
|
Seat 4: Player2 ($96.10)
|
||||||
|
Seat 5: Player5 ($105.50), is sitting out
|
||||||
|
Seat 6: Player14 ($131.70)
|
||||||
|
Seat 7: Player6 ($54.70)
|
||||||
|
Seat 8: Player10 ($96.40)
|
||||||
|
Player10 antes $0.40
|
||||||
|
Player1 antes $0.40
|
||||||
|
Player12 antes $0.40
|
||||||
|
Player14 antes $0.40
|
||||||
|
Player6 antes $0.40
|
||||||
|
5 seconds left to act
|
||||||
|
Player2 is sitting out
|
||||||
|
*** 3RD STREET ***
|
||||||
|
Dealt to Player12 [5c]
|
||||||
|
Dealt to Player1 [Td 9d] [Kc]
|
||||||
|
Dealt to Player14 [5h]
|
||||||
|
Dealt to Player6 [4s]
|
||||||
|
Dealt to Player10 [7s]
|
||||||
|
Player6 is low with [4s]
|
||||||
|
Player2 stands up
|
||||||
|
Player6 brings in for $0.50
|
||||||
|
Player10 folds
|
||||||
|
Player12 folds
|
||||||
|
Player1 completes it to $2
|
||||||
|
Player14 calls $2
|
||||||
|
Player6 folds
|
||||||
|
*** 4TH STREET ***
|
||||||
|
Dealt to Player1 [Td 9d Kc] [9s]
|
||||||
|
Dealt to Player14 [5h] [9h]
|
||||||
|
Player1 bets $2
|
||||||
|
Player14 raises to $4
|
||||||
|
Player1 calls $2
|
||||||
|
*** 5TH STREET ***
|
||||||
|
Dealt to Player1 [Td 9d Kc 9s] [Tc]
|
||||||
|
Dealt to Player14 [5h 9h] [3d]
|
||||||
|
Player1 checks
|
||||||
|
Player14 checks
|
||||||
|
*** 6TH STREET ***
|
||||||
|
Dealt to Player1 [Td 9d Kc 9s Tc] [9c]
|
||||||
|
Dealt to Player14 [5h 9h 3d] [Th]
|
||||||
|
Player1 bets $4
|
||||||
|
Player14 calls $4
|
||||||
|
*** 7TH STREET ***
|
||||||
|
Dealt to Player1 [Td 9d Kc 9s Tc 9c] [7h]
|
||||||
|
Player1 bets $4
|
||||||
|
Player14 calls $4
|
||||||
|
*** SHOW DOWN ***
|
||||||
|
Player1 shows [Td 9d Kc 9s Tc 9c 7h] a full house, Nines full of Tens
|
||||||
|
Player14 mucks
|
||||||
|
Player1 wins the pot ($29.50) with a full house, Nines full of Tens
|
||||||
|
*** SUMMARY ***
|
||||||
|
Total pot $30.50 | Rake $1
|
||||||
|
Seat 1: Player12 folded on 3rd St.
|
||||||
|
Seat 2: Player9 is sitting out
|
||||||
|
Seat 3: Player1 showed [Td 9d Kc 9s Tc 9c 7h] and won ($29.50) with a full house, Nines full of Tens
|
||||||
|
Seat 4: Player2 is sitting out
|
||||||
|
Seat 5: Player5 is sitting out
|
||||||
|
Seat 6: Player14 mucked [8h 6h 5h 9h 3d Th 3h] - a flush, Ten high
|
||||||
|
Seat 7: Player6 folded on 3rd St.
|
||||||
|
Seat 8: Player10 folded on 3rd St.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Full Tilt Poker Game #11111113928: Table Fpdb - $2/$4 Ante $0.40 - Limit Stud Hi - 13:39:41 ET - 2010/06/10
|
||||||
|
Seat 1: Player12 ($68.70)
|
||||||
|
Seat 2: Player9 ($40), is sitting out
|
||||||
|
Seat 3: Player1 ($103.90)
|
||||||
|
Seat 6: Player14 ($116.40)
|
||||||
|
Seat 7: Player6 ($58.40)
|
||||||
|
Seat 8: Player10 ($95.60)
|
||||||
|
Player10 antes $0.40
|
||||||
|
Player1 antes $0.40
|
||||||
|
Player6 antes $0.40
|
||||||
|
Player3 sits down
|
||||||
|
Player14 antes $0.40
|
||||||
|
Player12 antes $0.40
|
||||||
|
*** 3RD STREET ***
|
||||||
|
Dealt to Player12 [9c]
|
||||||
|
Dealt to Player1 [Ts 4h] [9h]
|
||||||
|
Dealt to Player14 [7c]
|
||||||
|
Dealt to Player6 [7s]
|
||||||
|
Dealt to Player10 [2h]
|
||||||
|
Player10 is low with [2h]
|
||||||
|
Player3 adds $40
|
||||||
|
Player10 brings in for $0.50
|
||||||
|
Player12 folds
|
||||||
|
Player1 completes it to $2
|
||||||
|
Player14 folds
|
||||||
|
Player6 folds
|
||||||
|
Player10 folds
|
||||||
|
Uncalled bet of $1.50 returned to Player1
|
||||||
|
Player1 mucks
|
||||||
|
Player1 wins the pot ($3)
|
||||||
|
*** SUMMARY ***
|
||||||
|
Total pot $3 | Rake $0
|
||||||
|
Seat 1: Player12 folded on 3rd St.
|
||||||
|
Seat 2: Player9 is sitting out
|
||||||
|
Seat 3: Player1 collected ($3), mucked
|
||||||
|
Seat 6: Player14 folded on 3rd St.
|
||||||
|
Seat 7: Player6 folded on 3rd St.
|
||||||
|
Seat 8: Player10 folded on 3rd St.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Full Tilt Poker Game #11111111062: Table Fpdb - $2/$4 Ante $0.40 - Limit Stud Hi - 13:51:45 ET - 2010/06/10
|
||||||
|
Seat 1: Player12 ($83.40)
|
||||||
|
Seat 2: Player9 ($24.35)
|
||||||
|
Seat 3: Player1 ($147.90)
|
||||||
|
Seat 4: Player3 ($74.10)
|
||||||
|
Seat 5: Player8 ($63.10)
|
||||||
|
Seat 6: Player14 ($103)
|
||||||
|
Seat 7: Player6 ($63.20)
|
||||||
|
Seat 8: Player7 ($48.40)
|
||||||
|
Player7 antes $0.40
|
||||||
|
Player1 antes $0.40
|
||||||
|
Player8 antes $0.40
|
||||||
|
Player3 antes $0.40
|
||||||
|
Player9 antes $0.40
|
||||||
|
Player12 antes $0.40
|
||||||
|
Player14 antes $0.40
|
||||||
|
Player6 antes $0.40
|
||||||
|
*** 3RD STREET ***
|
||||||
|
Dealt to Player12 [As]
|
||||||
|
Dealt to Player9 [7s]
|
||||||
|
Dealt to Player1 [7h 6s] [8d]
|
||||||
|
Dealt to Player3 [2d]
|
||||||
|
Dealt to Player8 [3c]
|
||||||
|
Dealt to Player14 [7c]
|
||||||
|
Dealt to Player6 [8h]
|
||||||
|
Dealt to Player7 [Qs]
|
||||||
|
Player3 is low with [2d]
|
||||||
|
Player3 brings in for $0.50
|
||||||
|
Player8 folds
|
||||||
|
Player14 folds
|
||||||
|
Player6 folds
|
||||||
|
Player7 folds
|
||||||
|
Player12 completes it to $2
|
||||||
|
Player9 folds
|
||||||
|
Player1 calls $2
|
||||||
|
Player3 calls $1.50
|
||||||
|
*** 4TH STREET ***
|
||||||
|
Dealt to Player12 [As] [5d]
|
||||||
|
Dealt to Player1 [7h 6s 8d] [Qc]
|
||||||
|
Dealt to Player3 [2d] [3h]
|
||||||
|
Player12 bets $2
|
||||||
|
Player1 folds
|
||||||
|
Player3 calls $2
|
||||||
|
*** 5TH STREET ***
|
||||||
|
Dealt to Player12 [As 5d] [4c]
|
||||||
|
Dealt to Player3 [2d 3h] [5s]
|
||||||
|
Player12 bets $4
|
||||||
|
Player3 folds
|
||||||
|
Uncalled bet of $4 returned to Player12
|
||||||
|
Player12 mucks
|
||||||
|
Player12 wins the pot ($13.20)
|
||||||
|
*** SUMMARY ***
|
||||||
|
Total pot $13.20 | Rake $0
|
||||||
|
Seat 1: Player12 collected ($13.20), mucked
|
||||||
|
Seat 2: Player9 folded on 3rd St.
|
||||||
|
Seat 3: Player1 folded on 4th St.
|
||||||
|
Seat 4: Player3 folded on 5th St.
|
||||||
|
Seat 5: Player8 folded on 3rd St.
|
||||||
|
Seat 6: Player14 folded on 3rd St.
|
||||||
|
Seat 7: Player6 folded on 3rd St.
|
||||||
|
Seat 8: Player7 folded on 3rd St.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Full Tilt Poker Game #11111115744: Table Fpdb - $2/$4 Ante $0.40 - Limit Stud Hi - 14:02:17 ET - 2010/06/10
|
||||||
|
Seat 2: Player0 ($60)
|
||||||
|
Seat 3: Player1 ($129.30)
|
||||||
|
Seat 4: Player3 ($125.75)
|
||||||
|
Seat 5: Player8 ($40.10)
|
||||||
|
Seat 7: Player6 ($72)
|
||||||
|
Seat 8: Player7 ($32.20)
|
||||||
|
Player0 antes $0.40
|
||||||
|
Player8 antes $0.40
|
||||||
|
Player7 antes $0.40
|
||||||
|
Player1 antes $0.40
|
||||||
|
Player3 antes $0.40
|
||||||
|
Player6 antes $0.40
|
||||||
|
*** 3RD STREET ***
|
||||||
|
Dealt to Player0 [Th]
|
||||||
|
Dealt to Player1 [9s Qc] [7d]
|
||||||
|
Dealt to Player3 [Qh]
|
||||||
|
Dealt to Player8 [Kd]
|
||||||
|
Dealt to Player6 [Jd]
|
||||||
|
Dealt to Player7 [Jh]
|
||||||
|
Player1 is low with [7d]
|
||||||
|
Player1 brings in for $0.50
|
||||||
|
Player3 folds
|
||||||
|
Player8 folds
|
||||||
|
Player6 folds
|
||||||
|
Player7 completes it to $2
|
||||||
|
Player0 calls $2
|
||||||
|
Player1 folds
|
||||||
|
*** 4TH STREET ***
|
||||||
|
Dealt to Player0 [Th] [As]
|
||||||
|
Dealt to Player7 [Jh] [8c]
|
||||||
|
Player0 bets $2
|
||||||
|
Player7 calls $2
|
||||||
|
*** 5TH STREET ***
|
||||||
|
Dealt to Player0 [Th As] [Kh]
|
||||||
|
Dealt to Player7 [Jh 8c] [2s]
|
||||||
|
Player0 checks
|
||||||
|
Player7 checks
|
||||||
|
*** 6TH STREET ***
|
||||||
|
Dealt to Player0 [Th As Kh] [7h]
|
||||||
|
Dealt to Player7 [Jh 8c 2s] [9h]
|
||||||
|
Player0 bets $4
|
||||||
|
Player7 folds
|
||||||
|
Uncalled bet of $4 returned to Player0
|
||||||
|
Player0 mucks
|
||||||
|
Player0 wins the pot ($10.90)
|
||||||
|
*** SUMMARY ***
|
||||||
|
Total pot $10.90 | Rake $0
|
||||||
|
Seat 2: Player0 collected ($10.90), mucked
|
||||||
|
Seat 3: Player1 folded on 3rd St.
|
||||||
|
Seat 4: Player3 folded on 3rd St.
|
||||||
|
Seat 5: Player8 folded on 3rd St.
|
||||||
|
Seat 7: Player6 folded on 3rd St.
|
||||||
|
Seat 8: Player7 folded on 6th St.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,137 @@
|
||||||
|
PokerStars Game #14732633821: Hold'em No Limit ($0.25/$0.50 USD) - 2010/05/23 22:39:16 WET [2010/05/23 17:39:16 ET]
|
||||||
|
Table '99999999 II' 2-max Seat #1 is the button
|
||||||
|
Seat 1: Player0 ($20 in chips)
|
||||||
|
Seat 2: Player1 ($50.50 in chips)
|
||||||
|
Player0: posts small blind $0.25
|
||||||
|
Player1: posts big blind $0.50
|
||||||
|
*** HOLE CARDS ***
|
||||||
|
Dealt to Player0 [2h Th]
|
||||||
|
Player0: calls $0.25
|
||||||
|
Player1: checks
|
||||||
|
*** FLOP *** [4c 8c Ac]
|
||||||
|
Player1: checks
|
||||||
|
Player0: checks
|
||||||
|
*** TURN *** [4c 8c Ac] [7s]
|
||||||
|
Player1: checks
|
||||||
|
Player0: bets $1
|
||||||
|
Player1: folds
|
||||||
|
Uncalled bet ($1) returned to Player0
|
||||||
|
Player0 collected $0.95 from pot
|
||||||
|
Player0: doesn't show hand
|
||||||
|
*** SUMMARY ***
|
||||||
|
Total pot $1 | Rake $0.05
|
||||||
|
Board [4c 8c Ac 7s]
|
||||||
|
Seat 1: Player0 (button) (small blind) collected ($0.95)
|
||||||
|
Seat 2: Player1 (big blind) folded on the Turn
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PokerStars Game #28140199921: Hold'em No Limit ($0.25/$0.50 USD) - 2010/05/23 22:39:59 WET [2010/05/23 17:39:59 ET]
|
||||||
|
Table '99999999 II' 2-max Seat #2 is the button
|
||||||
|
Seat 1: Player0 ($20.45 in chips)
|
||||||
|
Seat 2: Player1 ($50 in chips)
|
||||||
|
Player1: posts small blind $0.25
|
||||||
|
Player0: posts big blind $0.50
|
||||||
|
*** HOLE CARDS ***
|
||||||
|
Dealt to Player0 [7h Kh]
|
||||||
|
Player1: raises $1 to $1.50
|
||||||
|
Player0: folds
|
||||||
|
Uncalled bet ($1) returned to Player1
|
||||||
|
Player1 collected $1 from pot
|
||||||
|
Player1: doesn't show hand
|
||||||
|
*** SUMMARY ***
|
||||||
|
Total pot $1 | Rake $0
|
||||||
|
Seat 1: Player0 (big blind) folded before Flop
|
||||||
|
Seat 2: Player1 (button) (small blind) collected ($1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PokerStars Game #29402240709: Hold'em No Limit ($0.25/$0.50 USD) - 2010/05/23 22:40:22 WET [2010/05/23 17:40:22 ET]
|
||||||
|
Table '99999999 II' 2-max Seat #1 is the button
|
||||||
|
Seat 1: Player0 ($19.95 in chips)
|
||||||
|
Seat 2: Player1 ($50.50 in chips)
|
||||||
|
Player0: posts small blind $0.25
|
||||||
|
Player1: posts big blind $0.50
|
||||||
|
*** HOLE CARDS ***
|
||||||
|
Dealt to Player0 [5c 8c]
|
||||||
|
Player0: folds
|
||||||
|
Uncalled bet ($0.25) returned to Player1
|
||||||
|
Player1 collected $0.50 from pot
|
||||||
|
Player1: doesn't show hand
|
||||||
|
*** SUMMARY ***
|
||||||
|
Total pot $0.50 | Rake $0
|
||||||
|
Seat 1: Player0 (button) (small blind) folded before Flop
|
||||||
|
Seat 2: Player1 (big blind) collected ($0.50)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PokerStars Game #31842149327: Hold'em No Limit ($0.25/$0.50 USD) - 2010/05/23 22:40:29 WET [2010/05/23 17:40:29 ET]
|
||||||
|
Table '99999999 II' 2-max Seat #2 is the button
|
||||||
|
Seat 1: Player0 ($19.70 in chips)
|
||||||
|
Seat 2: Player1 ($50.75 in chips)
|
||||||
|
Player1: posts small blind $0.25
|
||||||
|
Player0: posts big blind $0.50
|
||||||
|
*** HOLE CARDS ***
|
||||||
|
Dealt to Player0 [Ks 9c]
|
||||||
|
Player1: raises $1 to $1.50
|
||||||
|
Player0: calls $1
|
||||||
|
*** FLOP *** [3d As 4s]
|
||||||
|
Player0: checks
|
||||||
|
Player1: bets $2
|
||||||
|
Player0: calls $2
|
||||||
|
*** TURN *** [3d As 4s] [Jd]
|
||||||
|
Player0: checks
|
||||||
|
Player1: checks
|
||||||
|
*** RIVER *** [3d As 4s Jd] [3h]
|
||||||
|
Player0: checks
|
||||||
|
Player1: checks
|
||||||
|
*** SHOW DOWN ***
|
||||||
|
Player0: shows [Ks 9c] (a pair of Threes)
|
||||||
|
Player1: mucks hand
|
||||||
|
Player0 collected $6.70 from pot
|
||||||
|
*** SUMMARY ***
|
||||||
|
Total pot $7 | Rake $0.30
|
||||||
|
Board [3d As 4s Jd 3h]
|
||||||
|
Seat 1: Player0 (big blind) showed [Ks 9c] and won ($6.70) with a pair of Threes
|
||||||
|
Seat 2: Player1 (button) (small blind) mucked [6c 5s]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PokerStars Game #10697227103: Hold'em No Limit ($0.25/$0.50 USD) - 2010/05/23 22:41:10 WET [2010/05/23 17:41:10 ET]
|
||||||
|
Table '99999999 II' 2-max Seat #1 is the button
|
||||||
|
Seat 1: Player0 ($22.90 in chips)
|
||||||
|
Seat 2: Player1 ($50 in chips)
|
||||||
|
Player0: posts small blind $0.25
|
||||||
|
Player1: posts big blind $0.50
|
||||||
|
*** HOLE CARDS ***
|
||||||
|
Dealt to Player0 [Ts 3d]
|
||||||
|
Player0: folds
|
||||||
|
Uncalled bet ($0.25) returned to Player1
|
||||||
|
Player1 collected $0.50 from pot
|
||||||
|
Player1: doesn't show hand
|
||||||
|
*** SUMMARY ***
|
||||||
|
Total pot $0.50 | Rake $0
|
||||||
|
Seat 1: Player0 (button) (small blind) folded before Flop
|
||||||
|
Seat 2: Player1 (big blind) collected ($0.50)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PokerStars Game #27159326072: Hold'em No Limit ($0.25/$0.50 USD) - 2010/05/23 22:41:17 WET [2010/05/23 17:41:17 ET]
|
||||||
|
Table '99999999 II' 2-max Seat #2 is the button
|
||||||
|
Seat 1: Player0 ($22.65 in chips)
|
||||||
|
Seat 2: Player1 ($50.25 in chips)
|
||||||
|
Player1: posts small blind $0.25
|
||||||
|
Player0: posts big blind $0.50
|
||||||
|
*** HOLE CARDS ***
|
||||||
|
Dealt to Player0 [4h Ks]
|
||||||
|
Player1: raises $1 to $1.50
|
||||||
|
Player0: folds
|
||||||
|
Uncalled bet ($1) returned to Player1
|
||||||
|
Player1 collected $1 from pot
|
||||||
|
Player1: doesn't show hand
|
||||||
|
*** SUMMARY ***
|
||||||
|
Total pot $1 | Rake $0
|
||||||
|
Seat 1: Player0 (big blind) folded before Flop
|
||||||
|
Seat 2: Player1 (button) (small blind) collected ($1)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
PokerStars Game #42738187409: Hold'em No Limit ($0.01/$0.02 USD) - 2010/04/16 11:14:06 WET [2010/04/16 6:14:06 ET]
|
||||||
|
Table 'Circinus V' 9-max Seat #4 is the button
|
||||||
|
Seat 1: Player2 ($4.26 in chips)
|
||||||
|
Seat 2: Player1 ($0.35 in chips)
|
||||||
|
Seat 3: Player7 ($8.34 in chips)
|
||||||
|
Seat 4: Player5 ($3.70 in chips)
|
||||||
|
Seat 5: Player6 ($4.98 in chips)
|
||||||
|
Seat 7: Player3 ($2.55 in chips)
|
||||||
|
Seat 8: Player0 ($4.91 in chips)
|
||||||
|
Seat 9: Player4 ($1.31 in chips)
|
||||||
|
Player6: posts small blind $0.01
|
||||||
|
Alehta: is sitting out
|
||||||
|
Player3: posts big blind $0.02
|
||||||
|
*** HOLE CARDS ***
|
||||||
|
Dealt to Player1 [3d Ks]
|
||||||
|
Alehta leaves the table
|
||||||
|
Player0: calls $0.02
|
||||||
|
Player4: raises $0.06 to $0.08
|
||||||
|
Player2: raises $0.16 to $0.24
|
||||||
|
AFMAT joins the table at seat #6
|
||||||
|
Player1: folds
|
||||||
|
Player7: folds
|
||||||
|
Player5: folds
|
||||||
|
Player6: folds
|
||||||
|
Player3: folds
|
||||||
|
Player0: calls $0.22
|
||||||
|
Player4: raises $1.07 to $1.31 and is all-in
|
||||||
|
Player2: calls $1.07
|
||||||
|
Player0: folds
|
||||||
|
*** FLOP *** [7c Ac 6s]
|
||||||
|
*** TURN *** [7c Ac 6s] [5d]
|
||||||
|
*** RIVER *** [7c Ac 6s 5d] [Qh]
|
||||||
|
*** SHOW DOWN ***
|
||||||
|
Player4: shows [As Qs] (two pair, Aces and Queens)
|
||||||
|
Player2: shows [Jc Jd] (a pair of Jacks)
|
||||||
|
Player4 collected $2.79 from pot
|
||||||
|
*** SUMMARY ***
|
||||||
|
Total pot $2.89 | Rake $0.10
|
||||||
|
Board [7c Ac 6s 5d Qh]
|
||||||
|
Seat 1: Player2 showed [Jc Jd] and lost with a pair of Jacks
|
||||||
|
Seat 2: Player1 folded before Flop (didn't bet)
|
||||||
|
Seat 3: Player7 folded before Flop (didn't bet)
|
||||||
|
Seat 4: Player5 (button) folded before Flop (didn't bet)
|
||||||
|
Seat 5: Player6 (small blind) folded before Flop
|
||||||
|
Seat 7: Player3 (big blind) folded before Flop
|
||||||
|
Seat 8: Player0 folded before Flop
|
||||||
|
Seat 9: Player4 showed [As Qs] and won ($2.79) with two pair, Aces and Queens
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,45 @@
|
||||||
|
PokerStars Game #24782122321: Hold'em No Limit ($0.01/$0.02 USD) - 2010/06/06 22:24:02 WET [2010/06/06 17:24:02 ET]
|
||||||
|
Table '999999999' 9-max Seat #1 is the button
|
||||||
|
Seat 1: Player2 ($0.88 in chips)
|
||||||
|
Seat 2: Player0 ($1.61 in chips)
|
||||||
|
Seat 3: Player5 ($5.27 in chips)
|
||||||
|
Seat 5: Player1 ($2.15 in chips)
|
||||||
|
Seat 6: Player3 ($2.55 in chips)
|
||||||
|
Seat 7: Player6 ($2.90 in chips)
|
||||||
|
Seat 9: Player4 ($1.93 in chips)
|
||||||
|
Player0: posts small blind $0.01
|
||||||
|
Player5: posts big blind $0.02
|
||||||
|
*** HOLE CARDS ***
|
||||||
|
Dealt to Player0 [Td Qc]
|
||||||
|
Player1: folds
|
||||||
|
Player3: calls $0.02
|
||||||
|
Player3 said, "":D""
|
||||||
|
Player6: folds
|
||||||
|
Player4: folds
|
||||||
|
Player2 has timed out
|
||||||
|
Player2: folds
|
||||||
|
Player0: calls $0.01
|
||||||
|
Player5: checks
|
||||||
|
*** FLOP *** [7d 2s Jc]
|
||||||
|
Player0: checks
|
||||||
|
Player5: checks
|
||||||
|
Player3: checks
|
||||||
|
*** TURN *** [7d 2s Jc] [2h]
|
||||||
|
Player0: folds
|
||||||
|
Player5: bets $0.06
|
||||||
|
Player3: folds
|
||||||
|
Uncalled bet ($0.06) returned to Player5
|
||||||
|
Player5 collected $0.06 from pot
|
||||||
|
Player5: doesn't show hand
|
||||||
|
*** SUMMARY ***
|
||||||
|
Total pot $0.06 | Rake $0
|
||||||
|
Board [7d 2s Jc 2h]
|
||||||
|
Seat 1: Player2 (button) folded before Flop (didn't bet)
|
||||||
|
Seat 2: Player0 (small blind) folded on the Turn
|
||||||
|
Seat 3: Player5 (big blind) collected ($0.06)
|
||||||
|
Seat 5: Player1 folded before Flop (didn't bet)
|
||||||
|
Seat 6: Player3 folded on the Turn
|
||||||
|
Seat 7: Player6 folded before Flop (didn't bet)
|
||||||
|
Seat 9: Player4 folded before Flop (didn't bet)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
PokerStars Game #42875758685: Hold'em No Limit ($0.05/$0.10 USD) - 2010/04/19 0:19:11 WET [2010/04/18 19:19:11 ET]
|
||||||
|
Table 'gimick VI' 9-max Seat #4 is the button
|
||||||
|
Seat 3: Player1 ($5.55 in chips)
|
||||||
|
Seat 4: Player0 ($2.40 in chips)
|
||||||
|
Seat 8: Player2 ($3.90 in chips)
|
||||||
|
Player2: posts small blind $0.05
|
||||||
|
Player1: posts big blind $0.10
|
||||||
|
*** HOLE CARDS ***
|
||||||
|
Dealt to Player0 [7d 8d]
|
||||||
|
Player0: raises $0.30 to $0.40
|
||||||
|
Player2: calls $0.35
|
||||||
|
Player1: folds
|
||||||
|
*** FLOP *** [2h 2d Qd]
|
||||||
|
Player2: checks
|
||||||
|
Player0: bets $0.60
|
||||||
|
Player2: raises $0.60 to $1.20
|
||||||
|
Player0: calls $0.60
|
||||||
|
*** TURN *** [2h 2d Qd] [5d]
|
||||||
|
Player2: bets $0.90
|
||||||
|
Player0: calls $0.80 and is all-in
|
||||||
|
Uncalled bet ($0.10) returned to Player2
|
||||||
|
*** RIVER *** [2h 2d Qd 5d] [4d]
|
||||||
|
*** SHOW DOWN ***
|
||||||
|
Player2: shows [9d As] (a flush, Queen high)
|
||||||
|
Player0: shows [7d 8d] (a flush, Queen high - lower cards)
|
||||||
|
Player2 collected $4.70 from pot
|
||||||
|
*** SUMMARY ***
|
||||||
|
Total pot $4.90 | Rake $0.20
|
||||||
|
Board [2h 2d Qd 5d 4d]
|
||||||
|
Seat 3: Player1 (big blind) folded before Flop
|
||||||
|
Seat 4: Player0 (button) showed [7d 8d] and lost with a flush, Queen high
|
||||||
|
Seat 8: Player2 (small blind) showed [9d As] and won ($4.70) with a flush, Queen high
|
||||||
|
|
|
@ -0,0 +1,158 @@
|
||||||
|
|
||||||
|
PokerStars Game #14311270221: Omaha Pot Limit ($0.01/$0.02 USD) - 2010/06/07 20:13:12 WET [2010/06/07 15:13:12 ET]
|
||||||
|
Table '99999999I' 9-max Seat #3 is the button
|
||||||
|
Seat 2: Player5 ($0.58 in chips)
|
||||||
|
Seat 3: Player1 ($0.65 in chips)
|
||||||
|
Seat 6: Player4 ($1.92 in chips)
|
||||||
|
Seat 7: Player6 ($2.81 in chips)
|
||||||
|
Seat 8: Player3 ($2.50 in chips)
|
||||||
|
Seat 9: Player2 ($0.80 in chips)
|
||||||
|
Player0 will be allowed to play after the button
|
||||||
|
Player4: posts small blind $0.01
|
||||||
|
Player6: posts big blind $0.02
|
||||||
|
Player3: posts big blind $0.02
|
||||||
|
Player2: posts big blind $0.02
|
||||||
|
*** HOLE CARDS ***
|
||||||
|
Dealt to Player1 [8d As 2h Ks]
|
||||||
|
Player3: checks
|
||||||
|
Player2: checks
|
||||||
|
Player5: raises $0.02 to $0.04
|
||||||
|
Player1: raises $0.02 to $0.06
|
||||||
|
Player4: calls $0.05
|
||||||
|
Player6: folds
|
||||||
|
Player3: calls $0.04
|
||||||
|
Player2: calls $0.04
|
||||||
|
Player5: calls $0.02
|
||||||
|
*** FLOP *** [Qh 7c Qs]
|
||||||
|
Player4: checks
|
||||||
|
Player3: checks
|
||||||
|
Player2: bets $0.31
|
||||||
|
Player5: folds
|
||||||
|
Player1: folds
|
||||||
|
Player4: folds
|
||||||
|
Player3: folds
|
||||||
|
Uncalled bet ($0.31) returned to Player2
|
||||||
|
Player2 collected $0.31 from pot
|
||||||
|
*** SUMMARY ***
|
||||||
|
Total pot $0.32 | Rake $0.01
|
||||||
|
Board [Qh 7c Qs]
|
||||||
|
Seat 2: Player5 folded on the Flop
|
||||||
|
Seat 3: Player1 (button) folded on the Flop
|
||||||
|
Seat 6: Player4 (small blind) folded on the Flop
|
||||||
|
Seat 7: Player6 (big blind) folded before Flop
|
||||||
|
Seat 8: Player3 folded on the Flop
|
||||||
|
Seat 9: Player2 collected ($0.31)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PokerStars Game #22865231671: Omaha Pot Limit ($0.01/$0.02 USD) - 2010/06/07 20:14:17 WET [2010/06/07 15:14:17 ET]
|
||||||
|
Table '99999999I' 9-max Seat #6 is the button
|
||||||
|
Seat 2: Player5 ($0.52 in chips)
|
||||||
|
Seat 3: Player1 ($0.59 in chips)
|
||||||
|
Seat 5: Player0 ($0.90 in chips)
|
||||||
|
Seat 6: Player4 ($1.86 in chips)
|
||||||
|
Seat 7: Player6 ($2.79 in chips)
|
||||||
|
Seat 8: Player3 ($5 in chips)
|
||||||
|
Seat 9: Player2 ($1.05 in chips)
|
||||||
|
Player6: posts small blind $0.01
|
||||||
|
Player3: posts big blind $0.02
|
||||||
|
Player0: posts big blind $0.02
|
||||||
|
*** HOLE CARDS ***
|
||||||
|
Dealt to Player1 [6d 3c 5s As]
|
||||||
|
Player2: calls $0.02
|
||||||
|
Player5: calls $0.02
|
||||||
|
Player1: calls $0.02
|
||||||
|
Player0: raises $0.06 to $0.08
|
||||||
|
Player4: calls $0.08
|
||||||
|
Player6: folds
|
||||||
|
Player3: folds
|
||||||
|
Player2: calls $0.06
|
||||||
|
Player5: calls $0.06
|
||||||
|
Player1: raises $0.06 to $0.14
|
||||||
|
Player0: raises $0.55 to $0.69
|
||||||
|
Player4: calls $0.61
|
||||||
|
Player2: raises $0.36 to $1.05 and is all-in
|
||||||
|
Player5: folds
|
||||||
|
Player1: calls $0.45 and is all-in
|
||||||
|
Player0: calls $0.21 and is all-in
|
||||||
|
Player4: calls $0.36
|
||||||
|
*** FLOP *** [6c Kc Qc]
|
||||||
|
*** TURN *** [6c Kc Qc] [Jc]
|
||||||
|
*** RIVER *** [6c Kc Qc Jc] [4c]
|
||||||
|
*** SHOW DOWN ***
|
||||||
|
Player2: shows [Js Ah 5d 9h] (a pair of Jacks)
|
||||||
|
Player4: shows [9c 9d 7d 7h] (a pair of Nines)
|
||||||
|
Player2 collected $0.29 from side pot-2
|
||||||
|
Player0: shows [Ks Ad 7s Tc] (a straight, Ten to Ace)
|
||||||
|
Player0 collected $0.88 from side pot-1
|
||||||
|
Player1: shows [6d 3c 5s As] (a pair of Sixes)
|
||||||
|
Player0 collected $2.35 from main pot
|
||||||
|
*** SUMMARY ***
|
||||||
|
Total pot $3.70 Main pot $2.35. Side pot-1 $0.88. Side pot-2 $0.29. | Rake $0.18
|
||||||
|
Board [6c Kc Qc Jc 4c]
|
||||||
|
Seat 2: Player5 folded before Flop
|
||||||
|
Seat 3: Player1 showed [6d 3c 5s As] and lost with a pair of Sixes
|
||||||
|
Seat 5: Player0 showed [Ks Ad 7s Tc] and won ($3.23) with a straight, Ten to Ace
|
||||||
|
Seat 6: Player4 (button) showed [9c 9d 7d 7h] and lost with a pair of Nines
|
||||||
|
Seat 7: Player6 (small blind) folded before Flop
|
||||||
|
Seat 8: Player3 (big blind) folded before Flop
|
||||||
|
Seat 9: Player2 showed [Js Ah 5d 9h] and won ($0.29) with a pair of Jacks
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PokerStars Game #60920749213: Omaha Pot Limit ($0.01/$0.02 USD) - 2010/06/07 20:15:29 WET [2010/06/07 15:15:29 ET]
|
||||||
|
Table '99999999I' 9-max Seat #7 is the button
|
||||||
|
Seat 2: Player5 ($0.44 in chips)
|
||||||
|
Seat 3: Player1 ($0.80 in chips)
|
||||||
|
Seat 5: Player0 ($3.23 in chips)
|
||||||
|
Seat 6: Player4 ($0.81 in chips)
|
||||||
|
Seat 7: Player6 ($2.78 in chips)
|
||||||
|
Seat 8: Player3 ($4.98 in chips)
|
||||||
|
Seat 9: Player2 ($0.29 in chips)
|
||||||
|
Player3: posts small blind $0.01
|
||||||
|
Player2: posts big blind $0.02
|
||||||
|
*** HOLE CARDS ***
|
||||||
|
Dealt to Player1 [2c 4c 3s 7c]
|
||||||
|
Player5: calls $0.02
|
||||||
|
Player1: calls $0.02
|
||||||
|
Player0: calls $0.02
|
||||||
|
Player4: folds
|
||||||
|
Player6: calls $0.02
|
||||||
|
Player3: folds
|
||||||
|
Player2: checks
|
||||||
|
*** FLOP *** [7h 8s 4s]
|
||||||
|
Player2: checks
|
||||||
|
Player5: bets $0.02
|
||||||
|
Player1: raises $0.02 to $0.04
|
||||||
|
Player0: raises $0.14 to $0.18
|
||||||
|
Player6: calls $0.18
|
||||||
|
Player2: raises $0.09 to $0.27 and is all-in
|
||||||
|
Player5: calls $0.25
|
||||||
|
Player1: raises $0.51 to $0.78 and is all-in
|
||||||
|
Player0: calls $0.60
|
||||||
|
Player6: folds
|
||||||
|
Player5: calls $0.15 and is all-in
|
||||||
|
*** TURN *** [7h 8s 4s] [2s]
|
||||||
|
*** RIVER *** [7h 8s 4s 2s] [2h]
|
||||||
|
*** SHOW DOWN ***
|
||||||
|
Player1: shows [2c 4c 3s 7c] (a full house, Deuces full of Sevens)
|
||||||
|
Player0: shows [6h 3h Tc 9c] (a pair of Deuces)
|
||||||
|
Player1 collected $0.69 from side pot-2
|
||||||
|
Player5: shows [3d 5c 8h 7s] (two pair, Eights and Sevens)
|
||||||
|
Player1 collected $0.42 from side pot-1
|
||||||
|
Player2: shows [5s 7d Kd 9h] (two pair, Sevens and Deuces)
|
||||||
|
Player1 collected $1.31 from main pot
|
||||||
|
*** SUMMARY ***
|
||||||
|
Total pot $2.54 Main pot $1.31. Side pot-1 $0.42. Side pot-2 $0.69. | Rake $0.12
|
||||||
|
Board [7h 8s 4s 2s 2h]
|
||||||
|
Seat 2: Player5 showed [3d 5c 8h 7s] and lost with two pair, Eights and Sevens
|
||||||
|
Seat 3: Player1 showed [2c 4c 3s 7c] and won ($2.42) with a full house, Deuces full of Sevens
|
||||||
|
Seat 5: Player0 showed [6h 3h Tc 9c] and lost with a pair of Deuces
|
||||||
|
Seat 6: Player4 folded before Flop (didn't bet)
|
||||||
|
Seat 7: Player6 (button) folded on the Flop
|
||||||
|
Seat 8: Player3 (small blind) folded before Flop
|
||||||
|
Seat 9: Player2 (big blind) showed [5s 7d Kd 9h] and lost with two pair, Sevens and Deuces
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
Full Tilt Poker Game #19505996411: $2 + $0.25 Sit & Go (148860619), Table 1 - 300/600 - Limit Hold'em - 18:58:46 ET - 2010/03/23
|
||||||
|
Seat 2: Player2 (7,723)
|
||||||
|
Seat 5: Player5 (3,409)
|
||||||
|
Seat 6: Player6 (50)
|
||||||
|
Seat 8: Player8 (818)
|
||||||
|
Player6 posts the small blind of 50, and is all in
|
||||||
|
Player8 posts the big blind of 300
|
||||||
|
The button is in seat #5
|
||||||
|
*** HOLE CARDS ***
|
||||||
|
Dealt to Player5 [2h 9h]
|
||||||
|
Player2 has 15 seconds left to act
|
||||||
|
Player2 calls 300
|
||||||
|
Player5 folds
|
||||||
|
Player8 checks
|
||||||
|
*** FLOP *** [2d 7s Qc]
|
||||||
|
Player8 checks
|
||||||
|
Player2 checks
|
||||||
|
*** TURN *** [2d 7s Qc] [8s]
|
||||||
|
Player8 checks
|
||||||
|
Player2 checks
|
||||||
|
*** RIVER *** [2d 7s Qc 8s] [5c]
|
||||||
|
Player8 checks
|
||||||
|
Player2 checks
|
||||||
|
*** SHOW DOWN ***
|
||||||
|
Player8 shows [Ts 4c] Queen Ten high
|
||||||
|
Player2 shows [2c As] a pair of Twos
|
||||||
|
Player2 wins the side pot (500) with a pair of Twos
|
||||||
|
Player6 shows [7c 5s] two pair, Sevens and Fives
|
||||||
|
Player6 wins the main pot (150) with two pair, Sevens and Fives
|
||||||
|
*** SUMMARY ***
|
||||||
|
Total pot 650 Main pot 150. Side pot 500. | Rake 0
|
||||||
|
Board: [2d 7s Qc 8s 5c]
|
||||||
|
Seat 2: Player2 showed [2c As] and won (500) with a pair of Twos
|
||||||
|
Seat 5: Player5 (button) didn't bet (folded)
|
||||||
|
Seat 6: Player6 (small blind) showed [7c 5s] and won (150) with two pair, Sevens and Fives
|
||||||
|
Seat 8: Player8 (big blind) showed [Ts 4c] and lost with Queen Ten high
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user