friendlypics2.dialogs.main_window module

GUI dialog defining behavior of main application window

class friendlypics2.dialogs.main_window.ImageItem(file_path)[source]

Bases: object

Abstraction around an image that appears in the main list view

Parameters

file_path (pathlib.Path) – path to the file managed by this instance

property file_name

name of the file managed by this object, excluding the path

Type

str

property thumbnail

thumbnail representation of the image, lazy loaded when needed

Type

QIcon

class friendlypics2.dialogs.main_window.ImageModel(folder)[source]

Bases: QAbstractListModel

Qt model that manages a list of images

Parameters

folder (pathlib.Path) – path containing images to be presented to the user

canFetchMore(parent)[source]

Is there more data to load from our model

Used for lazy loading image thumbnails only when needed

Parameters

parent (QModelIndex) – reference to the parent item containing the images to load

Returns

True if there is more data to load from our model, False if not

Return type

bool

data(index, role)[source]

retrieves data for a specific image given a specific role

Parameters
  • index (QModelIndex) – index for the image to query

  • roleItemDataRole of the role within the view where the data will be used

Returns

returns the name of the file when using the Display role, and returns the image thumbnail when using the Decoration role

Return type

str or QIcon

fetchMore(parent)[source]

Lazily loads more image data when needed

Triggered by the view class when the user scrolls below the current end of the viewable data

Parameters

parent (QModelIndex) – reference to the parent item containing the images to load

property max_count

gets the total number of images managed by this model

Type

int

rowCount(_)[source]

int: number of images in the model, lazy loaded as needed

staticMetaObject = <PySide2.QtCore.QMetaObject object>
class friendlypics2.dialogs.main_window.MainWindow[source]

Bases: QMainWindow

Main window interface

closeEvent(event)[source]

event handler called when the application is about to close

Parameters

event (QCloseEvent) – reference to the event object being raised

file_open_click()[source]

callback for file-open menu

file_settings_click()[source]

event handler for when the file->settings menu is clicked

help_about_click()[source]

callback for the help-about menu

staticMetaObject = <PySide2.QtCore.QMetaObject object>
window_debug_click()[source]

event handler for when the window->debug menu is clicked