moved example data into separate file
This commit is contained in:
17
exampledata.py
Normal file
17
exampledata.py
Normal 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()}
|
||||
|
||||
|
||||
|
15
mainwin.py
15
mainwin.py
@ -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)
|
||||
|
Reference in New Issue
Block a user