friendlypics2.dialogs.settings_dlg module¶
Logic for the application settings UI
-
class
friendlypics2.dialogs.settings_dlg.
AppSettingsModel
(data)[source]¶ Bases:
QAbstractItemModel
Interface for rendering application settings stored in a hierarchical format
Loosely based on example code found here
- Parameters
data (AppSettings) – reference to the application settings to be managed by this dialog
-
columnCount
(parent)[source]¶ retrieves the number of fields associated with a given item
- Parameters
parent (QModelIndex) – index of the item to retrieve information for contains a reference to the SettingsItem it manages
- Returns
number of fields associated with the given item
- Return type
-
data
(index, role)[source]¶ retrieves data for a specific setting given a specific role
- Parameters
index (QModelIndex) – index for the setting to query
role – ItemDataRole of the role within the view where the data will be used
- Returns
data for the specified setting within the given context, or None if no data suitable for the given role can be found
- Return type
-
flags
(index)[source]¶ gets bit-field describing how a given setting should be rendered
- Parameters
index (QModelIndex) – index of the setting to be analysed
- Returns
bit-field encoded set of flags describing how the given item should be displayed
- Return type
-
headerData
(section, orientation, role)[source]¶ Gets column header text for the view
- Parameters
section (int) – id of the field / column to retrieve the header for
orientation – Orientation of the text direction for the headers
role – ItemDataRole of the role within the view where the data will be used
- Returns
header text for the given section / column
- Return type
-
index
(row, column, parent)[source]¶ Gets the index for a given element in the data managed by the model
- Parameters
row (int) – row of the data set to query within our context, this is the ID of the setting to query
column (int) – column of the data set to query within our context, this is the ID of the field of a specific setting to query
parent (QModelIndex) – index of the node / setting containing the children to query
- Returns
reference to the setting associated with the given context
- Return type
-
parent
(index)[source]¶ Gets the index of the parent item for a given setting
- Parameters
index (QModelIndex) – index of the setting to query
- Returns
reference to the setting owning the given item, or an empty index if the given item has no parent
- Return type
-
property
root_item
¶ gets the root node of our settings tree
- Type
-
rowCount
(parent)[source]¶ Number of direct children owned by a given index
- Parameters
parent (QModelIndex) – reference to the setting to query
- Returns
number of children owned by this parent
- Return type
-
setData
(index, value, role)[source]¶ Modifies the value of a settings
Loosely based on example code found here
- Parameters
index (QModelIndex) – index of the app setting to modify
value (str) – new data value for the setting
role – ItemDataRole of the role within the view where the data is being edited
- Returns
True if the data was successfully modified, False if not
- Return type
-
staticMetaObject
= <PySide2.QtCore.QMetaObject object>¶
-
class
friendlypics2.dialogs.settings_dlg.
SettingsDialog
(parent, settings)[source]¶ Bases:
QDialog
Logic for managing application settings dialog
- Parameters
parent (QWidget) – Parent widget / dialog that owns the settings dialog
settings (AppSettings) – reference to the application settings to be managed by this dialog
-
staticMetaObject
= <PySide2.QtCore.QMetaObject object>¶
-
class
friendlypics2.dialogs.settings_dlg.
SettingsItem
(data, parent=None)[source]¶ Bases:
object
Interface to a single application setting or group of application settings
Loosely based on example code found here
- Parameters
data (tuple) – fields associated with this setting, providing data for each column in the view
parent (SettingsItem) – parent setting that owns this one. Set to None to indicate this item is a root setting with no parent
-
appendChild
(item)[source]¶ Adds a new child element to this setting in the tree
- Parameters
item (SettingsItem) – child item related to this one
-
child
(row)[source]¶ Gets a specific child item from this parent
- Parameters
row (int) – index of the child item to retrieve
- Returns
child item with the given index
- Return type
-
property
child_items
¶ list of children owned by this item
- Type