From b2618708fb485dd253cc6c49c18529e009d1877a Mon Sep 17 00:00:00 2001 From: Alex Ashmore Date: Mon, 13 Dec 2021 11:18:40 +0000 Subject: [PATCH] added MO v2.5 rudimentary support --- readme/reinstaller/reinstaller.json | 23 +++++ .../rootbuilder/rootbuilder.json | 16 ++-- readme/shortcutter/shortcutter.json | 23 +++++ .../pluginfinder/models/plugin_data.py | 85 +++++++++++++++++ .../pluginfinder/models/plugin_version.py | 71 ++++++++++++++ .../modules/pluginfinder_paths.py | 39 ++++++-- .../modules/pluginfinder_search.py | 92 +++++++++++++++++++ .../pluginfinder/plugin_directory.json | 22 +++++ .../pluginfinder/pluginfinder/pluginfinder.py | 33 ++----- release/pluginfinder/shared/shared_icons.py | 5 +- release/pluginfinder/shared/shared_paths.py | 5 +- release/pluginfinder/shared/shared_plugin.py | 8 +- .../pluginfinder/shared/shared_settings.py | 5 +- release/reinstaller/reinstaller.json | 23 +++++ .../plugins/reinstaller_tool_create.py | 11 ++- .../plugins/reinstaller_tool_delete.py | 11 ++- .../plugins/reinstaller_tool_install.py | 11 ++- .../plugins/reinstaller_tool_manage.py | 18 +++- .../reinstaller/reinstaller_plugin.py | 2 +- release/reinstaller/shared/shared_icons.py | 5 +- release/reinstaller/shared/shared_paths.py | 5 +- release/reinstaller/shared/shared_plugin.py | 8 +- release/reinstaller/shared/shared_settings.py | 5 +- release/rootbuilder/rootbuilder.json | 23 +++++ .../rootbuilder/modules/rootbuilder_backup.py | 5 +- .../rootbuilder/modules/rootbuilder_copy.py | 7 +- .../rootbuilder/modules/rootbuilder_linker.py | 5 +- .../plugins/rootbuilder_plugin_mapper.py | 8 +- .../plugins/rootbuilder_tool_build.py | 5 +- .../plugins/rootbuilder_tool_clear.py | 5 +- .../plugins/rootbuilder_tool_manage.py | 25 +++-- .../plugins/rootbuilder_tool_sync.py | 5 +- .../rootbuilder/rootbuilder/rootbuilder.py | 5 +- .../rootbuilder/rootbuilder_plugin.py | 7 +- release/rootbuilder/shared/shared_icons.py | 5 +- release/rootbuilder/shared/shared_paths.py | 5 +- release/rootbuilder/shared/shared_plugin.py | 8 +- release/rootbuilder/shared/shared_settings.py | 5 +- release/shortcutter/shared/shared_icons.py | 5 +- release/shortcutter/shared/shared_paths.py | 5 +- release/shortcutter/shared/shared_plugin.py | 8 +- release/shortcutter/shared/shared_settings.py | 5 +- release/shortcutter/shortcutter.json | 23 +++++ .../plugins/shortcutter_tool_create.py | 28 ++++-- .../shortcutter/shortcutter_plugin.py | 2 +- src/pluginfinder/models/plugin_data.py | 85 +++++++++++++++++ src/pluginfinder/models/plugin_version.py | 71 ++++++++++++++ .../modules/pluginfinder_paths.py | 39 ++++++-- .../modules/pluginfinder_search.py | 92 +++++++++++++++++++ src/pluginfinder/plugin_directory.json | 8 +- src/pluginfinder/pluginfinder.py | 33 ++----- .../plugins/reinstaller_tool_create.py | 11 ++- .../plugins/reinstaller_tool_delete.py | 11 ++- .../plugins/reinstaller_tool_install.py | 11 ++- .../plugins/reinstaller_tool_manage.py | 18 +++- src/reinstaller/reinstaller_plugin.py | 2 +- src/rootbuilder/modules/rootbuilder_backup.py | 5 +- src/rootbuilder/modules/rootbuilder_copy.py | 7 +- src/rootbuilder/modules/rootbuilder_linker.py | 5 +- .../plugins/rootbuilder_plugin_mapper.py | 8 +- .../plugins/rootbuilder_tool_build.py | 5 +- .../plugins/rootbuilder_tool_clear.py | 5 +- .../plugins/rootbuilder_tool_manage.py | 25 +++-- .../plugins/rootbuilder_tool_sync.py | 5 +- src/rootbuilder/rootbuilder.py | 5 +- src/rootbuilder/rootbuilder_plugin.py | 7 +- src/shared/shared_icons.py | 5 +- src/shared/shared_paths.py | 5 +- src/shared/shared_plugin.py | 8 +- src/shared/shared_settings.py | 5 +- .../plugins/shortcutter_tool_create.py | 28 ++++-- src/shortcutter/shortcutter_plugin.py | 2 +- tools/deploy_all.bat | 2 +- 73 files changed, 1045 insertions(+), 193 deletions(-) create mode 100644 readme/reinstaller/reinstaller.json rename src/rootbuilder/plugin_info.json => readme/rootbuilder/rootbuilder.json (62%) create mode 100644 readme/shortcutter/shortcutter.json create mode 100644 release/pluginfinder/pluginfinder/models/plugin_data.py create mode 100644 release/pluginfinder/pluginfinder/models/plugin_version.py create mode 100644 release/pluginfinder/pluginfinder/modules/pluginfinder_search.py create mode 100644 release/pluginfinder/pluginfinder/plugin_directory.json create mode 100644 release/reinstaller/reinstaller.json create mode 100644 release/rootbuilder/rootbuilder.json create mode 100644 release/shortcutter/shortcutter.json create mode 100644 src/pluginfinder/models/plugin_data.py create mode 100644 src/pluginfinder/models/plugin_version.py create mode 100644 src/pluginfinder/modules/pluginfinder_search.py diff --git a/readme/reinstaller/reinstaller.json b/readme/reinstaller/reinstaller.json new file mode 100644 index 0000000..964a008 --- /dev/null +++ b/readme/reinstaller/reinstaller.json @@ -0,0 +1,23 @@ +{ + "Name": "Reinstaller", + "Author": "Kezyma", + "Description": "Reinstaller allows you to conveninetly backup mod installers to re-run later, without risk of them cluttering up your downloads section in Mod Organizer 2.", + "NexusUrl": "https://www.nexusmods.com/skyrimspecialedition/mods/59292", + "GithubUrl": "https://github.com/Kezyma/ModOrganizer-Plugins", + "DownloadUrl": "https://github.com/Kezyma/ModOrganizer-Plugins/releases/download/Current/reinstaller.zip", + "PluginPath": [ "reinstaller" ], + "LocalePath": [], + "DataPath": [ "data/reinstaller" ], + "Versions": [ + { + "Version": "1.0.6", + "Released": "2021-12-13", + "MinSupport": "2.4.2", + "MaxSupport": "2.5.0", + "DownloadUrl": "https://github.com/Kezyma/ModOrganizer-Plugins/releases/download/reinstaller-1.0.6/reinstaller.zip", + "PluginPath": [ "reinstaller" ], + "LocalePath": [], + "DataPath": [ "data/reinstaller" ] + } + ] +} diff --git a/src/rootbuilder/plugin_info.json b/readme/rootbuilder/rootbuilder.json similarity index 62% rename from src/rootbuilder/plugin_info.json rename to readme/rootbuilder/rootbuilder.json index 0a0671e..1b526ce 100644 --- a/src/rootbuilder/plugin_info.json +++ b/readme/rootbuilder/rootbuilder.json @@ -6,18 +6,18 @@ "GithubUrl": "https://github.com/Kezyma/ModOrganizer-Plugins", "DownloadUrl": "https://github.com/Kezyma/ModOrganizer-Plugins/releases/download/Current/rootbuilder.zip", "PluginPath": [ "rootbuilder" ], - "LocalePath": [ ], + "LocalePath": [], "DataPath": [ "data/rootbuilder" ], "Versions": [ { - "Version": "", - "Released": "", - "MinSupport": "", - "MaxSupport": "", - "DownloadUrl": "", - "PluginPath": [], + "Version": "4.2.7", + "Released": "2021-12-13", + "MinSupport": "2.4.2", + "MaxSupport": "2.5.0", + "DownloadUrl": "https://github.com/Kezyma/ModOrganizer-Plugins/releases/download/rootbuilder-4.2.7/rootbuilder.4.2.7.zip", + "PluginPath": [ "rootbuilder" ], "LocalePath": [], - "DataPath": [] + "DataPath": [ "data/rootbuilder" ] } ] } diff --git a/readme/shortcutter/shortcutter.json b/readme/shortcutter/shortcutter.json new file mode 100644 index 0000000..a7f82eb --- /dev/null +++ b/readme/shortcutter/shortcutter.json @@ -0,0 +1,23 @@ +{ + "Name": "Shortcutter", + "Author": "Kezyma", + "Description": "Shortcutter gives you the option of quickly creating instance and profile specific desktop shortcuts, allowing you to quickly launch your game without having to manually switch inside Mod Organizer.", + "NexusUrl": "https://www.nexusmods.com/skyrimspecialedition/mods/59827", + "GithubUrl": "https://github.com/Kezyma/ModOrganizer-Plugins", + "DownloadUrl": "https://github.com/Kezyma/ModOrganizer-Plugins/releases/download/Current/shortcutter.zip", + "PluginPath": [ "shortcutter" ], + "LocalePath": [], + "DataPath": [ "data/shortcutter" ], + "Versions": [ + { + "Version": "1.0.4", + "Released": "2021-12-13", + "MinSupport": "2.4.2", + "MaxSupport": "2.5.0", + "DownloadUrl": "https://github.com/Kezyma/ModOrganizer-Plugins/releases/download/shortcutter-1.0.4/shortcutter.zip", + "PluginPath": [ "shortcutter" ], + "LocalePath": [], + "DataPath": [ "data/shortcutter" ] + } + ] +} diff --git a/release/pluginfinder/pluginfinder/models/plugin_data.py b/release/pluginfinder/pluginfinder/models/plugin_data.py new file mode 100644 index 0000000..f84f278 --- /dev/null +++ b/release/pluginfinder/pluginfinder/models/plugin_data.py @@ -0,0 +1,85 @@ +import mobase, os +from plugin_version import PluginVersion + +class PluginData(self): + + def __init__(self, jsonObject=dict): + self.json = jsonObject + super().__init__() + + def getJsonProperty(self, key=str): + if key in self.json.keys(): + return self.json[key] + else: + return None + + def getJsonArray(self, key=str): + data = self.getJsonProperty(key) + res = [] + if data: + try: + for val in data: + res.append(data) + return res + except: + return None + else: + return None + + def identifier(self): + return str(self.getJsonProperty("Identifier")) + + def name(self): + return str(self.getJsonProperty("Name")) + + def description(self): + return str(self.getJsonProperty("Description")) + + def nexusUrl(self): + return str(self.getJsonProperty("NexusUrl")) + + def githubUrl(self): + return str(self.getJsonProperty("GithubUrl")) + + def downloadUrl(self): + return str(self.getJsonProperty("DownloadUrl")) + + def pluginPaths(self): + paths = [] + data = self.getJsonArray("PluginPath") + if data: + for path in data: + paths.append(str(path)) + return paths + else: + return None + + def localePaths(self): + paths = [] + data = self.getJsonArray("LocalePath") + if data: + for path in data: + paths.append(str(path)) + return paths + else: + return None + + def dataPaths(self): + paths = [] + data = self.getJsonArray("DataPath") + if data: + for path in data: + paths.append(str(path)) + return paths + else: + return None + + def versions(): + versions = [] + data = self.getJsonArray("Versions") + if data: + for version in data: + versions.append(PluginVersion(version)) + return versions + else: + return None \ No newline at end of file diff --git a/release/pluginfinder/pluginfinder/models/plugin_version.py b/release/pluginfinder/pluginfinder/models/plugin_version.py new file mode 100644 index 0000000..fb7b325 --- /dev/null +++ b/release/pluginfinder/pluginfinder/models/plugin_version.py @@ -0,0 +1,71 @@ +import mobase, os + +class PluginVersion(self): + + def __init__(self, jsonObject=dict): + self.json = jsonObject + super().__init__() + + def getJsonProperty(self, key=str): + if key in self.json.keys(): + return self.json[key] + else: + return None + + def getJsonArray(self, key=str): + data = self.getJsonProperty(key) + res = [] + if data: + try: + for val in data: + res.append(data) + return res + except: + return None + else: + return None + + def released(self): + return str(self.getJsonProperty("Released")) + + def minSupport(self): + return str(self.getJsonProperty("MinSupport")) + + def maxSupport(self): + return str(self.getJsonProperty("MaxSupport")) + + def version(self): + return str(self.getJsonProperty("Version")) + + def downloadUrl(self): + return str(self.getJsonProperty("DownloadUrl")) + + def pluginPaths(self): + paths = [] + data = self.getJsonArray("PluginPath") + if data: + for path in data: + paths.append(str(path)) + return paths + else: + return None + + def localePaths(self): + paths = [] + data = self.getJsonArray("LocalePath") + if data: + for path in data: + paths.append(str(path)) + return paths + else: + return None + + def dataPaths(self): + paths = [] + data = self.getJsonArray("DataPath") + if data: + for path in data: + paths.append(str(path)) + return paths + else: + return None diff --git a/release/pluginfinder/pluginfinder/modules/pluginfinder_paths.py b/release/pluginfinder/pluginfinder/modules/pluginfinder_paths.py index 5dc7781..f0160a1 100644 --- a/release/pluginfinder/pluginfinder/modules/pluginfinder_paths.py +++ b/release/pluginfinder/pluginfinder/modules/pluginfinder_paths.py @@ -7,15 +7,7 @@ class PluginFinderPaths(SharedPaths): def __init__(self, organiser=mobase.IOrganizer): super().__init__("PluginFinder", organiser) - - _directoryJsonPath = str() - def directoryJsonPath(self): - if self._directoryJsonPath == str(): - self._directoryJsonPath = str(self.pluginDataPath() / "pluginfinder_directory.json") - return Path(self._directoryJsonPath) - - githubDirectoryUrl = "https://raw.githubusercontent.com/Kezyma/ModOrganizer-Plugins/main/src/pluginfinder/pluginfinder_directory.json" - + _modOrganizerPluginPath = str() def modOrganizerPluginPath(self): if self._modOrganizerPluginPath == str(): @@ -40,4 +32,31 @@ def pluginStageTempPath(self): self._pluginStageTempPath = self.pluginDataPath() / "DownloadedPlugin" if not Path(self._pluginStageTempPath).exists(): os.makedirs(self._pluginStageTempPath) - return Path(self._pluginStageTempPath) \ No newline at end of file + return Path(self._pluginStageTempPath) + + + _pluginDirectoryUrl = "https://raw.githubusercontent.com/Kezyma/ModOrganizer-Plugins/main/src/pluginfinder/plugin_directory.json" + def pluginDirectoryUrl(self): + """ Url to the directory json for updating. """ + return self._pluginDirectoryUrl + + _initialDirectoryPath = str() + def initialDirectoryPath(self): + """ Path to the initial directory json to be deployed during install. """ + if self._initialDirectoryPath == str(): + self._initialDirectoryPath = str(Path(__file__).parent.parent / "plugin_directory.json") + return self._initialDirectoryPath; + + _directoryJsonPath = str() + def directoryJsonPath(self): + """ Path to the current plugin directory json file. """ + if self._directoryJsonPath == str(): + self._directoryJsonPath = str(self.pluginDataPath() / "plugin_directory.json") + return Path(self._directoryJsonPath) + + _pluginDataCachePath = str() + def pluginDataCachePath(self, pluginId=str): + """ Gets the location of the current plugin json file. """ + if self._pluginDataCachePath == str(): + self._pluginDataCachePath = self.pluginDataPath() / "directory" + return self._pluginDataCachePath / (str(pluginId) + ".json") diff --git a/release/pluginfinder/pluginfinder/modules/pluginfinder_search.py b/release/pluginfinder/pluginfinder/modules/pluginfinder_search.py new file mode 100644 index 0000000..b1f8783 --- /dev/null +++ b/release/pluginfinder/pluginfinder/modules/pluginfinder_search.py @@ -0,0 +1,92 @@ +import mobase, os, urllib, json +from pathlib import Path +from datetime import datetime, timedelta +from itertools import islice +from pluginfinder_paths import PluginFinderPaths +from pluginfinder_files import PluginFinderFiles +from ...shared.shared_utilities import SharedUtilities +from ..models.plugin_data import PluginData + +class PluginFinderSearch(): + + def __init__(self, organiser=mobase.IOrganizer, paths=PluginFinderPaths, files=PluginFinderFiles): + self.organiser = organiser + self.paths = paths + self.files = files + self.utilities = SharedUtilities() + super().__init__() + + def deployInitialDirectory(self): + """ Deploys the initial directory file, only happens on first run. """ + if Path(self.paths.initialDirectoryPath()).exists(): + self.utilities.moveTo(self.paths.initialDirectoryPath(), self.paths.directoryJsonPath()) + + def updateDirectory(self): + """ Attempt to download a directory update from Github. """ + try: + data = json.loads(urllib.request.urlopen(self.paths.pluginDirectoryUrl()).read()) + with open(self.paths.directoryJsonPath(), "w") as rcJson: + json.dump(data, rcJson) + except: + qInfo("Could not download update.") + urllib.request.urlcleanup() + + def directory(self): + """ Get the directory as json. """ + # Deploy if it's first run. + self.deployInitialDirectory() + # If the file is missing or old, update it. + if not Path(self.paths.directoryJsonPath()).exists(): + if datetime.fromtimestamp(os.path.getmtime(str(self.paths.directoryJsonPath()))) < (datetime.today() - timedelta(days=1)): + self.updateDirectory() + # Load the directory file. + directory = json.load(open(self.paths.directoryJsonPath())) + return directory + + def searchDirectory(self, searchTerms=str): + """ Searches the directory by plugin name. """ + results = [] + for plugin in self.directory(): + if "Name" in plugin: + if searchTerms in plugin["Name"]: + results.append(plugin) + return results + + def updatePluginData(self, pluginId=str): + """ Gets the json file for the current plugin. """ + for plugin in self.directory(): + if plugin["Identifier"] == str(pluginId): + url = plugin["Manifest"] + try: + data = json.loads(urllib.request.urlopen(str(url)).read()) + with open(self.paths.pluginDataCachePath(pluginId) "w") as rcJson: + json.dump(data, rcJson) + except: + qInfo("Could not download update.") + urllib.request.urlcleanup() + + def pluginData(self, pluginId=str): + """ Loads the data for a plugin. """ + # If the file is missing or old, update it. + if not Path(self.paths.pluginDataCachePath(pluginId)).exists() or datetime.fromtimestamp(os.path.getmtime(str(self.paths.pluginDataCachePath(pluginId)))) < (datetime.today() - timedelta(days=1)): + self.updatePluginData(pluginId) + # If the file now exists (it should), load it. + if Path(self.paths.pluginDataCachePath(pluginId)).exists(): + try: + data = json.load(open(self.paths.pluginDataCachePath(pluginId))) + data["Identifier"] = str(pluginId) + return PluginData(data) + except: + return None + # Return an null if we can't load the file. + return None + + def pagedPluginData(self, searchTerms=str, page=int, pageSize=int): + """ Get a paged list of plugin data. """ + manifestSearch = self.searchDirectory(searchTerms) + pagedList = list(islice(manifestSearch, ((page-1)*pageSize), ((page-1)*pageSize) + pageSize)) + results = [] + for item in pagedList: + if "Identifier" in item: + results.append(self.pluginData(str(item["Identifier"]))) + return results \ No newline at end of file diff --git a/release/pluginfinder/pluginfinder/plugin_directory.json b/release/pluginfinder/pluginfinder/plugin_directory.json new file mode 100644 index 0000000..5287999 --- /dev/null +++ b/release/pluginfinder/pluginfinder/plugin_directory.json @@ -0,0 +1,22 @@ +[ + { + "Name": "Root Builder", + "Identifier": "rootbuilder", + "Manifest": "https://raw.githubusercontent.com/Kezyma/ModOrganizer-Plugins/main/readme/rootbuilder/rootbuilder.json" + }, + { + "Name": "Reinstaller", + "Identifier": "reinstaller", + "Manifest": "https://raw.githubusercontent.com/Kezyma/ModOrganizer-Plugins/main/readme/reinstaller/reinstaller.json" + }, + { + "Name": "Shortcutter", + "Identifier": "shortcutter", + "Manifest": "https://raw.githubusercontent.com/Kezyma/ModOrganizer-Plugins/main/readme/shortcutter/shortcutter.json" + }, + { + "Name": "Plugin Finder", + "Identifier": "pluginfinder", + "Manifest": "" + } +] \ No newline at end of file diff --git a/release/pluginfinder/pluginfinder/pluginfinder.py b/release/pluginfinder/pluginfinder/pluginfinder.py index 047aab0..ad9d2a7 100644 --- a/release/pluginfinder/pluginfinder/pluginfinder.py +++ b/release/pluginfinder/pluginfinder/pluginfinder.py @@ -1,9 +1,13 @@ import mobase, json, urllib.request, zipfile, os, shutil, re +from src.pluginfinder.modules.pluginfinder_search import PluginFinderSearch from ..shared.shared_utilities import SharedUtilities from .modules.pluginfinder_paths import PluginFinderPaths from .modules.pluginfinder_files import PluginFinderFiles -from PyQt5.QtCore import QCoreApplication, qInfo from pathlib import Path +try: + from PyQt5.QtCore import QCoreApplication, qInfo +except: + from PyQt6.QtCore import QCoreApplication, qInfo # TODO: Check for updates function to get all installed plugins again and check if the version has changed. # TODO: Search function to filter plugins by text @@ -60,33 +64,10 @@ def __init__(self, organiser = mobase.IOrganizer): self.organiser = organiser self.files = PluginFinderFiles(self.organiser) self.paths = PluginFinderPaths(self.organiser) + self.search = PluginFinderSearch(self.organiser, self.paths, self.files) self.utilities = SharedUtilities() super().__init__() - - def deploy(self): - """ Deploys the directory file to plugin data and attempts to update it. """ - # Copy the default directory over to the plugin data folder. - jsonPath = str(Path(__file__).parent / "pluginfinder_directory.json") - if Path(jsonPath).exists(): - self.utilities.moveTo(jsonPath, self.paths.directoryJsonPath()) - # Try and update the directory from the github repo. - self.updateDirectory() - - def updateDirectory(self): - """ Attempt to download a directory update from Github. """ - try: - data = json.loads(urllib.request.urlopen(self.paths.githubDirectoryUrl).read()) - with open(self.paths.directoryJsonPath(), "w") as rcJson: - json.dump(data, rcJson) - except: - qInfo("Could not download update.") - urllib.request.urlcleanup() - - def directory(self): - """ Get the directory as json. """ - directory = json.load(open(self.paths.directoryJsonPath())) - return directory - + def install(self, pluginId=str): """ Installs a plugin. """ qInfo("Installing " + str(pluginId)) diff --git a/release/pluginfinder/shared/shared_icons.py b/release/pluginfinder/shared/shared_icons.py index 6df51fc..a78fa74 100644 --- a/release/pluginfinder/shared/shared_icons.py +++ b/release/pluginfinder/shared/shared_icons.py @@ -1,4 +1,7 @@ -from PyQt5.QtGui import QIcon +try: + from PyQt5.QtGui import QIcon +except: + from PyQt6.QtGui import QIcon from pathlib import Path class SharedIcons(): diff --git a/release/pluginfinder/shared/shared_paths.py b/release/pluginfinder/shared/shared_paths.py index 44aa6a8..11d78a7 100644 --- a/release/pluginfinder/shared/shared_paths.py +++ b/release/pluginfinder/shared/shared_paths.py @@ -1,6 +1,9 @@ import mobase, os, winreg, glob from pathlib import Path, PurePath -from PyQt5.QtCore import QCoreApplication, qInf, qInfo +try: + from PyQt5.QtCore import QCoreApplication, qInfo +except: + from PyQt6.QtCore import QCoreApplication, qInfo class SharedPaths(): diff --git a/release/pluginfinder/shared/shared_plugin.py b/release/pluginfinder/shared/shared_plugin.py index 4b01a4e..583a8b0 100644 --- a/release/pluginfinder/shared/shared_plugin.py +++ b/release/pluginfinder/shared/shared_plugin.py @@ -1,5 +1,8 @@ import mobase -from PyQt5.QtCore import QCoreApplication +try: + from PyQt5.QtCore import QCoreApplication +except: + from PyQt6.QtCore import QCoreApplication from .shared_icons import SharedIcons from .shared_settings import SharedSettings @@ -26,6 +29,9 @@ def isActive(self): def __tr(self, trstr): return QCoreApplication.translate(self.pluginName, trstr) + def tr(self, trstr): + return self.__tr(trstr) + def icon(self): return self.icons.menuIcon() diff --git a/release/pluginfinder/shared/shared_settings.py b/release/pluginfinder/shared/shared_settings.py index 32c8a63..70b27b4 100644 --- a/release/pluginfinder/shared/shared_settings.py +++ b/release/pluginfinder/shared/shared_settings.py @@ -1,4 +1,7 @@ -from PyQt5.QtCore import QCoreApplication +try: + from PyQt5.QtCore import QCoreApplication +except: + from PyQt6.QtCore import QCoreApplication import mobase class SharedSettings(): diff --git a/release/reinstaller/reinstaller.json b/release/reinstaller/reinstaller.json new file mode 100644 index 0000000..964a008 --- /dev/null +++ b/release/reinstaller/reinstaller.json @@ -0,0 +1,23 @@ +{ + "Name": "Reinstaller", + "Author": "Kezyma", + "Description": "Reinstaller allows you to conveninetly backup mod installers to re-run later, without risk of them cluttering up your downloads section in Mod Organizer 2.", + "NexusUrl": "https://www.nexusmods.com/skyrimspecialedition/mods/59292", + "GithubUrl": "https://github.com/Kezyma/ModOrganizer-Plugins", + "DownloadUrl": "https://github.com/Kezyma/ModOrganizer-Plugins/releases/download/Current/reinstaller.zip", + "PluginPath": [ "reinstaller" ], + "LocalePath": [], + "DataPath": [ "data/reinstaller" ], + "Versions": [ + { + "Version": "1.0.6", + "Released": "2021-12-13", + "MinSupport": "2.4.2", + "MaxSupport": "2.5.0", + "DownloadUrl": "https://github.com/Kezyma/ModOrganizer-Plugins/releases/download/reinstaller-1.0.6/reinstaller.zip", + "PluginPath": [ "reinstaller" ], + "LocalePath": [], + "DataPath": [ "data/reinstaller" ] + } + ] +} diff --git a/release/reinstaller/reinstaller/plugins/reinstaller_tool_create.py b/release/reinstaller/reinstaller/plugins/reinstaller_tool_create.py index 031066b..a97c049 100644 --- a/release/reinstaller/reinstaller/plugins/reinstaller_tool_create.py +++ b/release/reinstaller/reinstaller/plugins/reinstaller_tool_create.py @@ -1,6 +1,11 @@ -from PyQt5.QtWidgets import QInputDialog, QLineEdit -from PyQt5.QtCore import QCoreApplication -from PyQt5 import QtWidgets +try: + from PyQt5.QtWidgets import QInputDialog, QLineEdit + from PyQt5.QtCore import QCoreApplication + from PyQt5 import QtWidgets +except: + from PyQt6.QtWidgets import QInputDialog, QLineEdit + from PyQt6.QtCore import QCoreApplication + from PyQt6 import QtWidgets from ..reinstaller_plugin import ReinstallerPlugin import mobase diff --git a/release/reinstaller/reinstaller/plugins/reinstaller_tool_delete.py b/release/reinstaller/reinstaller/plugins/reinstaller_tool_delete.py index 2de9cfa..0252a02 100644 --- a/release/reinstaller/reinstaller/plugins/reinstaller_tool_delete.py +++ b/release/reinstaller/reinstaller/plugins/reinstaller_tool_delete.py @@ -1,6 +1,11 @@ -from PyQt5.QtWidgets import QInputDialog -from PyQt5.QtCore import QCoreApplication -from PyQt5 import QtWidgets +try: + from PyQt5.QtWidgets import QInputDialog, QLineEdit + from PyQt5.QtCore import QCoreApplication + from PyQt5 import QtWidgets +except: + from PyQt6.QtWidgets import QInputDialog, QLineEdit + from PyQt6.QtCore import QCoreApplication + from PyQt6 import QtWidgets from ..reinstaller_plugin import ReinstallerPlugin import mobase, shutil, os diff --git a/release/reinstaller/reinstaller/plugins/reinstaller_tool_install.py b/release/reinstaller/reinstaller/plugins/reinstaller_tool_install.py index b369a36..627ec1d 100644 --- a/release/reinstaller/reinstaller/plugins/reinstaller_tool_install.py +++ b/release/reinstaller/reinstaller/plugins/reinstaller_tool_install.py @@ -1,6 +1,11 @@ -from PyQt5.QtWidgets import QInputDialog -from PyQt5.QtCore import QCoreApplication -from PyQt5 import QtWidgets +try: + from PyQt5.QtWidgets import QInputDialog, QLineEdit + from PyQt5.QtCore import QCoreApplication + from PyQt5 import QtWidgets +except: + from PyQt6.QtWidgets import QInputDialog, QLineEdit + from PyQt6.QtCore import QCoreApplication + from PyQt6 import QtWidgets from ..reinstaller_plugin import ReinstallerPlugin import mobase, os diff --git a/release/reinstaller/reinstaller/plugins/reinstaller_tool_manage.py b/release/reinstaller/reinstaller/plugins/reinstaller_tool_manage.py index 2490193..8bf7639 100644 --- a/release/reinstaller/reinstaller/plugins/reinstaller_tool_manage.py +++ b/release/reinstaller/reinstaller/plugins/reinstaller_tool_manage.py @@ -1,5 +1,15 @@ -from PyQt5.QtCore import QCoreApplication -from PyQt5 import QtWidgets, QtCore +try: + from PyQt5.QtWidgets import QInputDialog, QLineEdit + from PyQt5.QtCore import QCoreApplication + from PyQt5 import QtWidgets, QtCore + qtHLine = QtWidgets.QFrame.HLine + qtSunken = QtWidgets.QFrame.Sunken +except: + from PyQt6.QtWidgets import QInputDialog, QLineEdit + from PyQt6.QtCore import QCoreApplication + from PyQt6 import QtWidgets, QtCore + qtHLine = QtWidgets.QFrame.Shape.HLine + qtSunken = QtWidgets.QFrame.Shadow.Sunken from pathlib import Path from ..reinstaller_plugin import ReinstallerPlugin import mobase @@ -122,8 +132,8 @@ def getDialog(self): self.line = QtWidgets.QFrame(dialog) self.line.setGeometry(QtCore.QRect(0, 45, 560, 16)) - self.line.setFrameShape(QtWidgets.QFrame.HLine) - self.line.setFrameShadow(QtWidgets.QFrame.Sunken) + self.line.setFrameShape(qtHLine) + self.line.setFrameShadow(qtSunken) self.line.setObjectName("line") # Select Existing Mod diff --git a/release/reinstaller/reinstaller/reinstaller_plugin.py b/release/reinstaller/reinstaller/reinstaller_plugin.py index 4bb5cb2..8840975 100644 --- a/release/reinstaller/reinstaller/reinstaller_plugin.py +++ b/release/reinstaller/reinstaller/reinstaller_plugin.py @@ -5,7 +5,7 @@ class ReinstallerPlugin(SharedPlugin): def __init__(self): - super().__init__("Reinstaller", "Reinstaller", mobase.VersionInfo(1,0,5, mobase.ReleaseType.ALPHA)) + super().__init__("Reinstaller", "Reinstaller", mobase.VersionInfo(1,0,6, mobase.ReleaseType.ALPHA)) def init(self, organiser=mobase.IOrganizer): self.reinstaller = Reinstaller(organiser) diff --git a/release/reinstaller/shared/shared_icons.py b/release/reinstaller/shared/shared_icons.py index 6df51fc..a78fa74 100644 --- a/release/reinstaller/shared/shared_icons.py +++ b/release/reinstaller/shared/shared_icons.py @@ -1,4 +1,7 @@ -from PyQt5.QtGui import QIcon +try: + from PyQt5.QtGui import QIcon +except: + from PyQt6.QtGui import QIcon from pathlib import Path class SharedIcons(): diff --git a/release/reinstaller/shared/shared_paths.py b/release/reinstaller/shared/shared_paths.py index 44aa6a8..11d78a7 100644 --- a/release/reinstaller/shared/shared_paths.py +++ b/release/reinstaller/shared/shared_paths.py @@ -1,6 +1,9 @@ import mobase, os, winreg, glob from pathlib import Path, PurePath -from PyQt5.QtCore import QCoreApplication, qInf, qInfo +try: + from PyQt5.QtCore import QCoreApplication, qInfo +except: + from PyQt6.QtCore import QCoreApplication, qInfo class SharedPaths(): diff --git a/release/reinstaller/shared/shared_plugin.py b/release/reinstaller/shared/shared_plugin.py index 4b01a4e..583a8b0 100644 --- a/release/reinstaller/shared/shared_plugin.py +++ b/release/reinstaller/shared/shared_plugin.py @@ -1,5 +1,8 @@ import mobase -from PyQt5.QtCore import QCoreApplication +try: + from PyQt5.QtCore import QCoreApplication +except: + from PyQt6.QtCore import QCoreApplication from .shared_icons import SharedIcons from .shared_settings import SharedSettings @@ -26,6 +29,9 @@ def isActive(self): def __tr(self, trstr): return QCoreApplication.translate(self.pluginName, trstr) + def tr(self, trstr): + return self.__tr(trstr) + def icon(self): return self.icons.menuIcon() diff --git a/release/reinstaller/shared/shared_settings.py b/release/reinstaller/shared/shared_settings.py index 32c8a63..70b27b4 100644 --- a/release/reinstaller/shared/shared_settings.py +++ b/release/reinstaller/shared/shared_settings.py @@ -1,4 +1,7 @@ -from PyQt5.QtCore import QCoreApplication +try: + from PyQt5.QtCore import QCoreApplication +except: + from PyQt6.QtCore import QCoreApplication import mobase class SharedSettings(): diff --git a/release/rootbuilder/rootbuilder.json b/release/rootbuilder/rootbuilder.json new file mode 100644 index 0000000..1b526ce --- /dev/null +++ b/release/rootbuilder/rootbuilder.json @@ -0,0 +1,23 @@ +{ + "Name": "Root Builder", + "Author": "Kezyma", + "Description": "Root Builder is a Mod Organizer 2 plugin that allows you to manage files in the base game folder, not just the Data folder.", + "NexusUrl": "https://www.nexusmods.com/skyrimspecialedition/mods/31720", + "GithubUrl": "https://github.com/Kezyma/ModOrganizer-Plugins", + "DownloadUrl": "https://github.com/Kezyma/ModOrganizer-Plugins/releases/download/Current/rootbuilder.zip", + "PluginPath": [ "rootbuilder" ], + "LocalePath": [], + "DataPath": [ "data/rootbuilder" ], + "Versions": [ + { + "Version": "4.2.7", + "Released": "2021-12-13", + "MinSupport": "2.4.2", + "MaxSupport": "2.5.0", + "DownloadUrl": "https://github.com/Kezyma/ModOrganizer-Plugins/releases/download/rootbuilder-4.2.7/rootbuilder.4.2.7.zip", + "PluginPath": [ "rootbuilder" ], + "LocalePath": [], + "DataPath": [ "data/rootbuilder" ] + } + ] +} diff --git a/release/rootbuilder/rootbuilder/modules/rootbuilder_backup.py b/release/rootbuilder/rootbuilder/modules/rootbuilder_backup.py index f4bf43d..1f186a3 100644 --- a/release/rootbuilder/rootbuilder/modules/rootbuilder_backup.py +++ b/release/rootbuilder/rootbuilder/modules/rootbuilder_backup.py @@ -5,7 +5,10 @@ from .rootbuilder_paths import RootBuilderPaths from .rootbuilder_files import RootBuilderFiles import mobase, os, hashlib, json, shutil, stat -from PyQt5.QtCore import QCoreApplication, qInfo +try: + from PyQt5.QtCore import QCoreApplication, qInfo +except: + from PyQt6.QtCore import QCoreApplication, qInfo class RootBuilderBackup(): """ Root Builder backup module. Used to back up and restore vanilla game installations. """ diff --git a/release/rootbuilder/rootbuilder/modules/rootbuilder_copy.py b/release/rootbuilder/rootbuilder/modules/rootbuilder_copy.py index 14c7fa4..53202b5 100644 --- a/release/rootbuilder/rootbuilder/modules/rootbuilder_copy.py +++ b/release/rootbuilder/rootbuilder/modules/rootbuilder_copy.py @@ -1,12 +1,13 @@ from pathlib import Path - -from PyQt5.QtCore import qInf from .rootbuilder_settings import RootBuilderSettings from .rootbuilder_paths import RootBuilderPaths from .rootbuilder_files import RootBuilderFiles from .rootbuilder_backup import RootBuilderBackup from ...shared.shared_utilities import SharedUtilities -from PyQt5.QtCore import QCoreApplication, qInfo +try: + from PyQt5.QtCore import QCoreApplication, qInfo +except: + from PyQt6.QtCore import QCoreApplication, qInfo import mobase, os, json class RootBuilderCopy(): diff --git a/release/rootbuilder/rootbuilder/modules/rootbuilder_linker.py b/release/rootbuilder/rootbuilder/modules/rootbuilder_linker.py index 1376ed5..d81eb59 100644 --- a/release/rootbuilder/rootbuilder/modules/rootbuilder_linker.py +++ b/release/rootbuilder/rootbuilder/modules/rootbuilder_linker.py @@ -3,7 +3,10 @@ from .rootbuilder_files import RootBuilderFiles from ...shared.shared_utilities import SharedUtilities import mobase, os, json -from PyQt5.QtCore import QCoreApplication, qInfo +try: + from PyQt5.QtCore import QCoreApplication, qInfo +except: + from PyQt6.QtCore import QCoreApplication, qInfo class RootBuilderLinker(): """ Root Builder link module. Used to create links for specific file types. """ diff --git a/release/rootbuilder/rootbuilder/plugins/rootbuilder_plugin_mapper.py b/release/rootbuilder/rootbuilder/plugins/rootbuilder_plugin_mapper.py index 7bc8e92..1e1302f 100644 --- a/release/rootbuilder/rootbuilder/plugins/rootbuilder_plugin_mapper.py +++ b/release/rootbuilder/rootbuilder/plugins/rootbuilder_plugin_mapper.py @@ -1,5 +1,9 @@ -from PyQt5.QtCore import QCoreApplication -from PyQt5 import QtWidgets +try: + from PyQt5.QtCore import QCoreApplication, qInfo + from PyQt5 import QtWidgets +except: + from PyQt6.QtCore import QCoreApplication, qInfo + from PyQt6 import QtWidgets from ..rootbuilder_plugin import RootBuilderPlugin import mobase diff --git a/release/rootbuilder/rootbuilder/plugins/rootbuilder_tool_build.py b/release/rootbuilder/rootbuilder/plugins/rootbuilder_tool_build.py index 84f9d80..e3cbff8 100644 --- a/release/rootbuilder/rootbuilder/plugins/rootbuilder_tool_build.py +++ b/release/rootbuilder/rootbuilder/plugins/rootbuilder_tool_build.py @@ -1,4 +1,7 @@ -from PyQt5.QtCore import QCoreApplication +try: + from PyQt5.QtCore import QCoreApplication, qInfo +except: + from PyQt6.QtCore import QCoreApplication, qInfo from ..rootbuilder_plugin import RootBuilderPlugin import mobase diff --git a/release/rootbuilder/rootbuilder/plugins/rootbuilder_tool_clear.py b/release/rootbuilder/rootbuilder/plugins/rootbuilder_tool_clear.py index 61be015..08e99d0 100644 --- a/release/rootbuilder/rootbuilder/plugins/rootbuilder_tool_clear.py +++ b/release/rootbuilder/rootbuilder/plugins/rootbuilder_tool_clear.py @@ -1,4 +1,7 @@ -from PyQt5.QtCore import QCoreApplication +try: + from PyQt5.QtCore import QCoreApplication, qInfo +except: + from PyQt6.QtCore import QCoreApplication, qInfo from ..rootbuilder_plugin import RootBuilderPlugin import mobase diff --git a/release/rootbuilder/rootbuilder/plugins/rootbuilder_tool_manage.py b/release/rootbuilder/rootbuilder/plugins/rootbuilder_tool_manage.py index a0377dc..92bc7a4 100644 --- a/release/rootbuilder/rootbuilder/plugins/rootbuilder_tool_manage.py +++ b/release/rootbuilder/rootbuilder/plugins/rootbuilder_tool_manage.py @@ -1,5 +1,14 @@ -from PyQt5.QtCore import QCoreApplication -from PyQt5 import QtCore, QtWidgets +try: + from PyQt5.QtCore import QCoreApplication, qInfo + from PyQt5 import QtCore, QtWidgets + qtHLine = QtWidgets.QFrame.HLine + qtSunken = QtWidgets.QFrame.Sunken +except: + from PyQt6.QtCore import QCoreApplication, qInfo + from PyQt6 import QtCore, QtWidgets + qtHLine = QtWidgets.QFrame.Shape.HLine + qtSunken = QtWidgets.QFrame.Shadow.Sunken + from ..rootbuilder_plugin import RootBuilderPlugin import mobase @@ -43,8 +52,8 @@ def getDialog(self): self.line = QtWidgets.QFrame(dialog) self.line.setGeometry(QtCore.QRect(0, 30, 431, 16)) - self.line.setFrameShape(QtWidgets.QFrame.HLine) - self.line.setFrameShadow(QtWidgets.QFrame.Sunken) + self.line.setFrameShape(qtHLine) + self.line.setFrameShadow(qtSunken) self.line.setObjectName("line") # Backup Settings @@ -75,8 +84,8 @@ def getDialog(self): self.line_2 = QtWidgets.QFrame(dialog) self.line_2.setGeometry(QtCore.QRect(0, 95, 431, 16)) - self.line_2.setFrameShape(QtWidgets.QFrame.HLine) - self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken) + self.line_2.setFrameShape(qtHLine) + self.line_2.setFrameShadow(qtSunken) self.line_2.setObjectName("line_2") # Mode Settings @@ -111,8 +120,8 @@ def getDialog(self): self.line_3 = QtWidgets.QFrame(dialog) self.line_3.setGeometry(QtCore.QRect(0, 215, 431, 16)) - self.line_3.setFrameShape(QtWidgets.QFrame.HLine) - self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken) + self.line_3.setFrameShape(qtHLine) + self.line_3.setFrameShadow(qtSunken) self.line_3.setObjectName("line_3") # Misc Settings diff --git a/release/rootbuilder/rootbuilder/plugins/rootbuilder_tool_sync.py b/release/rootbuilder/rootbuilder/plugins/rootbuilder_tool_sync.py index e312379..e05bd26 100644 --- a/release/rootbuilder/rootbuilder/plugins/rootbuilder_tool_sync.py +++ b/release/rootbuilder/rootbuilder/plugins/rootbuilder_tool_sync.py @@ -1,4 +1,7 @@ -from PyQt5.QtCore import QCoreApplication +try: + from PyQt5.QtCore import QCoreApplication, qInfo +except: + from PyQt6.QtCore import QCoreApplication, qInfo from ..rootbuilder_plugin import RootBuilderPlugin import mobase diff --git a/release/rootbuilder/rootbuilder/rootbuilder.py b/release/rootbuilder/rootbuilder/rootbuilder.py index ff2ee9f..139e364 100644 --- a/release/rootbuilder/rootbuilder/rootbuilder.py +++ b/release/rootbuilder/rootbuilder/rootbuilder.py @@ -1,4 +1,7 @@ -from PyQt5.QtCore import QCoreApplication, qInfo +try: + from PyQt5.QtCore import QCoreApplication, qInfo +except: + from PyQt6.QtCore import QCoreApplication, qInfo from .modules.rootbuilder_settings import RootBuilderSettings from .modules.rootbuilder_paths import RootBuilderPaths from .modules.rootbuilder_files import RootBuilderFiles diff --git a/release/rootbuilder/rootbuilder/rootbuilder_plugin.py b/release/rootbuilder/rootbuilder/rootbuilder_plugin.py index da061e8..bbba5b9 100644 --- a/release/rootbuilder/rootbuilder/rootbuilder_plugin.py +++ b/release/rootbuilder/rootbuilder/rootbuilder_plugin.py @@ -1,12 +1,15 @@ import mobase from ..shared.shared_plugin import SharedPlugin from .rootbuilder import RootBuilder -from PyQt5.QtCore import QCoreApplication +try: + from PyQt5.QtCore import QCoreApplication, qInfo +except: + from PyQt6.QtCore import QCoreApplication, qInfo class RootBuilderPlugin(SharedPlugin): def __init__(self): - super().__init__("RootBuilder", "Root Builder", mobase.VersionInfo(4, 2, 6, mobase.ReleaseType.BETA)) + super().__init__("RootBuilder", "Root Builder", mobase.VersionInfo(4, 2, 7, mobase.ReleaseType.BETA)) def init(self, organiser=mobase.IOrganizer): self.rootBuilder = RootBuilder(organiser) diff --git a/release/rootbuilder/shared/shared_icons.py b/release/rootbuilder/shared/shared_icons.py index 6df51fc..a78fa74 100644 --- a/release/rootbuilder/shared/shared_icons.py +++ b/release/rootbuilder/shared/shared_icons.py @@ -1,4 +1,7 @@ -from PyQt5.QtGui import QIcon +try: + from PyQt5.QtGui import QIcon +except: + from PyQt6.QtGui import QIcon from pathlib import Path class SharedIcons(): diff --git a/release/rootbuilder/shared/shared_paths.py b/release/rootbuilder/shared/shared_paths.py index 44aa6a8..11d78a7 100644 --- a/release/rootbuilder/shared/shared_paths.py +++ b/release/rootbuilder/shared/shared_paths.py @@ -1,6 +1,9 @@ import mobase, os, winreg, glob from pathlib import Path, PurePath -from PyQt5.QtCore import QCoreApplication, qInf, qInfo +try: + from PyQt5.QtCore import QCoreApplication, qInfo +except: + from PyQt6.QtCore import QCoreApplication, qInfo class SharedPaths(): diff --git a/release/rootbuilder/shared/shared_plugin.py b/release/rootbuilder/shared/shared_plugin.py index 4b01a4e..583a8b0 100644 --- a/release/rootbuilder/shared/shared_plugin.py +++ b/release/rootbuilder/shared/shared_plugin.py @@ -1,5 +1,8 @@ import mobase -from PyQt5.QtCore import QCoreApplication +try: + from PyQt5.QtCore import QCoreApplication +except: + from PyQt6.QtCore import QCoreApplication from .shared_icons import SharedIcons from .shared_settings import SharedSettings @@ -26,6 +29,9 @@ def isActive(self): def __tr(self, trstr): return QCoreApplication.translate(self.pluginName, trstr) + def tr(self, trstr): + return self.__tr(trstr) + def icon(self): return self.icons.menuIcon() diff --git a/release/rootbuilder/shared/shared_settings.py b/release/rootbuilder/shared/shared_settings.py index 32c8a63..70b27b4 100644 --- a/release/rootbuilder/shared/shared_settings.py +++ b/release/rootbuilder/shared/shared_settings.py @@ -1,4 +1,7 @@ -from PyQt5.QtCore import QCoreApplication +try: + from PyQt5.QtCore import QCoreApplication +except: + from PyQt6.QtCore import QCoreApplication import mobase class SharedSettings(): diff --git a/release/shortcutter/shared/shared_icons.py b/release/shortcutter/shared/shared_icons.py index 6df51fc..a78fa74 100644 --- a/release/shortcutter/shared/shared_icons.py +++ b/release/shortcutter/shared/shared_icons.py @@ -1,4 +1,7 @@ -from PyQt5.QtGui import QIcon +try: + from PyQt5.QtGui import QIcon +except: + from PyQt6.QtGui import QIcon from pathlib import Path class SharedIcons(): diff --git a/release/shortcutter/shared/shared_paths.py b/release/shortcutter/shared/shared_paths.py index 44aa6a8..11d78a7 100644 --- a/release/shortcutter/shared/shared_paths.py +++ b/release/shortcutter/shared/shared_paths.py @@ -1,6 +1,9 @@ import mobase, os, winreg, glob from pathlib import Path, PurePath -from PyQt5.QtCore import QCoreApplication, qInf, qInfo +try: + from PyQt5.QtCore import QCoreApplication, qInfo +except: + from PyQt6.QtCore import QCoreApplication, qInfo class SharedPaths(): diff --git a/release/shortcutter/shared/shared_plugin.py b/release/shortcutter/shared/shared_plugin.py index 4b01a4e..583a8b0 100644 --- a/release/shortcutter/shared/shared_plugin.py +++ b/release/shortcutter/shared/shared_plugin.py @@ -1,5 +1,8 @@ import mobase -from PyQt5.QtCore import QCoreApplication +try: + from PyQt5.QtCore import QCoreApplication +except: + from PyQt6.QtCore import QCoreApplication from .shared_icons import SharedIcons from .shared_settings import SharedSettings @@ -26,6 +29,9 @@ def isActive(self): def __tr(self, trstr): return QCoreApplication.translate(self.pluginName, trstr) + def tr(self, trstr): + return self.__tr(trstr) + def icon(self): return self.icons.menuIcon() diff --git a/release/shortcutter/shared/shared_settings.py b/release/shortcutter/shared/shared_settings.py index 32c8a63..70b27b4 100644 --- a/release/shortcutter/shared/shared_settings.py +++ b/release/shortcutter/shared/shared_settings.py @@ -1,4 +1,7 @@ -from PyQt5.QtCore import QCoreApplication +try: + from PyQt5.QtCore import QCoreApplication +except: + from PyQt6.QtCore import QCoreApplication import mobase class SharedSettings(): diff --git a/release/shortcutter/shortcutter.json b/release/shortcutter/shortcutter.json new file mode 100644 index 0000000..a7f82eb --- /dev/null +++ b/release/shortcutter/shortcutter.json @@ -0,0 +1,23 @@ +{ + "Name": "Shortcutter", + "Author": "Kezyma", + "Description": "Shortcutter gives you the option of quickly creating instance and profile specific desktop shortcuts, allowing you to quickly launch your game without having to manually switch inside Mod Organizer.", + "NexusUrl": "https://www.nexusmods.com/skyrimspecialedition/mods/59827", + "GithubUrl": "https://github.com/Kezyma/ModOrganizer-Plugins", + "DownloadUrl": "https://github.com/Kezyma/ModOrganizer-Plugins/releases/download/Current/shortcutter.zip", + "PluginPath": [ "shortcutter" ], + "LocalePath": [], + "DataPath": [ "data/shortcutter" ], + "Versions": [ + { + "Version": "1.0.4", + "Released": "2021-12-13", + "MinSupport": "2.4.2", + "MaxSupport": "2.5.0", + "DownloadUrl": "https://github.com/Kezyma/ModOrganizer-Plugins/releases/download/shortcutter-1.0.4/shortcutter.zip", + "PluginPath": [ "shortcutter" ], + "LocalePath": [], + "DataPath": [ "data/shortcutter" ] + } + ] +} diff --git a/release/shortcutter/shortcutter/plugins/shortcutter_tool_create.py b/release/shortcutter/shortcutter/plugins/shortcutter_tool_create.py index f5c83be..1446f84 100644 --- a/release/shortcutter/shortcutter/plugins/shortcutter_tool_create.py +++ b/release/shortcutter/shortcutter/plugins/shortcutter_tool_create.py @@ -1,7 +1,20 @@ -from PyQt5.QtWidgets import QFileDialog, QFileIconProvider, QInputDialog, QLineEdit, QWidget -from PyQt5.QtCore import QCoreApplication, qInfo, QSize -from PyQt5 import QtGui, QtWidgets, QtCore -from PyQt5.QtWidgets import QFileIconProvider +try: + from PyQt5.QtWidgets import QFileDialog, QFileIconProvider, QInputDialog, QLineEdit, QWidget + from PyQt5.QtCore import QCoreApplication, qInfo, QSize + from PyQt5 import QtGui, QtWidgets, QtCore + from PyQt5.QtWidgets import QFileIconProvider + qtHorizontal = QtCore.Qt.Horizontal + qtCancel = QtWidgets.QDialogButtonBox.Cancel + qtOkay = QtWidgets.QDialogButtonBox.Ok +except: + from PyQt6.QtWidgets import QFileDialog, QFileIconProvider, QInputDialog, QLineEdit, QWidget + from PyQt6.QtCore import QCoreApplication, qInfo, QSize + from PyQt6 import QtGui, QtWidgets, QtCore + from PyQt6.QtWidgets import QFileIconProvider + qtHorizontal = QtCore.Qt.Orientation.Horizontal + qtCancel = QtWidgets.QDialogButtonBox.StandardButton.Cancel + qtOkay = QtWidgets.QDialogButtonBox.StandardButton.Ok + from ..shortcutter_plugin import ShortcutterPlugin import mobase @@ -29,8 +42,7 @@ def display(self): self.dialog.show() self.rebindUi() self.setInitialSettings() - - + invalidCharacters = '|<>"?*:/\\' def createShortcut(self): profile = self.profileSelect.currentText() @@ -90,8 +102,8 @@ def setupUi(self, widget): self.buttonBox = QtWidgets.QDialogButtonBox(widget) self.buttonBox.setGeometry(QtCore.QRect(230, 180, 166, 32)) - self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) + self.buttonBox.setOrientation(qtHorizontal) + self.buttonBox.setStandardButtons(qtCancel|qtOkay) self.buttonBox.setObjectName("buttonBox") self.profileLabel = QtWidgets.QLabel(widget) diff --git a/release/shortcutter/shortcutter/shortcutter_plugin.py b/release/shortcutter/shortcutter/shortcutter_plugin.py index ca103fb..3048d8e 100644 --- a/release/shortcutter/shortcutter/shortcutter_plugin.py +++ b/release/shortcutter/shortcutter/shortcutter_plugin.py @@ -5,7 +5,7 @@ class ShortcutterPlugin(SharedPlugin): def __init__(self): - super().__init__("Shortcutter", "Shortcutter", mobase.VersionInfo(1,0,3, mobase.ReleaseType.ALPHA)) + super().__init__("Shortcutter", "Shortcutter", mobase.VersionInfo(1,0,4, mobase.ReleaseType.ALPHA)) def init(self, organiser=mobase.IOrganizer): self.shortcutter = Shortcutter(organiser) diff --git a/src/pluginfinder/models/plugin_data.py b/src/pluginfinder/models/plugin_data.py new file mode 100644 index 0000000..f84f278 --- /dev/null +++ b/src/pluginfinder/models/plugin_data.py @@ -0,0 +1,85 @@ +import mobase, os +from plugin_version import PluginVersion + +class PluginData(self): + + def __init__(self, jsonObject=dict): + self.json = jsonObject + super().__init__() + + def getJsonProperty(self, key=str): + if key in self.json.keys(): + return self.json[key] + else: + return None + + def getJsonArray(self, key=str): + data = self.getJsonProperty(key) + res = [] + if data: + try: + for val in data: + res.append(data) + return res + except: + return None + else: + return None + + def identifier(self): + return str(self.getJsonProperty("Identifier")) + + def name(self): + return str(self.getJsonProperty("Name")) + + def description(self): + return str(self.getJsonProperty("Description")) + + def nexusUrl(self): + return str(self.getJsonProperty("NexusUrl")) + + def githubUrl(self): + return str(self.getJsonProperty("GithubUrl")) + + def downloadUrl(self): + return str(self.getJsonProperty("DownloadUrl")) + + def pluginPaths(self): + paths = [] + data = self.getJsonArray("PluginPath") + if data: + for path in data: + paths.append(str(path)) + return paths + else: + return None + + def localePaths(self): + paths = [] + data = self.getJsonArray("LocalePath") + if data: + for path in data: + paths.append(str(path)) + return paths + else: + return None + + def dataPaths(self): + paths = [] + data = self.getJsonArray("DataPath") + if data: + for path in data: + paths.append(str(path)) + return paths + else: + return None + + def versions(): + versions = [] + data = self.getJsonArray("Versions") + if data: + for version in data: + versions.append(PluginVersion(version)) + return versions + else: + return None \ No newline at end of file diff --git a/src/pluginfinder/models/plugin_version.py b/src/pluginfinder/models/plugin_version.py new file mode 100644 index 0000000..fb7b325 --- /dev/null +++ b/src/pluginfinder/models/plugin_version.py @@ -0,0 +1,71 @@ +import mobase, os + +class PluginVersion(self): + + def __init__(self, jsonObject=dict): + self.json = jsonObject + super().__init__() + + def getJsonProperty(self, key=str): + if key in self.json.keys(): + return self.json[key] + else: + return None + + def getJsonArray(self, key=str): + data = self.getJsonProperty(key) + res = [] + if data: + try: + for val in data: + res.append(data) + return res + except: + return None + else: + return None + + def released(self): + return str(self.getJsonProperty("Released")) + + def minSupport(self): + return str(self.getJsonProperty("MinSupport")) + + def maxSupport(self): + return str(self.getJsonProperty("MaxSupport")) + + def version(self): + return str(self.getJsonProperty("Version")) + + def downloadUrl(self): + return str(self.getJsonProperty("DownloadUrl")) + + def pluginPaths(self): + paths = [] + data = self.getJsonArray("PluginPath") + if data: + for path in data: + paths.append(str(path)) + return paths + else: + return None + + def localePaths(self): + paths = [] + data = self.getJsonArray("LocalePath") + if data: + for path in data: + paths.append(str(path)) + return paths + else: + return None + + def dataPaths(self): + paths = [] + data = self.getJsonArray("DataPath") + if data: + for path in data: + paths.append(str(path)) + return paths + else: + return None diff --git a/src/pluginfinder/modules/pluginfinder_paths.py b/src/pluginfinder/modules/pluginfinder_paths.py index 5dc7781..f0160a1 100644 --- a/src/pluginfinder/modules/pluginfinder_paths.py +++ b/src/pluginfinder/modules/pluginfinder_paths.py @@ -7,15 +7,7 @@ class PluginFinderPaths(SharedPaths): def __init__(self, organiser=mobase.IOrganizer): super().__init__("PluginFinder", organiser) - - _directoryJsonPath = str() - def directoryJsonPath(self): - if self._directoryJsonPath == str(): - self._directoryJsonPath = str(self.pluginDataPath() / "pluginfinder_directory.json") - return Path(self._directoryJsonPath) - - githubDirectoryUrl = "https://raw.githubusercontent.com/Kezyma/ModOrganizer-Plugins/main/src/pluginfinder/pluginfinder_directory.json" - + _modOrganizerPluginPath = str() def modOrganizerPluginPath(self): if self._modOrganizerPluginPath == str(): @@ -40,4 +32,31 @@ def pluginStageTempPath(self): self._pluginStageTempPath = self.pluginDataPath() / "DownloadedPlugin" if not Path(self._pluginStageTempPath).exists(): os.makedirs(self._pluginStageTempPath) - return Path(self._pluginStageTempPath) \ No newline at end of file + return Path(self._pluginStageTempPath) + + + _pluginDirectoryUrl = "https://raw.githubusercontent.com/Kezyma/ModOrganizer-Plugins/main/src/pluginfinder/plugin_directory.json" + def pluginDirectoryUrl(self): + """ Url to the directory json for updating. """ + return self._pluginDirectoryUrl + + _initialDirectoryPath = str() + def initialDirectoryPath(self): + """ Path to the initial directory json to be deployed during install. """ + if self._initialDirectoryPath == str(): + self._initialDirectoryPath = str(Path(__file__).parent.parent / "plugin_directory.json") + return self._initialDirectoryPath; + + _directoryJsonPath = str() + def directoryJsonPath(self): + """ Path to the current plugin directory json file. """ + if self._directoryJsonPath == str(): + self._directoryJsonPath = str(self.pluginDataPath() / "plugin_directory.json") + return Path(self._directoryJsonPath) + + _pluginDataCachePath = str() + def pluginDataCachePath(self, pluginId=str): + """ Gets the location of the current plugin json file. """ + if self._pluginDataCachePath == str(): + self._pluginDataCachePath = self.pluginDataPath() / "directory" + return self._pluginDataCachePath / (str(pluginId) + ".json") diff --git a/src/pluginfinder/modules/pluginfinder_search.py b/src/pluginfinder/modules/pluginfinder_search.py new file mode 100644 index 0000000..b1f8783 --- /dev/null +++ b/src/pluginfinder/modules/pluginfinder_search.py @@ -0,0 +1,92 @@ +import mobase, os, urllib, json +from pathlib import Path +from datetime import datetime, timedelta +from itertools import islice +from pluginfinder_paths import PluginFinderPaths +from pluginfinder_files import PluginFinderFiles +from ...shared.shared_utilities import SharedUtilities +from ..models.plugin_data import PluginData + +class PluginFinderSearch(): + + def __init__(self, organiser=mobase.IOrganizer, paths=PluginFinderPaths, files=PluginFinderFiles): + self.organiser = organiser + self.paths = paths + self.files = files + self.utilities = SharedUtilities() + super().__init__() + + def deployInitialDirectory(self): + """ Deploys the initial directory file, only happens on first run. """ + if Path(self.paths.initialDirectoryPath()).exists(): + self.utilities.moveTo(self.paths.initialDirectoryPath(), self.paths.directoryJsonPath()) + + def updateDirectory(self): + """ Attempt to download a directory update from Github. """ + try: + data = json.loads(urllib.request.urlopen(self.paths.pluginDirectoryUrl()).read()) + with open(self.paths.directoryJsonPath(), "w") as rcJson: + json.dump(data, rcJson) + except: + qInfo("Could not download update.") + urllib.request.urlcleanup() + + def directory(self): + """ Get the directory as json. """ + # Deploy if it's first run. + self.deployInitialDirectory() + # If the file is missing or old, update it. + if not Path(self.paths.directoryJsonPath()).exists(): + if datetime.fromtimestamp(os.path.getmtime(str(self.paths.directoryJsonPath()))) < (datetime.today() - timedelta(days=1)): + self.updateDirectory() + # Load the directory file. + directory = json.load(open(self.paths.directoryJsonPath())) + return directory + + def searchDirectory(self, searchTerms=str): + """ Searches the directory by plugin name. """ + results = [] + for plugin in self.directory(): + if "Name" in plugin: + if searchTerms in plugin["Name"]: + results.append(plugin) + return results + + def updatePluginData(self, pluginId=str): + """ Gets the json file for the current plugin. """ + for plugin in self.directory(): + if plugin["Identifier"] == str(pluginId): + url = plugin["Manifest"] + try: + data = json.loads(urllib.request.urlopen(str(url)).read()) + with open(self.paths.pluginDataCachePath(pluginId) "w") as rcJson: + json.dump(data, rcJson) + except: + qInfo("Could not download update.") + urllib.request.urlcleanup() + + def pluginData(self, pluginId=str): + """ Loads the data for a plugin. """ + # If the file is missing or old, update it. + if not Path(self.paths.pluginDataCachePath(pluginId)).exists() or datetime.fromtimestamp(os.path.getmtime(str(self.paths.pluginDataCachePath(pluginId)))) < (datetime.today() - timedelta(days=1)): + self.updatePluginData(pluginId) + # If the file now exists (it should), load it. + if Path(self.paths.pluginDataCachePath(pluginId)).exists(): + try: + data = json.load(open(self.paths.pluginDataCachePath(pluginId))) + data["Identifier"] = str(pluginId) + return PluginData(data) + except: + return None + # Return an null if we can't load the file. + return None + + def pagedPluginData(self, searchTerms=str, page=int, pageSize=int): + """ Get a paged list of plugin data. """ + manifestSearch = self.searchDirectory(searchTerms) + pagedList = list(islice(manifestSearch, ((page-1)*pageSize), ((page-1)*pageSize) + pageSize)) + results = [] + for item in pagedList: + if "Identifier" in item: + results.append(self.pluginData(str(item["Identifier"]))) + return results \ No newline at end of file diff --git a/src/pluginfinder/plugin_directory.json b/src/pluginfinder/plugin_directory.json index d1a991c..3f6a86a 100644 --- a/src/pluginfinder/plugin_directory.json +++ b/src/pluginfinder/plugin_directory.json @@ -2,21 +2,21 @@ { "Name": "Root Builder", "Identifier": "rootbuilder", - "Manifest": "" + "Manifest": "https://raw.githubusercontent.com/Kezyma/ModOrganizer-Plugins/main/readme/rootbuilder/rootbuilder.json" }, { "Name": "Reinstaller", "Identifier": "reinstaller", - "Manifest": "" + "Manifest": "https://raw.githubusercontent.com/Kezyma/ModOrganizer-Plugins/main/readme/reinstaller/reinstaller.json" }, { "Name": "Shortcutter", "Identifier": "shortcutter", - "Manifest": "" + "Manifest": "https://raw.githubusercontent.com/Kezyma/ModOrganizer-Plugins/main/readme/shortcutter/shortcutter.json" }, { "Name": "Plugin Finder", "Identifier": "pluginfinder", - "Manifest": "" + "Manifest": "https://raw.githubusercontent.com/Kezyma/ModOrganizer-Plugins/main/readme/pluginfinder/pluginfinder.json" } ] \ No newline at end of file diff --git a/src/pluginfinder/pluginfinder.py b/src/pluginfinder/pluginfinder.py index 047aab0..ad9d2a7 100644 --- a/src/pluginfinder/pluginfinder.py +++ b/src/pluginfinder/pluginfinder.py @@ -1,9 +1,13 @@ import mobase, json, urllib.request, zipfile, os, shutil, re +from src.pluginfinder.modules.pluginfinder_search import PluginFinderSearch from ..shared.shared_utilities import SharedUtilities from .modules.pluginfinder_paths import PluginFinderPaths from .modules.pluginfinder_files import PluginFinderFiles -from PyQt5.QtCore import QCoreApplication, qInfo from pathlib import Path +try: + from PyQt5.QtCore import QCoreApplication, qInfo +except: + from PyQt6.QtCore import QCoreApplication, qInfo # TODO: Check for updates function to get all installed plugins again and check if the version has changed. # TODO: Search function to filter plugins by text @@ -60,33 +64,10 @@ def __init__(self, organiser = mobase.IOrganizer): self.organiser = organiser self.files = PluginFinderFiles(self.organiser) self.paths = PluginFinderPaths(self.organiser) + self.search = PluginFinderSearch(self.organiser, self.paths, self.files) self.utilities = SharedUtilities() super().__init__() - - def deploy(self): - """ Deploys the directory file to plugin data and attempts to update it. """ - # Copy the default directory over to the plugin data folder. - jsonPath = str(Path(__file__).parent / "pluginfinder_directory.json") - if Path(jsonPath).exists(): - self.utilities.moveTo(jsonPath, self.paths.directoryJsonPath()) - # Try and update the directory from the github repo. - self.updateDirectory() - - def updateDirectory(self): - """ Attempt to download a directory update from Github. """ - try: - data = json.loads(urllib.request.urlopen(self.paths.githubDirectoryUrl).read()) - with open(self.paths.directoryJsonPath(), "w") as rcJson: - json.dump(data, rcJson) - except: - qInfo("Could not download update.") - urllib.request.urlcleanup() - - def directory(self): - """ Get the directory as json. """ - directory = json.load(open(self.paths.directoryJsonPath())) - return directory - + def install(self, pluginId=str): """ Installs a plugin. """ qInfo("Installing " + str(pluginId)) diff --git a/src/reinstaller/plugins/reinstaller_tool_create.py b/src/reinstaller/plugins/reinstaller_tool_create.py index 031066b..a97c049 100644 --- a/src/reinstaller/plugins/reinstaller_tool_create.py +++ b/src/reinstaller/plugins/reinstaller_tool_create.py @@ -1,6 +1,11 @@ -from PyQt5.QtWidgets import QInputDialog, QLineEdit -from PyQt5.QtCore import QCoreApplication -from PyQt5 import QtWidgets +try: + from PyQt5.QtWidgets import QInputDialog, QLineEdit + from PyQt5.QtCore import QCoreApplication + from PyQt5 import QtWidgets +except: + from PyQt6.QtWidgets import QInputDialog, QLineEdit + from PyQt6.QtCore import QCoreApplication + from PyQt6 import QtWidgets from ..reinstaller_plugin import ReinstallerPlugin import mobase diff --git a/src/reinstaller/plugins/reinstaller_tool_delete.py b/src/reinstaller/plugins/reinstaller_tool_delete.py index 2de9cfa..0252a02 100644 --- a/src/reinstaller/plugins/reinstaller_tool_delete.py +++ b/src/reinstaller/plugins/reinstaller_tool_delete.py @@ -1,6 +1,11 @@ -from PyQt5.QtWidgets import QInputDialog -from PyQt5.QtCore import QCoreApplication -from PyQt5 import QtWidgets +try: + from PyQt5.QtWidgets import QInputDialog, QLineEdit + from PyQt5.QtCore import QCoreApplication + from PyQt5 import QtWidgets +except: + from PyQt6.QtWidgets import QInputDialog, QLineEdit + from PyQt6.QtCore import QCoreApplication + from PyQt6 import QtWidgets from ..reinstaller_plugin import ReinstallerPlugin import mobase, shutil, os diff --git a/src/reinstaller/plugins/reinstaller_tool_install.py b/src/reinstaller/plugins/reinstaller_tool_install.py index b369a36..627ec1d 100644 --- a/src/reinstaller/plugins/reinstaller_tool_install.py +++ b/src/reinstaller/plugins/reinstaller_tool_install.py @@ -1,6 +1,11 @@ -from PyQt5.QtWidgets import QInputDialog -from PyQt5.QtCore import QCoreApplication -from PyQt5 import QtWidgets +try: + from PyQt5.QtWidgets import QInputDialog, QLineEdit + from PyQt5.QtCore import QCoreApplication + from PyQt5 import QtWidgets +except: + from PyQt6.QtWidgets import QInputDialog, QLineEdit + from PyQt6.QtCore import QCoreApplication + from PyQt6 import QtWidgets from ..reinstaller_plugin import ReinstallerPlugin import mobase, os diff --git a/src/reinstaller/plugins/reinstaller_tool_manage.py b/src/reinstaller/plugins/reinstaller_tool_manage.py index 2490193..8bf7639 100644 --- a/src/reinstaller/plugins/reinstaller_tool_manage.py +++ b/src/reinstaller/plugins/reinstaller_tool_manage.py @@ -1,5 +1,15 @@ -from PyQt5.QtCore import QCoreApplication -from PyQt5 import QtWidgets, QtCore +try: + from PyQt5.QtWidgets import QInputDialog, QLineEdit + from PyQt5.QtCore import QCoreApplication + from PyQt5 import QtWidgets, QtCore + qtHLine = QtWidgets.QFrame.HLine + qtSunken = QtWidgets.QFrame.Sunken +except: + from PyQt6.QtWidgets import QInputDialog, QLineEdit + from PyQt6.QtCore import QCoreApplication + from PyQt6 import QtWidgets, QtCore + qtHLine = QtWidgets.QFrame.Shape.HLine + qtSunken = QtWidgets.QFrame.Shadow.Sunken from pathlib import Path from ..reinstaller_plugin import ReinstallerPlugin import mobase @@ -122,8 +132,8 @@ def getDialog(self): self.line = QtWidgets.QFrame(dialog) self.line.setGeometry(QtCore.QRect(0, 45, 560, 16)) - self.line.setFrameShape(QtWidgets.QFrame.HLine) - self.line.setFrameShadow(QtWidgets.QFrame.Sunken) + self.line.setFrameShape(qtHLine) + self.line.setFrameShadow(qtSunken) self.line.setObjectName("line") # Select Existing Mod diff --git a/src/reinstaller/reinstaller_plugin.py b/src/reinstaller/reinstaller_plugin.py index 4bb5cb2..8840975 100644 --- a/src/reinstaller/reinstaller_plugin.py +++ b/src/reinstaller/reinstaller_plugin.py @@ -5,7 +5,7 @@ class ReinstallerPlugin(SharedPlugin): def __init__(self): - super().__init__("Reinstaller", "Reinstaller", mobase.VersionInfo(1,0,5, mobase.ReleaseType.ALPHA)) + super().__init__("Reinstaller", "Reinstaller", mobase.VersionInfo(1,0,6, mobase.ReleaseType.ALPHA)) def init(self, organiser=mobase.IOrganizer): self.reinstaller = Reinstaller(organiser) diff --git a/src/rootbuilder/modules/rootbuilder_backup.py b/src/rootbuilder/modules/rootbuilder_backup.py index f4bf43d..1f186a3 100644 --- a/src/rootbuilder/modules/rootbuilder_backup.py +++ b/src/rootbuilder/modules/rootbuilder_backup.py @@ -5,7 +5,10 @@ from .rootbuilder_paths import RootBuilderPaths from .rootbuilder_files import RootBuilderFiles import mobase, os, hashlib, json, shutil, stat -from PyQt5.QtCore import QCoreApplication, qInfo +try: + from PyQt5.QtCore import QCoreApplication, qInfo +except: + from PyQt6.QtCore import QCoreApplication, qInfo class RootBuilderBackup(): """ Root Builder backup module. Used to back up and restore vanilla game installations. """ diff --git a/src/rootbuilder/modules/rootbuilder_copy.py b/src/rootbuilder/modules/rootbuilder_copy.py index 14c7fa4..53202b5 100644 --- a/src/rootbuilder/modules/rootbuilder_copy.py +++ b/src/rootbuilder/modules/rootbuilder_copy.py @@ -1,12 +1,13 @@ from pathlib import Path - -from PyQt5.QtCore import qInf from .rootbuilder_settings import RootBuilderSettings from .rootbuilder_paths import RootBuilderPaths from .rootbuilder_files import RootBuilderFiles from .rootbuilder_backup import RootBuilderBackup from ...shared.shared_utilities import SharedUtilities -from PyQt5.QtCore import QCoreApplication, qInfo +try: + from PyQt5.QtCore import QCoreApplication, qInfo +except: + from PyQt6.QtCore import QCoreApplication, qInfo import mobase, os, json class RootBuilderCopy(): diff --git a/src/rootbuilder/modules/rootbuilder_linker.py b/src/rootbuilder/modules/rootbuilder_linker.py index 1376ed5..d81eb59 100644 --- a/src/rootbuilder/modules/rootbuilder_linker.py +++ b/src/rootbuilder/modules/rootbuilder_linker.py @@ -3,7 +3,10 @@ from .rootbuilder_files import RootBuilderFiles from ...shared.shared_utilities import SharedUtilities import mobase, os, json -from PyQt5.QtCore import QCoreApplication, qInfo +try: + from PyQt5.QtCore import QCoreApplication, qInfo +except: + from PyQt6.QtCore import QCoreApplication, qInfo class RootBuilderLinker(): """ Root Builder link module. Used to create links for specific file types. """ diff --git a/src/rootbuilder/plugins/rootbuilder_plugin_mapper.py b/src/rootbuilder/plugins/rootbuilder_plugin_mapper.py index 7bc8e92..1e1302f 100644 --- a/src/rootbuilder/plugins/rootbuilder_plugin_mapper.py +++ b/src/rootbuilder/plugins/rootbuilder_plugin_mapper.py @@ -1,5 +1,9 @@ -from PyQt5.QtCore import QCoreApplication -from PyQt5 import QtWidgets +try: + from PyQt5.QtCore import QCoreApplication, qInfo + from PyQt5 import QtWidgets +except: + from PyQt6.QtCore import QCoreApplication, qInfo + from PyQt6 import QtWidgets from ..rootbuilder_plugin import RootBuilderPlugin import mobase diff --git a/src/rootbuilder/plugins/rootbuilder_tool_build.py b/src/rootbuilder/plugins/rootbuilder_tool_build.py index 84f9d80..e3cbff8 100644 --- a/src/rootbuilder/plugins/rootbuilder_tool_build.py +++ b/src/rootbuilder/plugins/rootbuilder_tool_build.py @@ -1,4 +1,7 @@ -from PyQt5.QtCore import QCoreApplication +try: + from PyQt5.QtCore import QCoreApplication, qInfo +except: + from PyQt6.QtCore import QCoreApplication, qInfo from ..rootbuilder_plugin import RootBuilderPlugin import mobase diff --git a/src/rootbuilder/plugins/rootbuilder_tool_clear.py b/src/rootbuilder/plugins/rootbuilder_tool_clear.py index 61be015..08e99d0 100644 --- a/src/rootbuilder/plugins/rootbuilder_tool_clear.py +++ b/src/rootbuilder/plugins/rootbuilder_tool_clear.py @@ -1,4 +1,7 @@ -from PyQt5.QtCore import QCoreApplication +try: + from PyQt5.QtCore import QCoreApplication, qInfo +except: + from PyQt6.QtCore import QCoreApplication, qInfo from ..rootbuilder_plugin import RootBuilderPlugin import mobase diff --git a/src/rootbuilder/plugins/rootbuilder_tool_manage.py b/src/rootbuilder/plugins/rootbuilder_tool_manage.py index a0377dc..92bc7a4 100644 --- a/src/rootbuilder/plugins/rootbuilder_tool_manage.py +++ b/src/rootbuilder/plugins/rootbuilder_tool_manage.py @@ -1,5 +1,14 @@ -from PyQt5.QtCore import QCoreApplication -from PyQt5 import QtCore, QtWidgets +try: + from PyQt5.QtCore import QCoreApplication, qInfo + from PyQt5 import QtCore, QtWidgets + qtHLine = QtWidgets.QFrame.HLine + qtSunken = QtWidgets.QFrame.Sunken +except: + from PyQt6.QtCore import QCoreApplication, qInfo + from PyQt6 import QtCore, QtWidgets + qtHLine = QtWidgets.QFrame.Shape.HLine + qtSunken = QtWidgets.QFrame.Shadow.Sunken + from ..rootbuilder_plugin import RootBuilderPlugin import mobase @@ -43,8 +52,8 @@ def getDialog(self): self.line = QtWidgets.QFrame(dialog) self.line.setGeometry(QtCore.QRect(0, 30, 431, 16)) - self.line.setFrameShape(QtWidgets.QFrame.HLine) - self.line.setFrameShadow(QtWidgets.QFrame.Sunken) + self.line.setFrameShape(qtHLine) + self.line.setFrameShadow(qtSunken) self.line.setObjectName("line") # Backup Settings @@ -75,8 +84,8 @@ def getDialog(self): self.line_2 = QtWidgets.QFrame(dialog) self.line_2.setGeometry(QtCore.QRect(0, 95, 431, 16)) - self.line_2.setFrameShape(QtWidgets.QFrame.HLine) - self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken) + self.line_2.setFrameShape(qtHLine) + self.line_2.setFrameShadow(qtSunken) self.line_2.setObjectName("line_2") # Mode Settings @@ -111,8 +120,8 @@ def getDialog(self): self.line_3 = QtWidgets.QFrame(dialog) self.line_3.setGeometry(QtCore.QRect(0, 215, 431, 16)) - self.line_3.setFrameShape(QtWidgets.QFrame.HLine) - self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken) + self.line_3.setFrameShape(qtHLine) + self.line_3.setFrameShadow(qtSunken) self.line_3.setObjectName("line_3") # Misc Settings diff --git a/src/rootbuilder/plugins/rootbuilder_tool_sync.py b/src/rootbuilder/plugins/rootbuilder_tool_sync.py index e312379..e05bd26 100644 --- a/src/rootbuilder/plugins/rootbuilder_tool_sync.py +++ b/src/rootbuilder/plugins/rootbuilder_tool_sync.py @@ -1,4 +1,7 @@ -from PyQt5.QtCore import QCoreApplication +try: + from PyQt5.QtCore import QCoreApplication, qInfo +except: + from PyQt6.QtCore import QCoreApplication, qInfo from ..rootbuilder_plugin import RootBuilderPlugin import mobase diff --git a/src/rootbuilder/rootbuilder.py b/src/rootbuilder/rootbuilder.py index ff2ee9f..139e364 100644 --- a/src/rootbuilder/rootbuilder.py +++ b/src/rootbuilder/rootbuilder.py @@ -1,4 +1,7 @@ -from PyQt5.QtCore import QCoreApplication, qInfo +try: + from PyQt5.QtCore import QCoreApplication, qInfo +except: + from PyQt6.QtCore import QCoreApplication, qInfo from .modules.rootbuilder_settings import RootBuilderSettings from .modules.rootbuilder_paths import RootBuilderPaths from .modules.rootbuilder_files import RootBuilderFiles diff --git a/src/rootbuilder/rootbuilder_plugin.py b/src/rootbuilder/rootbuilder_plugin.py index da061e8..bbba5b9 100644 --- a/src/rootbuilder/rootbuilder_plugin.py +++ b/src/rootbuilder/rootbuilder_plugin.py @@ -1,12 +1,15 @@ import mobase from ..shared.shared_plugin import SharedPlugin from .rootbuilder import RootBuilder -from PyQt5.QtCore import QCoreApplication +try: + from PyQt5.QtCore import QCoreApplication, qInfo +except: + from PyQt6.QtCore import QCoreApplication, qInfo class RootBuilderPlugin(SharedPlugin): def __init__(self): - super().__init__("RootBuilder", "Root Builder", mobase.VersionInfo(4, 2, 6, mobase.ReleaseType.BETA)) + super().__init__("RootBuilder", "Root Builder", mobase.VersionInfo(4, 2, 7, mobase.ReleaseType.BETA)) def init(self, organiser=mobase.IOrganizer): self.rootBuilder = RootBuilder(organiser) diff --git a/src/shared/shared_icons.py b/src/shared/shared_icons.py index 6df51fc..a78fa74 100644 --- a/src/shared/shared_icons.py +++ b/src/shared/shared_icons.py @@ -1,4 +1,7 @@ -from PyQt5.QtGui import QIcon +try: + from PyQt5.QtGui import QIcon +except: + from PyQt6.QtGui import QIcon from pathlib import Path class SharedIcons(): diff --git a/src/shared/shared_paths.py b/src/shared/shared_paths.py index 44aa6a8..11d78a7 100644 --- a/src/shared/shared_paths.py +++ b/src/shared/shared_paths.py @@ -1,6 +1,9 @@ import mobase, os, winreg, glob from pathlib import Path, PurePath -from PyQt5.QtCore import QCoreApplication, qInf, qInfo +try: + from PyQt5.QtCore import QCoreApplication, qInfo +except: + from PyQt6.QtCore import QCoreApplication, qInfo class SharedPaths(): diff --git a/src/shared/shared_plugin.py b/src/shared/shared_plugin.py index 4b01a4e..583a8b0 100644 --- a/src/shared/shared_plugin.py +++ b/src/shared/shared_plugin.py @@ -1,5 +1,8 @@ import mobase -from PyQt5.QtCore import QCoreApplication +try: + from PyQt5.QtCore import QCoreApplication +except: + from PyQt6.QtCore import QCoreApplication from .shared_icons import SharedIcons from .shared_settings import SharedSettings @@ -26,6 +29,9 @@ def isActive(self): def __tr(self, trstr): return QCoreApplication.translate(self.pluginName, trstr) + def tr(self, trstr): + return self.__tr(trstr) + def icon(self): return self.icons.menuIcon() diff --git a/src/shared/shared_settings.py b/src/shared/shared_settings.py index 32c8a63..70b27b4 100644 --- a/src/shared/shared_settings.py +++ b/src/shared/shared_settings.py @@ -1,4 +1,7 @@ -from PyQt5.QtCore import QCoreApplication +try: + from PyQt5.QtCore import QCoreApplication +except: + from PyQt6.QtCore import QCoreApplication import mobase class SharedSettings(): diff --git a/src/shortcutter/plugins/shortcutter_tool_create.py b/src/shortcutter/plugins/shortcutter_tool_create.py index f5c83be..1446f84 100644 --- a/src/shortcutter/plugins/shortcutter_tool_create.py +++ b/src/shortcutter/plugins/shortcutter_tool_create.py @@ -1,7 +1,20 @@ -from PyQt5.QtWidgets import QFileDialog, QFileIconProvider, QInputDialog, QLineEdit, QWidget -from PyQt5.QtCore import QCoreApplication, qInfo, QSize -from PyQt5 import QtGui, QtWidgets, QtCore -from PyQt5.QtWidgets import QFileIconProvider +try: + from PyQt5.QtWidgets import QFileDialog, QFileIconProvider, QInputDialog, QLineEdit, QWidget + from PyQt5.QtCore import QCoreApplication, qInfo, QSize + from PyQt5 import QtGui, QtWidgets, QtCore + from PyQt5.QtWidgets import QFileIconProvider + qtHorizontal = QtCore.Qt.Horizontal + qtCancel = QtWidgets.QDialogButtonBox.Cancel + qtOkay = QtWidgets.QDialogButtonBox.Ok +except: + from PyQt6.QtWidgets import QFileDialog, QFileIconProvider, QInputDialog, QLineEdit, QWidget + from PyQt6.QtCore import QCoreApplication, qInfo, QSize + from PyQt6 import QtGui, QtWidgets, QtCore + from PyQt6.QtWidgets import QFileIconProvider + qtHorizontal = QtCore.Qt.Orientation.Horizontal + qtCancel = QtWidgets.QDialogButtonBox.StandardButton.Cancel + qtOkay = QtWidgets.QDialogButtonBox.StandardButton.Ok + from ..shortcutter_plugin import ShortcutterPlugin import mobase @@ -29,8 +42,7 @@ def display(self): self.dialog.show() self.rebindUi() self.setInitialSettings() - - + invalidCharacters = '|<>"?*:/\\' def createShortcut(self): profile = self.profileSelect.currentText() @@ -90,8 +102,8 @@ def setupUi(self, widget): self.buttonBox = QtWidgets.QDialogButtonBox(widget) self.buttonBox.setGeometry(QtCore.QRect(230, 180, 166, 32)) - self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) + self.buttonBox.setOrientation(qtHorizontal) + self.buttonBox.setStandardButtons(qtCancel|qtOkay) self.buttonBox.setObjectName("buttonBox") self.profileLabel = QtWidgets.QLabel(widget) diff --git a/src/shortcutter/shortcutter_plugin.py b/src/shortcutter/shortcutter_plugin.py index ca103fb..3048d8e 100644 --- a/src/shortcutter/shortcutter_plugin.py +++ b/src/shortcutter/shortcutter_plugin.py @@ -5,7 +5,7 @@ class ShortcutterPlugin(SharedPlugin): def __init__(self): - super().__init__("Shortcutter", "Shortcutter", mobase.VersionInfo(1,0,3, mobase.ReleaseType.ALPHA)) + super().__init__("Shortcutter", "Shortcutter", mobase.VersionInfo(1,0,4, mobase.ReleaseType.ALPHA)) def init(self, organiser=mobase.IOrganizer): self.shortcutter = Shortcutter(organiser) diff --git a/tools/deploy_all.bat b/tools/deploy_all.bat index 75e382a..6ce6d43 100644 --- a/tools/deploy_all.bat +++ b/tools/deploy_all.bat @@ -1 +1 @@ -call deploy.bat rootbuilder reinstaller shortcutter pluginfinder > deploy_log.txt \ No newline at end of file +call deploy.bat rootbuilder reinstaller shortcutter > deploy_log.txt \ No newline at end of file