-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgraphBase.py
More file actions
65 lines (51 loc) · 2.21 KB
/
graphBase.py
File metadata and controls
65 lines (51 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from pyqtgraph.dockarea import *
from pyqtgraph.Qt import QtCore, QtGui
from pyqtgraph.parametertree import types as pTypes
from pyqtgraph.parametertree import Parameter, ParameterTree
from pyqtgraph.parametertree import ParameterItem, registerParameterType
import gc
import pyqtgraph as pg
import crystalParamBase
import pyqtgraph.exporters
import pyqtgraph.opengl as gl
class graphBase(QtGui.QWidget):
def __init__(self):
QtGui.QWidget.__init__(self)
self.dockAreaList = {}
self.setUpGui()
self.params = crystalParamBase.crytalParamInitialize()
self.tree.setParameters(self.params, showTop = False)
self.params.param('Add Crystal').sigActivated.connect(self.addCrystalParam)
self.params.param('Crystals').sigChildRemoved.connect(self.crystalWindowRemove)
def setUpGui(self):
# Insert a layout into the main window where other widgets can be added
self.layout = QtGui.QVBoxLayout()
self.layout.setContentsMargins(0,0,0,0)
self.setLayout(self.layout)
# Insert a widget that allows for division of the layout
self.splitterMain = QtGui.QSplitter()
self.splitterMain.setOrientation(QtCore.Qt.Horizontal)
self.layout.addWidget(self.splitterMain)
# View for adding crystals
self.splitterSubAdd = QtGui.QSplitter()
self.splitterSubAdd.setOrientation(QtCore.Qt.Vertical)
self.splitterMain.addWidget(self.splitterSubAdd)
self.tree = ParameterTree(showHeader = False)
self.splitterSubAdd.addWidget(self.tree)
self.splitterSubView = QtGui.QSplitter()
self.splitterSubView.setOrientation(QtCore.Qt.Vertical)
self.splitterMain.addWidget(self.splitterSubView)
# Adds a news window to add a new crystal next door
def addCrystalParam(self):
if not self.params.param('Chemical Formula').value() in self.params.crystalList:
self.params.addCrystalView(self.params)
a = self.params.crystalList[
self.params.param('Chemical Formula').value()].area
self.dockAreaList[self.params.param('Chemical Formula').value()] = a
self.splitterSubView.addWidget(a)
self.params.param('Chemical Formula').setToDefault()
self.params.param('Polytype').setToDefault()
def crystalWindowRemove(self, param, child):
self.dockAreaList[child.name()].close()
del self.dockAreaList[child.name()]
gc.collect()