[tracks] add window information
This commit is contained in:
parent
0542d271ef
commit
1c65296008
@ -95,31 +95,43 @@ class SelectionControls(QWidget):
|
|||||||
self.tone_selection = QLabel("0")
|
self.tone_selection = QLabel("0")
|
||||||
self.ttwo_selection = QLabel("0")
|
self.ttwo_selection = QLabel("0")
|
||||||
self.tother_selection = QLabel("0")
|
self.tother_selection = QLabel("0")
|
||||||
|
self.startframe = QLabel("0")
|
||||||
|
self.endframe = QLabel("0")
|
||||||
self._total = 0
|
self._total = 0
|
||||||
|
|
||||||
grid = QGridLayout()
|
grid = QGridLayout()
|
||||||
grid.addWidget(backBtn, 0, 0, 2, 2)
|
grid.addWidget(backBtn, 0, 0, 3, 2)
|
||||||
grid.addWidget(halfstepBackBtn, 2, 0, 1, 2)
|
grid.addWidget(halfstepBackBtn, 3, 0, 2, 2)
|
||||||
grid.addWidget(quarterstepBackBtn, 3, 0, 1, 2)
|
grid.addWidget(quarterstepBackBtn, 5, 0, 2, 2)
|
||||||
grid.addWidget(fwdBtn, 0, 6, 2, 2)
|
grid.addWidget(fwdBtn, 0, 6, 3, 2)
|
||||||
grid.addWidget(halfstepFwdBtn, 2, 6, 1, 2)
|
grid.addWidget(halfstepFwdBtn, 3, 6, 2, 2)
|
||||||
grid.addWidget(quarterstepFwdBtn, 3, 6, 1, 2)
|
grid.addWidget(quarterstepFwdBtn, 5, 6, 2, 2)
|
||||||
grid.addWidget(QLabel("Current selection:"), 0, 2, 1, 4)
|
|
||||||
grid.addWidget(QLabel("Track One:"), 1, 2, 1, 3)
|
grid.addWidget(QLabel("Current window:"), 0, 2, 1, 4)
|
||||||
grid.addWidget(self.tone_selection, 1, 5, 1, 1)
|
grid.addWidget(QLabel("start:"), 1, 3, 1, 1)
|
||||||
grid.addWidget(QLabel("Track Two:"), 2, 2, 1, 3)
|
grid.addWidget(self.startframe, 1, 4, 1, 2, Qt.AlignmentFlag.AlignRight)
|
||||||
grid.addWidget(self.ttwo_selection, 2, 5, 1, 1)
|
grid.addWidget(QLabel("end:"), 2, 3, 1, 1)
|
||||||
grid.addWidget(QLabel("Unassigned:"), 3, 2, 1, 3)
|
grid.addWidget(self.endframe, 2, 4, 1, 2, Qt.AlignmentFlag.AlignRight)
|
||||||
grid.addWidget(self.tother_selection, 3, 5, 1, 1)
|
grid.addWidget(QLabel("Current selection:"), 3, 2, 1, 4)
|
||||||
|
grid.addWidget(QLabel("Track One:"), 4, 3, 1, 2)
|
||||||
grid.addWidget(assignOneBtn, 4, 0, 4, 3)
|
grid.addWidget(self.tone_selection, 4, 5, 1, 1, Qt.AlignmentFlag.AlignRight)
|
||||||
grid.addWidget(assignOtherBtn, 4, 3, 4, 2)
|
grid.addWidget(QLabel("Track Two:"), 5, 3, 1, 2)
|
||||||
grid.addWidget(assignTwoBtn, 4, 5, 4, 3)
|
grid.addWidget(self.ttwo_selection, 5, 5, 1, 1, Qt.AlignmentFlag.AlignRight)
|
||||||
|
grid.addWidget(QLabel("Unassigned:"), 6, 3, 1, 2)
|
||||||
|
grid.addWidget(self.tother_selection, 6, 5, 1, 1, Qt.AlignmentFlag.AlignRight)
|
||||||
|
|
||||||
|
grid.addWidget(assignOneBtn, 7, 0, 4, 3)
|
||||||
|
grid.addWidget(assignOtherBtn, 7, 3, 4, 2)
|
||||||
|
grid.addWidget(assignTwoBtn, 7, 5, 4, 3)
|
||||||
grid.setColumnStretch(0, 1)
|
grid.setColumnStretch(0, 1)
|
||||||
grid.setColumnStretch(7, 1)
|
grid.setColumnStretch(7, 1)
|
||||||
self.setLayout(grid)
|
self.setLayout(grid)
|
||||||
self.setMaximumSize(QSize(400, 200))
|
self.setMaximumSize(QSize(400, 200))
|
||||||
|
|
||||||
|
def setWindow(self, start:int=0, end:int=0):
|
||||||
|
self.startframe.setText(f"{start:.0f}")
|
||||||
|
self.endframe.setText(f"{end:g}")
|
||||||
|
|
||||||
def _updateNumbers(self, track):
|
def _updateNumbers(self, track):
|
||||||
labels = {1: self.tone_selection, 2: self.ttwo_selection, 3: self.tother_selection}
|
labels = {1: self.tone_selection, 2: self.ttwo_selection, 3: self.tother_selection}
|
||||||
for k in labels:
|
for k in labels:
|
||||||
@ -150,12 +162,17 @@ class SelectionControls(QWidget):
|
|||||||
|
|
||||||
def setSelectedTracks(self, tracks):
|
def setSelectedTracks(self, tracks):
|
||||||
logging.debug("SelectionControl: setSelectedTracks")
|
logging.debug("SelectionControl: setSelectedTracks")
|
||||||
|
if tracks is not None:
|
||||||
tone = np.sum(tracks == 1)
|
tone = np.sum(tracks == 1)
|
||||||
ttwo = np.sum(tracks == 2)
|
ttwo = np.sum(tracks == 2)
|
||||||
|
else:
|
||||||
|
tone = 0
|
||||||
|
ttwo = 0
|
||||||
|
|
||||||
self.tone_selection.setText(str(tone))
|
self.tone_selection.setText(str(tone))
|
||||||
self.ttwo_selection.setText(str(ttwo))
|
self.ttwo_selection.setText(str(ttwo))
|
||||||
self.tother_selection.setText(str(len(tracks) - tone - ttwo))
|
self.tother_selection.setText(str(len(tracks) - tone - ttwo if tracks is not None else 0))
|
||||||
self._total = len(tracks)
|
self._total = len(tracks) if tracks is not None else 0
|
||||||
|
|
||||||
|
|
||||||
class FixTracks(QWidget):
|
class FixTracks(QWidget):
|
||||||
@ -313,6 +330,7 @@ class FixTracks(QWidget):
|
|||||||
|
|
||||||
start_frame = self._currentWindowPos
|
start_frame = self._currentWindowPos
|
||||||
stop_frame = start_frame + self._currentWindowWidth
|
stop_frame = start_frame + self._currentWindowWidth
|
||||||
|
self._controls_widget.setWindow(start_frame, stop_frame)
|
||||||
logging.debug("Tracks:update: Updating View for detection range %i, %i frames", start_frame, stop_frame)
|
logging.debug("Tracks:update: Updating View for detection range %i, %i frames", start_frame, stop_frame)
|
||||||
self._data.setSelectionRange("frame", start_frame, stop_frame)
|
self._data.setSelectionRange("frame", start_frame, stop_frame)
|
||||||
frames = self._data.selectedData("frame")
|
frames = self._data.selectedData("frame")
|
||||||
@ -448,6 +466,7 @@ class FixTracks(QWidget):
|
|||||||
self._currentWindowWidth = value
|
self._currentWindowWidth = value
|
||||||
logging.debug("Tracks:OnWindowSizeChanged %i franes", value)
|
logging.debug("Tracks:OnWindowSizeChanged %i franes", value)
|
||||||
self._timeline.setWindowWidth(self._currentWindowWidth / self._maxframes)
|
self._timeline.setWindowWidth(self._currentWindowWidth / self._maxframes)
|
||||||
|
self._controls_widget.setSelectedTracks(None)
|
||||||
|
|
||||||
def on_detectionsSelected(self, detections):
|
def on_detectionsSelected(self, detections):
|
||||||
logging.debug("Tracks: Detections selected")
|
logging.debug("Tracks: Detections selected")
|
||||||
@ -476,6 +495,7 @@ class FixTracks(QWidget):
|
|||||||
new_start_frame = self._currentWindowPos + step
|
new_start_frame = self._currentWindowPos + step
|
||||||
self._timeline.setWindowPos(new_start_frame / self._maxframes)
|
self._timeline.setWindowPos(new_start_frame / self._maxframes)
|
||||||
self._currentWindowPos = new_start_frame
|
self._currentWindowPos = new_start_frame
|
||||||
|
self._controls_widget.setSelectedTracks(None)
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
def on_forward(self, stepsize):
|
def on_forward(self, stepsize):
|
||||||
|
Loading…
Reference in New Issue
Block a user