-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bb215ac
Showing
7 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Lint | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.10" | ||
- uses: psf/black@stable | ||
with: | ||
black_args: ". --check" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Run isort | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.10" | ||
- uses: isort/[email protected] | ||
with: | ||
configuration: "--profile black --line-length 125" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
|
||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- run: | | ||
echo ${{ format('ARCHIVE=Auto-Activator-{0}.zip', github.ref_name) }} >> $env:GITHUB_ENV | ||
echo "RELEASE_NOTES<<EOF" >> $env:GITHUB_ENV | ||
jq -r .Versions[-1].ReleaseNotes[] .\manifest.json >> $env:GITHUB_ENV | ||
echo "EOF" >> $env:GITHUB_ENV | ||
- run: | | ||
echo "RELEASE_NOTES<<EOF" >> $env:GITHUB_ENV | ||
echo $env:RELEASE_NOTES | foreach {"* " + $_} >> $env:GITHUB_ENV | ||
echo "EOF" >> $env:GITHUB_ENV | ||
if: contains(env.RELEASE_NOTES, '\n') | ||
- name: Zip | ||
run: | | ||
7z a -tzip -mx9 $env:ARCHIVE auto_activator.py LICENSE README.md | ||
- name: Create Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
body: ${{ env.RELEASE_NOTES }} | ||
draft: true | ||
prerelease: ${{ endsWith(github.ref_name, 'alpha') || endsWith(github.ref_name, 'beta') }} | ||
files: ${{ env.ARCHIVE }} | ||
fail_on_unmatched_files: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.mypy_cache/ | ||
.vscode/ | ||
__pycache__/ | ||
env/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Auto-Activator | ||
[Mod Organizer 2](https://github.com/ModOrganizer2/modorganizer) plugin to automatically activate mods on installation. | ||
|
||
This is now possible thanks to a [bugfix](https://github.com/ModOrganizer2/modorganizer/pull/1837) in version 2.5.0 of Mod Organizer, which has not yet been released at the time of writing. As such, this plugin currently only works with pre-release builds of Mod Organizer v2.5. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
""" | ||
Auto-Activator Plugin for Mod Organizer 2 | ||
Copyright (C) 2023 Jonathan Feenstra | ||
""" | ||
import mobase | ||
from PyQt6.QtCore import qCritical | ||
from PyQt6.QtWidgets import QApplication | ||
|
||
|
||
class AutoActivator(mobase.IPlugin): | ||
def __init__(self) -> None: | ||
super().__init__() | ||
|
||
def init(self, organizer: mobase.IOrganizer) -> bool: | ||
self.__organizer = organizer | ||
|
||
if not self.__organizer.modList().onModInstalled(self.__onModInstalled): | ||
qCritical("Failed to install onModInstalled callback.") | ||
return False | ||
|
||
return True | ||
|
||
def name(self) -> str: | ||
return "Auto-Activator" | ||
|
||
def author(self) -> str: | ||
return "Jonathan Feenstra" | ||
|
||
def description(self) -> str: | ||
return self.__tr("Automatically activate mods after installing.") | ||
|
||
def version(self) -> mobase.VersionInfo: | ||
return mobase.VersionInfo(1, 0, 0, mobase.ReleaseType.FINAL) | ||
|
||
def settings(self) -> list[mobase.PluginSetting]: | ||
return [] | ||
|
||
def __onModInstalled(self, mod: mobase.IModInterface) -> None: | ||
self.__organizer.modList().setActive(name=mod.name(), active=True) | ||
|
||
def __tr(self, txt: str) -> str: | ||
return QApplication.translate("AutoActivator", txt) | ||
|
||
|
||
def createPlugin() -> mobase.IPlugin: | ||
return AutoActivator() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[tool.black] | ||
line-length = 125 | ||
target-version = ["py310"] | ||
|
||
[tool.isort] | ||
profile = "black" | ||
line_length = 125 | ||
|
||
[tool.pylint.messages_control] | ||
disable = "C0330, C0326, C0111, W0212" | ||
|
||
[tool.pylint.format] | ||
max-line-length = "125" |