Skip to content

Commit

Permalink
curation club plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Kezyma committed Dec 22, 2021
1 parent 7e80f68 commit 929ba2b
Show file tree
Hide file tree
Showing 19 changed files with 263 additions and 68 deletions.
34 changes: 0 additions & 34 deletions src/creationeer/plugins/creationeer_tool_manage.py

This file was deleted.

4 changes: 2 additions & 2 deletions src/creationeer_init.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mobase
from .creationeer.plugins.creationeer_tool_manage import CreationeerManageTool
from .creationeer.plugins.creationeer_tool_manage import CurationClubManageTool

def createPlugins():
return [
CreationeerManageTool()
CurationClubManageTool()
]
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import mobase, os, base64, re, json, urllib, pathlib
from .modules.creationeer_paths import CreationeerPaths
from .modules.creationeer_files import CreationeerFiles
from .modules.creationeer_settings import CreationeerSettings
from .modules.curationclub_paths import CurationClubPaths
from .modules.curationclub_files import CurationClubFiles
from .modules.curationclub_settings import CurationClubSettings
from ..shared.shared_utilities import SharedUtilities
from pathlib import Path
try:
from PyQt5.QtCore import QCoreApplication, qInfo
except:
from PyQt6.QtCore import QCoreApplication, qInfo

class Creationeer():
class CurationClub():

def __init__(self, organiser = mobase.IOrganizer):
self.organiser = organiser
self.settings = CreationeerSettings(self.organiser)
self.paths = CreationeerPaths(self.settings, self.organiser)
self.files = CreationeerFiles(self.settings, self.paths, self.organiser)
self.settings = CurationClubSettings(self.organiser)
self.paths = CurationClubPaths(self.settings, self.organiser)
self.files = CurationClubFiles(self.settings, self.paths, self.organiser)
self.utilities = SharedUtilities()
self.deployInitialCache()
super().__init__()
Expand Down Expand Up @@ -72,20 +72,24 @@ def sort(self):
if str(ext) not in cache[ccId]["Files"]:
cache[ccId]["Files"].append(str(ext))
self.saveCache(cache)
modNames = []
for key in cache.keys():
data = cache[key]
name = str(self.settings.modNameFormat()).replace("{creation}", str(data["Name"]))
modFolder = self.paths.modsPath() / name.strip().replace(":", " -").replace("_", "-")
modName = name.strip().replace(":", " -").replace("_", "-")
modFolder = self.paths.modsPath() / modName
if "Files" in data.keys():
for fileName in data["Files"]:
if fileName:

filePath = Path(self.paths.gamePath() / self.paths.gameDataDir()) / str(fileName)
if not filePath.exists():
filePath = Path(self.organiser.overwritePath()) / str(fileName)
if not filePath.exists():
modFile = self.files.findFileInMod(str(fileName))
if modFile:
filePath = Path(modFile)

if filePath.exists():
targetPath = modFolder / str(fileName)
if str(filePath) != str(targetPath):
Expand All @@ -104,6 +108,15 @@ def sort(self):
if not targetPath.parent.exists():
os.makedirs(str(targetPath.parent))
self.utilities.moveTo(manifestPath, targetPath)

modNames.append(modName)

# Activate everything.
self.organiser.refresh(True)
#for modName in modNames:
# self.organiser.modList().setActive(modName, True)
#self.organiser.refresh(True)
#self.organiser.refresh()

def readCache(self):
if self.paths.creationNameCacheFile().exists():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import mobase
from ..shared.shared_plugin import SharedPlugin
from .creationeer import Creationeer
from .curationclub import CurationClub
try:
from PyQt5.QtCore import QCoreApplication, qInfo
except:
from PyQt6.QtCore import QCoreApplication, qInfo

class CreationeerPlugin(SharedPlugin):
class CurationClubPlugin(SharedPlugin):

def __init__(self):
super().__init__("Creationeer", "Creationeer", mobase.VersionInfo(0,0,1, mobase.ReleaseType.ALPHA))
super().__init__("CurationClub", "Curation Club", mobase.VersionInfo(0,0,1, mobase.ReleaseType.ALPHA))

def init(self, organiser=mobase.IOrganizer):
self.creationeer = Creationeer(organiser)
self.curationclub = CurationClub(organiser)
res = super().init(organiser)
return res

Expand All @@ -22,7 +22,7 @@ def __tr(self, trstr):
def settings(self):
""" Current list of game settings for Mod Organizer. """
return [
mobase.PluginSetting("enabled","Enables Creationeer",True),
mobase.PluginSetting("enabled","Enables Curation Club",True),
mobase.PluginSetting("rootbuildersupport","Enables support for Root Builder.", False),
mobase.PluginSetting("modnameformat","Format for mod names.", "Creation Club - {creation}")
]
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import mobase, glob, os
from .creationeer_settings import CreationeerSettings
from .creationeer_paths import CreationeerPaths
from .curationclub_settings import CurationClubSettings
from .curationclub_paths import CurationClubPaths
from ...shared.shared_files import SharedFiles
from pathlib import Path
try:
from PyQt5.QtCore import QCoreApplication, qInfo
except:
from PyQt6.QtCore import QCoreApplication, qInfo

class CreationeerFiles(SharedFiles):
""" Creationeer file module. Used to get collections of files from different game paths. """
class CurationClubFiles(SharedFiles):
""" Curation Club file module. Used to get collections of files from different game paths. """

def __init__(self, settings=CreationeerSettings, paths=CreationeerPaths, organiser=mobase.IOrganizer):
def __init__(self, settings=CurationClubSettings, paths=CurationClubPaths, organiser=mobase.IOrganizer):
self.paths = paths
self.settings = settings
super().__init__("Creationeer", organiser)
super().__init__("CurationClub", organiser)

def creationMetaFiles(self):
metaFiles = []
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import mobase
from ...shared.shared_paths import SharedPaths
from .creationeer_settings import CreationeerSettings
from .curationclub_settings import CurationClubSettings
from pathlib import Path

class CreationeerPaths(SharedPaths):
""" Creationeer path module. Used to load various paths for the plugin. """
class CurationClubPaths(SharedPaths):
""" Curation Club path module. Used to load various paths for the plugin. """

def __init__(self, settings=CreationeerSettings, organiser=mobase.IOrganizer):
def __init__(self, settings=CurationClubSettings, organiser=mobase.IOrganizer):
self.settings = settings
super().__init__("Creationeer", organiser)
super().__init__("CurationClub", organiser)

_creationsMetaFolder = str()
def creationsMetaFolder(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import mobase
from ...shared.shared_settings import SharedSettings

class CreationeerSettings(SharedSettings):
""" Creationeer settings module. Used to load various plugin settings. """
class CurationClubSettings(SharedSettings):
""" Curation Club settings module. Used to load various plugin settings. """

def __init__(self, organiser = mobase.IOrganizer):
super().__init__("Creationeer", organiser)
super().__init__("CurationClub", organiser)

def rootBuilderSupport(self):
""" Whether to create and search Root mod folders. """
Expand Down
Loading

0 comments on commit 929ba2b

Please sign in to comment.