PipelineGUI

class PipelineGUI.PipelineGUI(parent, controller, projdir)[source]

Bases: AppWindow

PipelineGUI is a class that inherits from AppWindow. It creates and manages the internal pages of the app that appear when a project is running. The class handles the layout of the GUI and has event handlers for all buttons on the display.

Parameters:
  • parent (tkinter container) – passed from main to make the tkinter frame.

  • controller (main*) – a reference to main.

  • projdir (pathlib.Path) – Project directory containing .vrp file.

DEFAULT_CHART = WindowsPath('C:/Users/akuhl/Desktop/VirtualRocks/docs/gui/placeholder/blankchart.jpg')
DEFAULT_PREVIEW = WindowsPath('C:/Users/akuhl/Desktop/VirtualRocks/docs/gui/placeholder/drone.jpg')
_refresh_chart(e)[source]

Event handler called whenever a RefreshChart events occurs (in set_chart and change_chart_view). It sets the image displayed on the chart canvas to the currentchart set by set_chart. If the Tk app has been resized, then the chart image is resized, using _scale_image, to fit in the left column.

Parameters:

e (event) – a RefreshChart or Configure event

_scale_image(wwidth, wheight, iwidth, iheight, image)[source]

Helper method that scales an image to fit within a window defined by its width (wwidth) and height (wheight). It scales images without distortion (preserving the aspect ratio) by choosing the smaller scale calculated from the x and y axes.

Parameters:
  • wwidth (int) – window width.

  • wheight (int) – window height.

  • iwidth (int) – image width.

  • iheight (int) – image height.

  • image (image) – the image/chart to be scaled.

bounds_handler()[source]

Event handler for the “Trim Bounds” button, the optional step between the Matcher and Mesher. It makes a BoundsDialog object to prompt the user to set the minimum and maximum bounds for the x, y, and z axes of the generated point cloud. The inputted values are then passed to the set_bounds handler in main.

change_chart_view()[source]

Event handler for the “Change View” button under the chart, toggles between the heat map and elevation map views. Because of how different threads interact with the TK app, the chart uses a RefreshChart event to actually change, which the handler generates.

change_projdir()[source]

Event handler for the “Change” button under the printed workspace path, which gives the user an option to change the project directory. It makes a new project with the same name and image directory and removed the original from recents projects. If the user doesn’t select a new project directory (or if the path has a space), then the project directory doesn’t change.

log(msg)[source]

Method that writes strings to the log for display in the log textbox. Sets the log display to show the bottom of the log.

Parameters:

msg (string) – string to be printed on the log.

photos_handler()[source]

Event handler for the “Add Photos” button, the first step in the pipeline. It opens a dialog box propting the user to select the directory where their images are saved, which gets passed to the add_photos() handler in main. It updates the bar internally since it’s a nearly instantaneous step.

Note

Because of how Colmap uses file paths, paths (and therefor folders and files) cannot contain spaces. This method displays an error message when the user tries to use an image directory path that has a space in it.

set_chart(chartdir)[source]

Method to be called externally to set the chart image in the GUI. It’s called in main when the state is updated or bounds are set. Because of how different threads interact with the TK app, the chart uses a RefreshChart event to actually change, which the handler requests.

Parameters:

chartdir (pathlib.Path) – the path to the current chart to display.

set_example_image(imagefile)[source]

Method called externally to set the example image on the top right of the app. It allows the user to confirm that they’ve selected the right image directory before progressing through the pipeline.

Parameters:

imagefile (pathlib.Path) – the path to the example image to display.

setup_layout()[source]

Method that sets up the layout of the GUI, making all elements and placing them. The GUI is divided into left and right tkinter.ttk.Frame objects, into which chart and pipeline elements are assigned respectively. The elements are packed to ensure order and allow for resizing.

show_files()[source]

Event handler for the “Show Files” button, the last step in the pipeline that opens a file explorer window to show the user the contents of the “out” folder in the current project directory.

update_text(numimg)[source]

Method used to update the text displaying the number of images in the current image directory on the right button bar. Used by main when making a new project, opening an existing project, and when adding images/selecting an image directory.

Parameters:

numimg (int) – the number of images in the current image directory.