qmm.manager module

Handles the Qt main window.

class qmm.manager.ArchiveAddedEventHandler(moved_cb, created_cb, deleted_cb, modified_cb)[source]

Bases: QmmWdEventHandler, PatternMatchingEventHandler, QObject

on_created(event)[source]

Called when a file or directory is created.

Parameters:

event (DirCreatedEvent or FileCreatedEvent) – Event representing file/directory creation.

on_deleted(event)[source]

Called when a file or directory is deleted.

Parameters:

event (DirDeletedEvent or FileDeletedEvent) – Event representing file/directory deletion.

on_modified(event)[source]

Called when a file or directory is modified.

Parameters:

event (DirModifiedEvent or FileModifiedEvent) – Event representing file/directory modification.

on_moved(event)[source]

Called when a file or a directory is moved or renamed.

Parameters:

event (DirMovedEvent or FileMovedEvent) – Event representing file/directory movement.

class qmm.manager.GameModEventHandler(moved_cb, created_cb, deleted_cb, modified_cb)[source]

Bases: QmmWdEventHandler, PatternMatchingEventHandler, QObject

on_created(event)[source]

Called when a file or directory is created.

Parameters:

event (DirCreatedEvent or FileCreatedEvent) – Event representing file/directory creation.

on_deleted(event)[source]

Called when a file or directory is deleted.

Parameters:

event (DirDeletedEvent or FileDeletedEvent) – Event representing file/directory deletion.

on_modified(event)[source]

Called when a file or directory is modified.

Parameters:

event (DirModifiedEvent or FileModifiedEvent) – Event representing file/directory modification.

on_moved(event)[source]

Called when a file or a directory is moved or renamed.

Parameters:

event (DirMovedEvent or FileMovedEvent) – Event representing file/directory movement.

class qmm.manager.MainWindow[source]

Bases: QMainWindow, QEventFilter, Ui_MainWindow

add_callbacks_post_show(items)[source]
closeEvent(self, a0: QCloseEvent | None)[source]
do_about()[source]

Show the about window.

do_settings()[source]

Show the settings window.

fswatch_clear(QString, QString)

str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

fswatch_ignore(QString, QString)

str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

get_row_index_by_name(name)[source]

Return row if name is found in the list.

Parameters:

name (str) – Filename of the archive to find, matches content of the ListRowItem text method.

Returns:

index of item found, None if name matches nothing.

Return type:

int or None

property is_mod_repo_dirty
on_selection_change() None[source]

Change the tab color to match the selected element in linked list.

on_window_activate()[source]
on_window_deactivate()[source]
post_show_setup()[source]

Actions to be triggered only after mainwindow show method is triggered

refresh_list_item_state()[source]

Refresh the listwidget whenever an item is added or removed.

set_tab_color(index, color: QColor = None) None[source]

Manage tab text color.

Helper to MainWindow._on_selection_change.

Store the default text color of a tab in order to restore it whenever the selected element in the linked list changes.

Parameters:
  • index (int) – index of the tab

  • color (QColor) – new color of the text

setup_schedulers()[source]
class qmm.manager.QAppEventFilter[source]

Bases: QObject

Detect if the application is active then triggers to appropriate events.

The purpose of this object is to enable or disable WatchDog related procedures. We want to disable file system watch on the modules directory when the window is inactive (user has alt-tabbed outside of it or minimized the application), as such delay any activity until the user comes back to the application itself. The intent is to minimize uneeded operations as the user could move and rename multiple files in the folder. We only need to scan the module’s repository once the user has finished, thus once the application becomes active.

The detection of activity needs to be done at the Session Manager, namely PyQt5:QApplication (QGuiApplication or QCoreApplication). That object handles every window and widgets of the application. Each of those window and widgets could become inactive regardless of the status of the whole application. Inactivity could be defined as whenever the application loose focus (keyboard input). This loss also happen whenever the window is being dragged around by the user, which means we need to make sure to not trigger any refresh of the database for those user cases. To achieve that we track the geometry and coordinates of the window and trigger the callback only if those parameters remains the same between an inactive and active event.

Callbacks are on_window_activate and on_window_deactivate.

eventFilter(self, a0: QObject | None, a1: QEvent | None) bool[source]
get_coords() Tuple[int, int][source]

Return the coordinates of the top window.

get_geometry() Tuple[int, int][source]

Return the geometry of the top window.

set_coords()[source]
set_geometry()[source]
set_top_window(window: MainWindow)[source]

Define the widget that is considered as top window.

class qmm.manager.QEventFilter[source]

Bases: object

eventFilter(o, e)[source]
setup_filters(objects)[source]
class qmm.manager.QmmWdEventHandler(moved_cb, created_cb, deleted_cb, modified_cb)[source]

Bases: object

clear(src_path, event_type)[source]

Remove a path from the event’s ignore tuple.

ignore(src_path, event_type)[source]

Ignore an event if path is found in it’s ignore tuple.

sgn_created(PyQt_PyObject)

str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

sgn_deleted(PyQt_PyObject)

str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

sgn_modified(PyQt_PyObject)

str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

sgn_moved(PyQt_PyObject)

str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

exception qmm.manager.UnknownContext[source]

Bases: Exception

class qmm.manager.WatchDogSchedules(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

ARCHIVES = 'archives'
MODULES = 'modules'
qmm.manager.main()[source]

Start the application proper.