-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a toggle option for LOOT warnings to the tools menu
- Loading branch information
1 parent
2296f22
commit 47b4f1b
Showing
8 changed files
with
156 additions
and
14 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,34 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
|
||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- run: | | ||
echo ${{ format('ARCHIVE=LOOT-Warning-Checker-{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 img LOOT-Warning-Checker 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.mypy_cache/ | ||
.vscode/ | ||
__pycache__/ | ||
__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
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,76 @@ | ||
""" | ||
Toggle Plugin | ||
============= | ||
The plugin to toggle LOOT warnings. | ||
Copyright (C) 2021-2022 Jonathan Feenstra | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
""" | ||
from typing import List, Optional | ||
import mobase | ||
|
||
from PyQt5.QtWidgets import QApplication, QWidget | ||
from PyQt5.QtGui import QIcon | ||
from .Games import SUPPORTED_GAMES | ||
|
||
|
||
class LOOTWarningToggle(mobase.IPluginTool): | ||
def __init__(self) -> None: | ||
super().__init__() | ||
self.__parentWidget: Optional[QWidget] = None | ||
|
||
def init(self, organizer: mobase.IOrganizer) -> bool: | ||
self.__organizer = organizer | ||
return True | ||
|
||
def name(self) -> str: | ||
return "LOOT Warning Toggle" | ||
|
||
def author(self) -> str: | ||
return "Jonathan Feenstra" | ||
|
||
def description(self) -> str: | ||
return self.__tr("Toggles LOOT warnings.") | ||
|
||
def version(self) -> mobase.VersionInfo: | ||
return mobase.VersionInfo(1, 0, 0, mobase.ReleaseType.BETA) | ||
|
||
def requirements(self) -> List[mobase.IPluginRequirement]: | ||
return [mobase.PluginRequirementFactory.gameDependency(games=list(SUPPORTED_GAMES.keys()))] | ||
|
||
def settings(self) -> List[mobase.PluginSetting]: | ||
return [mobase.PluginSetting("enable-warnings", self.__tr("Enable LOOT warnings"), True)] | ||
|
||
def display(self) -> None: | ||
self.__organizer.setPluginSetting(self.name(), "enable-warnings", not self.__warningsEnabled()) | ||
|
||
def displayName(self) -> str: | ||
return self.__tr(f"{'Disable' if self.__warningsEnabled() else 'Enable'} LOOT warnings") | ||
|
||
def icon(self) -> QIcon: | ||
return QIcon("plugins/LOOT-Warning-Checker/resources/icon.ico") | ||
|
||
def setParentWidget(self, parent: QWidget) -> None: | ||
self.__parentWidget = parent | ||
|
||
def tooltip(self) -> str: | ||
return self.__tr("Toggles checking for LOOT warnings from the LOOT Warning Checker plugin.") | ||
|
||
def __tr(self, txt: str) -> str: | ||
return QApplication.translate("LOOTWarningToggle", txt) | ||
|
||
def __warningsEnabled(self) -> bool: | ||
return self.__organizer.pluginSetting(self.name(), "enable-warnings") # type: ignore |
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
Binary file not shown.
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
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