From a98e71ad243ba292e2e736d346814be9b9bde5e7 Mon Sep 17 00:00:00 2001 From: Eric Blade Date: Mon, 27 Sep 2010 03:14:10 -0400 Subject: [PATCH] semi-fix stdout for hud_main in windows when running from source --- pyfpdb/GuiAutoImport.py | 19 ++++++++++++------- pyfpdb/HUD_main.pyw | 9 ++++++--- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/pyfpdb/GuiAutoImport.py b/pyfpdb/GuiAutoImport.py index c603ab8b..2345f0f5 100755 --- a/pyfpdb/GuiAutoImport.py +++ b/pyfpdb/GuiAutoImport.py @@ -205,13 +205,15 @@ class GuiAutoImport (threading.Thread): self.doAutoImportBool = True widget.set_label(_(u' _Stop Auto Import ')) if self.pipe_to_hud is None: - if Configuration.FROZEN: + if Configuration.FROZEN: # if py2exe, run hud_main.exe path = Configuration.EXEC_PATH command = "HUD_main.exe" bs = 0 elif os.name == 'nt': path = sys.path[0].replace('\\','\\\\') 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 else: command = os.path.join(sys.path[0], 'HUD_main.pyw') @@ -220,12 +222,15 @@ class GuiAutoImport (threading.Thread): try: print _("opening pipe to HUD") - self.pipe_to_hud = subprocess.Popen(command, bufsize=bs, - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, # only needed for py2exe - stderr=subprocess.PIPE, # only needed for py2exe - universal_newlines=True - ) + if Configuration.FROZEN: + self.pipe_to_hud = subprocess.Popen(command, bufsize=bs, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, # only needed for py2exe + stderr=subprocess.PIPE, # only needed for py2exe + 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.stderr.close() except: diff --git a/pyfpdb/HUD_main.pyw b/pyfpdb/HUD_main.pyw index c3ac5d18..dc80543e 100755 --- a/pyfpdb/HUD_main.pyw +++ b/pyfpdb/HUD_main.pyw @@ -128,19 +128,22 @@ class HUD_main(object): log.error(e) def client_moved(self, widget, hud): + print "hud_main: client moved" print hud, hud.table.name, "moved", hud.table.x, hud.table.y 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 + print "hud_main: client destroyed" self.kill_hud(None, hud.table.name) def game_changed(self, widget, hud): - print "Game Changed." + print "hud_main: Game Changed." def table_changed(self, widget, hud): - print "Table Changed." + print "hud_main: Table Changed." self.kill_hud(None, hud.table.name) def destroy(self, *args): # call back for terminating the main eventloop