Created
April 8, 2016 21:21
-
-
Save santiago-salas-v/6d99328a510ae2c14a2b1fcc184e42ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, sys, logging, re, pandas as pd, numpy as np, scipy as sp, csv, bisect, uuid | |
import matplotlib, colormaps | |
matplotlib.use('Qt4Agg') | |
matplotlib.rcParams['backend.qt4'] = 'PySide' | |
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas | |
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar | |
from matplotlib.figure import Figure | |
from PySide import QtGui, QtCore | |
from functools import partial | |
from mat_Zerlegungen import gausselimination | |
from datetime import datetime | |
from mpldatacursor import datacursor | |
class UiGroup_1(QtGui.QWidget): | |
def __init__(self, parent): | |
QtGui.QWidget.__init__(self, parent) | |
parent.resize(500, 357) | |
self.layout = QtGui.QVBoxLayout(parent) | |
self.pushButton_1 = QtGui.QPushButton(parent) | |
self.pushButton_2 = QtGui.QPushButton(parent) | |
self.layout.addWidget(self.pushButton_1) | |
self.layout.addWidget(self.pushButton_2) | |
self.pushButton_1.setText('Add box') | |
self.pushButton_2.setText('Replace box') | |
self.pushButton_1.clicked.connect(partial(self.newGroup_1)) | |
self.pushButton_2.clicked.connect(partial(self.newGroup_2)) | |
def newGroup_1(self): | |
self.group_2 = QtGui.QGroupBox() | |
self.child_1 = LogWidget(1, self.group_2) | |
self.group_2.resize(200,200) | |
self.group_2.move(1,2) | |
self.child_1.move(1,2) | |
self.group_2.show() | |
def newGroup_2(self): | |
self.group_2 = QtGui.QGroupBox() | |
self.child_1 = UiGroupBoxPlot(self.group_2) | |
self.group_2.resize(100,100) | |
self.group_2.show() | |
def show_group_2(self): | |
pass | |
# ================================================================================================ | |
# ================================================================================================ | |
# ================================================================================================ | |
class LogWidget(QtGui.QWidget): | |
def __init__(self, _log, parent): | |
QtGui.QWidget.__init__(self, parent) | |
parent.resize(762, 450) | |
self.icon = QtGui.QIcon() | |
self.icon.addPixmap(QtGui.QPixmap( | |
"utils/glyphicons-88-log-book.png"), | |
QtGui.QIcon.Normal, QtGui.QIcon.Off) | |
self.log = _log | |
self.setupUi() | |
#self.group_2.setWindowIcon(self.icon) | |
self.group_2.show() | |
def setupUi(self): | |
self.minLogHeight = 400 | |
self.minLogWidth = self.minLogHeight * 16 / 9 | |
self.group_2 = QtGui.QGroupBox(parent=self) | |
self.group_2.resize(self.minLogWidth, self.minLogHeight) | |
self.verticalLayout = QtGui.QVBoxLayout(self.group_2) | |
self.horizontalLayout = QtGui.QHBoxLayout() | |
self.group_2.setLayout(self.verticalLayout) | |
self.pandasView = QtGui.QTableView(self.group_2) | |
self.firstButton = QtGui.QPushButton(self.group_2) | |
self.lastButton = QtGui.QPushButton(self.group_2) | |
self.nextButton = QtGui.QPushButton(self.group_2) | |
self.previousButton = QtGui.QPushButton(self.group_2) | |
self.pageLabel = QtGui.QLabel(self.group_2) | |
self.totPagesLabel = QtGui.QLabel(self.group_2) | |
self.pageBox = QtGui.QLineEdit(self.group_2) | |
self.exportButton = QtGui.QPushButton(self.group_2) | |
self.plotButton = QtGui.QPushButton(self.group_2) | |
self.verticalLayout.addLayout(self.horizontalLayout) | |
self.verticalLayout.addWidget(self.pandasView) | |
self.verticalLayout.addWidget(self.exportButton) | |
self.verticalLayout.addWidget(self.plotButton) | |
self.horizontalLayout.addWidget(self.firstButton) | |
self.horizontalLayout.addWidget(self.previousButton) | |
self.horizontalLayout.addWidget(self.pageLabel) | |
self.horizontalLayout.addWidget(self.pageBox) | |
self.horizontalLayout.addWidget(self.totPagesLabel) | |
self.horizontalLayout.addWidget(self.nextButton) | |
self.horizontalLayout.addWidget(self.lastButton) | |
class UiGroupBoxPlot(QtGui.QWidget): | |
def __init__(self, parent): | |
QtGui.QWidget.__init__(self, parent) | |
parent.resize(762, 450) | |
self.verticalLayout_1Widget = QtGui.QWidget(parent) | |
self.verticalLayout_1Widget.setGeometry(QtCore.QRect(9, 19, 741, 421)) | |
self.verticalLayout_1Widget.setObjectName("verticalLayout_1Widget") | |
self.verticalLayout_1Widget.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) | |
self.verticalLayout_1 = QtGui.QVBoxLayout(self.verticalLayout_1Widget) | |
self.verticalLayout_1.setObjectName("verticalLayout_1") | |
self.verticalLayout_1.setContentsMargins(0, 0, 0, 0) | |
self.horizontalTools = QtGui.QHBoxLayout() | |
self.horizontalTools.setAlignment(QtCore.Qt.AlignVCenter) | |
self.toolsFrame = QtGui.QFrame() | |
self.toolsFrame.setLayout(self.horizontalTools) | |
self.toggleLogButtonX = QtGui.QPushButton() | |
self.toggleLogButtonY = QtGui.QPushButton() | |
self.eraseAnnotationsB = QtGui.QPushButton() | |
self.toggleLogButtonX.setCheckable(True) | |
self.toggleLogButtonY.setCheckable(True) | |
self.eraseAnnotationsB.setIcon(QtGui.QIcon(os.path.join(sys.path[0], | |
*['utils', 'glyphicons-551-erase.png']))) | |
self.navigation_frame = QtGui.QFrame() | |
self.verticalLayout_1.addWidget(self.navigation_frame) | |
self.horizontalTools.addWidget(self.toggleLogButtonY) | |
self.horizontalTools.addWidget(self.toggleLogButtonX) | |
self.horizontalTools.addWidget(self.eraseAnnotationsB) | |
self.verticalLayout_1.addWidget(self.toolsFrame) | |
self.horizontalLayout = QtGui.QHBoxLayout() | |
self.horizontalLayout.setObjectName("horizontalLayout") | |
self.verticalLayout_1.addLayout(self.horizontalLayout) | |
def main(): | |
app = QtGui.QApplication.instance() # checks if QApplication already exists | |
if not app: # create QApplication if it doesnt exist | |
app = QtGui.QApplication(sys.argv) | |
main_form = QtGui.QGroupBox() | |
main_form.ui = UiGroup_1(main_form) | |
main_form.show() | |
app.exec_() | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment