Moved window title re to HHC classes
Just redefine function getTableTitleRe in coresponding hhc for custom re
This commit is contained in:
parent
f99c4baa8b
commit
9dd600702a
|
@ -53,6 +53,7 @@ import gobject
|
|||
# FreePokerTools modules
|
||||
import Configuration
|
||||
import Database
|
||||
from HandHistoryConverter import getTableTitleRe
|
||||
# get the correct module for the current os
|
||||
if os.name == 'posix':
|
||||
import XTables as Tables
|
||||
|
@ -253,10 +254,10 @@ class HUD_main(object):
|
|||
if comm_cards != {}: # stud!
|
||||
cards['common'] = comm_cards['common']
|
||||
|
||||
if type == "tour":
|
||||
tablewindow = Tables.Table(tournament = tour_number, table_number = tab_number)
|
||||
else:
|
||||
tablewindow = Tables.Table(table_name = table_name)
|
||||
table_kwargs = dict(table_name = table_name, tournament = tour_number, table_number = tab_number)
|
||||
search_string = getTableTitleRe(self.config, site, type, **table_kwargs)
|
||||
tablewindow = Tables.Table(search_string, **table_kwargs)
|
||||
|
||||
if tablewindow is None:
|
||||
# If no client window is found on the screen, complain and continue
|
||||
if type == "tour":
|
||||
|
|
|
@ -506,3 +506,26 @@ or None if we fail to get the info """
|
|||
|
||||
def getTourney(self):
|
||||
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])
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -93,19 +93,17 @@ gobject.signal_new("client_destroyed", gtk.Window,
|
|||
# screen location of (0, 0) in the working window.
|
||||
|
||||
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:
|
||||
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:
|
||||
if tournament is not None and table_number is not None:
|
||||
print "tournament %s, table %s" % (tournament, table_number)
|
||||
self.tournament = int(tournament)
|
||||
self.table = int(table_number)
|
||||
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:
|
||||
return None
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user