diff --git a/gitso/trunk/ArgsParser.py b/gitso/trunk/ArgsParser.py index 82267c8..85b65d1 100644 --- a/gitso/trunk/ArgsParser.py +++ b/gitso/trunk/ArgsParser.py @@ -41,6 +41,7 @@ class ArgsParser: self.paths['listen'] = False self.paths['connect'] = '' self.paths['list'] = [] + self.paths['mode'] = '' if sys.platform.find('linux') != -1: @@ -54,6 +55,8 @@ class ArgsParser: i = 1 while i < len(sys.argv): if sys.argv[i] == '--dev': # --dev + print "Running in 'Development Mode'" + self.paths['mode'] = 'dev' if sys.platform == "darwin": if not os.path.exists('build/OSXvnc'): os.popen("mkdir build; cp arch/osx/OSXvnc.tar.gz build ; cd build ; tar xvfz OSXvnc.tar.gz > /dev/null") @@ -62,8 +65,7 @@ class ArgsParser: if not os.path.exists('build/cotvnc.app'): os.popen("cp arch/osx/cotvnc.app.tar.gz build ; cd build ; tar xvfz cotvnc.app.tar.gz > /dev/null") self.paths['resources'] = 'build/' - elif sys.platform == "w32": - print "dev mode" + elif sys.platform == "win32": self.paths['main'] = os.path.join(sys.path[0]) self.paths['copyright'] = os.path.join(sys.path[0], 'COPYING') self.paths['resources'] = 'arch/win32/' diff --git a/gitso/trunk/ConnectionWindow.py b/gitso/trunk/ConnectionWindow.py index d49bd31..17cd1e1 100644 --- a/gitso/trunk/ConnectionWindow.py +++ b/gitso/trunk/ConnectionWindow.py @@ -125,7 +125,7 @@ class ConnectionWindow(wx.Frame): self.SetMenuBar(menuBar) - self.statusBar = self.CreateStatusBar(1) + self.statusBar = self.CreateStatusBar() self.statusBar.SetStatusWidths([350]) self.setMessage("Idle", False) @@ -256,27 +256,19 @@ class ConnectionWindow(wx.Frame): @author: Derek Buranen @author: Aaron Gerber """ - - """ - def kill(pid): - ""kill function for Win32"" - import win32api - handle = win32api.OpenProcess(1, 0, pid) - return (0 != win32api.TerminateProcess(handle, 0)) - """ if self.thread <> None: self.thread.kill() - time.sleep(.5) + # If you don't wait 0.5+ seconds, the interface won't reload and it'll freeze. + # Possibly on older systems you should wait longer, it works fine on mine... + # With better thread management, I'm not sure that we need this. If we start getting freezes, look at this. + # time.sleep(1) self.thread = None self.setMessage("Idle.", False) return def OnCloseWindow(self, evt): - if self.thread <> None: - self.thread.kill() - time.sleep(.5) - self.thread = None + self.KillPID() self.Destroy() @@ -310,15 +302,20 @@ class ConnectionWindow(wx.Frame): self.hostField.SetValue(text) def setMessage(self, message, status): + if self.threadLock.locked(): + return + self.threadLock.acquire() self.statusBar.SetStatusText(message, 0) + if status: self.connectButton.Enable(False) self.stopButton.Enable(True) else: self.connectButton.Enable(True) self.stopButton.Enable(False) + if self.ToggleValue == 0: self.rb1.SetValue(True) @@ -328,13 +325,13 @@ class ConnectionWindow(wx.Frame): self.threadLock.release() def createThread(self, host=""): - if self.thread <> None: - self.thread.kill() - self.thread = GitsoThread.GitsoThread(self, self.paths) + self.KillPID() + self.thread = GitsoThread.GitsoThread(self, self.paths) self.thread.setHost(host) self.thread.start() # If you don't wait 1+ seconds, the interface won't reload and it'll freeze. # Possibly on older systems you should wait longer, it works fine on mine... - time.sleep(1) + # With better thread management, I'm not sure that we need this. If we start getting freezes, look at this. + # time.sleep(1) diff --git a/gitso/trunk/Processes.py b/gitso/trunk/Processes.py index 4899e66..8079d52 100644 --- a/gitso/trunk/Processes.py +++ b/gitso/trunk/Processes.py @@ -43,7 +43,11 @@ class Processes: print "Launched WinVNC.exe, waiting to run -connect command..." import time time.sleep(3) - subprocess.Popen(['WinVNC.exe', '-connect', '%s' % host]) + + if self.paths['mode'] == 'dev': + subprocess.Popen(['%sWinVNC.exe' % self.paths['resources'], '-connect', '%s' % host]) + else: + subprocess.Popen(['WinVNC.exe', '-connect', '%s' % host]) else: print 'Platform not detected' return self.returnPID @@ -56,7 +60,12 @@ class Processes: elif sys.platform.find('linux') != -1: self.returnPID = os.spawnlp(os.P_NOWAIT, 'vncviewer', 'vncviewer', '-bgr233', '-listen') elif sys.platform == 'win32': - self.returnPID = subprocess.Popen(['vncviewer.exe' , '-listen']) + import subprocess + print self.paths['resources'] + if self.paths['mode'] == 'dev': + self.returnPID = subprocess.Popen(['%svncviewer.exe' % self.paths['resources'], '-listen']) + else: + self.returnPID = subprocess.Popen(['vncviewer.exe', '-listen']) else: print 'Platform not detected' return self.returnPID @@ -76,7 +85,6 @@ class Processes: handle = win32api.OpenProcess(PROCESS_TERMINATE, False, self.returnPID.pid) win32api.TerminateProcess(handle, -1) win32api.CloseHandle(handle) - print "vnc is dead, handles closed." else: os.kill(self.returnPID, signal.SIGKILL) self.returnPID = 0 diff --git a/gitso/trunk/arch/win32/setup.py b/gitso/trunk/arch/win32/setup.py index 519b017..3639a7a 100644 --- a/gitso/trunk/arch/win32/setup.py +++ b/gitso/trunk/arch/win32/setup.py @@ -1,11 +1,15 @@ +import glob from distutils.core import setup import py2exe -import urllib +DATA_FILES = [] OPTIONS = {'argv_emulation': True} -setup(name="Gitso", - windows=["Gitso.py"], +setup( + version = "0.6.0", + description = "Gitso is to support Others", + name="Gitso", + + windows=[{"script":"Gitso.py", "icon_resources":[(1,"icon.ico")]}], + data_files=[(".", ["icon.ico"])], py_modules = ['AboutWindow', 'ConnectionWindow', 'ArgsParser', 'GitsoThread', 'Processes'], ) - - diff --git a/gitso/trunk/makegitso.nsi b/gitso/trunk/makegitso.nsi index 2dddd80..4f66316 100644 --- a/gitso/trunk/makegitso.nsi +++ b/gitso/trunk/makegitso.nsi @@ -67,6 +67,7 @@ Section "Gitso" File ".\COPYING" File ".\dist\Gitso.exe" File ".\dist\bz2.pyd" + File ".\dist\win32api.pyd" File ".\dist\icon.ico" File ".\dist\library.zip" File ".\dist\msvcp71.dll"