| 1 | """ |
|---|
| 2 | window.py |
|---|
| 3 | |
|---|
| 4 | Open Coin prototype GUI |
|---|
| 5 | |
|---|
| 6 | Copyright (C) 2007 Andrew Nicholson <andy@infiniterecursion.com.au> |
|---|
| 7 | |
|---|
| 8 | This program is free software; you can redistribute it and/or modify |
|---|
| 9 | it under the terms of the GNU General Public License as published by |
|---|
| 10 | the Free Software Foundation; either version 2 of the License, or |
|---|
| 11 | (at your option) any later version. |
|---|
| 12 | |
|---|
| 13 | This program is distributed in the hope that it will be useful, |
|---|
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 16 | GNU General Public License for more details. |
|---|
| 17 | |
|---|
| 18 | You should have received a copy of the GNU General Public License |
|---|
| 19 | along with this program; if not, write to the Free Software |
|---|
| 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|---|
| 21 | """ |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | import sys |
|---|
| 25 | from PyQt4.QtCore import * |
|---|
| 26 | from PyQt4.QtGui import * |
|---|
| 27 | |
|---|
| 28 | from opencoin_ui import Ui_openCoin_MainWindow |
|---|
| 29 | |
|---|
| 30 | from constants import __version__ |
|---|
| 31 | |
|---|
| 32 | class Window(QMainWindow): |
|---|
| 33 | |
|---|
| 34 | def __init__(self, parent=None): |
|---|
| 35 | QWidget.__init__(self, parent) |
|---|
| 36 | self.ui = Ui_openCoin_MainWindow() |
|---|
| 37 | self.ui.setupUi(self) |
|---|
| 38 | |
|---|
| 39 | # Set up signal-slot connections defined in the .ui files and |
|---|
| 40 | # those providing higher-level functionality. |
|---|
| 41 | QMetaObject.connectSlotsByName(self) |
|---|
| 42 | |
|---|
| 43 | #connect signals and methods |
|---|
| 44 | self.connect(self.ui.actionAbout_Open_Coin, SIGNAL("triggered()"), self.about) |
|---|
| 45 | self.connect(self.ui.actionAbout_QT, SIGNAL("triggered()"), self.aboutQt) |
|---|
| 46 | self.connect(self.ui.actionQuit, SIGNAL("triggered()"), self.deleteWindow) |
|---|
| 47 | |
|---|
| 48 | #custom tests |
|---|
| 49 | a = QListWidgetItem() |
|---|
| 50 | a.setText('a') |
|---|
| 51 | self.ui.opencoin_listWidget.addItem(a) |
|---|
| 52 | |
|---|
| 53 | def about(self): |
|---|
| 54 | |
|---|
| 55 | QMessageBox.about(self, |
|---|
| 56 | self.tr("About Open Coin %1").arg(__version__), |
|---|
| 57 | self.tr("<qt><h3>About Open Coin %1</h3>" |
|---|
| 58 | "<p> Open Coin is blah blah blah " |
|---|
| 59 | "</p></qt>").arg(__version__) |
|---|
| 60 | ) |
|---|
| 61 | |
|---|
| 62 | def aboutQt(self): |
|---|
| 63 | |
|---|
| 64 | QMessageBox.aboutQt(self) |
|---|
| 65 | |
|---|
| 66 | def deleteWindow(self): |
|---|
| 67 | |
|---|
| 68 | self.destroy() |
|---|
| 69 | |
|---|