mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-22 13:36:31 +02:00
[ui] CsvData: fix data update
This commit is contained in:
parent
de93f795fb
commit
baaccb0562
2 changed files with 33 additions and 14 deletions
|
@ -23,6 +23,10 @@ class CsvData(QObject):
|
|||
def getFilepath(self):
|
||||
return self._filepath
|
||||
|
||||
@Slot(result=int)
|
||||
def getNbColumns(self):
|
||||
return len(self._data) if self._ready else 0
|
||||
|
||||
def setFilepath(self, filepath):
|
||||
if self._filepath == filepath:
|
||||
return
|
||||
|
@ -73,7 +77,8 @@ class CsvData(QObject):
|
|||
filepath = Property(str, getFilepath, setFilepath, notify=filepathChanged)
|
||||
readyChanged = Signal()
|
||||
ready = Property(bool, lambda self: self._ready, notify=readyChanged)
|
||||
data = Property(QObject, lambda self: self._data, constant=True)
|
||||
data = Property(QObject, lambda self: self._data, notify=readyChanged)
|
||||
nbColumns = Property(int, getNbColumns, notify=readyChanged)
|
||||
|
||||
|
||||
class CsvColumn(QObject):
|
||||
|
|
|
@ -34,7 +34,24 @@ FloatingPane {
|
|||
onWheel: {}
|
||||
}
|
||||
|
||||
property bool ready: csvData.ready
|
||||
property bool crfReady: csvData.ready && csvData.nbColumns >= 4
|
||||
onCrfReadyChanged: {
|
||||
if(crfReady)
|
||||
{
|
||||
redCurve.clear()
|
||||
greenCurve.clear()
|
||||
blueCurve.clear()
|
||||
csvData.getColumn(1).fillChartSerie(redCurve)
|
||||
csvData.getColumn(2).fillChartSerie(greenCurve)
|
||||
csvData.getColumn(3).fillChartSerie(blueCurve)
|
||||
}
|
||||
else
|
||||
{
|
||||
redCurve.clear()
|
||||
greenCurve.clear()
|
||||
blueCurve.clear()
|
||||
}
|
||||
}
|
||||
Item {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
@ -54,8 +71,8 @@ FloatingPane {
|
|||
id: valueAxisX
|
||||
labelFormat: "%i"
|
||||
titleText: "Camera Brightness"
|
||||
min: ready ? csvData.getColumn(0).getFirst() : 0
|
||||
max: ready ? csvData.getColumn(0).getLast() : 1
|
||||
min: crfReady ? csvData.getColumn(0).getFirst() : 0
|
||||
max: crfReady ? csvData.getColumn(0).getLast() : 1
|
||||
}
|
||||
ValueAxis {
|
||||
id: valueAxisY
|
||||
|
@ -67,30 +84,27 @@ FloatingPane {
|
|||
// We cannot use a Repeater with these Components so we need to instantiate them one by one
|
||||
// Red curve
|
||||
LineSeries {
|
||||
id: redCurve
|
||||
axisX: valueAxisX
|
||||
axisY: valueAxisY
|
||||
name: ready ? csvData.getColumn(1).title : ""
|
||||
name: crfReady ? csvData.getColumn(1).title : ""
|
||||
color: name.toLowerCase()
|
||||
|
||||
Component.onCompleted: if(ready) csvData.getColumn(1).fillChartSerie(this)
|
||||
}
|
||||
// Green curve
|
||||
LineSeries {
|
||||
id: greenCurve
|
||||
axisX: valueAxisX
|
||||
axisY: valueAxisY
|
||||
name: ready ? csvData.getColumn(2).title : ""
|
||||
name: crfReady ? csvData.getColumn(2).title : ""
|
||||
color: name.toLowerCase()
|
||||
|
||||
Component.onCompleted: if(ready) csvData.getColumn(2).fillChartSerie(this)
|
||||
}
|
||||
// Blue curve
|
||||
LineSeries {
|
||||
id: blueCurve
|
||||
axisX: valueAxisX
|
||||
axisY: valueAxisY
|
||||
name: ready ? csvData.getColumn(3).title : ""
|
||||
name: crfReady ? csvData.getColumn(3).title : ""
|
||||
color: name.toLowerCase()
|
||||
|
||||
Component.onCompleted: if(ready) csvData.getColumn(3).fillChartSerie(this)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue