-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
32e081c
commit 522be9a
Showing
3 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
MethodicConfigurator/frontend_tkinter_template_overview_window.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env python3 | ||
|
||
''' | ||
This file is part of Ardupilot methodic configurator. https://github.com/ArduPilot/MethodicConfigurator | ||
(C) 2024 Amilcar do Carmo Lucas | ||
SPDX-License-Identifier: GPL-3 | ||
''' | ||
|
||
import tkinter as tk | ||
from tkinter import ttk | ||
|
||
from middleware_template_overview import TemplateOverview | ||
|
||
class TemplateOverviewWindow: | ||
def __init__(self): | ||
self.window = tk.Tk() | ||
self.window.title("ArduPilot methodic configurator - Template Overview") | ||
self.window.geometry("600x400") | ||
|
||
self.template_overview = TemplateOverview() | ||
|
||
# Define the columns for the Treeview | ||
columns = ("FC Manufacturer", "FC Model", "TOW Min [KG]", "TOW Max [KG]", "RC Protocol", "Telemetry Model", "ESC Protocol", "Prop Diameter [inches]", "GNSS Model") | ||
self.tree = ttk.Treeview(self.window, columns=columns, show='headings') | ||
for col in columns: | ||
self.tree.heading(col, text=col) | ||
|
||
# Populate the Treeview with data from the template overview | ||
for item in self.template_overview.__dict__.values(): | ||
self.tree.insert('', 'end', values=(item)) | ||
|
||
self.tree.pack(fill=tk.BOTH, expand=True) | ||
|
||
self.window.mainloop() | ||
|
||
if __name__ == "__main__": | ||
app = TemplateOverviewWindow() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env python3 | ||
|
||
''' | ||
This file is part of Ardupilot methodic configurator. https://github.com/ArduPilot/MethodicConfigurator | ||
(C) 2024 Amilcar do Carmo Lucas | ||
SPDX-License-Identifier: GPL-3 | ||
''' | ||
|
||
class TemplateOverview: | ||
def __init__(self): | ||
self.fc_manufacturer = None | ||
self.fc_model = None | ||
self.tow_min_kg = None | ||
self.tow_max_kg = None | ||
self.rc_protocol = None | ||
self.telemetry_model = None | ||
self.esc_protocol = None | ||
self.prop_diameter_inches = None | ||
self.gnss_model = None | ||
|
||
def load_template_overview(self, components_data: dict): | ||
self.fc_manufacturer = components_data.get('Flight Controller', {}).get('Product', {}).get('Manufacturer') | ||
self.fc_model = components_data.get('Flight Controller', {}).get('Product', {}).get('Model') | ||
self.tow_min_kg = components_data.get('Frame', {}).get('Product', {}).get('tow_min_kg') | ||
self.tow_max_kg = components_data.get('Frame', {}).get('Product', {}).get('tow_max_kg') | ||
self.rc_protocol = components_data.get('RC Receiver', {}).get('Product', {}).get('Model') | ||
self.telemetry_model = components_data.get('Telemetry', {}).get('Product', {}).get('Model') | ||
self.esc_protocol = components_data.get('Battery Monitor', {}).get('Product', {}).get('Manufacturer') | ||
self.prop_diameter_inches = components_data.get('Battery Monitor', {}).get('Product', {}).get('Model') | ||
self.gnss_model = components_data.get('Battery', {}).get('Specifications', {}).get('Model') |