graphical_input.py

graphical_input.py#

class aviary.interface.graphical_input.AviaryMissionEditor[source]

Bases: Tk

Aviary mission editor class

__init__()[source]

Return a new top level widget on screen SCREENNAME. A new Tcl interpreter will be created. BASENAME will be used for the identification of the profile file (see readprofile). It is constructed from sys.argv[0] without extensions if None is given. CLASSNAME is the name of the widget class.

add_new_row()[source]

Updates data lists with a generic new point and runs redraw plot and update table. New point is added at x = halfway between last point and x limit, y = half of y limit

advanced_options_popup()[source]

Creates a popup window that allows user to edit advanced options for phase info. Options included are specified as a dict in __init__ and include solve/constrain for range, include landing/takeoff, polynomial order, and phase order. This function is triggered by the menu buttons

change_axes_popup()[source]

Creates a popup window that allows user to edit axes limits. This function is triggered by the menu buttons

change_rounding()[source]
change_units()[source]
check_data_info()[source]

Verifies data_info dict has consistent number of dependent variables

clear_plot()[source]

Clears all lines from plots except for crosshairs

close_popup()[source]

Function to close existing popup and refocus main window

close_window()[source]

Closes main window and saves persistent settings into a binary pickle file.

create_menu()[source]

Creates menu. Structure is specified as a dictionary, can add commands, separators, and checkbuttons.

create_plots()[source]

Creates subplots according to data_info dict. Sets labels and limits. Ties mouse events to appropriate internal functions.

create_table()[source]

Creates headers for table and sets column widths based on header lengths.

delete_point(row: int)[source]

When X button next to tabular point is pressed, lists are popped and plot and tables are updated to show the removed point.

display_rounding(value, col: int, extra=0)[source]

Returns a rounded value based on which variable the value belongs to. Uses rounding amount specified in data_info

generic_popup(pop_title='Popup', buttons_text=[])[source]

Function to create a base window for a popup. Returns popup object to be used for adding widget and configuring settings. Buttons_text can be used to specify any number of buttons. These button objects are returned for configuring commands and location.

get_distance(pt1: tuple, pt2: tuple, plot_idx: int)[source]

Returns a normalized distance value between 2 points. Normalization is based on the subplot’s x and y limits, subplot specified as plot_idx

get_phase_names()[source]

Returns a list of phase names, these are decided based on final and starting altitudes. These names are only used for the dropdown menu in advanced options, and are not connected to phase info phase names.

on_enter(event)[source]
on_leave(event)[source]
on_mouse_click(event)[source]

Called when mouse click is determined, adds new point if it is valid

on_mouse_move(event)[source]

Handles functionality related to mouse movement. Creates crosshair if mouse is inside a subplot and updates cursor if near a point that can be dragged. Also handles moving point on graph if it is being dragged.

on_mouse_press(event)[source]

Handles mouse press event, sets internal mouse state

on_mouse_release(event)[source]

Handles release of mouse button. Calls click function if mouse has not been dragged.

open_phase_info()[source]

Opens a dialog box to select a .py file with a phase info dict. File must contain a dict called phase_info. File can be placed in any directory.

place_popup()[source]

Generic popup lets Tkinter automatically size the popup to fit all contents. This function uses that size and main GUI window size/location to compute a location for the popup that is central to the GUI.

redraw_plot()[source]

Redraws plot, using the new values inside data lists

remind_store_settings()[source]
save(filename=None)[source]

Saves mission into a file as a phase info dictionary which can be used by Aviary. This function is also called by the save as function with a non-default filename.

save_as()[source]

Creates a file dialog that saves as a phase info. User can specify filename and location.

save_option_defaults()[source]

Saves default values for advanced options and axes limits, these will be referenced if user chooses to reset advanced options or axes limits

show_instructions()[source]

Shows a messagebox with instructions to use this utility.

temporary_notice()[source]
toggle_optimize_view()[source]

Runs update table with overwrite on to toggle display of optimize checkboxes

toggle_phase_slope(redraw=True)[source]
update_axes(units=False, limits=False, refresh=False)[source]
update_header(new_headers)[source]

Update header

update_list(value, index, axis)[source]

Updates internal data lists based on row,col values. col corresponds to dependent/independent variable. row corresponds to point number.

update_str_vars()[source]

Updates StringVar values for the table. Used when points are dragged on plot

update_table(overwrite=False, bool_list=None)[source]

This function handles both adding a new entry to table and overwriting the whole table. Overwriting causes all table widgets to be destroyed and a new set of widgets to be created. This also resets the StringVars.

update_theme(toggle=False)[source]

Called by theme toggle button and start of app, changes color settings for widgets based on current theme.

class aviary.interface.graphical_input.VerticalScrolledFrame(parent, *args, **kw)[source]

Bases: Frame

A pure Tkinter scrollable frame that actually works! * Use the ‘interior’ attribute to place widgets inside the scrollable frame. * Construct and pack/place/grid normally. * This frame only allows vertical scrolling. —— Taken from https://stackoverflow.com/questions/16188420/tkinter-scrollbar-for-frame

__init__(parent, *args, **kw)[source]

Construct a frame widget with the parent MASTER.

Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, relief, takefocus, visual, width.

aviary.interface.graphical_input.create_phase_info(times, altitudes, mach_values, units, polynomial_order, num_segments, optimize_mach_phase_vars, optimize_altitude_phase_vars, user_choices, orders, filename='outputted_phase_info.py')[source]

Creates a dictionary containing the information about different flight phases based on input times, altitudes, and Mach values.

The information includes details such as duration bounds, initial guesses, and various options for optimization and control for each phase.

Parameters:
  • times (list of float) – The times at which phase changes occur, given in minutes.

  • altitudes (list of float) – The altitudes corresponding to each phase, given in feet.

  • mach_values (list of float) – The Mach numbers corresponding to each phase.

Returns:

A dictionary with all the phase information, including bounds and initial guesses.

Return type:

dict

aviary.interface.graphical_input.estimate_total_range_trapezoidal(times, mach_numbers, units)[source]

Source: original Aviary graphical_input.py.

aviary.interface.graphical_input.get_screen_geometry()[source]

Taken from: https://stackoverflow.com/questions/3129322/how-do-i-get-monitor-resolution-in-python/56913005#56913005 Workaround to get the size of the current screen in a multi-screen setup.