Finish wiring up SAM orientation control.

The UI works beautifully, but that's not worth much if it doesn't
actually change the data...

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2479.
This commit is contained in:
Dan Albert 2023-05-16 18:21:25 -07:00
parent 418d78f99b
commit 889e1f5da2

View File

@ -163,8 +163,8 @@ class QGroundObjectMenu(QDialog):
self.orientationBox = QGroupBox("Orientation :") self.orientationBox = QGroupBox("Orientation :")
self.orientationBoxLayout = QHBoxLayout() self.orientationBoxLayout = QHBoxLayout()
heading_image = HeadingIndicator(self.ground_object.heading, self) self.heading_image = HeadingIndicator(self.ground_object.heading, self)
self.orientationBoxLayout.addWidget(heading_image) self.orientationBoxLayout.addWidget(self.heading_image)
self.headingLabel = QLabel("Heading:") self.headingLabel = QLabel("Heading:")
self.orientationBoxLayout.addWidget(self.headingLabel) self.orientationBoxLayout.addWidget(self.headingLabel)
self.headingSelector = QSpinBox() self.headingSelector = QSpinBox()
@ -174,7 +174,7 @@ class QGroundObjectMenu(QDialog):
self.headingSelector.setSingleStep(5) self.headingSelector.setSingleStep(5)
self.headingSelector.setValue(self.ground_object.heading.degrees) self.headingSelector.setValue(self.ground_object.heading.degrees)
self.headingSelector.valueChanged.connect( self.headingSelector.valueChanged.connect(
lambda degrees: heading_image.set_heading(Heading(degrees)) lambda degrees: self.rotate_tgo(Heading(degrees))
) )
self.orientationBoxLayout.addWidget(self.headingSelector) self.orientationBoxLayout.addWidget(self.headingSelector)
if self.cp.captured: if self.cp.captured:
@ -184,7 +184,7 @@ class QGroundObjectMenu(QDialog):
or self.ground_object.heading or self.ground_object.heading
) )
self.head_to_conflict_button.clicked.connect( self.head_to_conflict_button.clicked.connect(
lambda: self.rotate_tgo(heading) lambda: self.headingSelector.setValue(heading.degrees)
) )
self.orientationBoxLayout.addWidget(self.head_to_conflict_button) self.orientationBoxLayout.addWidget(self.head_to_conflict_button)
else: else:
@ -250,7 +250,7 @@ class QGroundObjectMenu(QDialog):
def rotate_tgo(self, heading: Heading) -> None: def rotate_tgo(self, heading: Heading) -> None:
self.ground_object.rotate(heading) self.ground_object.rotate(heading)
self.do_refresh_layout() self.heading_image.set_heading(heading)
def sell_all(self): def sell_all(self):
self.update_total_value() self.update_total_value()