moved example data into separate file

This commit is contained in:
2022-12-18 15:46:50 +01:00
parent d08c512bb1
commit 0ff5d9fc87
2 changed files with 19 additions and 13 deletions

17
exampledata.py Normal file
View File

@ -0,0 +1,17 @@
import numpy as np
X = np.arange(100) / 10
exampledata = {
"sine": [X, np.sin(X)],
"cosine": [X, np.cos(X)],
"exp": [X, np.exp(X)],
"log": [X, np.log(X+1)]
}
# due to the appending of xy pairs, data needs to be transposed
exampledata = {k: zip(*v) for k, v in exampledata.items()}

View File

@ -1,5 +1,3 @@
import numpy as np
from PyQt5.QtCore import Qt, pyqtSignal
from PyQt5.QtWidgets import QMainWindow, QSplitter
@ -7,9 +5,7 @@ import assets
from dictlist import DictList
from mdi import MDIArea, MDISubPlot
from rpcserverthread import RPCServerThread
X = np.arange(100) / 10
from exampledata import exampledata
class MainWindow(QMainWindow):
@ -21,14 +17,7 @@ class MainWindow(QMainWindow):
self.setWindowTitle(title)
self.setWindowIcon(assets.icon())
data = {
"sine": [X, np.sin(X)],
"cosine": [X, np.cos(X)],
"exp": [X, np.exp(X)],
"log": [X, np.log(X+1)]
}
data = {k: zip(*v) for k, v in data.items()} # due to the appending of xy pairs, data needs to be transposed
self.lst = lst = DictList(data)
self.lst = lst = DictList(exampledata)
lst.setAlternatingRowColors(True)
lst.doubleClicked.connect(self.on_select_list_item)
self.setCentralWidget(lst)