1#!/usr/bin/env python 

2# http://pyrocko.org - GPLv3 

3# 

4# The Pyrocko Developers, 21st Century 

5# ---|P------/S----------~Lg---------- 

6 

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. 

13 

14import sys 

15import signal 

16 

17from pyrocko import moment_tensor_viewer as mtv 

18 

19from PyQt4 import QtCore, QtGui 

20 

21 

22class Momo(QtGui.QApplication): 

23 

24 def __init__(self, *args): 

25 QtGui.QApplication.__init__(self, *args) 

26 

27 viewer = mtv.BeachballView() 

28 editor = mtv.MomentTensorEditor() 

29 

30 self.win = QtGui.QMainWindow() 

31 self.win.setWindowTitle('Momo - Moment Tensor Calculator') 

32 self.win.setCentralWidget(viewer) 

33 

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() 

41 

42 sb = self.win.statusBar() 

43 sb.clearMessage() 

44 sb.showMessage('Welcome to Momo!') 

45 

46 self.connect(self, QtCore.SIGNAL("lastWindowClosed()"), self.myquit) 

47 signal.signal(signal.SIGINT, self.myquit) 

48 

49 def myquit(self, *args): 

50 self.quit() 

51 

52 

53def main(args): 

54 app = Momo(args) 

55 app.exec_() 

56 

57 sys.exit() 

58 

59 

60if __name__ == "__main__": 

61 main(sys.argv)