diff --git a/gitso/trunk/AboutWindow.py b/gitso/trunk/AboutWindow.py index 076b779..607c234 100644 --- a/gitso/trunk/AboutWindow.py +++ b/gitso/trunk/AboutWindow.py @@ -1,5 +1,37 @@ import wx -import os, os.path, sys +import os, os.path, sys, cStringIO + +class InfoPage(wx.Panel): + def __init__(self, parent): + wx.Panel.__init__(self, parent) + + infostring = "Authors:" + "\n\tAaron Gerber\n\tDerek Buranen" + infostring = infostring + "\n\nContributors:" + "\n\tNick Verbeck" + infostring = infostring + "\n\nCopyright 2007 - 2008" + + info = wx.TextCtrl(self, -1, infostring, style=wx.TE_MULTILINE | wx.ST_NO_AUTORESIZE) + + pagesizer = wx.BoxSizer(wx.VERTICAL); + pagesizer.Add(info, 1, wx.EXPAND) + self.SetSizer(pagesizer); + pagesizer.SetSizeHints(self); + + +class LicensePage(wx.Panel): + def __init__(self, parent, paths): + wx.Panel.__init__(self, parent) + + license = open(paths['copyright'], 'r') + copyright = wx.TextCtrl(self, -1, license.read(), style=wx.TE_MULTILINE | wx.ST_NO_AUTORESIZE) + copyright.SetEditable(False) + + pagesizer = wx.BoxSizer(wx.VERTICAL); + pagesizer.Add(copyright, 1, wx.EXPAND); + + self.SetSizer(pagesizer); + pagesizer.SetSizeHints(self); + + class AboutWindow(wx.Frame): """ @@ -19,41 +51,76 @@ class AboutWindow(wx.Frame): icon = wx.Icon(os.path.join(paths['main'], 'icon.ico'), wx.BITMAP_TYPE_ICO) self.SetIcon(icon) - # Create a read-only box - license = open(paths['copyright'], 'r') - if sys.platform == 'win32': - self.SetBackgroundColour(wx.Colour(236,233,216)) - - self.copyright = wx.TextCtrl(self, -1, license.read(), pos=wx.Point(0, 180), size=wx.Size(525, 160), style=wx.TE_MULTILINE | wx.ST_NO_AUTORESIZE) - self.copyright.SetEditable(False) + SetBackgroundColour(wx.Colour(236,233,216)) - self.text1 = wx.StaticText(self, wx.ID_ANY, 'Gitso', pos=wx.Point(0, 13), size=wx.Size(525, 35), style=wx.ALIGN_CENTER_HORIZONTAL | wx.ST_NO_AUTORESIZE) + ## Headings ## + text1 = wx.StaticText(self, wx.ID_ANY, 'Gitso') font1 = wx.Font(24, wx.NORMAL, wx.NORMAL, wx.BOLD) - self.text1.SetFont(font1) - - self.text2 = wx.StaticText(self, -1, "Gitso is to Support Others", pos=wx.Point(0, 48), size=wx.Size(525, 27), style=wx.ALIGN_CENTER_HORIZONTAL | wx.ST_NO_AUTORESIZE) - self.text3 = wx.StaticText(self, -1, "Version 0.5", pos=wx.Point(0, 72), size=wx.Size(525, 27), style=wx.ALIGN_CENTER_HORIZONTAL | wx.ST_NO_AUTORESIZE) + text1.SetFont(font1) + + text2 = wx.StaticText(self, -1, "Gitso is to Support Others") + text3 = wx.StaticText(self, -1, "Version 0.6") font2 = wx.Font(16, wx.NORMAL, wx.NORMAL, wx.NORMAL) - self.text2.SetFont(font2) - self.text3.SetFont(font2) + font3 = wx.Font(12, wx.NORMAL, wx.NORMAL, wx.NORMAL) + text2.SetFont(font2) + text3.SetFont(font3) + url = wx.HyperlinkCtrl(self, -1, "code.google.com/p/gitso", "http://code.google.com/p/gitso") - self.text4 = wx.StaticText(self, -1, "Copyright 2008", pos=wx.Point(0, 102), size=wx.Size(525, 27), style=wx.ALIGN_CENTER_HORIZONTAL | wx.ST_NO_AUTORESIZE) - self.text5 = wx.StaticText(self, -1, "Aaron Gerber and Derek Buranen", pos=wx.Point(0, 125), size=wx.Size(525, 27), style=wx.ALIGN_CENTER_HORIZONTAL | wx.ST_NO_AUTORESIZE) - font4 = wx.Font(14, wx.NORMAL, wx.NORMAL, wx.NORMAL) - self.text4.SetFont(font4) - self.text5.SetFont(font4) + data = open(os.path.join(paths['main'], 'icon.png'), "rb").read() + stream = cStringIO.StringIO(data) + img = wx.ImageFromStream(stream) + img.Rescale(150, 150) + bmp = wx.BitmapFromImage(img) + image1 = wx.StaticBitmap(self, -1, bmp) - self.url = wx.HyperlinkCtrl(self, -1, "code.google.com/p/gitso", "http://code.google.com/p/gitso", wx.Point(189, 150)) - - self.ok = wx.Button(self, wx.ID_OK, "OK", wx.Point(425, 350)) - self.SetDefaultItem(self.ok) - self.ok.SetFocus() + ## Buttons ## + ok = wx.Button(self, wx.ID_OK, "OK") + self.SetDefaultItem(ok) + ok.SetFocus() wx.EVT_BUTTON(self, wx.ID_OK, self.CloseAbout) + ## Sizers ## + topsizer = wx.BoxSizer(wx.VERTICAL); + + info_sizer = wx.BoxSizer(wx.VERTICAL); + info_sizer.Add(text1, 0, wx.ALIGN_CENTER | wx.ALL, 7); + info_sizer.Add(text2, 0, wx.ALIGN_CENTER | wx.ALL, 3); + info_sizer.Add(text3, 0, wx.ALIGN_CENTER | wx.ALL, 3); + info_sizer.Add(url, 0, wx.ALIGN_CENTER | wx.ALL, 3); + + heading_sizer = wx.BoxSizer(wx.HORIZONTAL); + heading_sizer.Add(image1, 0, wx.ALIGN_LEFT | wx.ALL, 10 ); + heading_sizer.Add(info_sizer, 0, wx.ALL, 10 ); + + topsizer.Add(heading_sizer, 0, wx.ALIGN_CENTER); + + ## Tabs ## + nb = wx.Notebook(self, size=wx.Size(525,220)) + + license_page = LicensePage(nb, paths) + info_page = InfoPage(nb) + + nb.AddPage(info_page, "Authors") + nb.AddPage(license_page, "License") + + tab_sizer = wx.BoxSizer(wx.HORIZONTAL); + tab_sizer.Add(nb, 1, wx.EXPAND | wx.ALL, 10 ); + topsizer.Add(tab_sizer, 1, wx.ALIGN_RIGHT ); + + ## Buttons ## + button_sizer = wx.BoxSizer(wx.HORIZONTAL); + button_sizer.Add(ok, 0, wx.ALL, 10 ); + topsizer.Add(button_sizer, 0, wx.ALIGN_RIGHT ); + + ## Final settings ## + self.SetSizer(topsizer); + topsizer.SetSizeHints(self); + self.SetThemeEnabled(True) self.Centre() self.Show() + def CloseAbout(self, event): self.Close() diff --git a/gitso/trunk/ArgsParser.py b/gitso/trunk/ArgsParser.py index 0800fd4..4989ba4 100644 --- a/gitso/trunk/ArgsParser.py +++ b/gitso/trunk/ArgsParser.py @@ -10,7 +10,8 @@ Gitso is a utility to facilitate the connection of VNC @copyright: 2007-2008 """ -import os, sys, signal, os.path +import os, sys, signal, os.path, urllib + class ArgsParser: def __init__(self): # Initialize Self.paths here. @@ -21,6 +22,8 @@ class ArgsParser: self.paths['main'] = '' self.paths['listen'] = False self.paths['connect'] = '' + self.paths['list'] = [] + if sys.platform.find('linux') != -1: self.paths['main'] = os.path.join(sys.path[0], '..', 'share', 'gitso') @@ -50,14 +53,30 @@ class ArgsParser: elif sys.argv[i] == '--connect': # --connect i = i + 1 - if i >= len(sys.argv) or self.paths['listen']: + if i >= len(sys.argv): + print "Error: No IP or domain name given." + self.HelpMenu() + + if self.paths['listen']: print "Error: --connect and --listen can not be used at the same time." self.HelpMenu() if sys.argv[i][0] + sys.argv[i][1] <> "--": self.paths['connect'] = sys.argv[i] else: - print "Error: '" + sys.argv[i] + "' is host with '--connect'." + print "Error: '" + sys.argv[i] + "' is not a valid host with '--connect'." + self.HelpMenu() + + elif sys.argv[i] == '--list': # --list + i = i + 1 + if i >= len(sys.argv): + print "Error: No List file given." + self.HelpMenu() + + if sys.argv[i][0] + sys.argv[i][1] <> "--": + self.paths['list'] = self.getHosts(sys.argv[i]) + else: + print "Error: '" + sys.argv[i] + "' is not a valid list with '--list'." self.HelpMenu() else: @@ -83,9 +102,42 @@ class ArgsParser: print " --dev\t\tSet self.paths for development." print " --listen\t\tlisten for incoming connections." print " --connect {IP|DN}\tConnects to host (support giver)." - print " --list {URL|LIST}\tAlternative Support list." + print " --list {URL|FILE}\tAlternative Support list." print " --help\t\tThis Menu." exit(0) def GetPaths(self): return self.paths + + def getHosts(self, file): + list = [] + fileList = "" + + if len(file) > 3: + prefix = file[0] + file[1] + file[2] + file[3] + else: + prefix = "" + + if prefix == "www." or prefix == "http": + handle = urllib.urlopen(file) + fileList = handle.read() + handle.close() + else: + if os.path.exists(file): + handle = open(file, 'r') + fileList = handle.read() + handle.close() + + parsedlist = fileList.split(",") + for i in range(0, len(parsedlist)): + if self.validHost(parsedlist[i].strip()): + list.append(parsedlist[i].strip()) + + return list + + def validHost(self, host): + if host != "" and host.find(";") == -1 and host.find("/") == -1 and host.find("'") == -1 and host.find("`") == -1 and len(host) > 6: + return True + else: + return False + diff --git a/gitso/trunk/ConnectionWindow.py b/gitso/trunk/ConnectionWindow.py index ae22a9f..e7dd4e1 100644 --- a/gitso/trunk/ConnectionWindow.py +++ b/gitso/trunk/ConnectionWindow.py @@ -61,7 +61,7 @@ class ConnectionWindow(wx.Frame): # the combobox Control - self.sampleList = [] + self.sampleList = self.paths['list'] self.sampleList = self.getHosts(self.sampleList, os.path.join(self.paths['main'], 'hosts.txt')) self.sampleList = self.getHosts(self.sampleList, self.paths['preferences']) @@ -122,7 +122,6 @@ class ConnectionWindow(wx.Frame): self.hostField.Value = self.paths['connect'] self.ConnectSupport(None) - def RadioToggle(self, event): """ Toggles Radio Buttons @@ -303,7 +302,7 @@ class ConnectionWindow(wx.Frame): self.thread.setHost(host) self.thread.start() - # If you don't wait 2 seconds, the interface won't reload and it'll freeze. + # 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) diff --git a/gitso/trunk/arch/linux/README-stand-alone.txt b/gitso/trunk/arch/linux/README-stand-alone.txt new file mode 100644 index 0000000..f175dd0 --- /dev/null +++ b/gitso/trunk/arch/linux/README-stand-alone.txt @@ -0,0 +1,41 @@ +Gitso is to support others. + +We created Gitso as a frontend to reverse VNC connections. It is meant +to be a simple two-step process that connects one person to another's +screen. First, the support person offers to give support. Second, the +person who needs help connects and has their screen remotely visible. +Because Gitso is cross-platform (Ubuntu, OS X and Windows) and uses a +reverse VNC connection, it greatly simplifies the process of getting support. + + +Gitso 0.5: "Kill the Undead". (September 5, 2008) + + * Complete rewrite of the interface to wxWidgets (from GTK). + * Gitso no longer has Zombied VNC processes after it quits. + * Gitso stops the VNC process when it closes (OS X & Linux) + * Updated Icon + * Updated License: GPL 3 + * Added Support to specify a list of hosts when you distribute it. + * Added History/Clear History of servers + * Added OS X 10.5 Support (needs testing on 10.4 and 10.3) + o OS X uses TightVNC 1.3.9 (Source) + o OS X uses OSXvnc 3.0 (Source) + * Added Windows XP Support + o Windows uses TightVNC 1.3.9 (Source) + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +Gitso Distro-independent Code. + +Note: If you run Ubuntu, it'd be easier to use gitso_0.5_all.deb. However, +if you aren't running Ubuntu proceed. + +Requirements: + x11vnc + vncviewer + wxPython + +Usage: ./run-gitso.sh [options] + Options: + --have-wxpython: Disable wxPython library check + + diff --git a/gitso/trunk/arch/linux/gitso.1 b/gitso/trunk/arch/linux/gitso.1 index 1ad1dfd..ce144bd 100644 --- a/gitso/trunk/arch/linux/gitso.1 +++ b/gitso/trunk/arch/linux/gitso.1 @@ -34,7 +34,7 @@ which is an IP or domain name (address of support giver). .B --list Alternative support list, where .I list -is either a URL of a remote file list or a comma seperated list +is either a URL of a remote file or path to local file. .TP .B --help Display the help menu. diff --git a/gitso/trunk/arch/linux/run-gitso.sh b/gitso/trunk/arch/linux/run-gitso.sh new file mode 100755 index 0000000..bd08ab7 --- /dev/null +++ b/gitso/trunk/arch/linux/run-gitso.sh @@ -0,0 +1,36 @@ +#! /bin/bash + +if test "$1" == "-h" -o "$1" == "--help"; then + echo -e "Usage: ./run-gitso.sh [options]" + echo -e "\tOptions:" + echo -e "\t--have-wxpython:\tDisable wxPython library check" + exit 0 +fi + + +## Checking for x11vnc +if test ! "`which x11vnc`"; then + echo -e "Error - x11vnc was not found on your system.\n" + exit 1 +fi + +## Checking for wxpython +if test "$1" != "--have-wxpython"; then + if test ! "`locate wxPython/lib`"; then + echo -e "\nError - wxPython was not found on your system." + echo -e "\nIf you know you have wxPython installed, use '--have-wxpython'.\n\tExample: ./run-gitso --have-wxpython\n" + exit 1 + fi +else + echo -e "\nBypassing wxpython check..." +fi + +## Checking for vncviewer +if test ! "`which vncviewer`"; then + echo -e "\nError - vncviewer was not found on your system.\n" + exit 1 +fi + + +echo -e "Starting Gitso..." +bin/gitso diff --git a/gitso/trunk/makegitso.sh b/gitso/trunk/makegitso.sh index 8182593..e36e54a 100755 --- a/gitso/trunk/makegitso.sh +++ b/gitso/trunk/makegitso.sh @@ -55,10 +55,13 @@ if test `uname -a | grep Darwin`; then elif test "`uname -a 2>&1 | grep Linux | grep -v which`"; then DEB="gitso_0.6_all.deb" + TARGZ="gitso_0.6_all.tar.gz" BUILDPATH="gitso" + TARGZPATH="Gitso" echo -n "Creating $DEB" rm -rf $BUILDPATH + # Deb version of Gitso. mkdir -p $BUILDPATH/DEBIAN mkdir -p $BUILDPATH/usr/bin mkdir -p $BUILDPATH/usr/share/applications @@ -79,6 +82,7 @@ elif test "`uname -a 2>&1 | grep Linux | grep -v which`"; then cp __init__.py $BUILDPATH/usr/share/$BUILDPATH/ cp hosts.txt $BUILDPATH/usr/share/$BUILDPATH/ cp icon.ico $BUILDPATH/usr/share/$BUILDPATH/ + cp icon.png $BUILDPATH/usr/share/$BUILDPATH/ echo -n ".." cp arch/linux/gitso.desktop $BUILDPATH/usr/share/applications/ @@ -89,10 +93,32 @@ elif test "`uname -a 2>&1 | grep Linux | grep -v which`"; then echo -n ".." dpkg -b $BUILDPATH/ $DEB 2>&1 > /dev/null + + echo -e " [done]" + + # Standalone version of Gitso. + echo -n "Creating $TARGZ" + rm -rf $TARGZPATH + + cp -r $BUILDPATH $TARGZPATH + rm -rf $TARGZPATH/DEBIAN + + echo -n ".." + cp arch/linux/README-stand-alone.txt $TARGZPATH/README + cp arch/linux/run-gitso.sh $TARGZPATH/ + mv $TARGZPATH/usr/bin $TARGZPATH/bin + mv $TARGZPATH/usr/share $TARGZPATH/share + rm -rf $TARGZPATH/usr/ + + echo -n "." + tar -cvzf $TARGZ $TARGZPATH 2>&1 > /dev/null + + echo -e " [done]\n" if [ "$CLEAN" = "yes" ]; then rm -rf $BUILDPATH + rm -rf $TARGZPATH + find . -name "*.pyc" -exec rm {} ';' fi - echo -e " [done]\n" fi