zooui.windows.mainwindow module

ZooUI QMainWindow.

class zooui.windows.mainwindow.MainWindow(framerate=20, zoom_sensitivity=50, icon=None, config=None, autosave_config=None)[source]

Bases: QMainWindow

Constructor :

MainWindow(framerate, zoom_sensitivity)

Parameters :

framerate : int zoom_sensitivity : int

MainWindow(framerate, zoom_sensitivity) –> None

MainWindow windows are used for displaying the ZooUI interface. This class defines all the interface affordances, menus, widgets, frames etc. Framerate and zoom_sensitivity variables have to be declared the same value as in qzui class

Create a new MainWindow.

Parameters:
  • framerate – Frame rate for the QZUI widget

  • zoom_sensitivity – Zoom sensitivity for the QZUI widget

  • icon – Optional QIcon to set as window icon

  • config – Optional full application configuration dictionary

  • autosave_config – Optional autosave configuration dictionary

__init__(framerate=20, zoom_sensitivity=50, icon=None, config=None, autosave_config=None)[source]

Create a new MainWindow.

Parameters:
  • framerate – Frame rate for the QZUI widget

  • zoom_sensitivity – Zoom sensitivity for the QZUI widget

  • icon – Optional QIcon to set as window icon

  • config – Optional full application configuration dictionary

  • autosave_config – Optional autosave configuration dictionary

sizeHint()[source]
Method :

MainWindow.sizeHint()

Parameters :

None

MainWindow.sizeHint() –> QtCore.QSize

Return the recommended size for the widget.

minimumSizeHint()[source]
Method :

MainWindow.minimumSizeHint()

Parameters :

None

MainWindow.minimumSizeHint() –> QtCore.QSize

Return the minimum size hint for the widget.

property current_zui
Property:

MainWindow.current_zui

Parameters :

None

MainWindow.current_zui –> QZUI

Return the QZUI instance of the currently active tab.

property zui

Backward-compatible property returning the current tab’s QZUI.

_add_tab(title='Untitled')[source]
Method :

MainWindow._add_tab(title)

Parameters :

title : str

MainWindow._add_tab(title) –> int

Create a new tab with a fresh QZUI and Scene. Returns the tab index.

_close_tab(index)[source]
Method :

MainWindow._close_tab(index)

Parameters :

index : int

MainWindow._close_tab(index) –> None

Close the tab at the given index. Prevents closing the last remaining tab. Stops autosave and purges tiles for the closed scene.

_on_tab_changed(index)[source]
Method :

MainWindow._on_tab_changed(index)

Parameters :

index : int

MainWindow._on_tab_changed(index) –> None

Handle tab change: set focus on the new active QZUI and update window title.

__update_window_title()

Update the window title to reflect the current tab.

__show_error(text, details)
Method :

MainWindow.__show_error(text, details)

Parameters :

text : str details : Any

MainWindow.__show_error(text, details) –> None

Show an error dialog with the given text and details.

__create_action(key, text, callback=None, shortcut=None, checkable=False)
Method :

MainWindow.__create_action(key, text, callback, shortcut, checkable)

Parameters :

key : str text : str callback : Optional[Any] shortcut : Optional[str] checkable : bool

MainWindow.__create_action(key, text, callback, shortcut, checkable) –> None

Create a QAction and store it in self.__action[key].

__action_new_scene()
Method :

MainWindow.__action_new_scene()

Parameters :

None

MainWindow.__action_new_scene() –> None

Create a new scene in the current tab.

__action_new_tab()
Method :

MainWindow.__action_new_tab()

Parameters :

None

MainWindow.__action_new_tab() –> None

Create a new tab with a fresh scene.

__action_close_tab()
Method :

MainWindow.__action_close_tab()

Parameters :

None

MainWindow.__action_close_tab() –> None

Close the current tab.

__action_open_scene()
Method :

MainWindow.__action_open_scene()

Parameters :

None

MainWindow.__action_open_scene() –> None

Open a scene from the location chosen by the user in a file selection dialog into the current tab.

__action_open_scene_home()
Method :

MainWindow.__action_open_scene_home()

Parameters :

None

MainWindow.__action_open_scene_home() –> None

Open the Home scene in the current tab.

__action_import_scene()
Method :

MainWindow.__action_import_scene()

Parameters :

None

MainWindow.__action_import_scene() –> None

Import a scene from the location chosen by the user in a file selection dialog, merging it into the current tab’s scene.

__action_save_scene()
Method :

MainWindow.__action_save_scene()

Parameters :

None

MainWindow.__action_save_scene() –> None

Save the scene or selected mediaobjects to the location chosen by the user in a file selection dialog.

If mediaobjects are selected, saves only the selection with “0 0 0” as the first line in the PZS file, preserving relative positions. If no selection, saves the entire scene.

__action_save_screenshot()
Method :

MainWindow.__action_save_screenshot()

Parameters :

None

MainWindow.__action_save_screenshot() –> None

Save a screenshot to the location chosen by the user in a file selection dialog.

__action_ocr_screenshot()
__handle_ocr_region(image)
static _get_pdf_page_count(pdf_path)[source]

Get page count from a PDF file using pdfinfo.

pdfinfo is part of the Poppler suite and is typically installed alongside pdftoppm.

__show_pdf_page_dialog(pdf_path, page_count)

Show a dialog asking which page to open for a large PDF.

Returns the 0-indexed page number, or None if cancelled.

__open_media(media_id, add=True)
Method :

MainWindow.__open_media(media_id, add)

Parameters :

media_id : str add : bool

MainWindow.__open_media(media_id, add) –> Optional[Any]

Open the media with the given media_id.

If add is True then the media will be fit to the screen and added to the scene. Otherwise it will be returned.

For PDF files larger than 2 MB, a page selection dialog is shown allowing the user to choose which page to open at.

__action_open_media_local()
Method :

MainWindow.__action_open_media_local()

Parameters :

None

MainWindow.__action_open_media_local() –> None

Open media from the location chosen by the user in a file selection dialog.

__action_open_media_string()
Method :

MainWindow.__action_open_media_string()

Parameters :

None

MainWindow.__action_open_media_string() –> None

Render string given by the user in an input dialog.

__action_open_svg_pick()
Method :

MainWindow.__action_open_svg_pick()

Parameters :

None

MainWindow.__action_open_svg_pick() –> None

Open SVG file selected by the user in a picker dialog.

SUPPORTED_EXTENSIONS = {'.avif', '.bmp', '.gif', '.heic', '.heif', '.jpeg', '.jpg', '.jxl', '.pdf', '.png', '.ppm', '.svg', '.tif', '.tiff', '.webp'}
__action_open_media_dir()
Method :

MainWindow.__action_open_media_dir()

Parameters :

None

MainWindow.__action_open_media_dir() –> None

Open media from the directory chosen by the user in a file selection dialog. Only files with supported extensions are opened.

__action_set_fps(act)
Method :

MainWindow.__action_set_fps(act)

Parameters :

act : QtGui.QAction

MainWindow.__action_set_fps(act) –> None

Set the framerate to the value specified in act.

__action_fullscreen()
Method :

MainWindow.__action_fullscreen()

Parameters :

None

MainWindow.__action_fullscreen() –> None

Toggles fullscreen mode.

__action_toggle_render_order()
Method :

MainWindow.__action_toggle_render_order()

Parameters :

None

MainWindow.__action_toggle_render_order() –> None

Toggle render order between smaller_on_top and larger_on_top.

__action_about()
Method :

MainWindow.__action_about()

Parameters :

None

MainWindow.__action_about() –> None

Display the ZooUI about dialog.

__action_about_qt()
Method :

MainWindow.__action_about_qt()

Parameters :

None

MainWindow.__action_about_qt() –> None

Display the Qt about dialog.

__action_usage()
Method :

MainWindow.__action_usage()

Parameters :

None

MainWindow.__action_usage() –> None

Display the Usage Instructions dialog from the RST documentation.

__action_save_and_quit()
Method :

MainWindow.__action_save_and_quit()

Parameters :

None

MainWindow.__action_save_and_quit() –> None

Calls the __action_save_scene and then quit.

__action_confirm_quit()
Method :

MainWindow.__action_confirm_quit()

Parameters :

None

MainWindow.__action_confirm_quit() –> None

Ask user if it really wants to quit.

__action_set_zoom_sensitivity()
Method :

MainWindow.__action_set_zoom_sensitivity()

Parameters :

None

MainWindow.__action_set_zoom_sensitivity() –> None

Set the zoom sensitivity for the ZUI.

__action_copy()
Method :

MainWindow.__action_copy()

Parameters :

None

MainWindow.__action_copy() –> None

Handle Copy menu action.

__action_paste()
Method :

MainWindow.__action_paste()

Parameters :

None

MainWindow.__action_paste() –> None

Handle Paste menu action.

__action_set_home_point()
Method :

MainWindow.__action_set_home_point()

Parameters :

None

MainWindow.__action_set_home_point() –> None

Handle Set Home Point menu action.

__action_go_to_home_point()
Method :

MainWindow.__action_go_to_home_point()

Parameters :

None

MainWindow.__action_go_to_home_point() –> None

Handle Go to Home Point menu action.

__action_autosave_settings()
Method :

MainWindow.__action_autosave_settings()

Parameters :

None

MainWindow.__action_autosave_settings() –> None

Handle Autosave Settings menu action.

__action_zoom_settings()
Method :

MainWindow.__action_zoom_settings()

Parameters :

None

MainWindow.__action_zoom_settings() –> None

Handle Zoom Settings menu action.

__create_actions()
Method :

MainWindow.__create_actions()

Parameters :

None

MainWindow.__create_actions() –> None

Create the QActions required for the interface.

__create_menus()
Method :

MainWindow.__create_menus()

Parameters :

None

MainWindow.__create_menus() –> None

Create the menus.

showEvent(event)[source]
Method :

MainWindow.showEvent(event)

Parameters :

event : QtGui.QShowEvent

MainWindow.showEvent(event) –> None

Handle show event by focusing the current tab’s QZUI widget.

staticMetaObject = PySide6.QtCore.QMetaObject("MainWindow" inherits "QMainWindow": )

See Also

  • zooui/objects/scene/scene - Scene management and QZUI widget

  • zooui/windows/dialogwindows/dialogwindows - Dialog window base classes

  • zooui/config - Configuration management

  • logger - Logging system