Merge branch 'master' of git://git.assembla.com/fpdb-eric

This commit is contained in:
Worros 2011-03-07 10:55:11 +08:00
commit acb2fa23cb
11 changed files with 396 additions and 432 deletions

View File

@ -163,8 +163,8 @@ def get_logger(file_name, config = "config", fallback = False, log_dir=None, log
log = logging.basicConfig(filename=file, level=logging.INFO)
log = logging.getLogger()
# but it looks like default is no output :-( maybe because all the calls name a module?
log.debug(_("Default logger initialised for ")+file)
print _("Default logger intialised for ")+file
log.debug(_("Default logger initialised for %s") % file)
print(_("Default logger initialised for %s") % file)
return log
def check_dir(path, create = True):
@ -834,7 +834,7 @@ class Config:
try:
example_doc = xml.dom.minidom.parse(example_file)
except:
log.error(_("Error parsing example file %s. See error log file.") % (example_file))
log.error(_("Error parsing example configuration file %s. See error log file.") % (example_file))
return nodes_added
for cnode in doc.getElementsByTagName("FreePokerToolsConfig"):

View File

@ -1169,7 +1169,7 @@ class Database:
for idx in self.indexes[self.backend]:
if idx['drop'] == 1:
if self.backend == self.MYSQL_INNODB:
print _("Creating mysql index %s %s") % (idx['tab'], idx['col'])
print _("Creating MySQL index %s %s") % (idx['tab'], idx['col'])
try:
s = "alter table %s add index %s(%s)" % (idx['tab'],idx['col'],idx['col'])
c.execute(s)
@ -1178,7 +1178,7 @@ class Database:
elif self.backend == self.PGSQL:
# pass
# mod to use tab_col for index name?
print _("Creating pg index "), idx['tab'], idx['col']
print _("Creating PostgreSQL index "), idx['tab'], idx['col']
try:
s = "create index %s_%s_idx on %s(%s)" % (idx['tab'], idx['col'], idx['tab'], idx['col'])
c.execute(s)
@ -1423,22 +1423,22 @@ class Database:
if cons:
pass
else:
print _("creating foreign key "), fk['fktab'], fk['fkcol'], "->", fk['rtab'], fk['rcol']
print _("Creating foreign key "), fk['fktab'], fk['fkcol'], "->", fk['rtab'], fk['rcol']
try:
c.execute("alter table " + fk['fktab'] + " add foreign key ("
+ fk['fkcol'] + ") references " + fk['rtab'] + "("
+ fk['rcol'] + ")")
except:
print _(" create foreign key failed: ") + str(sys.exc_info())
print _("Create foreign key failed: ") + str(sys.exc_info())
elif self.backend == self.PGSQL:
print _("creating foreign key "), fk['fktab'], fk['fkcol'], "->", fk['rtab'], fk['rcol']
print _("Creating foreign key "), fk['fktab'], fk['fkcol'], "->", fk['rtab'], fk['rcol']
try:
c.execute("alter table " + fk['fktab'] + " add constraint "
+ fk['fktab'] + '_' + fk['fkcol'] + '_fkey'
+ " foreign key (" + fk['fkcol']
+ ") references " + fk['rtab'] + "(" + fk['rcol'] + ")")
except:
print _(" create foreign key failed: ") + str(sys.exc_info())
print _("Create foreign key failed: ") + str(sys.exc_info())
else:
print _("Only MySQL and Postgres supported so far")

View File

@ -630,7 +630,7 @@ class Filters(threading.Thread):
lbl_title = gtk.Label(self.filterText['playerstitle'])
lbl_title.set_alignment(xalign=0.0, yalign=0.5)
top_hbox.pack_start(lbl_title, expand=True, padding=3)
showb = gtk.Button(label="refresh", stock=None, use_underline=True)
showb = gtk.Button(label=_("Refresh"), stock=None, use_underline=True)
showb.set_alignment(xalign=1.0, yalign=0.5)
showb.connect('clicked', self.__refresh, 'players')
@ -676,7 +676,7 @@ class Filters(threading.Thread):
lbl_title.set_alignment(xalign=0.0, yalign=0.5)
top_hbox.pack_start(lbl_title, expand=True, padding=3)
showb = gtk.Button(label="hide", stock=None, use_underline=True)
showb = gtk.Button(label=_("hide"), stock=None, use_underline=True)
showb.set_alignment(xalign=1.0, yalign=0.5)
showb.connect('clicked', self.__toggle_box, 'sites')
showb.show()
@ -705,7 +705,7 @@ class Filters(threading.Thread):
lbl_title = gtk.Label(self.filterText['tourneyTypesTitle'])
lbl_title.set_alignment(xalign=0.0, yalign=0.5)
top_hbox.pack_start(lbl_title, expand=True, padding=3)
showb = gtk.Button(label="hide", stock=None, use_underline=True)
showb = gtk.Button(label=_("hide"), stock=None, use_underline=True)
showb.set_alignment(xalign=1.0, yalign=0.5)
showb.connect('clicked', self.__toggle_box, 'tourneyTypes')
top_hbox.pack_start(showb, expand=False, padding=1)
@ -731,7 +731,7 @@ class Filters(threading.Thread):
lbl_title = gtk.Label(self.filterText['gamestitle'])
lbl_title.set_alignment(xalign=0.0, yalign=0.5)
top_hbox.pack_start(lbl_title, expand=True, padding=3)
showb = gtk.Button(label="hide", stock=None, use_underline=True)
showb = gtk.Button(label=_("hide"), stock=None, use_underline=True)
showb.set_alignment(xalign=1.0, yalign=0.5)
showb.connect('clicked', self.__toggle_box, 'games')
top_hbox.pack_start(showb, expand=False, padding=1)
@ -758,7 +758,7 @@ class Filters(threading.Thread):
lbl_title = gtk.Label(self.filterText['limitstitle'])
lbl_title.set_alignment(xalign=0.0, yalign=0.5)
top_hbox.pack_start(lbl_title, expand=True, padding=3)
showb = gtk.Button(label="hide", stock=None, use_underline=True)
showb = gtk.Button(label=_("hide"), stock=None, use_underline=True)
showb.set_alignment(xalign=1.0, yalign=0.5)
showb.connect('clicked', self.__toggle_box, 'limits')
top_hbox.pack_start(showb, expand=False, padding=1)
@ -872,7 +872,7 @@ class Filters(threading.Thread):
title = gtk.Label(_("Graphing Options:"))
title.set_alignment(xalign=0.0, yalign=0.5)
top_hbox.pack_start(title, expand=True, padding=3)
showb = gtk.Button(label="hide", stock=None, use_underline=True)
showb = gtk.Button(label=_("hide"), stock=None, use_underline=True)
showb.set_alignment(xalign=1.0, yalign=0.5)
showb.connect('clicked', self.__toggle_box, 'graphops')
top_hbox.pack_start(showb, expand=False, padding=1)
@ -923,7 +923,7 @@ class Filters(threading.Thread):
lbl_title = gtk.Label(self.filterText['seatstitle'])
lbl_title.set_alignment(xalign=0.0, yalign=0.5)
hbox.pack_start(lbl_title, expand=True, padding=3)
showb = gtk.Button(label="hide", stock=None, use_underline=True)
showb = gtk.Button(label=_("hide"), stock=None, use_underline=True)
showb.set_alignment(xalign=1.0, yalign=0.5)
showb.connect('clicked', self.__toggle_box, 'seats')
hbox.pack_start(showb, expand=False, padding=1)
@ -957,7 +957,7 @@ class Filters(threading.Thread):
lbl_title = gtk.Label(self.filterText['groupstitle'])
lbl_title.set_alignment(xalign=0.0, yalign=0.5)
hbox.pack_start(lbl_title, expand=True, padding=3)
showb = gtk.Button(label="hide", stock=None, use_underline=True)
showb = gtk.Button(label=_("hide"), stock=None, use_underline=True)
showb.set_alignment(xalign=1.0, yalign=0.5)
showb.connect('clicked', self.__toggle_box, 'groups')
hbox.pack_start(showb, expand=False, padding=1)
@ -1015,7 +1015,7 @@ class Filters(threading.Thread):
lbl_title = gtk.Label(self.filterText['datestitle'])
lbl_title.set_alignment(xalign=0.0, yalign=0.5)
top_hbox.pack_start(lbl_title, expand=True, padding=3)
showb = gtk.Button(label="hide", stock=None, use_underline=True)
showb = gtk.Button(label=_("hide"), stock=None, use_underline=True)
showb.set_alignment(xalign=1.0, yalign=0.5)
showb.connect('clicked', self.__toggle_box, 'dates')
top_hbox.pack_start(showb, expand=False, padding=1)
@ -1065,10 +1065,10 @@ class Filters(threading.Thread):
def __toggle_box(self, widget, entry):
if self.boxes[entry].props.visible:
self.boxes[entry].hide()
widget.set_label("show")
widget.set_label(_("show"))
else:
self.boxes[entry].show()
widget.set_label("hide")
widget.set_label(_("hide"))
#end def __toggle_box
def __calendar_dialog(self, widget, entry):

View File

@ -228,7 +228,7 @@ class GuiGraphViewer (threading.Thread):
#TODO: Do something useful like alert user
#print "No hands returned by graph query"
else:
self.ax.set_title(_("Profit graph for ring games"+names),fontsize=12)
self.ax.set_title((_("Profit graph for ring games")+names),fontsize=12)
#Draw plot
self.ax.plot(green, color='green', label=_('Hands: %d\nProfit (%s): %.2f') %(len(green),graphops['dspin'], green[-1]))

View File

@ -140,9 +140,9 @@ class GuiRingPlayerStats (GuiPlayerStats.GuiPlayerStats):
}
self.filters = Filters.Filters(self.db, self.conf, self.sql, display = filters_display)
self.filters.registerButton1Name("_Filters")
self.filters.registerButton1Name(_("_Filters"))
self.filters.registerButton1Callback(self.showDetailFilter)
self.filters.registerButton2Name("_Refresh Stats")
self.filters.registerButton2Name(_("_Refresh Stats"))
self.filters.registerButton2Callback(self.refreshStats)
# ToDo: store in config

View File

@ -52,6 +52,7 @@ if sys.platform == 'linux2':
elif sys.platform == 'darwin':
import OSXTables as Tables
else: # This is bad--figure out the values for the various windows flavors
is_windows = True
import WinTables as Tables
# get config and set up logger
@ -126,7 +127,9 @@ class HUD_main(object):
hud.up_update_table_position()
def client_resized(self, widget, hud):
gobject.idle_add(idle_resize, hud)
# Don't forget to get rid of this.
if not is_windows:
gigobject.idle_add(idle_resize, hud)
def client_destroyed(self, widget, hud): # call back for terminating the main eventloop
self.kill_hud(None, hud.table.key)

View File

@ -370,7 +370,7 @@ class Hud:
self.label = label
menu.show_all()
self.main_window.show_all()
self.topify_window(self.main_window)
# self.topify_window(self.main_window)
def change_max_seats(self, widget):
if self.max != widget.ms:
@ -645,6 +645,9 @@ class Hud:
player_id = 'fake',
font = self.font)
self.topify_window(self.main_window)
for i in xrange(1, self.max + 1):
self.topify_window(self.stat_windows[i].window, self.main_window)
self.stats = []
game = config.supported_games[self.poker_game]
@ -710,13 +713,18 @@ class Hud:
window.window.show_all()
unhidewindow = False
def topify_window(self, window):
def topify_window(self, window, parentwindow=None):
window.set_focus_on_map(False)
window.set_accept_focus(False)
# print "topify_window", window, parentwindow
if not self.table.gdkhandle:
self.table.gdkhandle = gtk.gdk.window_foreign_new(int(self.table.number)) # gtk handle to poker window
window.window.set_transient_for(self.table.gdkhandle)
if parentwindow is not None:
window.window.set_transient_for(parentwindow.window)
else:
window.window.set_transient_for(self.table.gdkhandle)
window.set_destroy_with_parent(True)
class Stat_Window:
@ -791,6 +799,8 @@ class Stat_Window:
self.window.set_focus_on_map(False)
self.window.set_accept_focus(False)
self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_UTILITY)
grid = gtk.Table(rows = game.rows, columns = game.cols, homogeneous = False)
self.grid = grid
self.window.add(grid)
@ -845,20 +855,10 @@ class Stat_Window:
self.window.move(self.x, self.y)
self.window.realize() # window must be realized before it has a gdkwindow so we can attach it to the table window..
self.topify_window(self.window)
self.window.hide()
self.window.realize() # window must be realized before it has a gdkwindow so we can attach it to the table window..
# self.topify_window(self.window)
def topify_window(self, window):
window.set_focus_on_map(False)
window.set_accept_focus(False)
if not self.table.gdkhandle:
self.table.gdkhandle = gtk.gdk.window_foreign_new(int(self.table.number)) # gtk handle to poker window
# window.window.reparent(self.table.gdkhandle, 0, 0)
window.window.set_transient_for(self.table.gdkhandle)
# window.present()
def destroy(*args): # call back for terminating the main eventloop
gtk.main_quit()

View File

@ -26,6 +26,9 @@ client has been resized, destroyed, etc.
########################################################################
import L10n
_ = L10n.get_translation()
# Standard Library modules
import re
@ -66,7 +69,7 @@ bad_words = ('History for table:', 'HUD:', 'Chat:', 'FPDBHUD')
# Here are the custom signals we define for allowing the 'client watcher'
# thread to communicate with the gui thread. Any time a poker client is
# is moved, resized, or closed on of these signals is emitted to the
# is moved, resized, or closed one of these signals is emitted to the
# HUD main window.
gobject.signal_new("client_moved", gtk.Window,
gobject.SIGNAL_RUN_LAST,

View File

@ -56,12 +56,23 @@ class Table(Table_Window):
"""Finds poker client window with the given table name."""
titles = {}
win32gui.EnumWindows(win_enum_handler, titles)
for hwnd in titles:
for hwnd in titles:
if titles[hwnd] == "":
continue
if re.search(self.search_string, titles[hwnd], re.I):
if self.check_bad_words(titles[hwnd]):
continue
if not win32gui.IsWindowVisible(hwnd): # if window not visible, probably not a table
continue
if win32gui.GetParent(hwnd) != 0: # if window is a child of another window, probably not a table
continue
HasNoOwner = win32gui.GetWindow(hwnd, win32con.GW_OWNER) == 0
WindowStyle = win32gui.GetWindowLong(hwnd, win32con.GWL_EXSTYLE)
if HasNoOwner and WindowStyle & win32con.WS_EX_TOOLWINDOW != 0:
continue
if not HasNoOwner and WindowStyle & win32con.WS_EX_APPWINDOW == 0:
continue
self.window = hwnd
break

File diff suppressed because it is too large Load Diff

Binary file not shown.