-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
341 changed files
with
8,399 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,178 @@ | ||
#26.9.2013 modified about text (foo.li), hyperlinks | ||
|
||
import wx | ||
import os, os.path, sys, cStringIO | ||
|
||
|
||
""" | ||
Gisto - Gitso is to support others | ||
Gitso is a utility to facilitate the connection of VNC | ||
@author: Aaron Gerber ('gerberad') <[email protected]> | ||
@author: Derek Buranen ('burner') <[email protected]> | ||
@copyright: 2008 - 2010 | ||
Gitso is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Gitso is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with Gitso. If not, see <http://www.gnu.org/licenses/>. | ||
""" | ||
|
||
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" + "\n\tTroy Frew" + "\n\tDennis Koot" | ||
infostring = infostring + "\n\nmodified by:" + "\n\tPeter Beck, foo.li systeme + software" | ||
|
||
infostring = infostring + "\n\nCopyright (C) 2007 - 2010 by Aaron Gerber and Derek Buranen" | ||
if sys.platform == "darwin": | ||
infostring = infostring + "\n\n+++++++++++++++++++++++" | ||
infostring = infostring + "\nChicken Of The VNC:" | ||
infostring = infostring + "\n\tCopyright (C) 2002-2006 by Jason Harris" | ||
infostring = infostring + "\n\tCopyright (C) 1998-2000 by Helmut Maierhofer" | ||
|
||
infostring = infostring + "\n\nlibJPEG: Independent JPEG Group's JPEG software" | ||
infostring = infostring + "\n\tCopyright (C) 1991-1998, Thomas G. Lane." | ||
|
||
infostring = infostring + "\n\nOSXvnc:" | ||
infostring = infostring + "\n\tCopyright (C) 2002-2007 by Redstone Software: " | ||
infostring = infostring + "\n\t\tDoug Simons and Jonathan Gillaspie" | ||
|
||
infostring = infostring + "\n\nechoWare:" | ||
infostring = infostring + "\n\tCopyright (C) 2004-2007 Echogent Systems, Inc" | ||
elif sys.platform == "win32": | ||
infostring = infostring + "\n\n+++++++++++++++++++++++" | ||
infostring = infostring + "\nTightVNC && VNCviewer:" | ||
infostring = infostring + "\n\tCopyright (C) 1999 AT&T Laboratories Cambridge." | ||
|
||
infostring = infostring + "\n\nVNCHooks:" | ||
infostring = infostring + "\n\tCopyright (C) 2000-2007 TightVNC Group" | ||
|
||
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): | ||
def __init__(self, parent, id, title, paths): | ||
""" | ||
Setup About Window for Gitso | ||
@author: Derek Buranen | ||
@author: Aaron Gerber | ||
""" | ||
wx.Frame.__init__(self, parent, wx.ID_ANY, title, size=(525,400), style=wx.CLOSE_BOX | wx.MINIMIZE_BOX) | ||
|
||
if sys.platform == 'win32': | ||
self.SetBackgroundColour(wx.Colour(236,233,216)) | ||
|
||
icon = wx.Icon(os.path.join(paths['main'], 'icon.ico'), wx.BITMAP_TYPE_ICO) | ||
self.SetIcon(icon) | ||
|
||
## Headings ## | ||
text1 = wx.StaticText(self, wx.ID_ANY, 'foo.li support') | ||
font1 = wx.Font(24, wx.NORMAL, wx.NORMAL, wx.BOLD) | ||
text1.SetFont(font1) | ||
|
||
text2 = wx.StaticText(self, -1, "foo.li remote support (gitso)") | ||
text3 = wx.StaticText(self, -1, "Version 0.6") | ||
font2 = wx.Font(16, wx.NORMAL, wx.NORMAL, wx.NORMAL) | ||
font3 = wx.Font(12, wx.NORMAL, wx.NORMAL, wx.NORMAL) | ||
text2.SetFont(font2) | ||
text3.SetFont(font3) | ||
url = wx.HyperlinkCtrl(self, -1, "foo.li systeme + software", "http://www.foo.li") | ||
url2 = wx.HyperlinkCtrl(self, -1, "foo.li ticket system website", "http://support.foo.li") | ||
url3 = wx.HyperlinkCtrl(self, -1, "foo.li ticket system email", "mailto:[email protected]") | ||
url4 = wx.HyperlinkCtrl(self, -1, "source code", "http://code.google.com/p/gitso") | ||
|
||
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) | ||
|
||
## 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, 1); | ||
info_sizer.Add(url2, 0, wx.ALIGN_CENTER | wx.ALL, 1); | ||
info_sizer.Add(url3, 0, wx.ALIGN_CENTER | wx.ALL, 1); | ||
info_sizer.Add(url4, 0, wx.ALIGN_CENTER | wx.ALL, 1); | ||
|
||
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() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
#! /usr/bin/env python | ||
|
||
""" | ||
Gisto - Gitso is to support others | ||
Gitso is a utility to facilitate the connection of VNC | ||
@author: Aaron Gerber ('gerberad') <[email protected]> | ||
@author: Derek Buranen ('burner') <[email protected]> | ||
@copyright: 2008 - 2010 | ||
Gitso is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Gitso is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with Gitso. If not, see <http://www.gnu.org/licenses/>. | ||
""" | ||
|
||
import os | ||
import sys | ||
import signal | ||
import os.path | ||
import urllib | ||
import re | ||
|
||
class ArgsParser: | ||
def __init__(self): | ||
# Initialize Self.paths here. | ||
self.paths = dict() | ||
self.paths['resources'] = os.path.join(sys.path[0], "./") | ||
self.paths['preferences'] = '' | ||
self.paths['copyright'] = '' | ||
self.paths['main'] = '' | ||
self.paths['listen'] = False | ||
self.paths['connect'] = '' | ||
self.paths['list'] = [] | ||
self.paths['mode'] = '' | ||
self.paths['low-colors'] = False | ||
|
||
if re.match('(?:open|free|net)bsd|linux',sys.platform): | ||
self.paths['main'] = os.path.join(sys.path[0], '..', 'share', 'gitso') | ||
self.paths['copyright'] = os.path.join(sys.path[0], '..', 'share', 'doc', 'gitso', 'COPYING') | ||
elif sys.platform == "darwin": | ||
self.paths['main'] = sys.path[0] | ||
self.paths['copyright'] = os.path.join(sys.path[0], 'COPYING') | ||
else: | ||
self.paths['main'] = os.path.join(sys.path[0], '..') | ||
self.paths['copyright'] = os.path.join(sys.path[0], '..', 'COPYING') | ||
|
||
#for i in range(1, len(sys.argv)): | ||
i = 1 | ||
while i < len(sys.argv): | ||
if sys.argv[i] == '--help': # --help | ||
self.HelpMenu() | ||
elif sys.argv[i] == '--version': # --version | ||
print "Gitso 0.6 -- Copyright 2007 - 2010 Aaron Gerber and Derek Buranen." | ||
exit(0) | ||
elif 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") | ||
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/' | ||
self.paths['main'] = sys.path[0] | ||
self.paths['copyright'] = os.path.join(sys.path[0], 'COPYING') | ||
|
||
elif sys.platform == "win32": | ||
self.paths['copyright'] = os.path.join(sys.path[0], 'COPYING') | ||
self.paths['main'] = os.path.join(sys.path[0]) | ||
self.paths['resources'] = 'arch/win32/' | ||
|
||
else: | ||
self.paths['resources'] = 'arch/linux/' | ||
self.paths['main'] = os.path.join(sys.path[0]) | ||
self.paths['copyright'] = os.path.join(sys.path[0], 'COPYING') | ||
|
||
elif sys.argv[i] == '--listen': # --listen | ||
if self.paths['connect'] <> "": | ||
print "Error: --connect and --listen can not be used at the same time." | ||
self.HelpMenu() | ||
self.paths['listen'] = True | ||
|
||
elif sys.argv[i] == '--connect': # --connect | ||
i = i + 1 | ||
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 not a valid host with '--connect'." | ||
self.HelpMenu() | ||
|
||
elif sys.argv[i] == '--low-colors': # --low-colors | ||
self.paths['low-colors'] = True; | ||
|
||
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: | ||
print "Error: '" + sys.argv[i] + "' is not a valid argument." | ||
self.HelpMenu() | ||
|
||
i = i + 1 | ||
|
||
if sys.platform == "darwin": | ||
self.paths['preferences'] = os.path.join(os.path.expanduser("~"), "Library", "Application Support", "Gitso") | ||
if os.path.exists(self.paths['preferences']) != True: | ||
os.makedirs(self.paths['preferences'], 0700) | ||
self.paths['preferences'] = os.path.join(self.paths['preferences'], "hosts") | ||
elif sys.platform == "win32": | ||
self.paths['preferences'] = os.path.join(os.getenv('USERPROFILE'), "gitso-hosts") | ||
else: | ||
self.paths['preferences'] = os.path.join(os.path.expanduser("~"), ".gitso-hosts") | ||
|
||
#Help Menu | ||
def HelpMenu(self): | ||
print "Usage: " + os.path.basename(sys.argv[0]) + " [OPTION]" | ||
print " OPTIONS" | ||
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|FILE}\tAlternative Support list." | ||
print " --low-colors\t\tUse 8bit colors (for slow connections). Linux only." | ||
print " --version\t\tThe current Gitso version." | ||
print " --help\t\tThis Menu." | ||
exit(1) | ||
|
||
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 | ||
|
Oops, something went wrong.