friendlypics2.misc.gui_helpers module

helper methods for use by GUI objects and dialogs

class friendlypics2.misc.gui_helpers.GuiLogger(widget)[source]

Bases: logging.Handler

Custom Python log handler that redirects output to a Qt widget

Parameters

widget (QWidget) – text widget to redirect log output to

emit(record)[source]

Displays a log message to the GUI

write(_)[source]

Disable disk-based file access

friendlypics2.misc.gui_helpers.generate_screen_id(screen)[source]

generates a unique identifier for a screen

Parameters

screen (QScreen) – screen to be analysed

Returns

unique ID describing the given screen

Return type

str

friendlypics2.misc.gui_helpers.load_ui(file, parent)[source]

Loads a UI interface file from disk

Parameters
  • file (str) – path to the UI file to load. Must be relative to the data/ui folder.

  • parent (object) – reference to the Qt dialog object associated with the UI file

friendlypics2.misc.gui_helpers.settings_group_context(settings, group_name)[source]

Context manager that starts loading settings from a specific sub-group and restores the original settings group once the context goes out of scope

Code within this context will load settings from the specified sub-group

Parameters
  • settings (QSettings) – settings for the running app

  • group_name (str) – name of the settings group to invoke