main module
- class main.App(*args, **kwargs)[source]
Bases:
CTk
Master window of the program.
- add_to_queue(index=None)[source]
Adds an image to the Render queue.
- Parameters:
index (int, optional) – Index of the image to add to the Render queue, Default is the index of the currently displayed image.
- Returns:
None
- blue_entry_event(event)[source]
Called on updating the blue_slider_value_entry.
- Parameters:
event (tkinter.Event) –
- Returns:
None
- blue_slider_event(event=None, color_value=None)[source]
Called on blue_slider value update.
- Parameters:
event (tkinter.Event) –
color_value (str,optional) – RGB color value of range 0 to 255
- Returns:
None
- cache_data(protocol)[source]
Generates a dictionary from the loaded data.
- Parameters:
protocol (str) – “images” or “project”
- Returns:
None
- cel_opacity_slider_event_handler(value)[source]
Called on value update from the opacity_slider, Changes the opacity of the cel.
- Parameters:
value – Range from 0 to 1.
- Returns:
None
- change_stroke_width(event)[source]
Uses the mouse scroll wheel to update the width_slider.
- Parameters:
event (tkinter.Event) – Mouse scroll event.
- Returns:
None
- configure_button_functionality()[source]
Disables the functionality of the Media buttons if the index has reached the limit.
- Returns:
None
- create_graphics_data_dict()[source]
Creates the graphics_data and proxy_data dictionary with keys starting from index -2 to number of total images and empty dictionary as values.
- Returns:
None
- create_image_tools_panel()[source]
Creats the bottom tools panel for Image and Scale Controls.
- Returns:
None
Creates a RenderMenu toplevel window and displays the Render Menu window.
- Parameters:
batch (bool) – True adds all images in queue to render. False renders the current image. Default True.
- Returns:
None
- create_settings_dict()[source]
Creating a dictionary with the settings values used in the RenderMenu and assigns to self.settings_data.
- Returns:
None
- decimate_slider_event(event)[source]
Called on updating the decimate_slider.
- Parameters:
event (tkinter.Event) –
- Returns:
None
- drag_canvas(event)[source]
Pans the canvas.
- Parameters:
event (tkinter.Event) – Mouse Drag event.
- Returns:
None
- edit_data()[source]
- Decorator responsible for updating the text and settings to the project dictionary as well as
updating the UI elements before and after displaying a different image.
- fetch_from_outline(index: int, event=None)[source]
Display the image according to the index(button) selected on the outliner.
- Parameters:
index (int) – Index of the image to set as current image_index.
event (tkinter.Event) – Mouse click event.
- Returns:
None
- fetch_slider_color(event=None)[source]
Fetches the RGB colors from the color slider and sets as active color.
- Parameters:
event (tkinter.Event) –
- Returns:
None
- flush_image_objects_from_overlaycache()[source]
Removes the PIL.IMAGE objects from the overlaycache dictionary.
- Returns:
None
- get_queue_status(index: int = None)[source]
Get the queue status of the index.
- Parameters:
index (int,optional) – Index to check for queue status. Default is the current index.
- Returns:
True if index is queued, False if not queued.
- Return type:
bool
- get_rel_height(times)[source]
Gets the relative height value proportional to the screen height.
- Parameters:
times (float) – A float value that multiplies the screen height.
- Returns:
The relative height as an integer.
- Return type:
int
- get_rel_width(times)[source]
Gets the relative width value proportional to the screen width.
- Parameters:
times (float) – A float value that multiplies the screen width.
- Returns:
The relative width as an integer.
- Return type:
int
- green_entry_event(event)[source]
Called on updating the green_slider_value_entry.
- Parameters:
event (tkinter.Event) –
- Returns:
None
- green_slider_event(event=None, color_value=None)[source]
Called on green_slider value update.
- Parameters:
event (tkinter.Event) –
color_value (str,optional) – RGB color value of range 0 to 255
- Returns:
None
- handle_hide_annotations_btn(enable: bool = None)[source]
Method called on toggling the hide_annotations_btn
- Parameters:
enable (bool,optional) – If True sets the button to active.
- Returns:
None
- handle_hq_view_btn()[source]
Sets the resampling algorithm to Image.LANCZOS resulting in a higher quality image.
- Returns:
None
- handle_queue()[source]
Adds or removes the image from the render queue based on the value from queue_switch button.
- Returns:
None
- has_annotation(index: int = None)[source]
Checks if the Image in the provided index has any annotations.
- Parameters:
index (int,optional) – Index of the image to check for annotation, Default is the current viewed image.
- Returns:
True if the index has annotations, else False.
- Return type:
bool
- load_project(project_path: str, images_folder_override_path=None, ignore_missing_images: bool = False)[source]
Gets the Project file from the file load window.
- Parameters:
project_path (str) – Path to the project file.
images_folder_override_path (str|None,optional) – Path containing the images used in the saved project.
ignore_missing_images (bool) – True generates blank placeholder images for missing images. False raises error if images not found. Default False.
- Returns:
None
- load_user_settings(reset: bool = False)[source]
Loads the user settings from the settings.json file.
- Parameters:
reset (bool) – If True, replaces the settings.json with a new file with default user settings.
- Returns:
None
- on_mouse_enter(index, event=None)[source]
Called on hovering the mouse over the outliner. If shift key pressed during the hover, display full file name in the outliner.
- Parameters:
index (int) – Index value of the outliner index hovered over.
event (tkinter.Event) – Mouse position.
- Returns:
None
- on_mouse_leave(event=None, index: int = None, override: bool = False)[source]
Called when cursor leaves the outliner. Removes the full filename element from the outliner.
- Parameters:
index (int) – Index value of the outliner index hovered over.
event (tkinter.Event) – Mouse position.
override (bool) – True removes the full filename element bypassing any conditions. Default False
- Returns:
None
- on_right_click(*args, index: int)[source]
Toggles the queue status of the index based on the index right-clicked on the outliner.
- Parameters:
index (int) – Index is hardcoded to each Index elements in the outliner at the time of Outliner creation.
- Returns:
None
- opacity_slider_event_handler(value)[source]
Sets the opacity of the selected overlay image.
- Parameters:
value – Range 0 to 100
- Returns:
None
- pick_color(event=None, color=None, canvas: CTkCanvas = None)[source]
Picks a color value(pixel) from the canvas.
- Parameters:
event (tkinter.Event) – Mouse cordiantes for the picked pixel.
color (str, optional) – Hex Color Code
canvas (ctk.CTkCanvas, optional) – If no canvas is provided, picker will pick colors from the rgb_picker_canvas.
- Returns:
None
- red_entry_event(event)[source]
Called on updating the red_slider_value_entry.
- Parameters:
event (tkinter.Event) –
- Returns:
None
- red_slider_event(event=None, color_value=None)[source]
Called on red_slider value update.
- Parameters:
event (tkinter.Event) –
color_value (str,optional) – RGB color value of range 0 to 255
- Returns:
None
- remove_from_queue(index=None)[source]
Removes an image from the Render queue.
- Parameters:
index (int, optional) – Index of the image to add to the Render queue, Default is the index of the currently displayed image.
- Returns:
None
- rescale_tools_panel()[source]
Rescales the tools panel to adapt to the new window size.
- Returns:
None
- reset_scale_slider(event)[source]
Resets the scale slider to middle position on mouse release.
- Parameters:
event – Mouse click release event.
- Returns:
None
- rotation_slider_event_handler(value=None, increment=None)[source]
Rotates the selected overlay image based on the slider value.
- Parameters:
value – Range 0 to 360.
increment –
or - that increments the current rotation by +1 or -1.
- Returns:
None
- save_data(from_exit_prompt: bool = False)[source]
Saves the current project_data dictionary as a .rvp (pickle) file.
- Parameters:
from_exit_prompt (bool) – Whether the method is being called from the exit_prompt. (to set parent for the asksaveasfilename).Default False.
- Returns:
True if saved, False if failed. None, if operation cancelled.
- Return type:
bool|None
- scale_slider_event_handler(value=None, increment: str = None)[source]
Scales the selected text item or selected overlay image.
- Parameters:
value – A multiplier value that scales the image/text times the current image/text size.
increment (str) – “+” or “-” that increments or decrements the item scale by 1.
- Returns:
None
- scroll_to_view()[source]
Scrolls the Outliner till the current filename/sequence becomes visible in the outliner.
- Returns:
None
- set_active_color(color=None)[source]
Sets active color from other means like color picker.
- Parameters:
color (str, optional) – Hex color code to set as active color.
Returns:
- set_drag(event)[source]
Sets the starting drag point on the canvas for panning.
- Parameters:
event (tkinter.Event) – Mouse click position.
- Returns:
None
- set_opacity_slider(value)[source]
Sets the opacity slider to the provided value.
- Parameters:
value – Value from range 0 to 1
- Returns:
None
- set_rotation_slider(value)[source]
Sets the rotation slider to the value provided.
- Parameters:
value (int) – Range 0 to 360
Returns:
- show_actual_scale()[source]
Displays the current image in its actual size, 1:1 ratio.
- Returns:
None
- show_first_img(force_first=False, event=None)[source]
Shows the first image.
- Parameters:
event (tkinter.Event) – Button click event.
- Returns:
None
- show_last_img(event=None)[source]
Shows the last image.
- Parameters:
event (tkinter.Event) – Button click event.
- Returns:
None
- show_next_img(event=None)[source]
Shows the next image.
- Parameters:
event (tkinter.Event) – Button click event.
- Returns:
None
- show_previous_img(event=None)[source]
Shows the previous image.
- Parameters:
event (tkinter.Event) – Button click event.
- Returns:
None
- toggle_image_control_buttons(toggle)[source]
Toggles the state of the Display Image Control buttons (top).
- Parameters:
toggle (int) – 0 to disable ,1 to set state to normal.
Returns:
- toggle_image_tools_buttons(toggle, only_reset=False)[source]
Toggles the state of image tools button.
- Parameters:
toggle (int) – 1 sets the state to normal , 0 sets state to disabled.
only_reset (bool) – Toggles the state of only the image_reset_btn. Default False.
- Returns:
None
- toggle_image_tools_sliders(toggle, only_scale=False)[source]
Toggles the state of the image tools sliders.
- Parameters:
toggle (int) – 1 sets the state to normal , 0 sets state to disabled.
only_scale (bool) – Toggles the state of only the scale_slider. Default False.
- Returns:
None
- toggle_media_buttons(toggle: int)[source]
Toggles the state of the media buttons.
- Parameters:
toggle (int) – 0 to disable ,1 to set state to normal.
- Returns:
None
- toggle_overlay_canvas(override=False, rescaled=False)[source]
Toggles the display of the overlay_canvas.
- Parameters:
override (bool) – If True display the overlay_canvas irrespective of current state.Default False
rescaled (bool) – If False reset the Base Canvas to default state. Default False.
- Returns:
None
- update_filename()[source]
Updates the filename on the left lowerside with the name of the current displayed image.
- Returns:
None
- update_outliner_color(index=None, has_annotation=None, is_queued=True)[source]
Updates the color of the Outliner index based on the status of the index.
- Args:
has_annotation= True if the index has annotation. Default is False. is_queued (bool):True if the index is in queue. Default is True
- Returns:
None
- update_outliner_selection(has_annotation=False, is_queued=True)[source]
Updates the color of the outliner index selection based on the status of the index.
- Parameters:
False. (has_annotation= True if the index has annotation. Default is) –
is_queued (bool) – True if the index is in queue. Default is True
- Returns:
None
- update_queue_switch(is_queued=True)[source]
Updates the state of the queue switch without calling the command.
- Parameters:
is_queued (bool) – Default is True
- Returns:
None
- update_user_settings()[source]
Converts values from the user settings json file into variables.
- Returns:
None
- validate_rgb_input_values(P)[source]
Validates the manual value input on the color sliders.
- Parameters:
P – Should be an int of range 0 to 255
- Returns:
False if conditions not met.
- width_slider_event(event)[source]
Called on updating the width_slider.
- Parameters:
event (tkinter.Event) –
- Returns:
None
- window_resize(event=None, state=None)[source]
Called on change in window size.
- Parameters:
event (tkinter.Event) – Event object
state (str) – “x” represents the initial state, “m” for maximzied and “w” for windowed.
- Returns:
None
- zoom_image(event=0, lock_zoom: bool = False)[source]
Zooms the current image with the mouse cursor as anchor.
- Parameters:
event (tkinter.Event) – Mouse Position to anchor the zoom.
lock_zoom (bool) – If True,stores zoom value and scroll position and applies it to the next displayed image.
- Returns:
None
- class main.ErrorPrompt(master, *args, **kwargs)[source]
Bases:
CTkButton
A ctk button repurposed to be an Error Popup within the image frame.
- animate_error_prompt()[source]
Method that slightly animates the error prompt entering and leaving the image_frame.
- Returns:
None
- display_error_prompt(error_msg: str, priority=2)[source]
Displays the error prompt window with the error message.
- Parameters:
error_msg (str) – The error message to display.
priority (int) – Integer values of 1,2,3 representing the priority of the error. 1=red,3=green. Default 2=Orange.
- Returns:
None
- class main.ExitPrompt(app, *args, **kwargs)[source]
Bases:
CTkToplevel
Toplevel window that handles the exit prompt.
- class main.FileLoadWindow(app, *args, **kwargs)[source]
Bases:
CTkToplevel
Toplevel window that handles loading and verifying of Images and Project files.
- browse_images()[source]
Browse and load Images and sets the current_protocol to “images”.
- Returns:
None
- browse_project()[source]
Browse and load a saved project file and sets the current_protocol to “project”.
- Returns:
None
- call_load_files()[source]
Loads images or project and calls the load_images method on App.
- Returns:
None
- change_protocol(new_protocol)[source]
Change the protocol between “images” , “project” or “fail”.
- Parameters:
new_protocol (str) – Current protocol to use.
- Returns:
None
- clear_file_list()[source]
Clears all variables and resets the FileLoad window to initial state.
- Returns:
None
- folder_override_entrybox_updated(*args)[source]
Called when path_override_entry box is updated with a value. If the entry box is empty disable the ignore_missing_image checkbox.
- Parameters:
*args –
- Returns:
None
- get_rel_width(times)[source]
Method that returns a relative width of the window times a value.
- Parameters:
times (float) – A value that multiplies the window width.
- Returns:
Resulting float value.
- Return type:
float
- set_sequence_search_mode(choice: str)[source]
Called on selecting a search mode from the dropdown menu in the FileLoad window. Sets the sequence search mode to the selected mode.
- Parameters:
choice – Sequence search mode to extract the sequence pattern from the filenames. Deafault “auto”.
- Returns:
None
- update_file_list_box(string: str = '', count: int = 0)[source]
Updates the textbox on the file load window.
- Parameters:
string (str) – Text to display
count (int) – Count of files loaded.
- Returns:
None
- update_file_window_progressbar(progress: float, progress_color: str = None)[source]
Updates the file_load_progressbar.
- Parameters:
progress (float) – A float of range 0 to 1.0 with 1.0 filling the progressbar 100%.
progress_color (str) – A hex color value for the progression color in the progressbar.
- Returns:
None
- class main.RenderMenu(app, batch: bool, *args, **kwargs)[source]
Bases:
CTkToplevel
Toplevel window that handles the render settings and starting the render.
- jpeg_quality_slider_event_handler(value)[source]
Called on updating the jpeg_quality_slider.
- Returns:
None
- overlay_trim_checkbox_handler()[source]
Called on toggling the trim_overlay_checkbox.
- Returns:
None
- pick_path()[source]
Opens a filedialog.askdirectory window for the user to set a folder path for the output images.
- Returns:
None
- render_overlay_checkbox_handler()[source]
Called on toggling the render_overlay_checkbox. :returns: None
- start_render(batch: bool = True)[source]
Starts the render process by calling the render_images method from ImageProcessor.
- Parameters:
batch (bool) – True sets the mode to batch and adds all images in queue to render.False renders the current image in view. Default True
- Returns:
None
- update_progress_bar(progress: float, status: bool)[source]
Updates the render_progressbar widget on the RenderMenu window based on the files processed.
- Parameters:
progress (float) – A value between 0-1.
status (bool) – True indicates a success transfer, False indicates a failed render.
- Returns:
None