From de39d1cabfb906b223d1a160864a431a2bb6b90d Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 29 Jul 2010 22:57:57 +0800 Subject: [PATCH 01/10] Add all Timezones that Stars supports to TZ function All timezones outside of Australia I dodn't define for the moment. Still requires support for actually getting said timezone, but were on our way. --- pyfpdb/HandHistoryConverter.py | 44 ++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index 658e7433..59ba90ef 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.py @@ -511,6 +511,50 @@ or None if we fail to get the info """ elif givenTimezone=="CET": givenTimezone = timezone('Europe/Berlin') #Note: Daylight Saving Time is standardised across the EU so this should be fine + elif givenTimezone == 'HST': # Hawaiian Standard Time + pass + elif givenTimezone == 'AKT': # Alaska Time + pass + elif givenTimezone == 'PT': # Pacific Time + pass + elif givenTimezone == 'MT': # Mountain Time + pass + elif givenTimezone == 'CT': # Central Time + pass + elif givenTimezone == 'AT': # Atlantic Time + pass + elif givenTimezone == 'NT': # Newfoundland Time + pass + elif givenTimezone == 'ART': # Argentinian Time + pass + elif givenTimezone == 'BRT': # Brasilia Time + pass + elif givenTimezone == 'AKT': # Alaska Time + pass + elif givenTimezone == 'WET': # Western European Time + pass + elif givenTimezone == 'EET': # Eastern European Time + pass + elif givenTimezone == 'MSK': # Moscow Standard Time + pass + elif givenTimezone == 'IST': # India Standard Time + pass + elif givenTimezone == 'CCT': # China Coast Time + pass + elif givenTimezone == 'JST': # Japan Standard Time + pass + elif givenTimezone == 'AWST': # Australian Western Standard Time + givenTimezone = timezone('Australia/West') + elif givenTimezone == 'ACST': # Australian Central Standard Time + givenTimezone = timezone('Australia/Darwin') + elif givenTimezone == 'AEST': # Australian Eastern Standard Time + # Each State on the East Coast has different DSTs. + # Melbournce is out because I don't like AFL, Queensland doesn't have DST + # ACT is full of politicians and Tasmania will never notice. + # Using Sydney. + givenTimezone = timezone('Australia/Sydney') + elif givenTimezone == 'NZT': # New Zealand Time + pass else: raise Error #TODO raise appropriate error From 961ade9aff947afd50bf4d213cc4c991b2205713 Mon Sep 17 00:00:00 2001 From: Worros Date: Sat, 31 Jul 2010 16:57:25 +0800 Subject: [PATCH 02/10] Stars: Make Knockout tourneys parse Adjusted GameInfo regex to separately parse buyin, rake and knockout for tournamets --- pyfpdb/PokerStarsToFpdb.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/pyfpdb/PokerStarsToFpdb.py b/pyfpdb/PokerStarsToFpdb.py index 0a9e47fc..a45a9b4e 100644 --- a/pyfpdb/PokerStarsToFpdb.py +++ b/pyfpdb/PokerStarsToFpdb.py @@ -72,7 +72,7 @@ class PokerStars(HandHistoryConverter): (Tournament\s\# # open paren of tournament info (?P\d+),\s # here's how I plan to use LS - (?P([%(LS)s\+\d\.]+\s?(?P%(LEGAL_ISO)s)?)|Freeroll)\s+)? + (?P(?P[%(LS)s\d\.]+)\+(?P[%(LS)s\d\.]+)?\+(?P[%(LS)s\d\.]+)\s?(?P%(LEGAL_ISO)s)|Freeroll)\s+)? # close paren of tournament info (?PHORSE|8\-Game|HOSE)?\s?\(? (?PHold\'em|Razz|RAZZ|7\sCard\sStud|7\sCard\sStud\sHi/Lo|Omaha|Omaha\sHi/Lo|Badugi|Triple\sDraw\s2\-7\sLowball|5\sCard\sDraw)\s @@ -206,24 +206,20 @@ class PokerStars(HandHistoryConverter): m = self.re_HandInfo.search(hand.handText,re.DOTALL) if m: info.update(m.groupdict()) -# hand.maxseats = int(m2.group(1)) else: pass # throw an exception here, eh? m = self.re_GameInfo.search(hand.handText) 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 + log.debug("readHandInfo: %s" % info) for key in info: if key == 'DATETIME': - #2008/11/12 10:00:48 CET [2008/11/12 4:00:48 ET] # (both dates are parsed so ET date overrides the other) + #2008/11/12 10:00:48 CET [2008/11/12 4:00:48 ET] # (both dates are parsed so ET date overrides the other) #2008/08/17 - 01:14:43 (ET) #2008/09/07 06:23:14 ET m1 = self.re_DateTime.finditer(info[key]) - # m2 = re.search("(?P[0-9]{4})\/(?P[0-9]{2})\/(?P[0-9]{2})[\- ]+(?P[0-9]+):(?P[0-9]+):(?P[0-9]+)", info[key]) - datetimestr = "2000/01/01 00:00:00" # default used if time not found (stops import crashing, but startTime will be wrong) + datetimestr = "2000/01/01 00:00:00" # default used if time not found for a in m1: datetimestr = "%s/%s/%s %s:%s:%s" % (a.group('Y'), a.group('M'),a.group('D'),a.group('H'),a.group('MIN'),a.group('S')) #tz = a.group('TZ') # just assume ET?? @@ -236,12 +232,15 @@ class PokerStars(HandHistoryConverter): hand.tourNo = info[key] if key == 'BUYIN': if hand.tourNo!=None: + #print "DEBUG: info['BUYIN']: %s" % info['BUYIN'] + #print "DEBUG: info['BIAMT']: %s" % info['BIAMT'] + #print "DEBUG: info['BIRAKE']: %s" % info['BIRAKE'] + #print "DEBUG: info['BOUNTY']: %s" % info['BOUNTY'] if info[key] == 'Freeroll': hand.buyin = 0 hand.fee = 0 hand.buyinCurrency = "FREE" else: - #print "info[key]:",info[key] if info[key].find("$")!=-1: hand.buyinCurrency="USD" elif info[key].find(u"€")!=-1: @@ -249,13 +248,13 @@ class PokerStars(HandHistoryConverter): elif info[key].find("FPP")!=-1: hand.buyinCurrency="PSFP" else: - raise FpdbParseError("failed to detect currency") #FIXME: handle other currencies, FPP, play money + #FIXME: handle other currencies, FPP, play money + raise FpdbParseError("failed to detect currency") if hand.buyinCurrency=="USD" or hand.buyinCurrency=="EUR": - info[key]=info[key][:-4] - middle=info[key].find("+") - hand.buyin = int(100*Decimal(info[key][1:middle])) - hand.fee = int(100*Decimal(info[key][middle+2:])) + hand.buyin = int(100*Decimal(info['BIAMT'][1:])) + hand.fee = int(100*Decimal(info['BIRAKE'][1:])) + # TODO: Bounty is in key 'BOUNTY' elif hand.buyinCurrency=="PSFP": hand.buyin = int(Decimal(info[key][0:-3])) hand.fee = 0 From 223f7441b6254c4b7da107ad7ad6f4ba37fe81ad Mon Sep 17 00:00:00 2001 From: grindi Date: Sat, 31 Jul 2010 14:38:24 +0400 Subject: [PATCH 03/10] Fixes for absolute poker Note: previous xtables's re doesn't match java absolute client --- pyfpdb/AbsoluteToFpdb.py | 32 ++++++++++++++++++-------------- pyfpdb/XTables.py | 2 +- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/pyfpdb/AbsoluteToFpdb.py b/pyfpdb/AbsoluteToFpdb.py index 26aea7e8..31e21764 100755 --- a/pyfpdb/AbsoluteToFpdb.py +++ b/pyfpdb/AbsoluteToFpdb.py @@ -42,10 +42,10 @@ class Absolute(HandHistoryConverter): #Seat 6 - FETS63 ($0.75 in chips) #Board [10s 5d Kh Qh 8c] - re_GameInfo = re.compile(ur"^Stage #([0-9]+): (?PHoldem|HORSE)(?: \(1 on 1\)|)? ?(?PNo Limit|Pot Limit|Normal|)? ?(?P\$| €|)(?P[.0-9]+)/?(?:\$| €|)(?P[.0-9]+)?", re.MULTILINE) + re_GameInfo = re.compile(ur"^Stage #(C?[0-9]+): (?PHoldem|HORSE)(?: \(1 on 1\)|)? ?(?PNo Limit|Pot Limit|Normal|)? ?(?P\$| €|)(?P[.0-9]+)/?(?:\$| €|)(?P[.0-9]+)?", re.MULTILINE) re_HorseGameInfo = re.compile(ur"^Game Type: (?PLimit) (?PHoldem)", re.MULTILINE) # TODO: can set max seats via (1 on 1) to a known 2 .. - re_HandInfo = re.compile(ur"^Stage #(?P[0-9]+): .*(?P\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d).*\n(Table: (?P.*) \(Real Money\))?", re.MULTILINE) + re_HandInfo = re.compile(ur"^Stage #C?(?P[0-9]+): .*(?P\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d).*\n(Table: (?P
.*) \(Real Money\))?", re.MULTILINE) re_TableFromFilename = re.compile(ur".*IHH([0-9]+) (?P
.*) -") # on HORSE STUD games, the table name isn't in the hand info! re_Button = re.compile(ur"Seat #(?P
.+$)", re.MULTILINE) re_Button = re.compile(ur"^Seat (?P
[0-9]+)\.txt") @@ -50,11 +50,11 @@ class Everleaf(HandHistoryConverter): self.compiledPlayers = players player_re = "(?P" + "|".join(map(re.escape, players)) + ")" logging.debug("player_re: "+ player_re) - self.re_PostSB = re.compile(ur"^%s: posts small blind \[(?:\$| €|) (?P[.0-9]+)" % player_re, re.MULTILINE) - self.re_PostBB = re.compile(ur"^%s: posts big blind \[(?:\$| €|) (?P[.0-9]+)" % player_re, re.MULTILINE) - self.re_PostBoth = re.compile(ur"^%s: posts both blinds \[(?:\$| €|) (?P[.0-9]+)" % player_re, re.MULTILINE) - self.re_Antes = re.compile(ur"^%s: posts ante \[(?:\$| €|) (?P[.0-9]+)" % player_re, re.MULTILINE) - self.re_BringIn = re.compile(ur"^%s posts bring-in (?:\$| €|)(?P[.0-9]+)\." % player_re, re.MULTILINE) + self.re_PostSB = re.compile(ur"^%s: posts small blind \[[$€]? (?P[.0-9]+)" % player_re, re.MULTILINE) + self.re_PostBB = re.compile(ur"^%s: posts big blind \[[$€]? (?P[.0-9]+)" % player_re, re.MULTILINE) + self.re_PostBoth = re.compile(ur"^%s: posts both blinds \[[$€]? (?P[.0-9]+)" % player_re, re.MULTILINE) + self.re_Antes = re.compile(ur"^%s: posts ante \[[$€]? (?P[.0-9]+)" % player_re, re.MULTILINE) + self.re_BringIn = re.compile(ur"^%s posts bring-in [$€]? (?P[.0-9]+)\." % player_re, re.MULTILINE) self.re_HeroCards = re.compile(ur"^Dealt to %s \[ (?P.*) \]" % player_re, re.MULTILINE) # ^%s(?P: bets| checks| raises| calls| folds)(\s\[(?:\$| €|) (?P[.,\d]+) (USD|EURO|Chips)\])? self.re_Action = re.compile(ur"^%s(?P: bets| checks| raises| calls| folds)(\s\[(?:[$€]?) (?P[.,\d]+)\s?(USD|EURO|Chips|)\])?" % player_re, re.MULTILINE) From 4394cebbff69ae142abb292f220aaa576483daec Mon Sep 17 00:00:00 2001 From: steffen123 Date: Sat, 31 Jul 2010 20:30:35 +0200 Subject: [PATCH 05/10] adapt ebuild to work with snapshots too --- ...d_testing.ebuild => current_stable.ebuild} | 0 packaging/gentoo/current_testing.ebuild | 60 +++++++++++++++++++ packaging/gentoo/readme.txt | 3 + 3 files changed, 63 insertions(+) rename packaging/gentoo/{current_stable_and_testing.ebuild => current_stable.ebuild} (100%) create mode 100644 packaging/gentoo/current_testing.ebuild diff --git a/packaging/gentoo/current_stable_and_testing.ebuild b/packaging/gentoo/current_stable.ebuild similarity index 100% rename from packaging/gentoo/current_stable_and_testing.ebuild rename to packaging/gentoo/current_stable.ebuild diff --git a/packaging/gentoo/current_testing.ebuild b/packaging/gentoo/current_testing.ebuild new file mode 100644 index 00000000..05483b62 --- /dev/null +++ b/packaging/gentoo/current_testing.ebuild @@ -0,0 +1,60 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# created by Steffen Schaumburg, steffen@schaumburger.info + +inherit eutils +inherit games + +EAPI="2" +NEED_PYTHON=2.5 + +DESCRIPTION="A free/open source tracker/HUD for use with online poker" +HOMEPAGE="http://fpdb.wiki.sourceforge.net/" +SRC_URI="mirror://sourceforge/${PN}/Snapshots/${P}.tar.bz2" + +LICENSE="AGPL-3" +SLOT="0" +KEYWORDS="~amd64 ~x86" +#note: this should work on other architectures too, please send me your experiences + +IUSE="graph mysql postgres sqlite" +RDEPEND=" + mysql? ( virtual/mysql + dev-python/mysql-python ) + postgres? ( dev-db/postgresql-server + dev-python/psycopg ) + sqlite? ( dev-lang/python[sqlite] + dev-python/numpy ) + >=x11-libs/gtk+-2.10 + dev-python/pygtk + graph? ( dev-python/numpy + dev-python/matplotlib[gtk] ) + dev-python/python-xlib + dev-python/pytz" +DEPEND="${RDEPEND}" + +src_install() { + insinto "${GAMES_DATADIR}"/${PN} + doins -r gfx + doins -r pyfpdb + doins readme.txt + + exeinto "${GAMES_DATADIR}"/${PN} + doexe run_fpdb.py + + dodir "${GAMES_BINDIR}" + dosym "${GAMES_DATADIR}"/${PN}/run_fpdb.py "${GAMES_BINDIR}"/${PN} + + newicon gfx/fpdb-icon.png ${PN}.png + make_desktop_entry ${PN} + + prepgamesdirs + fperms +x "${GAMES_DATADIR}"/${PN}/pyfpdb/*.pyw +} + +pkg_postinst() { + games_pkg_postinst + elog "Note that if you really want to use mysql or postgresql you will have to create" + elog "the database and user yourself and enter it into the fpdb config." + elog "You can find the instructions on the project's website." +} diff --git a/packaging/gentoo/readme.txt b/packaging/gentoo/readme.txt index 66d3b452..e8317e9d 100644 --- a/packaging/gentoo/readme.txt +++ b/packaging/gentoo/readme.txt @@ -1,2 +1,5 @@ +If you want to run a stable version please use current_stable.ebuild +If you want to run a testing version please use current_testing.ebuild + To use the ebuild please simply copy it into your local portage tree and rename it to fpdb-version.ebuild, for example fpdb-0.20.1.ebuild or fpdb-0.20.902.ebuild. Here's a little howto on how to utilise 3rd party ebuilds such as this one: http://www.gentoo-wiki.info/HOWTO_Installing_3rd_Party_Ebuilds From c136f7a2dcab1809b2a243d8eb0252e70dbd2580 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Sat, 31 Jul 2010 22:27:24 +0200 Subject: [PATCH 06/10] fix pgsql table creation --- pyfpdb/SQL.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index fcebc5c9..7ba5641b 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -146,8 +146,8 @@ class Sql: id BIGSERIAL, PRIMARY KEY (id), tourneysPlayerId INT NOT NULL, FOREIGN KEY (tourneysPlayerId) REFERENCES TourneysPlayers(id), playerId INT NOT NULL, FOREIGN KEY (playerId) REFERENCES Players(id), - buyInPercentage FLOAT UNSIGNED NOT NULL, - payOffPercentage FLOAT UNSIGNED NOT NULL)""" + buyInPercentage FLOAT NOT NULL, + payOffPercentage FLOAT NOT NULL)""" elif db_server == 'sqlite': self.query['createBackingsTable'] = """CREATE TABLE Backings ( id INTEGER PRIMARY KEY, From b4ff46ec4fe834e50c7843643e8a491263877322 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Sat, 31 Jul 2010 22:31:55 +0200 Subject: [PATCH 07/10] fix typo in pgsql raiseFirstInChance --- pyfpdb/SQL.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index 7ba5641b..06c6d648 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -3275,7 +3275,7 @@ class Sql: ,sum(CAST(foldToOtherRaisedStreet2 as integer)) ,sum(CAST(foldToOtherRaisedStreet3 as integer)) ,sum(CAST(foldToOtherRaisedStreet4 as integer)) - ,sum(CAST(raisedFirstInChance as integer)) + ,sum(CAST(raiseFirstInChance as integer)) ,sum(CAST(raisedFirstIn as integer)) ,sum(CAST(foldBbToStealChance as integer)) ,sum(CAST(foldedBbToSteal as integer)) From e8d39711dd9d67746d384bf6eeb9e55388fd21bb Mon Sep 17 00:00:00 2001 From: Eric Blade Date: Sat, 31 Jul 2010 17:24:06 -0400 Subject: [PATCH 08/10] fix from carl for wtsd, more tweaks to everleaf regexes --- pyfpdb/DerivedStats.py | 5 ++++- pyfpdb/EverleafToFpdb.py | 16 ++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/pyfpdb/DerivedStats.py b/pyfpdb/DerivedStats.py index e92bfeaa..7778c956 100644 --- a/pyfpdb/DerivedStats.py +++ b/pyfpdb/DerivedStats.py @@ -290,7 +290,10 @@ class DerivedStats(): # print "p_actions:", self.pfba(actions), "p_folds:", self.pfba(actions, l=('folds',)), "alliners:", alliners # pas = set.union(self.pfba(actions) - self.pfba(actions, l=('folds',)), alliners) - p_in = set(x[1] for x in hand.players) + # hand.players includes people that are sitting out on some sites. + # Those that posted an ante should have been deal cards. + p_in = set([x[0] for x in hand.actions['BLINDSANTES']]) + for (i, street) in enumerate(hand.actionStreets): actions = hand.actions[street] p_in = p_in - self.pfba(actions, l=('folds',)) diff --git a/pyfpdb/EverleafToFpdb.py b/pyfpdb/EverleafToFpdb.py index 9da5966f..454f7e79 100755 --- a/pyfpdb/EverleafToFpdb.py +++ b/pyfpdb/EverleafToFpdb.py @@ -37,8 +37,8 @@ class Everleaf(HandHistoryConverter): re_GameInfo = re.compile(ur"^(Blinds )?(?P[$€]?)(?P[.0-9]+)/[$€]?(?P[.0-9]+) (?PNL|PL|) ?(?P(Hold\'em|Omaha|7 Card Stud))", re.MULTILINE) #re.compile(ur"^(Blinds )?(?P\$| €|)(?P[.0-9]+)/(?:\$| €)?(?P[.0-9]+) (?PNL|PL|) ?(?P(Hold\'em|Omaha|7 Card Stud))", re.MULTILINE) re_HandInfo = re.compile(ur".*#(?P[0-9]+)\n.*\n(Blinds )?(?P[$€])?(?P[.0-9]+)/(?:[$€])?(?P[.0-9]+) (?P.*) - (?P\d\d\d\d/\d\d/\d\d - \d\d:\d\d:\d\d)\nTable (?P
.+$)", re.MULTILINE) - re_Button = re.compile(ur"^Seat (?P
[0-9]+)\.txt") @@ -50,15 +50,15 @@ class Everleaf(HandHistoryConverter): self.compiledPlayers = players player_re = "(?P" + "|".join(map(re.escape, players)) + ")" logging.debug("player_re: "+ player_re) - self.re_PostSB = re.compile(ur"^%s: posts small blind \[[$€]? (?P[.0-9]+)" % player_re, re.MULTILINE) - self.re_PostBB = re.compile(ur"^%s: posts big blind \[[$€]? (?P[.0-9]+)" % player_re, re.MULTILINE) - self.re_PostBoth = re.compile(ur"^%s: posts both blinds \[[$€]? (?P[.0-9]+)" % player_re, re.MULTILINE) - self.re_Antes = re.compile(ur"^%s: posts ante \[[$€]? (?P[.0-9]+)" % player_re, re.MULTILINE) + self.re_PostSB = re.compile(ur"^%s: posts small blind \[[$€]? (?P[.0-9]+)\s.*\]$" % player_re, re.MULTILINE) + self.re_PostBB = re.compile(ur"^%s: posts big blind \[[$€]? (?P[.0-9]+)\s.*\]$" % player_re, re.MULTILINE) + self.re_PostBoth = re.compile(ur"^%s: posts both blinds \[[$€]? (?P[.0-9]+)\s.*\]$" % player_re, re.MULTILINE) + self.re_Antes = re.compile(ur"^%s: posts ante \[[$€]? (?P[.0-9]+)\s.*\]$" % player_re, re.MULTILINE) self.re_BringIn = re.compile(ur"^%s posts bring-in [$€]? (?P[.0-9]+)\." % player_re, re.MULTILINE) - self.re_HeroCards = re.compile(ur"^Dealt to %s \[ (?P.*) \]" % player_re, re.MULTILINE) + self.re_HeroCards = re.compile(ur"^Dealt to %s \[ (?P.*) \]$" % player_re, re.MULTILINE) # ^%s(?P: bets| checks| raises| calls| folds)(\s\[(?:\$| €|) (?P[.,\d]+) (USD|EURO|Chips)\])? self.re_Action = re.compile(ur"^%s(?P: bets| checks| raises| calls| folds)(\s\[(?:[$€]?) (?P[.,\d]+)\s?(USD|EURO|Chips|)\])?" % player_re, re.MULTILINE) - self.re_ShowdownAction = re.compile(ur"^%s shows \[ (?P.*) \]" % player_re, re.MULTILINE) + self.re_ShowdownAction = re.compile(ur"^%s shows \[ (?P.*) \]$" % player_re, re.MULTILINE) self.re_CollectPot = re.compile(ur"^%s wins (?:[$€]?)\s?(?P[.\d]+) (USD|EURO|chips)(.*?\[ (?P.*?) \])?" % player_re, re.MULTILINE) self.re_SitsOut = re.compile(ur"^%s sits out" % player_re, re.MULTILINE) From ed239668c0e19d228017f5c421faf4d4291ebae0 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Sat, 31 Jul 2010 23:55:05 +0200 Subject: [PATCH 09/10] fix pgsql index and foreign key drops --- pyfpdb/Database.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index 500dfb0a..2aea6790 100644 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -951,6 +951,7 @@ class Database: # hmmm, tested by commenting out rollback in grapher. lock seems to work but # then drop still hangs :-( does work in some tests though?? # will leave code here for now pending further tests/enhancement ... + c.execute("BEGIN TRANSACTION") c.execute( "lock table %s in exclusive mode nowait" % (fk['fktab'],) ) #print "after lock, status:", c.statusmessage #print "alter table %s drop constraint %s_%s_fkey" % (fk['fktab'], fk['fktab'], fk['fkcol']) @@ -961,6 +962,7 @@ class Database: if "does not exist" not in str(sys.exc_value): print "warning: drop pg fk %s_%s_fkey failed: %s, continuing ..." \ % (fk['fktab'], fk['fkcol'], str(sys.exc_value).rstrip('\n') ) + c.execute("END TRANSACTION") except: print "warning: constraint %s_%s_fkey not dropped: %s, continuing ..." \ % (fk['fktab'],fk['fkcol'], str(sys.exc_value).rstrip('\n')) @@ -984,6 +986,7 @@ class Database: print "dropping pg index ", idx['tab'], idx['col'] try: # try to lock table to see if index drop will work: + c.execute("BEGIN TRANSACTION") c.execute( "lock table %s in exclusive mode nowait" % (idx['tab'],) ) #print "after lock, status:", c.statusmessage try: @@ -995,6 +998,7 @@ class Database: if "does not exist" not in str(sys.exc_value): print "warning: drop index %s_%s_idx failed: %s, continuing ..." \ % (idx['tab'],idx['col'], str(sys.exc_value).rstrip('\n')) + c.execute("END TRANSACTION") except: print "warning: index %s_%s_idx not dropped %s, continuing ..." \ % (idx['tab'],idx['col'], str(sys.exc_value).rstrip('\n')) From d3f99eec9b18324c63557e4688e0c8289ea46a8a Mon Sep 17 00:00:00 2001 From: Eric Blade Date: Sun, 1 Aug 2010 03:05:35 -0400 Subject: [PATCH 10/10] call reposition_windows after doing a window move, so that the user doesn't need to hit the menu option to do it (reposition_windows manages to successfully move the hidden windows, whereas the original move doesn't, for some reason) --- pyfpdb/Hud.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyfpdb/Hud.py b/pyfpdb/Hud.py index 8d3d7d0c..a92682e7 100644 --- a/pyfpdb/Hud.py +++ b/pyfpdb/Hud.py @@ -469,6 +469,9 @@ class Hud: # While we're at it, fix the positions of mucked cards too for aux in self.aux_windows: aux.update_card_positions() + + self.reposition_windows() + # call reposition_windows, which apparently moves even hidden windows, where this function does not, even though they do the same thing, afaict return True