Version 0.2

+ not rally related to 0.1
+ core works, do proper commits from here.
pull/1/head
Ivan Olexyn 6 years ago
parent e7698940d4
commit fd54a16439

@ -12,14 +12,20 @@ This is a frontend for the collection of tools used by the zebra.
### How To ### How To
##### Installation:
``` ```
pip3 install pyqt5 pip3 install pyqt5
pip3 install matplotlib pip3 install matplotlib
python3 ./window.py python3 ./window.py
``` ```
<br> ##### About PyQt
Every UI element (e.g. *Button*) is a *Widget*.
A *Widget* can also have a *Layout* (e.g. *Grid*)
and contain other *Widgets*.
For example:
A *Tab* widget may contain an empty container widget.
The empty container widget may have the grid layout,
and contain a button on position (0,0) of said grid.
### To Do
+ Add a plot.
+ Add file selection.

@ -0,0 +1,2 @@
''''''
from PyQt5.QtWidgets import QWidget

@ -0,0 +1,145 @@
from PyQt5.QtWidgets import QPlainTextEdit, QHBoxLayout, QWidget, QGridLayout, QLabel, QPushButton, QTableWidget, QTableWidgetItem
class OneDimView(QWidget):
def __init__(self):
''' Widget containing the entire 2D Mode view. '''
super().__init__()
self.grid = QGridLayout()
self.setLayout(self.grid)
self.define_widgets()
self.set_widget_actions()
def define_widgets(self):
''' Define widgets such as buttons. This must be done before setting widget actions.
Otherwise a widget action might try to modify a widget that is not defined yet.'''
# add empty label as spacer after buttons
# this has some side effects (i suspect) :
# + when adding the Buttons20, we really mean for it to span from grid position (3,1) to (3,2)
# but to create the correct visual effect it must span also over the invisible spacder column,
# Thus from (3,1) to (3,3).
self.grid.addWidget(QLabel(), 10,10)
self.load_data_button = QPushButton()
self.load_data_button.setText("Load Data File")
self.load_data_button.setMaximumWidth(200)
self.grid.addWidget(self.load_data_button, 0, 0)
self.one_d_text = OneDText()
self.grid.addWidget(self.one_d_text, 1,0)
self.one_d_table = OneDTable()
self.grid.addWidget(self.one_d_table,0,1, 4,1)
self.one_d_visualize = OneDVisualize()
self.grid.addWidget(self.one_d_visualize,0,2,2,2)
self.buttons20 = Buttons20()
self.grid.addWidget(self.buttons20, 2,0)
self.buttons30 = Buttons30()
self.grid.addWidget(self.buttons30, 3,0)
self.buttons32 = Buttons32()
self.grid.addWidget(self.buttons32,3,2)
def set_widget_actions(self):
pass
class OneDText(QPlainTextEdit):
def __init__(self):
super().__init__()
self.setMinimumSize(200,200)
self.setPlainText("List of Files:\n+ File 1\n+ File 2")
class OneDTable(QTableWidget):
def __init__(self):
super().__init__()
self.setSortingEnabled(True)
self.setRowCount(4)
self.setColumnCount(4)
self.setMinimumSize(300,200)
self.setHorizontalHeaderLabels({'h', 'k', 'l'})
class Buttons20(QWidget):
def __init__(self):
super().__init__()
self.hbox = QHBoxLayout()
self.setLayout(self.hbox)
self.searchButton = QPushButton('Search')
self.addButton = QPushButton('Add')
self.substractButton = QPushButton('Substract')
self.hbox.addWidget(self.searchButton)
self.hbox.addWidget(self.addButton)
self.hbox.addWidget(self.substractButton)
class Buttons30(QWidget):
def __init__(self):
super().__init__()
self.hbox = QHBoxLayout()
self.setLayout(self.hbox)
self.integrateButton = QPushButton('Integrate')
self.lorentzButton = QPushButton('Lorentz')
self.absorptionButton = QPushButton('Absorption')
self.hbox.addWidget(self.integrateButton)
self.hbox.addWidget(self.lorentzButton)
self.hbox.addWidget(self.absorptionButton)
class Buttons32(QWidget):
def __init__(self):
''' Named after its position in the containing grid: row 3, column 2.'''
super().__init__()
self.grid= QGridLayout()
self.setLayout(self.grid)
self.saveButton = QPushButton('Save')
self.grid.addWidget(self.saveButton,0,0)
self.visualizeButton = QPushButton('Visualize in 2D')
self.grid.addWidget(self.visualizeButton, 0,1)
class OneDVisualize(QPlainTextEdit):
def __init__(self):
super().__init__()
self.setMinimumSize(200,200)
self.setPlainText('Placeholder\nfor OneDVisualize().')

@ -0,0 +1,94 @@
import sys
from PyQt5.QtWidgets import QMainWindow, QApplication, QPushButton, QWidget, QAction, QTabWidget ,QVBoxLayout
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import pyqtSlot
class App(QMainWindow):
def __init__(self):
''' Everything is used with `self.` so it can be easily accessed in any function.
'''
super().__init__()
self.title = 'PyQt5 tabs - pythonspot.com'
self.left = 0
self.top = 0
self.setWindowTitle(self.title)
self.setGeometry(self.left, self.top, 400, 400)
self.table_widget = MyTableWidget(self)
self.setCentralWidget(self.table_widget)
self.modeMenu = self.menuBar().addMenu('Mode')
self.zebraMenuEntry = QAction('Zebra')
self.zebraMenuEntry.triggered.connect(self.close)
self.modeMenu.addAction(self.zebraMenuEntry)
self.oneDMenuEntry = QAction('1D Mode')
self.oneDMenuEntry.triggered.connect(self.close)
self.modeMenu.addAction(self.oneDMenuEntry)
self.twoDMenuEntry = QAction('2D Mode')
self.twoDMenuEntry.triggered.connect(self.close)
self.modeMenu.addAction(self.twoDMenuEntry)
self.show() # once everything is set up, show the window.
class MyTableWidget(QWidget):
def __init__(self, parent):
super(QWidget, self).__init__(parent)
self.layout = QVBoxLayout(self)
# Initialize tab screen
self.tabs = QTabWidget()
self.tab1 = QWidget()
self.tab2 = QWidget()
self.tab3 = QWidget()
self.tabs.resize(300 ,200)
# Add tabs
self.tabs.addTab(self.tab1 ,"Prep Experiment Zebra")
self.tabs.addTab(self.tab2 ,"1D Mode")
self.tabs.addTab(self.tab3, "2D Mode")
# Create first tab
self.tab1.layout = QVBoxLayout(self)
self.pushButton1 = QPushButton("PyQt5 button")
self.tab1.layout.addWidget(self.pushButton1)
self.tab1.setLayout(self.tab1.layout)
# Create second tab
self.tab2.layout = QVBoxLayout(self)
self.tabs2 = QTabWidget()
self.tab21 = QWidget()
self.tabs2.addTab(self.tab21, "hello")
self.tab2.layout.addWidget(self.tabs2)
# Add tabs to widget
self.layout.addWidget(self.tabs)
self.setLayout(self.layout)
@pyqtSlot()
def on_click(self):
print("\n")
for currentQTableWidgetItem in self.tableWidget.selectedItems():
print(currentQTableWidgetItem.row(), currentQTableWidgetItem.column(), currentQTableWidgetItem.text())
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = App()
sys.exit(app.exec_())

@ -0,0 +1,35 @@
import sys
from PyQt5.QtWidgets import QMainWindow, QApplication, QPushButton,QLabel, QVBoxLayout, QWidget
from two_d_mode import TwoDMode
from one_d_mode import OneDMode, OneDTable
class TestAWidget(QMainWindow):
def __init__(self):
''' Replace `QPushButton` with any widget you intend to test.
This is meant to be used for quick and easy testing.'''
super().__init__()
self.testWidget = OneDMode()
self.setCentralWidget(self.testWidget)
self.setGeometry(0,0,400,400)
self.setWindowTitle('Test')
self.show()
if __name__ == '__main__':
app = QApplication(sys.argv)
test = TestAWidget()
sys.exit(app.exec())

@ -0,0 +1,130 @@
from PyQt5.QtWidgets import QWidget, QGridLayout, QLabel, QPushButton, QAction, QHBoxLayout, QTabWidget, QTableWidget, QPlainTextEdit
class TwoDimView(QWidget):
def __init__(self):
''' Widget containing the entire Zebra Mode view. '''
super().__init__()
self.grid = QGridLayout()
self.setLayout(self.grid)
self.define_widgets()
self.set_widget_actions()
def define_widgets(self):
''' Define widgets such as buttons. This must be done before setting widget actions.
Otherwise a widget action might try to modify a widget that is not defined yet.'''
# add empty label as spacer after buttons
# this has some side effects (i suspect) :
# + when adding the Buttons20, we really mean for it to span from grid position (3,1) to (3,2)
# but to create the correct visual effect it must span also over the invisible spacder column,
# Thus from (3,1) to (3,3).
self.grid.addWidget(QLabel(), 10,10)
self.load_data_button = QPushButton()
self.load_data_button.setText("Load Data File")
self.load_data_button.setMaximumWidth(200)
self.grid.addWidget(self.load_data_button, 1, 0)
self.one_d_text = OneDText()
self.grid.addWidget(self.one_d_text, 0,0)
self.one_d_table = OneDTable()
self.grid.addWidget(self.one_d_table,0,1)
self.one_d_visualize = OneDVisualize()
self.grid.addWidget(self.one_d_visualize,0,2)
self.buttons20 = Buttons20()
self.grid.addWidget(self.buttons20, 2,0)
self.buttons30 = Buttons30()
self.grid.addWidget(self.buttons30, 3,0)
def set_widget_actions(self):
pass
class OneDText(QPlainTextEdit):
def __init__(self):
super().__init__()
self.setMinimumSize(200,200)
self.setPlainText("List of Files:\n+ File 1\n+ File 2")
class OneDTable(QTableWidget):
def __init__(self):
super().__init__()
self.setSortingEnabled(True)
self.setRowCount(4)
self.setColumnCount(4)
self.setMinimumSize(300,200)
self.setHorizontalHeaderLabels({'h', 'k', 'l'})
class OneDVisualize(QPlainTextEdit):
def __init__(self):
super().__init__()
self.setMinimumSize(200,200)
self.setPlainText('Placeholder\nfor OneDVisualize().')
class Buttons20(QWidget):
def __init__(self):
super().__init__()
self.hbox = QHBoxLayout()
self.setLayout(self.hbox)
self.sortButton = QPushButton('Sort')
self.selectButton = QPushButton('Select')
self.optimizeButton = QPushButton('Optimize')
self.hbox.addWidget(self.sortButton)
self.hbox.addWidget(self.selectButton)
self.hbox.addWidget(self.optimizeButton)
class Buttons30(QWidget):
def __init__(self):
super().__init__()
self.hbox = QHBoxLayout()
self.setLayout(self.hbox)
self.runButton = QPushButton('Run')
self.saveButton = QPushButton('Save')
self.hbox.addWidget(self.runButton)
self.hbox.addWidget(self.saveButton)

@ -0,0 +1,22 @@
from PyQt5.QtWidgets import QPlainTextEdit, QVBoxLayout, QHBoxLayout, QWidget, QGridLayout, QLabel, QPushButton, QTableWidget, QTableWidgetItem
from PyQt5.QtGui import QPixmap
class WelcomeView(QWidget):
def __init__(self):
super().__init__()
self.vbox = QVBoxLayout()
self.setLayout(self.vbox)
self.zebraLabel = QLabel()
zebraImage = QPixmap('zebra.png')
self.zebraLabel.setPixmap(zebraImage)
self.vbox.addWidget(self.zebraLabel)
self.note = QLabel('Please select a Mode.')
self.vbox.addWidget(self.note)

@ -4,6 +4,13 @@ from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QMainWindow, QGr
from plot_canvas import PlotCanvas from plot_canvas import PlotCanvas
class Window(QMainWindow): class Window(QMainWindow):
'''
How it works:
First a window is created.
Then all the widgets (buttons, sliders, plots) are added to the window and hidden.
Finally depending on what view is requested widgets are shown or hidden.
This way we work around the need for tabs and maintain a quick and simple UI.
'''
def __init__(self): def __init__(self):
super().__init__() super().__init__()

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

@ -0,0 +1,95 @@
import sys
from PyQt5.QtWidgets import QMainWindow, QApplication, QPushButton, QGraphicsPixmapItem, QLabel,QWidget, QVBoxLayout, QAction
from twoDimView import TwoDimView
from oneDimView import OneDimView
from welcomeView import WelcomeView
from zebraView import ZebraView
class Zebra(QMainWindow):
def __init__(self):
''' The main window of the Zebra application.'''
super().__init__()
# Set the main container.
self.container = QWidget(self)
self.setCentralWidget(self.container)
# Set the main layout.
self.vbox = QVBoxLayout()
self.container.setLayout(self.vbox)
# Add things.
self.addViews()
self.mainMenu()
# Finalize settings and show.
self.setGeometry(0,0,0,0)
self.setWindowTitle('Zebra')
self.show()
def addViews(self):
''' Add the three views.'''
self.welcomeView = WelcomeView()
self.vbox.addWidget(self.welcomeView)
self.welcomeView.setHidden(False)
self.zebraView = ZebraView()
self.vbox.addWidget(self.zebraView)
self.zebraView.setHidden(True)
self.oneDimView = OneDimView()
self.vbox.addWidget(self.oneDimView)
self.oneDimView.setHidden(True)
self.twoDimView = TwoDimView()
self.vbox.addWidget(self.twoDimView)
self.twoDimView.setHidden(True)
def mainMenu(self):
''' Set up the main menu.'''
self.modeMenu = self.menuBar().addMenu('Mode')
self.zebraMenuEntry = QAction('Zebra')
self.zebraMenuEntry.triggered.connect(lambda: self.showView('zebra'))
self.modeMenu.addAction(self.zebraMenuEntry)
self.oneDMenuEntry = QAction('1D Mode')
self.oneDMenuEntry.triggered.connect(lambda: self.showView('1D'))
self.modeMenu.addAction(self.oneDMenuEntry)
self.twoDMenuEntry = QAction('2D Mode')
self.twoDMenuEntry.triggered.connect(lambda: self.showView('2D'))
self.modeMenu.addAction(self.twoDMenuEntry)
def showView(self, view):
self.welcomeView.setHidden(True)
self.zebraView.setHidden(True)
self.oneDimView.setHidden(True)
self.twoDimView.setHidden(True)
if view == 'zebra':
self.zebraView.setHidden(False)
elif view == '1D':
self.oneDimView.setHidden(False)
elif view =='2D':
self.twoDimView.setHidden(False)
else:
pass
if __name__ == '__main__':
app = QApplication(sys.argv)
test = Zebra()
sys.exit(app.exec())

@ -0,0 +1,799 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<diagram program="umlet" version="13.3">
<zoom_level>8</zoom_level>
<element>
<id>UMLClass</id>
<coordinates>
<x>808</x>
<y>0</y>
<w>168</w>
<h>24</h>
</coordinates>
<panel_attributes>Prep Experiment Zebra
bg=#777777
halign=left</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>808</x>
<y>24</y>
<w>136</w>
<h>24</h>
</coordinates>
<panel_attributes>Load Crystal File
bg=#BBBBBB
halign=left</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>808</x>
<y>48</y>
<w>160</w>
<h>24</h>
</coordinates>
<panel_attributes>Load Instrument File
bg=#BBBBBB
halign=left</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>808</x>
<y>96</y>
<w>160</w>
<h>24</h>
</coordinates>
<panel_attributes>Sector Nuc
bg=#BBBBBB
halign=left</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1208</x>
<y>280</y>
<w>272</w>
<h>352</h>
</coordinates>
<panel_attributes>Table
1.1.3
generated by code
(called by button prepare sector)
columns= {h,k,l} and others (see 1.1.4)
1.1.4
sort ascending , descending</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>960</x>
<y>96</y>
<w>392</w>
<h>184</h>
</coordinates>
<panel_attributes>lt=&lt;.</panel_attributes>
<additional_attributes>470.0;210.0;250.0;130.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1184</x>
<y>264</y>
<w>320</w>
<h>424</h>
</coordinates>
<panel_attributes>
layer=-1
fg=blue</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1208</x>
<y>640</y>
<w>56</w>
<h>32</h>
</coordinates>
<panel_attributes>Sort</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1264</x>
<y>640</y>
<w>64</w>
<h>32</h>
</coordinates>
<panel_attributes>Select</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1328</x>
<y>640</y>
<w>80</w>
<h>32</h>
</coordinates>
<panel_attributes>Optimize</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1408</x>
<y>640</y>
<w>72</w>
<h>32</h>
</coordinates>
<panel_attributes>Save</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>808</x>
<y>120</y>
<w>160</w>
<h>24</h>
</coordinates>
<panel_attributes>Sector Mag
halign=left
bg=#BBBBBB</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1552</x>
<y>280</y>
<w>264</w>
<h>352</h>
</coordinates>
<panel_attributes>Table
1.1.5-6
columns= {h,k,l} and others</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1528</x>
<y>264</y>
<w>320</w>
<h>424</h>
</coordinates>
<panel_attributes>
layer=-1
fg=blue</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1552</x>
<y>640</y>
<w>56</w>
<h>32</h>
</coordinates>
<panel_attributes>Run</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>960</x>
<y>120</y>
<w>728</w>
<h>160</h>
</coordinates>
<panel_attributes>lt=&lt;.</panel_attributes>
<additional_attributes>890.0;180.0;890.0;70.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1608</x>
<y>640</y>
<w>56</w>
<h>32</h>
</coordinates>
<panel_attributes>Sort</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1664</x>
<y>640</y>
<w>80</w>
<h>32</h>
</coordinates>
<panel_attributes>Optimize</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1744</x>
<y>640</y>
<w>72</w>
<h>32</h>
</coordinates>
<panel_attributes>Save</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>816</x>
<y>1056</y>
<w>328</w>
<h>352</h>
</coordinates>
<panel_attributes>Table
halign=left
File 1 ID | X | Y
FILE 2 ID | X | Y
FILE 1+2 ID | X | Y
</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>480</x>
<y>696</y>
<w>504</w>
<h>104</h>
</coordinates>
<panel_attributes>1D Mode
bg=#777777
halign=left</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>504</x>
<y>960</y>
<w>136</w>
<h>24</h>
</coordinates>
<panel_attributes>Load Data
bg=#BBBBBB
halign=left</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>816</x>
<y>824</y>
<w>160</w>
<h>24</h>
</coordinates>
<panel_attributes>Manipulate
bg=#BBBBBB
halign=left</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>816</x>
<y>848</y>
<w>160</w>
<h>24</h>
</coordinates>
<panel_attributes>Integrate Intensities
bg=#BBBBBB
halign=left</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1488</x>
<y>840</y>
<w>160</w>
<h>24</h>
</coordinates>
<panel_attributes>Visualize Measured Int
bg=#BBBBBB
halign=left</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>944</x>
<y>856</y>
<w>136</w>
<h>176</h>
</coordinates>
<panel_attributes>lt=&lt;.</panel_attributes>
<additional_attributes>10.0;200.0;150.0;150.0;40.0;10.0</additional_attributes>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>512</x>
<y>1016</y>
<w>1000</w>
<h>592</h>
</coordinates>
<panel_attributes>
layer=-1
fg=blue</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>816</x>
<y>1448</y>
<w>80</w>
<h>32</h>
</coordinates>
<panel_attributes>Integrate</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>896</x>
<y>1448</y>
<w>64</w>
<h>32</h>
</coordinates>
<panel_attributes>Lorentz</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>960</x>
<y>1448</y>
<w>80</w>
<h>32</h>
</coordinates>
<panel_attributes>Absorption</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1896</x>
<y>840</y>
<w>184</w>
<h>24</h>
</coordinates>
<panel_attributes>Visualize Parapetric Data
halign=left
bg=#BBBBBB</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1560</x>
<y>1056</y>
<w>272</w>
<h>352</h>
</coordinates>
<panel_attributes>GUI Window????</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1536</x>
<y>1040</y>
<w>320</w>
<h>424</h>
</coordinates>
<panel_attributes>
layer=-1
fg=blue</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>1640</x>
<y>848</y>
<w>80</w>
<h>208</h>
</coordinates>
<panel_attributes>lt=&lt;.</panel_attributes>
<additional_attributes>80.0;240.0;30.0;90.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1880</x>
<y>1040</y>
<w>320</w>
<h>64</h>
</coordinates>
<panel_attributes>
layer=-1
fg=blue</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1952</x>
<y>1056</y>
<w>56</w>
<h>32</h>
</coordinates>
<panel_attributes>Q-Maps</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>2008</x>
<y>1056</y>
<w>104</w>
<h>32</h>
</coordinates>
<panel_attributes>Plot Data Vs</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>2112</x>
<y>1056</y>
<w>72</w>
<h>32</h>
</coordinates>
<panel_attributes>Save</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>2024</x>
<y>840</y>
<w>72</w>
<h>216</h>
</coordinates>
<panel_attributes>lt=&lt;.</panel_attributes>
<additional_attributes>10.0;250.0;10.0;210.0;70.0;10.0</additional_attributes>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1072</x>
<y>800</y>
<w>200</w>
<h>24</h>
</coordinates>
<panel_attributes>Open File Dialogue
halign=left</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>960</x>
<y>32</y>
<w>120</w>
<h>48</h>
</coordinates>
<panel_attributes>lt=&lt;.</panel_attributes>
<additional_attributes>130.0;10.0;10.0;40.0</additional_attributes>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1064</x>
<y>32</y>
<w>200</w>
<h>24</h>
</coordinates>
<panel_attributes>Open File Dialogue
halign=left</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>936</x>
<y>24</y>
<w>144</w>
<h>32</h>
</coordinates>
<panel_attributes>lt=&lt;.</panel_attributes>
<additional_attributes>160.0;20.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>816</x>
<y>1416</y>
<w>56</w>
<h>32</h>
</coordinates>
<panel_attributes>Search</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>872</x>
<y>1416</y>
<w>64</w>
<h>32</h>
</coordinates>
<panel_attributes>Add</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>936</x>
<y>1416</y>
<w>80</w>
<h>32</h>
</coordinates>
<panel_attributes>Substract</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1016</x>
<y>1416</y>
<w>72</w>
<h>32</h>
</coordinates>
<panel_attributes>Save</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1896</x>
<y>1184</y>
<w>136</w>
<h>96</h>
</coordinates>
<panel_attributes>GUI Window????</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>2072</x>
<y>1184</y>
<w>136</w>
<h>96</h>
</coordinates>
<panel_attributes>GUI Window????</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1880</x>
<y>1152</y>
<w>168</w>
<h>160</h>
</coordinates>
<panel_attributes>
layer=-1
fg=blue</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>2056</x>
<y>1152</y>
<w>168</w>
<h>160</h>
</coordinates>
<panel_attributes>
layer=-1
fg=blue</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>2048</x>
<y>1080</y>
<w>104</w>
<h>88</h>
</coordinates>
<panel_attributes>lt=&lt;.</panel_attributes>
<additional_attributes>110.0;90.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>1952</x>
<y>1080</y>
<w>40</w>
<h>88</h>
</coordinates>
<panel_attributes>lt=&lt;.</panel_attributes>
<additional_attributes>10.0;90.0;30.0;10.0</additional_attributes>
</element>
<element>
<id>Text</id>
<coordinates>
<x>1320</x>
<y>736</y>
<w>80</w>
<h>56</h>
</coordinates>
<panel_attributes>Extra Features</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>736</x>
<y>96</y>
<w>80</w>
<h>136</h>
</coordinates>
<panel_attributes>lt=.</panel_attributes>
<additional_attributes>80.0;10.0;10.0;150.0</additional_attributes>
</element>
<element>
<id>Text</id>
<coordinates>
<x>704</x>
<y>224</y>
<w>80</w>
<h>56</h>
</coordinates>
<panel_attributes>Button</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>1432</x>
<y>664</y>
<w>24</w>
<h>72</h>
</coordinates>
<panel_attributes>lt=.</panel_attributes>
<additional_attributes>10.0;70.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>Text</id>
<coordinates>
<x>1432</x>
<y>728</y>
<w>80</w>
<h>56</h>
</coordinates>
<panel_attributes>Base Feature</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>1344</x>
<y>664</y>
<w>24</w>
<h>72</h>
</coordinates>
<panel_attributes>lt=.</panel_attributes>
<additional_attributes>10.0;70.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>1280</x>
<y>672</y>
<w>64</w>
<h>80</h>
</coordinates>
<panel_attributes>lt=.</panel_attributes>
<additional_attributes>60.0;80.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>1232</x>
<y>664</y>
<w>96</w>
<h>96</h>
</coordinates>
<panel_attributes>lt=.</panel_attributes>
<additional_attributes>100.0;100.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>536</x>
<y>1080</y>
<w>192</w>
<h>160</h>
</coordinates>
<panel_attributes>List of Files loaded
+ File 1
+ File 2
halign=left</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1152</x>
<y>1056</y>
<w>328</w>
<h>352</h>
</coordinates>
<panel_attributes>
halign=left
visualize
e.g. integration
</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1280</x>
<y>1456</y>
<w>200</w>
<h>32</h>
</coordinates>
<panel_attributes>Very Special Button</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>1472</x>
<y>1456</y>
<w>104</w>
<h>48</h>
</coordinates>
<panel_attributes>lt=&lt;.</panel_attributes>
<additional_attributes>110.0;10.0;80.0;40.0;10.0;20.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>1472</x>
<y>1304</y>
<w>552</w>
<h>256</h>
</coordinates>
<panel_attributes>lt=&lt;.</panel_attributes>
<additional_attributes>670.0;10.0;590.0;300.0;10.0;220.0</additional_attributes>
</element>
</diagram>

@ -0,0 +1,124 @@
from PyQt5.QtWidgets import QPlainTextEdit, QVBoxLayout, QHBoxLayout, QWidget, QGridLayout, QLabel, QPushButton, QTableWidget, QTableWidgetItem
from PyQt5.QtGui import QPixmap
class ZebraView(QWidget):
def __init__(self):
''' Widget containing the entire Zebra Mode view. '''
super().__init__()
self.grid = QGridLayout()
self.setLayout(self.grid)
self.define_widgets()
self.set_widget_actions()
def define_widgets(self):
''' Define widgets such as buttons. This must be done before setting widget actions.
Otherwise a widget action might try to modify a widget that is not defined yet.'''
# add empty label as spacer after buttons
# this has some side effects (i suspect) :
# + when adding the Buttons20, we really mean for it to span from grid position (3,1) to (3,2)
# but to create the correct visual effect it must span also over the invisible spacder column,
# Thus from (3,1) to (3,3).
self.grid.addWidget(QLabel(), 10,10)
self.load_data_button = QPushButton()
self.load_data_button.setText("Load Data File")
self.load_data_button.setMaximumWidth(200)
self.grid.addWidget(self.load_data_button, 0, 0)
self.one_d_text = OneDText()
self.grid.addWidget(self.one_d_text, 1,0)
self.one_d_table = OneDTable()
self.grid.addWidget(self.one_d_table,0,1, 4,1)
self.buttons20 = Buttons20()
self.grid.addWidget(self.buttons20, 2,0)
self.buttons30 = Buttons30()
self.grid.addWidget(self.buttons30, 3,0)
def set_widget_actions(self):
pass
class OneDText(QPlainTextEdit):
def __init__(self):
super().__init__()
self.setMinimumSize(200,200)
self.setPlainText("List of Files:\n+ File 1\n+ File 2")
class OneDTable(QTableWidget):
def __init__(self):
super().__init__()
self.setSortingEnabled(True)
self.setRowCount(4)
self.setColumnCount(4)
self.setMinimumSize(300,200)
self.setHorizontalHeaderLabels({'h', 'k', 'l'})
class Buttons20(QWidget):
def __init__(self):
super().__init__()
self.hbox = QHBoxLayout()
self.setLayout(self.hbox)
self.sortButton = QPushButton('Sort')
self.selectButton = QPushButton('Select')
self.optimizeButton = QPushButton('Optimize')
self.hbox.addWidget(self.sortButton)
self.hbox.addWidget(self.selectButton)
self.hbox.addWidget(self.optimizeButton)
class Buttons30(QWidget):
def __init__(self):
super().__init__()
self.hbox = QHBoxLayout()
self.setLayout(self.hbox)
self.runButton = QPushButton('Run')
self.saveButton = QPushButton('Save')
self.hbox.addWidget(self.runButton)
self.hbox.addWidget(self.saveButton)
Loading…
Cancel
Save