Fix(?) problem with HUD only starting after 2 hands have been entered.

Import code will now import_file_dict() on every file it initially finds that was modified in the last minute.

Not perfect, as a lot of hands can take longer than that.
This commit is contained in:
Worros 2008-11-05 10:39:27 +13:00
parent 79ddee8971
commit 093302e76d

View File

@ -110,7 +110,7 @@ class Importer:
self.filelist = list(set(self.filelist)) self.filelist = list(set(self.filelist))
#Add a directory of files to filelist #Add a directory of files to filelist
def addImportDirectory(self,dir,monitor = False): def addImportDirectory(self,dir,monitor = False, filter = "passthrough"):
if os.path.isdir(dir): if os.path.isdir(dir):
if monitor == True: if monitor == True:
self.monitor = True self.monitor = True
@ -146,13 +146,15 @@ class Importer:
stat_info = os.stat(file) stat_info = os.stat(file)
try: try:
lastupdate = self.updated[file] lastupdate = self.updated[file]
# print "Is " + str(stat_info.st_mtime) + " > " + str(lastupdate)
if stat_info.st_mtime > lastupdate: if stat_info.st_mtime > lastupdate:
self.import_file_dict(file) self.import_file_dict(file)
self.updated[file] = time() self.updated[file] = time()
except: except:
# print "Adding " + str(file) + " at approx " + str(time())
self.updated[file] = time() self.updated[file] = time()
# This codepath only runs first time the file is found, if modified in the last
# minute run an immediate import.
if (time() - stat_info.st_mtime) < 60:
self.import_file_dict(file)
# This is now an internal function that should not be called directly. # This is now an internal function that should not be called directly.
def import_file_dict(self, file): def import_file_dict(self, file):