1#!/usr/bin/env python
2# http://pyrocko.org - GPLv3
3#
4# The Pyrocko Developers, 21st Century
5# ---|P------/S----------~Lg----------
7# Moment tensor calculator
8#
9# Copyright (c) 2010, Sebastian Heimann <sebastian.heimann@zmaw.de>
10#
11# This file is part of pyrocko. For licensing information please see the file
12# COPYING which is included with pyrocko.
14import sys
15import signal
17from pyrocko import moment_tensor_viewer as mtv
19from PyQt4 import QtCore, QtGui
22class Momo(QtGui.QApplication):
24 def __init__(self, *args):
25 QtGui.QApplication.__init__(self, *args)
27 viewer = mtv.BeachballView()
28 editor = mtv.MomentTensorEditor()
30 self.win = QtGui.QMainWindow()
31 self.win.setWindowTitle('Momo - Moment Tensor Calculator')
32 self.win.setCentralWidget(viewer)
34 dockwin = QtGui.QDockWidget('Moment Tensor')
35 dockwin.setWidget(editor)
36 self.win.addDockWidget(QtCore.Qt.BottomDockWidgetArea, dockwin)
37 self.connect(editor,
38 QtCore.SIGNAL("moment_tensor_changed(PyQt_PyObject)"),
39 viewer.set_moment_tensor)
40 self.win.show()
42 sb = self.win.statusBar()
43 sb.clearMessage()
44 sb.showMessage('Welcome to Momo!')
46 self.connect(self, QtCore.SIGNAL("lastWindowClosed()"), self.myquit)
47 signal.signal(signal.SIGINT, self.myquit)
49 def myquit(self, *args):
50 self.quit()
53def main(args):
54 app = Momo(args)
55 app.exec_()
57 sys.exit()
60if __name__ == "__main__":
61 main(sys.argv)