p60 - patches from ray - autoimport now doesnt block GUI and calls HUD.

This commit is contained in:
steffen123 2008-08-19 23:38:01 +01:00
parent eff5c9cc6e
commit d73a4614f3
3 changed files with 24 additions and 4 deletions

View File

@ -3,6 +3,7 @@ Everything is subject to change and especially the order will often change. Patc
alpha2 (release by 17Aug) alpha2 (release by 17Aug)
====== ======
set hud stats row1: hands, VPIP, PFR, PF3B/4B, ST row2: Aggr% (postflop), Fold% (postflop), W$sF, WtSD, W$@SD
make windows use correct language version of Appdata, e.g. Anwendungdaten make windows use correct language version of Appdata, e.g. Anwendungdaten
stop bulk importer from executing HUD hook stop bulk importer from executing HUD hook
seperate and improve instructions for update seperate and improve instructions for update

View File

@ -16,9 +16,12 @@
#agpl-3.0.txt in the docs folder of the package. #agpl-3.0.txt in the docs folder of the package.
import threading import threading
import subprocess
import pygtk import pygtk
pygtk.require('2.0') pygtk.require('2.0')
import gtk import gtk
import gobject
import os import os
import time import time
import fpdb_import import fpdb_import
@ -45,21 +48,35 @@ class GuiAutoImport (threading.Thread):
dia_chooser.destroy() dia_chooser.destroy()
#end def GuiAutoImport.browseClicked #end def GuiAutoImport.browseClicked
def do_import(self):
"""Callback for timer to do an import iteration."""
fpdb_import.import_file_dict(self, self.settings)
return(1)
def startClicked(self, widget, data): def startClicked(self, widget, data):
"""runs when user clicks start on auto import tab""" """runs when user clicks start on auto import tab"""
# Check to see if we have an open file handle to the HUD and open one if we do not.
# bufsize = 1 means unbuffered
# We need to close this file handle sometime.
try: #uhhh, I don't this this is the best way to check for the existence of an attr
getattr(self, "pipe_to_hud")
except AttributeError:
cwd = os.getcwd()
command = os.path.join(cwd, 'HUD_main.py')
self.pipe_to_hud = subprocess.Popen(command, bufsize = 1, stdin = subprocess.PIPE)
self.path=self.pathTBuffer.get_text(self.pathTBuffer.get_start_iter(), self.pathTBuffer.get_end_iter()) self.path=self.pathTBuffer.get_text(self.pathTBuffer.get_start_iter(), self.pathTBuffer.get_end_iter())
for file in os.listdir(self.path): for file in os.listdir(self.path):
if os.path.isdir(file): if os.path.isdir(file):
print "AutoImport is not recursive - please select the final directory in which the history files are" print "AutoImport is not recursive - please select the final directory in which the history files are"
else: else:
self.inputFile=self.path+os.sep+file self.inputFile=self.path+os.sep+file
fpdb_import.import_file_dict(self, self.settings) self.do_import()
print "GuiAutoImport.import_dir done" print "GuiAutoImport.import_dir done"
interval=int(self.intervalTBuffer.get_text(self.intervalTBuffer.get_start_iter(), self.intervalTBuffer.get_end_iter())) interval=int(self.intervalTBuffer.get_text(self.intervalTBuffer.get_start_iter(), self.intervalTBuffer.get_end_iter()))
time.sleep(interval) gobject.timeout_add(interval*1000, self.do_import)
self.startClicked(widget,data)
#end def GuiAutoImport.browseClicked #end def GuiAutoImport.browseClicked
def get_vbox(self): def get_vbox(self):

View File

@ -108,6 +108,8 @@ def import_file_dict(options, settings):
stored+=1 stored+=1
if settings['imp-callFpdbHud']: if settings['imp-callFpdbHud']:
print "call to HUD here. handsId:",handsId print "call to HUD here. handsId:",handsId
# pipe the Hands.id out to the HUD
options.pipe_to_hud.stdin.write("%s\n" % (handsId))
db.commit() db.commit()
except fpdb_simple.DuplicateError: except fpdb_simple.DuplicateError:
duplicates+=1 duplicates+=1