diff --git a/src/profilesync/plugins/profilesync_tool_manage.py b/src/profilesync/plugins/profilesync_tool_manage.py index 9a4b3bc..da33df7 100644 --- a/src/profilesync/plugins/profilesync_tool_manage.py +++ b/src/profilesync/plugins/profilesync_tool_manage.py @@ -55,7 +55,9 @@ def profileRename(self, profile, oldName, newName): self.profilesync.renameProfile(oldName, newName) def syncProfile(self, modName, oldPriority, newPriority): - self.profilesync.syncToGroup(self.organiser.profileName()) + #self.profilesync.syncToGroup(self.organiser.profileName()) + qInfo("Moved " + modName + " from " + str(oldPriority) + " to " + str(newPriority)) + self.profilesync.syncFromCurrent() def checkGroupName(self): if self.addText.text().strip() == "" or self.addText.text().lower().strip() in [x.lower().strip() for x in self.profilesync.getSyncGroups().keys()]: diff --git a/src/profilesync/profilesync.py b/src/profilesync/profilesync.py index 28c0b32..c507f6f 100644 --- a/src/profilesync/profilesync.py +++ b/src/profilesync/profilesync.py @@ -87,20 +87,32 @@ def getProfileGroup(self, profileName=str): return g return "" + def syncFromCurrent(self): + profile = self.organiser.profile() + group = self.getProfileGroup(profile.name()) + if group != "": + qInfo("Sync from Profile " + profile.name() + " to Group " + group) + mods = self.organiser.modList().allModsByProfilePriority(profile) + modNl = [] + for m in mods: + modNl.append(m + "\n") + self.setGroupModlist(group, modNl) + def groupToProfile(self, groupName=str, profileName=str): qInfo("Sync from Group " + groupName + " to Profile " + profileName) - groupList = self.getGroupModlist(groupName) - mods, enabled = self.profileModlist(profileName) - results = [] - for mod in groupList: - if mod in enabled: - results.append("+" + mod) - else: - results.append("-" + mod) - results.reverse() - path = self.paths.profileModlistPath(profileName) - with open(str(path), "w") as w: - w.writelines(results) + if groupName != "": + groupList = self.getGroupModlist(groupName) + mods, enabled = self.profileModlist(profileName) + results = [] + for mod in groupList: + if mod in enabled: + results.append("+" + mod) + else: + results.append("-" + mod) + results.reverse() + path = self.paths.profileModlistPath(profileName) + with open(str(path), "w") as w: + w.writelines(results) def removeProfileFromGroup(self, groupName=str, profileName=str): groups = self.getSyncGroups()