Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opening a telemetry screen with a button on another telemetry screen #1793

Open
KodiakLiDAR opened this issue Oct 26, 2022 · 1 comment
Open

Comments

@KodiakLiDAR
Copy link

Hello OpenC3 Team,

I would like to open one telemetry (child screen) screen by clicking a button on another telemetry screen (master screen).

I'd like to have one "master" telemetry screen with a series of buttons (one for each sub-system) that will open a "child" telemetry screen with relevant data for each button's respective subsystem.

Essentially, wondering if capability exists for developing a telemetry screen button that will launch a separate telemetry screen.

Thanks so much for any and all help.

Kindly,
Kodiak

@AbdelAzizMohamedMousa
Copy link

Yes, it is possible to develop a telemetry screen button that will launch a separate telemetry screen. Here's an example code snippet in Python that demonstrates how to do it using the PyQt5 library:
`from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton

class MasterTelemetryScreen(QMainWindow):
def init(self):
super().init()
self.setWindowTitle("Master Telemetry Screen")

    button1 = QPushButton("Subsystem 1", self)
    button1.setGeometry(50, 50, 100, 30)
    button1.clicked.connect(lambda: self.open_child_screen("Subsystem 1"))

    button2 = QPushButton("Subsystem 2", self)
    button2.setGeometry(50, 100, 100, 30)
    button2.clicked.connect(lambda: self.open_child_screen("Subsystem 2"))

def open_child_screen(self, subsystem):
    child_screen = ChildTelemetryScreen(subsystem)
    child_screen.show()

class ChildTelemetryScreen(QMainWindow):
def init(self, subsystem):
super().init()
self.setWindowTitle(f"{subsystem} Telemetry Screen")

    # Add widgets and set layout for the child screen here

app = QApplication([])
master_screen = MasterTelemetryScreen()
master_screen.show()
app.exec_()
`

In this example, the MasterTelemetryScreen class represents the master screen with buttons for each subsystem, and the ChildTelemetryScreen class represents the child screen that will be opened when a button is clicked.

Each button is connected to a lambda function that calls the open_child_screen method of the MasterTelemetryScreen class with the appropriate subsystem name as an argument.

The open_child_screen method creates an instance of the ChildTelemetryScreen class with the subsystem name passed as a parameter, and then shows the child screen using the show method.

You can customize the ChildTelemetryScreen class to add widgets and layout as needed to display the telemetry data for the selected subsystem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants