Merge branch 'master' of git://git.assembla.com/fpdb-eric
This commit is contained in:
commit
f6b97ab532
|
@ -66,7 +66,7 @@ class Carbon(HandHistoryConverter):
|
|||
# Static regexes
|
||||
re_SplitHands = re.compile(r'</game>\n+(?=<game)')
|
||||
re_TailSplitHands = re.compile(r'(</game>)')
|
||||
re_GameInfo = re.compile(r'<description type="(?P<GAME>[a-zA-Z ]+)" stakes="(?P<LIMIT>[a-zA-Z ]+) ?\(\$(?P<SB>[.0-9]+)/\$(?P<BB>[.0-9]+)?\)"/>', re.MULTILINE)
|
||||
re_GameInfo = re.compile(r'<description type="(?P<GAME>[a-zA-Z ]+)" stakes="(?P<LIMIT>[a-zA-Z ]+) \(\$(?P<SB>[.0-9]+)/\$(?P<BB>[.0-9]+)\)"/>', re.MULTILINE)
|
||||
re_HandInfo = re.compile(r'<game id="(?P<HID1>[0-9]+)-(?P<HID2>[0-9]+)" starttime="(?P<DATETIME>[0-9]+)" numholecards="2" gametype="2" realmoney="true" data="[0-9]+\|(?P<TABLE>[^\(]+)', re.MULTILINE)
|
||||
re_Button = re.compile(r'<players dealer="(?P<BUTTON>[0-9]+)">')
|
||||
re_PlayerInfo = re.compile(r'<player seat="(?P<SEAT>[0-9]+)" nickname="(?P<PNAME>.+)" balance="\$(?P<CASH>[.0-9]+)" dealtin="(?P<DEALTIN>(true|false))" />', re.MULTILINE)
|
||||
|
|
|
@ -204,15 +204,18 @@ class GuiAutoImport (threading.Thread):
|
|||
# That is not correct. It should open another dir for importing while piping the
|
||||
# results to the same pipe. This means that self.path should be a a list of dirs
|
||||
# to watch.
|
||||
if widget.get_active(): # toggled on
|
||||
if data == "autostart" or (widget == self.startButton and self.startButton.get_active()):
|
||||
self.startButton.set_active(True)
|
||||
# - Does the lock acquisition need to be more sophisticated for multiple dirs?
|
||||
# (see comment above about what to do if pipe already open)
|
||||
# - Ideally we want to release the lock if the auto-import is killed by some
|
||||
# kind of exception - is this possible?
|
||||
if self.settings['global_lock'].acquire(False): # returns false immediately if lock not acquired
|
||||
if self.settings['global_lock'].acquire(wait=False, source="AutoImport"): # returns false immediately if lock not acquired
|
||||
self.addText(_("\nGlobal lock taken ... Auto Import Started.\n"))
|
||||
self.doAutoImportBool = True
|
||||
widget.set_label(_(u' _Stop Auto Import '))
|
||||
self.startButton.set_label(_(u' _Stop Auto Import '))
|
||||
while gtk.events_pending(): # change the label NOW don't wait for the pipe to open
|
||||
gtk.main_iteration(False)
|
||||
if self.pipe_to_hud is None:
|
||||
if Configuration.FROZEN: # if py2exe, run hud_main.exe
|
||||
path = Configuration.EXEC_PATH
|
||||
|
@ -224,15 +227,14 @@ class GuiAutoImport (threading.Thread):
|
|||
command = 'pythonw "'+path+'\\HUD_main.pyw" ' + self.settings['cl_options']
|
||||
else:
|
||||
command = 'python "'+path+'\\HUD_main.pyw" ' + self.settings['cl_options']
|
||||
# uncomment above line if you want hud_main stdout to work ... and make sure you are running fpdb.py using python.exe not pythonw.exe
|
||||
bs = 0
|
||||
else:
|
||||
command = os.path.join(sys.path[0], 'HUD_main.pyw')
|
||||
command = [command, ] + string.split(self.settings['cl_options'])
|
||||
bs = 1
|
||||
|
||||
try:
|
||||
print _("opening pipe to HUD")
|
||||
try:
|
||||
if Configuration.FROZEN or (os.name == "nt" and win32console.GetConsoleWindow()) == 0:
|
||||
self.pipe_to_hud = subprocess.Popen(command, bufsize=bs,
|
||||
stdin=subprocess.PIPE,
|
||||
|
@ -242,8 +244,6 @@ class GuiAutoImport (threading.Thread):
|
|||
)
|
||||
else:
|
||||
self.pipe_to_hud = subprocess.Popen(command, bufsize=bs, stdin=subprocess.PIPE, universal_newlines=True)
|
||||
#self.pipe_to_hud.stdout.close()
|
||||
#self.pipe_to_hud.stderr.close()
|
||||
except:
|
||||
err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
||||
#self.addText( "\n*** GuiAutoImport Error opening pipe: " + err[2] + "(" + str(err[1]) + "): " + str(sys.exc_info()[1]))
|
||||
|
@ -268,8 +268,9 @@ class GuiAutoImport (threading.Thread):
|
|||
if self.pipe_to_hud.poll() is not None:
|
||||
self.addText(_("\n * Stop Auto Import: HUD already terminated"))
|
||||
else:
|
||||
self.pipe_to_hud.terminate()
|
||||
#print >>self.pipe_to_hud.stdin, "\n"
|
||||
self.pipe_to_hud.communicate('\n') # waits for process to terminate
|
||||
# self.pipe_to_hud.communicate('\n') # waits for process to terminate
|
||||
self.pipe_to_hud = None
|
||||
self.startButton.set_label(_(u' Start _Auto Import '))
|
||||
|
||||
|
|
|
@ -102,6 +102,17 @@ class HUD_main(object):
|
|||
|
||||
# a main window
|
||||
self.main_window = gtk.Window()
|
||||
if options.minimized:
|
||||
self.main_window.iconify()
|
||||
if options.hidden:
|
||||
self.main_window.hide()
|
||||
|
||||
if options.xloc is not None or options.yloc is not None:
|
||||
if options.xloc is None:
|
||||
options.xloc = 0
|
||||
if options.yloc is None:
|
||||
options.yloc = 0
|
||||
self.main_window.move(options.xloc,options.yloc)
|
||||
self.main_window.connect("client_moved", self.client_moved)
|
||||
self.main_window.connect("client_resized", self.client_resized)
|
||||
self.main_window.connect("client_destroyed", self.client_destroyed)
|
||||
|
@ -120,7 +131,8 @@ class HUD_main(object):
|
|||
self.main_window.set_icon_from_file('/usr/share/pixmaps/fpdb-cards.png')
|
||||
else:
|
||||
self.main_window.set_icon_stock(gtk.STOCK_HOME)
|
||||
self.main_window.show_all()
|
||||
if not options.hidden:
|
||||
self.main_window.show_all()
|
||||
gobject.timeout_add(100, self.check_tables)
|
||||
|
||||
except:
|
||||
|
@ -356,6 +368,7 @@ class HUD_main(object):
|
|||
self.create_HUD(new_hand_id, tablewindow, temp_key, max, poker_game, type, stat_dict, cards)
|
||||
else:
|
||||
log.error(_('Table "%s" no longer exists\n') % table_name)
|
||||
return
|
||||
|
||||
t6 = time.time()
|
||||
log.info(_("HUD_main.read_stdin: hand read in %4.3f seconds (%4.3f,%4.3f,%4.3f,%4.3f,%4.3f,%4.3f)")
|
||||
|
@ -363,7 +376,10 @@ class HUD_main(object):
|
|||
self.db_connection.connection.rollback()
|
||||
|
||||
if type == "tour":
|
||||
self.hud_dict[temp_key].table.check_table_no(self.hud_dict[temp_key])
|
||||
try:
|
||||
self.hud_dict[temp_key].table.check_table_no(self.hud_dict[temp_key])
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
if __name__== "__main__":
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
#Copyright 2010 Chaz Littlejohn
|
||||
|
@ -28,21 +28,18 @@ import Configuration
|
|||
import Database
|
||||
|
||||
__ARCHIVE_PRE_HEADER_REGEX='^Hand #(\d+)\s*$|\*{20}\s#\s\d+\s\*+\s+'
|
||||
re_SplitArchive = re.compile(__ARCHIVE_PRE_HEADER_REGEX, re.MULTILINE)
|
||||
re_SplitArchive = re.compile(__ARCHIVE_PRE_HEADER_REGEX)
|
||||
|
||||
|
||||
class IdentifySite:
|
||||
def __init__(self, config, in_path = '-'):
|
||||
self.in_path = in_path
|
||||
self.config = config
|
||||
self.db = Database.Database(self.config)
|
||||
self.db = Database.Database(config)
|
||||
self.sitelist = {}
|
||||
self.filelist = {}
|
||||
self.generateSiteList()
|
||||
if os.path.isdir(self.in_path):
|
||||
self.walkDirectory(self.in_path, self.sitelist)
|
||||
else:
|
||||
self.idSite(self.in_path, self.sitelist)
|
||||
self.walkDirectory(self.in_path, self.sitelist)
|
||||
|
||||
def generateSiteList(self):
|
||||
"""Generates a ordered dictionary of site, filter and filter name for each site in hhcs"""
|
||||
|
@ -83,7 +80,7 @@ class IdentifySite:
|
|||
for kodec in self.__listof(obj.codepage):
|
||||
try:
|
||||
in_fh = codecs.open(file, 'r', kodec)
|
||||
whole_file = in_fh.read(2000)
|
||||
whole_file = in_fh.read()
|
||||
in_fh.close()
|
||||
|
||||
if info[2] in ('OnGame', 'Winamax'):
|
||||
|
@ -97,7 +94,7 @@ class IdentifySite:
|
|||
if re_SplitArchive.search(whole_file):
|
||||
archive = True
|
||||
if m:
|
||||
self.filelist[file] = [info[1]] + [kodec] + [archive]
|
||||
self.filelist[file] = [info[0]] + [info[1]] + [kodec] + [archive]
|
||||
break
|
||||
except:
|
||||
pass
|
||||
|
|
|
@ -59,8 +59,16 @@ def fpdb_options():
|
|||
help=_("File to be split is a PokerStars or Full Tilt Poker archive file"))
|
||||
parser.add_option("-n", "--numhands", dest="hands", default="100", type="int",
|
||||
help=_("How many hands do you want saved to each file. Default is 100"))
|
||||
parser.add_option("-w", "--workerid", dest="workerid", default="0", type="int",
|
||||
help=_("Specifies the worker id running the script"))
|
||||
parser.add_option("--xloc", dest="xloc", default=None, type="int",
|
||||
help=_("X location to open window"))
|
||||
parser.add_option("--yloc", dest="yloc", default=None, type="int",
|
||||
help=_("Y location to open Window"))
|
||||
parser.add_option("--autoimport", action="store_true", dest="autoimport",
|
||||
help=_("Auto-start Auto-import"))
|
||||
parser.add_option("--minimized", action="store_true", dest="minimized",
|
||||
help=_("Start Minimized"))
|
||||
parser.add_option("--hidden", action="store_true", dest="hidden",
|
||||
help=_("Start Hidden"))
|
||||
|
||||
|
||||
(options, argv) = parser.parse_args()
|
||||
|
|
|
@ -298,7 +298,7 @@ class PokerStars(HandHistoryConverter):
|
|||
if key == 'BUTTON':
|
||||
hand.buttonpos = info[key]
|
||||
if key == 'MAX':
|
||||
if info[key]: hand.maxseats = int(info[key])
|
||||
hand.maxseats = int(info[key])
|
||||
|
||||
if key == 'MIXED':
|
||||
hand.mixed = self.mixes[info[key]] if info[key] is not None else None
|
||||
|
|
|
@ -1,22 +1,19 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2010, Chaz Littlejohn
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
########################################################################
|
||||
#Copyright 2010 Chaz Littlejohn
|
||||
#This program is free software: you can redistribute it and/or modify
|
||||
#it under the terms of the GNU Affero General Public License as published by
|
||||
#the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
#This program is distributed in the hope that it will be useful,
|
||||
#but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
#GNU General Public License for more details.
|
||||
#
|
||||
#You should have received a copy of the GNU Affero General Public License
|
||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||
|
||||
import L10n
|
||||
_ = L10n.get_translation()
|
||||
|
@ -31,7 +28,6 @@ import Options
|
|||
import Configuration
|
||||
from Exceptions import *
|
||||
from cStringIO import StringIO
|
||||
import time
|
||||
|
||||
(options, argv) = Options.fpdb_options()
|
||||
|
||||
|
@ -41,7 +37,7 @@ codepage = ["utf-16", "utf-8", "cp1252"]
|
|||
|
||||
|
||||
class SplitHandHistory:
|
||||
def __init__(self, config, in_path = '-', out_path = None, hands = 100, filter = "PokerStarsToFpdb", archive = False, workerid = 0):
|
||||
def __init__(self, config, in_path = '-', out_path = None, hands = 100, filter = "PokerStarsToFpdb", archive = False):
|
||||
self.config = config
|
||||
self.in_path = in_path
|
||||
self.out_path = out_path
|
||||
|
@ -54,25 +50,22 @@ class SplitHandHistory:
|
|||
self.line_addendum = None
|
||||
self.filedone = False
|
||||
|
||||
self.timestamp = str(time.time())
|
||||
self.workerid = '%02d' % workerid
|
||||
|
||||
#Acquire re_SplitHands for this hh
|
||||
self.filter_name = filter.replace("ToFpdb", "")
|
||||
filter_name = filter.replace("ToFpdb", "")
|
||||
mod = __import__(filter)
|
||||
obj = getattr(mod, self.filter_name, None)
|
||||
obj = getattr(mod, filter_name, None)
|
||||
self.re_SplitHands = obj.re_SplitHands
|
||||
|
||||
#Determine line delimiter type if any
|
||||
if self.re_SplitHands.match('\n\n\n'):
|
||||
self.line_delimiter = '\n\n\n'
|
||||
if self.re_SplitHands.match('\n\n'):
|
||||
self.line_delimiter = '\n\n'
|
||||
if self.re_SplitHands.match('\n\n\n'):
|
||||
self.line_delimiter = '\n\n\n'
|
||||
|
||||
#Add new line addendum for sites which match SplitHand to next line as well
|
||||
if self.filter_name == 'OnGame':
|
||||
if filter_name == 'OnGame':
|
||||
self.line_addendum = '*'
|
||||
if self.filter_name == 'Carbon':
|
||||
if filter_name == 'Carbon':
|
||||
self.line_addendum = '<game'
|
||||
|
||||
#Open the gargantuan file
|
||||
|
@ -82,7 +75,6 @@ class SplitHandHistory:
|
|||
except IOError:
|
||||
print _('File not found')
|
||||
sys.exit(2)
|
||||
self.kodec = kodec
|
||||
|
||||
#Split with do_hands_per_file if archive and paragraphs if a regular hh
|
||||
if self.archive:
|
||||
|
@ -113,10 +105,9 @@ class SplitHandHistory:
|
|||
print _('Nope, will not work (fileno=%d)' % fileno)
|
||||
sys.exit(2)
|
||||
basename = os.path.splitext(os.path.basename(self.in_path))[0]
|
||||
name = os.path.join(self.out_path, self.filter_name+'-'+basename+'_'+self.workerid+'_'+self.timestamp+'_%06d.txt' % fileno)
|
||||
name = os.path.join(self.out_path, basename+'-%06d.txt' % fileno)
|
||||
print '-> %s' % name
|
||||
newfile = file(name, 'w')
|
||||
os.chmod(name, 0775)
|
||||
return newfile
|
||||
|
||||
#Archive Hand Splitter
|
||||
|
@ -131,11 +122,8 @@ class SplitHandHistory:
|
|||
except FpdbEndOfFile:
|
||||
done = True
|
||||
break
|
||||
except UnicodeEncodeError:
|
||||
print _('Absurd character done messed you up')
|
||||
sys.exit(2)
|
||||
except:
|
||||
print _('Unexpected error processing file')
|
||||
print _("Unexpected error processing file")
|
||||
sys.exit(2)
|
||||
n += 1
|
||||
outfile.close()
|
||||
|
@ -186,7 +174,7 @@ class SplitHandHistory:
|
|||
l = infile.readline()
|
||||
l = l.replace('\r\n', '\n')
|
||||
outfile.write(l)
|
||||
l = infile.readline().encode(self.kodec)
|
||||
l = infile.readline()
|
||||
|
||||
while len(l) < 3:
|
||||
l = infile.readline()
|
||||
|
@ -194,7 +182,7 @@ class SplitHandHistory:
|
|||
while len(l) > 2:
|
||||
l = l.replace('\r\n', '\n')
|
||||
outfile.write(l)
|
||||
l = infile.readline().encode(self.kodec)
|
||||
l = infile.readline()
|
||||
outfile.write(self.line_delimiter)
|
||||
return infile
|
||||
|
||||
|
@ -207,19 +195,13 @@ class SplitHandHistory:
|
|||
def main(argv=None):
|
||||
if argv is None:
|
||||
argv = sys.argv[1:]
|
||||
|
||||
if not options.filename:
|
||||
options.filename = sys.argv[1]
|
||||
|
||||
if not options.config:
|
||||
options.config = sys.argv[2]
|
||||
|
||||
if sys.argv[3] == "True":
|
||||
options.archive = True
|
||||
|
||||
options.config = Configuration.Config(file = "HUD_config.test.xml")
|
||||
|
||||
if options.filename:
|
||||
SplitHH = SplitHandHistory(options.config, options.filename, options.outpath, options.hands,
|
||||
options.hhc, options.archive, options.workerid)
|
||||
options.hhc, options.archive)
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
|
|
|
@ -58,7 +58,7 @@ limit_game_names = { #fpdb name Stars Name FTP Name
|
|||
|
||||
# A window title might have our table name + one of these words/
|
||||
# phrases. If it has this word in the title, it is not a table.
|
||||
bad_words = ('History for table:', 'HUD:', 'Chat:', 'FPDBHUD', 'Instant Replay')
|
||||
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
|
||||
|
@ -104,14 +104,12 @@ gobject.signal_new("table_changed", gtk.Window,
|
|||
# title bar and window borders. To put it another way, this is the
|
||||
# screen location of (0, 0) in the working window.
|
||||
# tournament = Tournament number for a tournament or None for a cash game.
|
||||
# tw.table = tournament: Table number for the tournament.
|
||||
# cash: full Table name as given by the poker site
|
||||
# tw.gdkhandle = gdk handle for the poker client window - used to nail the hud to the window
|
||||
# tw.window = is this still used?
|
||||
# tw.parent = window object of the parent of the client window, only used in Linux
|
||||
# tw.game = the poker game being played at the table, only used in mixed games
|
||||
# tw.search_string = regular expression used to find the table, supplied by XToFpdb.py
|
||||
# tw.key = a string formulated to be a unique id for this table window, used in the hud main window
|
||||
# table = Table number for a tournament.
|
||||
# gdkhandle =
|
||||
# window =
|
||||
# parent =
|
||||
# game =
|
||||
# search_string =
|
||||
|
||||
class Table_Window(object):
|
||||
def __init__(self, config, site, table_name = None, tournament = None, table_number = None):
|
||||
|
@ -126,13 +124,13 @@ class Table_Window(object):
|
|||
self.type = "tour"
|
||||
table_kwargs = dict(tournament = self.tournament, table_number = self.table)
|
||||
self.tableno_re = getTableNoRe(self.config, self.site, tournament = self.tournament)
|
||||
self.key = "%s Table %s" % (tournament, str(self.table))
|
||||
self.key = tournament # used as key for the hud_dict in HUD_main
|
||||
elif table_name is not None:
|
||||
self.name = table_name
|
||||
self.type = "cash"
|
||||
self.tournament = None
|
||||
table_kwargs = dict(table_name = table_name)
|
||||
self.key = table_name # used as key for the hud_dict in HUD_main
|
||||
self.key = table_name
|
||||
|
||||
else:
|
||||
return None
|
||||
|
@ -140,7 +138,10 @@ class Table_Window(object):
|
|||
self.search_string = getTableTitleRe(self.config, self.site, self.type, **table_kwargs)
|
||||
self.find_table_parameters()
|
||||
|
||||
# self.gdkhandle = gtk.gdk.window_foreign_new(self.number)
|
||||
try:
|
||||
self.gdkhandle = gtk.gdk.window_foreign_new(self.number)
|
||||
except AttributeError: # self.number does not exist, table was closed
|
||||
return None
|
||||
geo = self.get_geometry()
|
||||
if geo is None: return None
|
||||
self.width = geo['width']
|
||||
|
|
102
pyfpdb/fpdb.pyw
102
pyfpdb/fpdb.pyw
|
@ -14,7 +14,6 @@
|
|||
#You should have received a copy of the GNU Affero General Public License
|
||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||
|
||||
import L10n
|
||||
_ = L10n.get_translation()
|
||||
|
||||
|
@ -76,7 +75,7 @@ try:
|
|||
pygtk.require('2.0')
|
||||
import gtk
|
||||
import pango
|
||||
except:
|
||||
except ImportError:
|
||||
print _("Unable to load PyGTK modules required for GUI. Please install PyCairo, PyGObject, and PyGTK from www.pygtk.org.")
|
||||
raw_input(_("Press ENTER to continue."))
|
||||
exit()
|
||||
|
@ -87,18 +86,18 @@ import interlocks
|
|||
try:
|
||||
import matplotlib
|
||||
matplotlib_version = matplotlib.__version__
|
||||
except:
|
||||
except ImportError:
|
||||
matplotlib_version = 'not found'
|
||||
try:
|
||||
import numpy
|
||||
numpy_version = numpy.__version__
|
||||
except:
|
||||
except ImportError:
|
||||
numpy_version = 'not found'
|
||||
try:
|
||||
import sqlite3
|
||||
sqlite3_version = sqlite3.version
|
||||
sqlite_version = sqlite3.sqlite_version
|
||||
except:
|
||||
except ImportError:
|
||||
sqlite3_version = 'not found'
|
||||
sqlite_version = 'not found'
|
||||
|
||||
|
@ -205,7 +204,7 @@ class fpdb:
|
|||
gtk.Button.set_relief(button, gtk.RELIEF_NONE)
|
||||
settings = gtk.Widget.get_settings(button);
|
||||
(w,h) = gtk.icon_size_lookup_for_settings(settings, gtk.ICON_SIZE_SMALL_TOOLBAR);
|
||||
gtk.Widget.set_size_request (button, w + 4, h + 4);
|
||||
gtk.Widget.set_size_request(button, w + 4, h + 4);
|
||||
image.show()
|
||||
iconBox.pack_start(image, True, False, 0)
|
||||
button.add(iconBox)
|
||||
|
@ -935,6 +934,7 @@ class fpdb:
|
|||
response = diaDbVersionWarning.run()
|
||||
diaDbVersionWarning.destroy()
|
||||
|
||||
# TODO: This should probably be setup in GUI Init
|
||||
if self.status_bar is None:
|
||||
self.status_bar = gtk.Label("")
|
||||
self.main_vbox.pack_end(self.status_bar, False, True, 0)
|
||||
|
@ -968,8 +968,8 @@ class fpdb:
|
|||
self.quitting = True
|
||||
# TODO: check if current settings differ from profile, if so offer to save or abort
|
||||
|
||||
if self.db!=None:
|
||||
if self.db.backend==self.db.MYSQL_INNODB:
|
||||
if self.db is not None:
|
||||
if self.db.backend == self.db.MYSQL_INNODB:
|
||||
try:
|
||||
import _mysql_exceptions
|
||||
if self.db is not None and self.db.is_connected():
|
||||
|
@ -995,8 +995,11 @@ class fpdb:
|
|||
"""opens the auto import tab"""
|
||||
new_aimp_thread = GuiAutoImport.GuiAutoImport(self.settings, self.config, self.sql, self.window)
|
||||
self.threads.append(new_aimp_thread)
|
||||
aimp_tab=new_aimp_thread.get_vbox()
|
||||
aimp_tab = new_aimp_thread.get_vbox()
|
||||
self.add_and_display_tab(aimp_tab, _("Auto Import"))
|
||||
if options.autoimport:
|
||||
new_aimp_thread.startClicked(new_aimp_thread.startButton, "autostart")
|
||||
options.autoimport = False
|
||||
|
||||
def tab_bulk_import(self, widget, data=None):
|
||||
"""opens a tab for bulk importing"""
|
||||
|
@ -1103,12 +1106,24 @@ You can find the full license texts in agpl-3.0.txt, gpl-2.0.txt, gpl-3.0.txt an
|
|||
self.db = None
|
||||
self.status_bar = None
|
||||
self.quitting = False
|
||||
|
||||
self.visible = False
|
||||
self.threads = [] # objects used by tabs - no need for threads, gtk handles it
|
||||
self.closeq = Queue.Queue(20) # used to signal ending of a thread (only logviewer for now)
|
||||
|
||||
# create window, move it to specific location on command line
|
||||
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
|
||||
if options.xloc is not None or options.yloc is not None:
|
||||
if options.xloc is None:
|
||||
options.xloc = 0
|
||||
if options.yloc is None:
|
||||
options.yloc = 0
|
||||
self.window.move(options.xloc,options.yloc)
|
||||
|
||||
# connect to required events
|
||||
self.window.connect("delete_event", self.delete_event)
|
||||
self.window.connect("destroy", self.destroy)
|
||||
self.window.set_title("Free Poker DB - v%s" % (VERSION, ))
|
||||
# set a default x/y size for the window
|
||||
self.window.set_border_width(1)
|
||||
defx, defy = 900, 720
|
||||
sx, sy = gtk.gdk.screen_width(), gtk.gdk.screen_height()
|
||||
|
@ -1117,34 +1132,43 @@ You can find the full license texts in agpl-3.0.txt, gpl-2.0.txt, gpl-3.0.txt an
|
|||
self.window.set_default_size(defx, defy)
|
||||
self.window.set_resizable(True)
|
||||
|
||||
# main area of window
|
||||
self.main_vbox = gtk.VBox(False, 1)
|
||||
self.main_vbox.set_border_width(1)
|
||||
self.window.add(self.main_vbox)
|
||||
self.main_vbox.show()
|
||||
|
||||
# create our Main Menu Bar
|
||||
menubar = self.get_menu(self.window)
|
||||
self.main_vbox.pack_start(menubar, False, True, 0)
|
||||
menubar.show()
|
||||
#done menubar
|
||||
|
||||
self.threads = [] # objects used by tabs - no need for threads, gtk handles it
|
||||
self.closeq = Queue.Queue(20) # used to signal ending of a thread (only logviewer for now)
|
||||
|
||||
# create a tab bar
|
||||
self.nb = gtk.Notebook()
|
||||
self.nb.set_show_tabs(True)
|
||||
self.nb.show()
|
||||
self.main_vbox.pack_start(self.nb, True, True, 0)
|
||||
self.tabs=[] # the event_boxes forming the actual tabs
|
||||
self.tab_names=[] # names of tabs used since program started, not removed if tab is closed
|
||||
self.pages=[] # the contents of the page, not removed if tab is closed
|
||||
self.nb_tab_names=[] # list of tab names currently displayed in notebook
|
||||
self.tabs = [] # the event_boxes forming the actual tabs
|
||||
self.tab_names = [] # names of tabs used since program started, not removed if tab is closed
|
||||
self.pages = [] # the contents of the page, not removed if tab is closed
|
||||
self.nb_tab_names = [] # list of tab names currently displayed in notebook
|
||||
|
||||
# create the first tab
|
||||
self.tab_main_help(None, None)
|
||||
|
||||
# determine window visibility from command line options
|
||||
if options.minimized:
|
||||
self.window.iconify()
|
||||
if options.hidden:
|
||||
self.window.hide()
|
||||
|
||||
self.window.show()
|
||||
self.visible = True # Flip on
|
||||
if not options.hidden:
|
||||
self.window.show()
|
||||
self.visible = True # Flip on
|
||||
|
||||
self.load_profile(create_db = True)
|
||||
|
||||
# setup error logging
|
||||
if not options.errorsToConsole:
|
||||
fileName = os.path.join(self.config.dir_log, 'fpdb-errors.txt')
|
||||
print (_("\nNote: error output is being diverted to fpdb-errors.txt and HUD-errors.txt in: %s") % self.config.dir_log) \
|
||||
|
@ -1152,12 +1176,13 @@ You can find the full license texts in agpl-3.0.txt, gpl-2.0.txt, gpl-3.0.txt an
|
|||
errorFile = open(fileName, 'w', 0)
|
||||
sys.stderr = errorFile
|
||||
|
||||
# set up tray-icon and menu
|
||||
self.statusIcon = gtk.StatusIcon()
|
||||
# use getcwd() here instead of sys.path[0] so that py2exe works:
|
||||
cards = os.path.join(os.getcwd(), '..','gfx','fpdb-cards.png')
|
||||
if os.path.exists(cards):
|
||||
self.statusIcon.set_from_file(cards)
|
||||
self.window.set_icon_from_file(cards)
|
||||
self.window.set_icon_from_file(cards)
|
||||
elif os.path.exists('/usr/share/pixmaps/fpdb-cards.png'):
|
||||
self.statusIcon.set_from_file('/usr/share/pixmaps/fpdb-cards.png')
|
||||
self.window.set_icon_from_file('/usr/share/pixmaps/fpdb-cards.png')
|
||||
|
@ -1167,20 +1192,39 @@ You can find the full license texts in agpl-3.0.txt, gpl-2.0.txt, gpl-3.0.txt an
|
|||
self.statusIcon.set_tooltip("Free Poker Database")
|
||||
self.statusIcon.connect('activate', self.statusicon_activate)
|
||||
self.statusMenu = gtk.Menu()
|
||||
menuItem = gtk.ImageMenuItem(gtk.STOCK_ABOUT)
|
||||
menuItem.connect('activate', self.dia_about)
|
||||
self.statusMenu.append(menuItem)
|
||||
|
||||
menuItem = gtk.ImageMenuItem(gtk.STOCK_QUIT)
|
||||
menuItem.connect('activate', self.quit)
|
||||
self.statusMenu.append(menuItem)
|
||||
|
||||
# set default menu options
|
||||
self.addImageToTrayMenu(gtk.STOCK_ABOUT, self.dia_about)
|
||||
self.addImageToTrayMenu(gtk.STOCK_QUIT, self.quit)
|
||||
|
||||
self.statusIcon.connect('popup-menu', self.statusicon_menu, self.statusMenu)
|
||||
self.statusIcon.set_visible(True)
|
||||
|
||||
self.window.connect('window-state-event', self.window_state_event_cb)
|
||||
sys.stderr.write(_("fpdb starting ..."))
|
||||
|
||||
|
||||
if options.autoimport:
|
||||
self.tab_auto_import(None)
|
||||
|
||||
def addImageToTrayMenu(self, image, event=None):
|
||||
menuItem = gtk.ImageMenuItem(image)
|
||||
if event is not None:
|
||||
menuItem.connect('activate', event)
|
||||
self.statusMenu.append(menuItem)
|
||||
menuItem.show()
|
||||
return menuItem
|
||||
|
||||
def addLabelToTrayMenu(self, label, event=None):
|
||||
menuItem = gtk.MenuItem(label)
|
||||
if event is not None:
|
||||
menuItem.connect('activate', event)
|
||||
self.statusMenu.append(menuItem)
|
||||
menuItem.show()
|
||||
return menuItem
|
||||
|
||||
def removeFromTrayMenu(self, menuItem):
|
||||
menuItem.destroy()
|
||||
menuItem = None
|
||||
|
||||
def __iconify(self):
|
||||
self.visible = False
|
||||
|
|
4
pyfpdb/interlocks.py
Normal file → Executable file
4
pyfpdb/interlocks.py
Normal file → Executable file
|
@ -45,7 +45,7 @@ class InterProcessLockBase:
|
|||
|
||||
def acquire_impl(self, wait): abstract
|
||||
|
||||
def acquire(self, wait=False, retry_time=1, source=None):
|
||||
def acquire(self, source, wait=False, retry_time=1):
|
||||
if source == None:
|
||||
source="Unknown"
|
||||
if self._has_lock: # make sure 2nd acquire in same process fails
|
||||
|
@ -108,7 +108,7 @@ class InterProcessLockFcntl(InterProcessLockBase):
|
|||
self.lockfd = 0
|
||||
try:
|
||||
os.unlink(self.lock_file_name)
|
||||
except OSError:
|
||||
except IOError:
|
||||
# We don't care about the existence of the file too much here. It's the flock() we care about,
|
||||
# And that should just go away magically.
|
||||
pass
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
PokerStars Game #2428142447: Hold'em Limit ($1/$2 USD) - 2005/08/26 16:12:22 ET
|
||||
Table 'Teucer II' Seat #5 is the button
|
||||
Seat 1: Frankson34 ($24 in chips)
|
||||
Seat 2: webb22 ($64 in chips)
|
||||
Seat 3: eric_mtx ($26 in chips)
|
||||
Seat 4: sososolid ($147.75 in chips)
|
||||
Seat 5: DRILHER ($48.25 in chips)
|
||||
Seat 6: Naughtychic ($60 in chips)
|
||||
Seat 7: Terps78 ($71.50 in chips)
|
||||
Seat 8: ChazDazzle ($69.25 in chips)
|
||||
Seat 9: alekos ($55 in chips)
|
||||
Seat 10: BigNards84 ($64.25 in chips)
|
||||
Naughtychic: posts small blind $0.50
|
||||
Terps78: posts big blind $1
|
||||
*** HOLE CARDS ***
|
||||
Dealt to ChazDazzle [8c Kd]
|
||||
ChazDazzle: folds
|
||||
alekos: folds
|
||||
BigNards84: raises $1 to $2
|
||||
Frankson34: folds
|
||||
webb22: folds
|
||||
eric_mtx: folds
|
||||
ChazDazzle leaves the table
|
||||
sososolid: folds
|
||||
DRILHER: folds
|
||||
cdhender joins the table at seat #8
|
||||
Naughtychic: folds
|
||||
Terps78: folds
|
||||
BigNards84 collected $2.50 from pot
|
||||
BigNards84: doesn't show hand
|
||||
*** SUMMARY ***
|
||||
Total pot $2.50 | Rake $0
|
||||
Seat 1: Frankson34 folded before Flop (didn't bet)
|
||||
Seat 2: webb22 folded before Flop (didn't bet)
|
||||
Seat 3: eric_mtx folded before Flop (didn't bet)
|
||||
Seat 4: sososolid folded before Flop (didn't bet)
|
||||
Seat 5: DRILHER (button) folded before Flop (didn't bet)
|
||||
Seat 6: Naughtychic (small blind) folded before Flop
|
||||
Seat 7: Terps78 (big blind) folded before Flop
|
||||
Seat 8: ChazDazzle folded before Flop (didn't bet)
|
||||
Seat 9: alekos folded before Flop (didn't bet)
|
||||
Seat 10: BigNards84 collected ($2.50)
|
Loading…
Reference in New Issue
Block a user