Merge branch 'master' of git://git.assembla.com/free_poker_tools

Conflicts:

	pyfpdb/fpdb_simple.py
This commit is contained in:
Worros 2009-04-10 00:19:32 +08:00
commit 5a737624c9
8 changed files with 143 additions and 45 deletions

View File

@ -1,8 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<FreePokerToolsConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FreePokerToolsConfig.xsd">
<import callFpdbHud = "True" interval = "10" fastStoreHudCache="False" hhArchiveBase="~/.fpdb/HandHistories/" saveActions="True"></import>
<supported_sites>
<site enabled="True" site_name="PokerStars" table_finder="PokerStars.exe" screen_name="DO NOT NEED THIS YET" site_path="~/.wine/drive_c/Program Files/PokerStars/" HH_path="~/.wine/drive_c/Program Files/PokerStars/HandHistory/abc/" decoder="pokerstars_decode_table" converter="passthrough" supported_games="holdem,razz,omahahi,omahahilo,studhi,studhilo">
<site enabled="True"
site_name="PokerStars"
table_finder="PokerStars.exe"
screen_name="YOUR SCREEN NAME HERE"
site_path="C:/Program Files/PokerStars/"
HH_path="C:/Program Files/PokerStars/HandHistory/YOUR SCREEN NAME HERE/"
decoder="pokerstars_decode_table"
bgcolor="#000000"
fgcolor="#FFFFFF"
hudopacity="1.0"
font="Sans"
font_size="8"
converter="passthrough"
supported_games="holdem,razz,omahahi,omahahilo,studhi,studhilo">
<layout max="8" width="792" height="546" fav_seat="0">
<location seat="1" x="684" y="61"> </location>
<location seat="2" x="689" y="239"> </location>
@ -49,7 +66,21 @@
<location seat="2" x="10" y="288"> </location>
</layout>
</site>
<site enabled="True" site_name="Full Tilt Poker" table_finder="FullTiltPoker.exe" screen_name="DO NOT NEED THIS YET" site_path="~/.wine/drive_c/Program Files/Full Tilt Poker/" HH_path="~/.wine/drive_c/Program Files/Full Tilt Poker/HandHistory/abc/" decoder="fulltilt_decode_table" converter="passthrough" supported_games="holdem,razz,omahahi,omahahilo,studhi,studhilo">
<site enabled="True"
site_name="Full Tilt Poker"
table_finder="FullTiltPoker"
screen_name="YOUR SCREEN NAME HERE"
site_path="C:/Program Files/Full Tilt Poker/"
HH_path="C:/Program Files/Full Tilt Poker/HandHistory/YOUR SCREEN NAME HERE/"
decoder="fulltilt_decode_table"
bgcolor="#000000"
fgcolor="#FFFFFF"
hudopacity="1.0"
font="Sans"
font_size="8"
converter="passthrough"
supported_games="holdem,razz,omahahi,omahahilo,studhi,studhilo">
<layout fav_seat="0" height="547" max="8" width="794">
<location seat="1" x="640" y="64"> </location>
<location seat="2" x="650" y="230"> </location>
@ -84,7 +115,16 @@
<location seat="9" x="70" y="53"> </location>
</layout>
</site>
<site enabled="False" site_name="Everleaf" table_finder="Everleaf.exe" screen_name="DO NOT NEED THIS YET" site_path="" HH_path="" decoder="everleaf_decode_table" converter="EverleafToFpdb" supported_games="holdem">
<site enabled="False"
site_name="Everleaf"
table_finder="Everleaf.exe"
screen_name="YOUR SCREEN NAME HERE"
site_path=""
HH_path=""
decoder="everleaf_decode_table"
converter="EverleafToFpdb"
supported_games="holdem">
<layout fav_seat="0" height="547" max="8" width="794">
<location seat="1" x="640" y="64"> </location>
<location seat="2" x="650" y="230"> </location>
@ -120,8 +160,10 @@
</layout>
</site>
</supported_sites>
<supported_games>
<game cols="3" db="fpdb" game_name="holdem" rows="2">
<game cols="3" db="fpdb" game_name="holdem" rows="2" aux="mucked">
<stat click="tog_decorate" col="0" popup="default" row="0" stat_name="vpip" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="0" stat_name="pfr" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="0" stat_name="ffreq_1" tip="tip1"> </stat>
@ -129,7 +171,8 @@
<stat click="tog_decorate" col="1" popup="default" row="1" stat_name="wtsd" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="1" stat_name="wmsd" tip="tip1"> </stat>
</game>
<game cols="3" db="fpdb" game_name="razz" rows="2">
<game cols="3" db="fpdb" game_name="razz" rows="2" aux="stud_mucked">
<stat click="tog_decorate" col="0" popup="default" row="0" stat_name="vpip" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="0" stat_name="pfr" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="0" stat_name="ffreq_1" tip="tip1"> </stat>
@ -137,7 +180,8 @@
<stat click="tog_decorate" col="1" popup="default" row="1" stat_name="wtsd" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="1" stat_name="wmsd" tip="tip1"> </stat>
</game>
<game cols="3" db="fpdb" game_name="omahahi" rows="2">
<game cols="3" db="fpdb" game_name="omahahi" rows="2" aux="mucked">
<stat click="tog_decorate" col="0" popup="default" row="0" stat_name="vpip" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="0" stat_name="pfr" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="0" stat_name="ffreq_1" tip="tip1"> </stat>
@ -145,7 +189,8 @@
<stat click="tog_decorate" col="1" popup="default" row="1" stat_name="wtsd" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="1" stat_name="wmsd" tip="tip1"> </stat>
</game>
<game cols="3" db="fpdb" game_name="omahahilo" rows="2">
<game cols="3" db="fpdb" game_name="omahahilo" rows="2" aux="mucked">
<stat click="tog_decorate" col="0" popup="default" row="0" stat_name="vpip" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="0" stat_name="pfr" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="0" stat_name="ffreq_1" tip="tip1"> </stat>
@ -153,7 +198,8 @@
<stat click="tog_decorate" col="1" popup="default" row="1" stat_name="wtsd" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="1" stat_name="wmsd" tip="tip1"> </stat>
</game>
<game cols="3" db="fpdb" game_name="studhi" rows="2">
<game cols="3" db="fpdb" game_name="studhi" rows="2" aux="stud_mucked">
<stat click="tog_decorate" col="0" popup="default" row="0" stat_name="vpip" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="0" stat_name="pfr" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="0" stat_name="ffreq_1" tip="tip1"> </stat>
@ -161,7 +207,8 @@
<stat click="tog_decorate" col="1" popup="default" row="1" stat_name="wtsd" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="1" stat_name="wmsd" tip="tip1"> </stat>
</game>
<game cols="3" db="fpdb" game_name="studhilo" rows="2">
<game cols="3" db="fpdb" game_name="studhilo" rows="2" aux="stud_mucked">
<stat click="tog_decorate" col="0" popup="default" row="0" stat_name="vpip" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="0" stat_name="pfr" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="0" stat_name="ffreq_1" tip="tip1"> </stat>
@ -170,6 +217,7 @@
<stat click="tog_decorate" col="2" popup="default" row="1" stat_name="wmsd" tip="tip1"> </stat>
</game>
</supported_games>
<popup_windows>
<pu pu_name="default">
<pu_stat pu_stat_name="n"> </pu_stat>
@ -196,15 +244,54 @@
<pu_stat pu_stat_name="ffreq_4"> </pu_stat>
</pu>
</popup_windows>
<import callFpdbHud = "True" interval = "10" ></import>
<tv combinedStealFold = "True" combined2B3B = "True" combinedPostflop = "True"></tv>
<aux_windows>
<aw card_ht="42" card_wd="30" class="Stud_mucked" cols="11" deck="Cards01.png" module="Mucked" name="stud_mucked" rows="8"> </aw>
<aw class="Hello" module="Hello" name="Hello"> </aw>
<aw class="Hello_Menu" module="Hello" name="Hello_menu"> </aw>
<aw class="Hello_plus" module="Hello" name="Hello_plus"> </aw>
<aw card_ht="42" card_wd="30" class="Flop_Mucked" deck="Cards01.png" module="Mucked" name="mucked" opacity="0.7" timeout="5">
<layout height="546" max="6" width="792">
<location seat="1" x="555" y="169"> </location>
<location seat="2" x="572" y="276"> </location>
<location seat="3" x="363" y="348"> </location>
<location seat="4" x="150" y="273"> </location>
<location seat="5" x="150" y="169"> </location>
<location seat="6" x="363" y="113"> </location>
<location common="1" x="323" y="232"> </location>
</layout>
<layout height="546" max="9" width="792">
<location seat="1" x="486" y="113"> </location>
<location seat="2" x="555" y="169"> </location>
<location seat="3" x="572" y="276"> </location>
<location seat="4" x="522" y="345"> </location>
<location seat="5" x="363" y="348"> </location>
<location seat="6" x="217" y="341"> </location>
<location seat="7" x="150" y="273"> </location>
<location seat="8" x="150" y="169"> </location>
<location seat="9" x="230" y="115"> </location>
<location common="1" x="323" y="232"> </location>
</layout>
<layout height="546" max="10" width="792">
<location seat="1" x="486" y="113"> </location>
<location seat="2" x="499" y="138"> </location>
<location seat="3" x="522" y="212"> </location>
<location seat="4" x="501" y="281"> </location>
<location seat="5" x="402" y="323"> </location>
<location seat="6" x="243" y="311"> </location>
<location seat="7" x="203" y="262"> </location>
<location seat="8" x="170" y="185"> </location>
<location seat="9" x="183" y="128"> </location>
<location seat="10" x="213" y="86"> </location>
<location common="1" x="317" y="237"> </location>
</layout>
</aw>
</aux_windows>
<supported_databases>
<database db_name="fpdb" db_server="mysql" db_ip="localhost" db_user="fpdb" db_pass="YOUR MYSQL PASSWORD" db_type="fpdb"> </database>
<database db_name="fpdb" db_server="mysql" db_ip="localhost" db_user="fpdb" db_pass="YOUR MYSQL PASSWORD" db_type="fpdb"></database>
</supported_databases>
<mucked_windows>
<mw mw_name="stud1" format="stud" rows="8" cols="11" deck="Cards01.png" card_wd="30" card_ht="42"> </mw>
</mucked_windows>
</FreePokerToolsConfig>

View File

@ -51,6 +51,8 @@ import Database
import Tables
import Hud
aggregate_stats = {"ring": False, "tour": False} # config file!
class HUD_main(object):
"""A main() object to own both the read_stdin thread and the gui."""
# This class mainly provides state for controlling the multiple HUDs.
@ -85,7 +87,7 @@ class HUD_main(object):
del(self.hud_dict[table])
self.main_window.resize(1,1)
def create_HUD(self, new_hand_id, table, table_name, max, poker_game, is_tournament, stat_dict, cards):
def create_HUD(self, new_hand_id, table, table_name, max, poker_game, stat_dict, cards):
def idle_func():
@ -108,9 +110,9 @@ class HUD_main(object):
gtk.gdk.threads_leave()
self.hud_dict[table_name] = Hud.Hud(self, table, max, poker_game, self.config, self.db_connection)
self.hud_dict[table_name].table_name = table_name
self.hud_dict[table_name].stat_dict = stat_dict
self.hud_dict[table_name].cards = cards
[aw.update_data(new_hand_id, self.db_connection) for aw in self.hud_dict[table_name].aux_windows]
gobject.idle_add(idle_func)
@ -149,8 +151,8 @@ class HUD_main(object):
# get basic info about the new hand from the db
# if there is a db error, complain, skip hand, and proceed
try:
(table_name, max, poker_game) = self.db_connection.get_table_name(new_hand_id)
stat_dict = self.db_connection.get_stats_from_hand(new_hand_id)
(table_name, max, poker_game, type) = self.db_connection.get_table_name(new_hand_id)
stat_dict = self.db_connection.get_stats_from_hand(new_hand_id, aggregate = aggregate_stats[type])
cards = self.db_connection.get_cards(new_hand_id)
comm_cards = self.db_connection.get_common_cards(new_hand_id)
if comm_cards != {}: # stud!
@ -160,15 +162,17 @@ class HUD_main(object):
sys.stderr.write("Database error %s in hand %d. Skipping.\n" % (err, int(new_hand_id)))
continue
# find out if this hand is from a tournament
mat_obj = tourny_finder.search(table_name)
if mat_obj:
is_tournament = True
(tour_number, tab_number) = mat_obj.group(1, 2)
temp_key = tour_number
if type == "tour": # hand is from a tournament
mat_obj = tourny_finder.search(table_name)
if mat_obj:
(tour_number, tab_number) = mat_obj.group(1, 2)
temp_key = tour_number
else: # tourney, but can't get number and table
print "could not find tournamtne: skipping "
sys.stderr.write("Could not find tournament %d in hand %d. Skipping.\n" % (int(tour_number), int(new_hand_id)))
continue
else:
is_tournament = False
(tour_number, tab_number) = (0, 0)
temp_key = table_name
# Update an existing HUD
@ -180,18 +184,17 @@ class HUD_main(object):
# Or create a new HUD
else:
if is_tournament:
if type == "tour":
tablewindow = Tables.discover_tournament_table(self.config, tour_number, tab_number)
else:
tablewindow = Tables.discover_table_by_name(self.config, table_name)
if tablewindow == None:
# If no client window is found on the screen, complain and continue
if is_tournament:
if type == "tour":
table_name = "%s %s" % (tour_number, tab_number)
sys.stderr.write("table name "+table_name+" not found, skipping.\n")
else:
self.create_HUD(new_hand_id, tablewindow, temp_key, max, poker_game, is_tournament, stat_dict, cards)
self.create_HUD(new_hand_id, tablewindow, temp_key, max, poker_game, stat_dict, cards)
if __name__== "__main__":
sys.stderr.write("HUD_main starting\n")

View File

@ -125,7 +125,7 @@ class Hud:
self.menu = gtk.Menu()
self.item1 = gtk.MenuItem('Kill this HUD')
self.menu.append(self.item1)
self.item1.connect("activate", self.parent.kill_hud, self.table.name)
self.item1.connect("activate", self.parent.kill_hud, self.table_name)
self.item1.show()
self.item2 = gtk.MenuItem('Save Layout')
@ -204,14 +204,14 @@ class Hud:
def reposition_windows(self, *args):
for w in self.stat_windows.itervalues():
if type(w) == int:
print "in reposition, w =", w
# print "in reposition, w =", w
continue
print "in reposition, w =", w, w.x, w.y
# print "in reposition, w =", w, w.x, w.y
w.window.move(w.x, w.y)
return True
def debug_stat_windows(self, *args):
print self.table, "\n", self.main_window.window.get_transient_for()
# print self.table, "\n", self.main_window.window.get_transient_for()
for w in self.stat_windows:
print self.stat_windows[w].window.window.get_transient_for()

View File

@ -451,7 +451,7 @@ class Flop_Mucked(Aux_Window):
def save_layout(self, *args):
"""Save new layout back to the aux element in the config file."""
new_locs = {}
print "adj =", self.adj
# print "adj =", self.adj
for (i, pos) in self.positions.iteritems():
if i != 'common':
new_locs[self.adj[int(i)]] = (pos[0] - self.hud.table.x, pos[1] - self.hud.table.y)

View File

@ -331,7 +331,7 @@ class Sql:
"""
self.query['get_table_name'] = """
select tableName, maxSeats, category
select tableName, maxSeats, category, type
from Hands,Gametypes
where Hands.id = %s
and Gametypes.id = Hands.gametypeId

View File

@ -135,7 +135,7 @@ def discover_posix(c):
if re.search(params['table_finder'], listing):
if 'Lobby' in listing: continue
if 'Instant Hand History' in listing: continue
if '\"Full Tilt Poker\"' in listing: continue
# if '\"Full Tilt Poker\"' in listing: continue
if 'History for table:' in listing: continue
if 'has no name' in listing: continue
info = decode_xwininfo(c, listing)
@ -387,7 +387,7 @@ def discover_mac_by_name(c, tablename):
if __name__=="__main__":
c = Configuration.Config()
print discover_table_by_name(c, "Ringe")
print discover_table_by_name(c, "Torino")
# print discover_tournament_table(c, "118942908", "3")
tables = discover(c)

View File

@ -47,7 +47,7 @@ import GuiGraphViewer
import FpdbSQLQueries
import Configuration
VERSION = "0.10"
VERSION = "0.11"
class fpdb:
def tab_clicked(self, widget, tab_name):

View File

@ -869,11 +869,19 @@ def goesAllInOnThisLine(line):
#end def goesAllInOnThisLine
#returns the action type code (see table design) of the given action line
ActionTypes = { 'calls':"call", 'brings in for':"blind", 'completes it to':"bet", ' posts $':"blind",
' posts a dead ' : "blind", ' posts the small blind of $':"blind", ': posts big blind ':"blind",
' posts the big blind of $':"blind", ': posts small & big blinds $':"blind",
': posts small blind $':"blind", ': posts small blind ':"blind",
' bets' : "bet", ' raises' : "bet"
ActionTypes = { 'brings in for' :"blind",
' posts $' :"blind",
' posts a dead ' :"blind",
' posts the small blind of $' :"blind",
': posts big blind ' :"blind",
': posts small blind ' :"blind",
' posts the big blind of $' :"blind",
': posts small & big blinds $' :"blind",
': posts small blind $' :"blind",
'calls' :"call",
'completes it to' :"bet",
' bets' :"bet",
' raises' :"bet"
}
def parseActionType(line):
if (line.startswith("Uncalled bet")):