Last active
May 13, 2020 12:30
-
-
Save Holt59/35595fc2b79b5dc21189aef780984810 to your computer and use it in GitHub Desktop.
MO2 python test plugin - Install after download
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: utf-8 -*- | |
from PyQt5.QtCore import QCoreApplication | |
import mobase | |
class InstallAfterDownload(mobase.IPlugin): | |
def __init__(self): | |
super().__init__() | |
def init(self, organizer: mobase.IOrganizer): | |
self._organizer = organizer | |
self._organizer.downloadManager().downloadComplete.connect(self._install_mod) | |
return True | |
def _install_mod(self, download_id: int): | |
if self.isActive(): | |
self._organizer.installMod( | |
self._organizer.downloadManager().downloadPath(download_id) | |
) | |
def name(self): | |
return "Install after download" | |
def author(self): | |
return "Holt59" | |
def description(self): | |
return self.__tr("Automatically start installing mods after downloading them") | |
def version(self): | |
return mobase.VersionInfo(0, 0, 1, mobase.ReleaseType.alpha) | |
def isActive(self): | |
return self._organizer.pluginSetting(self.name(), "enabled") | |
def settings(self): | |
return [mobase.PluginSetting("enabled", "check to enable this plugin", True)] | |
def __tr(self, str): | |
return QCoreApplication.translate(InstallAfterDownload.__name__, str) | |
def createPlugin(): | |
return InstallAfterDownload() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment