mirror of
https://github.com/wassname/segpy.git
synced 2026-07-11 06:06:30 +08:00
*** empty log message ***
This commit is contained in:
+55
@@ -19,6 +19,15 @@
|
||||
import pygtk
|
||||
pygtk.require('2.0')
|
||||
|
||||
|
||||
import matplotlib
|
||||
matplotlib.use('GTK')
|
||||
from matplotlib.figure import Figure
|
||||
from matplotlib.axes import Subplot
|
||||
from matplotlib.backends.backend_gtk import FigureCanvasGTK, NavigationToolbar
|
||||
from matplotlib.numerix import arange, sin, pi
|
||||
|
||||
|
||||
import gtk, gtk.glade
|
||||
|
||||
import segypy
|
||||
@@ -34,5 +43,51 @@ class SimpleTest:
|
||||
self.segy = segypy.readSegy('../data_4byteINT.segy')
|
||||
print 'foo2'
|
||||
|
||||
def on_open1_activate(self, button):
|
||||
dialog = gtk.FileChooserDialog("Open..",
|
||||
None,
|
||||
gtk.FILE_CHOOSER_ACTION_OPEN,
|
||||
(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
|
||||
gtk.STOCK_OPEN, gtk.RESPONSE_OK))
|
||||
dialog.set_default_response(gtk.RESPONSE_OK)
|
||||
|
||||
filter = gtk.FileFilter()
|
||||
filter.set_name("All files")
|
||||
filter.add_pattern("*")
|
||||
|
||||
dialog.add_filter(filter)
|
||||
filter = gtk.FileFilter()
|
||||
filter.set_name("SEG-Y files")
|
||||
filter.add_pattern("*.segy")
|
||||
filter.add_pattern("*.sgy")
|
||||
filter.add_pattern("*.seg-y")
|
||||
dialog.add_filter(filter)
|
||||
filter = gtk.FileFilter()
|
||||
filter.set_name("SU files")
|
||||
filter.add_pattern("*.su")
|
||||
dialog.add_filter(filter)
|
||||
response = dialog.run()
|
||||
if response == gtk.RESPONSE_OK:
|
||||
print dialog.get_filename(), 'selected'
|
||||
filename = dialog.get_filename()
|
||||
dialog.destroy()
|
||||
self.segy = segypy.readSegy(filename)
|
||||
|
||||
self.figure = Figure(figsize=(6,4), dpi=72)
|
||||
self.axis = self.figure.add_subplot(111)
|
||||
self.axis.set_xlabel('Yepper')
|
||||
self.axis.set_ylabel('Flabber')
|
||||
self.axis.set_title('An Empty Graph')
|
||||
self.axis.grid(True)
|
||||
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)
|
||||
|
||||
|
||||
elif response == gtk.RESPONSE_CANCEL:
|
||||
print 'Closed, no files selected'
|
||||
dialog.destroy()
|
||||
|
||||
test = SimpleTest()
|
||||
gtk.main()
|
||||
|
||||
+3
-10
@@ -4,8 +4,6 @@
|
||||
<glade-interface>
|
||||
|
||||
<widget class="GtkWindow" id="window1">
|
||||
<property name="width_request">800</property>
|
||||
<property name="height_request">600</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">SegyPY GUI</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
@@ -43,7 +41,7 @@
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenu" id="menu1">
|
||||
<widget class="GtkMenu" id="menuitem1_menu">
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="new1">
|
||||
@@ -107,7 +105,7 @@
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenu" id="menu2">
|
||||
<widget class="GtkMenu" id="menuitem2_menu">
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="cut1">
|
||||
@@ -154,11 +152,6 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_View</property>
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenu" id="menu3">
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
@@ -169,7 +162,7 @@
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenu" id="menu4">
|
||||
<widget class="GtkMenu" id="menuitem4_menu">
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="about1">
|
||||
|
||||
+16
-10
@@ -4,8 +4,6 @@
|
||||
<glade-interface>
|
||||
|
||||
<widget class="GtkWindow" id="window1">
|
||||
<property name="width_request">800</property>
|
||||
<property name="height_request">600</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">SegyPY GUI</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
@@ -43,7 +41,7 @@
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenu" id="menu1">
|
||||
<widget class="GtkMenu" id="menuitem1_menu">
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="new1">
|
||||
@@ -107,7 +105,7 @@
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenu" id="menu2">
|
||||
<widget class="GtkMenu" id="menuitem2_menu">
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="cut1">
|
||||
@@ -154,11 +152,6 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_View</property>
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenu" id="menu3">
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
@@ -169,7 +162,7 @@
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenu" id="menu4">
|
||||
<widget class="GtkMenu" id="menuitem4_menu">
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="about1">
|
||||
@@ -223,6 +216,19 @@
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkDrawingArea" id="drawingarea1">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_options">fill</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
Reference in New Issue
Block a user