Merge branch 'master' of git://git.assembla.com/fpdb
This commit is contained in:
commit
d061c89715
|
@ -23,6 +23,10 @@ import HandHistoryConverter
|
||||||
import Configuration
|
import Configuration
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import gettext
|
||||||
|
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"])
|
||||||
|
trans.install()
|
||||||
|
|
||||||
(options, argv) = Options.fpdb_options()
|
(options, argv) = Options.fpdb_options()
|
||||||
config = Configuration.Config()
|
config = Configuration.Config()
|
||||||
|
|
||||||
|
@ -40,13 +44,13 @@ if os.path.exists(options.infile):
|
||||||
filecontents = in_fh.read()
|
filecontents = in_fh.read()
|
||||||
in_fh.close()
|
in_fh.close()
|
||||||
else:
|
else:
|
||||||
print "Could not find file %s" % options.infile
|
print _("Could not find file %s") % options.infile
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
m = hhc.re_PlayerInfo.finditer(filecontents)
|
m = hhc.re_PlayerInfo.finditer(filecontents)
|
||||||
|
|
||||||
outfile = options.infile+".anon"
|
outfile = options.infile+".anon"
|
||||||
print "Output being written to", outfile
|
print _("Output being written to"), outfile
|
||||||
|
|
||||||
savestdout = sys.stdout
|
savestdout = sys.stdout
|
||||||
fsock = open(outfile,"w")
|
fsock = open(outfile,"w")
|
||||||
|
|
|
@ -70,7 +70,7 @@ class GuiAutoImport (threading.Thread):
|
||||||
vbox2 = gtk.VBox(True, 0)
|
vbox2 = gtk.VBox(True, 0)
|
||||||
hbox.pack_start(vbox2, True, True, 0)
|
hbox.pack_start(vbox2, True, True, 0)
|
||||||
|
|
||||||
self.intervalLabel = gtk.Label("Time between imports in seconds:")
|
self.intervalLabel = gtk.Label(_("Time between imports in seconds:"))
|
||||||
self.intervalLabel.set_alignment(xalign=1.0, yalign=0.5)
|
self.intervalLabel.set_alignment(xalign=1.0, yalign=0.5)
|
||||||
vbox1.pack_start(self.intervalLabel, False, True, 0)
|
vbox1.pack_start(self.intervalLabel, False, True, 0)
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ class GuiAutoImport (threading.Thread):
|
||||||
hbox.pack_start(lbl1, expand=True, fill=False)
|
hbox.pack_start(lbl1, expand=True, fill=False)
|
||||||
|
|
||||||
self.doAutoImportBool = False
|
self.doAutoImportBool = False
|
||||||
self.startButton = gtk.ToggleButton(" Start _Autoimport ")
|
self.startButton = gtk.ToggleButton(_(" Start _Autoimport "))
|
||||||
self.startButton.connect("clicked", self.startClicked, "start clicked")
|
self.startButton.connect("clicked", self.startClicked, "start clicked")
|
||||||
hbox.pack_start(self.startButton, expand=False, fill=False)
|
hbox.pack_start(self.startButton, expand=False, fill=False)
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ class GuiAutoImport (threading.Thread):
|
||||||
scrolledwindow.add(self.textview)
|
scrolledwindow.add(self.textview)
|
||||||
|
|
||||||
self.mainVBox.show_all()
|
self.mainVBox.show_all()
|
||||||
self.addText("AutoImport Ready.")
|
self.addText(_("AutoImport Ready."))
|
||||||
|
|
||||||
def addText(self, text):
|
def addText(self, text):
|
||||||
end_iter = self.textbuffer.get_end_iter()
|
end_iter = self.textbuffer.get_end_iter()
|
||||||
|
@ -133,7 +133,7 @@ class GuiAutoImport (threading.Thread):
|
||||||
"""runs when user clicks one of the browse buttons in the auto import tab"""
|
"""runs when user clicks one of the browse buttons in the auto import tab"""
|
||||||
current_path=data[1].get_text()
|
current_path=data[1].get_text()
|
||||||
|
|
||||||
dia_chooser = gtk.FileChooserDialog(title="Please choose the path that you want to auto import",
|
dia_chooser = gtk.FileChooserDialog(title=_("Please choose the path that you want to auto import"),
|
||||||
action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
|
action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
|
||||||
buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))
|
buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))
|
||||||
#dia_chooser.set_current_folder(pathname)
|
#dia_chooser.set_current_folder(pathname)
|
||||||
|
@ -156,7 +156,7 @@ class GuiAutoImport (threading.Thread):
|
||||||
def do_import(self):
|
def do_import(self):
|
||||||
"""Callback for timer to do an import iteration."""
|
"""Callback for timer to do an import iteration."""
|
||||||
if self.doAutoImportBool:
|
if self.doAutoImportBool:
|
||||||
self.startButton.set_label(u' _Auto Import Running ')
|
self.startButton.set_label(_(u' _Auto Import Running '))
|
||||||
self.importer.runUpdated()
|
self.importer.runUpdated()
|
||||||
self.addText(".")
|
self.addText(".")
|
||||||
#sys.stdout.write(".")
|
#sys.stdout.write(".")
|
||||||
|
@ -167,9 +167,9 @@ class GuiAutoImport (threading.Thread):
|
||||||
|
|
||||||
def reset_startbutton(self):
|
def reset_startbutton(self):
|
||||||
if self.pipe_to_hud is not None:
|
if self.pipe_to_hud is not None:
|
||||||
self.startButton.set_label(u' Stop _Autoimport ')
|
self.startButton.set_label(_(u' Stop _Autoimport '))
|
||||||
else:
|
else:
|
||||||
self.startButton.set_label(u' Start _Autoimport ')
|
self.startButton.set_label(_(u' Start _Autoimport '))
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -192,9 +192,9 @@ class GuiAutoImport (threading.Thread):
|
||||||
# - Ideally we want to release the lock if the auto-import is killed by some
|
# - Ideally we want to release the lock if the auto-import is killed by some
|
||||||
# kind of exception - is this possible?
|
# 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(False): # returns false immediately if lock not acquired
|
||||||
self.addText("\nGlobal lock taken ... Auto Import Started.\n")
|
self.addText(_("\nGlobal lock taken ... Auto Import Started.\n"))
|
||||||
self.doAutoImportBool = True
|
self.doAutoImportBool = True
|
||||||
widget.set_label(u' _Stop Autoimport ')
|
widget.set_label(_(u' _Stop Autoimport '))
|
||||||
if self.pipe_to_hud is None:
|
if self.pipe_to_hud is None:
|
||||||
if Configuration.FROZEN:
|
if Configuration.FROZEN:
|
||||||
path = Configuration.EXEC_PATH
|
path = Configuration.EXEC_PATH
|
||||||
|
@ -210,7 +210,7 @@ class GuiAutoImport (threading.Thread):
|
||||||
bs = 1
|
bs = 1
|
||||||
|
|
||||||
try:
|
try:
|
||||||
print "opening pipe to HUD"
|
print _("opening pipe to HUD")
|
||||||
self.pipe_to_hud = subprocess.Popen(command, bufsize=bs,
|
self.pipe_to_hud = subprocess.Popen(command, bufsize=bs,
|
||||||
stdin=subprocess.PIPE,
|
stdin=subprocess.PIPE,
|
||||||
stdout=subprocess.PIPE, # only needed for py2exe
|
stdout=subprocess.PIPE, # only needed for py2exe
|
||||||
|
@ -222,7 +222,7 @@ class GuiAutoImport (threading.Thread):
|
||||||
except:
|
except:
|
||||||
err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
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]))
|
#self.addText( "\n*** GuiAutoImport Error opening pipe: " + err[2] + "(" + str(err[1]) + "): " + str(sys.exc_info()[1]))
|
||||||
self.addText( "\n*** GuiAutoImport Error opening pipe: " + traceback.format_exc() )
|
self.addText(_("\n*** GuiAutoImport Error opening pipe: ") + traceback.format_exc() )
|
||||||
else:
|
else:
|
||||||
for site in self.input_settings:
|
for site in self.input_settings:
|
||||||
self.importer.addImportDirectory(self.input_settings[site][0], True, site, self.input_settings[site][1])
|
self.importer.addImportDirectory(self.input_settings[site][0], True, site, self.input_settings[site][1])
|
||||||
|
@ -234,19 +234,19 @@ class GuiAutoImport (threading.Thread):
|
||||||
self.importtimer = gobject.timeout_add(interval * 1000, self.do_import)
|
self.importtimer = gobject.timeout_add(interval * 1000, self.do_import)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.addText("\nauto-import aborted - global lock not available")
|
self.addText(_("\nauto-import aborted - global lock not available"))
|
||||||
else: # toggled off
|
else: # toggled off
|
||||||
gobject.source_remove(self.importtimer)
|
gobject.source_remove(self.importtimer)
|
||||||
self.settings['global_lock'].release()
|
self.settings['global_lock'].release()
|
||||||
self.doAutoImportBool = False # do_import will return this and stop the gobject callback timer
|
self.doAutoImportBool = False # do_import will return this and stop the gobject callback timer
|
||||||
self.addText("\nStopping autoimport - global lock released.")
|
self.addText(_("\nStopping autoimport - global lock released."))
|
||||||
if self.pipe_to_hud.poll() is not None:
|
if self.pipe_to_hud.poll() is not None:
|
||||||
self.addText("\n * Stop Autoimport: HUD already terminated")
|
self.addText(_("\n * Stop Autoimport: HUD already terminated"))
|
||||||
else:
|
else:
|
||||||
#print >>self.pipe_to_hud.stdin, "\n"
|
#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.pipe_to_hud = None
|
||||||
self.startButton.set_label(u' Start _Autoimport ')
|
self.startButton.set_label(_(u' Start _Autoimport '))
|
||||||
|
|
||||||
#end def GuiAutoImport.startClicked
|
#end def GuiAutoImport.startClicked
|
||||||
|
|
||||||
|
@ -268,7 +268,7 @@ class GuiAutoImport (threading.Thread):
|
||||||
hbox1.pack_start(dirPath, True, True, 3)
|
hbox1.pack_start(dirPath, True, True, 3)
|
||||||
dirPath.show()
|
dirPath.show()
|
||||||
|
|
||||||
browseButton=gtk.Button("Browse...")
|
browseButton=gtk.Button(_("Browse..."))
|
||||||
browseButton.connect("clicked", self.browseClicked, [site] + [dirPath])
|
browseButton.connect("clicked", self.browseClicked, [site] + [dirPath])
|
||||||
hbox2.pack_start(browseButton, False, False, 3)
|
hbox2.pack_start(browseButton, False, False, 3)
|
||||||
browseButton.show()
|
browseButton.show()
|
||||||
|
@ -311,7 +311,7 @@ if __name__== "__main__":
|
||||||
parser = OptionParser()
|
parser = OptionParser()
|
||||||
parser.add_option("-q", "--quiet", action="store_false", dest="gui", default=True, help="don't start gui")
|
parser.add_option("-q", "--quiet", action="store_false", dest="gui", default=True, help="don't start gui")
|
||||||
parser.add_option("-m", "--minPrint", "--status", dest="minPrint", default="0", type="int",
|
parser.add_option("-m", "--minPrint", "--status", dest="minPrint", default="0", type="int",
|
||||||
help="How often to print a one-line status report (0 (default) means never)")
|
help=_("How often to print a one-line status report (0 (default) means never)"))
|
||||||
(options, argv) = parser.parse_args()
|
(options, argv) = parser.parse_args()
|
||||||
|
|
||||||
config = Configuration.Config()
|
config = Configuration.Config()
|
||||||
|
|
|
@ -52,8 +52,8 @@ class GuiBulkImport():
|
||||||
# (see comment above about what to do if pipe already open)
|
# (see comment above about what to do if pipe already open)
|
||||||
if self.settings['global_lock'].acquire(wait=False, source="GuiBulkImport"): # returns false immediately if lock not acquired
|
if self.settings['global_lock'].acquire(wait=False, source="GuiBulkImport"): # returns false immediately if lock not acquired
|
||||||
#try:
|
#try:
|
||||||
print "\nGlobal lock taken ..."
|
print _("\nGlobal lock taken ...")
|
||||||
self.progressbar.set_text("Importing...")
|
self.progressbar.set_text(_("Importing..."))
|
||||||
self.progressbar.pulse()
|
self.progressbar.pulse()
|
||||||
while gtk.events_pending(): # see http://faq.pygtk.org/index.py?req=index for more hints (3.7)
|
while gtk.events_pending(): # see http://faq.pygtk.org/index.py?req=index for more hints (3.7)
|
||||||
gtk.main_iteration(False)
|
gtk.main_iteration(False)
|
||||||
|
@ -102,7 +102,7 @@ class GuiBulkImport():
|
||||||
ttime = time() - starttime
|
ttime = time() - starttime
|
||||||
if ttime == 0:
|
if ttime == 0:
|
||||||
ttime = 1
|
ttime = 1
|
||||||
print 'GuiBulkImport.load done: Stored: %d \tDuplicates: %d \tPartial: %d \tErrors: %d in %s seconds - %.0f/sec'\
|
print _('GuiBulkImport.load done: Stored: %d \tDuplicates: %d \tPartial: %d \tErrors: %d in %s seconds - %.0f/sec')\
|
||||||
% (stored, dups, partial, errs, ttime, (stored+0.0) / ttime)
|
% (stored, dups, partial, errs, ttime, (stored+0.0) / ttime)
|
||||||
self.importer.clearFileList()
|
self.importer.clearFileList()
|
||||||
# This file should really be 'logging'
|
# This file should really be 'logging'
|
||||||
|
@ -116,7 +116,7 @@ class GuiBulkImport():
|
||||||
self.cb_drophudcache.set_active(0)
|
self.cb_drophudcache.set_active(0)
|
||||||
self.lab_hdrop.set_sensitive(True)
|
self.lab_hdrop.set_sensitive(True)
|
||||||
|
|
||||||
self.progressbar.set_text("Import Complete")
|
self.progressbar.set_text(_("Import Complete"))
|
||||||
self.progressbar.set_fraction(0)
|
self.progressbar.set_fraction(0)
|
||||||
#except:
|
#except:
|
||||||
#err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
#err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
||||||
|
@ -124,7 +124,7 @@ class GuiBulkImport():
|
||||||
#self.settings['global_lock'].release()
|
#self.settings['global_lock'].release()
|
||||||
self.settings['global_lock'].release()
|
self.settings['global_lock'].release()
|
||||||
else:
|
else:
|
||||||
print "bulk-import aborted - global lock not available"
|
print _("bulk-import aborted - global lock not available")
|
||||||
|
|
||||||
def get_vbox(self):
|
def get_vbox(self):
|
||||||
"""returns the vbox of this thread"""
|
"""returns the vbox of this thread"""
|
||||||
|
@ -150,14 +150,14 @@ class GuiBulkImport():
|
||||||
self.table.show()
|
self.table.show()
|
||||||
|
|
||||||
# checkbox - print start/stop?
|
# checkbox - print start/stop?
|
||||||
self.chk_st_st = gtk.CheckButton('Print Start/Stop Info')
|
self.chk_st_st = gtk.CheckButton(_('Print Start/Stop Info'))
|
||||||
self.table.attach(self.chk_st_st, 0, 1, 0, 1, xpadding=10, ypadding=0,
|
self.table.attach(self.chk_st_st, 0, 1, 0, 1, xpadding=10, ypadding=0,
|
||||||
yoptions=gtk.SHRINK)
|
yoptions=gtk.SHRINK)
|
||||||
self.chk_st_st.show()
|
self.chk_st_st.show()
|
||||||
self.chk_st_st.set_active(True)
|
self.chk_st_st.set_active(True)
|
||||||
|
|
||||||
# label - status
|
# label - status
|
||||||
self.lab_status = gtk.Label("Hands/status print:")
|
self.lab_status = gtk.Label(_("Hands/status print:"))
|
||||||
self.table.attach(self.lab_status, 1, 2, 0, 1, xpadding=0, ypadding=0,
|
self.table.attach(self.lab_status, 1, 2, 0, 1, xpadding=0, ypadding=0,
|
||||||
yoptions=gtk.SHRINK)
|
yoptions=gtk.SHRINK)
|
||||||
self.lab_status.show()
|
self.lab_status.show()
|
||||||
|
@ -174,7 +174,7 @@ class GuiBulkImport():
|
||||||
self.spin_status.show()
|
self.spin_status.show()
|
||||||
|
|
||||||
# label - threads
|
# label - threads
|
||||||
self.lab_threads = gtk.Label("Number of threads:")
|
self.lab_threads = gtk.Label(_("Number of threads:"))
|
||||||
self.table.attach(self.lab_threads, 3, 4, 0, 1, xpadding=0, ypadding=0,
|
self.table.attach(self.lab_threads, 3, 4, 0, 1, xpadding=0, ypadding=0,
|
||||||
yoptions=gtk.SHRINK)
|
yoptions=gtk.SHRINK)
|
||||||
self.lab_threads.show()
|
self.lab_threads.show()
|
||||||
|
@ -194,12 +194,12 @@ class GuiBulkImport():
|
||||||
self.spin_threads.set_sensitive(False)
|
self.spin_threads.set_sensitive(False)
|
||||||
|
|
||||||
# checkbox - fail on error?
|
# checkbox - fail on error?
|
||||||
self.chk_fail = gtk.CheckButton('Fail on error')
|
self.chk_fail = gtk.CheckButton(_('Fail on error'))
|
||||||
self.table.attach(self.chk_fail, 0, 1, 1, 2, xpadding=10, ypadding=0, yoptions=gtk.SHRINK)
|
self.table.attach(self.chk_fail, 0, 1, 1, 2, xpadding=10, ypadding=0, yoptions=gtk.SHRINK)
|
||||||
self.chk_fail.show()
|
self.chk_fail.show()
|
||||||
|
|
||||||
# label - hands
|
# label - hands
|
||||||
self.lab_hands = gtk.Label("Hands/file:")
|
self.lab_hands = gtk.Label(_("Hands/file:"))
|
||||||
self.table.attach(self.lab_hands, 1, 2, 1, 2, xpadding=0, ypadding=0, yoptions=gtk.SHRINK)
|
self.table.attach(self.lab_hands, 1, 2, 1, 2, xpadding=0, ypadding=0, yoptions=gtk.SHRINK)
|
||||||
self.lab_hands.show()
|
self.lab_hands.show()
|
||||||
self.lab_hands.set_justify(gtk.JUSTIFY_RIGHT)
|
self.lab_hands.set_justify(gtk.JUSTIFY_RIGHT)
|
||||||
|
@ -214,7 +214,7 @@ class GuiBulkImport():
|
||||||
self.spin_hands.show()
|
self.spin_hands.show()
|
||||||
|
|
||||||
# label - drop indexes
|
# label - drop indexes
|
||||||
self.lab_drop = gtk.Label("Drop indexes:")
|
self.lab_drop = gtk.Label(_("Drop indexes:"))
|
||||||
self.table.attach(self.lab_drop, 3, 4, 1, 2, xpadding=0, ypadding=0,
|
self.table.attach(self.lab_drop, 3, 4, 1, 2, xpadding=0, ypadding=0,
|
||||||
yoptions=gtk.SHRINK)
|
yoptions=gtk.SHRINK)
|
||||||
self.lab_drop.show()
|
self.lab_drop.show()
|
||||||
|
@ -223,20 +223,20 @@ class GuiBulkImport():
|
||||||
|
|
||||||
# ComboBox - drop indexes
|
# ComboBox - drop indexes
|
||||||
self.cb_dropindexes = gtk.combo_box_new_text()
|
self.cb_dropindexes = gtk.combo_box_new_text()
|
||||||
self.cb_dropindexes.append_text('auto')
|
self.cb_dropindexes.append_text(_('auto'))
|
||||||
self.cb_dropindexes.append_text("don't drop")
|
self.cb_dropindexes.append_text(_("don't drop"))
|
||||||
self.cb_dropindexes.append_text('drop')
|
self.cb_dropindexes.append_text(_('drop'))
|
||||||
self.cb_dropindexes.set_active(0)
|
self.cb_dropindexes.set_active(0)
|
||||||
self.table.attach(self.cb_dropindexes, 4, 5, 1, 2, xpadding=10,
|
self.table.attach(self.cb_dropindexes, 4, 5, 1, 2, xpadding=10,
|
||||||
ypadding=0, yoptions=gtk.SHRINK)
|
ypadding=0, yoptions=gtk.SHRINK)
|
||||||
self.cb_dropindexes.show()
|
self.cb_dropindexes.show()
|
||||||
|
|
||||||
self.cb_testmode = gtk.CheckButton('HUD Test mode')
|
self.cb_testmode = gtk.CheckButton(_('HUD Test mode'))
|
||||||
self.table.attach(self.cb_testmode, 0, 1, 2, 3, xpadding=10, ypadding=0, yoptions=gtk.SHRINK)
|
self.table.attach(self.cb_testmode, 0, 1, 2, 3, xpadding=10, ypadding=0, yoptions=gtk.SHRINK)
|
||||||
self.cb_testmode.show()
|
self.cb_testmode.show()
|
||||||
|
|
||||||
# label - filter
|
# label - filter
|
||||||
self.lab_filter = gtk.Label("Site filter:")
|
self.lab_filter = gtk.Label(_("Site filter:"))
|
||||||
self.table.attach(self.lab_filter, 1, 2, 2, 3, xpadding=0, ypadding=0,
|
self.table.attach(self.lab_filter, 1, 2, 2, 3, xpadding=0, ypadding=0,
|
||||||
yoptions=gtk.SHRINK)
|
yoptions=gtk.SHRINK)
|
||||||
self.lab_filter.show()
|
self.lab_filter.show()
|
||||||
|
@ -264,7 +264,7 @@ class GuiBulkImport():
|
||||||
self.cbfilter.show()
|
self.cbfilter.show()
|
||||||
|
|
||||||
# label - drop hudcache
|
# label - drop hudcache
|
||||||
self.lab_hdrop = gtk.Label("Drop HudCache:")
|
self.lab_hdrop = gtk.Label(_("Drop HudCache:"))
|
||||||
self.table.attach(self.lab_hdrop, 3, 4, 2, 3, xpadding=0, ypadding=0,
|
self.table.attach(self.lab_hdrop, 3, 4, 2, 3, xpadding=0, ypadding=0,
|
||||||
yoptions=gtk.SHRINK)
|
yoptions=gtk.SHRINK)
|
||||||
self.lab_hdrop.show()
|
self.lab_hdrop.show()
|
||||||
|
@ -273,18 +273,18 @@ class GuiBulkImport():
|
||||||
|
|
||||||
# ComboBox - drop hudcache
|
# ComboBox - drop hudcache
|
||||||
self.cb_drophudcache = gtk.combo_box_new_text()
|
self.cb_drophudcache = gtk.combo_box_new_text()
|
||||||
self.cb_drophudcache.append_text('auto')
|
self.cb_drophudcache.append_text(_('auto'))
|
||||||
self.cb_drophudcache.append_text("don't drop")
|
self.cb_drophudcache.append_text(_("don't drop"))
|
||||||
self.cb_drophudcache.append_text('drop')
|
self.cb_drophudcache.append_text(_('drop'))
|
||||||
self.cb_drophudcache.set_active(0)
|
self.cb_drophudcache.set_active(0)
|
||||||
self.table.attach(self.cb_drophudcache, 4, 5, 2, 3, xpadding=10,
|
self.table.attach(self.cb_drophudcache, 4, 5, 2, 3, xpadding=10,
|
||||||
ypadding=0, yoptions=gtk.SHRINK)
|
ypadding=0, yoptions=gtk.SHRINK)
|
||||||
self.cb_drophudcache.show()
|
self.cb_drophudcache.show()
|
||||||
|
|
||||||
# button - Import
|
# button - Import
|
||||||
self.load_button = gtk.Button('Import') # todo: rename variables to import too
|
self.load_button = gtk.Button(_('Import')) # todo: rename variables to import too
|
||||||
self.load_button.connect('clicked', self.load_clicked,
|
self.load_button.connect('clicked', self.load_clicked,
|
||||||
'Import clicked')
|
_('Import clicked'))
|
||||||
self.table.attach(self.load_button, 2, 3, 4, 5, xpadding=0, ypadding=0,
|
self.table.attach(self.load_button, 2, 3, 4, 5, xpadding=0, ypadding=0,
|
||||||
yoptions=gtk.SHRINK)
|
yoptions=gtk.SHRINK)
|
||||||
self.load_button.show()
|
self.load_button.show()
|
||||||
|
@ -302,7 +302,7 @@ class GuiBulkImport():
|
||||||
self.progressbar = gtk.ProgressBar()
|
self.progressbar = gtk.ProgressBar()
|
||||||
self.table.attach(self.progressbar, 3, 5, 4, 5, xpadding=0, ypadding=0,
|
self.table.attach(self.progressbar, 3, 5, 4, 5, xpadding=0, ypadding=0,
|
||||||
yoptions=gtk.SHRINK)
|
yoptions=gtk.SHRINK)
|
||||||
self.progressbar.set_text("Waiting...")
|
self.progressbar.set_text(_("Waiting..."))
|
||||||
self.progressbar.set_fraction(0)
|
self.progressbar.set_fraction(0)
|
||||||
self.progressbar.show()
|
self.progressbar.show()
|
||||||
|
|
||||||
|
@ -331,29 +331,29 @@ def main(argv=None):
|
||||||
|
|
||||||
parser = OptionParser()
|
parser = OptionParser()
|
||||||
parser.add_option("-f", "--file", dest="filename", metavar="FILE", default=None,
|
parser.add_option("-f", "--file", dest="filename", metavar="FILE", default=None,
|
||||||
help="Input file in quiet mode")
|
help=_("Input file in quiet mode"))
|
||||||
parser.add_option("-q", "--quiet", action="store_false", dest="gui", default=True,
|
parser.add_option("-q", "--quiet", action="store_false", dest="gui", default=True,
|
||||||
help="don't start gui; deprecated (just give a filename with -f).")
|
help=_("don't start gui; deprecated (just give a filename with -f)."))
|
||||||
parser.add_option("-c", "--convert", dest="filtername", default="PokerStars", metavar="FILTER",
|
parser.add_option("-c", "--convert", dest="filtername", default="PokerStars", metavar="FILTER",
|
||||||
help="Conversion filter (*Full Tilt Poker, PokerStars, Everleaf, Absolute)")
|
help=_("Conversion filter (*Full Tilt Poker, PokerStars, Everleaf, Absolute)"))
|
||||||
parser.add_option("-x", "--failOnError", action="store_true", default=False,
|
parser.add_option("-x", "--failOnError", action="store_true", default=False,
|
||||||
help="If this option is passed it quits when it encounters any error")
|
help=_("If this option is passed it quits when it encounters any error"))
|
||||||
parser.add_option("-m", "--minPrint", "--status", dest="minPrint", default="0", type="int",
|
parser.add_option("-m", "--minPrint", "--status", dest="minPrint", default="0", type="int",
|
||||||
help="How often to print a one-line status report (0 (default) means never)")
|
help=_("How often to print a one-line status report (0 (default) means never)"))
|
||||||
parser.add_option("-u", "--usage", action="store_true", dest="usage", default=False,
|
parser.add_option("-u", "--usage", action="store_true", dest="usage", default=False,
|
||||||
help="Print some useful one liners")
|
help=_("Print some useful one liners"))
|
||||||
parser.add_option("-s", "--starsarchive", action="store_true", dest="starsArchive", default=False,
|
parser.add_option("-s", "--starsarchive", action="store_true", dest="starsArchive", default=False,
|
||||||
help="Do the required conversion for Stars Archive format (ie. as provided by support")
|
help=_("Do the required conversion for Stars Archive format (ie. as provided by support"))
|
||||||
(options, argv) = parser.parse_args(args = argv)
|
(options, argv) = parser.parse_args(args = argv)
|
||||||
|
|
||||||
if options.usage == True:
|
if options.usage == True:
|
||||||
#Print usage examples and exit
|
#Print usage examples and exit
|
||||||
print "USAGE:"
|
print _("USAGE:")
|
||||||
print 'PokerStars converter: ./GuiBulkImport.py -c PokerStars -f filename'
|
print _('PokerStars converter: ./GuiBulkImport.py -c PokerStars -f filename')
|
||||||
print 'Full Tilt converter: ./GuiBulkImport.py -c "Full Tilt Poker" -f filename'
|
print _('Full Tilt converter: ./GuiBulkImport.py -c "Full Tilt Poker" -f filename')
|
||||||
print "Everleaf converter: ./GuiBulkImport.py -c Everleaf -f filename"
|
print _("Everleaf converter: ./GuiBulkImport.py -c Everleaf -f filename")
|
||||||
print "Absolute converter: ./GuiBulkImport.py -c Absolute -f filename"
|
print _("Absolute converter: ./GuiBulkImport.py -c Absolute -f filename")
|
||||||
print "PartyPoker converter: ./GuiBulkImport.py -c PartyPoker -f filename"
|
print _("PartyPoker converter: ./GuiBulkImport.py -c PartyPoker -f filename")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
config = Configuration.Config()
|
config = Configuration.Config()
|
||||||
|
@ -369,7 +369,7 @@ def main(argv=None):
|
||||||
settings.update(config.get_default_paths())
|
settings.update(config.get_default_paths())
|
||||||
|
|
||||||
if not options.gui:
|
if not options.gui:
|
||||||
print '-q is deprecated. Just use "-f filename" instead'
|
print _('-q is deprecated. Just use "-f filename" instead')
|
||||||
# This is because -q on its own causes an error, so -f is necessary and sufficient for cmd line use
|
# This is because -q on its own causes an error, so -f is necessary and sufficient for cmd line use
|
||||||
if not options.filename:
|
if not options.filename:
|
||||||
i = GuiBulkImport(settings, config)
|
i = GuiBulkImport(settings, config)
|
||||||
|
@ -382,7 +382,7 @@ def main(argv=None):
|
||||||
#Do something useful
|
#Do something useful
|
||||||
importer = fpdb_import.Importer(False,settings, config)
|
importer = fpdb_import.Importer(False,settings, config)
|
||||||
# importer.setDropIndexes("auto")
|
# importer.setDropIndexes("auto")
|
||||||
importer.setDropIndexes("don't drop")
|
importer.setDropIndexes(_("don't drop"))
|
||||||
importer.setFailOnError(options.failOnError)
|
importer.setFailOnError(options.failOnError)
|
||||||
importer.setThreads(-1)
|
importer.setThreads(-1)
|
||||||
importer.addBulkImportImportFileOrDir(os.path.expanduser(options.filename), site=options.filtername)
|
importer.addBulkImportImportFileOrDir(os.path.expanduser(options.filename), site=options.filtername)
|
||||||
|
@ -391,7 +391,7 @@ def main(argv=None):
|
||||||
importer.setStarsArchive(True)
|
importer.setStarsArchive(True)
|
||||||
(stored, dups, partial, errs, ttime) = importer.runImport()
|
(stored, dups, partial, errs, ttime) = importer.runImport()
|
||||||
importer.clearFileList()
|
importer.clearFileList()
|
||||||
print 'GuiBulkImport done: Stored: %d \tDuplicates: %d \tPartial: %d \tErrors: %d in %s seconds - %.0f/sec'\
|
print _('GuiBulkImport done: Stored: %d \tDuplicates: %d \tPartial: %d \tErrors: %d in %s seconds - %.0f/sec')\
|
||||||
% (stored, dups, partial, errs, ttime, (stored+0.0) / ttime)
|
% (stored, dups, partial, errs, ttime, (stored+0.0) / ttime)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,18 +34,18 @@ class GuiImapFetcher (threading.Thread):
|
||||||
self.buttonsHBox = gtk.HBox()
|
self.buttonsHBox = gtk.HBox()
|
||||||
self.mainVBox.pack_end(self.buttonsHBox, expand=False)
|
self.mainVBox.pack_end(self.buttonsHBox, expand=False)
|
||||||
|
|
||||||
label=gtk.Label("To cancel just close this tab.")
|
label=gtk.Label(_("To cancel just close this tab."))
|
||||||
self.buttonsHBox.add(label)
|
self.buttonsHBox.add(label)
|
||||||
|
|
||||||
self.saveButton = gtk.Button("_Save")
|
self.saveButton = gtk.Button(_("_Save"))
|
||||||
self.saveButton.connect('clicked', self.saveClicked)
|
self.saveButton.connect('clicked', self.saveClicked)
|
||||||
self.buttonsHBox.add(self.saveButton)
|
self.buttonsHBox.add(self.saveButton)
|
||||||
|
|
||||||
self.importAllButton = gtk.Button("_Import All")
|
self.importAllButton = gtk.Button(_("_Import All"))
|
||||||
self.importAllButton.connect('clicked', self.importAllClicked)
|
self.importAllButton.connect('clicked', self.importAllClicked)
|
||||||
self.buttonsHBox.add(self.importAllButton)
|
self.buttonsHBox.add(self.importAllButton)
|
||||||
|
|
||||||
self.statusLabel=gtk.Label("If you change the config you must save before importing")
|
self.statusLabel=gtk.Label(_("If you change the config you must save before importing"))
|
||||||
self.mainVBox.pack_end(self.statusLabel, expand=False, padding=4)
|
self.mainVBox.pack_end(self.statusLabel, expand=False, padding=4)
|
||||||
|
|
||||||
self.passwords={}
|
self.passwords={}
|
||||||
|
@ -88,17 +88,17 @@ class GuiImapFetcher (threading.Thread):
|
||||||
#def saveClicked
|
#def saveClicked
|
||||||
|
|
||||||
def importAllClicked(self, widget, data=None):
|
def importAllClicked(self, widget, data=None):
|
||||||
self.statusLabel.set_label("Starting import. Please wait.") #FIXME: why doesnt this one show?
|
self.statusLabel.set_label(_("Starting import. Please wait.")) #FIXME: why doesnt this one show?
|
||||||
for email in self.config.emails:
|
for email in self.config.emails:
|
||||||
try:
|
try:
|
||||||
result=ImapFetcher.run(self.config.emails[email], self.db)
|
result=ImapFetcher.run(self.config.emails[email], self.db)
|
||||||
self.statusLabel.set_label("Finished import without error.")
|
self.statusLabel.set_label(_("Finished import without error."))
|
||||||
except IMAP4.error as error:
|
except IMAP4.error as error:
|
||||||
if str(error)=="[AUTHENTICATIONFAILED] Authentication failed.":
|
if str(error)=="[AUTHENTICATIONFAILED] Authentication failed.":
|
||||||
self.statusLabel.set_label("Login to mailserver failed: please check mailserver, username and password")
|
self.statusLabel.set_label(_("Login to mailserver failed: please check mailserver, username and password"))
|
||||||
except gaierror as error:
|
except gaierror as error:
|
||||||
if str(error)=="[Errno -2] Name or service not known":
|
if str(error)=="[Errno -2] Name or service not known":
|
||||||
self.statusLabel.set_label("Could not connect to mailserver: check mailserver and use SSL settings and internet connectivity")
|
self.statusLabel.set_label(_("Could not connect to mailserver: check mailserver and use SSL settings and internet connectivity"))
|
||||||
#def importAllClicked
|
#def importAllClicked
|
||||||
|
|
||||||
def get_vbox(self):
|
def get_vbox(self):
|
||||||
|
@ -108,7 +108,7 @@ class GuiImapFetcher (threading.Thread):
|
||||||
|
|
||||||
def displayConfig(self):
|
def displayConfig(self):
|
||||||
box=gtk.HBox(homogeneous=True)
|
box=gtk.HBox(homogeneous=True)
|
||||||
for text in ("Site", "Fetch Type", "Mailserver", "Username", "Password", "Mail Folder", "Use SSL"):
|
for text in (_("Site"), _("Fetch Type"), _("Mailserver"), _("Username"), _("Password"), _("Mail Folder"), _("Use SSL")):
|
||||||
label=gtk.Label(text)
|
label=gtk.Label(text)
|
||||||
box.add(label)
|
box.add(label)
|
||||||
self.mainVBox.pack_start(box, expand=False)
|
self.mainVBox.pack_start(box, expand=False)
|
||||||
|
@ -139,8 +139,8 @@ class GuiImapFetcher (threading.Thread):
|
||||||
box.add(entry)
|
box.add(entry)
|
||||||
|
|
||||||
sslBox = gtk.combo_box_new_text()
|
sslBox = gtk.combo_box_new_text()
|
||||||
sslBox.append_text("Yes")
|
sslBox.append_text(_("Yes"))
|
||||||
sslBox.append_text("No")
|
sslBox.append_text(_("No"))
|
||||||
sslBox.set_active(0)
|
sslBox.set_active(0)
|
||||||
box.add(sslBox)
|
box.add(sslBox)
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ class GuiTourneyPlayerStats (GuiPlayerStats.GuiPlayerStats):
|
||||||
self.filters = TourneyFilters.TourneyFilters(self.db, self.conf, self.sql, display = filters_display)
|
self.filters = TourneyFilters.TourneyFilters(self.db, self.conf, self.sql, display = filters_display)
|
||||||
#self.filters.registerButton1Name("_Filters")
|
#self.filters.registerButton1Name("_Filters")
|
||||||
#self.filters.registerButton1Callback(self.showDetailFilter)
|
#self.filters.registerButton1Callback(self.showDetailFilter)
|
||||||
self.filters.registerButton2Name("_Refresh Stats")
|
self.filters.registerButton2Name(_("_Refresh Stats"))
|
||||||
self.filters.registerButton2Callback(self.refreshStats)
|
self.filters.registerButton2Callback(self.refreshStats)
|
||||||
|
|
||||||
# ToDo: store in config
|
# ToDo: store in config
|
||||||
|
@ -237,7 +237,7 @@ class GuiTourneyPlayerStats (GuiPlayerStats.GuiPlayerStats):
|
||||||
self.addGrid(swin, 'playerDetailedStats', flags, playerids, sitenos, seats, dates)
|
self.addGrid(swin, 'playerDetailedStats', flags, playerids, sitenos, seats, dates)
|
||||||
|
|
||||||
self.db.rollback()
|
self.db.rollback()
|
||||||
print "Stats page displayed in %4.2f seconds" % (time() - startTime)
|
print _("Stats page displayed in %4.2f seconds") % (time() - startTime)
|
||||||
#end def createStatsTable
|
#end def createStatsTable
|
||||||
|
|
||||||
def fillStatsFrame(self, vbox):
|
def fillStatsFrame(self, vbox):
|
||||||
|
@ -262,10 +262,10 @@ class GuiTourneyPlayerStats (GuiPlayerStats.GuiPlayerStats):
|
||||||
|
|
||||||
if not sitenos:
|
if not sitenos:
|
||||||
#Should probably pop up here.
|
#Should probably pop up here.
|
||||||
print "No sites selected - defaulting to PokerStars"
|
print _("No sites selected - defaulting to PokerStars")
|
||||||
sitenos = [2]
|
sitenos = [2]
|
||||||
if not playerids:
|
if not playerids:
|
||||||
print "No player ids found"
|
print _("No player ids found")
|
||||||
return
|
return
|
||||||
|
|
||||||
self.createStatsTable(vbox, tourneyTypes, playerids, sitenos, seats, dates)
|
self.createStatsTable(vbox, tourneyTypes, playerids, sitenos, seats, dates)
|
||||||
|
@ -451,7 +451,7 @@ class GuiTourneyPlayerStats (GuiPlayerStats.GuiPlayerStats):
|
||||||
# to turn indicator off for other cols
|
# to turn indicator off for other cols
|
||||||
except:
|
except:
|
||||||
err = traceback.extract_tb(sys.exc_info()[2])
|
err = traceback.extract_tb(sys.exc_info()[2])
|
||||||
print "***sortCols error: " + str(sys.exc_info()[1])
|
print _("***sortCols error: ") + str(sys.exc_info()[1])
|
||||||
print "\n".join( [e[0]+':'+str(e[1])+" "+e[2] for e in err] )
|
print "\n".join( [e[0]+':'+str(e[1])+" "+e[2] for e in err] )
|
||||||
#end def sortCols
|
#end def sortCols
|
||||||
#end class GuiTourneyPlayerStats
|
#end class GuiTourneyPlayerStats
|
||||||
|
|
|
@ -60,6 +60,9 @@ elif os.name == 'nt':
|
||||||
#import Tables
|
#import Tables
|
||||||
import Hud
|
import Hud
|
||||||
|
|
||||||
|
import gettext
|
||||||
|
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"])
|
||||||
|
trans.install()
|
||||||
|
|
||||||
# get config and set up logger
|
# get config and set up logger
|
||||||
c = Configuration.Config(file=options.config, dbname=options.dbname)
|
c = Configuration.Config(file=options.config, dbname=options.dbname)
|
||||||
|
@ -71,22 +74,22 @@ class HUD_main(object):
|
||||||
# This class mainly provides state for controlling the multiple HUDs.
|
# This class mainly provides state for controlling the multiple HUDs.
|
||||||
|
|
||||||
def __init__(self, db_name = 'fpdb'):
|
def __init__(self, db_name = 'fpdb'):
|
||||||
print "\nHUD_main: starting ..."
|
print _("\nHUD_main: starting ...")
|
||||||
self.db_name = db_name
|
self.db_name = db_name
|
||||||
self.config = c
|
self.config = c
|
||||||
print "Logfile is " + os.path.join(self.config.dir_log, 'HUD-log.txt')
|
print _("Logfile is ") + os.path.join(self.config.dir_log, 'HUD-log.txt')
|
||||||
log.info("HUD_main starting: using db name = %s" % (db_name))
|
log.info(_("HUD_main starting: using db name = %s") % (db_name))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not options.errorsToConsole:
|
if not options.errorsToConsole:
|
||||||
fileName = os.path.join(self.config.dir_log, 'HUD-errors.txt')
|
fileName = os.path.join(self.config.dir_log, 'HUD-errors.txt')
|
||||||
print "Note: error output is being diverted to:\n"+fileName \
|
print _("Note: error output is being diverted to:\n")+fileName \
|
||||||
+ "\nAny major error will be reported there _only_.\n"
|
+ _("\nAny major error will be reported there _only_.\n")
|
||||||
log.info("Note: error output is being diverted to:"+fileName)
|
log.info(_("Note: error output is being diverted to:")+fileName)
|
||||||
log.info("Any major error will be reported there _only_.")
|
log.info(_("Any major error will be reported there _only_."))
|
||||||
errorFile = open(fileName, 'w', 0)
|
errorFile = open(fileName, 'w', 0)
|
||||||
sys.stderr = errorFile
|
sys.stderr = errorFile
|
||||||
sys.stderr.write("HUD_main: starting ...\n")
|
sys.stderr.write(_("HUD_main: starting ...\n"))
|
||||||
|
|
||||||
self.hud_dict = {}
|
self.hud_dict = {}
|
||||||
self.hud_params = self.config.get_hud_ui_parameters()
|
self.hud_params = self.config.get_hud_ui_parameters()
|
||||||
|
@ -99,10 +102,10 @@ class HUD_main(object):
|
||||||
self.main_window = gtk.Window()
|
self.main_window = gtk.Window()
|
||||||
self.main_window.connect("destroy", self.destroy)
|
self.main_window.connect("destroy", self.destroy)
|
||||||
self.vb = gtk.VBox()
|
self.vb = gtk.VBox()
|
||||||
self.label = gtk.Label('Closing this window will exit from the HUD.')
|
self.label = gtk.Label(_('Closing this window will exit from the HUD.'))
|
||||||
self.vb.add(self.label)
|
self.vb.add(self.label)
|
||||||
self.main_window.add(self.vb)
|
self.main_window.add(self.vb)
|
||||||
self.main_window.set_title("HUD Main Window")
|
self.main_window.set_title(_("HUD Main Window"))
|
||||||
self.main_window.show_all()
|
self.main_window.show_all()
|
||||||
except:
|
except:
|
||||||
log.error( "*** Exception in HUD_main.init() *** " )
|
log.error( "*** Exception in HUD_main.init() *** " )
|
||||||
|
@ -111,7 +114,7 @@ class HUD_main(object):
|
||||||
|
|
||||||
|
|
||||||
def destroy(self, *args): # call back for terminating the main eventloop
|
def destroy(self, *args): # call back for terminating the main eventloop
|
||||||
log.info("Terminating normally.")
|
log.info(_("Terminating normally."))
|
||||||
gtk.main_quit()
|
gtk.main_quit()
|
||||||
|
|
||||||
def kill_hud(self, event, table):
|
def kill_hud(self, event, table):
|
||||||
|
@ -215,7 +218,7 @@ class HUD_main(object):
|
||||||
t0 = time.time()
|
t0 = time.time()
|
||||||
t1 = t2 = t3 = t4 = t5 = t6 = t0
|
t1 = t2 = t3 = t4 = t5 = t6 = t0
|
||||||
new_hand_id = string.rstrip(new_hand_id)
|
new_hand_id = string.rstrip(new_hand_id)
|
||||||
log.debug("Received hand no %s" % new_hand_id)
|
log.debug(_("Received hand no %s") % new_hand_id)
|
||||||
if new_hand_id == "": # blank line means quit
|
if new_hand_id == "": # blank line means quit
|
||||||
self.destroy()
|
self.destroy()
|
||||||
break # this thread is not always killed immediately with gtk.main_quit()
|
break # this thread is not always killed immediately with gtk.main_quit()
|
||||||
|
@ -234,12 +237,12 @@ class HUD_main(object):
|
||||||
|
|
||||||
# get basic info about the new hand from the db
|
# get basic info about the new hand from the db
|
||||||
# if there is a db error, complain, skip hand, and proceed
|
# if there is a db error, complain, skip hand, and proceed
|
||||||
log.info("HUD_main.read_stdin: hand processing starting ...")
|
log.info(_("HUD_main.read_stdin: hand processing starting ..."))
|
||||||
try:
|
try:
|
||||||
(table_name, max, poker_game, type, site_id, site_name, num_seats, tour_number, tab_number) = \
|
(table_name, max, poker_game, type, site_id, site_name, num_seats, tour_number, tab_number) = \
|
||||||
self.db_connection.get_table_info(new_hand_id)
|
self.db_connection.get_table_info(new_hand_id)
|
||||||
except Exception:
|
except Exception:
|
||||||
log.error("db error: skipping %s" % new_hand_id)
|
log.error(_("db error: skipping %s" % new_hand_id))
|
||||||
continue
|
continue
|
||||||
t1 = time.time()
|
t1 = time.time()
|
||||||
|
|
||||||
|
@ -260,8 +263,8 @@ class HUD_main(object):
|
||||||
try:
|
try:
|
||||||
self.hud_dict[temp_key].stat_dict = stat_dict
|
self.hud_dict[temp_key].stat_dict = stat_dict
|
||||||
except KeyError: # HUD instance has been killed off, key is stale
|
except KeyError: # HUD instance has been killed off, key is stale
|
||||||
log.error('hud_dict[%s] was not found\n' % temp_key)
|
log.error(_('hud_dict[%s] was not found\n') % temp_key)
|
||||||
log.error('will not send hand\n')
|
log.error(_('will not send hand\n'))
|
||||||
# Unlocks table, copied from end of function
|
# Unlocks table, copied from end of function
|
||||||
self.db_connection.connection.rollback()
|
self.db_connection.connection.rollback()
|
||||||
return
|
return
|
||||||
|
@ -295,8 +298,7 @@ class HUD_main(object):
|
||||||
# If no client window is found on the screen, complain and continue
|
# If no client window is found on the screen, complain and continue
|
||||||
if type == "tour":
|
if type == "tour":
|
||||||
table_name = "%s %s" % (tour_number, tab_number)
|
table_name = "%s %s" % (tour_number, tab_number)
|
||||||
# log.error("HUD create: table name "+table_name+" not found, skipping.\n")
|
log.error(_("HUD create: table name %s not found, skipping.") % table_name)
|
||||||
log.error("HUD create: table name %s not found, skipping." % table_name)
|
|
||||||
else:
|
else:
|
||||||
tablewindow.max = max
|
tablewindow.max = max
|
||||||
tablewindow.site = site_name
|
tablewindow.site = site_name
|
||||||
|
@ -304,10 +306,10 @@ class HUD_main(object):
|
||||||
if hasattr(tablewindow, 'number'):
|
if hasattr(tablewindow, 'number'):
|
||||||
self.create_HUD(new_hand_id, tablewindow, temp_key, max, poker_game, type, stat_dict, cards)
|
self.create_HUD(new_hand_id, tablewindow, temp_key, max, poker_game, type, stat_dict, cards)
|
||||||
else:
|
else:
|
||||||
log.error('Table "%s" no longer exists\n' % table_name)
|
log.error(_('Table "%s" no longer exists\n') % table_name)
|
||||||
|
|
||||||
t6 = time.time()
|
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)"
|
log.info(_("HUD_main.read_stdin: hand read in %4.3f seconds (%4.3f,%4.3f,%4.3f,%4.3f,%4.3f,%4.3f)")
|
||||||
% (t6-t0,t1-t0,t2-t0,t3-t0,t4-t0,t5-t0,t6-t0))
|
% (t6-t0,t1-t0,t2-t0,t3-t0,t4-t0,t5-t0,t6-t0))
|
||||||
self.db_connection.connection.rollback()
|
self.db_connection.connection.rollback()
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ from Exceptions import FpdbParseError
|
||||||
import Configuration
|
import Configuration
|
||||||
|
|
||||||
#import gettext
|
#import gettext
|
||||||
#trans=gettext.translation("fpdb", "/home/steffen/poker/fpdb-dev/pyfpdb/locale", languages=["de"])
|
#trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"])
|
||||||
#trans.install()
|
#trans.install()
|
||||||
|
|
||||||
import pygtk
|
import pygtk
|
||||||
|
|
|
@ -22,6 +22,10 @@
|
||||||
from imaplib import IMAP4, IMAP4_SSL
|
from imaplib import IMAP4, IMAP4_SSL
|
||||||
import PokerStarsSummary
|
import PokerStarsSummary
|
||||||
|
|
||||||
|
import gettext
|
||||||
|
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"])
|
||||||
|
trans.install()
|
||||||
|
|
||||||
def splitPokerStarsSummaries(emailText):
|
def splitPokerStarsSummaries(emailText):
|
||||||
splitSummaries=emailText.split("\nPokerStars Tournament #")[1:]
|
splitSummaries=emailText.split("\nPokerStars Tournament #")[1:]
|
||||||
for i in range(len(splitSummaries)):
|
for i in range(len(splitSummaries)):
|
||||||
|
@ -39,7 +43,7 @@ def run(config, db):
|
||||||
else:
|
else:
|
||||||
server = IMAP4(config.host)
|
server = IMAP4(config.host)
|
||||||
response = server.login(config.username, config.password) #TODO catch authentication error
|
response = server.login(config.username, config.password) #TODO catch authentication error
|
||||||
print "response to logging in:",response
|
print _("response to logging in:"),response
|
||||||
#print "server.list():",server.list() #prints list of folders
|
#print "server.list():",server.list() #prints list of folders
|
||||||
|
|
||||||
response = server.select(config.folder)
|
response = server.select(config.folder)
|
||||||
|
@ -71,7 +75,7 @@ def run(config, db):
|
||||||
#print "finished importing a PS summary with result:",result
|
#print "finished importing a PS summary with result:",result
|
||||||
#TODO: count results and output to shell like hand importer does
|
#TODO: count results and output to shell like hand importer does
|
||||||
|
|
||||||
print "completed running Imap import, closing server connection"
|
print _("completed running Imap import, closing server connection")
|
||||||
#finally:
|
#finally:
|
||||||
# try:
|
# try:
|
||||||
server.close()
|
server.close()
|
||||||
|
|
1
pyfpdb/create-mo-files.sh
Executable file
1
pyfpdb/create-mo-files.sh
Executable file
|
@ -0,0 +1 @@
|
||||||
|
python /usr/share/doc/python-2.7/examples/Tools/i18n/msgfmt.py --output-file=locale/de_DE/LC_MESSAGES/fpdb.mo locale/fpdb-de_DE.po
|
2
pyfpdb/create-po-file.sh
Executable file
2
pyfpdb/create-po-file.sh
Executable file
|
@ -0,0 +1,2 @@
|
||||||
|
python /usr/share/doc/python-2.7/examples/Tools/i18n/pygettext.py --output-dir=locale --default-domain=fpdb --output=fpdb-en_GB.po *.py*
|
||||||
|
|
275
pyfpdb/fpdb.pyw
275
pyfpdb/fpdb.pyw
|
@ -20,32 +20,32 @@ import sys
|
||||||
import re
|
import re
|
||||||
import Queue
|
import Queue
|
||||||
|
|
||||||
#import gettext
|
import gettext
|
||||||
#trans=gettext.translation("fpdb", "locale", ["en_GB"])
|
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"])
|
||||||
#trans.install()
|
trans.install()
|
||||||
|
|
||||||
# if path is set to use an old version of python look for a new one:
|
# if path is set to use an old version of python look for a new one:
|
||||||
# (does this work in linux?)
|
# (does this work in linux?)
|
||||||
if os.name == 'nt' and sys.version[0:3] not in ('2.5', '2.6') and '-r' not in sys.argv:
|
if os.name == 'nt' and sys.version[0:3] not in ('2.5', '2.6', '2.7') and '-r' not in sys.argv:
|
||||||
#print "old path =", os.environ['PATH']
|
#print "old path =", os.environ['PATH']
|
||||||
dirs = re.split(os.pathsep, os.environ['PATH'])
|
dirs = re.split(os.pathsep, os.environ['PATH'])
|
||||||
# remove any trailing / or \ chars from dirs:
|
# remove any trailing / or \ chars from dirs:
|
||||||
dirs = [re.sub('[\\/]$','',p) for p in dirs]
|
dirs = [re.sub('[\\/]$','',p) for p in dirs]
|
||||||
# remove any dirs containing 'python' apart from those ending in 'python25', 'python26' or 'python':
|
# remove any dirs containing 'python' apart from those ending in 'python25', 'python26' or 'python':
|
||||||
dirs = [p for p in dirs if not re.search('python', p, re.I) or re.search('python25$', p, re.I) or re.search('python26$', p, re.I)]
|
dirs = [p for p in dirs if not re.search('python', p, re.I) or re.search('python25$', p, re.I) or re.search('python26$', p, re.I) or re.search('python27$', p, re.I)]
|
||||||
tmppath = ";".join(dirs)
|
tmppath = ";".join(dirs)
|
||||||
#print "new path =", tmppath
|
#print "new path =", tmppath
|
||||||
if re.search('python', tmppath, re.I):
|
if re.search('python', tmppath, re.I):
|
||||||
os.environ['PATH'] = tmppath
|
os.environ['PATH'] = tmppath
|
||||||
print "Python " + sys.version[0:3] + ' - press return to continue\n'
|
print "Python " + sys.version[0:3] + _(' - press return to continue\n')
|
||||||
sys.stdin.readline()
|
sys.stdin.readline()
|
||||||
if os.name=='nt':
|
if os.name=='nt':
|
||||||
os.execvpe('pythonw.exe', ('pythonw.exe', 'fpdb.pyw', '-r'), os.environ) # first arg is ignored (name of program being run)
|
os.execvpe('pythonw.exe', ('pythonw.exe', 'fpdb.pyw', '-r'), os.environ) # first arg is ignored (name of program being run)
|
||||||
else:
|
else:
|
||||||
os.execvpe('python', ('python', 'fpdb.pyw', '-r'), os.environ) # first arg is ignored (name of program being run)
|
os.execvpe('python', ('python', 'fpdb.pyw', '-r'), os.environ) # first arg is ignored (name of program being run)
|
||||||
else:
|
else:
|
||||||
print "\npython 2.5 not found, please install python 2.5 or 2.6 for fpdb\n"
|
print _("\npython 2.5 not found, please install python 2.5, 2.6 or 2.7 for fpdb\n")
|
||||||
raw_input("Press ENTER to continue.")
|
raw_input(_("Press ENTER to continue."))
|
||||||
exit()
|
exit()
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
@ -56,8 +56,8 @@ if os.name == 'nt':
|
||||||
import win32api
|
import win32api
|
||||||
import win32con
|
import win32con
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print "We appear to be running in Windows, but the Windows Python Extensions are not loading. Please install the PYWIN32 package from http://sourceforge.net/projects/pywin32/"
|
print _("We appear to be running in Windows, but the Windows Python Extensions are not loading. Please install the PYWIN32 package from http://sourceforge.net/projects/pywin32/")
|
||||||
raw_input("Press ENTER to continue.")
|
raw_input(_("Press ENTER to continue."))
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
print "Python " + sys.version[0:3] + '...'
|
print "Python " + sys.version[0:3] + '...'
|
||||||
|
@ -78,8 +78,8 @@ try:
|
||||||
import gtk
|
import gtk
|
||||||
import pango
|
import pango
|
||||||
except:
|
except:
|
||||||
print "Unable to load PYGTK modules required for GUI. Please install PyCairo, PyGObject, and PyGTK from www.pygtk.org."
|
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.")
|
raw_input(_("Press ENTER to continue."))
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
import interlocks
|
import interlocks
|
||||||
|
@ -121,7 +121,7 @@ import Configuration
|
||||||
import Exceptions
|
import Exceptions
|
||||||
import Stats
|
import Stats
|
||||||
|
|
||||||
VERSION = "0.20.903 plus git"
|
VERSION = "0.20.904 plus git"
|
||||||
|
|
||||||
|
|
||||||
class fpdb:
|
class fpdb:
|
||||||
|
@ -236,19 +236,19 @@ class fpdb:
|
||||||
dia = gtk.AboutDialog()
|
dia = gtk.AboutDialog()
|
||||||
dia.set_name("Free Poker Database (FPDB)")
|
dia.set_name("Free Poker Database (FPDB)")
|
||||||
dia.set_version(VERSION)
|
dia.set_version(VERSION)
|
||||||
dia.set_copyright("Copyright 2008-2010, Steffen, Eratosthenes, Carl Gherardi, Eric Blade, _mt, sqlcoder, Bostik, and others")
|
dia.set_copyright(_("Copyright 2008-2010, Steffen, Eratosthenes, Carl Gherardi, Eric Blade, _mt, sqlcoder, Bostik, and others"))
|
||||||
dia.set_comments("You are free to change and distribute original or changed versions of fpdb within the rules set out by the license")
|
dia.set_comments(_("You are free to change, and distribute original or changed versions of fpdb within the rules set out by the license"))
|
||||||
dia.set_license("Please see fpdb's start screen for license information")
|
dia.set_license(_("Please see fpdb's start screen for license information"))
|
||||||
dia.set_website("http://fpdb.sourceforge.net/")
|
dia.set_website("http://fpdb.sourceforge.net/")
|
||||||
|
|
||||||
dia.set_authors(['Steffen', 'Eratosthenes', 'Carl Gherardi',
|
dia.set_authors(['Steffen', 'Eratosthenes', 'Carl Gherardi',
|
||||||
'Eric Blade', '_mt', 'sqlcoder', 'Bostik', 'and others'])
|
'Eric Blade', '_mt', 'sqlcoder', 'Bostik', _('and others')])
|
||||||
dia.set_program_name("Free Poker Database (FPDB)")
|
dia.set_program_name("Free Poker Database (FPDB)")
|
||||||
|
|
||||||
db_version = ""
|
db_version = ""
|
||||||
#if self.db is not None:
|
#if self.db is not None:
|
||||||
# db_version = self.db.get_version()
|
# db_version = self.db.get_version()
|
||||||
nums = [ ('Operating System', os.name)
|
nums = [ (_('Operating System'), os.name)
|
||||||
, ('Python', sys.version[0:3])
|
, ('Python', sys.version[0:3])
|
||||||
, ('GTK+', '.'.join([str(x) for x in gtk.gtk_version]))
|
, ('GTK+', '.'.join([str(x) for x in gtk.gtk_version]))
|
||||||
, ('PyGTK', '.'.join([str(x) for x in gtk.pygtk_version]))
|
, ('PyGTK', '.'.join([str(x) for x in gtk.pygtk_version]))
|
||||||
|
@ -268,24 +268,24 @@ class fpdb:
|
||||||
view.show()
|
view.show()
|
||||||
dia.vbox.pack_end(view, True, True, 2)
|
dia.vbox.pack_end(view, True, True, 2)
|
||||||
|
|
||||||
l = gtk.Label("Your config file is: "+self.config.file)
|
l = gtk.Label(_("Your config file is: ")+self.config.file)
|
||||||
l.set_alignment(0.5, 0.5)
|
l.set_alignment(0.5, 0.5)
|
||||||
l.show()
|
l.show()
|
||||||
dia.vbox.pack_end(l, True, True, 2)
|
dia.vbox.pack_end(l, True, True, 2)
|
||||||
|
|
||||||
l = gtk.Label('Version Information:')
|
l = gtk.Label(_('Version Information:'))
|
||||||
l.set_alignment(0.5, 0.5)
|
l.set_alignment(0.5, 0.5)
|
||||||
l.show()
|
l.show()
|
||||||
dia.vbox.pack_end(l, True, True, 2)
|
dia.vbox.pack_end(l, True, True, 2)
|
||||||
|
|
||||||
dia.run()
|
dia.run()
|
||||||
dia.destroy()
|
dia.destroy()
|
||||||
log.debug("Threads: ")
|
log.debug(_("Threads: "))
|
||||||
for t in self.threads:
|
for t in self.threads:
|
||||||
log.debug("........." + str(t.__class__))
|
log.debug("........." + str(t.__class__))
|
||||||
|
|
||||||
def dia_preferences(self, widget, data=None):
|
def dia_preferences(self, widget, data=None):
|
||||||
dia = gtk.Dialog("Preferences",
|
dia = gtk.Dialog(_("Preferences"),
|
||||||
self.window,
|
self.window,
|
||||||
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
|
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
|
||||||
(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
|
(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
|
||||||
|
@ -303,8 +303,7 @@ class fpdb:
|
||||||
dia.destroy()
|
dia.destroy()
|
||||||
else:
|
else:
|
||||||
dia.destroy() # destroy prefs before raising warning, otherwise parent is dia rather than self.window
|
dia.destroy() # destroy prefs before raising warning, otherwise parent is dia rather than self.window
|
||||||
self.warning_box("Updated preferences have not been loaded because "
|
self.warning_box(_("Updated preferences have not been loaded because windows are open. Re-start fpdb to load them."))
|
||||||
+ "windows are open. Re-start fpdb to load them.")
|
|
||||||
else:
|
else:
|
||||||
dia.destroy()
|
dia.destroy()
|
||||||
|
|
||||||
|
@ -314,7 +313,7 @@ class fpdb:
|
||||||
if len(self.tab_names) == 1:
|
if len(self.tab_names) == 1:
|
||||||
if self.obtain_global_lock("dia_maintain_dbs"): # returns true if successful
|
if self.obtain_global_lock("dia_maintain_dbs"): # returns true if successful
|
||||||
# only main tab has been opened, open dialog
|
# only main tab has been opened, open dialog
|
||||||
dia = gtk.Dialog("Maintain Databases",
|
dia = gtk.Dialog(_("Maintain Databases"),
|
||||||
self.window,
|
self.window,
|
||||||
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
|
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
|
||||||
(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
|
(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
|
||||||
|
@ -324,27 +323,26 @@ class fpdb:
|
||||||
prefs = GuiDatabase.GuiDatabase(self.config, self.window, dia)
|
prefs = GuiDatabase.GuiDatabase(self.config, self.window, dia)
|
||||||
response = dia.run()
|
response = dia.run()
|
||||||
if response == gtk.RESPONSE_ACCEPT:
|
if response == gtk.RESPONSE_ACCEPT:
|
||||||
log.info('saving updated db data')
|
log.info(_('saving updated db data'))
|
||||||
# save updated config
|
# save updated config
|
||||||
self.config.save()
|
self.config.save()
|
||||||
self.load_profile()
|
self.load_profile()
|
||||||
for name in self.config.supported_databases: #db_ip/db_user/db_pass/db_server
|
for name in self.config.supported_databases: #db_ip/db_user/db_pass/db_server
|
||||||
log.info('fpdb: name,desc='+name+','+self.config.supported_databases[name].db_desc)
|
log.info('fpdb: name,desc='+name+','+self.config.supported_databases[name].db_desc)
|
||||||
else:
|
else:
|
||||||
log.info('guidb response was '+str(response))
|
log.info(_('guidb response was ')+str(response))
|
||||||
|
|
||||||
self.release_global_lock()
|
self.release_global_lock()
|
||||||
|
|
||||||
dia.destroy()
|
dia.destroy()
|
||||||
else:
|
else:
|
||||||
self.warning_box("Cannot open Database Maintenance window because "
|
self.warning_box(_("Cannot open Database Maintenance window because other windows have been opened. Re-start fpdb to use this option."))
|
||||||
+ "other windows have been opened. Re-start fpdb to use this option.")
|
|
||||||
|
|
||||||
def dia_database_stats(self, widget, data=None):
|
def dia_database_stats(self, widget, data=None):
|
||||||
self.warning_box(str="Number of Hands: "+str(self.db.getHandCount())+
|
self.warning_box(str=_("Number of Hands: ")+str(self.db.getHandCount())+
|
||||||
"\nNumber of Tourneys: "+str(self.db.getTourneyCount())+
|
_("\nNumber of Tourneys: ")+str(self.db.getTourneyCount())+
|
||||||
"\nNumber of TourneyTypes: "+str(self.db.getTourneyTypeCount()),
|
_("\nNumber of TourneyTypes: ")+str(self.db.getTourneyTypeCount()),
|
||||||
diatitle="Database Statistics")
|
diatitle=_("Database Statistics"))
|
||||||
#end def dia_database_stats
|
#end def dia_database_stats
|
||||||
|
|
||||||
def diaHudConfigurator(self, widget, data=None):
|
def diaHudConfigurator(self, widget, data=None):
|
||||||
|
@ -353,13 +351,13 @@ class fpdb:
|
||||||
self.hudConfiguratorColumns=None
|
self.hudConfiguratorColumns=None
|
||||||
self.hudConfiguratorGame=None
|
self.hudConfiguratorGame=None
|
||||||
|
|
||||||
diaSelections = gtk.Dialog("HUD Configurator - choose category",
|
diaSelections = gtk.Dialog(_("HUD Configurator - choose category"),
|
||||||
self.window,
|
self.window,
|
||||||
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
|
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
|
||||||
(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT,
|
(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT,
|
||||||
gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT))
|
gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT))
|
||||||
|
|
||||||
label=gtk.Label("Please select the game category for which you want to configure HUD stats:")
|
label=gtk.Label(_("Please select the game category for which you want to configure HUD stats:"))
|
||||||
diaSelections.vbox.add(label)
|
diaSelections.vbox.add(label)
|
||||||
label.show()
|
label.show()
|
||||||
|
|
||||||
|
@ -411,25 +409,25 @@ class fpdb:
|
||||||
"""shows dialogue with Table of ComboBoxes to allow choosing of HUD stats"""
|
"""shows dialogue with Table of ComboBoxes to allow choosing of HUD stats"""
|
||||||
#TODO: add notices to hud configurator: no duplicates, no empties, display options
|
#TODO: add notices to hud configurator: no duplicates, no empties, display options
|
||||||
#TODO: show explanation of what each stat means
|
#TODO: show explanation of what each stat means
|
||||||
diaHudTable = gtk.Dialog("HUD Configurator - please choose your stats",
|
diaHudTable = gtk.Dialog(_("HUD Configurator - please choose your stats"),
|
||||||
self.window,
|
self.window,
|
||||||
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
|
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
|
||||||
(gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT,
|
(gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT,
|
||||||
gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT))
|
gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT))
|
||||||
|
|
||||||
label=gtk.Label("Please choose the stats you wish to use in the below table.")
|
label=gtk.Label(_("Please choose the stats you wish to use in the below table."))
|
||||||
diaHudTable.vbox.add(label)
|
diaHudTable.vbox.add(label)
|
||||||
label.show()
|
label.show()
|
||||||
|
|
||||||
label=gtk.Label("Note that you may not select any stat more than once or it will crash.")
|
label=gtk.Label(_("Note that you may not select any stat more than once or it will crash."))
|
||||||
diaHudTable.vbox.add(label)
|
diaHudTable.vbox.add(label)
|
||||||
label.show()
|
label.show()
|
||||||
|
|
||||||
label=gtk.Label("It is not currently possible to select \"empty\" or anything else to that end.")
|
label=gtk.Label(_("It is not currently possible to select \"empty\" or anything else to that end."))
|
||||||
diaHudTable.vbox.add(label)
|
diaHudTable.vbox.add(label)
|
||||||
label.show()
|
label.show()
|
||||||
|
|
||||||
label=gtk.Label("To configure things like colouring you will still have to manually edit your HUD_config.xml.")
|
label=gtk.Label(_("To configure things like colouring you will still have to manually edit your HUD_config.xml."))
|
||||||
diaHudTable.vbox.add(label)
|
diaHudTable.vbox.add(label)
|
||||||
label.show()
|
label.show()
|
||||||
|
|
||||||
|
@ -507,9 +505,6 @@ class fpdb:
|
||||||
dumpFile.close()
|
dumpFile.close()
|
||||||
#end def dia_database_stats
|
#end def dia_database_stats
|
||||||
|
|
||||||
def dia_licensing(self, widget, data=None):
|
|
||||||
self.warning_box("Unimplemented: Licensing")
|
|
||||||
|
|
||||||
def dia_load_profile(self, widget, data=None):
|
def dia_load_profile(self, widget, data=None):
|
||||||
"""Dialogue to select a file to load a profile from"""
|
"""Dialogue to select a file to load a profile from"""
|
||||||
if self.obtain_global_lock("fpdb.dia_load_profile"): # returns true if successful
|
if self.obtain_global_lock("fpdb.dia_load_profile"): # returns true if successful
|
||||||
|
@ -539,9 +534,9 @@ class fpdb:
|
||||||
|
|
||||||
#lock_released = False
|
#lock_released = False
|
||||||
dia_confirm = gtk.MessageDialog(parent=self.window, flags=gtk.DIALOG_DESTROY_WITH_PARENT, type=gtk.MESSAGE_WARNING,
|
dia_confirm = gtk.MessageDialog(parent=self.window, flags=gtk.DIALOG_DESTROY_WITH_PARENT, type=gtk.MESSAGE_WARNING,
|
||||||
buttons=(gtk.BUTTONS_YES_NO), message_format="Confirm deleting and recreating tables")
|
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 " \
|
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.\nThis may take a while."
|
+self.db.database+" on "+self.db.host+_(" they will be deleted.\nThis may take a while.")
|
||||||
dia_confirm.format_secondary_text(diastring)#todo: make above string with bold for db, host and deleted
|
dia_confirm.format_secondary_text(diastring)#todo: make above string with bold for db, host and deleted
|
||||||
# disable windowclose, do not want the the underlying processing interrupted mid-process
|
# disable windowclose, do not want the the underlying processing interrupted mid-process
|
||||||
dia_confirm.set_deletable(False)
|
dia_confirm.set_deletable(False)
|
||||||
|
@ -566,14 +561,14 @@ class fpdb:
|
||||||
# self.fdb_lock.fdb.recreate_tables()
|
# self.fdb_lock.fdb.recreate_tables()
|
||||||
elif response == gtk.RESPONSE_NO:
|
elif response == gtk.RESPONSE_NO:
|
||||||
self.release_global_lock()
|
self.release_global_lock()
|
||||||
print 'User cancelled recreating tables'
|
print _('User cancelled recreating tables')
|
||||||
#if not lock_released:
|
#if not lock_released:
|
||||||
#end def dia_recreate_tables
|
#end def dia_recreate_tables
|
||||||
|
|
||||||
def dia_recreate_hudcache(self, widget, data=None):
|
def dia_recreate_hudcache(self, widget, data=None):
|
||||||
if self.obtain_global_lock("dia_recreate_hudcache"):
|
if self.obtain_global_lock("dia_recreate_hudcache"):
|
||||||
self.dia_confirm = gtk.MessageDialog(parent=self.window, flags=gtk.DIALOG_DESTROY_WITH_PARENT, type=gtk.MESSAGE_WARNING, buttons=(gtk.BUTTONS_YES_NO), message_format="Confirm recreating HUD cache")
|
self.dia_confirm = gtk.MessageDialog(parent=self.window, flags=gtk.DIALOG_DESTROY_WITH_PARENT, type=gtk.MESSAGE_WARNING, buttons=(gtk.BUTTONS_YES_NO), message_format="Confirm recreating HUD cache")
|
||||||
diastring = "Please confirm that you want to re-create the HUD cache."
|
diastring = _("Please confirm that you want to re-create the HUD cache.")
|
||||||
self.dia_confirm.format_secondary_text(diastring)
|
self.dia_confirm.format_secondary_text(diastring)
|
||||||
# disable windowclose, do not want the the underlying processing interrupted mid-process
|
# disable windowclose, do not want the the underlying processing interrupted mid-process
|
||||||
self.dia_confirm.set_deletable(False)
|
self.dia_confirm.set_deletable(False)
|
||||||
|
@ -581,7 +576,7 @@ class fpdb:
|
||||||
hb1 = gtk.HBox(True, 1)
|
hb1 = gtk.HBox(True, 1)
|
||||||
self.h_start_date = gtk.Entry(max=12)
|
self.h_start_date = gtk.Entry(max=12)
|
||||||
self.h_start_date.set_text( self.db.get_hero_hudcache_start() )
|
self.h_start_date.set_text( self.db.get_hero_hudcache_start() )
|
||||||
lbl = gtk.Label(" Hero's cache starts: ")
|
lbl = gtk.Label(_(" Hero's cache starts: "))
|
||||||
btn = gtk.Button()
|
btn = gtk.Button()
|
||||||
btn.set_image(gtk.image_new_from_stock(gtk.STOCK_INDEX, gtk.ICON_SIZE_BUTTON))
|
btn.set_image(gtk.image_new_from_stock(gtk.STOCK_INDEX, gtk.ICON_SIZE_BUTTON))
|
||||||
btn.connect('clicked', self.__calendar_dialog, self.h_start_date)
|
btn.connect('clicked', self.__calendar_dialog, self.h_start_date)
|
||||||
|
@ -595,7 +590,7 @@ class fpdb:
|
||||||
hb2 = gtk.HBox(True, 1)
|
hb2 = gtk.HBox(True, 1)
|
||||||
self.start_date = gtk.Entry(max=12)
|
self.start_date = gtk.Entry(max=12)
|
||||||
self.start_date.set_text( self.db.get_hero_hudcache_start() )
|
self.start_date.set_text( self.db.get_hero_hudcache_start() )
|
||||||
lbl = gtk.Label(" Villains' cache starts: ")
|
lbl = gtk.Label(_(" Villains' cache starts: "))
|
||||||
btn = gtk.Button()
|
btn = gtk.Button()
|
||||||
btn.set_image(gtk.image_new_from_stock(gtk.STOCK_INDEX, gtk.ICON_SIZE_BUTTON))
|
btn.set_image(gtk.image_new_from_stock(gtk.STOCK_INDEX, gtk.ICON_SIZE_BUTTON))
|
||||||
btn.connect('clicked', self.__calendar_dialog, self.start_date)
|
btn.connect('clicked', self.__calendar_dialog, self.start_date)
|
||||||
|
@ -608,7 +603,7 @@ class fpdb:
|
||||||
|
|
||||||
response = self.dia_confirm.run()
|
response = self.dia_confirm.run()
|
||||||
if response == gtk.RESPONSE_YES:
|
if response == gtk.RESPONSE_YES:
|
||||||
lbl = gtk.Label(" Rebuilding HUD Cache ... ")
|
lbl = gtk.Label(_(" Rebuilding HUD Cache ... "))
|
||||||
self.dia_confirm.vbox.add(lbl)
|
self.dia_confirm.vbox.add(lbl)
|
||||||
lbl.show()
|
lbl.show()
|
||||||
while gtk.events_pending():
|
while gtk.events_pending():
|
||||||
|
@ -616,7 +611,7 @@ class fpdb:
|
||||||
|
|
||||||
self.db.rebuild_hudcache( self.h_start_date.get_text(), self.start_date.get_text() )
|
self.db.rebuild_hudcache( self.h_start_date.get_text(), self.start_date.get_text() )
|
||||||
elif response == gtk.RESPONSE_NO:
|
elif response == gtk.RESPONSE_NO:
|
||||||
print 'User cancelled rebuilding hud cache'
|
print _('User cancelled rebuilding hud cache')
|
||||||
|
|
||||||
self.dia_confirm.destroy()
|
self.dia_confirm.destroy()
|
||||||
|
|
||||||
|
@ -628,8 +623,8 @@ class fpdb:
|
||||||
,flags=gtk.DIALOG_DESTROY_WITH_PARENT
|
,flags=gtk.DIALOG_DESTROY_WITH_PARENT
|
||||||
,type=gtk.MESSAGE_WARNING
|
,type=gtk.MESSAGE_WARNING
|
||||||
,buttons=(gtk.BUTTONS_YES_NO)
|
,buttons=(gtk.BUTTONS_YES_NO)
|
||||||
,message_format="Confirm rebuilding database indexes")
|
,message_format=_("Confirm rebuilding database indexes"))
|
||||||
diastring = "Please confirm that you want to rebuild the database indexes."
|
diastring = _("Please confirm that you want to rebuild the database indexes.")
|
||||||
self.dia_confirm.format_secondary_text(diastring)
|
self.dia_confirm.format_secondary_text(diastring)
|
||||||
# disable windowclose, do not want the the underlying processing interrupted mid-process
|
# disable windowclose, do not want the the underlying processing interrupted mid-process
|
||||||
self.dia_confirm.set_deletable(False)
|
self.dia_confirm.set_deletable(False)
|
||||||
|
@ -637,24 +632,24 @@ class fpdb:
|
||||||
response = self.dia_confirm.run()
|
response = self.dia_confirm.run()
|
||||||
if response == gtk.RESPONSE_YES:
|
if response == gtk.RESPONSE_YES:
|
||||||
#FIXME these progress messages do not seem to work in *nix
|
#FIXME these progress messages do not seem to work in *nix
|
||||||
lbl = gtk.Label(" Rebuilding Indexes ... ")
|
lbl = gtk.Label(_(" Rebuilding Indexes ... "))
|
||||||
self.dia_confirm.vbox.add(lbl)
|
self.dia_confirm.vbox.add(lbl)
|
||||||
lbl.show()
|
lbl.show()
|
||||||
while gtk.events_pending():
|
while gtk.events_pending():
|
||||||
gtk.main_iteration_do(False)
|
gtk.main_iteration_do(False)
|
||||||
self.db.rebuild_indexes()
|
self.db.rebuild_indexes()
|
||||||
|
|
||||||
lbl.set_text(" Cleaning Database ... ")
|
lbl.set_text(_(" Cleaning Database ... "))
|
||||||
while gtk.events_pending():
|
while gtk.events_pending():
|
||||||
gtk.main_iteration_do(False)
|
gtk.main_iteration_do(False)
|
||||||
self.db.vacuumDB()
|
self.db.vacuumDB()
|
||||||
|
|
||||||
lbl.set_text(" Analyzing Database ... ")
|
lbl.set_text(_(" Analyzing Database ... "))
|
||||||
while gtk.events_pending():
|
while gtk.events_pending():
|
||||||
gtk.main_iteration_do(False)
|
gtk.main_iteration_do(False)
|
||||||
self.db.analyzeDB()
|
self.db.analyzeDB()
|
||||||
elif response == gtk.RESPONSE_NO:
|
elif response == gtk.RESPONSE_NO:
|
||||||
print 'User cancelled rebuilding db indexes'
|
print _('User cancelled rebuilding db indexes')
|
||||||
|
|
||||||
self.dia_confirm.destroy()
|
self.dia_confirm.destroy()
|
||||||
|
|
||||||
|
@ -715,13 +710,13 @@ class fpdb:
|
||||||
d.set_destroy_with_parent(True)
|
d.set_destroy_with_parent(True)
|
||||||
d.set_modal(True)
|
d.set_modal(True)
|
||||||
|
|
||||||
d.set_title('Pick a date')
|
d.set_title(_('Pick a date'))
|
||||||
|
|
||||||
vb = gtk.VBox()
|
vb = gtk.VBox()
|
||||||
cal = gtk.Calendar()
|
cal = gtk.Calendar()
|
||||||
vb.pack_start(cal, expand=False, padding=0)
|
vb.pack_start(cal, expand=False, padding=0)
|
||||||
|
|
||||||
btn = gtk.Button('Done')
|
btn = gtk.Button(_('Done'))
|
||||||
btn.connect('clicked', self.__get_date, cal, entry, d)
|
btn.connect('clicked', self.__get_date, cal, entry, d)
|
||||||
|
|
||||||
vb.pack_start(btn, expand=False, padding=4)
|
vb.pack_start(btn, expand=False, padding=4)
|
||||||
|
@ -748,18 +743,13 @@ class fpdb:
|
||||||
win.destroy()
|
win.destroy()
|
||||||
self.dia_confirm.set_modal(True)
|
self.dia_confirm.set_modal(True)
|
||||||
|
|
||||||
def dia_regression_test(self, widget, data=None):
|
|
||||||
self.warning_box("Unimplemented: Regression Test")
|
|
||||||
#self.obtain_global_lock("dia_regression_test")
|
|
||||||
#self.release_global_lock()
|
|
||||||
|
|
||||||
def dia_save_profile(self, widget, data=None):
|
def dia_save_profile(self, widget, data=None):
|
||||||
self.warning_box("Unimplemented: Save Profile (try saving a HUD layout, that should do it)")
|
self.warning_box(_("Unimplemented: Save Profile (try saving a HUD layout, that should do it)"))
|
||||||
|
|
||||||
def diaSetupWizard(self, path):
|
def diaSetupWizard(self, path):
|
||||||
diaSetupWizard = gtk.Dialog(title="Fatal Error - Config File Missing", parent=None, flags=0, buttons=(gtk.STOCK_QUIT,gtk.RESPONSE_OK))
|
diaSetupWizard = gtk.Dialog(title=_("Fatal Error - Config File Missing"), parent=None, flags=0, buttons=(gtk.STOCK_QUIT,gtk.RESPONSE_OK))
|
||||||
|
|
||||||
label = gtk.Label("Please copy the config file from the docs folder to:")
|
label = gtk.Label(_("Please copy the config file from the docs folder to:"))
|
||||||
diaSetupWizard.vbox.add(label)
|
diaSetupWizard.vbox.add(label)
|
||||||
label.show()
|
label.show()
|
||||||
|
|
||||||
|
@ -767,7 +757,7 @@ class fpdb:
|
||||||
diaSetupWizard.vbox.add(label)
|
diaSetupWizard.vbox.add(label)
|
||||||
label.show()
|
label.show()
|
||||||
|
|
||||||
label = gtk.Label("and edit it according to the install documentation at http://fpdb.sourceforge.net")
|
label = gtk.Label(_("and edit it according to the install documentation at http://fpdb.sourceforge.net"))
|
||||||
diaSetupWizard.vbox.add(label)
|
diaSetupWizard.vbox.add(label)
|
||||||
label.show()
|
label.show()
|
||||||
|
|
||||||
|
@ -824,36 +814,36 @@ class fpdb:
|
||||||
actiongroup = gtk.ActionGroup('UIManagerExample')
|
actiongroup = gtk.ActionGroup('UIManagerExample')
|
||||||
|
|
||||||
# Create actions
|
# Create actions
|
||||||
actiongroup.add_actions([('main', None, '_Main'),
|
actiongroup.add_actions([('main', None, _('_Main')),
|
||||||
('Quit', gtk.STOCK_QUIT, '_Quit', None, 'Quit the Program', self.quit),
|
('Quit', gtk.STOCK_QUIT, _('_Quit'), None, 'Quit the Program', self.quit),
|
||||||
('LoadProf', None, '_Load Profile (broken)', '<control>L', 'Load your profile', self.dia_load_profile),
|
('LoadProf', None, _('_Load Profile (broken)'), _('<control>L'), 'Load your profile', self.dia_load_profile),
|
||||||
('SaveProf', None, '_Save Profile (todo)', '<control>S', 'Save your profile', self.dia_save_profile),
|
('SaveProf', None, _('_Save Profile (todo)'), _('<control>S'), 'Save your profile', self.dia_save_profile),
|
||||||
('Preferences', None, 'Pre_ferences', '<control>F', 'Edit your preferences', self.dia_preferences),
|
('Preferences', None, _('Pre_ferences'), _('<control>F'), 'Edit your preferences', self.dia_preferences),
|
||||||
('import', None, '_Import'),
|
('import', None, _('_Import')),
|
||||||
('sethharchive', None, '_Set HandHistory Archive Directory', None, 'Set HandHistory Archive Directory', self.select_hhArchiveBase),
|
('sethharchive', None, _('_Set HandHistory Archive Directory'), None, 'Set HandHistory Archive Directory', self.select_hhArchiveBase),
|
||||||
('bulkimp', None, '_Bulk Import', '<control>B', 'Bulk Import', self.tab_bulk_import),
|
('bulkimp', None, _('_Bulk Import'), _('<control>B'), 'Bulk Import', self.tab_bulk_import),
|
||||||
('imapimport', None, '_Import through eMail/IMAP', '<control>I', 'Import through eMail/IMAP', self.tab_imap_import),
|
('imapimport', None, _('_Import through eMail/IMAP'), _('<control>I'), 'Import through eMail/IMAP', self.tab_imap_import),
|
||||||
('viewers', None, '_Viewers'),
|
('viewers', None, _('_Viewers')),
|
||||||
('autoimp', None, '_Auto Import and HUD', '<control>A', 'Auto Import and HUD', self.tab_auto_import),
|
('autoimp', None, _('_Auto Import and HUD'), _('<control>A'), 'Auto Import and HUD', self.tab_auto_import),
|
||||||
('hudConfigurator', None, '_HUD Configurator', '<control>H', 'HUD Configurator', self.diaHudConfigurator),
|
('hudConfigurator', None, _('_HUD Configurator'), _('<control>H'), 'HUD Configurator', self.diaHudConfigurator),
|
||||||
('graphs', None, '_Graphs', '<control>G', 'Graphs', self.tabGraphViewer),
|
('graphs', None, _('_Graphs'), _('<control>G'), 'Graphs', self.tabGraphViewer),
|
||||||
('ringplayerstats', None, 'Ring _Player Stats (tabulated view)', '<control>P', 'Ring Player Stats (tabulated view)', self.tab_ring_player_stats),
|
('ringplayerstats', None, _('Ring _Player Stats (tabulated view)'), _('<control>P'), 'Ring Player Stats (tabulated view)', self.tab_ring_player_stats),
|
||||||
('tourneyplayerstats', None, '_Tourney Player Stats (tabulated view)', '<control>T', 'Tourney Player Stats (tabulated view, mysql only)', self.tab_tourney_player_stats),
|
('tourneyplayerstats', None, _('_Tourney Player Stats (tabulated view)'), _('<control>T'), 'Tourney Player Stats (tabulated view, mysql only)', self.tab_tourney_player_stats),
|
||||||
('tourneyviewer', None, 'Tourney _Viewer', None, 'Tourney Viewer)', self.tab_tourney_viewer_stats),
|
('tourneyviewer', None, _('Tourney _Viewer'), None, 'Tourney Viewer)', self.tab_tourney_viewer_stats),
|
||||||
('posnstats', None, 'P_ositional Stats (tabulated view, not on sqlite)', '<control>O', 'Positional Stats (tabulated view)', self.tab_positional_stats),
|
('posnstats', None, _('P_ositional Stats (tabulated view, not on sqlite)'), _('<control>O'), 'Positional Stats (tabulated view)', self.tab_positional_stats),
|
||||||
('sessionstats', None, 'Session Stats', None, 'Session Stats', self.tab_session_stats),
|
('sessionstats', None, _('Session Stats'), None, 'Session Stats', self.tab_session_stats),
|
||||||
('database', None, '_Database'),
|
('database', None, _('_Database')),
|
||||||
('maintaindbs', None, '_Maintain Databases', None, 'Maintain Databases', self.dia_maintain_dbs),
|
('maintaindbs', None, _('_Maintain Databases'), None, 'Maintain Databases', self.dia_maintain_dbs),
|
||||||
('createtabs', None, 'Create or Recreate _Tables', None, 'Create or Recreate Tables ', self.dia_recreate_tables),
|
('createtabs', None, _('Create or Recreate _Tables'), None, 'Create or Recreate Tables ', self.dia_recreate_tables),
|
||||||
('rebuildhudcache', None, 'Rebuild HUD Cache', None, 'Rebuild HUD Cache', self.dia_recreate_hudcache),
|
('rebuildhudcache', None, _('Rebuild HUD Cache'), None, 'Rebuild HUD Cache', self.dia_recreate_hudcache),
|
||||||
('rebuildindexes', None, 'Rebuild DB Indexes', None, 'Rebuild DB Indexes', self.dia_rebuild_indexes),
|
('rebuildindexes', None, _('Rebuild DB Indexes'), None, 'Rebuild DB Indexes', self.dia_rebuild_indexes),
|
||||||
('databasestats', None, '_Statistics', None, 'View Database Statistics', self.dia_database_stats),
|
('databasestats', None, _('_Statistics'), None, 'View Database Statistics', self.dia_database_stats),
|
||||||
('dumptofile', None, 'Dump Database to Textfile (takes ALOT of time)', None, 'Dump Database to Textfile (takes ALOT of time)', self.dia_dump_db),
|
('dumptofile', None, _('Dump Database to Textfile (takes ALOT of time)'), None, 'Dump Database to Textfile (takes ALOT of time)', self.dia_dump_db),
|
||||||
('help', None, '_Help'),
|
('help', None, _('_Help')),
|
||||||
('Logs', None, '_Log Messages', None, 'Log and Debug Messages', self.dia_logs),
|
('Logs', None, _('_Log Messages'), None, 'Log and Debug Messages', self.dia_logs),
|
||||||
('About', None, 'A_bout, License, Copying', None, 'About the program', self.dia_about),
|
('About', None, _('A_bout, License, Copying'), None, 'About the program', self.dia_about),
|
||||||
])
|
])
|
||||||
actiongroup.get_action('Quit').set_property('short-label', '_Quit')
|
actiongroup.get_action('Quit').set_property('short-label', _('_Quit'))
|
||||||
|
|
||||||
uimanager.insert_action_group(actiongroup, 0)
|
uimanager.insert_action_group(actiongroup, 0)
|
||||||
merge_id = uimanager.add_ui_from_string(fpdbmenu)
|
merge_id = uimanager.add_ui_from_string(fpdbmenu)
|
||||||
|
@ -869,18 +859,18 @@ class fpdb:
|
||||||
"""Loads profile from the provided path name."""
|
"""Loads profile from the provided path name."""
|
||||||
self.config = Configuration.Config(file=options.config, dbname=options.dbname)
|
self.config = Configuration.Config(file=options.config, dbname=options.dbname)
|
||||||
if self.config.file_error:
|
if self.config.file_error:
|
||||||
self.warning_box( "There is an error in your config file\n" + self.config.file
|
self.warning_box(_("There is an error in your config file\n") + self.config.file
|
||||||
+ "\n\nError is: " + str(self.config.file_error)
|
+ _("\n\nError is: ") + str(self.config.file_error)
|
||||||
, diatitle="CONFIG FILE ERROR" )
|
, diatitle=_("CONFIG FILE ERROR"))
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
log = Configuration.get_logger("logging.conf", "fpdb", log_dir=self.config.dir_log)
|
log = Configuration.get_logger("logging.conf", "fpdb", log_dir=self.config.dir_log)
|
||||||
print "Logfile is " + os.path.join(self.config.dir_log, self.config.log_file) + "\n"
|
print _("Logfile is ") + os.path.join(self.config.dir_log, self.config.log_file) + "\n"
|
||||||
if self.config.example_copy:
|
if self.config.example_copy:
|
||||||
self.info_box( "Config file"
|
self.info_box(_("Config file")
|
||||||
, "has been created at:\n%s.\n" % self.config.file
|
, _("has been created at:\n%s.\n") % self.config.file
|
||||||
+ "Edit your screen_name and hand history path in the supported_sites "
|
+ _("Edit your screen_name and hand history path in the supported_sites ")
|
||||||
+ "section of the Preferences window (Main menu) before trying to import hands.")
|
+ _("section of the Preferences window (Main menu) before trying to import hands."))
|
||||||
self.settings = {}
|
self.settings = {}
|
||||||
self.settings['global_lock'] = self.lock
|
self.settings['global_lock'] = self.lock
|
||||||
if (os.sep=="/"):
|
if (os.sep=="/"):
|
||||||
|
@ -903,17 +893,17 @@ class fpdb:
|
||||||
self.db = Database.Database(self.config, sql = self.sql)
|
self.db = Database.Database(self.config, sql = self.sql)
|
||||||
if self.db.get_backend_name() == 'SQLite':
|
if self.db.get_backend_name() == 'SQLite':
|
||||||
# tell sqlite users where the db file is
|
# tell sqlite users where the db file is
|
||||||
print "Connected to SQLite: %(database)s" % {'database':self.db.db_path}
|
print _("Connected to SQLite: %(database)s") % {'database':self.db.db_path}
|
||||||
except Exceptions.FpdbMySQLAccessDenied:
|
except Exceptions.FpdbMySQLAccessDenied:
|
||||||
err_msg = "MySQL Server reports: Access denied. Are your permissions set correctly?"
|
err_msg = _("MySQL Server reports: Access denied. Are your permissions set correctly?")
|
||||||
except Exceptions.FpdbMySQLNoDatabase:
|
except Exceptions.FpdbMySQLNoDatabase:
|
||||||
err_msg = "MySQL client reports: 2002 or 2003 error. Unable to connect - " \
|
err_msg = _("MySQL client reports: 2002 or 2003 error. Unable to connect - ") \
|
||||||
+ "Please check that the MySQL service has been started"
|
+ _("Please check that the MySQL service has been started")
|
||||||
except Exceptions.FpdbPostgresqlAccessDenied:
|
except Exceptions.FpdbPostgresqlAccessDenied:
|
||||||
err_msg = "Postgres Server reports: Access denied. Are your permissions set correctly?"
|
err_msg = _("Postgres Server reports: Access denied. Are your permissions set correctly?")
|
||||||
except Exceptions.FpdbPostgresqlNoDatabase:
|
except Exceptions.FpdbPostgresqlNoDatabase:
|
||||||
err_msg = "Postgres client reports: Unable to connect - " \
|
err_msg = _("Postgres client reports: Unable to connect - ") \
|
||||||
+ "Please check that the Postgres service has been started"
|
+ _("Please check that the Postgres service has been started")
|
||||||
if err_msg is not None:
|
if err_msg is not None:
|
||||||
self.db = None
|
self.db = None
|
||||||
self.warning_box(err_msg)
|
self.warning_box(err_msg)
|
||||||
|
@ -937,17 +927,17 @@ class fpdb:
|
||||||
# sys.stderr.write("Failed to connect to %s database with username %s." % (self.settings['db-server'], self.settings['db-user']))
|
# sys.stderr.write("Failed to connect to %s database with username %s." % (self.settings['db-server'], self.settings['db-user']))
|
||||||
|
|
||||||
if self.db is not None and self.db.wrongDbVersion:
|
if self.db is not None and self.db.wrongDbVersion:
|
||||||
diaDbVersionWarning = gtk.Dialog(title="Strong Warning - Invalid database version", parent=None, flags=0, buttons=(gtk.STOCK_OK,gtk.RESPONSE_OK))
|
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.")
|
label = gtk.Label(_("An invalid DB version or missing tables have been detected."))
|
||||||
diaDbVersionWarning.vbox.add(label)
|
diaDbVersionWarning.vbox.add(label)
|
||||||
label.show()
|
label.show()
|
||||||
|
|
||||||
label = gtk.Label("This error is not necessarily fatal but it is strongly recommended that you recreate the tables by using the Database menu.")
|
label = gtk.Label(_("This error is not necessarily fatal but it is strongly recommended that you recreate the tables by using the Database menu."))
|
||||||
diaDbVersionWarning.vbox.add(label)
|
diaDbVersionWarning.vbox.add(label)
|
||||||
label.show()
|
label.show()
|
||||||
|
|
||||||
label = gtk.Label("Not doing this will likely lead to misbehaviour including fpdb crashes, corrupt data etc.")
|
label = gtk.Label(_("Not doing this will likely lead to misbehaviour including fpdb crashes, corrupt data etc."))
|
||||||
diaDbVersionWarning.vbox.add(label)
|
diaDbVersionWarning.vbox.add(label)
|
||||||
label.show()
|
label.show()
|
||||||
|
|
||||||
|
@ -960,23 +950,20 @@ class fpdb:
|
||||||
self.status_bar.show()
|
self.status_bar.show()
|
||||||
|
|
||||||
if self.db is not None and self.db.is_connected():
|
if self.db is not None and self.db.is_connected():
|
||||||
self.status_bar.set_text("Status: Connected to %s database named %s on host %s"
|
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.db.get_backend_name(),self.db.database, self.db.host))
|
||||||
# rollback to make sure any locks are cleared:
|
# rollback to make sure any locks are cleared:
|
||||||
self.db.rollback()
|
self.db.rollback()
|
||||||
|
|
||||||
self.validate_config()
|
self.validate_config()
|
||||||
|
|
||||||
def not_implemented(self, widget, data=None):
|
|
||||||
self.warning_box("Unimplemented menu entry")
|
|
||||||
|
|
||||||
def obtain_global_lock(self, source):
|
def obtain_global_lock(self, source):
|
||||||
ret = self.lock.acquire(source=source) # will return false if lock is already held
|
ret = self.lock.acquire(source=source) # will return false if lock is already held
|
||||||
if ret:
|
if ret:
|
||||||
print "\nGlobal lock taken by", source
|
print _("\nGlobal lock taken by"), source
|
||||||
self.lockTakenBy=source
|
self.lockTakenBy=source
|
||||||
else:
|
else:
|
||||||
print "\nFailed to get global lock, it is currently held by", source
|
print _("\nFailed to get global lock, it is currently held by"), source
|
||||||
return ret
|
return ret
|
||||||
# need to release it later:
|
# need to release it later:
|
||||||
# self.lock.release()
|
# self.lock.release()
|
||||||
|
@ -986,7 +973,7 @@ class fpdb:
|
||||||
#FIXME get two "quitting normally" messages, following the addition of the self.window.destroy() call
|
#FIXME get two "quitting normally" messages, following the addition of the self.window.destroy() call
|
||||||
# ... because self.window.destroy() leads to self.destroy() which calls this!
|
# ... because self.window.destroy() leads to self.destroy() which calls this!
|
||||||
if not self.quitting:
|
if not self.quitting:
|
||||||
print "Quitting normally"
|
print _("Quitting normally")
|
||||||
self.quitting = True
|
self.quitting = True
|
||||||
# TODO: check if current settings differ from profile, if so offer to save or abort
|
# TODO: check if current settings differ from profile, if so offer to save or abort
|
||||||
|
|
||||||
|
@ -1010,62 +997,62 @@ class fpdb:
|
||||||
def release_global_lock(self):
|
def release_global_lock(self):
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
self.lockTakenBy=None
|
self.lockTakenBy=None
|
||||||
print "Global lock released.\n"
|
print _("Global lock released.\n")
|
||||||
|
|
||||||
def tab_auto_import(self, widget, data=None):
|
def tab_auto_import(self, widget, data=None):
|
||||||
"""opens the auto import tab"""
|
"""opens the auto import tab"""
|
||||||
new_aimp_thread = GuiAutoImport.GuiAutoImport(self.settings, self.config, self.sql, self.window)
|
new_aimp_thread = GuiAutoImport.GuiAutoImport(self.settings, self.config, self.sql, self.window)
|
||||||
self.threads.append(new_aimp_thread)
|
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")
|
self.add_and_display_tab(aimp_tab, _("Auto Import"))
|
||||||
|
|
||||||
def tab_bulk_import(self, widget, data=None):
|
def tab_bulk_import(self, widget, data=None):
|
||||||
"""opens a tab for bulk importing"""
|
"""opens a tab for bulk importing"""
|
||||||
new_import_thread = GuiBulkImport.GuiBulkImport(self.settings, self.config, self.sql)
|
new_import_thread = GuiBulkImport.GuiBulkImport(self.settings, self.config, self.sql)
|
||||||
self.threads.append(new_import_thread)
|
self.threads.append(new_import_thread)
|
||||||
bulk_tab=new_import_thread.get_vbox()
|
bulk_tab=new_import_thread.get_vbox()
|
||||||
self.add_and_display_tab(bulk_tab, "Bulk Import")
|
self.add_and_display_tab(bulk_tab, _("Bulk Import"))
|
||||||
|
|
||||||
def tab_imap_import(self, widget, data=None):
|
def tab_imap_import(self, widget, data=None):
|
||||||
new_thread = GuiImapFetcher.GuiImapFetcher(self.config, self.db, self.sql, self.window)
|
new_thread = GuiImapFetcher.GuiImapFetcher(self.config, self.db, self.sql, self.window)
|
||||||
self.threads.append(new_thread)
|
self.threads.append(new_thread)
|
||||||
tab=new_thread.get_vbox()
|
tab=new_thread.get_vbox()
|
||||||
self.add_and_display_tab(tab, "IMAP Import")
|
self.add_and_display_tab(tab, _("eMail Import"))
|
||||||
#end def tab_import_imap_summaries
|
#end def tab_import_imap_summaries
|
||||||
|
|
||||||
def tab_ring_player_stats(self, widget, data=None):
|
def tab_ring_player_stats(self, widget, data=None):
|
||||||
new_ps_thread = GuiRingPlayerStats.GuiRingPlayerStats(self.config, self.sql, self.window)
|
new_ps_thread = GuiRingPlayerStats.GuiRingPlayerStats(self.config, self.sql, self.window)
|
||||||
self.threads.append(new_ps_thread)
|
self.threads.append(new_ps_thread)
|
||||||
ps_tab=new_ps_thread.get_vbox()
|
ps_tab=new_ps_thread.get_vbox()
|
||||||
self.add_and_display_tab(ps_tab, "Ring Player Stats")
|
self.add_and_display_tab(ps_tab, _("Ring Player Stats"))
|
||||||
|
|
||||||
def tab_tourney_player_stats(self, widget, data=None):
|
def tab_tourney_player_stats(self, widget, data=None):
|
||||||
new_ps_thread = GuiTourneyPlayerStats.GuiTourneyPlayerStats(self.config, self.db, self.sql, self.window)
|
new_ps_thread = GuiTourneyPlayerStats.GuiTourneyPlayerStats(self.config, self.db, self.sql, self.window)
|
||||||
self.threads.append(new_ps_thread)
|
self.threads.append(new_ps_thread)
|
||||||
ps_tab=new_ps_thread.get_vbox()
|
ps_tab=new_ps_thread.get_vbox()
|
||||||
self.add_and_display_tab(ps_tab, "Tourney Player Stats")
|
self.add_and_display_tab(ps_tab, _("Tourney Player Stats"))
|
||||||
|
|
||||||
def tab_tourney_viewer_stats(self, widget, data=None):
|
def tab_tourney_viewer_stats(self, widget, data=None):
|
||||||
new_thread = GuiTourneyViewer.GuiTourneyViewer(self.config, self.db, self.sql, self.window)
|
new_thread = GuiTourneyViewer.GuiTourneyViewer(self.config, self.db, self.sql, self.window)
|
||||||
self.threads.append(new_thread)
|
self.threads.append(new_thread)
|
||||||
tab=new_thread.get_vbox()
|
tab=new_thread.get_vbox()
|
||||||
self.add_and_display_tab(tab, "Tourney Viewer")
|
self.add_and_display_tab(tab, _("Tourney Viewer"))
|
||||||
|
|
||||||
def tab_positional_stats(self, widget, data=None):
|
def tab_positional_stats(self, widget, data=None):
|
||||||
new_ps_thread = GuiPositionalStats.GuiPositionalStats(self.config, self.sql)
|
new_ps_thread = GuiPositionalStats.GuiPositionalStats(self.config, self.sql)
|
||||||
self.threads.append(new_ps_thread)
|
self.threads.append(new_ps_thread)
|
||||||
ps_tab=new_ps_thread.get_vbox()
|
ps_tab=new_ps_thread.get_vbox()
|
||||||
self.add_and_display_tab(ps_tab, "Positional Stats")
|
self.add_and_display_tab(ps_tab, _("Positional Stats"))
|
||||||
|
|
||||||
def tab_session_stats(self, widget, data=None):
|
def tab_session_stats(self, widget, data=None):
|
||||||
new_ps_thread = GuiSessionViewer.GuiSessionViewer(self.config, self.sql, self.window)
|
new_ps_thread = GuiSessionViewer.GuiSessionViewer(self.config, self.sql, self.window)
|
||||||
self.threads.append(new_ps_thread)
|
self.threads.append(new_ps_thread)
|
||||||
ps_tab=new_ps_thread.get_vbox()
|
ps_tab=new_ps_thread.get_vbox()
|
||||||
self.add_and_display_tab(ps_tab, "Session Stats")
|
self.add_and_display_tab(ps_tab, _("Session Stats"))
|
||||||
|
|
||||||
def tab_main_help(self, widget, data=None):
|
def tab_main_help(self, widget, data=None):
|
||||||
"""Displays a tab with the main fpdb help screen"""
|
"""Displays a tab with the main fpdb help screen"""
|
||||||
mh_tab=gtk.Label("""Fpdb needs translators!
|
mh_tab=gtk.Label(_("""Fpdb needs translators!
|
||||||
If you speak another language and have a few minutes or more to spare get in touch by emailing steffen@schaumburger.info
|
If you speak another language and have a few minutes or more to spare get in touch by emailing steffen@schaumburger.info
|
||||||
|
|
||||||
Welcome to Fpdb!
|
Welcome to Fpdb!
|
||||||
|
@ -1081,15 +1068,15 @@ Please note that default.conf is no longer needed nor used, all configuration no
|
||||||
|
|
||||||
This program is free/libre open source software licensed partially under the AGPL3, and partially under GPL2 or later.
|
This program is free/libre open source software licensed partially under the AGPL3, and partially under GPL2 or later.
|
||||||
The Windows installer package includes code licensed under the MIT license.
|
The Windows installer package includes code licensed under the MIT license.
|
||||||
You can find the full license texts in agpl-3.0.txt, gpl-2.0.txt, gpl-3.0.txt and mit.txt in the fpdb installation directory.""")
|
You can find the full license texts in agpl-3.0.txt, gpl-2.0.txt, gpl-3.0.txt and mit.txt in the fpdb installation directory."""))
|
||||||
self.add_and_display_tab(mh_tab, "Help")
|
self.add_and_display_tab(mh_tab, _("Help"))
|
||||||
|
|
||||||
def tabGraphViewer(self, widget, data=None):
|
def tabGraphViewer(self, widget, data=None):
|
||||||
"""opens a graph viewer tab"""
|
"""opens a graph viewer tab"""
|
||||||
new_gv_thread = GuiGraphViewer.GuiGraphViewer(self.sql, self.config, self.window)
|
new_gv_thread = GuiGraphViewer.GuiGraphViewer(self.sql, self.config, self.window)
|
||||||
self.threads.append(new_gv_thread)
|
self.threads.append(new_gv_thread)
|
||||||
gv_tab = new_gv_thread.get_vbox()
|
gv_tab = new_gv_thread.get_vbox()
|
||||||
self.add_and_display_tab(gv_tab, "Graphs")
|
self.add_and_display_tab(gv_tab, _("Graphs"))
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
# no more than 1 process can this lock at a time:
|
# no more than 1 process can this lock at a time:
|
||||||
|
@ -1139,8 +1126,8 @@ You can find the full license texts in agpl-3.0.txt, gpl-2.0.txt, gpl-3.0.txt an
|
||||||
|
|
||||||
if not options.errorsToConsole:
|
if not options.errorsToConsole:
|
||||||
fileName = os.path.join(self.config.dir_log, 'fpdb-errors.txt')
|
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:\n" \
|
print _("\nNote: error output is being diverted to fpdb-errors.txt and HUD-errors.txt in:\n") \
|
||||||
+ self.config.dir_log + "\nAny major error will be reported there _only_.\n"
|
+ self.config.dir_log + _("\nAny major error will be reported there _only_.\n")
|
||||||
errorFile = open(fileName, 'w', 0)
|
errorFile = open(fileName, 'w', 0)
|
||||||
sys.stderr = errorFile
|
sys.stderr = errorFile
|
||||||
|
|
||||||
|
@ -1168,7 +1155,7 @@ You can find the full license texts in agpl-3.0.txt, gpl-2.0.txt, gpl-3.0.txt an
|
||||||
self.statusIcon.set_visible(True)
|
self.statusIcon.set_visible(True)
|
||||||
|
|
||||||
self.window.connect('window-state-event', self.window_state_event_cb)
|
self.window.connect('window-state-event', self.window_state_event_cb)
|
||||||
sys.stderr.write("fpdb starting ...")
|
sys.stderr.write(_("fpdb starting ..."))
|
||||||
|
|
||||||
def window_state_event_cb(self, window, event):
|
def window_state_event_cb(self, window, event):
|
||||||
if event.changed_mask & gtk.gdk.WINDOW_STATE_ICONIFIED:
|
if event.changed_mask & gtk.gdk.WINDOW_STATE_ICONIFIED:
|
||||||
|
@ -1217,7 +1204,7 @@ You can find the full license texts in agpl-3.0.txt, gpl-2.0.txt, gpl-3.0.txt an
|
||||||
diapath.destroy()
|
diapath.destroy()
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def warning_box(self, str, diatitle="FPDB WARNING"):
|
def warning_box(self, str, diatitle=_("FPDB WARNING")):
|
||||||
diaWarning = gtk.Dialog(title=diatitle, parent=self.window, flags=gtk.DIALOG_DESTROY_WITH_PARENT, buttons=(gtk.STOCK_OK,gtk.RESPONSE_OK))
|
diaWarning = gtk.Dialog(title=diatitle, parent=self.window, flags=gtk.DIALOG_DESTROY_WITH_PARENT, buttons=(gtk.STOCK_OK,gtk.RESPONSE_OK))
|
||||||
|
|
||||||
label = gtk.Label(str)
|
label = gtk.Label(str)
|
||||||
|
@ -1236,7 +1223,7 @@ You can find the full license texts in agpl-3.0.txt, gpl-2.0.txt, gpl-3.0.txt an
|
||||||
hhdir = hhbase
|
hhdir = hhbase
|
||||||
if not os.path.isdir(hhdir):
|
if not os.path.isdir(hhdir):
|
||||||
diapath = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_WARNING, buttons=(gtk.BUTTONS_YES_NO), message_format="Setup hh dir")
|
diapath = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_WARNING, buttons=(gtk.BUTTONS_YES_NO), message_format="Setup hh dir")
|
||||||
diastring = "WARNING: Unable to find output hh directory %s\n\n Press YES to create this directory, or NO to select a new one." % hhdir
|
diastring = _("WARNING: Unable to find output hh directory %s\n\n Press YES to create this directory, or NO to select a new one.") % hhdir
|
||||||
diapath.format_secondary_text(diastring)
|
diapath.format_secondary_text(diastring)
|
||||||
response = diapath.run()
|
response = diapath.run()
|
||||||
diapath.destroy()
|
diapath.destroy()
|
||||||
|
@ -1244,12 +1231,12 @@ You can find the full license texts in agpl-3.0.txt, gpl-2.0.txt, gpl-3.0.txt an
|
||||||
try:
|
try:
|
||||||
os.makedirs(hhdir)
|
os.makedirs(hhdir)
|
||||||
except:
|
except:
|
||||||
self.warning_box("WARNING: Unable to create hand output directory. Importing is not likely to work until this is fixed.")
|
self.warning_box(_("WARNING: Unable to create hand output directory. Importing is not likely to work until this is fixed."))
|
||||||
elif response == gtk.RESPONSE_NO:
|
elif response == gtk.RESPONSE_NO:
|
||||||
self.select_hhArchiveBase()
|
self.select_hhArchiveBase()
|
||||||
|
|
||||||
def select_hhArchiveBase(self, widget=None):
|
def select_hhArchiveBase(self, widget=None):
|
||||||
fc = gtk.FileChooserDialog(title="Select HH Output Directory", parent=None, action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER, buttons=(gtk.STOCK_OPEN,gtk.RESPONSE_OK), backend=None)
|
fc = gtk.FileChooserDialog(title=_("Select HH Output Directory"), parent=None, action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER, buttons=(gtk.STOCK_OPEN,gtk.RESPONSE_OK), backend=None)
|
||||||
fc.run()
|
fc.run()
|
||||||
# TODO: We need to put in a Cancel button, and handle if the user presses that or the "Close" box without selecting anything as a cancel, and return to the prior setting
|
# TODO: We need to put in a Cancel button, and handle if the user presses that or the "Close" box without selecting anything as a cancel, and return to the prior setting
|
||||||
#self.warning_box("You selected %s" % fc.get_filename())
|
#self.warning_box("You selected %s" % fc.get_filename())
|
||||||
|
|
BIN
pyfpdb/locale/de_DE/LC_MESSAGES/fpdb.mo
Normal file
BIN
pyfpdb/locale/de_DE/LC_MESSAGES/fpdb.mo
Normal file
Binary file not shown.
1008
pyfpdb/locale/fpdb-en_GB.po
Normal file
1008
pyfpdb/locale/fpdb-en_GB.po
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user