Package ajango :: Package gui :: Module window
[hide private]
[frames] | no frames]

Source Code for Module ajango.gui.window

 1  ########################################################################### 
 2  #                                                                         # 
 3  #  Copyright (C) 2016  Rafal Kobel <rafyco1@gmail.com>                    # 
 4  #                                                                         # 
 5  #  This program is free software: you can redistribute it and/or modify   # 
 6  #  it under the terms of the GNU General Public License as published by   # 
 7  #  the Free Software Foundation, either version 3 of the License, or      # 
 8  #  (at your option) any later version.                                    # 
 9  #                                                                         # 
10  #  This program is distributed in the hope that it will be useful,        # 
11  #  but WITHOUT ANY WARRANTY; without even the implied warranty of         # 
12  #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the           # 
13  #  GNU General Public License for more details.                           # 
14  #                                                                         # 
15  #  You should have received a copy of the GNU General Public License      # 
16  #  along with this program.  If not, see <http://www.gnu.org/licenses/>.  # 
17  #                                                                         # 
18  ########################################################################### 
19  """ Modul obslugujacy glowne okno interfejsu graficznego. """ 
20   
21  from PyQt4.QtGui                 import QWidget 
22  from PyQt4.QtGui                 import QMessageBox 
23  from PyQt4.QtGui                 import QIcon 
24  from PyQt4.QtGui                 import QTreeView 
25  from PyQt4.QtGui                 import QTableView 
26  from PyQt4.QtGui                 import QSplitter 
27  from PyQt4.QtGui                 import QHBoxLayout 
28  from PyQt4.QtCore                import Qt 
29  from django.core.management.base import CommandError 
30  from ajango.gui.controller       import Controller 
31  import ajango 
32   
33 -def block_application(window):
34 """ Wyswietla wiadomosc o niedostepnosci elementu gui i rzuca blad. """ 35 message = QMessageBox(window) 36 message.setText("Blad interfejsu graficznego.") 37 message.setInformativeText("Oprogramowanie w budowie.") 38 message.setWindowIcon(QIcon(ajango.__path__[0] + 39 '/gui/resource/icon.png')) 40 message.setIcon(QMessageBox.Critical) 41 message.exec_() 42 raise CommandError("Aplikacja nie gotowa.")
43
44 -class Window(QWidget):
45 """ Klasa okienka interfejsu graficznego Ajango. """
46 - def __init__(self, file_skeleton):
47 self.tree = None 48 self.table = None 49 self.controller = Controller(self, file_skeleton) 50 QWidget.__init__(self) 51 self.init_ui() 52 self.controller.build_tree() 53 block_application(self)
54 - def get_tree(self):
55 """ Zwraca drzewo okna. """ 56 return self.tree
57 - def get_table(self):
58 """ Zwraca okno z tabela. """ 59 return self.table
60 - def init_ui(self):
61 """ Inicjalizacja okienka. """ 62 self.tree = QTreeView(self) 63 self.table = QTableView(self) 64 splitter = QSplitter(Qt.Horizontal) 65 splitter.addWidget(self.tree) 66 splitter.addWidget(self.table) 67 vbox = QHBoxLayout() 68 vbox.addWidget(splitter) 69 self.setLayout(vbox) 70 self.setGeometry(300, 300, 500, 200) 71 self.setWindowTitle('Ajagno Editor') 72 self.setWindowIcon(QIcon(ajango.__path__[0] + 73 '/gui/resources/icon.png')) 74 self.show()
75