root / trunk / gui / window.py

Revision 4, 2.0 kB (checked in by ocandy, 4 years ago)

An inital framework for a QT4 GUI

Line 
1"""
2window.py
3
4Open Coin prototype GUI
5
6Copyright (C) 2007 Andrew Nicholson <andy@infiniterecursion.com.au>
7
8This program is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 2 of the License, or
11(at your option) any later version.
12
13This program is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with this program; if not, write to the Free Software
20Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21"""
22
23
24import sys
25from PyQt4.QtCore import *
26from PyQt4.QtGui import *
27
28from opencoin_ui import Ui_openCoin_MainWindow
29
30from constants import __version__
31
32class 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
Note: See TracBrowser for help on using the browser.