Merge branch 'master' of git://github.com/grindi/fpdb-grindi
This commit is contained in:
commit
4e78dd8d93
|
@ -9,8 +9,8 @@ class FpdbParseError(FpdbError):
|
||||||
self.value = value
|
self.value = value
|
||||||
self.hid = hid
|
self.hid = hid
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
if hid:
|
if self.hid:
|
||||||
return repr("HID:"+hid+", "+self.value)
|
return repr("HID:"+self.hid+", "+self.value)
|
||||||
else:
|
else:
|
||||||
return repr(self.value)
|
return repr(self.value)
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@ import gobject
|
||||||
# FreePokerTools modules
|
# FreePokerTools modules
|
||||||
import Configuration
|
import Configuration
|
||||||
import Database
|
import Database
|
||||||
|
from HandHistoryConverter import getTableTitleRe
|
||||||
# get the correct module for the current os
|
# get the correct module for the current os
|
||||||
if os.name == 'posix':
|
if os.name == 'posix':
|
||||||
import XTables as Tables
|
import XTables as Tables
|
||||||
|
@ -253,10 +254,10 @@ class HUD_main(object):
|
||||||
if comm_cards != {}: # stud!
|
if comm_cards != {}: # stud!
|
||||||
cards['common'] = comm_cards['common']
|
cards['common'] = comm_cards['common']
|
||||||
|
|
||||||
if type == "tour":
|
table_kwargs = dict(table_name = table_name, tournament = tour_number, table_number = tab_number)
|
||||||
tablewindow = Tables.Table(tournament = tour_number, table_number = tab_number)
|
search_string = getTableTitleRe(self.config, site, type, **table_kwargs)
|
||||||
else:
|
tablewindow = Tables.Table(search_string, **table_kwargs)
|
||||||
tablewindow = Tables.Table(table_name = table_name)
|
|
||||||
if tablewindow is None:
|
if tablewindow is None:
|
||||||
# If no client window is found on the screen, complain and continue
|
# If no client window is found on the screen, complain and continue
|
||||||
if type == "tour":
|
if type == "tour":
|
||||||
|
|
|
@ -147,6 +147,7 @@ Otherwise, finish at EOF.
|
||||||
except FpdbParseError, e:
|
except FpdbParseError, e:
|
||||||
numErrors += 1
|
numErrors += 1
|
||||||
log.warning("Failed to convert hand %s" % e.hid)
|
log.warning("Failed to convert hand %s" % e.hid)
|
||||||
|
log.warning("Exception msg: '%s'" % str(e))
|
||||||
log.debug(handText)
|
log.debug(handText)
|
||||||
else:
|
else:
|
||||||
handsList = self.allHandsAsList()
|
handsList = self.allHandsAsList()
|
||||||
|
@ -161,6 +162,7 @@ Otherwise, finish at EOF.
|
||||||
except FpdbParseError, e:
|
except FpdbParseError, e:
|
||||||
numErrors += 1
|
numErrors += 1
|
||||||
log.warning("Failed to convert hand %s" % e.hid)
|
log.warning("Failed to convert hand %s" % e.hid)
|
||||||
|
log.warning("Exception msg: '%s'" % str(e))
|
||||||
log.debug(handText)
|
log.debug(handText)
|
||||||
numHands = len(handsList)
|
numHands = len(handsList)
|
||||||
endtime = time.time()
|
endtime = time.time()
|
||||||
|
@ -499,3 +501,26 @@ or None if we fail to get the info """
|
||||||
|
|
||||||
def getTourney(self):
|
def getTourney(self):
|
||||||
return self.tourney
|
return self.tourney
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def getTableTitleRe(type, table_name=None, tournament = None, table_number=None):
|
||||||
|
"Returns string to search in windows titles"
|
||||||
|
if type=="tour":
|
||||||
|
return "%s.+Table\s%s" % (tournament, table_number)
|
||||||
|
else:
|
||||||
|
return table_name
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def getTableTitleRe(config, sitename, *args, **kwargs):
|
||||||
|
"Returns string to search in windows titles for current site"
|
||||||
|
return getSiteHhc(config, sitename).getTableTitleRe(*args, **kwargs)
|
||||||
|
|
||||||
|
def getSiteHhc(config, sitename):
|
||||||
|
"Returns HHC class for current site"
|
||||||
|
hhcName = config.supported_sites[sitename].converter
|
||||||
|
hhcModule = __import__(hhcName)
|
||||||
|
return getattr(hhcModule, hhcName[:-6])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -386,9 +386,9 @@ class Hud:
|
||||||
(x, y) = loc[adj[i+1]]
|
(x, y) = loc[adj[i+1]]
|
||||||
w.relocate(x, y)
|
w.relocate(x, y)
|
||||||
|
|
||||||
# While we're at it, fix the positions of mucked cards too
|
# While we're at it, fix the positions of mucked cards too
|
||||||
for aux in self.aux_windows:
|
for aux in self.aux_windows:
|
||||||
aux.update_card_positions()
|
aux.update_card_positions()
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -440,7 +440,7 @@ class Hud:
|
||||||
new_layout[self.stat_windows[sw].adj - 1] = new_loc
|
new_layout[self.stat_windows[sw].adj - 1] = new_loc
|
||||||
self.config.edit_layout(self.table.site, self.max, locations = new_layout)
|
self.config.edit_layout(self.table.site, self.max, locations = new_layout)
|
||||||
# ask each aux to save its layout back to the config object
|
# ask each aux to save its layout back to the config object
|
||||||
(aux.save_layout() for aux in self.aux_windows)
|
[aux.save_layout() for aux in self.aux_windows]
|
||||||
# save the config object back to the file
|
# save the config object back to the file
|
||||||
print "saving new xml file"
|
print "saving new xml file"
|
||||||
self.config.save()
|
self.config.save()
|
||||||
|
|
|
@ -93,19 +93,17 @@ gobject.signal_new("client_destroyed", gtk.Window,
|
||||||
# screen location of (0, 0) in the working window.
|
# screen location of (0, 0) in the working window.
|
||||||
|
|
||||||
class Table_Window(object):
|
class Table_Window(object):
|
||||||
def __init__(self, table_name = None, tournament = None, table_number = None):
|
def __init__(self, search_string, table_name = None, tournament = None, table_number = None):
|
||||||
|
|
||||||
if table_name is not None:
|
if tournament is not None and table_number is not None:
|
||||||
search_string = table_name
|
|
||||||
self.name = table_name
|
|
||||||
self.tournament = None
|
|
||||||
self.table = None
|
|
||||||
elif tournament is not None and table_number is not None:
|
|
||||||
print "tournament %s, table %s" % (tournament, table_number)
|
print "tournament %s, table %s" % (tournament, table_number)
|
||||||
self.tournament = int(tournament)
|
self.tournament = int(tournament)
|
||||||
self.table = int(table_number)
|
self.table = int(table_number)
|
||||||
self.name = "%s - %s" % (self.tournament, self.table)
|
self.name = "%s - %s" % (self.tournament, self.table)
|
||||||
search_string = "%s.+Table\s%s" % (tournament, table_number)
|
elif table_name is not None:
|
||||||
|
search_string = table_name
|
||||||
|
self.name = table_name
|
||||||
|
self.tournament = None
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -151,4 +149,4 @@ class Table_Window(object):
|
||||||
def check_bad_words(self, title):
|
def check_bad_words(self, title):
|
||||||
for word in bad_words:
|
for word in bad_words:
|
||||||
if word in title: return True
|
if word in title: return True
|
||||||
return False
|
return False
|
||||||
|
|
Loading…
Reference in New Issue
Block a user