pic_scanner.gui.models.windows.main
Subpackages
Attributes
Classes
A metaclass to enhance classes with logging capabilities. Classes that inherit from |
Functions
|
Context manager to set and unset a private flag attribute in an instance. |
Package Contents
- pic_scanner.gui.models.windows.main.flag_lock(instance, flag_name)
Context manager to set and unset a private flag attribute in an instance.
This context manager ensures that a specified private flag attribute in the given instance is set to True when entering the context and reset to False upon exiting the context. This is useful for indicating that an operation is in progress within a specific scope.
- Parameters:
instance (object) – The instance containing the private flag attribute.
flag_name (str) – The name of the flag attribute (without leading underscore).
- Raises:
AttributeError – If the instance does not have the specified private flag attribute.
- Example usage:
handler = OperationHandler() with flag_lock(handler, ‘flag’):
# Perform some operation pass
This will automatically set handler._flag to True within the context and reset it to False when exiting the context.
- pic_scanner.gui.models.windows.main.PARENT_LOGGER
- pic_scanner.gui.models.windows.main.MOD_LOGGER
- pic_scanner.gui.models.windows.main.make_window_template()
- pic_scanner.gui.models.windows.main.Window
- class pic_scanner.gui.models.windows.main.MainWindow(*args, **kwargs)
Bases:
Window,pic_scanner.log_engine.LoggableA metaclass to enhance classes with logging capabilities. Classes that inherit from ‘Loggable’ can instantly access a logger without manually setting it up. This logger is derived from a parent logger, ensuring consistent logging behavior and hierarchy.
- - log_device
The logger device associated with the instance of the class.
- class EventHandler(window)
Bases:
pic_scanner.log_engine.LoggableA metaclass to enhance classes with logging capabilities. Classes that inherit from ‘Loggable’ can instantly access a logger without manually setting it up. This logger is derived from a parent logger, ensuring consistent logging behavior and hierarchy.
- - log_device
The logger device associated with the instance of the class.
- property announced_start
- check_index()
- check_prev_button()
- check_remove_button()
Checks if the remove button should be enabled or disabled.
If no image is selected, the button is disabled. If an image is selected, the button is enabled.
- Returns:
None
- property event_handler
- property file_cursor
- property files
- build()
Builds the main window.
- Returns:
PySimpleGUI.Window
- close()
Closes the window.
This method is called when the window is closed by the user or by the program. It facilitates the safe closing of the window and the logging of the event. It also sets the running flag to False.
- Returns:
None
- remove_current_file()
- update_remove_button_state(state: bool)
Updates the state of the remove button.
This method takes a boolean value and sets the ‘disabled’ state of the remove button to the opposite of that value. If this value is True, the button is enabled. If the value is False, the button is disabled. This method is used to enable or disable the remove button based on the state of the window. If no image is selected, this method will ensure the button remains disabled. If the user has an image selected, this method will enable the Remove button.
- Parameters:
state (bool) – The state to set the button to.
- Returns:
None
- property active_image
- property file_index
- property setting_index: bool
- Return type:
bool