Merge branch 'master' of git://git.assembla.com/fpdb-eric
This commit is contained in:
commit
39fdcd6be3
|
@ -191,7 +191,7 @@ class Betfair(HandHistoryConverter):
|
|||
elif action.group('ATYPE') == 'checks':
|
||||
hand.addCheck( street, action.group('PNAME'))
|
||||
else:
|
||||
print "DEBUG: unimplemented readAction: '%s' '%s'" %(action.group('PNAME'),action.group('ATYPE'),)
|
||||
sys.stderr.write( "DEBUG: unimplemented readAction: '%s' '%s'" %(action.group('PNAME'),action.group('ATYPE'),))
|
||||
|
||||
|
||||
def readShowdownActions(self, hand):
|
||||
|
|
|
@ -67,7 +67,7 @@ class CarbonPoker(HandHistoryConverter):
|
|||
if(type == "Holdem"):
|
||||
gametype = gametype + ["hold"]
|
||||
else:
|
||||
print "Unknown gametype: '%s'" % (type)
|
||||
print "Carbon: Unknown gametype: '%s'" % (type)
|
||||
|
||||
stakes = desc_node[0].getAttribute("stakes")
|
||||
#TODO: no examples of anything except nlhe
|
||||
|
|
|
@ -111,24 +111,17 @@ class Site:
|
|||
self.ypad = node.getAttribute("ypad")
|
||||
self.layout = {}
|
||||
|
||||
print self.site_name, self.HH_path
|
||||
print "Loading site", self.site_name
|
||||
|
||||
for layout_node in node.getElementsByTagName('layout'):
|
||||
lo = Layout(layout_node)
|
||||
self.layout[lo.max] = lo
|
||||
|
||||
# Site defaults
|
||||
if self.xpad == "": self.xpad = 1
|
||||
else: self.xpad = int(self.xpad)
|
||||
|
||||
if self.ypad == "": self.ypad = 0
|
||||
else: self.ypad = int(self.ypad)
|
||||
|
||||
if self.font_size == "": self.font_size = 7
|
||||
else: self.font_size = int(self.font_size)
|
||||
|
||||
if self.hudopacity == "": self.hudopacity = 1.0
|
||||
else: self.hudopacity = float(self.hudopacity)
|
||||
self.xpad = 1 if self.xpad == "" else int(self.xpad)
|
||||
self.ypad = 0 if self.ypad == "" else int(self.ypad)
|
||||
self.font_size = 7 if self.font_size == "" else int(self.font_size)
|
||||
self.hudopacity = 1.0 if self.hudopacity == "" else float(self.hudopacity)
|
||||
|
||||
if self.use_frames == "": self.use_frames = False
|
||||
if self.font == "": self.font = "Sans"
|
||||
|
@ -323,22 +316,20 @@ class Config:
|
|||
# we check the existence of "file" and try to recover if it doesn't exist
|
||||
|
||||
self.default_config_path = self.get_default_config_path()
|
||||
if file != None: # configuration file path has been passed
|
||||
if file is not None: # config file path passed in
|
||||
file = os.path.expanduser(file)
|
||||
if not os.path.exists(file):
|
||||
print "Configuration file %s not found. Using defaults." % (file)
|
||||
sys.stderr.write("Configuration file %s not found. Using defaults." % (file))
|
||||
file = None
|
||||
|
||||
if file == None: # configuration file path not passed or invalid
|
||||
if file is None: # configuration file path not passed or invalid
|
||||
file = self.find_config() #Look for a config file in the normal places
|
||||
|
||||
if file == None: # no config file in the normal places
|
||||
if file is None: # no config file in the normal places
|
||||
file = self.find_example_config() #Look for an example file to edit
|
||||
if file != None:
|
||||
pass
|
||||
|
||||
if file == None: # that didn't work either, just die
|
||||
if file is None: # that didn't work either, just die
|
||||
print "No HUD_config_xml found after looking in current directory and "+self.default_config_path+"\nExiting"
|
||||
sys.stderr.write("No HUD_config_xml found after looking in current directory and "+self.default_config_path+"\nExiting")
|
||||
print "press enter to continue"
|
||||
|
@ -436,7 +427,7 @@ class Config:
|
|||
db = self.get_db_parameters()
|
||||
if db['db-password'] == 'YOUR MYSQL PASSWORD':
|
||||
df_file = self.find_default_conf()
|
||||
if df_file == None: # this is bad
|
||||
if df_file is None: # this is bad
|
||||
pass
|
||||
else:
|
||||
df_parms = self.read_default_conf(df_file)
|
||||
|
@ -527,7 +518,7 @@ class Config:
|
|||
|
||||
def get_layout_node(self, site_node, layout):
|
||||
for layout_node in site_node.getElementsByTagName("layout"):
|
||||
if layout_node.getAttribute("max") == None:
|
||||
if layout_node.getAttribute("max") is None:
|
||||
return None
|
||||
if int( layout_node.getAttribute("max") ) == int( layout ):
|
||||
return layout_node
|
||||
|
@ -543,7 +534,7 @@ class Config:
|
|||
return location_node
|
||||
|
||||
def save(self, file = None):
|
||||
if file != None:
|
||||
if file is not None:
|
||||
with open(file, 'w') as f:
|
||||
self.doc.writexml(f)
|
||||
else:
|
||||
|
@ -556,7 +547,7 @@ class Config:
|
|||
site_node = self.get_site_node(site_name)
|
||||
layout_node = self.get_layout_node(site_node, max)
|
||||
# TODO: how do we support inserting new layouts?
|
||||
if layout_node == None:
|
||||
if layout_node is None:
|
||||
return
|
||||
for i in range(1, max + 1):
|
||||
location_node = self.get_location_node(layout_node, i)
|
||||
|
@ -567,7 +558,7 @@ class Config:
|
|||
def edit_aux_layout(self, aux_name, max, width = None, height = None, locations = None):
|
||||
aux_node = self.get_aux_node(aux_name)
|
||||
layout_node = self.get_layout_node(aux_node, max)
|
||||
if layout_node == None:
|
||||
if layout_node is None:
|
||||
print "aux node not found"
|
||||
return
|
||||
print "editing locations =", locations
|
||||
|
@ -615,17 +606,17 @@ class Config:
|
|||
db_pass = None, db_server = None, db_type = None):
|
||||
db_node = self.get_db_node(db_name)
|
||||
if db_node != None:
|
||||
if db_ip != None: db_node.setAttribute("db_ip", db_ip)
|
||||
if db_user != None: db_node.setAttribute("db_user", db_user)
|
||||
if db_pass != None: db_node.setAttribute("db_pass", db_pass)
|
||||
if db_server != None: db_node.setAttribute("db_server", db_server)
|
||||
if db_type != None: db_node.setAttribute("db_type", db_type)
|
||||
if db_ip is not None: db_node.setAttribute("db_ip", db_ip)
|
||||
if db_user is not None: db_node.setAttribute("db_user", db_user)
|
||||
if db_pass is not None: db_node.setAttribute("db_pass", db_pass)
|
||||
if db_server is not None: db_node.setAttribute("db_server", db_server)
|
||||
if db_type is not None: db_node.setAttribute("db_type", db_type)
|
||||
if self.supported_databases.has_key(db_name):
|
||||
if db_ip != None: self.supported_databases[db_name].dp_ip = db_ip
|
||||
if db_user != None: self.supported_databases[db_name].dp_user = db_user
|
||||
if db_pass != None: self.supported_databases[db_name].dp_pass = db_pass
|
||||
if db_server != None: self.supported_databases[db_name].dp_server = db_server
|
||||
if db_type != None: self.supported_databases[db_name].dp_type = db_type
|
||||
if db_ip is not None: self.supported_databases[db_name].dp_ip = db_ip
|
||||
if db_user is not None: self.supported_databases[db_name].dp_user = db_user
|
||||
if db_pass is not None: self.supported_databases[db_name].dp_pass = db_pass
|
||||
if db_server is not None: self.supported_databases[db_name].dp_server = db_server
|
||||
if db_type is not None: self.supported_databases[db_name].dp_type = db_type
|
||||
return
|
||||
|
||||
def getDefaultSite(self):
|
||||
|
@ -816,19 +807,19 @@ class Config:
|
|||
font = None, font_size = None):
|
||||
"""Sets the specified site parameters for the specified site."""
|
||||
site_node = self.get_site_node(site_name)
|
||||
if db_node != None:
|
||||
if converter != None: site_node.setAttribute("converter", converter)
|
||||
if decoder != None: site_node.setAttribute("decoder", decoder)
|
||||
if hudbgcolor != None: site_node.setAttribute("hudbgcolor", hudbgcolor)
|
||||
if hudfgcolor != None: site_node.setAttribute("hudfgcolor", hudfgcolor)
|
||||
if hudopacity != None: site_node.setAttribute("hudopacity", hudopacity)
|
||||
if screen_name != None: site_node.setAttribute("screen_name", screen_name)
|
||||
if site_path != None: site_node.setAttribute("site_path", site_path)
|
||||
if table_finder != None: site_node.setAttribute("table_finder", table_finder)
|
||||
if HH_path != None: site_node.setAttribute("HH_path", HH_path)
|
||||
if enabled != None: site_node.setAttribute("enabled", enabled)
|
||||
if font != None: site_node.setAttribute("font", font)
|
||||
if font_size != None: site_node.setAttribute("font_size", font_size)
|
||||
if db_node is not None:
|
||||
if converter is not None: site_node.setAttribute("converter", converter)
|
||||
if decoder is not None: site_node.setAttribute("decoder", decoder)
|
||||
if hudbgcolor is not None: site_node.setAttribute("hudbgcolor", hudbgcolor)
|
||||
if hudfgcolor is not None: site_node.setAttribute("hudfgcolor", hudfgcolor)
|
||||
if hudopacity is not None: site_node.setAttribute("hudopacity", hudopacity)
|
||||
if screen_name is not None: site_node.setAttribute("screen_name", screen_name)
|
||||
if site_path is not None: site_node.setAttribute("site_path", site_path)
|
||||
if table_finder is not None: site_node.setAttribute("table_finder", table_finder)
|
||||
if HH_path is not None: site_node.setAttribute("HH_path", HH_path)
|
||||
if enabled is not None: site_node.setAttribute("enabled", enabled)
|
||||
if font is not None: site_node.setAttribute("font", font)
|
||||
if font_size is not None: site_node.setAttribute("font_size", font_size)
|
||||
return
|
||||
|
||||
def get_aux_windows(self):
|
||||
|
|
|
@ -353,7 +353,7 @@ class Database:
|
|||
# else:
|
||||
# cards += ranks[d['card' + str(i) + 'Value']] + d['card' +str(i) + 'Suit']
|
||||
cv = "card%dvalue" % i
|
||||
if cv not in d or d[cv] == None:
|
||||
if cv not in d or d[cv] is None:
|
||||
break
|
||||
elif d[cv] == 0:
|
||||
cards += "xx"
|
||||
|
@ -395,7 +395,7 @@ class Database:
|
|||
row = c.fetchone()
|
||||
except: # TODO: what error is a database error?!
|
||||
err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
||||
print "*** Error: " + err[2] + "(" + str(err[1]) + "): " + str(sys.exc_info()[1])
|
||||
print "*** Database Error: " + err[2] + "(" + str(err[1]) + "): " + str(sys.exc_info()[1])
|
||||
else:
|
||||
if row and row[0]:
|
||||
self.hand_1day_ago = int(row[0])
|
||||
|
@ -421,10 +421,10 @@ class Database:
|
|||
if row and row[0]:
|
||||
self.date_nhands_ago[str(playerid)] = row[0]
|
||||
c.close()
|
||||
print "date n hands ago = " + self.date_nhands_ago[str(playerid)] + "(playerid "+str(playerid)+")"
|
||||
print "Database: date n hands ago = " + self.date_nhands_ago[str(playerid)] + "(playerid "+str(playerid)+")"
|
||||
except:
|
||||
err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
||||
print "***Error: "+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
||||
print "*** Database Error: "+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
||||
|
||||
def get_stats_from_hand( self, hand, type # type is "ring" or "tour"
|
||||
, hud_params = {'aggregate_tour':False, 'aggregate_ring':False, 'hud_style':'A', 'hud_days':30, 'agg_bb_mult':100
|
||||
|
@ -551,7 +551,7 @@ class Database:
|
|||
def get_player_names(self, config, site_id=None, like_player_name="%"):
|
||||
"""Fetch player names from players. Use site_id and like_player_name if provided"""
|
||||
|
||||
if site_id == None:
|
||||
if site_id is None:
|
||||
site_id = -1
|
||||
c = self.get_cursor()
|
||||
c.execute(self.sql.query['get_player_names'], (like_player_name, site_id, site_id))
|
||||
|
@ -657,7 +657,7 @@ class Database:
|
|||
except:
|
||||
ret = -1
|
||||
err = traceback.extract_tb(sys.exc_info()[2])
|
||||
print "***get_last_insert_id error: " + str(sys.exc_info()[1])
|
||||
print "*** Database get_last_insert_id error: " + str(sys.exc_info()[1])
|
||||
print "\n".join( [e[0]+':'+str(e[1])+" "+e[2] for e in err] )
|
||||
raise
|
||||
return ret
|
||||
|
@ -1183,7 +1183,7 @@ class Database:
|
|||
if p_id:
|
||||
self.hero_ids[site_id] = int(p_id)
|
||||
|
||||
if start == None:
|
||||
if start is None:
|
||||
start = self.hero_hudstart_def
|
||||
if self.hero_ids == {}:
|
||||
where = ""
|
||||
|
|
|
@ -305,10 +305,10 @@ class Filters(threading.Thread):
|
|||
print "self.limit[%s] set to %s" %(limit, self.limits[limit])
|
||||
if limit.isdigit() or (len(limit) > 2 and limit[-2:] == 'nl'):
|
||||
if self.limits[limit]:
|
||||
if self.cbNoLimits != None:
|
||||
if self.cbNoLimits is not None:
|
||||
self.cbNoLimits.set_active(False)
|
||||
else:
|
||||
if self.cbAllLimits != None:
|
||||
if self.cbAllLimits is not None:
|
||||
self.cbAllLimits.set_active(False)
|
||||
if not self.limits[limit]:
|
||||
if limit.isdigit():
|
||||
|
@ -319,9 +319,9 @@ class Filters(threading.Thread):
|
|||
if self.limits[limit]:
|
||||
#for cb in self.cbLimits.values():
|
||||
# cb.set_active(True)
|
||||
if self.cbFL != None:
|
||||
if self.cbFL is not None:
|
||||
self.cbFL.set_active(True)
|
||||
if self.cbNL != None:
|
||||
if self.cbNL is not None:
|
||||
self.cbNL.set_active(True)
|
||||
elif limit == "none":
|
||||
if self.limits[limit]:
|
||||
|
|
|
@ -184,11 +184,11 @@ class Fulltilt(HandHistoryConverter):
|
|||
info['limitType'] = limits[mg['LIMIT']]
|
||||
info['sb'] = mg['SB']
|
||||
info['bb'] = mg['BB']
|
||||
if mg['GAME'] != None:
|
||||
if mg['GAME'] is not None:
|
||||
(info['base'], info['category']) = games[mg['GAME']]
|
||||
if mg['CURRENCY'] != None:
|
||||
if mg['CURRENCY'] is not None:
|
||||
info['currency'] = currencies[mg['CURRENCY']]
|
||||
if mg['TOURNO'] == None: info['type'] = "ring"
|
||||
if mg['TOURNO'] is None: info['type'] = "ring"
|
||||
else: info['type'] = "tour"
|
||||
# NB: SB, BB must be interpreted as blinds or bets depending on limit type.
|
||||
# if info['type'] == "tour": return None # importer is screwed on tournies, pass on those hands so we don't interrupt other autoimporting
|
||||
|
@ -196,7 +196,7 @@ class Fulltilt(HandHistoryConverter):
|
|||
|
||||
def readHandInfo(self, hand):
|
||||
m = self.re_HandInfo.search(hand.handText)
|
||||
if(m == None):
|
||||
if m is None:
|
||||
logging.info("Didn't match re_HandInfo")
|
||||
logging.info(hand.handText)
|
||||
return None
|
||||
|
@ -212,7 +212,7 @@ class Fulltilt(HandHistoryConverter):
|
|||
if m2: hand.maxseats = int(m2.group('MAX'))
|
||||
|
||||
hand.tourNo = m.group('TOURNO')
|
||||
if m.group('PLAY') != None:
|
||||
if m.group('PLAY') is not None:
|
||||
hand.gametype['currency'] = 'play'
|
||||
|
||||
# Done: if there's a way to figure these out, we should.. otherwise we have to stuff it with unknowns
|
||||
|
@ -240,9 +240,9 @@ class Fulltilt(HandHistoryConverter):
|
|||
hand.isShootout = True
|
||||
|
||||
|
||||
if hand.buyin == None:
|
||||
if hand.buyin is None:
|
||||
hand.buyin = "$0.00+$0.00"
|
||||
if hand.level == None:
|
||||
if hand.level is None:
|
||||
hand.level = "0"
|
||||
|
||||
# These work, but the info is already in the Hand class - should be used for tourneys though.
|
||||
|
@ -343,11 +343,11 @@ class Fulltilt(HandHistoryConverter):
|
|||
m = self.re_HeroCards.finditer(hand.streets[street])
|
||||
for found in m:
|
||||
player = found.group('PNAME')
|
||||
if found.group('NEWCARDS') == None:
|
||||
if found.group('NEWCARDS') is None:
|
||||
newcards = []
|
||||
else:
|
||||
newcards = found.group('NEWCARDS').split(' ')
|
||||
if found.group('OLDCARDS') == None:
|
||||
if found.group('OLDCARDS') is None:
|
||||
oldcards = []
|
||||
else:
|
||||
oldcards = found.group('OLDCARDS').split(' ')
|
||||
|
@ -376,7 +376,7 @@ class Fulltilt(HandHistoryConverter):
|
|||
elif action.group('ATYPE') == ' checks':
|
||||
hand.addCheck( street, action.group('PNAME'))
|
||||
else:
|
||||
print "DEBUG: unimplemented readAction: '%s' '%s'" %(action.group('PNAME'),action.group('ATYPE'),)
|
||||
print "FullTilt: DEBUG: unimplemented readAction: '%s' '%s'" %(action.group('PNAME'),action.group('ATYPE'),)
|
||||
|
||||
|
||||
def readShowdownActions(self, hand):
|
||||
|
@ -416,7 +416,8 @@ class Fulltilt(HandHistoryConverter):
|
|||
|
||||
def readOther(self, hand):
|
||||
m = self.re_Mixed.search(self.in_path)
|
||||
if m == None: hand.mixed = None
|
||||
if m is None:
|
||||
hand.mixed = None
|
||||
else:
|
||||
hand.mixed = self.mixes[m.groupdict()['MIXED']]
|
||||
|
||||
|
@ -472,8 +473,10 @@ class Fulltilt(HandHistoryConverter):
|
|||
(info['base'], info['category']) = games[mg['GAME']]
|
||||
if mg['CURRENCY'] is not None:
|
||||
info['currency'] = currencies[mg['CURRENCY']]
|
||||
if mg['TOURNO'] == None: info['type'] = "ring"
|
||||
else: info['type'] = "tour"
|
||||
if mg['TOURNO'] is None:
|
||||
info['type'] = "ring"
|
||||
else:
|
||||
info['type'] = "tour"
|
||||
# NB: SB, BB must be interpreted as blinds or bets depending on limit type.
|
||||
|
||||
# Info is now ready to be copied in the tourney object
|
||||
|
@ -654,7 +657,7 @@ class Fulltilt(HandHistoryConverter):
|
|||
|
||||
tourney.addPlayer(rank, a.group('PNAME'), winnings, 0, 0, 0, 0)
|
||||
else:
|
||||
print "Player finishing stats unreadable : %s" % a
|
||||
print "FullTilt: Player finishing stats unreadable : %s" % a
|
||||
|
||||
# Find Hero
|
||||
n = self.re_TourneyHeroFinishingP.search(playersText)
|
||||
|
@ -663,9 +666,9 @@ class Fulltilt(HandHistoryConverter):
|
|||
tourney.hero = heroName
|
||||
# Is this really useful ?
|
||||
if heroName not in tourney.finishPositions:
|
||||
print heroName, "not found in tourney.finishPositions ..."
|
||||
print "FullTilt:", heroName, "not found in tourney.finishPositions ..."
|
||||
elif (tourney.finishPositions[heroName] != Decimal(n.group('HERO_FINISHING_POS'))):
|
||||
print "Bad parsing : finish position incoherent : %s / %s" % (tourney.finishPositions[heroName], n.group('HERO_FINISHING_POS'))
|
||||
print "FullTilt: Bad parsing : finish position incoherent : %s / %s" % (tourney.finishPositions[heroName], n.group('HERO_FINISHING_POS'))
|
||||
|
||||
return True
|
||||
|
||||
|
|
|
@ -33,16 +33,15 @@ import string
|
|||
|
||||
class GuiAutoImport (threading.Thread):
|
||||
def __init__(self, settings, config, sql):
|
||||
"""Constructor for GuiAutoImport"""
|
||||
self.importtimer = 0
|
||||
self.settings=settings
|
||||
self.config=config
|
||||
self.settings = settings
|
||||
self.config = config
|
||||
self.sql = sql
|
||||
|
||||
imp = self.config.get_import_parameters()
|
||||
|
||||
print "Import parameters"
|
||||
print imp
|
||||
# print "Import parameters"
|
||||
# print imp
|
||||
|
||||
self.input_settings = {}
|
||||
self.pipe_to_hud = None
|
||||
|
@ -55,12 +54,12 @@ class GuiAutoImport (threading.Thread):
|
|||
self.importer.setHandCount(0)
|
||||
# self.importer.setWatchTime()
|
||||
|
||||
self.server=settings['db-host']
|
||||
self.user=settings['db-user']
|
||||
self.password=settings['db-password']
|
||||
self.database=settings['db-databaseName']
|
||||
self.server = settings['db-host']
|
||||
self.user = settings['db-user']
|
||||
self.password = settings['db-password']
|
||||
self.database = settings['db-databaseName']
|
||||
|
||||
self.mainVBox=gtk.VBox(False,1)
|
||||
self.mainVBox = gtk.VBox(False,1)
|
||||
|
||||
hbox = gtk.HBox(True, 0) # contains 2 equal vboxes
|
||||
self.mainVBox.pack_start(hbox, False, False, 0)
|
||||
|
@ -130,7 +129,8 @@ class GuiAutoImport (threading.Thread):
|
|||
data[1].set_text(dia_chooser.get_filename())
|
||||
self.input_settings[data[0]][0] = dia_chooser.get_filename()
|
||||
elif response == gtk.RESPONSE_CANCEL:
|
||||
print 'Closed, no files selected'
|
||||
#print 'Closed, no files selected'
|
||||
pass
|
||||
dia_chooser.destroy()
|
||||
#end def GuiAutoImport.browseClicked
|
||||
|
||||
|
@ -143,8 +143,7 @@ class GuiAutoImport (threading.Thread):
|
|||
sys.stdout.flush()
|
||||
gobject.timeout_add(1000, self.reset_startbutton)
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
return False
|
||||
|
||||
def reset_startbutton(self):
|
||||
if self.pipe_to_hud is not None:
|
||||
|
@ -184,22 +183,24 @@ class GuiAutoImport (threading.Thread):
|
|||
command = os.path.join(sys.path[0], 'HUD_main.py')
|
||||
command = [command, ] + string.split(self.settings['cl_options'])
|
||||
bs = 1
|
||||
|
||||
try:
|
||||
self.pipe_to_hud = subprocess.Popen(command, bufsize = bs, stdin = subprocess.PIPE,
|
||||
universal_newlines = True)
|
||||
self.pipe_to_hud = subprocess.Popen(command, bufsize=bs,
|
||||
stdin=subprocess.PIPE,
|
||||
universal_newlines=True)
|
||||
except:
|
||||
err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
||||
print "*** Error: " + err[2] + "(" + str(err[1]) + "): " + str(sys.exc_info()[1])
|
||||
print "*** GuiAutoImport Error opening pipe: " + err[2] + "(" + str(err[1]) + "): " + str(sys.exc_info()[1])
|
||||
else:
|
||||
for site in self.input_settings:
|
||||
self.importer.addImportDirectory(self.input_settings[site][0], True, site, self.input_settings[site][1])
|
||||
print " * Add", site, " import directory", str(self.input_settings[site][0])
|
||||
print "+Import directory - Site: " + site + " dir: " + str(self.input_settings[site][0])
|
||||
self.do_import()
|
||||
|
||||
interval = int(self.intervalEntry.get_text())
|
||||
if self.importtimer != 0:
|
||||
gobject.source_remove(self.importtimer)
|
||||
self.importtimer = gobject.timeout_add(interval*1000, self.do_import)
|
||||
self.importtimer = gobject.timeout_add(interval * 1000, self.do_import)
|
||||
|
||||
else:
|
||||
print "auto-import aborted - global lock not available"
|
||||
|
@ -209,7 +210,7 @@ class GuiAutoImport (threading.Thread):
|
|||
self.doAutoImportBool = False # do_import will return this and stop the gobject callback timer
|
||||
print "Stopping autoimport - global lock released."
|
||||
if self.pipe_to_hud.poll() is not None:
|
||||
print "HUD already terminated"
|
||||
print " * Stop Autoimport: HUD already terminated"
|
||||
else:
|
||||
#print >>self.pipe_to_hud.stdin, "\n"
|
||||
self.pipe_to_hud.communicate('\n') # waits for process to terminate
|
||||
|
@ -227,7 +228,7 @@ class GuiAutoImport (threading.Thread):
|
|||
#enabling and disabling sites from this interface not possible
|
||||
#expects a box to layout the line horizontally
|
||||
def createSiteLine(self, hbox1, hbox2, site, iconpath, hhpath, filter_name, active = True):
|
||||
label = gtk.Label(site + " auto-import:")
|
||||
label = gtk.Label("%s auto-import:" % site)
|
||||
hbox1.pack_start(label, False, False, 3)
|
||||
label.show()
|
||||
|
||||
|
@ -241,7 +242,7 @@ class GuiAutoImport (threading.Thread):
|
|||
hbox2.pack_start(browseButton, False, False, 3)
|
||||
browseButton.show()
|
||||
|
||||
label = gtk.Label(' ' + site + " filter:")
|
||||
label = gtk.Label("%s filter:" % site)
|
||||
hbox2.pack_start(label, False, False, 3)
|
||||
label.show()
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ class GuiBulkImport():
|
|||
self.progressbar.set_fraction(0)
|
||||
except:
|
||||
err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
||||
print "***Error: "+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
||||
print "*** BulkImport Error: "+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
||||
self.settings['global_lock'].release()
|
||||
else:
|
||||
print "bulk-import aborted - global lock not available"
|
||||
|
@ -142,32 +142,38 @@ class GuiBulkImport():
|
|||
self.chooser.show()
|
||||
|
||||
# Table widget to hold the settings
|
||||
self.table = gtk.Table(rows = 5, columns = 5, homogeneous = False)
|
||||
self.table = gtk.Table(rows=5, columns=5, homogeneous=False)
|
||||
self.vbox.add(self.table)
|
||||
self.table.show()
|
||||
|
||||
# checkbox - print start/stop?
|
||||
self.chk_st_st = gtk.CheckButton('Print Start/Stop Info')
|
||||
self.table.attach(self.chk_st_st, 0, 1, 0, 1, xpadding = 10, ypadding = 0, yoptions=gtk.SHRINK)
|
||||
self.table.attach(self.chk_st_st, 0, 1, 0, 1, xpadding=10, ypadding=0,
|
||||
yoptions=gtk.SHRINK)
|
||||
self.chk_st_st.show()
|
||||
self.chk_st_st.set_active(True)
|
||||
|
||||
# label - status
|
||||
self.lab_status = gtk.Label("Hands/status print:")
|
||||
self.table.attach(self.lab_status, 1, 2, 0, 1, xpadding = 0, ypadding = 0, yoptions=gtk.SHRINK)
|
||||
self.table.attach(self.lab_status, 1, 2, 0, 1, xpadding=0, ypadding=0,
|
||||
yoptions=gtk.SHRINK)
|
||||
self.lab_status.show()
|
||||
self.lab_status.set_justify(gtk.JUSTIFY_RIGHT)
|
||||
self.lab_status.set_alignment(1.0, 0.5)
|
||||
|
||||
# spin button - status
|
||||
status_adj = gtk.Adjustment(value=100, lower=0, upper=300, step_incr=10, page_incr=1, page_size=0) #not sure what upper value should be!
|
||||
self.spin_status = gtk.SpinButton(adjustment=status_adj, climb_rate=0.0, digits=0)
|
||||
self.table.attach(self.spin_status, 2, 3, 0, 1, xpadding = 10, ypadding = 0, yoptions=gtk.SHRINK)
|
||||
status_adj = gtk.Adjustment(value=100, lower=0, upper=300, step_incr=10,
|
||||
page_incr=1, page_size=0) #not sure what upper value should be!
|
||||
self.spin_status = gtk.SpinButton(adjustment=status_adj, climb_rate=0.0,
|
||||
digits=0)
|
||||
self.table.attach(self.spin_status, 2, 3, 0, 1, xpadding=10, ypadding=0,
|
||||
yoptions=gtk.SHRINK)
|
||||
self.spin_status.show()
|
||||
|
||||
# label - threads
|
||||
self.lab_threads = gtk.Label("Number of threads:")
|
||||
self.table.attach(self.lab_threads, 3, 4, 0, 1, xpadding = 0, ypadding = 0, yoptions=gtk.SHRINK)
|
||||
self.table.attach(self.lab_threads, 3, 4, 0, 1, xpadding=0, ypadding=0,
|
||||
yoptions=gtk.SHRINK)
|
||||
self.lab_threads.show()
|
||||
if not self.allowThreads:
|
||||
self.lab_threads.set_sensitive(False)
|
||||
|
@ -175,34 +181,39 @@ class GuiBulkImport():
|
|||
self.lab_threads.set_alignment(1.0, 0.5)
|
||||
|
||||
# spin button - threads
|
||||
threads_adj = gtk.Adjustment(value=0, lower=0, upper=32, step_incr=1, page_incr=1, page_size=0) #not sure what upper value should be!
|
||||
threads_adj = gtk.Adjustment(value=0, lower=0, upper=32, step_incr=1,
|
||||
page_incr=1, page_size=0) #not sure what upper value should be!
|
||||
self.spin_threads = gtk.SpinButton(adjustment=threads_adj, climb_rate=0.0, digits=0)
|
||||
self.table.attach(self.spin_threads, 4, 5, 0, 1, xpadding = 10, ypadding = 0, yoptions=gtk.SHRINK)
|
||||
self.table.attach(self.spin_threads, 4, 5, 0, 1, xpadding=10, ypadding=0,
|
||||
yoptions=gtk.SHRINK)
|
||||
self.spin_threads.show()
|
||||
if not self.allowThreads:
|
||||
self.spin_threads.set_sensitive(False)
|
||||
|
||||
# checkbox - fail on error?
|
||||
self.chk_fail = gtk.CheckButton('Fail on error')
|
||||
self.table.attach(self.chk_fail, 0, 1, 1, 2, xpadding = 10, ypadding = 0, yoptions=gtk.SHRINK)
|
||||
self.table.attach(self.chk_fail, 0, 1, 1, 2, xpadding=10, ypadding=0, yoptions=gtk.SHRINK)
|
||||
self.chk_fail.show()
|
||||
|
||||
# label - hands
|
||||
self.lab_hands = gtk.Label("Hands/file:")
|
||||
self.table.attach(self.lab_hands, 1, 2, 1, 2, xpadding = 0, ypadding = 0, yoptions=gtk.SHRINK)
|
||||
self.table.attach(self.lab_hands, 1, 2, 1, 2, xpadding=0, ypadding=0, yoptions=gtk.SHRINK)
|
||||
self.lab_hands.show()
|
||||
self.lab_hands.set_justify(gtk.JUSTIFY_RIGHT)
|
||||
self.lab_hands.set_alignment(1.0, 0.5)
|
||||
|
||||
# spin button - hands to import
|
||||
hands_adj = gtk.Adjustment(value=0, lower=0, upper=10, step_incr=1, page_incr=1, page_size=0) #not sure what upper value should be!
|
||||
hands_adj = gtk.Adjustment(value=0, lower=0, upper=10, step_incr=1,
|
||||
page_incr=1, page_size=0) #not sure what upper value should be!
|
||||
self.spin_hands = gtk.SpinButton(adjustment=hands_adj, climb_rate=0.0, digits=0)
|
||||
self.table.attach(self.spin_hands, 2, 3, 1, 2, xpadding = 10, ypadding = 0, yoptions=gtk.SHRINK)
|
||||
self.table.attach(self.spin_hands, 2, 3, 1, 2, xpadding=10, ypadding=0,
|
||||
yoptions=gtk.SHRINK)
|
||||
self.spin_hands.show()
|
||||
|
||||
# label - drop indexes
|
||||
self.lab_drop = gtk.Label("Drop indexes:")
|
||||
self.table.attach(self.lab_drop, 3, 4, 1, 2, xpadding = 0, ypadding = 0, yoptions=gtk.SHRINK)
|
||||
self.table.attach(self.lab_drop, 3, 4, 1, 2, xpadding=0, ypadding=0,
|
||||
yoptions=gtk.SHRINK)
|
||||
self.lab_drop.show()
|
||||
self.lab_drop.set_justify(gtk.JUSTIFY_RIGHT)
|
||||
self.lab_drop.set_alignment(1.0, 0.5)
|
||||
|
@ -213,12 +224,14 @@ class GuiBulkImport():
|
|||
self.cb_dropindexes.append_text("don't drop")
|
||||
self.cb_dropindexes.append_text('drop')
|
||||
self.cb_dropindexes.set_active(0)
|
||||
self.table.attach(self.cb_dropindexes, 4, 5, 1, 2, xpadding = 10, ypadding = 0, yoptions=gtk.SHRINK)
|
||||
self.table.attach(self.cb_dropindexes, 4, 5, 1, 2, xpadding=10,
|
||||
ypadding=0, yoptions=gtk.SHRINK)
|
||||
self.cb_dropindexes.show()
|
||||
|
||||
# label - filter
|
||||
self.lab_filter = gtk.Label("Site filter:")
|
||||
self.table.attach(self.lab_filter, 1, 2, 2, 3, xpadding = 0, ypadding = 0, yoptions=gtk.SHRINK)
|
||||
self.table.attach(self.lab_filter, 1, 2, 2, 3, xpadding=0, ypadding=0,
|
||||
yoptions=gtk.SHRINK)
|
||||
self.lab_filter.show()
|
||||
self.lab_filter.set_justify(gtk.JUSTIFY_RIGHT)
|
||||
self.lab_filter.set_alignment(1.0, 0.5)
|
||||
|
@ -229,12 +242,14 @@ class GuiBulkImport():
|
|||
print w
|
||||
self.cbfilter.append_text(w)
|
||||
self.cbfilter.set_active(0)
|
||||
self.table.attach(self.cbfilter, 2, 3, 2, 3, xpadding = 10, ypadding = 1, yoptions=gtk.SHRINK)
|
||||
self.table.attach(self.cbfilter, 2, 3, 2, 3, xpadding=10, ypadding=1,
|
||||
yoptions=gtk.SHRINK)
|
||||
self.cbfilter.show()
|
||||
|
||||
# label - drop hudcache
|
||||
self.lab_hdrop = gtk.Label("Drop HudCache:")
|
||||
self.table.attach(self.lab_hdrop, 3, 4, 2, 3, xpadding = 0, ypadding = 0, yoptions=gtk.SHRINK)
|
||||
self.table.attach(self.lab_hdrop, 3, 4, 2, 3, xpadding=0, ypadding=0,
|
||||
yoptions=gtk.SHRINK)
|
||||
self.lab_hdrop.show()
|
||||
self.lab_hdrop.set_justify(gtk.JUSTIFY_RIGHT)
|
||||
self.lab_hdrop.set_alignment(1.0, 0.5)
|
||||
|
@ -245,19 +260,22 @@ class GuiBulkImport():
|
|||
self.cb_drophudcache.append_text("don't drop")
|
||||
self.cb_drophudcache.append_text('drop')
|
||||
self.cb_drophudcache.set_active(0)
|
||||
self.table.attach(self.cb_drophudcache, 4, 5, 2, 3, xpadding = 10, ypadding = 0, yoptions=gtk.SHRINK)
|
||||
self.table.attach(self.cb_drophudcache, 4, 5, 2, 3, xpadding=10,
|
||||
ypadding=0, yoptions=gtk.SHRINK)
|
||||
self.cb_drophudcache.show()
|
||||
|
||||
# button - Import
|
||||
self.load_button = gtk.Button('Import') # todo: rename variables to import too
|
||||
self.load_button.connect('clicked', self.load_clicked,
|
||||
'Import clicked')
|
||||
self.table.attach(self.load_button, 2, 3, 4, 5, xpadding = 0, ypadding = 0, yoptions=gtk.SHRINK)
|
||||
self.table.attach(self.load_button, 2, 3, 4, 5, xpadding=0, ypadding=0,
|
||||
yoptions=gtk.SHRINK)
|
||||
self.load_button.show()
|
||||
|
||||
# label - spacer (keeps rows 3 & 5 apart)
|
||||
self.lab_spacer = gtk.Label()
|
||||
self.table.attach(self.lab_spacer, 3, 5, 3, 4, xpadding = 0, ypadding = 0, yoptions=gtk.SHRINK)
|
||||
self.table.attach(self.lab_spacer, 3, 5, 3, 4, xpadding=0, ypadding=0,
|
||||
yoptions=gtk.SHRINK)
|
||||
self.lab_spacer.show()
|
||||
|
||||
# label - info
|
||||
|
@ -265,7 +283,8 @@ class GuiBulkImport():
|
|||
# self.table.attach(self.lab_info, 3, 5, 4, 5, xpadding = 0, ypadding = 0, yoptions=gtk.SHRINK)
|
||||
# self.lab_info.show()
|
||||
self.progressbar = gtk.ProgressBar()
|
||||
self.table.attach(self.progressbar, 3, 5, 4, 5, xpadding = 0, ypadding = 0, yoptions = gtk.SHRINK)
|
||||
self.table.attach(self.progressbar, 3, 5, 4, 5, xpadding=0, ypadding=0,
|
||||
yoptions=gtk.SHRINK)
|
||||
self.progressbar.set_text("Waiting...")
|
||||
self.progressbar.set_fraction(0)
|
||||
self.progressbar.show()
|
||||
|
|
|
@ -310,7 +310,7 @@ class GuiSessionViewer (threading.Thread):
|
|||
except:
|
||||
pass
|
||||
|
||||
if self.fig != None:
|
||||
if self.fig is not None:
|
||||
self.fig.clear()
|
||||
self.fig = Figure(figsize=(5,4), dpi=100)
|
||||
if self.canvas is not None:
|
||||
|
|
|
@ -270,11 +270,11 @@ class HUD_main(object):
|
|||
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 tablewindow is None:
|
||||
# If no client window is found on the screen, complain and continue
|
||||
if type == "tour":
|
||||
table_name = "%s %s" % (tour_number, tab_number)
|
||||
sys.stderr.write("table name "+table_name+" not found, skipping.\n")
|
||||
sys.stderr.write("HUD create: table name "+table_name+" not found, skipping.\n")
|
||||
else:
|
||||
self.create_HUD(new_hand_id, tablewindow, temp_key, max, poker_game, type, stat_dict, cards)
|
||||
self.db_connection.connection.rollback()
|
||||
|
|
|
@ -550,12 +550,12 @@ Map the tuple self.gametype onto the pokerstars string describing it
|
|||
"""Return the first HH line for the current hand."""
|
||||
gs = "PokerStars Game #%s: " % self.handid
|
||||
|
||||
if self.tourNo != None and self.mixed != None: # mixed tournament
|
||||
if self.tourNo is not None and self.mixed is not None: # mixed tournament
|
||||
gs = gs + "Tournament #%s, %s %s (%s) - Level %s (%s) - " % (self.tourNo, self.buyin, self.MS[self.mixed], self.getGameTypeAsString(), self.level, self.getStakesAsString())
|
||||
elif self.tourNo != None: # all other tournaments
|
||||
elif self.tourNo is not None: # all other tournaments
|
||||
gs = gs + "Tournament #%s, %s %s - Level %s (%s) - " % (self.tourNo,
|
||||
self.buyin, self.getGameTypeAsString(), self.level, self.getStakesAsString())
|
||||
elif self.mixed != None: # all other mixed games
|
||||
elif self.mixed is not None: # all other mixed games
|
||||
gs = gs + " %s (%s, %s) - " % (self.MS[self.mixed],
|
||||
self.getGameTypeAsString(), self.getStakesAsString())
|
||||
else: # non-mixed cash games
|
||||
|
@ -628,7 +628,7 @@ class HoldemOmahaHand(Hand):
|
|||
hhc.readShownCards(self)
|
||||
self.totalPot() # finalise it (total the pot)
|
||||
hhc.getRake(self)
|
||||
if self.maxseats == None:
|
||||
if self.maxseats is None:
|
||||
self.maxseats = hhc.guessMaxSeats(self)
|
||||
hhc.readOther(self)
|
||||
elif builtFrom == "DB":
|
||||
|
@ -897,7 +897,7 @@ class DrawHand(Hand):
|
|||
hhc.readShownCards(self)
|
||||
self.totalPot() # finalise it (total the pot)
|
||||
hhc.getRake(self)
|
||||
if self.maxseats == None:
|
||||
if self.maxseats is None:
|
||||
self.maxseats = hhc.guessMaxSeats(self)
|
||||
hhc.readOther(self)
|
||||
elif builtFrom == "DB":
|
||||
|
@ -1073,7 +1073,7 @@ class StudHand(Hand):
|
|||
hhc.readShownCards(self) # not done yet
|
||||
self.totalPot() # finalise it (total the pot)
|
||||
hhc.getRake(self)
|
||||
if self.maxseats == None:
|
||||
if self.maxseats is None:
|
||||
self.maxseats = hhc.guessMaxSeats(self)
|
||||
hhc.readOther(self)
|
||||
elif builtFrom == "DB":
|
||||
|
|
|
@ -150,9 +150,9 @@ Otherwise, finish at EOF.
|
|||
for handText in self.tailHands():
|
||||
try:
|
||||
self.processHand(handText)
|
||||
numHands+=1
|
||||
numHands += 1
|
||||
except FpdbParseError, e:
|
||||
numErrors+=1
|
||||
numErrors += 1
|
||||
log.warning("Failed to convert hand %s" % e.hid)
|
||||
log.debug(handText)
|
||||
else:
|
||||
|
@ -166,7 +166,7 @@ Otherwise, finish at EOF.
|
|||
try:
|
||||
self.processedHands.append(self.processHand(handText))
|
||||
except FpdbParseError, e:
|
||||
numErrors+=1
|
||||
numErrors += 1
|
||||
log.warning("Failed to convert hand %s" % e.hid)
|
||||
log.debug(handText)
|
||||
numHands = len(handsList)
|
||||
|
@ -195,7 +195,8 @@ This requires a regex that greedily groups and matches the 'splitter' between ha
|
|||
which it expects to find at self.re_TailSplitHands -- see for e.g. Everleaf.py.
|
||||
|
||||
"""
|
||||
if self.in_path == '-': raise StopIteration
|
||||
if self.in_path == '-':
|
||||
raise StopIteration
|
||||
interval = 1.0 # seconds to sleep between reads for new data
|
||||
fd = codecs.open(self.in_path,'r', self.codepage)
|
||||
data = ''
|
||||
|
@ -256,7 +257,7 @@ which it expects to find at self.re_TailSplitHands -- see for e.g. Everleaf.py.
|
|||
self.readFile()
|
||||
self.obs = self.obs.strip()
|
||||
self.obs = self.obs.replace('\r\n', '\n')
|
||||
if self.obs == "" or self.obs == None:
|
||||
if self.obs is None or self.obs == "":
|
||||
log.info("Read no hands.")
|
||||
return []
|
||||
return re.split(self.re_SplitHands, self.obs)
|
||||
|
@ -396,7 +397,7 @@ or None if we fail to get the info """
|
|||
if True: # basically.. I don't know
|
||||
sane = True
|
||||
|
||||
if(self.in_path != '-' and self.out_path == self.in_path):
|
||||
if self.in_path != '-' and self.out_path == self.in_path:
|
||||
print "HH Sanity Check: output and input files are the same, check config"
|
||||
sane = False
|
||||
|
||||
|
@ -417,16 +418,19 @@ or None if we fail to get the info """
|
|||
for l in list:
|
||||
# print "'" + l + "'"
|
||||
hands = hands + [Hand.Hand(self.sitename, self.gametype, l)]
|
||||
# TODO: This looks like it could be replaced with a list comp.. ?
|
||||
return hands
|
||||
|
||||
def __listof(self, x):
|
||||
if isinstance(x, list) or isinstance(x, tuple): return x
|
||||
else: return [x]
|
||||
if isinstance(x, list) or isinstance(x, tuple):
|
||||
return x
|
||||
else:
|
||||
return [x]
|
||||
|
||||
def readFile(self):
|
||||
"""Open in_path according to self.codepage. Exceptions caught further up"""
|
||||
|
||||
if(self.filetype == "text"):
|
||||
if self.filetype == "text":
|
||||
if self.in_path == '-':
|
||||
# read from stdin
|
||||
log.debug("Reading stdin with %s" % self.codepage) # is this necessary? or possible? or what?
|
||||
|
@ -446,7 +450,7 @@ or None if we fail to get the info """
|
|||
pass
|
||||
else:
|
||||
print "unable to read file with any codec in list!", self.in_path
|
||||
elif(self.filetype == "xml"):
|
||||
elif self.filetype == "xml":
|
||||
doc = xml.dom.minidom.parse(filename)
|
||||
self.doc = doc
|
||||
|
||||
|
@ -474,7 +478,8 @@ or None if we fail to get the info """
|
|||
def maxOccSeat(self, hand):
|
||||
max = 0
|
||||
for player in hand.players:
|
||||
if player[0] > max: max = player[0]
|
||||
if player[0] > max:
|
||||
max = player[0]
|
||||
return max
|
||||
|
||||
def getStatus(self):
|
||||
|
|
|
@ -61,7 +61,7 @@ class Hud:
|
|||
def __init__(self, parent, table, max, poker_game, config, db_connection):
|
||||
# __init__ is (now) intended to be called from the stdin thread, so it
|
||||
# cannot touch the gui
|
||||
if parent == None: # running from cli ..
|
||||
if parent is None: # running from cli ..
|
||||
self.parent = self
|
||||
self.parent = parent
|
||||
self.table = table
|
||||
|
@ -87,11 +87,6 @@ class Hud:
|
|||
self.backgroundcolor = gtk.gdk.color_parse(self.colors['hudbgcolor'])
|
||||
self.foregroundcolor = gtk.gdk.color_parse(self.colors['hudfgcolor'])
|
||||
|
||||
|
||||
if font == None:
|
||||
font = "Sans"
|
||||
if font_size == None:
|
||||
font_size = "8"
|
||||
self.font = pango.FontDescription("%s %s" % (font, font_size))
|
||||
# do we need to add some sort of condition here for dealing with a request for a font that doesn't exist?
|
||||
|
||||
|
@ -136,7 +131,7 @@ class Hud:
|
|||
|
||||
killitem = gtk.MenuItem('Kill This HUD')
|
||||
menu.append(killitem)
|
||||
if self.parent != None:
|
||||
if self.parent is not None:
|
||||
killitem.connect("activate", self.parent.kill_hud, self.table_name)
|
||||
|
||||
saveitem = gtk.MenuItem('Save HUD Layout')
|
||||
|
|
|
@ -479,7 +479,7 @@ class Flop_Mucked(Aux_Seats):
|
|||
if i != "common":
|
||||
id = self.get_id_from_seat(i)
|
||||
# sc: had KeyError here with new table so added id != None test as a guess:
|
||||
if id != None:
|
||||
if id is not None:
|
||||
self.m_windows[i].eb.set_tooltip_text(self.hud.stat_dict[id]['screen_name'])
|
||||
|
||||
def update_gui(self, new_hand_id):
|
||||
|
|
|
@ -164,7 +164,7 @@ class PokerStars(HandHistoryConverter):
|
|||
if 'CURRENCY' in mg:
|
||||
info['currency'] = currencies[mg['CURRENCY']]
|
||||
|
||||
if 'TOURNO' in mg and mg['TOURNO'] == None:
|
||||
if 'TOURNO' in mg and mg['TOURNO'] is None:
|
||||
info['type'] = 'ring'
|
||||
else:
|
||||
info['type'] = 'tour'
|
||||
|
@ -172,7 +172,6 @@ class PokerStars(HandHistoryConverter):
|
|||
# NB: SB, BB must be interpreted as blinds or bets depending on limit type.
|
||||
return info
|
||||
|
||||
|
||||
def readHandInfo(self, hand):
|
||||
info = {}
|
||||
m = self.re_HandInfo.search(hand.handText,re.DOTALL)
|
||||
|
@ -182,7 +181,8 @@ class PokerStars(HandHistoryConverter):
|
|||
else:
|
||||
pass # throw an exception here, eh?
|
||||
m = self.re_GameInfo.search(hand.handText)
|
||||
if m: info.update(m.groupdict())
|
||||
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
|
||||
|
@ -205,8 +205,7 @@ class PokerStars(HandHistoryConverter):
|
|||
hand.maxseats = int(info[key])
|
||||
|
||||
if key == 'MIXED':
|
||||
if info[key] == None: hand.mixed = None
|
||||
else: hand.mixed = self.mixes[info[key]]
|
||||
hand.mixed = self.mixes[info[key]] if info[key] is not None else None
|
||||
|
||||
if key == 'TOURNO':
|
||||
hand.tourNo = info[key]
|
||||
|
@ -214,7 +213,7 @@ class PokerStars(HandHistoryConverter):
|
|||
hand.buyin = info[key]
|
||||
if key == 'LEVEL':
|
||||
hand.level = info[key]
|
||||
if key == 'PLAY' and info['PLAY'] != None:
|
||||
if key == 'PLAY' and info['PLAY'] is not None:
|
||||
# hand.currency = 'play' # overrides previously set value
|
||||
hand.gametype['currency'] = 'play'
|
||||
|
||||
|
@ -304,11 +303,11 @@ class PokerStars(HandHistoryConverter):
|
|||
m = self.re_HeroCards.finditer(hand.streets[street])
|
||||
for found in m:
|
||||
player = found.group('PNAME')
|
||||
if found.group('NEWCARDS') == None:
|
||||
if found.group('NEWCARDS') is None:
|
||||
newcards = []
|
||||
else:
|
||||
newcards = found.group('NEWCARDS').split(' ')
|
||||
if found.group('OLDCARDS') == None:
|
||||
if found.group('OLDCARDS') is None:
|
||||
oldcards = []
|
||||
else:
|
||||
oldcards = found.group('OLDCARDS').split(' ')
|
||||
|
|
|
@ -68,14 +68,14 @@ def do_tip(widget, tip):
|
|||
|
||||
def do_stat(stat_dict, player = 24, stat = 'vpip'):
|
||||
match = re_Places.search(stat)
|
||||
if match == None:
|
||||
if match is None:
|
||||
result = eval("%(stat)s(stat_dict, %(player)d)" % {'stat': stat, 'player': player})
|
||||
else:
|
||||
base = stat[0:-2]
|
||||
places = int(stat[-1:])
|
||||
result = eval("%(stat)s(stat_dict, %(player)d)" % {'stat': base, 'player': player})
|
||||
match = re_Percent.search(result[1])
|
||||
if match == None:
|
||||
if match is None:
|
||||
result = (result[0], "%.*f" % (places, result[0]), result[2], result[3], result[4], result[5])
|
||||
else:
|
||||
result = (result[0], "%.*f%%" % (places, 100*result[0]), result[2], result[3], result[4], result[5])
|
||||
|
|
|
@ -95,12 +95,12 @@ gobject.signal_new("client_destroyed", gtk.Window,
|
|||
class Table_Window(object):
|
||||
def __init__(self, table_name = None, tournament = None, table_number = None):
|
||||
|
||||
if table_name != None:
|
||||
if table_name is not None:
|
||||
search_string = table_name
|
||||
self.name = table_name
|
||||
self.tournament = None
|
||||
self.table = None
|
||||
elif tournament != None and table_number != None:
|
||||
elif 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)
|
||||
|
@ -133,7 +133,7 @@ class Table_Window(object):
|
|||
def check_geometry(self):
|
||||
new_geo = self.get_geometry()
|
||||
|
||||
if new_geo == None: # window destroyed
|
||||
if new_geo is None: # window destroyed
|
||||
return "client_destroyed"
|
||||
|
||||
elif self.x != new_geo['x'] or self.y != new_geo['y']: # window moved
|
||||
|
|
|
@ -105,7 +105,7 @@ def discover_table_by_name(c, tablename):
|
|||
info = discover_mac_by_name(c, tablename)
|
||||
else:
|
||||
return None
|
||||
if info == None:
|
||||
if info is None:
|
||||
return None
|
||||
return Table_Window(info)
|
||||
|
||||
|
@ -141,7 +141,7 @@ def discover_posix(c):
|
|||
if 'History for table:' in listing: continue
|
||||
if 'has no name' in listing: continue
|
||||
info = decode_xwininfo(c, listing)
|
||||
if info['site'] == None: continue
|
||||
if info['site'] is None: continue
|
||||
if info['title'] == info['exe']: continue
|
||||
# this appears to be a poker client, so make a table object for it
|
||||
tw = Table_Window(info)
|
||||
|
|
|
@ -289,7 +289,7 @@ class ttracker_main(object):
|
|||
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 tablewindow is None:
|
||||
# If no client window is found on the screen, complain and continue
|
||||
if type == "tour":
|
||||
table_name = "%s %s" % (tour_number, tab_number)
|
||||
|
|
|
@ -447,7 +447,7 @@ class fpdb:
|
|||
self.settings.update(self.config.get_import_parameters())
|
||||
self.settings.update(self.config.get_default_paths())
|
||||
|
||||
if self.db != None and self.db.fdb != None:
|
||||
if self.db is not None and self.db.fdb is not None:
|
||||
self.db.disconnect()
|
||||
|
||||
self.sql = SQL.Sql(type = self.settings['db-type'], db_server = self.settings['db-server'])
|
||||
|
@ -487,7 +487,7 @@ class fpdb:
|
|||
response = diaDbVersionWarning.run()
|
||||
diaDbVersionWarning.destroy()
|
||||
|
||||
if self.status_bar == None:
|
||||
if self.status_bar is None:
|
||||
self.status_bar = gtk.Label("Status: Connected to %s database named %s on host %s"%(self.db.get_backend_name(),self.db.database, self.db.host))
|
||||
self.main_vbox.pack_end(self.status_bar, False, True, 0)
|
||||
self.status_bar.show()
|
||||
|
|
|
@ -400,7 +400,7 @@ class Importer:
|
|||
file = file.decode(fpdb_simple.LOCALE_ENCODING)
|
||||
|
||||
# Load filter, process file, pass returned filename to import_fpdb_file
|
||||
if self.settings['threads'] > 0 and self.writeq != None:
|
||||
if self.settings['threads'] > 0 and self.writeq is not None:
|
||||
log.info("Converting " + file + " (" + str(q.qsize()) + ")")
|
||||
else:
|
||||
log.info("Converting " + file)
|
||||
|
@ -475,7 +475,7 @@ class Importer:
|
|||
|
||||
db.commit()
|
||||
ttime = time() - starttime
|
||||
if q == None:
|
||||
if q is None:
|
||||
log.info("Total stored: %(stored)d\tduplicates:%(duplicates)d\terrors:%(errors)d\ttime:%(ttime)s" % locals())
|
||||
|
||||
if not stored:
|
||||
|
|
|
@ -30,7 +30,7 @@ def mainParser(settings, siteID, category, hand, config, db = None, writeq = Non
|
|||
backend = settings['db-backend']
|
||||
# Ideally db connection is passed in, if not use sql list if passed in,
|
||||
# otherwise start from scratch
|
||||
if db == None:
|
||||
if db is None:
|
||||
db = Database.Database(c = config, sql = None)
|
||||
category = fpdb_simple.recogniseCategory(hand[0])
|
||||
|
||||
|
@ -222,7 +222,7 @@ def mainParser(settings, siteID, category, hand, config, db = None, writeq = Non
|
|||
, actionNos, hudImportData, maxSeats, tableName, seatNos)
|
||||
|
||||
# save hand in db via direct call or via q if in a thread
|
||||
if writeq == None:
|
||||
if writeq is None:
|
||||
result = db.store_the_hand(htw)
|
||||
else:
|
||||
writeq.put(htw)
|
||||
|
|
Loading…
Reference in New Issue
Block a user