From 6443c7f1d80c130a58b11abde55894afb640b439 Mon Sep 17 00:00:00 2001 From: Mika Bostrom Date: Thu, 8 Jul 2010 11:26:16 +0300 Subject: [PATCH 01/45] Update version to 0.20 --- packaging/debian/changelog | 6 ++++++ setup.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packaging/debian/changelog b/packaging/debian/changelog index e95fd1c5..ee15782a 100644 --- a/packaging/debian/changelog +++ b/packaging/debian/changelog @@ -1,3 +1,9 @@ +free-poker-tools (0.20-1) unstable; urgency=low + + * 0.20 release + + -- Mika Bostrom Thu, 08 Jul 2010 11:25:36 +0300 + free-poker-tools (0.20~git20100630) unstable; urgency=low * Snapshot release diff --git a/setup.py b/setup.py index 46703f06..11ee46dd 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ from distutils.core import setup setup(name = 'fpdb', description = 'Free Poker Database', - version = '0.12', + version = '0.20', author = 'FPDB team', author_email = 'fpdb-main@lists.sourceforge.net', packages = ['fpdb'], From 7ed40cdb5a797c25f445d7069239cb812cbf8301 Mon Sep 17 00:00:00 2001 From: Mika Bostrom Date: Thu, 8 Jul 2010 11:27:57 +0300 Subject: [PATCH 02/45] File 'THANKS.txt' has been removed from tree --- setup.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/setup.py b/setup.py index 11ee46dd..f5865893 100644 --- a/setup.py +++ b/setup.py @@ -27,8 +27,6 @@ setup(name = 'fpdb', packages = ['fpdb'], package_dir = { 'fpdb' : 'pyfpdb' }, data_files = [ - ('/usr/share/doc/python-fpdb', - ['THANKS.txt']), ('/usr/share/pixmaps', ['gfx/fpdb-icon.png', 'gfx/fpdb-icon2.png', 'gfx/fpdb-cards.png' From 701a30249aa71f518f7997d7a68a7fbf79dcc6fe Mon Sep 17 00:00:00 2001 From: Mika Bostrom Date: Thu, 8 Jul 2010 21:29:18 +0300 Subject: [PATCH 03/45] Ubuntu/Debian do not have pythonX symlinks --- pyfpdb/HUD_main.pyw | 2 +- pyfpdb/fpdb.pyw | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyfpdb/HUD_main.pyw b/pyfpdb/HUD_main.pyw index e1704d29..e42f0eb2 100755 --- a/pyfpdb/HUD_main.pyw +++ b/pyfpdb/HUD_main.pyw @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2008-2010, Ray E. Barker diff --git a/pyfpdb/fpdb.pyw b/pyfpdb/fpdb.pyw index debbaefc..c1b215db 100755 --- a/pyfpdb/fpdb.pyw +++ b/pyfpdb/fpdb.pyw @@ -1,4 +1,4 @@ -#!/usr/bin/python2 +#!/usr/bin/python # -*- coding: utf-8 -*- #Copyright 2008-2010 Steffen Schaumburg From 2808f71f7e71c5c00add386ebbab31980b023fa9 Mon Sep 17 00:00:00 2001 From: Mika Bostrom Date: Thu, 8 Jul 2010 21:32:57 +0300 Subject: [PATCH 04/45] Bump changelog and version for new upload --- packaging/debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packaging/debian/changelog b/packaging/debian/changelog index ee15782a..ed531b28 100644 --- a/packaging/debian/changelog +++ b/packaging/debian/changelog @@ -1,3 +1,10 @@ +free-poker-tools (0.20-2) unstable; urgency=low + + * Fix executable script shebangs: there is no /usr/bin/python2 (nor + /usr/bin/python3) symlink on Debian or Ubuntu + + -- Mika Bostrom Thu, 08 Jul 2010 21:29:40 +0300 + free-poker-tools (0.20-1) unstable; urgency=low * 0.20 release From 19d400c0b16f8c7b04866c0242f3925273906c50 Mon Sep 17 00:00:00 2001 From: Mika Bostrom Date: Thu, 22 Jul 2010 08:48:05 +0300 Subject: [PATCH 05/45] Update changelog, release version --- packaging/debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packaging/debian/changelog b/packaging/debian/changelog index ee15782a..a514f898 100644 --- a/packaging/debian/changelog +++ b/packaging/debian/changelog @@ -1,3 +1,9 @@ +free-poker-tools (0.20.1-1) unstable; urgency=low + + * 0.20.1 release + + -- Mika Bostrom Thu, 22 Jul 2010 08:47:39 +0300 + free-poker-tools (0.20-1) unstable; urgency=low * 0.20 release From 9eba555fe560dbd68935852e886ce27b8e311cf2 Mon Sep 17 00:00:00 2001 From: Mika Bostrom Date: Thu, 22 Jul 2010 23:33:34 +0300 Subject: [PATCH 06/45] Update changelog and version for snapshot --- packaging/debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packaging/debian/changelog b/packaging/debian/changelog index ca10f44a..acf61306 100644 --- a/packaging/debian/changelog +++ b/packaging/debian/changelog @@ -1,3 +1,9 @@ +free-poker-tools (0.20.901-1) unstable; urgency=low + + * Snapshot release before oncoming 0.21 + + -- Mika Bostrom Thu, 22 Jul 2010 23:32:47 +0300 + free-poker-tools (0.20.1-1) unstable; urgency=low * 0.20.1 release From 3759af49023b1b956bb2273b1a0a55ff088acc01 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Thu, 22 Jul 2010 22:59:53 +0200 Subject: [PATCH 07/45] GUI: update version indicator to include "plus git" again --- pyfpdb/fpdb.pyw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/fpdb.pyw b/pyfpdb/fpdb.pyw index a51ef932..67262ba7 100755 --- a/pyfpdb/fpdb.pyw +++ b/pyfpdb/fpdb.pyw @@ -117,7 +117,7 @@ import Configuration import Exceptions import Stats -VERSION = "0.20.901" +VERSION = "0.20.901 plus git" class fpdb: From de8b9e89c54ba02f5ab0a1bbb37941d3761a4d1e Mon Sep 17 00:00:00 2001 From: steffen123 Date: Fri, 23 Jul 2010 02:07:49 +0200 Subject: [PATCH 08/45] FTP: fix import --- pyfpdb/FulltiltToFpdb.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyfpdb/FulltiltToFpdb.py b/pyfpdb/FulltiltToFpdb.py index 290f2f42..93b6fe00 100755 --- a/pyfpdb/FulltiltToFpdb.py +++ b/pyfpdb/FulltiltToFpdb.py @@ -203,9 +203,9 @@ class Fulltilt(HandHistoryConverter): hand.tablename = m.group('TABLE') try: - 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") except: - hand.starttime = datetime.datetime.strptime(m.group('DATETIME'), "%H:%M ET - %a, %B %d, %Y") + hand.startTime = datetime.datetime.strptime(m.group('DATETIME'), "%H:%M ET - %a, %B %d, %Y") hand.startTime = HandHistoryConverter.changeTimezone(hand.startTime, "ET", "UTC") From a2243c854202cd117a491f937f445780df3607fd Mon Sep 17 00:00:00 2001 From: steffen123 Date: Fri, 23 Jul 2010 03:55:45 +0200 Subject: [PATCH 09/45] EVERLEAF: remove comment about converting to ET - we do not want to do that! --- pyfpdb/EverleafToFpdb.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pyfpdb/EverleafToFpdb.py b/pyfpdb/EverleafToFpdb.py index b16980ed..32b22a93 100755 --- a/pyfpdb/EverleafToFpdb.py +++ b/pyfpdb/EverleafToFpdb.py @@ -152,7 +152,6 @@ or None if we fail to get the info """ # or : 2008/11/07 12:38:49 ET # Not getting it in my HH files yet, so using # 2008/11/10 3:58:52 ET - #TODO: Do conversion from GMT to ET #TODO: Need some date functions to convert to different timezones (Date::Manip for perl rocked for this) hand.startTime = datetime.datetime.strptime(m.group('DATETIME'), "%Y/%m/%d - %H:%M:%S") return From 7f25cf6da89ebe3f007b8a132574673dda303c1c Mon Sep 17 00:00:00 2001 From: steffen123 Date: Fri, 23 Jul 2010 04:00:25 +0200 Subject: [PATCH 10/45] DB: allow NULL for TT.currency/buyin/fee for when this info is not available --- pyfpdb/Database.py | 2 +- pyfpdb/SQL.py | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index c0115bd9..028097dd 100644 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -74,7 +74,7 @@ except ImportError: use_numpy = False -DB_VERSION = 137 +DB_VERSION = 138 # Variance created as sqlite has a bunch of undefined aggregate functions. diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index 041ae981..4a0bde21 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -392,9 +392,9 @@ class Sql: self.query['createTourneyTypesTable'] = """CREATE TABLE TourneyTypes ( id SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL, PRIMARY KEY (id), siteId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (siteId) REFERENCES Sites(id), - currency varchar(4) NOT NULL, - buyIn INT NOT NULL, - fee INT NOT NULL, + currency varchar(4), + buyIn INT, + fee INT, category varchar(9) NOT NULL, limitType char(2) NOT NULL, buyInChips INT, @@ -423,9 +423,9 @@ class Sql: self.query['createTourneyTypesTable'] = """CREATE TABLE TourneyTypes ( id SERIAL, PRIMARY KEY (id), siteId INT NOT NULL, FOREIGN KEY (siteId) REFERENCES Sites(id), - currency varchar(4) NOT NULL, - buyin INT NOT NULL, - fee INT NOT NULL, + currency varchar(4), + buyin INT, + fee INT, category varchar(9), limitType char(2), buyInChips INT, @@ -453,9 +453,9 @@ class Sql: self.query['createTourneyTypesTable'] = """CREATE TABLE TourneyTypes ( id INTEGER PRIMARY KEY, siteId INT NOT NULL, - currency VARCHAR(4) NOT NULL, - buyin INT NOT NULL, - fee INT NOT NULL, + currency VARCHAR(4), + buyin INT, + fee INT, category TEXT, limitType TEXT, buyInChips INT, From 1f933563ee05422f3e42eaae67c65acda2fee532 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Fri, 23 Jul 2010 04:03:35 +0200 Subject: [PATCH 11/45] EVERLEAF: add comment where to get tourney info --- pyfpdb/EverleafToFpdb.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyfpdb/EverleafToFpdb.py b/pyfpdb/EverleafToFpdb.py index 32b22a93..a069d89c 100755 --- a/pyfpdb/EverleafToFpdb.py +++ b/pyfpdb/EverleafToFpdb.py @@ -146,6 +146,8 @@ or None if we fail to get the info """ tourno = t.group('TOURNO') hand.tourNo = tourno hand.tablename = t.group('TABLE') + #TODO we should fetch info including buyincurrency, buyin and fee from URL: + # https://www.poker4ever.com/tourney/%TOURNEY_NUMBER% # Believe Everleaf time is GMT/UTC, no transation necessary # Stars format (Nov 10 2008): 2008/11/07 12:38:49 CET [2008/11/07 7:38:49 ET] From 71df9b06ddd2cb174cea5cf13142a7392663cf4c Mon Sep 17 00:00:00 2001 From: steffen123 Date: Fri, 23 Jul 2010 04:45:57 +0200 Subject: [PATCH 12/45] HUD: make it work again after my previous overzealous removal of HP.TTid --- pyfpdb/DerivedStats.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyfpdb/DerivedStats.py b/pyfpdb/DerivedStats.py index f0f1f834..7aab6c98 100644 --- a/pyfpdb/DerivedStats.py +++ b/pyfpdb/DerivedStats.py @@ -59,6 +59,7 @@ class DerivedStats(): self.handsplayers[player[1]]['foldSbToStealChance'] = False self.handsplayers[player[1]]['foldedSbToSteal'] = False self.handsplayers[player[1]]['foldedBbToSteal'] = False + self.handsplayers[player[1]]['tourneyTypeId'] = None for i in range(5): self.handsplayers[player[1]]['street%dCalls' % i] = 0 @@ -142,6 +143,7 @@ class DerivedStats(): self.handsplayers[player[1]]['startCash'] = int(100 * Decimal(player[2])) self.handsplayers[player[1]]['sitout'] = False #TODO: implement actual sitout detection if hand.gametype["type"]=="tour": + self.handsplayers[player[1]]['tourneyTypeId']=hand.tourneyTypeId self.handsplayers[player[1]]['tourneysPlayersIds'] = hand.tourneysPlayersIds[player[1]] else: self.handsplayers[player[1]]['tourneysPlayersIds'] = None From ff835a0427ba1173214a6f872eddbfda5a19af57 Mon Sep 17 00:00:00 2001 From: Mika Bostrom Date: Sat, 24 Jul 2010 09:06:40 +0300 Subject: [PATCH 13/45] Update changelog for 0.20.902 snapshot --- packaging/debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packaging/debian/changelog b/packaging/debian/changelog index acf61306..0616ad0e 100644 --- a/packaging/debian/changelog +++ b/packaging/debian/changelog @@ -1,3 +1,9 @@ +free-poker-tools (0.20.902-1) unstable; urgency=low + + * New snapshot release; .901 was broken for FTP + + -- Mika Bostrom Sat, 24 Jul 2010 09:05:57 +0300 + free-poker-tools (0.20.901-1) unstable; urgency=low * Snapshot release before oncoming 0.21 From 5b432bcd9962c48850b8270f9398d5ab0661fe87 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Tue, 27 Jul 2010 15:48:19 +0200 Subject: [PATCH 14/45] GUI: remove obselete and broken table viewer --- pyfpdb/GuiTableViewer.py | 290 --------------------------------------- pyfpdb/fpdb.pyw | 10 -- 2 files changed, 300 deletions(-) delete mode 100644 pyfpdb/GuiTableViewer.py diff --git a/pyfpdb/GuiTableViewer.py b/pyfpdb/GuiTableViewer.py deleted file mode 100644 index 8086c0a0..00000000 --- a/pyfpdb/GuiTableViewer.py +++ /dev/null @@ -1,290 +0,0 @@ -#!/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 . -#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 fpdb_import -from Exceptions import * - - -class GuiTableViewer (threading.Thread): - def hudDivide (self, a, b): - if b==0: - return "n/a" - else: - return str(int((a/float(b))*100))+"%" - #end def hudDivide - - def browse_clicked(self, widget, data): - """runs when user clicks browse on tv tab""" - #print "start of table_viewer.browser_clicked" - current_path=self.filename_tbuffer.get_text(self.filename_tbuffer.get_start_iter(), self.filename_tbuffer.get_end_iter()) - - dia_chooser = gtk.FileChooserDialog(title="Please choose the file for which you want to open the Table Viewer", - action=gtk.FILE_CHOOSER_ACTION_OPEN, - buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK)) - #dia_chooser.set_current_folder(pathname) - dia_chooser.set_filename(current_path) - #dia_chooser.set_select_multiple(select_multiple) #not in tv, but want this in bulk import - - response = dia_chooser.run() - if response == gtk.RESPONSE_OK: - #print dia_chooser.get_filename(), 'selected' - self.filename_tbuffer.set_text(dia_chooser.get_filename()) - elif response == gtk.RESPONSE_CANCEL: - print 'Closed, no files selected' - dia_chooser.destroy() - #end def table_viewer.browse_clicked - - def prepare_data(self): - """prepares the data for display by refresh_clicked, returns a 2D array""" - #print "start of prepare_data" - arr=[] - #first prepare the header row - if (self.category=="holdem" or self.category=="omahahi" or self.category=="omahahilo"): - tmp=("Name", "HDs", "VPIP", "PFR", "PF3B", "ST") - - tmp+=("FS", "FB") - - tmp+=("CB", ) - - tmp+=("2B", "3B") - - tmp+=("AF", "FF", "AT", "FT", "AR", "FR") - - tmp+=("WtSD", "W$wsF", "W$SD") - else: - raise FpdbError("reimplement stud") - arr.append(tmp) - - #then the data rows - for player in range(len(self.player_names)): - tmp=[] - p_name = Charset.to_gui(self.player_names[player][0]) - tmp.append(p_name) - - seatCount=len(self.player_names) - if seatCount>=8: - minSeats,maxSeats=7,10 - elif seatCount==7: - minSeats,maxSeats=6,10 - elif seatCount==6 or seatCount==5: - minSeats,maxSeats=seatCount-1,seatCount+1 - elif seatCount==4: - minSeats,maxSeats=4,5 - elif seatCount==2 or seatCount==3: - minSeats,maxSeats=seatCount,seatCount - else: - FpdbError("invalid seatCount") - - self.cursor.execute("SELECT * FROM HudCache WHERE gametypeId=%s AND playerId=%s AND activeSeats>=%s AND activeSeats<=%s", (self.gametype_id, self.player_ids[player][0], minSeats, maxSeats)) - rows=self.cursor.fetchall() - - row=[] - for field_no in range(len(rows[0])): - row.append(rows[0][field_no]) - - for row_no in range(len(rows)): - if row_no==0: - pass - else: - for field_no in range(len(rows[row_no])): - if field_no<=3: - pass - else: - #print "in prep data, row_no:",row_no,"field_no:",field_no - row[field_no]+=rows[row_no][field_no] - - tmp.append(str(row[6]))#Hands - tmp.append(self.hudDivide(row[7],row[6])) #VPIP - tmp.append(self.hudDivide(row[8],row[6])) #PFR - tmp.append(self.hudDivide(row[10],row[9])+" ("+str(row[9])+")") #PF3B - - tmp.append(self.hudDivide(row[31],row[30])+" ("+str(row[30])+")") #ST - - tmp.append(self.hudDivide(row[35],row[34])+" ("+str(row[34])+")") #FS - tmp.append(self.hudDivide(row[33],row[32])+" ("+str(row[32])+")") #FB - - tmp.append(self.hudDivide(row[37],row[36])+" ("+str(row[36])+")") #CB - - tmp.append(self.hudDivide(row[39],row[38])+" ("+str(row[38])+")") #2B - tmp.append(self.hudDivide(row[41],row[40])+" ("+str(row[40])+")") #3B - - tmp.append(self.hudDivide(row[16],row[11])+" ("+str(row[11])+")") #AF - tmp.append(self.hudDivide(row[24],row[20])+" ("+str(row[20])+")") #FF - tmp.append(self.hudDivide(row[17],row[12])+" ("+str(row[12])+")") #AT - tmp.append(self.hudDivide(row[25],row[21])+" ("+str(row[21])+")") #FT - tmp.append(self.hudDivide(row[18],row[13])+" ("+str(row[13])+")") #AR - tmp.append(self.hudDivide(row[26],row[22])+" ("+str(row[22])+")") #FR - - tmp.append(self.hudDivide(row[15],row[11])) #WtSD - tmp.append(self.hudDivide(row[28],row[11])) #W$wSF - tmp.append(self.hudDivide(row[29],row[15])+" ("+str(row[15])+")") #W$@SD - - arr.append(tmp) - return arr - #end def table_viewer.prepare_data - - def refresh_clicked(self, widget, data): - """runs when user clicks refresh""" - #print "start of table_viewer.refresh_clicked" - arr=self.prepare_data() - - try: self.data_table.destroy() - except AttributeError: pass - self.data_table=gtk.Table(rows=len(arr), columns=len(arr[0]), homogeneous=False) - self.main_vbox.pack_start(self.data_table) - self.data_table.show() - - for row in range(len(arr)): - for column in range (len(arr[row])): - eventBox=gtk.EventBox() - new_label=gtk.Label(arr[row][column]) - if row%2==0: # - bg_col="white" - if column==0 or (column>=5 and column<=10): - bg_col="lightgrey" - else: - bg_col="lightgrey" - if column==0 or (column>=5 and column<=10): - bg_col="grey" - #style = eventBox.get_style() - #style.font.height=8 - #eventBox.set_style(style) - - eventBox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bg_col)) - eventBox.add(new_label) - self.data_table.attach(child=eventBox, left_attach=column, right_attach=column+1, top_attach=row, bottom_attach=row+1) - eventBox.show() - new_label.show() - #end def table_viewer.refresh_clicked - - def read_names_clicked(self, widget, data): - """runs when user clicks read names""" - #print "start of table_viewer.read_names_clicked" - self.db.reconnect() - self.cursor=self.db.get_cursor() - #self.hands_id=self.last_read_hand_id - - self.cursor.execute("SELECT gametypeId FROM Hands WHERE id=%s", (self.hands_id, )) - self.gametype_id=self.cursor.fetchone()[0] - self.cursor.execute("SELECT category FROM Gametypes WHERE id=%s", (self.gametype_id, )) - self.category=self.cursor.fetchone()[0] - #print "self.gametype_id", self.gametype_id," category:", self.category, " self.hands_id:", self.hands_id - - self.cursor.execute("""SELECT DISTINCT Players.id FROM HandsPlayers - INNER JOIN Players ON HandsPlayers.playerId=Players.id - WHERE handId=%s""", (self.hands_id, )) - self.player_ids=self.cursor.fetchall() - #print "self.player_ids:",self.player_ids - - self.cursor.execute("""SELECT DISTINCT Players.name FROM HandsPlayers - INNER JOIN Players ON HandsPlayers.playerId=Players.id - WHERE handId=%s""", (self.hands_id, )) - self.player_names=self.cursor.fetchall() - #print "self.player_names:",self.player_names - #end def table_viewer.read_names_clicked - - def import_clicked(self, widget, data): - """runs when user clicks import""" - #print "start of table_viewer.import_clicked" - self.inputFile=self.filename_tbuffer.get_text(self.filename_tbuffer.get_start_iter(), self.filename_tbuffer.get_end_iter()) - - self.importer = fpdb_import.Importer(self, self.settings, self.config) - self.importer.setMinPrint(0) - self.importer.setQuiet(False) - self.importer.setFailOnError(False) - self.importer.setHandCount(0) - - self.importer.addImportFile(self.inputFile) - self.importer.runImport() - self.hands_id=self.importer.handsId - #end def table_viewer.import_clicked - - def all_clicked(self, widget, data): - """runs when user clicks all""" - #print "start of table_viewer.all_clicked" - self.import_clicked(widget, data) - self.read_names_clicked(widget, data) - self.refresh_clicked(widget, data) - #end def table_viewer.all_clicked - - def get_vbox(self): - """returns the vbox of this thread""" - return self.main_vbox - #end def get_vbox - - def __init__(self, db, settings, config=None, debug=True): - """Constructor for table_viewer""" - self.debug=debug - #print "start of table_viewer constructor" - self.db = db - self.cursor = db.get_cursor() - self.settings = settings - self.config = config - - self.main_vbox = gtk.VBox(False, 0) - self.main_vbox.show() - - self.settings_hbox = gtk.HBox(False, 0) - self.main_vbox.pack_end(self.settings_hbox, False, True, 0) - self.settings_hbox.show() - - self.filename_label = gtk.Label("Path of history file") - self.settings_hbox.pack_start(self.filename_label, False, False) - self.filename_label.show() - - self.filename_tbuffer=gtk.TextBuffer() - self.filename_tbuffer.set_text(self.settings['hud-defaultPath']) - self.filename_tview=gtk.TextView(self.filename_tbuffer) - self.settings_hbox.pack_start(self.filename_tview, True, True, padding=5) - self.filename_tview.show() - - self.browse_button=gtk.Button("Browse...") - self.browse_button.connect("clicked", self.browse_clicked, "Browse clicked") - self.settings_hbox.pack_start(self.browse_button, False, False) - self.browse_button.show() - - - self.button_hbox = gtk.HBox(False, 0) - self.main_vbox.pack_end(self.button_hbox, False, True, 0) - self.button_hbox.show() - - #self.import_button = gtk.Button("Import") - #self.import_button.connect("clicked", self.import_clicked, "Import clicked") - #self.button_hbox.add(self.import_button) - #self.import_button.show() - - #self.read_names_button = gtk.Button("Read Names") - #self.read_names_button.connect("clicked", self.read_names_clicked, "Read clicked") - #self.button_hbox.add(self.read_names_button) - #self.read_names_button.show() - - #self.refresh_button = gtk.Button("Show/Refresh data") - #self.refresh_button.connect("clicked", self.refresh_clicked, "Refresh clicked") - #self.button_hbox.add(self.refresh_button) - #self.refresh_button.show() - - self.all_button = gtk.Button("Import&Read&Refresh") - self.all_button.connect("clicked", self.all_clicked, "All clicked") - self.button_hbox.add(self.all_button) - self.all_button.show() - #end of table_viewer.__init__ diff --git a/pyfpdb/fpdb.pyw b/pyfpdb/fpdb.pyw index 67262ba7..85519afc 100755 --- a/pyfpdb/fpdb.pyw +++ b/pyfpdb/fpdb.pyw @@ -107,7 +107,6 @@ import ImapFetcher import GuiRingPlayerStats import GuiTourneyPlayerStats import GuiPositionalStats -import GuiTableViewer import GuiAutoImport import GuiGraphViewer import GuiSessionViewer @@ -798,7 +797,6 @@ class fpdb: - @@ -839,7 +837,6 @@ class fpdb: ('tourneyplayerstats', None, '_Tourney Player Stats (tabulated view, mysql only)', 'T', 'Tourney Player Stats (tabulated view, mysql only)', self.tab_tourney_player_stats), ('posnstats', None, 'P_ositional Stats (tabulated view)', 'O', 'Positional Stats (tabulated view)', self.tab_positional_stats), ('sessionstats', None, 'Session Stats', None, 'Session Stats', self.tab_session_stats), - ('tableviewer', None, 'Poker_table Viewer (mostly obselete)', None, 'Poker_table Viewer (mostly obselete)', self.tab_table_viewer), ('database', None, '_Database'), ('maintaindbs', None, '_Maintain Databases', None, 'Maintain Databases', self.dia_maintain_dbs), ('createtabs', None, 'Create or Recreate _Tables', None, 'Create or Recreate Tables ', self.dia_recreate_tables), @@ -1068,13 +1065,6 @@ This program is free/libre open source software licensed partially under the AGP 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") - def tab_table_viewer(self, widget, data=None): - """opens a table viewer tab""" - new_tv_thread = GuiTableViewer.GuiTableViewer(self.db, self.settings, self.config) - self.threads.append(new_tv_thread) - tv_tab = new_tv_thread.get_vbox() - self.add_and_display_tab(tv_tab, "Table Viewer") - def tabGraphViewer(self, widget, data=None): """opens a graph viewer tab""" new_gv_thread = GuiGraphViewer.GuiGraphViewer(self.sql, self.config, self.window) From e0b194ddf052ff9fc00209d1feae7bb3eb2bc7c1 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Tue, 27 Jul 2010 17:43:47 +0200 Subject: [PATCH 15/45] minor cleanup --- pyfpdb/SQL.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index 4a0bde21..59fa4378 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -2444,6 +2444,8 @@ class Sql: ) hprof2 on hprof2.gtId = stats.gtId order by stats.category, stats.limittype, stats.bigBlindDesc desc """ + #elif db_server == 'sqlite': #TODO + # self.query['playerStats'] = """ """ else: # assume postgres self.query['playerStats'] = """ SELECT upper(stats.limitType) || ' ' @@ -2547,8 +2549,6 @@ class Sql: ) hprof2 on hprof2.gtId = stats.gtId order by stats.base, stats.limittype, stats.bigBlindDesc desc """ - #elif db_server == 'sqlite': - # self.query['playerStats'] = """ """ if db_server == 'mysql': self.query['playerStatsByPosition'] = """ From 20ebd040c12e43b21b766e18677faf958fff63a8 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Tue, 27 Jul 2010 18:16:46 +0200 Subject: [PATCH 16/45] remove some methods in TourneyFilters that are identical in Filters --- pyfpdb/TourneyFilters.py | 104 --------------------------------------- 1 file changed, 104 deletions(-) diff --git a/pyfpdb/TourneyFilters.py b/pyfpdb/TourneyFilters.py index 977c94ec..84f23e64 100644 --- a/pyfpdb/TourneyFilters.py +++ b/pyfpdb/TourneyFilters.py @@ -63,54 +63,6 @@ class TourneyFilters(Filters.Filters): 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() @@ -200,54 +152,6 @@ class TourneyFilters(Filters.Filters): 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) @@ -376,14 +280,6 @@ class TourneyFilters(Filters.Filters): 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 From c996a11ed6dbf129e1999f0d1602e8b193aaf746 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Tue, 27 Jul 2010 18:17:25 +0200 Subject: [PATCH 17/45] move method from TourneyFilters to Filters --- pyfpdb/Filters.py | 4 ++++ pyfpdb/TourneyFilters.py | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pyfpdb/Filters.py b/pyfpdb/Filters.py index 06f43610..d6a78949 100644 --- a/pyfpdb/Filters.py +++ b/pyfpdb/Filters.py @@ -229,6 +229,10 @@ class Filters(threading.Thread): return self.numHands #end def getNumHands + def getNumTourneys(self): + return self.numTourneys + #end def getNumTourneys + def getSites(self): return self.sites #end def getSites diff --git a/pyfpdb/TourneyFilters.py b/pyfpdb/TourneyFilters.py index 84f23e64..7415a9d3 100644 --- a/pyfpdb/TourneyFilters.py +++ b/pyfpdb/TourneyFilters.py @@ -280,10 +280,6 @@ class TourneyFilters(Filters.Filters): log.info("No tourney types returned from database") #end def fillTourneyTypesFrame - 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() From 84df9ad56710f5331224bb5d630c37784393ec2f Mon Sep 17 00:00:00 2001 From: steffen123 Date: Tue, 27 Jul 2010 18:21:43 +0200 Subject: [PATCH 18/45] remove more duplicate methods from TourneyFilters --- pyfpdb/TourneyFilters.py | 62 ---------------------------------------- 1 file changed, 62 deletions(-) diff --git a/pyfpdb/TourneyFilters.py b/pyfpdb/TourneyFilters.py index 7415a9d3..4ff57897 100644 --- a/pyfpdb/TourneyFilters.py +++ b/pyfpdb/TourneyFilters.py @@ -138,13 +138,6 @@ class TourneyFilters(Filters.Filters): 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) @@ -195,40 +188,6 @@ class TourneyFilters(Filters.Filters): 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() @@ -280,31 +239,10 @@ class TourneyFilters(Filters.Filters): log.info("No tourney types returned from database") #end def fillTourneyTypesFrame - 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 = {} From 9006a7f45bff4b62c19a490f0ba7106f32238075 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Tue, 27 Jul 2010 18:24:07 +0200 Subject: [PATCH 19/45] remove another dupe method from TourneyFilters --- pyfpdb/Filters.py | 1 + pyfpdb/TourneyFilters.py | 25 ------------------------- 2 files changed, 1 insertion(+), 25 deletions(-) diff --git a/pyfpdb/Filters.py b/pyfpdb/Filters.py index d6a78949..fa0a504b 100644 --- a/pyfpdb/Filters.py +++ b/pyfpdb/Filters.py @@ -587,6 +587,7 @@ class Filters(threading.Thread): # self.siteid[site] = result[0][0] #else: # print "Either 0 or more than one site matched - EEK" + #end def fillSitesFrame def fillGamesFrame(self, vbox): top_hbox = gtk.HBox(False, 0) diff --git a/pyfpdb/TourneyFilters.py b/pyfpdb/TourneyFilters.py index 4ff57897..6c103dc8 100644 --- a/pyfpdb/TourneyFilters.py +++ b/pyfpdb/TourneyFilters.py @@ -188,31 +188,6 @@ class TourneyFilters(Filters.Filters): top_hbox.pack_start(showb, expand=False, padding=1) #end def fillPlayerFrame - 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) From 90c81cb4eeea806afc29ca31dd448dd65dee968f Mon Sep 17 00:00:00 2001 From: steffen123 Date: Tue, 27 Jul 2010 18:25:27 +0200 Subject: [PATCH 20/45] move method from TF to F --- pyfpdb/Filters.py | 5 +++++ pyfpdb/TourneyFilters.py | 4 ---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pyfpdb/Filters.py b/pyfpdb/Filters.py index fa0a504b..35ab96c3 100644 --- a/pyfpdb/Filters.py +++ b/pyfpdb/Filters.py @@ -237,8 +237,13 @@ class Filters(threading.Thread): return self.sites #end def getSites + def getTourneyTypes(self): + return self.tourneyTypes + #end def getTourneyTypes + def getGames(self): return self.games + #end def getGames def getSiteIds(self): return self.siteid diff --git a/pyfpdb/TourneyFilters.py b/pyfpdb/TourneyFilters.py index 6c103dc8..313a05fa 100644 --- a/pyfpdb/TourneyFilters.py +++ b/pyfpdb/TourneyFilters.py @@ -214,10 +214,6 @@ class TourneyFilters(Filters.Filters): log.info("No tourney types returned from database") #end def fillTourneyTypesFrame - def getTourneyTypes(self): - return self.tourneyTypes - #end def getTourneyTypes - def make_filter(self): self.tourneyTypes = {} #self.tourneys = {} From 9781cd1d87eb8886de834e41f7fc5489b188f798 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Tue, 27 Jul 2010 18:31:35 +0200 Subject: [PATCH 21/45] yet more dupe removal from TourneyFilters --- pyfpdb/TourneyFilters.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/pyfpdb/TourneyFilters.py b/pyfpdb/TourneyFilters.py index 313a05fa..0de12a5f 100644 --- a/pyfpdb/TourneyFilters.py +++ b/pyfpdb/TourneyFilters.py @@ -327,15 +327,4 @@ class TourneyFilters(Filters.Filters): # 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 From c5ae1e785b5a8976ed0d693121663c557d82aba3 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Tue, 27 Jul 2010 18:33:01 +0200 Subject: [PATCH 22/45] remove another method from TF - this was only an almost-dupe --- pyfpdb/Filters.py | 1 + pyfpdb/TourneyFilters.py | 26 -------------------------- 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/pyfpdb/Filters.py b/pyfpdb/Filters.py index 35ab96c3..dffcaa53 100644 --- a/pyfpdb/Filters.py +++ b/pyfpdb/Filters.py @@ -325,6 +325,7 @@ class Filters(threading.Thread): liststore.append(_nt) self.__set_hero_name(pname, site) + #end def createPlayerLine def __set_hero_name(self, w, site): _name = w.get_text() diff --git a/pyfpdb/TourneyFilters.py b/pyfpdb/TourneyFilters.py index 0de12a5f..5c6a144f 100644 --- a/pyfpdb/TourneyFilters.py +++ b/pyfpdb/TourneyFilters.py @@ -112,32 +112,6 @@ class TourneyFilters(Filters.Filters): 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 createTourneyTypeLine(self, hbox, tourneyType): cb = gtk.CheckButton(str(tourneyType)) cb.connect('clicked', self.__set_tourney_type_select, tourneyType) From e006db3a2dc77063435045f6fe6ca5f8b6ac6b02 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Tue, 27 Jul 2010 18:35:38 +0200 Subject: [PATCH 23/45] move 2 more methods from TourneyFilters to Filters --- pyfpdb/Filters.py | 14 ++++++++++++++ pyfpdb/TourneyFilters.py | 13 ------------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/pyfpdb/Filters.py b/pyfpdb/Filters.py index dffcaa53..f282baa6 100644 --- a/pyfpdb/Filters.py +++ b/pyfpdb/Filters.py @@ -348,6 +348,20 @@ class Filters(threading.Thread): cb.connect('clicked', self.__set_site_select, site) cb.set_active(True) hbox.pack_start(cb, False, False, 0) + #end def createSiteLine + + 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 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 createGameLine(self, hbox, game): cb = gtk.CheckButton(game) diff --git a/pyfpdb/TourneyFilters.py b/pyfpdb/TourneyFilters.py index 5c6a144f..3a8fa542 100644 --- a/pyfpdb/TourneyFilters.py +++ b/pyfpdb/TourneyFilters.py @@ -97,12 +97,6 @@ class TourneyFilters(Filters.Filters): 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() @@ -112,13 +106,6 @@ class TourneyFilters(Filters.Filters): widget.set_label("hide") #end def __toggle_box - 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 fillPlayerFrame(self, vbox, display): top_hbox = gtk.HBox(False, 0) vbox.pack_start(top_hbox, False, False, 0) From fd4e421ca38134fa4077d062ccbda29e503f64d9 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Tue, 27 Jul 2010 18:41:51 +0200 Subject: [PATCH 24/45] remove another dupe from TourneyFilters --- pyfpdb/Filters.py | 1 + pyfpdb/TourneyFilters.py | 10 +--------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/pyfpdb/Filters.py b/pyfpdb/Filters.py index f282baa6..e1d876d4 100644 --- a/pyfpdb/Filters.py +++ b/pyfpdb/Filters.py @@ -884,6 +884,7 @@ class Filters(threading.Thread): for w in self.mainVBox.get_children(): w.destroy() self.make_filter() + #end def __refresh def __toggle_box(self, widget, entry): if self.boxes[entry].props.visible: diff --git a/pyfpdb/TourneyFilters.py b/pyfpdb/TourneyFilters.py index 3a8fa542..d2bce0ab 100644 --- a/pyfpdb/TourneyFilters.py +++ b/pyfpdb/TourneyFilters.py @@ -63,20 +63,12 @@ class TourneyFilters(Filters.Filters): self.make_filter() #end def __init__ - def __refresh(self, widget, entry): + def __refresh(self, widget, entry): #identical with Filters 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()) From 31aa76abc968a62ab3046f48bf9c60d65617dbfd Mon Sep 17 00:00:00 2001 From: steffen123 Date: Tue, 27 Jul 2010 18:44:06 +0200 Subject: [PATCH 25/45] and another dupe from TourneyFilters.. --- pyfpdb/Filters.py | 1 + pyfpdb/TourneyFilters.py | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/pyfpdb/Filters.py b/pyfpdb/Filters.py index e1d876d4..f743625e 100644 --- a/pyfpdb/Filters.py +++ b/pyfpdb/Filters.py @@ -529,6 +529,7 @@ class Filters(threading.Thread): #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_group_select(self, w, group): #print "__set_seat_select: seat =", seat, "active =", w.get_active() diff --git a/pyfpdb/TourneyFilters.py b/pyfpdb/TourneyFilters.py index d2bce0ab..39db47ad 100644 --- a/pyfpdb/TourneyFilters.py +++ b/pyfpdb/TourneyFilters.py @@ -77,12 +77,6 @@ class TourneyFilters(Filters.Filters): 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() From 3f4c5d45e8e1b2691ee72600f37488fe5c520621 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Tue, 27 Jul 2010 18:54:40 +0200 Subject: [PATCH 26/45] for fear of repeating myself, removed another dupe from TourneyFilters --- pyfpdb/Filters.py | 1 + pyfpdb/TourneyFilters.py | 8 +------- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/pyfpdb/Filters.py b/pyfpdb/Filters.py index f743625e..045d8f42 100644 --- a/pyfpdb/Filters.py +++ b/pyfpdb/Filters.py @@ -381,6 +381,7 @@ class Filters(threading.Thread): #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_game_select(self, w, game): #print w.get_active() diff --git a/pyfpdb/TourneyFilters.py b/pyfpdb/TourneyFilters.py index 39db47ad..dd639150 100644 --- a/pyfpdb/TourneyFilters.py +++ b/pyfpdb/TourneyFilters.py @@ -77,13 +77,7 @@ class TourneyFilters(Filters.Filters): print "setting numTourneys:", self.numTourneys #end def __set_num_tourneys - 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 __toggle_box(self, widget, entry): + def __toggle_box(self, widget, entry): #identical with Filters if self.boxes[entry].props.visible: self.boxes[entry].hide() widget.set_label("show") From 0266a707ac6e1a5a30f71c17caaabce905dd41b7 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Tue, 27 Jul 2010 19:07:14 +0200 Subject: [PATCH 27/45] move method from TourneyFilters to Filters --- pyfpdb/Filters.py | 26 ++++++++++++++++++++++++++ pyfpdb/TourneyFilters.py | 26 -------------------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/pyfpdb/Filters.py b/pyfpdb/Filters.py index 045d8f42..076f07fe 100644 --- a/pyfpdb/Filters.py +++ b/pyfpdb/Filters.py @@ -611,6 +611,32 @@ class Filters(threading.Thread): # print "Either 0 or more than one site matched - EEK" #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 fillGamesFrame(self, vbox): top_hbox = gtk.HBox(False, 0) vbox.pack_start(top_hbox, False, False, 0) diff --git a/pyfpdb/TourneyFilters.py b/pyfpdb/TourneyFilters.py index dd639150..bbc31944 100644 --- a/pyfpdb/TourneyFilters.py +++ b/pyfpdb/TourneyFilters.py @@ -129,32 +129,6 @@ class TourneyFilters(Filters.Filters): top_hbox.pack_start(showb, expand=False, padding=1) #end def fillPlayerFrame - 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 make_filter(self): self.tourneyTypes = {} #self.tourneys = {} From acbe15fadd15fa35e9195e9df30bda48dcaa29f7 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Tue, 27 Jul 2010 19:14:23 +0200 Subject: [PATCH 28/45] remove another near-duplicate from TourneyFilters --- pyfpdb/Filters.py | 1 + pyfpdb/TourneyFilters.py | 43 ---------------------------------------- 2 files changed, 1 insertion(+), 43 deletions(-) diff --git a/pyfpdb/Filters.py b/pyfpdb/Filters.py index 076f07fe..94bee25f 100644 --- a/pyfpdb/Filters.py +++ b/pyfpdb/Filters.py @@ -578,6 +578,7 @@ class Filters(threading.Thread): 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 fillSitesFrame(self, vbox): top_hbox = gtk.HBox(False, 0) diff --git a/pyfpdb/TourneyFilters.py b/pyfpdb/TourneyFilters.py index bbc31944..774c64c7 100644 --- a/pyfpdb/TourneyFilters.py +++ b/pyfpdb/TourneyFilters.py @@ -86,49 +86,6 @@ class TourneyFilters(Filters.Filters): widget.set_label("hide") #end def __toggle_box - 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 make_filter(self): self.tourneyTypes = {} #self.tourneys = {} From 9c5581caf0b72ed4f6dd9add312e7124baddd6cb Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Tue, 27 Jul 2010 22:27:18 +0100 Subject: [PATCH 29/45] rename stealattempt fields to raisefirstin and derive accordingly --- pyfpdb/Database.py | 8 +- pyfpdb/DerivedStats.py | 19 ++-- pyfpdb/GuiRingPlayerStats.py | 1 + pyfpdb/SQL.py | 194 +++++++++++++++++++++++++---------- 4 files changed, 154 insertions(+), 68 deletions(-) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index 028097dd..b2350a07 100644 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -1651,8 +1651,8 @@ class Database: pdata[p]['foldToOtherRaisedStreet2'], pdata[p]['foldToOtherRaisedStreet3'], pdata[p]['foldToOtherRaisedStreet4'], - pdata[p]['stealAttemptChance'], - pdata[p]['stealAttempted'], + pdata[p]['raiseFirstInChance'], + pdata[p]['raisedFirstIn'], pdata[p]['foldBbToStealChance'], pdata[p]['foldedBbToSteal'], pdata[p]['foldSbToStealChance'], @@ -1732,8 +1732,8 @@ class Database: if pdata[p]['foldToOtherRaisedStreet4']: line[21] = 1 line[22] = pdata[p]['wonWhenSeenStreet1'] line[23] = pdata[p]['wonAtSD'] - if pdata[p]['stealAttemptChance']: line[24] = 1 - if pdata[p]['stealAttempted']: line[25] = 1 + if pdata[p]['raiseFirstInChance']: line[24] = 1 + if pdata[p]['raisedFirstIn']: line[25] = 1 if pdata[p]['foldBbToStealChance']: line[26] = 1 if pdata[p]['foldedBbToSteal']: line[27] = 1 if pdata[p]['foldSbToStealChance']: line[28] = 1 diff --git a/pyfpdb/DerivedStats.py b/pyfpdb/DerivedStats.py index 7aab6c98..e92bfeaa 100644 --- a/pyfpdb/DerivedStats.py +++ b/pyfpdb/DerivedStats.py @@ -53,8 +53,8 @@ class DerivedStats(): self.handsplayers[player[1]]['street0_3BDone'] = False self.handsplayers[player[1]]['street0_4BChance'] = False self.handsplayers[player[1]]['street0_4BDone'] = False - self.handsplayers[player[1]]['stealAttemptChance'] = False - self.handsplayers[player[1]]['stealAttempted'] = False + self.handsplayers[player[1]]['raiseFirstInChance'] = False + self.handsplayers[player[1]]['raisedFirstIn'] = False self.handsplayers[player[1]]['foldBbToStealChance'] = False self.handsplayers[player[1]]['foldSbToStealChance'] = False self.handsplayers[player[1]]['foldedSbToSteal'] = False @@ -315,13 +315,14 @@ class DerivedStats(): self.hands['street%dRaises' % i] = len(filter( lambda action: action[1] in ('raises','bets'), hand.actions[street])) def calcSteals(self, hand): - """Fills stealAttempt(Chance|ed, fold(Bb|Sb)ToSteal(Chance|) + """Fills raiseFirstInChance|raisedFirstIn, fold(Bb|Sb)ToSteal(Chance|) - Steal attempt - open raise on positions 1 0 S - i.e. MP3, CO, BU, SB + Steal attempt - open raise on positions 1 0 S - i.e. CO, BU, SB (note: I don't think PT2 counts SB steals in HU hands, maybe we shouldn't?) Fold to steal - folding blind after steal attemp wo any other callers or raisers """ steal_attempt = False + raised = False steal_positions = (1, 0, 'S') if hand.gametype['base'] == 'stud': steal_positions = (2, 1, 0) @@ -341,11 +342,13 @@ class DerivedStats(): if steal_attempt and act != 'folds': break - if posn in steal_positions and not steal_attempt: - self.handsplayers[pname]['stealAttemptChance'] = True + if not steal_attempt and not raised: # if posn in steal_positions and not steal_attempt: + self.handsplayers[pname]['raiseFirstInChance'] = True if act in ('bets', 'raises'): - self.handsplayers[pname]['stealAttempted'] = True - steal_attempt = True + self.handsplayers[pname]['raisedFirstIn'] = True + raised = True + if posn in steal_positions: + steal_attempt = True if act == 'calls': break diff --git a/pyfpdb/GuiRingPlayerStats.py b/pyfpdb/GuiRingPlayerStats.py index f7d32355..765dda54 100644 --- a/pyfpdb/GuiRingPlayerStats.py +++ b/pyfpdb/GuiRingPlayerStats.py @@ -101,6 +101,7 @@ class GuiRingPlayerStats (GuiPlayerStats.GuiPlayerStats): , ["aggfac", True, "AggFac", 1.0, "%2.2f", "str"] , ["aggfrq", True, "AggFreq", 1.0, "%3.1f", "str"] , ["conbet", True, "ContBet", 1.0, "%3.1f", "str"] + , ["rfi", True, "RFI", 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"] diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index 59fa4378..fcebc5c9 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -598,8 +598,8 @@ class Sql: foldToOtherRaisedStreet3 BOOLEAN, foldToOtherRaisedStreet4 BOOLEAN, - stealAttemptChance BOOLEAN, - stealAttempted BOOLEAN, + raiseFirstInChance BOOLEAN, + raisedFirstIn BOOLEAN, foldBbToStealChance BOOLEAN, foldedBbToSteal BOOLEAN, foldSbToStealChance BOOLEAN, @@ -714,8 +714,8 @@ class Sql: foldToOtherRaisedStreet3 BOOLEAN, foldToOtherRaisedStreet4 BOOLEAN, - stealAttemptChance BOOLEAN, - stealAttempted BOOLEAN, + raiseFirstInChance BOOLEAN, + raisedFirstIn BOOLEAN, foldBbToStealChance BOOLEAN, foldedBbToSteal BOOLEAN, foldSbToStealChance BOOLEAN, @@ -829,8 +829,8 @@ class Sql: foldToOtherRaisedStreet3 INT, foldToOtherRaisedStreet4 INT, - stealAttemptChance INT, - stealAttempted INT, + raiseFirstInChance INT, + raisedFirstIn INT, foldBbToStealChance INT, foldedBbToSteal INT, foldSbToStealChance INT, @@ -1025,8 +1025,8 @@ class Sql: foldToOtherRaisedStreet3 INT, foldToOtherRaisedStreet4 INT, - stealAttemptChance INT, - stealAttempted INT, + raiseFirstInChance INT, + raisedFirstIn INT, foldBbToStealChance INT, foldedBbToSteal INT, foldSbToStealChance INT, @@ -1125,8 +1125,8 @@ class Sql: foldToOtherRaisedStreet3 INT, foldToOtherRaisedStreet4 INT, - stealAttemptChance INT, - stealAttempted INT, + raiseFirstInChance INT, + raisedFirstIn INT, foldBbToStealChance INT, foldedBbToSteal INT, foldSbToStealChance INT, @@ -1224,8 +1224,8 @@ class Sql: foldToOtherRaisedStreet3 INT, foldToOtherRaisedStreet4 INT, - stealAttemptChance INT, - stealAttempted INT, + raiseFirstInChance INT, + raisedFirstIn INT, foldBbToStealChance INT, foldedBbToSteal INT, foldSbToStealChance INT, @@ -1364,8 +1364,18 @@ class Sql: sum(hc.foldToOtherRaisedStreet4) AS f_freq_4, sum(hc.wonWhenSeenStreet1) AS w_w_s_1, sum(hc.wonAtSD) AS wmsd, - sum(hc.stealAttemptChance) AS steal_opp, - sum(hc.stealAttempted) AS steal, + sum(case hc.position + when 'S' then hc.raiseFirstInChance + when '0' then hc.raiseFirstInChance + when '1' then hc.raiseFirstInChance + else 0 + ) AS steal_opp, + sum(case hc.position + when 'S' then hc.raisedFirstIn + when '0' then hc.raisedFirstIn + when '1' then hc.raisedFirstIn + else 0 + ) AS steal, sum(hc.foldSbToStealChance) AS SBstolen, sum(hc.foldedSbToSteal) AS SBnotDef, sum(hc.foldBbToStealChance) AS BBstolen, @@ -1463,8 +1473,8 @@ class Sql: sum(hc.foldToOtherRaisedStreet4) AS f_freq_4, sum(hc.wonWhenSeenStreet1) AS w_w_s_1, sum(hc.wonAtSD) AS wmsd, - sum(hc.stealAttemptChance) AS steal_opp, - sum(hc.stealAttempted) AS steal, + sum(hc.raiseFirstInChance) AS steal_opp, + sum(hc.raisedFirstIn) AS steal, sum(hc.foldSbToStealChance) AS SBstolen, sum(hc.foldedSbToSteal) AS SBnotDef, sum(hc.foldBbToStealChance) AS BBstolen, @@ -1589,8 +1599,8 @@ class Sql: cast(hp2.foldToOtherRaisedStreet4 as integer) AS f_freq_4, cast(hp2.wonWhenSeenStreet1 as integer) AS w_w_s_1, cast(hp2.wonAtSD as integer) AS wmsd, - cast(hp2.stealAttemptChance as integer) AS steal_opp, - cast(hp2.stealAttempted as integer) AS steal, + cast(hp2.raiseFirstInChance as integer) AS steal_opp, + cast(hp2.raisedFirstIn as integer) AS steal, cast(hp2.foldSbToStealChance as integer) AS SBstolen, cast(hp2.foldedSbToSteal as integer) AS SBnotDef, cast(hp2.foldBbToStealChance as integer) AS BBstolen, @@ -1691,8 +1701,8 @@ class Sql: cast(hp2.foldToOtherRaisedStreet4 as integer) AS f_freq_4, cast(hp2.wonWhenSeenStreet1 as integer) AS w_w_s_1, cast(hp2.wonAtSD as integer) AS wmsd, - cast(hp2.stealAttemptChance as integer) AS steal_opp, - cast(hp2.stealAttempted as integer) AS steal, + cast(hp2.raiseFirstInChance as integer) AS steal_opp, + cast(hp2.raisedFirstIn as integer) AS steal, cast(hp2.foldSbToStealChance as integer) AS SBstolen, cast(hp2.foldedSbToSteal as integer) AS SBnotDef, cast(hp2.foldBbToStealChance as integer) AS BBstolen, @@ -1794,8 +1804,8 @@ class Sql: cast(hp2.foldToOtherRaisedStreet4 as integer) AS f_freq_4, cast(hp2.wonWhenSeenStreet1 as integer) AS w_w_s_1, cast(hp2.wonAtSD as integer) AS wmsd, - cast(hp2.stealAttemptChance as integer) AS steal_opp, - cast(hp2.stealAttempted as integer) AS steal, + cast(hp2.raiseFirstInChance as integer) AS steal_opp, + cast(hp2.raisedFirstIn as integer) AS steal, cast(hp2.foldSbToStealChance as integer) AS SBstolen, cast(hp2.foldedSbToSteal as integer) AS SBnotDef, cast(hp2.foldBbToStealChance as integer) AS BBstolen, @@ -2026,11 +2036,35 @@ class Sql: ,case when sum(cast(hp.street0_3Bchance as integer)) = 0 then -999 else 100.0*sum(cast(hp.street0_3Bdone as integer))/sum(cast(hp.street0_3Bchance as integer)) end AS pf3 - ,case when sum(cast(hp.stealattemptchance as integer)) = 0 then -999 - else 100.0*sum(cast(hp.stealattempted as integer))/sum(cast(hp.stealattemptchance as integer)) + ,case when sum(cast(hp.raiseFirstInChance as integer)) = 0 then -999 + else 100.0 * sum(cast(hp.raisedFirstIn as integer)) / + sum(cast(hp.raiseFirstInChance as integer)) + end AS rfi + ,case when sum(case hp.position + when 'S' then cast(hp.raiseFirstInChance as integer) + when '0' then cast(hp.raiseFirstInChance as integer) + when '1' then cast(hp.raiseFirstInChance as integer) + else 0 + end + ) = 0 then -999 + else 100.0 * + sum(case hp.position + when 'S' then cast(hp.raisedFirstIn as integer) + when '0' then cast(hp.raisedFirstIn as integer) + when '1' then cast(hp.raisedFirstIn as integer) + else 0 + end + ) / + sum(case hp.position + when 'S' then cast(hp.raiseFirstInChance as integer) + when '0' then cast(hp.raiseFirstInChance as integer) + when '1' then cast(hp.raiseFirstInChance as integer) + else 0 + end + ) end AS steals - ,100.0*sum(cast(hp.street1Seen as integer))/count(1) AS saw_f - ,100.0*sum(cast(hp.sawShowdown as integer))/count(1) AS sawsd + ,100.0*sum(cast(hp.street1Seen as integer))/count(1) AS saw_f + ,100.0*sum(cast(hp.sawShowdown as integer))/count(1) AS sawsd ,case when sum(cast(hp.street1Seen as integer)) = 0 then -999 else 100.0*sum(cast(hp.sawShowdown as integer))/sum(cast(hp.street1Seen as integer)) end AS wtsdwsf @@ -2123,8 +2157,32 @@ class Sql: ,case when sum(cast(hp.street0_3Bchance as integer)) = 0 then -999 else 100.0*sum(cast(hp.street0_3Bdone as integer))/sum(cast(hp.street0_3Bchance as integer)) end AS pf3 - ,case when sum(cast(hp.stealattemptchance as integer)) = 0 then -999 - else 100.0*sum(cast(hp.stealattempted as integer))/sum(cast(hp.stealattemptchance as integer)) + ,case when sum(cast(hp.raiseFirstInChance as integer)) = 0 then -999 + else 100.0 * sum(cast(hp.raisedFirstIn as integer)) / + sum(cast(hp.raiseFirstInChance as integer)) + end AS rfi + ,case when sum(case hp.position + when 'S' then cast(hp.raiseFirstInChance as integer) + when '0' then cast(hp.raiseFirstInChance as integer) + when '1' then cast(hp.raiseFirstInChance as integer) + else 0 + end + ) = 0 then -999 + else 100.0 * + sum(case hp.position + when 'S' then cast(hp.raisedFirstIn as integer) + when '0' then cast(hp.raisedFirstIn as integer) + when '1' then cast(hp.raisedFirstIn as integer) + else 0 + end + ) / + sum(case hp.position + when 'S' then cast(hp.raiseFirstInChance as integer) + when '0' then cast(hp.raiseFirstInChance as integer) + when '1' then cast(hp.raiseFirstInChance as integer) + else 0 + end + ) end AS steals ,100.0*sum(cast(hp.street1Seen as integer))/count(1) AS saw_f ,100.0*sum(cast(hp.sawShowdown as integer))/count(1) AS sawsd @@ -2221,8 +2279,32 @@ class Sql: ,case when sum(cast(hp.street0_3Bchance as integer)) = 0 then -999 else 100.0*sum(cast(hp.street0_3Bdone as integer))/sum(cast(hp.street0_3Bchance as integer)) end AS pf3 - ,case when sum(cast(hp.stealattemptchance as integer)) = 0 then -999 - else 100.0*sum(cast(hp.stealattempted as integer))/sum(cast(hp.stealattemptchance as integer)) + ,case when sum(cast(hp.raiseFirstInChance as integer)) = 0 then -999 + else 100.0 * sum(cast(hp.raisedFirstIn as integer)) / + sum(cast(hp.raiseFirstInChance as integer)) + end AS rfi + ,case when sum(case hp.position + when 'S' then cast(hp.raiseFirstInChance as integer) + when '0' then cast(hp.raiseFirstInChance as integer) + when '1' then cast(hp.raiseFirstInChance as integer) + else 0 + end + ) = 0 then -999 + else 100.0 * + sum(case hp.position + when 'S' then cast(hp.raisedFirstIn as integer) + when '0' then cast(hp.raisedFirstIn as integer) + when '1' then cast(hp.raisedFirstIn as integer) + else 0 + end + ) / + sum(case hp.position + when 'S' then cast(hp.raiseFirstInChance as integer) + when '0' then cast(hp.raiseFirstInChance as integer) + when '1' then cast(hp.raiseFirstInChance as integer) + else 0 + end + ) end AS steals ,100.0*sum(cast(hp.street1Seen as integer))/count(1) AS saw_f ,100.0*sum(cast(hp.sawShowdown as integer))/count(1) AS sawsd @@ -2380,8 +2462,8 @@ class Sql: ,case when sum(street0_3Bchance) = 0 then '0' else format(100.0*sum(street0_3Bdone)/sum(street0_3Bchance),1) end AS pf3 - ,case when sum(stealattemptchance) = 0 then '-' - else format(100.0*sum(stealattempted)/sum(stealattemptchance),1) + ,case when sum(raiseFirstInChance) = 0 then '-' + else format(100.0*sum(raisedFirstIn)/sum(raiseFirstInChance),1) end AS steals ,format(100.0*sum(street1Seen)/sum(HDs),1) AS saw_f ,format(100.0*sum(sawShowdown)/sum(HDs),1) AS sawsd @@ -2485,8 +2567,8 @@ class Sql: ,case when sum(street0_3Bchance) = 0 then '0' else to_char(100.0*sum(street0_3Bdone)/sum(street0_3Bchance),'90D0') end AS pf3 - ,case when sum(stealattemptchance) = 0 then '-' - else to_char(100.0*sum(stealattempted)/sum(stealattemptchance),'90D0') + ,case when sum(raiseFirstInChance) = 0 then '-' + else to_char(100.0*sum(raisedFirstIn)/sum(raiseFirstInChance),'90D0') end AS steals ,to_char(100.0*sum(street1Seen)/sum(HDs),'90D0') AS saw_f ,to_char(100.0*sum(sawShowdown)/sum(HDs),'90D0') AS sawsd @@ -2608,8 +2690,8 @@ class Sql: ,case when sum(street0_3Bchance) = 0 then '0' else format(100.0*sum(street0_3Bdone)/sum(street0_3Bchance),1) end AS pf3 - ,case when sum(stealattemptchance) = 0 then '-' - else format(100.0*sum(stealattempted)/sum(stealattemptchance),1) + ,case when sum(raiseFirstInChance) = 0 then '-' + else format(100.0*sum(raisedFirstIn)/sum(raiseFirstInChance),1) end AS steals ,format(100.0*sum(street1Seen)/sum(HDs),1) AS saw_f ,format(100.0*sum(sawShowdown)/sum(HDs),1) AS sawsd @@ -2742,8 +2824,8 @@ class Sql: ,case when sum(street0_3Bchance) = 0 then '0' else to_char(100.0*sum(street0_3Bdone)/sum(street0_3Bchance),'90D0') end AS pf3 - ,case when sum(stealattemptchance) = 0 then '-' - else to_char(100.0*sum(stealattempted)/sum(stealattemptchance),'90D0') + ,case when sum(raiseFirstInChance) = 0 then '-' + else to_char(100.0*sum(raisedFirstIn)/sum(raiseFirstInChance),'90D0') end AS steals ,to_char(round(100.0*sum(street1Seen)/sum(HDs)),'90D0') AS saw_f ,to_char(round(100.0*sum(sawShowdown)/sum(HDs)),'90D0') AS sawsd @@ -2922,8 +3004,8 @@ class Sql: ,foldToOtherRaisedStreet2 ,foldToOtherRaisedStreet3 ,foldToOtherRaisedStreet4 - ,stealAttemptChance - ,stealAttempted + ,raiseFirstInChance + ,raisedFirstIn ,foldBbToStealChance ,foldedBbToSteal ,foldSbToStealChance @@ -3012,8 +3094,8 @@ class Sql: ,sum(foldToOtherRaisedStreet2) ,sum(foldToOtherRaisedStreet3) ,sum(foldToOtherRaisedStreet4) - ,sum(stealAttemptChance) - ,sum(stealAttempted) + ,sum(raiseFirstInChance) + ,sum(raisedFirstIn) ,sum(foldBbToStealChance) ,sum(foldedBbToSteal) ,sum(foldSbToStealChance) @@ -3103,8 +3185,8 @@ class Sql: ,foldToOtherRaisedStreet2 ,foldToOtherRaisedStreet3 ,foldToOtherRaisedStreet4 - ,stealAttemptChance - ,stealAttempted + ,raiseFirstInChance + ,raisedFirstIn ,foldBbToStealChance ,foldedBbToSteal ,foldSbToStealChance @@ -3193,8 +3275,8 @@ class Sql: ,sum(CAST(foldToOtherRaisedStreet2 as integer)) ,sum(CAST(foldToOtherRaisedStreet3 as integer)) ,sum(CAST(foldToOtherRaisedStreet4 as integer)) - ,sum(CAST(stealAttemptChance as integer)) - ,sum(CAST(stealAttempted as integer)) + ,sum(CAST(raisedFirstInChance as integer)) + ,sum(CAST(raisedFirstIn as integer)) ,sum(CAST(foldBbToStealChance as integer)) ,sum(CAST(foldedBbToSteal as integer)) ,sum(CAST(foldSbToStealChance as integer)) @@ -3284,8 +3366,8 @@ class Sql: ,foldToOtherRaisedStreet2 ,foldToOtherRaisedStreet3 ,foldToOtherRaisedStreet4 - ,stealAttemptChance - ,stealAttempted + ,raiseFirstInChance + ,raisedFirstIn ,foldBbToStealChance ,foldedBbToSteal ,foldSbToStealChance @@ -3374,8 +3456,8 @@ class Sql: ,sum(CAST(foldToOtherRaisedStreet2 as integer)) ,sum(CAST(foldToOtherRaisedStreet3 as integer)) ,sum(CAST(foldToOtherRaisedStreet4 as integer)) - ,sum(CAST(stealAttemptChance as integer)) - ,sum(CAST(stealAttempted as integer)) + ,sum(CAST(raiseFirstInChance as integer)) + ,sum(CAST(raisedFirstIn as integer)) ,sum(CAST(foldBbToStealChance as integer)) ,sum(CAST(foldedBbToSteal as integer)) ,sum(CAST(foldSbToStealChance as integer)) @@ -3465,8 +3547,8 @@ class Sql: foldToOtherRaisedStreet4, wonWhenSeenStreet1, wonAtSD, - stealAttemptChance, - stealAttempted, + raiseFirstInChance, + raisedFirstIn, foldBbToStealChance, foldedBbToSteal, foldSbToStealChance, @@ -3554,8 +3636,8 @@ class Sql: foldToOtherRaisedStreet4=foldToOtherRaisedStreet4+%s, wonWhenSeenStreet1=wonWhenSeenStreet1+%s, wonAtSD=wonAtSD+%s, - stealAttemptChance=stealAttemptChance+%s, - stealAttempted=stealAttempted+%s, + raiseFirstInChance=raiseFirstInChance+%s, + raisedFirstIn=raisedFirstIn+%s, foldBbToStealChance=foldBbToStealChance+%s, foldedBbToSteal=foldedBbToSteal+%s, foldSbToStealChance=foldSbToStealChance+%s, @@ -3873,8 +3955,8 @@ class Sql: foldToOtherRaisedStreet2, foldToOtherRaisedStreet3, foldToOtherRaisedStreet4, - stealAttemptChance, - stealAttempted, + raiseFirstInChance, + raisedFirstIn, foldBbToStealChance, foldedBbToSteal, foldSbToStealChance, From d241ce9b48fc0b709362309aa63c6efea2973a56 Mon Sep 17 00:00:00 2001 From: Ferenc Erki Date: Sat, 17 Jul 2010 00:15:27 +0200 Subject: [PATCH 30/45] Added new stat: fold to steal Added new stat: fold to steal Signed-off-by: steffen123 --- pyfpdb/Stats.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/pyfpdb/Stats.py b/pyfpdb/Stats.py index 72af0bb0..9bb6307c 100755 --- a/pyfpdb/Stats.py +++ b/pyfpdb/Stats.py @@ -350,6 +350,29 @@ def f_BB_steal(stat_dict, player): 'fBB_s=NA', '(0/0)', '% folded BB to steal') + +def f_steal(stat_dict, player): + """ Folded blind to steal.""" + stat = 0.0 + try: + folded_blind = stat_dict[player]['sbnotdef'] + stat_dict[player]['bbnotdef'] + blind_stolen = stat_dict[player]['sbstolen'] + stat_dict[player]['bbstolen'] + + stat = float(folded_blind)/float(blind_stolen) + return (stat, + '%3.1f' % (100*stat) + '%', + 'fB=%3.1f' % (100*stat) + '%', + 'fB_s=%3.1f' % (100*stat) + '%', + '(%d/%d)' % (folded_blind, blind_stolen), + '% folded blind to steal' + ) + except: + return (stat, + 'NA', + 'fB=NA', + 'fB_s=NA', + '(0/0)', + '% folded blind to steal') def three_B(stat_dict, player): """ Three bet preflop/3rd.""" @@ -777,6 +800,7 @@ if __name__== "__main__": #print "player = ", player, do_stat(stat_dict, player = player, stat = 'steal') #print "player = ", player, do_stat(stat_dict, player = player, stat = 'f_SB_steal') #print "player = ", player, do_stat(stat_dict, player = player, stat = 'f_BB_steal') + #print "player = ", player, do_stat(stat_dict, player = player, stat = 'f_steal') #print "player = ", player, do_stat(stat_dict, player = player, stat = 'three_B') #print "player = ", player, do_stat(stat_dict, player = player, stat = 'WMsF') #print "player = ", player, do_stat(stat_dict, player = player, stat = 'a_freq1') From ac728fffb21c3425e80d8618477db7c3ae676ece Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 29 Jul 2010 19:59:45 +0800 Subject: [PATCH 31/45] FTP and Timezone fix. Error reported with the following hand hostory from FTP France: Full Tilt Poker.fr Game #22632637058: Daily Euro (174599326), Table 3 - 10/20 - No Limit Hold'em - 20:15:39 CET - 2010/07/27 The existing FTP parser crashed on CET times. 1) Fixed parser to accept CET 2) Added timezone offset into HHC Not happy with TZ1/TZ2 solution. --- pyfpdb/FulltiltToFpdb.py | 19 ++++++++++++------- pyfpdb/HandHistoryConverter.py | 14 +++++++++----- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/pyfpdb/FulltiltToFpdb.py b/pyfpdb/FulltiltToFpdb.py index be566ef7..cfeb7de1 100755 --- a/pyfpdb/FulltiltToFpdb.py +++ b/pyfpdb/FulltiltToFpdb.py @@ -54,7 +54,7 @@ class Fulltilt(HandHistoryConverter): \$?(?P[.0-9]+)/\$?(?P[.0-9]+)\s(Ante\s\$?(?P[.0-9]+)\s)?-\s \$?(?P[.0-9]+\sCap\s)? (?P[a-zA-Z\/\'\s]+)\s-\s - (?P\d+:\d+:\d+\s\w+\s-\s\d+/\d+/\d+|\d+:\d+\s\w+\s-\s\w+\,\s\w+\s\d+\,\s\d+) + (?P\d+:\d+:\d+\s(?P\w+)\s-\s\d+/\d+/\d+|\d+:\d+\s(?P\w+)\s-\s\w+\,\s\w+\s\d+\,\s\d+) (?P\(partial\))?\n (?:.*?\n(?PHand\s\#(?P=HID)\shas\sbeen\scanceled))? ''', re.VERBOSE|re.DOTALL) @@ -201,13 +201,18 @@ class Fulltilt(HandHistoryConverter): return None hand.handid = m.group('HID') hand.tablename = m.group('TABLE') - - try: - hand.startTime = datetime.datetime.strptime(m.group('DATETIME'), "%H:%M:%S ET - %Y/%m/%d") - except: - hand.startTime = datetime.datetime.strptime(m.group('DATETIME'), "%H:%M ET - %a, %B %d, %Y") - hand.startTime = HandHistoryConverter.changeTimezone(hand.startTime, "ET", "UTC") + timezone = "ET" + if m.group('TZ1') == "CET" or m.group('TZ2') == "CET": + timezone = "CET" + try: + stringformat = "%H:%M:%S " + m.group('TZ1') + " - %Y/%m/%d" + hand.startTime = datetime.datetime.strptime(m.group('DATETIME'), stringformat) + except: + stringformat = "%H:%M " + m.group('TZ2') + " - %a, %B %d, %Y" + hand.startTime = datetime.datetime.strptime(m.group('DATETIME'), stringformat) + + hand.startTime = HandHistoryConverter.changeTimezone(hand.startTime, timezone, "UTC") if m.group("CANCELLED") or m.group("PARTIAL"): raise FpdbParseError(hid=m.group('HID')) diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index 4554c2e8..bfd71640 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.py @@ -497,19 +497,23 @@ or None if we fail to get the info """ @staticmethod def changeTimezone(time, givenTimezone, wantedTimezone): + offest = datetime.timedelta(hours=0) if givenTimezone=="ET" and wantedTimezone=="UTC": # 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) + 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 + offset = datetime.timedelta(hours=4) # rest is EDT: assume 4 hour offset (ET with daylight saving) #print " tz = %s start = %s" % (tz, str(hand.starttime)) - return time + elif givenTimezone=="CET" and wantedTimezone=="UTC": + offset = datetime.timedelta(hours=1) + + # adjust time into UTC: + time = time + offset + return time #end @staticmethod def changeTimezone @staticmethod From 872bf2fa287626ed4b74764bd007596f011e9d84 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Thu, 29 Jul 2010 14:24:23 +0200 Subject: [PATCH 32/45] correct version number --- pyfpdb/fpdb.pyw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/fpdb.pyw b/pyfpdb/fpdb.pyw index 85519afc..cc050d07 100755 --- a/pyfpdb/fpdb.pyw +++ b/pyfpdb/fpdb.pyw @@ -116,7 +116,7 @@ import Configuration import Exceptions import Stats -VERSION = "0.20.901 plus git" +VERSION = "0.20.902 plus git" class fpdb: From 792a2aec4fa345fa47514b9d34411589af2cf84b Mon Sep 17 00:00:00 2001 From: steffen123 Date: Thu, 29 Jul 2010 16:18:05 +0200 Subject: [PATCH 33/45] finally fix the DST handling properly using pytz --- pyfpdb/HandHistoryConverter.py | 38 +++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index bfd71640..658e7433 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.py @@ -26,8 +26,11 @@ import codecs from decimal import Decimal import operator from xml.dom.minidom import Node + import time import datetime +from pytz import timezone +import pytz import logging # logging has been set up in fpdb.py or HUD_main.py, use their settings: @@ -497,23 +500,24 @@ or None if we fail to get the info """ @staticmethod def changeTimezone(time, givenTimezone, wantedTimezone): - offest = datetime.timedelta(hours=0) - if givenTimezone=="ET" and wantedTimezone=="UTC": - # 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) - #print " tz = %s start = %s" % (tz, str(hand.starttime)) - elif givenTimezone=="CET" and wantedTimezone=="UTC": - offset = datetime.timedelta(hours=1) - - # adjust time into UTC: - time = time + offset - return time + #print "raw time:",time, "given TZ:", givenTimezone + if wantedTimezone=="UTC": + wantedTimezone = pytz.utc + else: + raise Error #TODO raise appropriate error + + if givenTimezone=="ET": + givenTimezone = timezone('US/Eastern') + elif givenTimezone=="CET": + givenTimezone = timezone('Europe/Berlin') + #Note: Daylight Saving Time is standardised across the EU so this should be fine + else: + raise Error #TODO raise appropriate error + + localisedTime = givenTimezone.localize(time) + utcTime = localisedTime.astimezone(wantedTimezone) + #print "utcTime:",utcTime + return utcTime #end @staticmethod def changeTimezone @staticmethod From a02d16841d5fd89b709ec382ed5c2b2db061e1c6 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Thu, 29 Jul 2010 16:45:17 +0200 Subject: [PATCH 34/45] clean up ebuilds --- ...uild => current_stable_and_testing.ebuild} | 0 packaging/gentoo/fpdb-0.20-r1.ebuild | 57 ------------------ packaging/gentoo/fpdb-0.20-r2.ebuild | 59 ------------------- 3 files changed, 116 deletions(-) rename packaging/gentoo/{fpdb-0.20.1.ebuild => current_stable_and_testing.ebuild} (100%) delete mode 100644 packaging/gentoo/fpdb-0.20-r1.ebuild delete mode 100644 packaging/gentoo/fpdb-0.20-r2.ebuild diff --git a/packaging/gentoo/fpdb-0.20.1.ebuild b/packaging/gentoo/current_stable_and_testing.ebuild similarity index 100% rename from packaging/gentoo/fpdb-0.20.1.ebuild rename to packaging/gentoo/current_stable_and_testing.ebuild diff --git a/packaging/gentoo/fpdb-0.20-r1.ebuild b/packaging/gentoo/fpdb-0.20-r1.ebuild deleted file mode 100644 index 988a90b1..00000000 --- a/packaging/gentoo/fpdb-0.20-r1.ebuild +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright 1999-2010 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# created by Steffen Schaumburg, steffen@schaumburger.info - -EAPI="2" -NEED_PYTHON=2.5 - -#inherit distutils - -DESCRIPTION="A database program to track your online poker games" -HOMEPAGE="http://fpdb.sourceforge.net/" -#SRC_URI="mirror://sourceforge/fpdb/${MY_P}.tar.bz2" - -LICENSE="AGPL-3" -SLOT="0" -KEYWORDS="~amd64 ~x86" -#note: this should work on other architectures too, please send me your experiences - -IUSE="graphing mysql postgres sqlite" -RDEPEND=" - mysql? ( virtual/mysql - dev-python/mysql-python ) - postgres? ( dev-db/postgresql-server - dev-python/psycopg ) - sqlite? ( dev-lang/python[sqlite] - dev-python/numpy ) - >=x11-libs/gtk+-2.10 - dev-python/pygtk - graphing? ( dev-python/numpy - dev-python/matplotlib[gtk] ) - dev-python/python-xlib" -DEPEND="${RDEPEND}" - -#src_install() { -# DIRINST="${D}usr/share/games/fpdb/" -# mkdir -p "${DIRINST}" -# cp -R * "${DIRINST}" || die -# -# DIRBIN="${D}usr/games/bin/" -# mkdir -p "${DIRBIN}" -# #echo "pathes" -# #echo "${DIRINST}pyfpdb/fpdb.py" -# #echo "${DIRBIN}fpdb.py" -# #echo -# echo "cd /usr/share/games/fpdb/pyfpdb/ && python fpdb.py" > "${DIRBIN}fpdb" || die -# chmod 755 "${DIRBIN}fpdb" || die -#} - -#src_test() { -#} - -pkg_postinst() { - elog "Fpdb's dependencies have been installed. Please visit fpdb.sourceforge.net" - elog "and download and unpack the archive.You can then start fpdb by running run_fpdb.py." - elog "Note that if you really want to use mysql or postgresql you will have to create" - elog "the database and user yourself and enter it into the fpdb config." -} diff --git a/packaging/gentoo/fpdb-0.20-r2.ebuild b/packaging/gentoo/fpdb-0.20-r2.ebuild deleted file mode 100644 index 2e04719e..00000000 --- a/packaging/gentoo/fpdb-0.20-r2.ebuild +++ /dev/null @@ -1,59 +0,0 @@ -# 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 - -DESCRIPTION="Fpdb is a free/open source tracker/HUD for use with online poker" -HOMEPAGE="http://fpdb.wiki.sourceforge.net/" -SRC_URI="mirror://sourceforge/${PN}/${PV}/${P}.tar.gz" - -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() { - dodir /usr/share/games/fpdb - - exeinto /usr/share/games/fpdb - doexe run_fpdb.py - dosym /usr/share/games/fpdb/run_fpdb.py /usr/bin/fpdb - - insinto /usr/share/games/fpdb - doins readme.txt - - insinto /usr/share/games/fpdb/files - doins files/* - - insinto /usr/share/games/fpdb/gfx - doins gfx/* - - insinto /usr/share/games/fpdb/pyfpdb - doins pyfpdb/* - -# pyfpdb/regression-test-files dir is missing for now; cp -r ?? - -} - -pkg_postinst() { - 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." - elog "You can find the instructions on the project's website." -} From 2329128c91eb6fabbb5cfce896537a2983b18023 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Thu, 29 Jul 2010 16:46:32 +0200 Subject: [PATCH 35/45] courtesy of Ferki: fix archive format change, remove unnecessary echos --- packaging/gentoo/current_stable_and_testing.ebuild | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packaging/gentoo/current_stable_and_testing.ebuild b/packaging/gentoo/current_stable_and_testing.ebuild index a99e1bfe..d4dbba57 100644 --- a/packaging/gentoo/current_stable_and_testing.ebuild +++ b/packaging/gentoo/current_stable_and_testing.ebuild @@ -10,7 +10,7 @@ NEED_PYTHON=2.5 DESCRIPTION="A free/open source tracker/HUD for use with online poker" HOMEPAGE="http://fpdb.wiki.sourceforge.net/" -SRC_URI="mirror://sourceforge/${PN}/${PV}/${P}.tar.gz" +SRC_URI="mirror://sourceforge/${PN}/${PV}/${P}.tar.bz2" LICENSE="AGPL-3" SLOT="0" @@ -53,9 +53,7 @@ src_install() { pkg_postinst() { games_pkg_postinst - echo - 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." + 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." elog "You can find the instructions on the project's website." - echo } From 5e67459c24366b8c2ea00594efcfd41a7074457d Mon Sep 17 00:00:00 2001 From: steffen123 Date: Thu, 29 Jul 2010 16:55:13 +0200 Subject: [PATCH 36/45] add readme for gentoo users, add pytz dependency --- packaging/gentoo/current_stable_and_testing.ebuild | 3 ++- packaging/gentoo/readme.txt | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 packaging/gentoo/readme.txt diff --git a/packaging/gentoo/current_stable_and_testing.ebuild b/packaging/gentoo/current_stable_and_testing.ebuild index d4dbba57..7a27feb0 100644 --- a/packaging/gentoo/current_stable_and_testing.ebuild +++ b/packaging/gentoo/current_stable_and_testing.ebuild @@ -29,7 +29,8 @@ RDEPEND=" dev-python/pygtk graph? ( dev-python/numpy dev-python/matplotlib[gtk] ) - dev-python/python-xlib" + dev-python/python-xlib + dev-python/pytz" DEPEND="${RDEPEND}" src_install() { diff --git a/packaging/gentoo/readme.txt b/packaging/gentoo/readme.txt new file mode 100644 index 00000000..66d3b452 --- /dev/null +++ b/packaging/gentoo/readme.txt @@ -0,0 +1,2 @@ +To use the ebuild please simply copy it into your local portage tree and rename it to fpdb-version.ebuild, for example fpdb-0.20.1.ebuild or fpdb-0.20.902.ebuild. +Here's a little howto on how to utilise 3rd party ebuilds such as this one: http://www.gentoo-wiki.info/HOWTO_Installing_3rd_Party_Ebuilds From de39d1cabfb906b223d1a160864a431a2bb6b90d Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 29 Jul 2010 22:57:57 +0800 Subject: [PATCH 37/45] Add all Timezones that Stars supports to TZ function All timezones outside of Australia I dodn't define for the moment. Still requires support for actually getting said timezone, but were on our way. --- pyfpdb/HandHistoryConverter.py | 44 ++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index 658e7433..59ba90ef 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.py @@ -511,6 +511,50 @@ or None if we fail to get the info """ elif givenTimezone=="CET": givenTimezone = timezone('Europe/Berlin') #Note: Daylight Saving Time is standardised across the EU so this should be fine + elif givenTimezone == 'HST': # Hawaiian Standard Time + pass + elif givenTimezone == 'AKT': # Alaska Time + pass + elif givenTimezone == 'PT': # Pacific Time + pass + elif givenTimezone == 'MT': # Mountain Time + pass + elif givenTimezone == 'CT': # Central Time + pass + elif givenTimezone == 'AT': # Atlantic Time + pass + elif givenTimezone == 'NT': # Newfoundland Time + pass + elif givenTimezone == 'ART': # Argentinian Time + pass + elif givenTimezone == 'BRT': # Brasilia Time + pass + elif givenTimezone == 'AKT': # Alaska Time + pass + elif givenTimezone == 'WET': # Western European Time + pass + elif givenTimezone == 'EET': # Eastern European Time + pass + elif givenTimezone == 'MSK': # Moscow Standard Time + pass + elif givenTimezone == 'IST': # India Standard Time + pass + elif givenTimezone == 'CCT': # China Coast Time + pass + elif givenTimezone == 'JST': # Japan Standard Time + pass + elif givenTimezone == 'AWST': # Australian Western Standard Time + givenTimezone = timezone('Australia/West') + elif givenTimezone == 'ACST': # Australian Central Standard Time + givenTimezone = timezone('Australia/Darwin') + elif givenTimezone == 'AEST': # Australian Eastern Standard Time + # Each State on the East Coast has different DSTs. + # Melbournce is out because I don't like AFL, Queensland doesn't have DST + # ACT is full of politicians and Tasmania will never notice. + # Using Sydney. + givenTimezone = timezone('Australia/Sydney') + elif givenTimezone == 'NZT': # New Zealand Time + pass else: raise Error #TODO raise appropriate error From 216c9f27146814ad5aae8de91af7bb49337f40df Mon Sep 17 00:00:00 2001 From: steffen123 Date: Thu, 29 Jul 2010 17:31:40 +0200 Subject: [PATCH 38/45] increase DB version for sqlcoder's recent DB change --- pyfpdb/Database.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index b2350a07..500dfb0a 100644 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -74,7 +74,7 @@ except ImportError: use_numpy = False -DB_VERSION = 138 +DB_VERSION = 139 # Variance created as sqlite has a bunch of undefined aggregate functions. From 4510268bc898a641f5934e9ae7dd865f8e987c7c Mon Sep 17 00:00:00 2001 From: steffen123 Date: Fri, 30 Jul 2010 00:51:47 +0200 Subject: [PATCH 39/45] teach windows how to handle non-ASCII usernames --- pyfpdb/Configuration.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/pyfpdb/Configuration.py b/pyfpdb/Configuration.py index 03858760..6063b14d 100755 --- a/pyfpdb/Configuration.py +++ b/pyfpdb/Configuration.py @@ -52,8 +52,13 @@ def get_default_config_path(): if os.name == 'posix': config_path = os.path.join(os.path.expanduser("~"), '.fpdb') elif os.name == 'nt': - config_path = os.path.join(os.environ["APPDATA"], 'fpdb') + config_path = os.path.join(unicode(os.environ[u"APPDATA"], "latin-1"), u"fpdb") + #print u"path after joining in get_default_config_path:",config_path else: config_path = False + + try: os.mkdir(config_path) + except: pass + return config_path def get_exec_path(): @@ -110,7 +115,7 @@ def get_logger(file_name, config = "config", fallback = False, log_dir=None, log (conf_file,copied) = get_config(file_name, fallback = fallback) if log_dir is None: - log_dir = os.path.join(get_exec_path(), 'log') + log_dir = os.path.join(get_exec_path(), u'log') #print "\nget_logger: checking log_dir:", log_dir check_dir(log_dir) if log_file is None: @@ -147,7 +152,7 @@ def check_dir(path, create = True): msg = "Creating directory: '%s'" % (path) print msg log.info(msg) - os.mkdir(path) + os.mkdir(path)#, "utf-8")) else: return False @@ -520,9 +525,9 @@ class Config: self.dir_self = get_exec_path() # self.dir_config = os.path.dirname(self.file) self.dir_config = get_default_config_path() - self.dir_log = os.path.join(self.dir_config, 'log') - self.dir_database = os.path.join(self.dir_config, 'database') - self.log_file = os.path.join(self.dir_log, 'fpdb-log.txt') + self.dir_log = os.path.join(self.dir_config, u'log') + self.dir_database = os.path.join(self.dir_config, u'database') + self.log_file = os.path.join(self.dir_log, u'fpdb-log.txt') log = get_logger("logging.conf", "config", log_dir=self.dir_log) # Parse even if there was no real config file found and we are using the example From 1688dfc991341b2b378a9c4f8cf16a57fa66cdef Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Fri, 30 Jul 2010 01:00:31 +0100 Subject: [PATCH 40/45] add ability to display different columns in summary and position breakdown. Next job is to add this info to config and build a column config dialog. Also set height of top stat pane better. --- pyfpdb/GuiRingPlayerStats.py | 142 +++++++++++++++++++++++------------ 1 file changed, 96 insertions(+), 46 deletions(-) diff --git a/pyfpdb/GuiRingPlayerStats.py b/pyfpdb/GuiRingPlayerStats.py index 765dda54..30643720 100644 --- a/pyfpdb/GuiRingPlayerStats.py +++ b/pyfpdb/GuiRingPlayerStats.py @@ -31,7 +31,7 @@ import Filters import Charset import GuiPlayerStats -colalias,colshow,colheading,colxalign,colformat,coltype = 0,1,2,3,4,5 +colalias,colshowsumm,colshowposn,colheading,colxalign,colformat,coltype = 0,1,2,3,4,5,6 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): @@ -88,34 +88,34 @@ class GuiRingPlayerStats (GuiPlayerStats.GuiPlayerStats): # 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"] - , ["rfi", True, "RFI", 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"] + # is column displayed(summary then position), column heading, xalignment, formatting, celltype + self.columns = [ ["game", True, True, "Game", 0.0, "%s", "str"] + , ["hand", False, False, "Hand", 0.0, "%s", "str"] # true not allowed for this line + , ["plposition", False, False, "Posn", 1.0, "%s", "str"] # true not allowed for this line (set in code) + , ["pname", False, False, "Name", 0.0, "%s", "str"] # true not allowed for this line (set in code) + , ["n", True, True, "Hds", 1.0, "%1.0f", "str"] + , ["avgseats", False, False, "Seats", 1.0, "%3.1f", "str"] + , ["vpip", True, True, "VPIP", 1.0, "%3.1f", "str"] + , ["pfr", True, True, "PFR", 1.0, "%3.1f", "str"] + , ["pf3", True, True, "PF3", 1.0, "%3.1f", "str"] + , ["aggfac", True, True, "AggFac", 1.0, "%2.2f", "str"] + , ["aggfrq", True, True, "AggFreq", 1.0, "%3.1f", "str"] + , ["conbet", True, True, "ContBet", 1.0, "%3.1f", "str"] + , ["rfi", True, True, "RFI", 1.0, "%3.1f", "str"] + , ["steals", True, True, "Steals", 1.0, "%3.1f", "str"] + , ["saw_f", True, True, "Saw_F", 1.0, "%3.1f", "str"] + , ["sawsd", True, True, "SawSD", 1.0, "%3.1f", "str"] + , ["wtsdwsf", True, True, "WtSDwsF", 1.0, "%3.1f", "str"] + , ["wmsd", True, True, "W$SD", 1.0, "%3.1f", "str"] + , ["flafq", True, True, "FlAFq", 1.0, "%3.1f", "str"] + , ["tuafq", True, True, "TuAFq", 1.0, "%3.1f", "str"] + , ["rvafq", True, True, "RvAFq", 1.0, "%3.1f", "str"] + , ["pofafq", False, False, "PoFAFq", 1.0, "%3.1f", "str"] + , ["net", True, True, "Net($)", 1.0, "%6.2f", "cash"] + , ["bbper100", True, True, "bb/100", 1.0, "%4.2f", "str"] + , ["rake", True, True, "Rake($)", 1.0, "%6.2f", "cash"] + , ["bb100xr", True, True, "bbxr/100", 1.0, "%4.2f", "str"] + , ["variance", True, True, "Variance", 1.0, "%5.2f", "str"] ] # Detail filters: This holds the data used in the popup window, extra values are @@ -150,6 +150,8 @@ class GuiRingPlayerStats (GuiPlayerStats.GuiPlayerStats): self.stats_vbox = gtk.VPaned() self.stats_vbox.show() self.stats_frame.add(self.stats_vbox) + self.top_pane_height = 0 + self.height_inc = None # self.fillStatsFrame(self.stats_vbox) #self.main_hbox.pack_start(self.filters.get_vbox()) @@ -159,7 +161,17 @@ class GuiRingPlayerStats (GuiPlayerStats.GuiPlayerStats): self.main_hbox.show() # make sure Hand column is not displayed - [x for x in self.columns if x[0] == 'hand'][0][1] = False + [x for x in self.columns if x[0] == 'hand'][0][colshowsumm] = False + [x for x in self.columns if x[0] == 'hand'][0][colshowposn] = False + # if rfi and steal both on for summaries, turn rfi off + if ( [x for x in self.columns if x[0] == 'rfi'][0][colshowsumm] + and [x for x in self.columns if x[0] == 'steals'][0][colshowsumm]): + [x for x in self.columns if x[0] == 'rfi'][0][colshowsumm] = False + # if rfi and steal both on for position breakdowns, turn steals off: + if ( [x for x in self.columns if x[0] == 'rfi'][0][colshowposn] + and [x for x in self.columns if x[0] == 'steals'][0][colshowposn]): + [x for x in self.columns if x[0] == 'steals'][0][colshowposn] = False + self.last_pos = -1 @@ -169,18 +181,33 @@ class GuiRingPlayerStats (GuiPlayerStats.GuiPlayerStats): #end def get_vbox def refreshStats(self, widget, data): - self.last_pos = self.stats_vbox.get_position() + #self.last_pos = self.stats_vbox.get_position() + self.height_inc = None + #old_len = 0 + #if self.liststore: + # old_len = len(self.liststore[0]) 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) + + # set height of top pane + # (tried 2 ways, guesstimate using ratio of old to new number of rows and sum of + # heights of parts) + new_len = 0 + if self.liststore: + #new_len = len(self.liststore[0]) + #print "setting to", self.top_pane_height + self.height_inc + self.stats_vbox.set_position(self.top_pane_height + self.height_inc) + #if self.last_pos > 0: + # if old_len > 0 and new_len > 0 and new_len <= 10: + # self.stats_vbox.set_position(self.last_pos * (new_len+1.9)/(old_len+1.9)) + # else: + # self.stats_vbox.set_position(self.last_pos) #end def refreshStats def fillStatsFrame(self, vbox): @@ -226,8 +253,8 @@ class GuiRingPlayerStats (GuiPlayerStats.GuiPlayerStats): # 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) + vbox.pack1(swin) #, resize=True) don't use resize, self.height_inc relies on initial + # height of pane being correct for one row # Display summary table at top of page # 3rd parameter passes extra flags, currently includes: @@ -237,6 +264,7 @@ class GuiRingPlayerStats (GuiPlayerStats.GuiPlayerStats): flags = [False, self.filters.getNumHands(), 0] self.addGrid(swin, 'playerDetailedStats', flags, playerids ,sitenos, limits, type, seats, groups, dates, games) + swin.show() if 'allplayers' in groups and groups['allplayers']: # can't currently do this combination so skip detailed table @@ -250,19 +278,32 @@ class GuiRingPlayerStats (GuiPlayerStats.GuiPlayerStats): 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) + swin2 = gtk.ScrolledWindow(hadjustment=None, vadjustment=None) + swin2.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) + swin2.show() + vbox2.pack_start(swin2, expand=True, padding=3) vbox.pack2(vbox2) vbox2.show() # Detailed table flags[0] = True flags[2] = 1 - self.addGrid(swin, 'playerDetailedStats', flags, playerids + self.addGrid(swin2, 'playerDetailedStats', flags, playerids ,sitenos, limits, type, seats, groups, dates, games) + if self.height_inc is None: + self.height_inc = 0 + # need this to check whether scrollbar is visible: + while gtk.events_pending(): # see http://faq.pygtk.org/index.py?req=index for more hints (3.7) + gtk.main_iteration(False) + hs = swin.get_hscrollbar() + if hs is not None: + #print "hs vis", hs.get_property('visible'), hs.get_property('visible').__class__ + if hs.get_property('visible'): + self.height_inc = hs.size_request()[1] + swin.style_get_property('scrollbar-spacing') + #print "hh set to", self.height_inc + self.stats_vbox.set_position(self.top_pane_height + self.height_inc) + self.db.rollback() print "Stats page displayed in %4.2f seconds" % (time() - startTime) #end def createStatsTable @@ -351,6 +392,8 @@ class GuiRingPlayerStats (GuiPlayerStats.GuiPlayerStats): colnames = [desc[0].lower() for desc in self.cursor.description] # pre-fetch some constant values: + colshow = colshowsumm + if groups['posn']: colshow = colshowposn self.cols_to_show = [x for x in self.columns if x[colshow]] hgametypeid_idx = colnames.index('hgametypeid') @@ -446,6 +489,11 @@ class GuiRingPlayerStats (GuiPlayerStats.GuiPlayerStats): sqlrow += 1 row += 1 vbox.show_all() + view.show() + if len(self.liststore) == 1: + #print "view hieght is ", view.get_allocation().height, view.size_request(), view.get_visible_rect().height, view.get_vadjustment().get_value() + self.top_pane_height = view.size_request()[1] + #print "saved ", self.top_pane_height #end def addGrid def refineQuery(self, query, flags, playerids, sitenos, limits, type, seats, groups, dates, games): @@ -456,20 +504,22 @@ class GuiRingPlayerStats (GuiPlayerStats.GuiPlayerStats): else: holecards = flags[0] numhands = flags[1] + colshow = colshowsumm + if groups['posn']: colshow = colshowposn 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 + [x for x in self.columns if x[0] == 'pname'][0][colshow] = 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 + [x for x in self.columns if x[0] == 'pname'][0][colshow] = True if numhands: having = ' and count(1) > %d ' % (numhands,) else: @@ -481,7 +531,7 @@ class GuiRingPlayerStats (GuiPlayerStats.GuiPlayerStats): 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 + [x for x in self.columns if x[0] == 'pname'][0][colshow] = False query = query.replace("", nametest) query = query.replace("", pname) query = query.replace("", having) @@ -604,11 +654,11 @@ class GuiRingPlayerStats (GuiPlayerStats.GuiPlayerStats): #query = query.replace("", "case hp.position when '0' then 'Btn' else hp.position end") query = query.replace("", "hp.position") # set flag in self.columns to show posn column - [x for x in self.columns if x[0] == 'plposition'][0][1] = True + [x for x in self.columns if x[0] == 'plposition'][0][colshow] = True else: query = query.replace("", "gt.base") # unset flag in self.columns to hide posn column - [x for x in self.columns if x[0] == 'plposition'][0][1] = False + [x for x in self.columns if x[0] == 'plposition'][0][colshow] = False #print "query =\n", query return(query) From 961ade9aff947afd50bf4d213cc4c991b2205713 Mon Sep 17 00:00:00 2001 From: Worros Date: Sat, 31 Jul 2010 16:57:25 +0800 Subject: [PATCH 41/45] Stars: Make Knockout tourneys parse Adjusted GameInfo regex to separately parse buyin, rake and knockout for tournamets --- pyfpdb/PokerStarsToFpdb.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/pyfpdb/PokerStarsToFpdb.py b/pyfpdb/PokerStarsToFpdb.py index 0a9e47fc..a45a9b4e 100644 --- a/pyfpdb/PokerStarsToFpdb.py +++ b/pyfpdb/PokerStarsToFpdb.py @@ -72,7 +72,7 @@ class PokerStars(HandHistoryConverter): (Tournament\s\# # open paren of tournament info (?P\d+),\s # here's how I plan to use LS - (?P([%(LS)s\+\d\.]+\s?(?P%(LEGAL_ISO)s)?)|Freeroll)\s+)? + (?P(?P[%(LS)s\d\.]+)\+(?P[%(LS)s\d\.]+)?\+(?P[%(LS)s\d\.]+)\s?(?P%(LEGAL_ISO)s)|Freeroll)\s+)? # close paren of tournament info (?PHORSE|8\-Game|HOSE)?\s?\(? (?PHold\'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 @@ -206,24 +206,20 @@ class PokerStars(HandHistoryConverter): m = self.re_HandInfo.search(hand.handText,re.DOTALL) if m: info.update(m.groupdict()) -# hand.maxseats = int(m2.group(1)) else: pass # throw an exception here, eh? m = self.re_GameInfo.search(hand.handText) if m: info.update(m.groupdict()) -# m = self.re_Button.search(hand.handText) -# if m: info.update(m.groupdict()) - # TODO : I rather like the idea of just having this dict as hand.info + log.debug("readHandInfo: %s" % info) for key in info: if key == 'DATETIME': - #2008/11/12 10:00:48 CET [2008/11/12 4:00:48 ET] # (both dates are parsed so ET date overrides the other) + #2008/11/12 10:00:48 CET [2008/11/12 4:00:48 ET] # (both dates are parsed so ET date overrides the other) #2008/08/17 - 01:14:43 (ET) #2008/09/07 06:23:14 ET m1 = self.re_DateTime.finditer(info[key]) - # m2 = re.search("(?P[0-9]{4})\/(?P[0-9]{2})\/(?P[0-9]{2})[\- ]+(?P[0-9]+):(?P[0-9]+):(?P[0-9]+)", info[key]) - datetimestr = "2000/01/01 00:00:00" # default used if time not found (stops import crashing, but startTime will be wrong) + datetimestr = "2000/01/01 00:00:00" # default used if time not found 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')) #tz = a.group('TZ') # just assume ET?? @@ -236,12 +232,15 @@ class PokerStars(HandHistoryConverter): hand.tourNo = info[key] if key == 'BUYIN': if hand.tourNo!=None: + #print "DEBUG: info['BUYIN']: %s" % info['BUYIN'] + #print "DEBUG: info['BIAMT']: %s" % info['BIAMT'] + #print "DEBUG: info['BIRAKE']: %s" % info['BIRAKE'] + #print "DEBUG: info['BOUNTY']: %s" % info['BOUNTY'] if info[key] == 'Freeroll': hand.buyin = 0 hand.fee = 0 hand.buyinCurrency = "FREE" else: - #print "info[key]:",info[key] if info[key].find("$")!=-1: hand.buyinCurrency="USD" elif info[key].find(u"€")!=-1: @@ -249,13 +248,13 @@ class PokerStars(HandHistoryConverter): elif info[key].find("FPP")!=-1: hand.buyinCurrency="PSFP" else: - raise FpdbParseError("failed to detect currency") #FIXME: handle other currencies, FPP, play money + #FIXME: handle other currencies, FPP, play money + raise FpdbParseError("failed to detect currency") 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:])) + hand.buyin = int(100*Decimal(info['BIAMT'][1:])) + hand.fee = int(100*Decimal(info['BIRAKE'][1:])) + # TODO: Bounty is in key 'BOUNTY' elif hand.buyinCurrency=="PSFP": hand.buyin = int(Decimal(info[key][0:-3])) hand.fee = 0 From 223f7441b6254c4b7da107ad7ad6f4ba37fe81ad Mon Sep 17 00:00:00 2001 From: grindi Date: Sat, 31 Jul 2010 14:38:24 +0400 Subject: [PATCH 42/45] Fixes for absolute poker Note: previous xtables's re doesn't match java absolute client --- pyfpdb/AbsoluteToFpdb.py | 32 ++++++++++++++++++-------------- pyfpdb/XTables.py | 2 +- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/pyfpdb/AbsoluteToFpdb.py b/pyfpdb/AbsoluteToFpdb.py index 26aea7e8..31e21764 100755 --- a/pyfpdb/AbsoluteToFpdb.py +++ b/pyfpdb/AbsoluteToFpdb.py @@ -42,10 +42,10 @@ class Absolute(HandHistoryConverter): #Seat 6 - FETS63 ($0.75 in chips) #Board [10s 5d Kh Qh 8c] - re_GameInfo = re.compile(ur"^Stage #([0-9]+): (?PHoldem|HORSE)(?: \(1 on 1\)|)? ?(?PNo Limit|Pot Limit|Normal|)? ?(?P\$| €|)(?P[.0-9]+)/?(?:\$| €|)(?P[.0-9]+)?", re.MULTILINE) + re_GameInfo = re.compile(ur"^Stage #(C?[0-9]+): (?PHoldem|HORSE)(?: \(1 on 1\)|)? ?(?PNo Limit|Pot Limit|Normal|)? ?(?P\$| €|)(?P[.0-9]+)/?(?:\$| €|)(?P[.0-9]+)?", re.MULTILINE) re_HorseGameInfo = re.compile(ur"^Game Type: (?PLimit) (?PHoldem)", re.MULTILINE) # TODO: can set max seats via (1 on 1) to a known 2 .. - re_HandInfo = re.compile(ur"^Stage #(?P[0-9]+): .*(?P\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d).*\n(Table: (?P.*) \(Real Money\))?", re.MULTILINE) + re_HandInfo = re.compile(ur"^Stage #C?(?P[0-9]+): .*(?P\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d).*\n(Table: (?P
.*) \(Real Money\))?", re.MULTILINE) re_TableFromFilename = re.compile(ur".*IHH([0-9]+) (?P
.*) -") # on HORSE STUD games, the table name isn't in the hand info! re_Button = re.compile(ur"Seat #(?P