qmm.manager module¶
Handles the Qt main window.
- class qmm.manager.ArchiveAddedEventHandler(moved_cb, created_cb, deleted_cb, modified_cb)[source]¶
Bases:
qmm.manager.QmmWdEventHandler
,watchdog.events.PatternMatchingEventHandler
,QObject
- on_created(event)[source]¶
Called when a file or directory is created.
- Parameters
event (
DirCreatedEvent
orFileCreatedEvent
) – Event representing file/directory creation.
- on_deleted(event)[source]¶
Called when a file or directory is deleted.
- Parameters
event (
DirDeletedEvent
orFileDeletedEvent
) – Event representing file/directory deletion.
- class qmm.manager.GameModEventHandler(moved_cb, created_cb, deleted_cb, modified_cb)[source]¶
Bases:
qmm.manager.QmmWdEventHandler
,watchdog.events.PatternMatchingEventHandler
,QObject
- on_created(event)[source]¶
Called when a file or directory is created.
- Parameters
event (
DirCreatedEvent
orFileCreatedEvent
) – Event representing file/directory creation.
- on_deleted(event)[source]¶
Called when a file or directory is deleted.
- Parameters
event (
DirDeletedEvent
orFileDeletedEvent
) – Event representing file/directory deletion.
- class qmm.manager.MainWindow[source]¶
Bases:
QMainWindow
,qmm.manager.QEventFilter
,qmm.ui_mainwindow.Ui_MainWindow
- MainWindow.fswatch_clear(QString,QString)
- MainWindow.fswatch_ignore(QString,QString)
- 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
- property is_mod_repo_dirty¶
- on_selection_change() None [source]¶
Change the tab color to match the selected element in linked list.
- 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
QApplication
(QGuiApplication
orQCoreApplication
). 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
andon_window_deactivate
.- set_top_window(window: qmm.manager.MainWindow)[source]¶
Define the widget that is considered as top window.
- class qmm.manager.QmmWdEventHandler(moved_cb, created_cb, deleted_cb, modified_cb)[source]¶
Bases:
object
- sgn_created(PyQt_PyObject)¶
- sgn_deleted(PyQt_PyObject)¶
- sgn_modified(PyQt_PyObject)¶
- sgn_moved(PyQt_PyObject)¶