From cb323d2d6323a508c53fb430e39786c2aefdbc32 Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Sun, 28 Jun 2009 17:20:41 +0100 Subject: [PATCH 1/6] remove unused queries --- pyfpdb/FpdbSQLQueries.py | 167 --------------------------------------- pyfpdb/fpdb_db.py | 1 - 2 files changed, 168 deletions(-) diff --git a/pyfpdb/FpdbSQLQueries.py b/pyfpdb/FpdbSQLQueries.py index 598c0868..db2d7231 100644 --- a/pyfpdb/FpdbSQLQueries.py +++ b/pyfpdb/FpdbSQLQueries.py @@ -248,43 +248,6 @@ class FpdbSQLQueries: self.query['createHandsTable'] = """ """ - ################################ - # Create Gametypes - ################################ - - if(self.dbname == 'MySQL InnoDB'): - self.query['createBoardCardsTable'] = """CREATE TABLE BoardCards ( - id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, PRIMARY KEY (id), - handId BIGINT UNSIGNED NOT NULL, FOREIGN KEY (handId) REFERENCES Hands(id), - card1Value smallint NOT NULL, - card1Suit char(1) NOT NULL, - card2Value smallint NOT NULL, - card2Suit char(1) NOT NULL, - card3Value smallint NOT NULL, - card3Suit char(1) NOT NULL, - card4Value smallint NOT NULL, - card4Suit char(1) NOT NULL, - card5Value smallint NOT NULL, - card5Suit char(1) NOT NULL) - ENGINE=INNODB""" - elif(self.dbname == 'PostgreSQL'): - self.query['createBoardCardsTable'] = """CREATE TABLE BoardCards ( - id BIGSERIAL, PRIMARY KEY (id), - handId BIGINT, FOREIGN KEY (handId) REFERENCES Hands(id), - card1Value smallint, - card1Suit char(1), - card2Value smallint, - card2Suit char(1), - card3Value smallint, - card3Suit char(1), - card4Value smallint, - card4Suit char(1), - card5Value smallint, - card5Suit char(1))""" - elif(self.dbname == 'SQLite'): - self.query['createBoardCardsTable'] = """ """ - - ################################ # Create TourneyTypes ################################ @@ -1550,136 +1513,6 @@ class FpdbSQLQueries: elif(self.dbname == 'SQLite'): self.query['playerStatsByPosition'] = """ """ - if(self.dbname == 'MySQL InnoDB'): - self.query['playerStatsByPositionAndHoleCards'] = """ - SELECT - concat(upper(stats.limitType), ' ' - ,concat(upper(substring(stats.category,1,1)),substring(stats.category,2) ), ' ' - ,stats.name, ' $' - ,cast(trim(leading ' ' from - case when stats.bigBlind < 100 then format(stats.bigBlind/100.0,2) - else format(stats.bigBlind/100.0,0) - end ) as char) - ) AS Game - ,case when stats.PlPosition = -2 then 'BB' - when stats.PlPosition = -1 then 'SB' - when stats.PlPosition = 0 then 'Btn' - when stats.PlPosition = 1 then 'CO' - when stats.PlPosition = 2 then 'MP' - when stats.PlPosition = 5 then 'EP' - else '??' - end AS PlPosition - /*,stats.n*/,hprof2.n - /*,stats.vpip*/,0 - /*,stats.pfr*/,0 - /*,stats.saw_f*/,0 - /*,stats.sawsd*/,0 - /*,stats.wtsdwsf*/,0 - /*,stats.wmsd*/,0 - /*,stats.FlAFq*/,0 - /*,stats.TuAFq*/,0 - /*,stats.RvAFq*/,0 - /*,stats.PoFAFq*/,0 - /* if you have handsactions data the next 3 fields should give same answer as - following 3 commented out fields */ - /*,stats.Net - ,stats.BBper100 - ,stats.Profitperhand*/ - ,format(hprof2.sum_profit/100.0,2) AS Net - /*,format((hprof2.sum_profit/(stats.bigBlind+0.0)) / (stats.n/100.0),2)*/,0 - AS BBlPer100 - ,hprof2.profitperhand AS Profitperhand - ,format(hprof2.variance,2) AS Variance - FROM - (select /* stats from hudcache */ - gt.base - ,gt.category - ,upper(gt.limitType) as limitType - ,s.name - ,gt.bigBlind - ,hc.gametypeId - ,case when hc.position = 'B' then -2 - when hc.position = 'S' then -1 - when hc.position = 'D' then 0 - when hc.position = 'C' then 1 - when hc.position = 'M' then 2 - when hc.position = 'E' then 5 - else 9 - end as PlPosition - ,sum(HDs) AS n - ,format(100.0*sum(street0VPI)/sum(HDs),1) AS vpip - ,format(100.0*sum(street0Aggr)/sum(HDs),1) AS pfr - ,format(100.0*sum(street1Seen)/sum(HDs),1) AS saw_f - ,format(100.0*sum(sawShowdown)/sum(HDs),1) AS sawsd - ,case when sum(street1Seen) = 0 then '-' - else format(100.0*sum(sawShowdown)/sum(street1Seen),1) - end AS wtsdwsf - ,case when sum(sawShowdown) = 0 then '-' - end AS wtsdwsf - ,case when sum(sawShowdown) = 0 then '-' - else format(100.0*sum(wonAtSD)/sum(sawShowdown),1) - end AS wmsd - ,case when sum(street1Seen) = 0 then '-' - else format(100.0*sum(street1Aggr)/sum(street1Seen),1) - end AS FlAFq - ,case when sum(street2Seen) = 0 then '-' - else format(100.0*sum(street2Aggr)/sum(street2Seen),1) - end AS TuAFq - ,case when sum(street3Seen) = 0 then '-' - else format(100.0*sum(street3Aggr)/sum(street3Seen),1) - end AS RvAFq - ,case when sum(street1Seen)+sum(street2Seen)+sum(street3Seen) = 0 then '-' - else format(100.0*(sum(street1Aggr)+sum(street2Aggr)+sum(street3Aggr)) - /(sum(street1Seen)+sum(street2Seen)+sum(street3Seen)),1) - end AS PoFAFq - ,format(sum(totalProfit)/100.0,2) AS Net - ,format((sum(totalProfit)/(gt.bigBlind+0.0)) / (sum(HDs)/100.0),2) - AS BBper100 - ,format( (sum(totalProfit)/100.0) / sum(HDs), 4) AS Profitperhand - from Gametypes gt - inner join Sites s on s.Id = gt.siteId - inner join HudCache hc on hc.gameTypeId = gt.Id - where hc.playerId in - # use here ? - group by gt.base - ,gt.category - ,upper(gt.limitType) - ,s.name - ,gt.bigBlind - ,hc.gametypeId - ,PlPosition - ) stats - inner join - ( select # profit from handsplayers/handsactions - hprof.gameTypeId, - case when hprof.position = 'B' then -2 - when hprof.position = 'S' then -1 - when hprof.position in ('3','4') then 2 - when hprof.position in ('6','7') then 5 - else hprof.position - end as PlPosition, - sum(hprof.profit) as sum_profit, - avg(hprof.profit/100.0) as profitperhand, - variance(hprof.profit/100.0) as variance, - count(*) as n - from - (select hp.handId, h.gameTypeId, hp.position, hp.winnings, SUM(ha.amount) as costs - , hp.winnings - SUM(ha.amount) as profit - from HandsPlayers hp - inner join Hands h ON h.id = hp.handId - left join HandsActions ha ON ha.handsPlayerId = hp.id - where hp.playerId in - # use here ? - and hp.tourneysPlayersId IS NULL - and ((hp.card1Value = and hp.card2Value = ) or (hp.card1Value = and hp.card2Value = )) - group by hp.handId, h.gameTypeId, hp.position, hp.winnings - ) hprof - group by hprof.gameTypeId, PlPosition - ) hprof2 - on ( hprof2.gameTypeId = stats.gameTypeId - and hprof2.PlPosition = stats.PlPosition) - order by stats.category, stats.limittype, stats.bigBlind, cast(stats.PlPosition as signed) - """ if(self.dbname == 'MySQL InnoDB') or (self.dbname == 'PostgreSQL') or (self.dbname == 'SQLite'): self.query['getGames'] = """SELECT DISTINCT category from Gametypes""" diff --git a/pyfpdb/fpdb_db.py b/pyfpdb/fpdb_db.py index 29817af9..911618e1 100644 --- a/pyfpdb/fpdb_db.py +++ b/pyfpdb/fpdb_db.py @@ -243,7 +243,6 @@ class fpdb_db: self.cursor.execute(self.sql.query['createPlayersTable']) self.cursor.execute(self.sql.query['createAutoratesTable']) self.cursor.execute(self.sql.query['createHandsTable']) - self.cursor.execute(self.sql.query['createBoardCardsTable']) self.cursor.execute(self.sql.query['createTourneyTypesTable']) self.cursor.execute(self.sql.query['createTourneysTable']) self.cursor.execute(self.sql.query['createTourneysPlayersTable']) From dc7a3fb88ebd82f90a87c6e344474498749727d4 Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Sun, 28 Jun 2009 18:56:18 +0100 Subject: [PATCH 2/6] finish removal of store_board_cards() --- pyfpdb/Database.py | 3 --- pyfpdb/fpdb_simple.py | 10 ---------- 2 files changed, 13 deletions(-) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index 2cade5de..f59476b9 100755 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -328,7 +328,6 @@ class Database: if 'updateHudCache' not in settings or settings['updateHudCache'] != 'drop': fpdb_simple.storeHudCache(self.backend, cursor, base, category, gametype_id, hand_start_time, player_ids, hudImportData) t5 = time() - fpdb_simple.store_board_cards(cursor, hands_id, board_values, board_suits) t6 = time() if self.saveActions: fpdb_simple.storeActions(cursor, hands_players_ids, action_types, allIns, action_amounts, actionNos) @@ -363,8 +362,6 @@ class Database: if 'updateHudCache' not in settings or settings['updateHudCache'] != 'drop': fpdb_simple.storeHudCache(self.backend, cursor, base, category, gametype_id, hand_start_time, player_ids, hudImportData) - fpdb_simple.store_board_cards(cursor, hands_id, board_values, board_suits) - if self.saveActions: fpdb_simple.storeActions(cursor, hands_players_ids, action_types, allIns, action_amounts, actionNos) return hands_id diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py index 34f99e2f..3e862254 100644 --- a/pyfpdb/fpdb_simple.py +++ b/pyfpdb/fpdb_simple.py @@ -1136,16 +1136,6 @@ def storeActions(cursor, handsPlayersIds, actionTypes, allIns, actionAmounts, ac cursor.executemany("INSERT INTO HandsActions (handsPlayerId, street, actionNo, action, allIn, amount) VALUES (%s, %s, %s, %s, %s, %s)", inserts) #end def storeActions -def store_board_cards(cursor, hands_id, board_values, board_suits): -#stores into table board_cards - cursor.execute ("""INSERT INTO BoardCards (handId, card1Value, card1Suit, -card2Value, card2Suit, card3Value, card3Suit, card4Value, card4Suit, -card5Value, card5Suit) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", - (hands_id, board_values[0], board_suits[0], board_values[1], board_suits[1], - board_values[2], board_suits[2], board_values[3], board_suits[3], - board_values[4], board_suits[4])) -#end def store_board_cards - def storeHands(backend, conn, cursor, site_hand_no, gametype_id ,hand_start_time, names, tableName, maxSeats, hudCache, board_values, board_suits): From a3e6c2696faa9dde60316b3f091d723aa06dbd37 Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Sun, 28 Jun 2009 19:19:32 +0100 Subject: [PATCH 3/6] use Database instead of fpdb_db --- pyfpdb/fpdb.py | 58 ++++++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py index 6c982002..3f6b7fb6 100755 --- a/pyfpdb/fpdb.py +++ b/pyfpdb/fpdb.py @@ -32,7 +32,7 @@ import pygtk pygtk.require('2.0') import gtk -import fpdb_db + import fpdb_simple import GuiBulkImport import GuiPlayerStats @@ -206,22 +206,23 @@ class fpdb: try: dia_confirm = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_WARNING, buttons=(gtk.BUTTONS_YES_NO), message_format="Confirm deleting and recreating tables") - diastring = "Please confirm that you want to (re-)create the tables. If there already are tables in the database "+self.db.database+" on "+self.db.host+" they will be deleted." + diastring = "Please confirm that you want to (re-)create the tables. If there already are tables in the database " \ + +self.db.fdb.database+" on "+self.db.fdb.host+" they will be deleted." dia_confirm.format_secondary_text(diastring)#todo: make above string with bold for db, host and deleted response = dia_confirm.run() dia_confirm.destroy() if response == gtk.RESPONSE_YES: - if self.db.backend == self.fdb_lock.MYSQL_INNODB: + if self.db.fdb.backend == self.fdb_lock.fdb.MYSQL_INNODB: # mysql requires locks on all tables or none - easier to release this lock # than lock all the other tables # ToDo: lock all other tables so that lock doesn't have to be released self.release_global_lock() lock_released = True - self.db.recreate_tables() + self.db.fdb.recreate_tables() else: # for other dbs use same connection as holds global lock - self.fdb_lock.recreate_tables() + self.fdb_lock.fdb.recreate_tables() elif response == gtk.RESPONSE_NO: print 'User cancelled recreating tables' except: @@ -362,13 +363,18 @@ class fpdb: self.settings.update(self.config.get_import_parameters()) self.settings.update(self.config.get_default_paths()) - if self.db!=None: - self.db.disconnect() + if self.db != None and self.db.fdb != None: + self.db.fdb.disconnect() - self.db = fpdb_db.fpdb_db() - #print "end of fpdb.load_profile, databaseName:",self.settings['db-databaseName'] - self.db.do_connect(self.config) - if self.db.wrongDbVersion: + self.sql = SQL.Sql(type = self.settings['db-type'], db_server = self.settings['db-server']) + self.db = Database.Database(self.config, sql = self.sql) + + + + + + + if self.db.fdb.wrongDbVersion: diaDbVersionWarning = gtk.Dialog(title="Strong Warning - Invalid database version", parent=None, flags=0, buttons=(gtk.STOCK_OK,gtk.RESPONSE_OK)) label = gtk.Label("An invalid DB version or missing tables have been detected.") @@ -387,18 +393,19 @@ class fpdb: diaDbVersionWarning.destroy() if self.status_bar == 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.status_bar = gtk.Label("Status: Connected to %s database named %s on host %s"%(self.db.fdb.get_backend_name(),self.db.fdb.database, self.db.fdb.host)) self.main_vbox.pack_end(self.status_bar, False, True, 0) self.status_bar.show() else: - self.status_bar.set_text("Status: Connected to %s database named %s on host %s" % (self.db.get_backend_name(),self.db.database, self.db.host)) + self.status_bar.set_text("Status: Connected to %s database named %s on host %s" % (self.db.fdb.get_backend_name(),self.db.fdb.database, self.db.fdb.host)) # Database connected to successfully, load queries to pass on to other classes - self.querydict = FpdbSQLQueries.FpdbSQLQueries(self.db.get_backend_name()) - self.sql = SQL.Sql(type = self.settings['db-type'], db_server = self.settings['db-server']) - self.dbi = Database.Database(self.config, sql = self.sql) # dbi for db interface and to avoid clashes with db/database/etc - # can rename later if required - self.db.db.rollback() + self.querydict = FpdbSQLQueries.FpdbSQLQueries(self.db.fdb.get_backend_name()) + self.db.fdb.db.rollback() + + + + #end def load_profile def not_implemented(self, widget, data=None): @@ -407,21 +414,22 @@ class fpdb: def obtain_global_lock(self): print "\nTaking global lock ..." - self.fdb_lock = fpdb_db.fpdb_db() - self.fdb_lock.do_connect(self.config) - return self.fdb_lock.get_global_lock() + self.fdb_lock = Database.Database(self.config, sql = self.sql) + + self.fdb_lock.fdb.do_connect(self.config) + return self.fdb_lock.fdb.get_global_lock() #end def obtain_global_lock def quit(self, widget, data=None): print "Quitting normally" #check if current settings differ from profile, if so offer to save or abort - self.db.disconnect() + self.db.fdb.disconnect() gtk.main_quit() #end def quit_cliecked def release_global_lock(self): - self.fdb_lock.db.rollback() - self.fdb_lock.disconnect() + self.fdb_lock.fdb.db.rollback() + self.fdb_lock.fdb.disconnect() print "Global lock released." #end def release_global_lock @@ -471,7 +479,7 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt") def tab_table_viewer(self, widget, data=None): """opens a table viewer tab""" #print "start of tab_table_viewer" - new_tv_thread=GuiTableViewer.GuiTableViewer(self.db, self.settings) + new_tv_thread=GuiTableViewer.GuiTableViewer(self.db.fdb, self.settings) self.threads.append(new_tv_thread) tv_tab=new_tv_thread.get_vbox() self.add_and_display_tab(tv_tab, "Table Viewer") From 04b9dd91268563e2569417a5252ababaf8376cd4 Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Tue, 30 Jun 2009 21:58:59 +0100 Subject: [PATCH 4/6] use Players table for global lock because Database.init() tries to access Hands --- pyfpdb/fpdb_db.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pyfpdb/fpdb_db.py b/pyfpdb/fpdb_db.py index 911618e1..f89b5d6d 100644 --- a/pyfpdb/fpdb_db.py +++ b/pyfpdb/fpdb_db.py @@ -567,17 +567,18 @@ class fpdb_db: print "analyze took", atime, "seconds" #end def analyzeDB - # Currently uses an exclusive lock on the Hands table as a global lock + # Currently uses an exclusive lock on the Players table as a global lock + # ( Changed because Hands is used in Database.init() ) # Return values are Unix style, 0 for success, positive integers for errors # 1 = generic error - # 2 = hands table does not exist (error message is suppressed) + # 2 = players table does not exist (error message is suppressed) def get_global_lock(self): if self.backend == self.MYSQL_INNODB: try: - self.cursor.execute( "lock tables Hands write" ) + self.cursor.execute( "lock tables Players write" ) except: - # Table 'fpdb.hands' doesn't exist - if str(sys.exc_value).find(".Hands' doesn't exist") >= 0: + # Table 'fpdb.players' doesn't exist + if str(sys.exc_value).find(".Players' doesn't exist") >= 0: return(2) print "Error! failed to obtain global lock. Close all programs accessing " \ + "database (including fpdb) and try again (%s)." \ @@ -585,11 +586,11 @@ class fpdb_db: return(1) elif self.backend == self.PGSQL: try: - self.cursor.execute( "lock table Hands in exclusive mode nowait" ) + self.cursor.execute( "lock table Players in exclusive mode nowait" ) #print "... after lock table, status =", self.cursor.statusmessage except: - # relation "hands" does not exist - if str(sys.exc_value).find('relation "hands" does not exist') >= 0: + # relation "players" does not exist + if str(sys.exc_value).find('relation "players" does not exist') >= 0: return(2) print "Error! failed to obtain global lock. Close all programs accessing " \ + "database (including fpdb) and try again (%s)." \ From cb1a4d2d0ab6500e11666cf92b4677b8f51953dc Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Tue, 30 Jun 2009 22:00:55 +0100 Subject: [PATCH 5/6] add wrappers for fpdb_db methods (plan is to move the fpdb_db methods into Database) --- pyfpdb/Database.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index f59476b9..cf80b3d3 100755 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -40,7 +40,7 @@ import Card class Database: def __init__(self, c, db_name = None, game = None, sql = None): # db_name and game not used any more - print "creating Database instance, sql =", sql + print "\ncreating Database instance, sql =", sql self.fdb = fpdb_db.fpdb_db() # sets self.fdb.db self.fdb.cursor and self.fdb.sql self.fdb.do_connect(c) self.connection = self.fdb.db @@ -87,13 +87,28 @@ class Database: #row = cur.fetchone() self.saveActions = False if self.import_options['saveActions'] == False else True + def do_connect(self, c): + self.fdb.do_connect(c) def commit(self): self.fdb.db.commit() def close_connection(self): self.connection.close() + + def disconnect(self, due_to_error=False): + """Disconnects the DB (rolls back if param is true, otherwise commits""" + self.fdb.disconnect(due_to_error) + + def reconnect(self, due_to_error=False): + """Reconnects the DB""" + self.fdb.reconnect(due_to_error=False) + + def get_backend_name(self): + """Reconnects the DB""" + return self.fdb.get_backend_name() + def get_table_name(self, hand_id): c = self.connection.cursor() c.execute(self.sql.query['get_table_name'], (hand_id, )) From 56ef131bedb9dc06998250d11b2890a83b886a7c Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Tue, 30 Jun 2009 22:18:15 +0100 Subject: [PATCH 6/6] use 1 or 2 Database methods instead of the underlying fpdb_db methods (more to do) --- pyfpdb/fpdb.py | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py index 3f6b7fb6..cdb89894 100755 --- a/pyfpdb/fpdb.py +++ b/pyfpdb/fpdb.py @@ -364,16 +364,11 @@ class fpdb: self.settings.update(self.config.get_default_paths()) if self.db != None and self.db.fdb != None: - self.db.fdb.disconnect() + self.db.disconnect() self.sql = SQL.Sql(type = self.settings['db-type'], db_server = self.settings['db-server']) self.db = Database.Database(self.config, sql = self.sql) - - - - - if self.db.fdb.wrongDbVersion: diaDbVersionWarning = gtk.Dialog(title="Strong Warning - Invalid database version", parent=None, flags=0, buttons=(gtk.STOCK_OK,gtk.RESPONSE_OK)) @@ -393,19 +388,15 @@ class fpdb: diaDbVersionWarning.destroy() if self.status_bar == None: - self.status_bar = gtk.Label("Status: Connected to %s database named %s on host %s"%(self.db.fdb.get_backend_name(),self.db.fdb.database, self.db.fdb.host)) + self.status_bar = gtk.Label("Status: Connected to %s database named %s on host %s"%(self.db.get_backend_name(),self.db.fdb.database, self.db.fdb.host)) self.main_vbox.pack_end(self.status_bar, False, True, 0) self.status_bar.show() else: - self.status_bar.set_text("Status: Connected to %s database named %s on host %s" % (self.db.fdb.get_backend_name(),self.db.fdb.database, self.db.fdb.host)) + self.status_bar.set_text("Status: Connected to %s database named %s on host %s" % (self.db.get_backend_name(),self.db.fdb.database, self.db.fdb.host)) # Database connected to successfully, load queries to pass on to other classes - self.querydict = FpdbSQLQueries.FpdbSQLQueries(self.db.fdb.get_backend_name()) - self.db.fdb.db.rollback() - - - - + self.querydict = FpdbSQLQueries.FpdbSQLQueries(self.db.get_backend_name()) + self.db.connection.rollback() #end def load_profile def not_implemented(self, widget, data=None): @@ -415,22 +406,21 @@ class fpdb: def obtain_global_lock(self): print "\nTaking global lock ..." self.fdb_lock = Database.Database(self.config, sql = self.sql) - - self.fdb_lock.fdb.do_connect(self.config) + self.fdb_lock.do_connect(self.config) return self.fdb_lock.fdb.get_global_lock() #end def obtain_global_lock def quit(self, widget, data=None): print "Quitting normally" #check if current settings differ from profile, if so offer to save or abort - self.db.fdb.disconnect() + self.db.disconnect() gtk.main_quit() #end def quit_cliecked def release_global_lock(self): self.fdb_lock.fdb.db.rollback() self.fdb_lock.fdb.disconnect() - print "Global lock released." + print "Global lock released.\n" #end def release_global_lock def tab_abbreviations(self, widget, data=None):