further reorganization
This commit is contained in:
@ -48,7 +48,7 @@ class LogFSpinBox(QDoubleSpinBox):
|
||||
class BaseWidget(QGroupBox):
|
||||
changedTable = pyqtSignal()
|
||||
removeMe = pyqtSignal()
|
||||
subtract = pyqtSignal()
|
||||
subtract = pyqtSignal(bool)
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super(BaseWidget, self).__init__(parent)
|
||||
@ -56,6 +56,7 @@ class BaseWidget(QGroupBox):
|
||||
self.inputs = []
|
||||
self.errors = []
|
||||
self.names = []
|
||||
self._subtracted = False
|
||||
self.selector_mask = None # TODO: clean up
|
||||
self.func_type="None"
|
||||
|
||||
@ -63,7 +64,9 @@ class BaseWidget(QGroupBox):
|
||||
self.removeMe.emit()
|
||||
|
||||
def subtract(self):
|
||||
self.subtract.emit()
|
||||
self.subtract.emit(self._subtracted)
|
||||
self._subtracted = not self._subtracted # Toggle state
|
||||
|
||||
|
||||
def change_values( self, num ):
|
||||
self.changedTable.emit()
|
||||
@ -317,7 +320,8 @@ class ConductivityWidget(BaseWidget, QGroupBox):
|
||||
self.ui.gridLayout.addWidget(self.ui.rSigma,2,1)
|
||||
|
||||
self.ui.removeButton.clicked.connect(self.remove)
|
||||
#self.ui.subtractConductivityButton.connect(self.subtract)
|
||||
self.ui.pushButton_hide.clicked.connect(self.subtract)
|
||||
|
||||
self.func_type="Cond."
|
||||
|
||||
self.names = [
|
||||
@ -355,6 +359,7 @@ class PowerLawWidget(BaseWidget):
|
||||
self.ui.doubleSpinBox_2 = LogFSpinBox(self)
|
||||
self.ui.gridLayout.addWidget(self.ui.doubleSpinBox_2,1,1)
|
||||
self.ui.removeButton.clicked.connect(self.remove)
|
||||
self.ui.pushButton_hide.toggled.connect(self.subtract)
|
||||
self.func_type="Power Law"
|
||||
|
||||
self.names = ["Amp", "pwrAmp"]
|
||||
|
83
gui/graphs.py
Normal file
83
gui/graphs.py
Normal file
@ -0,0 +1,83 @@
|
||||
# coding=utf-8
|
||||
from PyQt4.QtCore import pyqtSignal
|
||||
from PyQt4.QtGui import QColor
|
||||
from data.data import Daten
|
||||
from libmath.function_library import ModelFunction
|
||||
|
||||
__author__ = 'markusro'
|
||||
|
||||
|
||||
import pyqtgraph as pg
|
||||
|
||||
|
||||
class Graph(object):
|
||||
def __init__(self,x = None, y = None):
|
||||
super(Graph, self).__init__(self)
|
||||
print "Graph"
|
||||
self._pen = pg.mkPen(color="w", width=2.0, style=3)
|
||||
self.graph_real = pg.PlotDataItem(x=x, y=y, pen=self._pen)
|
||||
self.graph_imag = pg.PlotDataItem(x=x, y=y, pen=self._pen)
|
||||
|
||||
@property
|
||||
def color(self):
|
||||
return self._pen.color()
|
||||
|
||||
@color.setter
|
||||
def color(self, c):
|
||||
self._pen.setColor(c)
|
||||
|
||||
@property
|
||||
def style(self):
|
||||
return self._pen.style()
|
||||
|
||||
@style.setter
|
||||
def style(self, s):
|
||||
self._pen.setStyle(s)
|
||||
|
||||
@property
|
||||
def width(self):
|
||||
return self._pen.width()
|
||||
|
||||
@width.setter
|
||||
def width(self, w):
|
||||
self._pen.setWidth(w)
|
||||
|
||||
def set_symbol(self, s):
|
||||
for gr in self.graph_real, self.graph_imag:
|
||||
gr.setSymbol(s)
|
||||
gr.setStyle(0)
|
||||
|
||||
|
||||
def update_graph_data(self, x, y_real, y_imag):
|
||||
"""
|
||||
Update Graph data.
|
||||
|
||||
@param x:
|
||||
@param y_real:
|
||||
@param y_imag:
|
||||
"""
|
||||
self.graph_real.setData(x, y_real)
|
||||
self.graph_imag.setData(x, y_imag)
|
||||
|
||||
class DataGraph(Graph):
|
||||
def __init__(self):
|
||||
super(DataGraph, self).__init__()
|
||||
self._pen = pg.mkPen(QColor(0, 0, 0, 0))
|
||||
self.graph_real = pg.PlotDataItem(x=x, y=y, pen=self._pen, symbol="o", symbolBrush=(255, 127, 0, 127))
|
||||
self.graph_imag = pg.PlotDataItem(x=x, y=y, pen=self._pen, symbol="o", symbolBrush=(255, 127, 0, 127))
|
||||
|
||||
|
||||
class GraphObject(Graph, Daten, ModelFunction):
|
||||
parameter_changed_signal = pyqtSignal(list)
|
||||
def __init__(self):
|
||||
super(GraphObject, self).__init__(self)
|
||||
self.data_changed_signal.connect(self.update_graph_data)
|
||||
|
||||
def update(self, x, p):
|
||||
if self.model is not None:
|
||||
_x, ry, iy = self.model.calculate(x, p)
|
||||
self.set_data(_x, ry, iy)
|
||||
self.parameter_changed_signal.emit(list(p))
|
||||
else:
|
||||
print "doing nothing"
|
||||
pass
|
Reference in New Issue
Block a user