diff --git a/gui.py b/gui.py new file mode 100644 index 0000000..ba94102 --- /dev/null +++ b/gui.py @@ -0,0 +1,102 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- + +import sys +from PyQt5.QtWidgets import (QWidget, QHBoxLayout, QFrame, + QSplitter, QStyleFactory, QApplication) +from PyQt5.QtCore import Qt +from PyQt5.QtWidgets import QMainWindow, QTextEdit, QAction, QApplication, QListView, QListWidget +from PyQt5.QtGui import QIcon + +import dm + +class MainWin(QMainWindow): + + def __init__(self): + super().__init__() + + self.initUI() + + + def initUI(self): + + textEdit = QTextEdit() + splitter = WorkArea() + self.setCentralWidget(splitter) + #self.setCentralWidget(textEdit) + + exitAction = QAction(QIcon('img/close.gif'), 'Выход', self) + exitAction.setShortcut('Ctrl+Q') + exitAction.setStatusTip('Выход') + exitAction.triggered.connect(self.close) + + self.statusBar() + + menubar = self.menuBar() + fileMenu = menubar.addMenu('&Файл') + fileMenu.addAction(exitAction) + + editMenu = menubar.addMenu('&Редактирование') + helpMenu = menubar.addMenu('&Помощь') + + toolbar = self.addToolBar('Выход') + toolbar.addAction(exitAction) + + self.setGeometry(300, 300, 850, 650) + self.setWindowTitle('Ацкый быдлокод') + self.show() + + +class WorkArea(QWidget): + + def __init__(self): + super().__init__() + + self.initUI() + + + def initUI(self): + + hbox = QHBoxLayout(self) + + #topleft = QFrame(self) + topleft = QListWidget() + topleft.setFrameShape(QFrame.StyledPanel) + + #topright = QFrame(self) + topright = QTextEdit() + topright.setFrameShape(QFrame.StyledPanel) + + #bottom = QFrame(self) + #bottom.setFrameShape(QFrame.StyledPanel) + + splitter1 = QSplitter(Qt.Horizontal) + splitter1.addWidget(topleft) + splitter1.addWidget(topright) + + splitter2 = QSplitter(Qt.Vertical) + splitter2.addWidget(splitter1) + #splitter2.addWidget(bottom) + + hbox.addWidget(splitter2) + + #textEdit = QListView() + self.setLayout(hbox) + + for i in dm.initDBstructure(): + topleft.addItem(i) + + + def onChanged(self, text): + + self.lbl.setText(text) + self.lbl.adjustSize() + + + +if __name__ == '__main__': + + app = QApplication(sys.argv) + ex = MainWin() + sys.exit(app.exec_()) +