Button changes immediately after pressing it instead of waiting until the pipe is ready.
Terminates HUD process rather than asking it to close
This commit is contained in:
parent
e5f4f5710d
commit
2990e5856d
|
@ -213,6 +213,8 @@ class GuiAutoImport (threading.Thread):
|
||||||
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 Auto Import '))
|
widget.set_label(_(u' _Stop Auto Import '))
|
||||||
|
while gtk.events_pending(): # change the label NOW don't wait for the pipe to open
|
||||||
|
gtk.main_iteration(False)
|
||||||
if self.pipe_to_hud is None:
|
if self.pipe_to_hud is None:
|
||||||
if Configuration.FROZEN: # if py2exe, run hud_main.exe
|
if Configuration.FROZEN: # if py2exe, run hud_main.exe
|
||||||
path = Configuration.EXEC_PATH
|
path = Configuration.EXEC_PATH
|
||||||
|
@ -224,15 +226,14 @@ class GuiAutoImport (threading.Thread):
|
||||||
command = 'pythonw "'+path+'\\HUD_main.pyw" ' + self.settings['cl_options']
|
command = 'pythonw "'+path+'\\HUD_main.pyw" ' + self.settings['cl_options']
|
||||||
else:
|
else:
|
||||||
command = 'python "'+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')
|
||||||
command = [command, ] + string.split(self.settings['cl_options'])
|
command = [command, ] + string.split(self.settings['cl_options'])
|
||||||
bs = 1
|
bs = 1
|
||||||
|
|
||||||
try:
|
|
||||||
print _("opening pipe to HUD")
|
print _("opening pipe to HUD")
|
||||||
|
try:
|
||||||
if Configuration.FROZEN or (os.name == "nt" and win32console.GetConsoleWindow()) == 0:
|
if Configuration.FROZEN or (os.name == "nt" and win32console.GetConsoleWindow()) == 0:
|
||||||
self.pipe_to_hud = subprocess.Popen(command, bufsize=bs,
|
self.pipe_to_hud = subprocess.Popen(command, bufsize=bs,
|
||||||
stdin=subprocess.PIPE,
|
stdin=subprocess.PIPE,
|
||||||
|
@ -242,8 +243,6 @@ class GuiAutoImport (threading.Thread):
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
self.pipe_to_hud = subprocess.Popen(command, bufsize=bs, stdin=subprocess.PIPE, universal_newlines=True)
|
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:
|
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]))
|
||||||
|
@ -268,8 +267,9 @@ class GuiAutoImport (threading.Thread):
|
||||||
if self.pipe_to_hud.poll() is not None:
|
if self.pipe_to_hud.poll() is not None:
|
||||||
self.addText(_("\n * Stop Auto Import: HUD already terminated"))
|
self.addText(_("\n * Stop Auto Import: HUD already terminated"))
|
||||||
else:
|
else:
|
||||||
|
self.pipe_to_hud.terminate()
|
||||||
#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 _Auto Import '))
|
self.startButton.set_label(_(u' Start _Auto Import '))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user