Merge branch 'master' of git://git.assembla.com/fpdb-eric
Conflicts: pyfpdb/Configuration.py
This commit is contained in:
commit
d6b5f5d019
|
@ -32,12 +32,6 @@ import shutil
|
||||||
import xml.dom.minidom
|
import xml.dom.minidom
|
||||||
from xml.dom.minidom import Node
|
from xml.dom.minidom import Node
|
||||||
|
|
||||||
#class Layout:
|
|
||||||
# def __init__(self, max):
|
|
||||||
# self.max = int(max)
|
|
||||||
# self.location = []
|
|
||||||
# for i in range(self.max + 1): self.location.append(None)
|
|
||||||
|
|
||||||
class Layout:
|
class Layout:
|
||||||
def __init__(self, node):
|
def __init__(self, node):
|
||||||
|
|
||||||
|
@ -47,7 +41,8 @@ class Layout:
|
||||||
self.height = int( node.getAttribute('height') )
|
self.height = int( node.getAttribute('height') )
|
||||||
|
|
||||||
self.location = []
|
self.location = []
|
||||||
for i in range(self.max + 1): self.location.append(None)
|
self.location = map(lambda x: None, range(self.max+1)) # there must be a better way to do this?
|
||||||
|
|
||||||
|
|
||||||
for location_node in node.getElementsByTagName('location'):
|
for location_node in node.getElementsByTagName('location'):
|
||||||
if location_node.getAttribute('seat') != "":
|
if location_node.getAttribute('seat') != "":
|
||||||
|
@ -62,7 +57,7 @@ class Layout:
|
||||||
if hasattr(self, "common"):
|
if hasattr(self, "common"):
|
||||||
temp = temp + " Common = (%d, %d)\n" % (self.common[0], self.common[1])
|
temp = temp + " Common = (%d, %d)\n" % (self.common[0], self.common[1])
|
||||||
temp = temp + " Locations = "
|
temp = temp + " Locations = "
|
||||||
for i in range(1, len(self.location)):
|
for i in xrange(1, len(self.location)):
|
||||||
temp = temp + "(%d,%d)" % self.location[i]
|
temp = temp + "(%d,%d)" % self.location[i]
|
||||||
|
|
||||||
return temp + "\n"
|
return temp + "\n"
|
||||||
|
@ -91,16 +86,17 @@ class Site:
|
||||||
self.layout[lo.max] = lo
|
self.layout[lo.max] = lo
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
temp = "Site = " + self.site_name + "\n"
|
temp = "Site = %s\n" % self.site_name
|
||||||
for key in dir(self):
|
for key in dir(self):
|
||||||
if key.startswith('__'): continue
|
if key.startswith('__'): continue
|
||||||
if key == 'layout': continue
|
if key == 'layout': continue
|
||||||
value = getattr(self, key)
|
value = getattr(self, key)
|
||||||
if callable(value): continue
|
if callable(value): continue
|
||||||
|
temp = "%s %s = %s\n" % (temp, key, str(value))
|
||||||
temp = temp + ' ' + key + " = " + str(value) + "\n"
|
temp = temp + ' ' + key + " = " + str(value) + "\n"
|
||||||
|
|
||||||
for layout in self.layout:
|
for layout in self.layout:
|
||||||
temp = temp + "%s" % self.layout[layout]
|
temp = "%s%s" % (temp, self.layout[layout])
|
||||||
|
|
||||||
return temp
|
return temp
|
||||||
|
|
||||||
|
@ -141,14 +137,10 @@ class Game:
|
||||||
self.stats[stat.stat_name] = stat
|
self.stats[stat.stat_name] = stat
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
temp = "Game = " + self.game_name + "\n"
|
temp = "Game = %s\n db = %s\n rows = %d\n cols = %d\n aux = %s\n" % (self.game_name, self.db, self.rows, self.cols, self.aux)
|
||||||
temp = temp + " db = %s\n" % self.db
|
|
||||||
temp = temp + " rows = %d\n" % self.rows
|
|
||||||
temp = temp + " cols = %d\n" % self.cols
|
|
||||||
temp = temp + " aux = %s\n" % self.aux
|
|
||||||
|
|
||||||
for stat in self.stats.keys():
|
for stat in self.stats.keys():
|
||||||
temp = temp + "%s" % self.stats[stat]
|
temp = "%s%s" % (temp, self.stats[stat])
|
||||||
|
|
||||||
return temp
|
return temp
|
||||||
|
|
||||||
|
@ -412,7 +404,7 @@ class Config:
|
||||||
site_node = self.get_site_node(site_name)
|
site_node = self.get_site_node(site_name)
|
||||||
layout_node = self.get_layout_node(site_node, max)
|
layout_node = self.get_layout_node(site_node, max)
|
||||||
if layout_node == None: return
|
if layout_node == None: return
|
||||||
for i in range(1, max + 1):
|
for i in xrange(1, max + 1):
|
||||||
location_node = self.get_location_node(layout_node, i)
|
location_node = self.get_location_node(layout_node, i)
|
||||||
location_node.setAttribute("x", str( locations[i-1][0] ))
|
location_node.setAttribute("x", str( locations[i-1][0] ))
|
||||||
location_node.setAttribute("y", str( locations[i-1][1] ))
|
location_node.setAttribute("y", str( locations[i-1][1] ))
|
||||||
|
@ -492,35 +484,17 @@ class Config:
|
||||||
|
|
||||||
def get_default_colors(self, site = "PokerStars"):
|
def get_default_colors(self, site = "PokerStars"):
|
||||||
colors = {}
|
colors = {}
|
||||||
if self.supported_sites[site].hudopacity == "":
|
colors['hudopacity'] = float(self.supported_sites[site].hudopacity) if self.supported_sites[site].hudopacity != "" else 0.90
|
||||||
colors['hudopacity'] = 0.90
|
colors['hudbgcolor'] = self.supported_sites[site].hudbgcolor if self.supported_sites[site].hudbgcolor != "" else "#FFFFFF"
|
||||||
else:
|
colors['hudfgcolor'] = self.supported_sites[site].hudfgcolor if self.supported_sites[site].hudfgcolor != "" else "#000000"
|
||||||
colors['hudopacity'] = float(self.supported_sites[site].hudopacity)
|
|
||||||
if self.supported_sites[site].hudbgcolor == "":
|
|
||||||
colors['hudbgcolor'] = "#FFFFFF"
|
|
||||||
else:
|
|
||||||
colors['hudbgcolor'] = self.supported_sites[site].hudbgcolor
|
|
||||||
if self.supported_sites[site].hudfgcolor == "":
|
|
||||||
colors['hudfgcolor'] = "#000000"
|
|
||||||
else:
|
|
||||||
colors['hudfgcolor'] = self.supported_sites[site].hudfgcolor
|
|
||||||
return colors
|
return colors
|
||||||
|
|
||||||
def get_default_font(self, site = 'PokerStars'):
|
def get_default_font(self, site = 'PokerStars'):
|
||||||
(font, font_size) = ("Sans", "8")
|
font = self.supported_sites[site].font if self.supported_sites[site].font != "" else "Sans"
|
||||||
if self.supported_sites[site].font == "":
|
font_size = self.supported_sites[site].font_size if self.supported_sites[site].font != "" else "8"
|
||||||
font = "Sans"
|
|
||||||
else:
|
|
||||||
font = self.supported_sites[site].font
|
|
||||||
|
|
||||||
if self.supported_sites[site].font_size == "":
|
|
||||||
font_size = "8"
|
|
||||||
else:
|
|
||||||
font_size = self.supported_sites[site].font_size
|
|
||||||
return (font, font_size)
|
return (font, font_size)
|
||||||
|
|
||||||
def get_locations(self, site = "PokerStars", max = "8"):
|
def get_locations(self, site = "PokerStars", max = "8"):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
locations = self.supported_sites[site].layout[max].location
|
locations = self.supported_sites[site].layout[max].location
|
||||||
except:
|
except:
|
||||||
|
@ -609,7 +583,7 @@ class Config:
|
||||||
def get_aux_parameters(self, name):
|
def get_aux_parameters(self, name):
|
||||||
"""Gets a dict of mucked window parameters from the named mw."""
|
"""Gets a dict of mucked window parameters from the named mw."""
|
||||||
param = {}
|
param = {}
|
||||||
if self.aux_windows.has_key(name):
|
if name in self.aux_windows:
|
||||||
for key in dir(self.aux_windows[name]):
|
for key in dir(self.aux_windows[name]):
|
||||||
if key.startswith('__'): continue
|
if key.startswith('__'): continue
|
||||||
value = getattr(self.aux_windows[name], key)
|
value = getattr(self.aux_windows[name], key)
|
||||||
|
@ -622,7 +596,7 @@ class Config:
|
||||||
def get_game_parameters(self, name):
|
def get_game_parameters(self, name):
|
||||||
"""Get the configuration parameters for the named game."""
|
"""Get the configuration parameters for the named game."""
|
||||||
param = {}
|
param = {}
|
||||||
if self.supported_games.has_key(name):
|
if name in self.supported_games:
|
||||||
param['game_name'] = self.supported_games[name].game_name
|
param['game_name'] = self.supported_games[name].game_name
|
||||||
param['db'] = self.supported_games[name].db
|
param['db'] = self.supported_games[name].db
|
||||||
param['rows'] = self.supported_games[name].rows
|
param['rows'] = self.supported_games[name].rows
|
||||||
|
@ -633,7 +607,7 @@ class Config:
|
||||||
def get_supported_games(self):
|
def get_supported_games(self):
|
||||||
"""Get the list of supported games."""
|
"""Get the list of supported games."""
|
||||||
sg = []
|
sg = []
|
||||||
for game in c.supported_games.keys():
|
for game in c.supported_games:
|
||||||
sg.append(c.supported_games[game].game_name)
|
sg.append(c.supported_games[game].game_name)
|
||||||
return sg
|
return sg
|
||||||
|
|
||||||
|
|
|
@ -132,13 +132,15 @@ class Database:
|
||||||
def convert_cards(self, d):
|
def convert_cards(self, d):
|
||||||
ranks = ('', '', '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A')
|
ranks = ('', '', '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A')
|
||||||
cards = ""
|
cards = ""
|
||||||
for i in range(1, 8):
|
for i in xrange(1, 8):
|
||||||
if d['card' + str(i) + 'Value'] == None:
|
cv = "card%dValue" % i
|
||||||
|
if d[cv] == None:
|
||||||
break
|
break
|
||||||
elif d['card' + str(i) + 'Value'] == 0:
|
elif d[cv] == 0:
|
||||||
cards += "xx"
|
cards = "%sxx" % cards
|
||||||
else:
|
else:
|
||||||
cards += ranks[d['card' + str(i) + 'Value']] + d['card' +str(i) + 'Suit']
|
cs = "card%dSuit" % i
|
||||||
|
cards = "%s%s%s" % (cards, ranks[d[cv]], cs)
|
||||||
return cards
|
return cards
|
||||||
|
|
||||||
def get_action_from_hand(self, hand_no):
|
def get_action_from_hand(self, hand_no):
|
||||||
|
|
|
@ -123,8 +123,7 @@ class HUD_main(object):
|
||||||
gtk.gdk.threads_enter()
|
gtk.gdk.threads_enter()
|
||||||
try:
|
try:
|
||||||
self.hud_dict[table_name].update(new_hand_id, config)
|
self.hud_dict[table_name].update(new_hand_id, config)
|
||||||
for m in self.hud_dict[table_name].aux_windows:
|
map(lambda aw: aw.update_gui(new_hand_id), self.hud_dict[table_name].aux_windows)
|
||||||
m.update_gui(new_hand_id)
|
|
||||||
return False
|
return False
|
||||||
finally:
|
finally:
|
||||||
gtk.gdk.threads_leave()
|
gtk.gdk.threads_leave()
|
||||||
|
@ -140,7 +139,7 @@ class HUD_main(object):
|
||||||
self.db_connection = Database.Database(self.config, self.db_name, 'temp')
|
self.db_connection = Database.Database(self.config, self.db_name, 'temp')
|
||||||
tourny_finder = re.compile('(\d+) (\d+)')
|
tourny_finder = re.compile('(\d+) (\d+)')
|
||||||
|
|
||||||
while True: # wait for a new hand number on stdin
|
while 1: # wait for a new hand number on stdin
|
||||||
new_hand_id = sys.stdin.readline()
|
new_hand_id = sys.stdin.readline()
|
||||||
new_hand_id = string.rstrip(new_hand_id)
|
new_hand_id = string.rstrip(new_hand_id)
|
||||||
if new_hand_id == "": # blank line means quit
|
if new_hand_id == "": # blank line means quit
|
||||||
|
@ -187,7 +186,7 @@ class HUD_main(object):
|
||||||
if tablewindow == None:
|
if tablewindow == 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 is_tournament:
|
if is_tournament:
|
||||||
table_name = tour_number + " " + tab_number
|
table_name = "%s %s" % (tour_number, tab_number)
|
||||||
sys.stderr.write("table name "+table_name+" not found, skipping.\n")
|
sys.stderr.write("table name "+table_name+" not found, skipping.\n")
|
||||||
else:
|
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, is_tournament, stat_dict, cards)
|
||||||
|
|
|
@ -172,7 +172,7 @@ class HandHistoryConverter(threading.Thread):
|
||||||
return
|
return
|
||||||
|
|
||||||
self.obs = self.obs.replace('\r\n', '\n')
|
self.obs = self.obs.replace('\r\n', '\n')
|
||||||
self.gametype = self.determineGameType()
|
self.gametype = self.determineGameType(self.obs)
|
||||||
if self.gametype == None:
|
if self.gametype == None:
|
||||||
print "Unknown game type from file, aborting on this file."
|
print "Unknown game type from file, aborting on this file."
|
||||||
return
|
return
|
||||||
|
@ -208,7 +208,7 @@ class HandHistoryConverter(threading.Thread):
|
||||||
|
|
||||||
# Read actions in street order
|
# Read actions in street order
|
||||||
for street in hand.streetList: # go through them in order
|
for street in hand.streetList: # go through them in order
|
||||||
print "DEBUG: ", street
|
# print "DEBUG: ", street
|
||||||
if hand.streets.group(street) is not None:
|
if hand.streets.group(street) is not None:
|
||||||
if self.gametype[1] == "hold" or self.gametype[1] == "omahahi":
|
if self.gametype[1] == "hold" or self.gametype[1] == "omahahi":
|
||||||
self.readCommunityCards(hand, street) # read community cards
|
self.readCommunityCards(hand, street) # read community cards
|
||||||
|
@ -247,7 +247,7 @@ class HandHistoryConverter(threading.Thread):
|
||||||
# type base limit
|
# type base limit
|
||||||
# [ ring, hold, nl , sb, bb ]
|
# [ ring, hold, nl , sb, bb ]
|
||||||
# Valid types specified in docs/tabledesign.html in Gametypes
|
# Valid types specified in docs/tabledesign.html in Gametypes
|
||||||
def determineGameType(self): abstract
|
def determineGameType(self, handText): abstract
|
||||||
|
|
||||||
# Read any of:
|
# Read any of:
|
||||||
# HID HandID
|
# HID HandID
|
||||||
|
|
|
@ -98,8 +98,7 @@ class Hud:
|
||||||
# Set up a main window for this this instance of the HUD
|
# Set up a main window for this this instance of the HUD
|
||||||
self.main_window = gtk.Window()
|
self.main_window = gtk.Window()
|
||||||
self.main_window.set_gravity(gtk.gdk.GRAVITY_STATIC)
|
self.main_window.set_gravity(gtk.gdk.GRAVITY_STATIC)
|
||||||
self.main_window.set_title(self.table.name + " FPDBHUD")
|
self.main_window.set_title("%s FPDBHUD" % (self.table.name))
|
||||||
# self.main_window.destroyhandler = self.main_window.connect("destroy", self.kill_hud)
|
|
||||||
self.main_window.set_decorated(False)
|
self.main_window.set_decorated(False)
|
||||||
self.main_window.set_opacity(self.colors["hudopacity"])
|
self.main_window.set_opacity(self.colors["hudopacity"])
|
||||||
|
|
||||||
|
@ -171,7 +170,7 @@ class Hud:
|
||||||
self.main_window.move(x, y)
|
self.main_window.move(x, y)
|
||||||
adj = self.adj_seats(self.hand, self.config)
|
adj = self.adj_seats(self.hand, self.config)
|
||||||
loc = self.config.get_locations(self.table.site, self.max)
|
loc = self.config.get_locations(self.table.site, self.max)
|
||||||
for i in range(1, self.max + 1):
|
for i in xrange(1, self.max + 1):
|
||||||
(x, y) = loc[adj[i]]
|
(x, y) = loc[adj[i]]
|
||||||
if i in self.stat_windows:
|
if i in self.stat_windows:
|
||||||
self.stat_windows[i].relocate(x, y)
|
self.stat_windows[i].relocate(x, y)
|
||||||
|
@ -190,18 +189,15 @@ class Hud:
|
||||||
# kill all stat_windows, popups and aux_windows in this HUD
|
# kill all stat_windows, popups and aux_windows in this HUD
|
||||||
# heap dead, burnt bodies, blood 'n guts, veins between my teeth
|
# heap dead, burnt bodies, blood 'n guts, veins between my teeth
|
||||||
for s in self.stat_windows.itervalues():
|
for s in self.stat_windows.itervalues():
|
||||||
for p in s.popups:
|
s.kill_popups()
|
||||||
s.kill_popup(p)
|
s.window.destroy()
|
||||||
s.window.destroy()
|
self.stat_windows = {}
|
||||||
self.stat_windows = {}
|
|
||||||
# also kill any aux windows
|
# also kill any aux windows
|
||||||
for m in self.aux_windows:
|
map(lambda m: m.destroy(), self.aux_windows)
|
||||||
m.destroy()
|
|
||||||
self.aux_windows = []
|
self.aux_windows = []
|
||||||
|
|
||||||
def reposition_windows(self, *args):
|
def reposition_windows(self, *args):
|
||||||
for w in self.stat_windows:
|
map(lambda x: x.window.move(x.x, x.y), self.stat_windows)
|
||||||
self.stat_windows[w].window.move(self.stat_windows[w].x, self.stat_windows[w].y)
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def debug_stat_windows(self, *args):
|
def debug_stat_windows(self, *args):
|
||||||
|
@ -220,7 +216,7 @@ class Hud:
|
||||||
|
|
||||||
def adj_seats(self, hand, config):
|
def adj_seats(self, hand, config):
|
||||||
|
|
||||||
adj = range(0, self.max + 1) # default seat adjustments = no adjustment
|
adj = xrange(0, self.max + 1) # default seat adjustments = no adjustment
|
||||||
# does the user have a fav_seat?
|
# does the user have a fav_seat?
|
||||||
try:
|
try:
|
||||||
sys.stderr.write("site = %s, max = %d, fav seat = %d\n" % (self.table.site, self.max, config.supported_sites[self.table.site].layout[self.max].fav_seat))
|
sys.stderr.write("site = %s, max = %d, fav seat = %d\n" % (self.table.site, self.max, config.supported_sites[self.table.site].layout[self.max].fav_seat))
|
||||||
|
@ -230,7 +226,7 @@ class Hud:
|
||||||
# actual_seat = self.db_connection.get_actual_seat(hand, config.supported_sites[self.table.site].screen_name)
|
# actual_seat = self.db_connection.get_actual_seat(hand, config.supported_sites[self.table.site].screen_name)
|
||||||
actual_seat = self.get_actual_seat(config.supported_sites[self.table.site].screen_name)
|
actual_seat = self.get_actual_seat(config.supported_sites[self.table.site].screen_name)
|
||||||
sys.stderr.write("found actual seat = %d\n" % actual_seat)
|
sys.stderr.write("found actual seat = %d\n" % actual_seat)
|
||||||
for i in range(0, self.max + 1):
|
for i in xrange(0, self.max + 1):
|
||||||
j = actual_seat + i
|
j = actual_seat + i
|
||||||
if j > self.max: j = j - self.max
|
if j > self.max: j = j - self.max
|
||||||
adj[j] = fav_seat + i
|
adj[j] = fav_seat + i
|
||||||
|
@ -241,7 +237,7 @@ class Hud:
|
||||||
return adj
|
return adj
|
||||||
|
|
||||||
def get_actual_seat(self, name):
|
def get_actual_seat(self, name):
|
||||||
for key in self.stat_dict.keys():
|
for key in self.stat_dict:
|
||||||
if self.stat_dict[key]['screen_name'] == name:
|
if self.stat_dict[key]['screen_name'] == name:
|
||||||
return self.stat_dict[key]['seat']
|
return self.stat_dict[key]['seat']
|
||||||
sys.stderr.write("Error finding actual seat.\n")
|
sys.stderr.write("Error finding actual seat.\n")
|
||||||
|
@ -263,7 +259,7 @@ class Hud:
|
||||||
loc = self.config.get_locations(self.table.site, self.max)
|
loc = self.config.get_locations(self.table.site, self.max)
|
||||||
|
|
||||||
# create the stat windows
|
# create the stat windows
|
||||||
for i in range(1, self.max + 1):
|
for i in xrange(1, self.max + 1):
|
||||||
(x, y) = loc[adj[i]]
|
(x, y) = loc[adj[i]]
|
||||||
if i in self.stat_windows:
|
if i in self.stat_windows:
|
||||||
self.stat_windows[i].relocate(x, y)
|
self.stat_windows[i].relocate(x, y)
|
||||||
|
@ -280,7 +276,7 @@ class Hud:
|
||||||
font = self.font)
|
font = self.font)
|
||||||
|
|
||||||
self.stats = []
|
self.stats = []
|
||||||
for i in range(0, config.supported_games[self.poker_game].rows + 1):
|
for i in xrange(0, config.supported_games[self.poker_game].rows + 1):
|
||||||
row_list = [''] * config.supported_games[self.poker_game].cols
|
row_list = [''] * config.supported_games[self.poker_game].cols
|
||||||
self.stats.append(row_list)
|
self.stats.append(row_list)
|
||||||
for stat in config.supported_games[self.poker_game].stats:
|
for stat in config.supported_games[self.poker_game].stats:
|
||||||
|
@ -304,8 +300,8 @@ class Hud:
|
||||||
self.create(hand, config, self.stat_dict, self.cards)
|
self.create(hand, config, self.stat_dict, self.cards)
|
||||||
self.stat_windows[self.stat_dict[s]['seat']].player_id = self.stat_dict[s]['player_id']
|
self.stat_windows[self.stat_dict[s]['seat']].player_id = self.stat_dict[s]['player_id']
|
||||||
|
|
||||||
for r in range(0, config.supported_games[self.poker_game].rows):
|
for r in xrange(0, config.supported_games[self.poker_game].rows):
|
||||||
for c in range(0, config.supported_games[self.poker_game].cols):
|
for c in xrange(0, config.supported_games[self.poker_game].cols):
|
||||||
this_stat = config.supported_games[self.poker_game].stats[self.stats[r][c]]
|
this_stat = config.supported_games[self.poker_game].stats[self.stats[r][c]]
|
||||||
number = Stats.do_stat(self.stat_dict, player = self.stat_dict[s]['player_id'], stat = self.stats[r][c])
|
number = Stats.do_stat(self.stat_dict, player = self.stat_dict[s]['player_id'], stat = self.stats[r][c])
|
||||||
statstring = this_stat.hudprefix + str(number[1]) + this_stat.hudsuffix
|
statstring = this_stat.hudprefix + str(number[1]) + this_stat.hudsuffix
|
||||||
|
@ -369,6 +365,10 @@ class Stat_Window:
|
||||||
def kill_popup(self, popup):
|
def kill_popup(self, popup):
|
||||||
popup.window.destroy()
|
popup.window.destroy()
|
||||||
self.popups.remove(popup)
|
self.popups.remove(popup)
|
||||||
|
|
||||||
|
def kill_popups(self):
|
||||||
|
map(lambda x: x.window.destroy(), self.popups)
|
||||||
|
self.popups = { }
|
||||||
|
|
||||||
def relocate(self, x, y):
|
def relocate(self, x, y):
|
||||||
self.x = x + self.table.x
|
self.x = x + self.table.x
|
||||||
|
@ -403,35 +403,38 @@ class Stat_Window:
|
||||||
self.e_box = []
|
self.e_box = []
|
||||||
self.frame = []
|
self.frame = []
|
||||||
self.label = []
|
self.label = []
|
||||||
for r in range(self.game.rows):
|
usegtkframes = self.useframes
|
||||||
if self.useframes:
|
e_box = self.e_box
|
||||||
|
label = self.label
|
||||||
|
for r in xrange(self.game.rows):
|
||||||
|
if usegtkframes:
|
||||||
self.frame.append([])
|
self.frame.append([])
|
||||||
self.e_box.append([])
|
e_box.append([])
|
||||||
self.label.append([])
|
label.append([])
|
||||||
for c in range(self.game.cols):
|
for c in xrange(self.game.cols):
|
||||||
if self.useframes:
|
if usegtkframes:
|
||||||
self.frame[r].append( gtk.Frame() )
|
self.frame[r].append( gtk.Frame() )
|
||||||
self.e_box[r].append( gtk.EventBox() )
|
e_box[r].append( gtk.EventBox() )
|
||||||
|
|
||||||
self.e_box[r][c].modify_bg(gtk.STATE_NORMAL, parent.backgroundcolor)
|
e_box[r][c].modify_bg(gtk.STATE_NORMAL, parent.backgroundcolor)
|
||||||
self.e_box[r][c].modify_fg(gtk.STATE_NORMAL, parent.foregroundcolor)
|
e_box[r][c].modify_fg(gtk.STATE_NORMAL, parent.foregroundcolor)
|
||||||
|
|
||||||
Stats.do_tip(self.e_box[r][c], 'stuff')
|
Stats.do_tip(e_box[r][c], 'stuff')
|
||||||
if self.useframes:
|
if usegtkframes:
|
||||||
self.grid.attach(self.frame[r][c], c, c+1, r, r+1, xpadding = 0, ypadding = 0)
|
self.grid.attach(self.frame[r][c], c, c+1, r, r+1, xpadding = 0, ypadding = 0)
|
||||||
self.frame[r][c].add(self.e_box[r][c])
|
self.frame[r][c].add(e_box[r][c])
|
||||||
else:
|
else:
|
||||||
self.grid.attach(self.e_box[r][c], c, c+1, r, r+1, xpadding = 0, ypadding = 0)
|
self.grid.attach(e_box[r][c], c, c+1, r, r+1, xpadding = 0, ypadding = 0)
|
||||||
self.label[r].append( gtk.Label('xxx') )
|
label[r].append( gtk.Label('xxx') )
|
||||||
|
|
||||||
if self.useframes:
|
if usegtkframes:
|
||||||
self.frame[r][c].modify_bg(gtk.STATE_NORMAL, parent.backgroundcolor)
|
self.frame[r][c].modify_bg(gtk.STATE_NORMAL, parent.backgroundcolor)
|
||||||
self.label[r][c].modify_bg(gtk.STATE_NORMAL, parent.backgroundcolor)
|
label[r][c].modify_bg(gtk.STATE_NORMAL, parent.backgroundcolor)
|
||||||
self.label[r][c].modify_fg(gtk.STATE_NORMAL, parent.foregroundcolor)
|
label[r][c].modify_fg(gtk.STATE_NORMAL, parent.foregroundcolor)
|
||||||
|
|
||||||
self.e_box[r][c].add(self.label[r][c])
|
e_box[r][c].add(self.label[r][c])
|
||||||
self.e_box[r][c].connect("button_press_event", self.button_press_cb)
|
e_box[r][c].connect("button_press_event", self.button_press_cb)
|
||||||
self.label[r][c].modify_font(font)
|
label[r][c].modify_font(font)
|
||||||
|
|
||||||
self.window.set_opacity(parent.colors['hudopacity'])
|
self.window.set_opacity(parent.colors['hudopacity'])
|
||||||
|
|
||||||
|
@ -475,8 +478,8 @@ class Popup_window:
|
||||||
# figure out the row, col address of the click that activated the popup
|
# figure out the row, col address of the click that activated the popup
|
||||||
row = 0
|
row = 0
|
||||||
col = 0
|
col = 0
|
||||||
for r in range(0, stat_window.game.rows):
|
for r in xrange(0, stat_window.game.rows):
|
||||||
for c in range(0, stat_window.game.cols):
|
for c in xrange(0, stat_window.game.cols):
|
||||||
if stat_window.e_box[r][c] == parent:
|
if stat_window.e_box[r][c] == parent:
|
||||||
row = r
|
row = r
|
||||||
col = c
|
col = c
|
||||||
|
@ -557,8 +560,11 @@ class Popup_window:
|
||||||
|
|
||||||
for w in tl_windows:
|
for w in tl_windows:
|
||||||
if w[1] == unique_name:
|
if w[1] == unique_name:
|
||||||
win32gui.SetWindowPos(w[0], win32con.HWND_TOPMOST, 0, 0, 0, 0, win32con.SWP_NOMOVE|win32con.SWP_NOSIZE)
|
window.set_transient_for(self.parent.main_window)
|
||||||
|
style = win32gui.GetWindowLong(self.table.number, win32con.GWL_EXSTYLE)
|
||||||
|
style |= win32con.WS_CLIPCHILDREN
|
||||||
|
win32gui.SetWindowLong(self.table.number, win32con.GWL_EXSTYLE, style)
|
||||||
|
|
||||||
window.set_title(real_name)
|
window.set_title(real_name)
|
||||||
|
|
||||||
if __name__== "__main__":
|
if __name__== "__main__":
|
||||||
|
|
|
@ -208,8 +208,7 @@ class Importer:
|
||||||
#if os.path.isdir(file):
|
#if os.path.isdir(file):
|
||||||
#self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1])
|
#self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1])
|
||||||
|
|
||||||
for dir in self.addToDirList:
|
self.addToDirList = filter(lambda x: self.addImportDirectory(x, True, self.addToDirList[x][0], self.addToDirList[x][1]), self.addToDirList)
|
||||||
self.addImportDirectory(dir, True, self.addToDirList[dir][0], self.addToDirList[dir][1])
|
|
||||||
|
|
||||||
for file in self.removeFromFileList:
|
for file in self.removeFromFileList:
|
||||||
if file in self.filelist:
|
if file in self.filelist:
|
||||||
|
@ -309,7 +308,7 @@ class Importer:
|
||||||
partial=0 #counter
|
partial=0 #counter
|
||||||
errors=0 #counter
|
errors=0 #counter
|
||||||
|
|
||||||
for i in range (len(self.lines)): #main loop, iterates through the lines of a file and calls the appropriate parser method
|
for i in xrange (len(self.lines)): #main loop, iterates through the lines of a file and calls the appropriate parser method
|
||||||
if (len(self.lines[i])<2):
|
if (len(self.lines[i])<2):
|
||||||
endpos=i
|
endpos=i
|
||||||
hand=self.lines[startpos:endpos]
|
hand=self.lines[startpos:endpos]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user