From 60dd2ed06e4d2cfdf7d6cb87d64bca437c5b5557 Mon Sep 17 00:00:00 2001 From: cultpenguin Date: Mon, 10 Oct 2005 07:35:42 +0000 Subject: [PATCH] *** empty log message *** --- GUI/demogtk.py | 102 ++++++++++++++++++++ GUI/gui.py | 9 +- GUI/project1.glade | 192 ++++++++++++++++++++++++++++++++++++++ GUI/segygui/segygui.glade | 175 ++++++++++------------------------ 4 files changed, 348 insertions(+), 130 deletions(-) create mode 100755 GUI/demogtk.py create mode 100644 GUI/project1.glade diff --git a/GUI/demogtk.py b/GUI/demogtk.py new file mode 100755 index 0000000..6e384d9 --- /dev/null +++ b/GUI/demogtk.py @@ -0,0 +1,102 @@ +#!/usr/bin/env python +#Licence: GPLv2.0 +#Copyright: Dave Aitel + +import sys + +try: + import pygtk + #tell pyGTK, if possible, that we want GTKv2 + pygtk.require("2.0") +except: + print "You need to install pyGTK or GTKv2 or set your PYTHONPATH correctly" + print "try: export PYTHONPATH=/usr/local/lib/python2.2/site-packages/" + sys.exit(1) + +import gtk +import gtk.glade +import segypy + +#now we have both gtk and gtk.glade imported +#Also, we know we are running GTKv2 + +def insert_row(model,parent,firstcolumn,secondcolumn): + myiter=model.insert_after(parent,None) + model.set_value(myiter,0,firstcolumn) + model.set_value(myiter,1,secondcolumn) + return myiter + +class appgui: + def __init__(self): + """ + In this init we are going to display the main serverinfo window + """ + gladefile="project1.glade" + windowname="serverinfo" + self.wTree=gtk.glade.XML (gladefile,windowname) + #we only have one callback to register, but you could register + #any number, or use a special class that + #automatically registers all callbacks + dic = { "on_button1_clicked" : self.button1_clicked, + "on_serverinfo_destroy" : (gtk.mainquit)} + self.wTree.signal_autoconnect (dic) + + self.logwindowview=self.wTree.get_widget("textview1") + self.logwindow=gtk.TextBuffer(None) + self.logwindowview.set_buffer(self.logwindow) + + import gobject + self.treeview=self.wTree.get_widget("treeview1") + self.treemodel=gtk.TreeStore(gobject.TYPE_STRING, + gobject.TYPE_STRING) + self.treeview.set_model(self.treemodel) + + self.treeview.set_headers_visible(True) + renderer=gtk.CellRendererText() + column=gtk.TreeViewColumn("Name",renderer, text=0) + column.set_resizable(True) + self.treeview.append_column(column) + renderer=gtk.CellRendererText() + + column=gtk.TreeViewColumn("Description",renderer, text=1) + column.set_resizable(True) + self.treeview.append_column(column) + self.treeview.show() + + model=self.treemodel + treeSTH=insert_row(model,None,'Segy Trace Header', '') + for key in segypy.STH_def.keys(): + insert_row(model,treeSTH,key, 'An Empty Row') + treeSH=insert_row(model,None,'Segy Header', 'SH') + for key in segypy.SH_def.keys(): + insert_row(model,treeSH,key, 'An Empty Row') + + + + return + + + #####CALLLBACKS + def button1_clicked(self,widget): + print "button clicked" + host=self.wTree.get_widget("entry1").get_text() + port=int(self.wTree.get_widget("spinbutton1").get_value()) + if host=="": + return + import urllib + page=urllib.urlopen("http://"+host+":"+str(port)+"/") + data=page.read() + try: + #this changed in a revision of pyGTK2 + self.logwindow.insert_at_cursor(data,len(data)) + except: + self.logwindow.insert_at_cursor(data) + #print data + return + + +app=appgui() +gtk.main() + + + diff --git a/GUI/gui.py b/GUI/gui.py index c9e7852..807fc40 100644 --- a/GUI/gui.py +++ b/GUI/gui.py @@ -55,7 +55,7 @@ class SimpleTest: self.canvas.show() # self.graphview = self.wTree.get_widget("vbox1") # self.graphview.pack_start(self.canvas, True, True) - self.graphview = self.xml.get_widget("vbox2") + self.graphview = self.xml.get_widget("vbox3") self.graphview.pack_start(self.canvas, True, True) print 'PLOTTED' @@ -100,10 +100,11 @@ class SimpleTest: self.axis.imshow(self.segy[0]) self.canvas = FigureCanvasGTK(self.figure) # a gtk.DrawingArea self.canvas.show() -# self.graphview = self.wTree.get_widget("vbox1") -# self.graphview.pack_start(self.canvas, True, True) - self.graphview = self.xml.get_widget("hbox2") + self.graphview = self.xml.get_widget_widget("vbox1") + print self.graphview self.graphview.pack_start(self.canvas, True, True) +# self.graphview = self.xml.get_widget("hbox2") +# self.graphview.pack_start(self.canvas, True, True) print 'PLOTTED' diff --git a/GUI/project1.glade b/GUI/project1.glade new file mode 100644 index 0000000..97f8fcf --- /dev/null +++ b/GUI/project1.glade @@ -0,0 +1,192 @@ + + + + + + + True + Server Info + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_NORMAL + GDK_GRAVITY_NORTH_WEST + True + + + + + True + False + 0 + + + + True + False + 8 + + + + True + Host: + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + True + True + True + 0 + + True + * + False + + + 0 + True + True + + + + + 0 + True + True + + + + + + True + True + 1 + 0 + False + GTK_UPDATE_ALWAYS + False + False + 80 1 65535 1 10 10 + + + 0 + False + False + + + + + + True + True + GO! + True + GTK_RELIEF_NORMAL + True + + + + 0 + False + False + + + + + + True + True + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + True + GTK_JUSTIFY_LEFT + GTK_WRAP_NONE + True + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + 0 + True + False + + + + + + True + True + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + 130 + 226 + True + True + True + False + False + True + False + False + False + + + + + 0 + True + True + + + + + + + diff --git a/GUI/segygui/segygui.glade b/GUI/segygui/segygui.glade index 6f84e96..544341e 100644 --- a/GUI/segygui/segygui.glade +++ b/GUI/segygui/segygui.glade @@ -5,12 +5,13 @@ True - window1 + Segy Viewer GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE + GTK_WIN_POS_CENTER False True False + stock_chart-reorganize True False False @@ -38,7 +39,7 @@ True - + @@ -102,7 +103,25 @@ True - + + + + + True + Segy Header + True + + + + + + + True + Trace Header + True + + + @@ -149,11 +168,6 @@ True _View True - - - - - @@ -164,7 +178,7 @@ True - + @@ -187,136 +201,29 @@ - + True False 0 - + True True - True - True - GTK_POS_TOP - False - False - - - - - - - - True - Plot - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - - True - True - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - False - True - False - False - False - - - - - False - True - - - - - - True - Segy Header - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - - - - - - True - Trace Header - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - + button1 + True + GTK_RELIEF_NORMAL + True 0 - True - True + False + False - + True False 0 @@ -339,6 +246,10 @@ True + + + + 0 @@ -346,6 +257,18 @@ True + + + + True + True + + + 0 + False + False + +