git12 - added percent sign to tv display

removed debug prints that im not going to touch for a while.
This commit is contained in:
steffen123 2008-08-06 21:09:29 +01:00
parent fb7a8ba9a2
commit 5ee5594741
4 changed files with 24 additions and 23 deletions

View File

@ -2,6 +2,7 @@ todolist (db=database, imp=importer, tv=tableviewer)
before alpha
============
colour in tv
verify at least one PrintPlayerFlags
in tv, select from hud table using named fields rather than the current *
imp/tv bug: handcount is only about 1/2 of what it should be

View File

@ -30,7 +30,7 @@ import table_viewer
class fpdb:
def tab_clicked(self, widget, tab_name):
"""called when a tab button is clicked to activate that tab"""
print "start of tab_clicked"
#print "start of tab_clicked"
self.display_tab(tab_name)
#end def tab_clicked
@ -42,7 +42,7 @@ class fpdb:
def add_tab(self, new_tab, new_tab_name):
"""adds a tab, namely creates the button and displays it and appends all the relevant arrays"""
print "start of add_tab"
#print "start of add_tab"
for i in self.tab_names: #todo: check this is valid
if i==new_tab_name:
raise fpdb_simple.FpdbError("duplicate tab_name not permitted")
@ -59,11 +59,11 @@ class fpdb:
def display_tab(self, new_tab_name):
"""displays the indicated tab"""
print "start of display_tab, len(self.tab_names):",len(self.tab_names)
#print "start of display_tab, len(self.tab_names):",len(self.tab_names)
tab_no=-1
#if len(self.tab_names)>1:
for i in range(len(self.tab_names)):
print "display_tab, new_tab_name:",new_tab_name," self.tab_names[i]:", self.tab_names[i]
#print "display_tab, new_tab_name:",new_tab_name," self.tab_names[i]:", self.tab_names[i]
if (new_tab_name==self.tab_names[i]):
tab_no=i
#self.tab_buttons[i].set_active(False)
@ -309,7 +309,7 @@ class fpdb:
def tab_bulk_import(self, widget, data):
"""opens a tab for bulk importing"""
print "start of tab_bulk_import"
#print "start of tab_bulk_import"
new_import_thread=import_threaded.import_threaded(self.db, self.bulk_import_default_path)
self.threads.append(new_import_thread)
bulk_tab=new_import_thread.get_vbox()
@ -318,7 +318,7 @@ class fpdb:
def tab_main_help(self, widget, data):
"""Displays a tab with the main fpdb help screen"""
print "start of tab_main_help"
#print "start of tab_main_help"
mh_tab=gtk.Label("""Welcome to Fpdb
blabla todo make this read a file for the helptext
blabla
@ -328,7 +328,7 @@ blabla""")
def tab_table_viewer(self, widget, data):
"""opens a table viewer tab"""
print "start of tab_table_viewer"
#print "start of tab_table_viewer"
new_tv_thread=table_viewer.table_viewer(self.db)
self.threads.append(new_tv_thread)
tv_tab=new_tv_thread.get_vbox()
@ -343,7 +343,7 @@ blabla""")
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.connect("delete_event", self.delete_event)
self.window.connect("destroy", self.destroy)
self.window.set_title("Free Poker DB")
self.window.set_title("Free Poker DB - version: pre-alpha, git12")
self.window.set_border_width(1)
self.window.set_size_request(600,400)
self.window.set_resizable(True)

View File

@ -37,7 +37,7 @@ class fpdb_db:
#print "fpdb_db.connect, password:",password,"/end"
if backend==self.MYSQL_INNODB:
import MySQLdb
print "fpdb_db.connect, host:", host, " user:", user, " passwd:", password, " db:", database
#print "fpdb_db.connect, host:", host, " user:", user, " passwd:", password, " db:", database
self.db=MySQLdb.connect(host = host, user = user, passwd = password, db = database)
elif backend==self.PGSQL:
import pgdb
@ -73,7 +73,7 @@ class fpdb_db:
def reconnect(self, due_to_error=False):
"""Reconnects the DB"""
print "started fpdb_db.reconnect"
#print "started fpdb_db.reconnect"
self.disconnect(due_to_error)
self.connect(self.backend, self.host, self.database, self.user, self.password)
#end def disconnect

View File

@ -29,13 +29,13 @@ class table_viewer (threading.Thread):
if b==0:
return "n/a"
else:
return str(int((a/float(b))*100))
return str(int((a/float(b))*100))+"%"
return "todo"
#end def hudDivide
def browse_clicked(self, widget, data):
"""runs when user clicks browse on tv tab"""
print "start of table_viewer.browser_clicked"
#print "start of table_viewer.browser_clicked"
current_path=self.filename_tbuffer.get_text(self.filename_tbuffer.get_start_iter(), self.filename_tbuffer.get_end_iter())
dia_chooser = gtk.FileChooserDialog(title="Please choose the file for which you want to open the Table Viewer",
@ -56,7 +56,7 @@ class table_viewer (threading.Thread):
def prepare_data(self):
"""prepares the data for display by refresh_clicked, returns a 2D array"""
print "start of prepare_data"
#print "start of prepare_data"
arr=[]
#first prepare the header row
if (self.category=="holdem" or self.category=="omahahi" or self.category=="omahahilo"):
@ -91,7 +91,7 @@ class table_viewer (threading.Thread):
def refresh_clicked(self, widget, data):
"""runs when user clicks refresh"""
if self.debug: print "start of table_viewer.refresh_clicked"
#print "start of table_viewer.refresh_clicked"
arr=self.prepare_data()
try: self.data_table.destroy()
@ -109,37 +109,37 @@ class table_viewer (threading.Thread):
def read_names_clicked(self, widget, data):
"""runs when user clicks read names"""
print "start of table_viewer.read_names_clicked"
print "self.last_read_hand:",self.last_read_hand
#print "start of table_viewer.read_names_clicked"
#print "self.last_read_hand:",self.last_read_hand
self.db.reconnect()
self.cursor=self.db.cursor
self.cursor.execute("""SELECT id FROM hands WHERE site_hand_no=%s""", (self.last_read_hand))
hands_id_tmp=self.db.cursor.fetchone()
print "tmp:",hands_id_tmp
#print "tmp:",hands_id_tmp
self.hands_id=hands_id_tmp[0]
self.db.cursor.execute("SELECT gametype_id FROM hands WHERE id=%s", (self.hands_id, ))
self.gametype_id=self.db.cursor.fetchone()[0]
self.cursor.execute("SELECT category FROM gametypes WHERE id=%s", (self.gametype_id, ))
self.category=self.db.cursor.fetchone()[0]
print "self.gametype_id", self.gametype_id," category:", self.category, " self.hands_id:", self.hands_id
#print "self.gametype_id", self.gametype_id," category:", self.category, " self.hands_id:", self.hands_id
self.db.cursor.execute("""SELECT DISTINCT players.id FROM hands_players
INNER JOIN players ON hands_players.player_id=players.id
WHERE hand_id=%s""", (self.hands_id, ))
self.player_ids=self.db.cursor.fetchall()
print "self.player_ids:",self.player_ids
#print "self.player_ids:",self.player_ids
self.db.cursor.execute("""SELECT DISTINCT players.name FROM hands_players
INNER JOIN players ON hands_players.player_id=players.id
WHERE hand_id=%s""", (self.hands_id, ))
self.player_names=self.db.cursor.fetchall()
print "self.player_names:",self.player_names
#print "self.player_names:",self.player_names
#end def table_viewer.read_names_clicked
def import_clicked(self, widget, data):
"""runs when user clicks import"""
print "start of table_viewer.import_clicked"
#print "start of table_viewer.import_clicked"
self.inputFile=self.filename_tbuffer.get_text(self.filename_tbuffer.get_start_iter(), self.filename_tbuffer.get_end_iter())
self.server=self.db.host
@ -157,7 +157,7 @@ class table_viewer (threading.Thread):
def all_clicked(self, widget, data):
"""runs when user clicks all"""
print "start of table_viewer.all_clicked"
#print "start of table_viewer.all_clicked"
self.import_clicked(widget, data)
self.read_names_clicked(widget, data)
self.refresh_clicked(widget, data)
@ -171,7 +171,7 @@ class table_viewer (threading.Thread):
def __init__(self, db, debug=True):
"""Constructor for table_viewer"""
self.debug=debug
if self.debug: print "start of table_viewer constructor"
#print "start of table_viewer constructor"
self.db=db
self.cursor=db.cursor