semi-fix stdout for hud_main in windows when running from source

This commit is contained in:
Eric Blade 2010-09-27 03:14:10 -04:00
parent 034a871f27
commit a98e71ad24
2 changed files with 18 additions and 10 deletions

View File

@ -205,13 +205,15 @@ class GuiAutoImport (threading.Thread):
self.doAutoImportBool = True self.doAutoImportBool = True
widget.set_label(_(u' _Stop Auto Import ')) widget.set_label(_(u' _Stop Auto Import '))
if self.pipe_to_hud is None: if self.pipe_to_hud is None:
if Configuration.FROZEN: if Configuration.FROZEN: # if py2exe, run hud_main.exe
path = Configuration.EXEC_PATH path = Configuration.EXEC_PATH
command = "HUD_main.exe" command = "HUD_main.exe"
bs = 0 bs = 0
elif os.name == 'nt': elif os.name == 'nt':
path = sys.path[0].replace('\\','\\\\') path = sys.path[0].replace('\\','\\\\')
command = 'pythonw "'+path+'\\HUD_main.pyw" ' + self.settings['cl_options'] command = 'pythonw "'+path+'\\HUD_main.pyw" ' + self.settings['cl_options']
#command = 'python "'+path+'\\HUD_main.pyw" ' + self.settings['cl_options']
# uncomment above line if you want hud_main stdout to work ... and make sure you are running fpdb.py using python.exe not pythonw.exe
bs = 0 bs = 0
else: else:
command = os.path.join(sys.path[0], 'HUD_main.pyw') command = os.path.join(sys.path[0], 'HUD_main.pyw')
@ -220,12 +222,15 @@ class GuiAutoImport (threading.Thread):
try: try:
print _("opening pipe to HUD") print _("opening pipe to HUD")
if Configuration.FROZEN:
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
stderr=subprocess.PIPE, # only needed for py2exe stderr=subprocess.PIPE, # only needed for py2exe
universal_newlines=True universal_newlines=True
) )
else:
self.pipe_to_hud = subprocess.Popen(command, bufsize=bs, stdin=subprocess.PIPE, universal_newlines=True)
#self.pipe_to_hud.stdout.close() #self.pipe_to_hud.stdout.close()
#self.pipe_to_hud.stderr.close() #self.pipe_to_hud.stderr.close()
except: except:

View File

@ -128,19 +128,22 @@ class HUD_main(object):
log.error(e) log.error(e)
def client_moved(self, widget, hud): def client_moved(self, widget, hud):
print "hud_main: client moved"
print hud, hud.table.name, "moved", hud.table.x, hud.table.y print hud, hud.table.name, "moved", hud.table.x, hud.table.y
def client_resized(self, widget, hud): def client_resized(self, widget, hud):
print "Client resized" print "hud_main: Client resized"
print hud, hud.table.name, hud.table.x, hud.table.y
def client_destroyed(self, widget, hud): # call back for terminating the main eventloop def client_destroyed(self, widget, hud): # call back for terminating the main eventloop
print "hud_main: client destroyed"
self.kill_hud(None, hud.table.name) self.kill_hud(None, hud.table.name)
def game_changed(self, widget, hud): def game_changed(self, widget, hud):
print "Game Changed." print "hud_main: Game Changed."
def table_changed(self, widget, hud): def table_changed(self, widget, hud):
print "Table Changed." print "hud_main: Table Changed."
self.kill_hud(None, hud.table.name) self.kill_hud(None, hud.table.name)
def destroy(self, *args): # call back for terminating the main eventloop def destroy(self, *args): # call back for terminating the main eventloop