Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sort order reverses #90

Closed
Utumno opened this issue May 27, 2014 · 2 comments
Closed

sort order reverses #90

Utumno opened this issue May 27, 2014 · 2 comments
Assignees
Labels
C-bug Category: Bug, an acknowledged defect in the program M-relnotes Misc: Issue should be listed in the version history for its milestone M-svn Misc: Issue was carried over from the old SVN repo
Milestone

Comments

@Utumno
Copy link
Member

Utumno commented May 27, 2014

svn

When using sort by selected, after activating or deactivating a mod, each subsequent mod activated or deactivated will reverse the sort order. The fix is included here below.

On line 1055 in basher.py under def checkUncheckMod(self, *mods), add:

       self.colReverse[self.sort] = not self.colReverse.get(self.sort,0)

to the if statement block. My hypothesis is that if this line is not added, every time GetSortSettings() is called as a result of these dirty sorts, with the way GetSortSettings is written, it will be interpreted as the column being clicked on to be sorted (i.e "reverse == -1 and col == self.sort" is true in the next function defined in basher.py "def GetSortSettings(self,col,reverse)." The fix works as far as I can tell, but I have not exhaustively searched the code to make sure that is what was happening.

This is the offending if check in "checkUncheckMod()"

#--Mark sort as dirty
if self.selectedFirst:
    self.sortDirty = 1
    self.colReverse[self.sort] = not self.colReverse.get(self.sort,0)

The entire function is included next, and the fix is on the final line.

def checkUncheckMod(self, *mods):
    removed = []
    notDeactivatable = [ Path(x) for x in bush.game.nonDeactivatableFiles ]
    for item in mods:
        if item in removed or item in notDeactivatable: continue
        oldFiles = bosh.modInfos.ordered[:]
        fileName = GPath(item)
        #--Unselect?
        if self.data.isSelected(fileName):
            try:
                self.data.unselect(fileName)
                changed = bolt.listSubtract(oldFiles,bosh.modInfos.ordered)
                if len(changed) > (fileName in changed):
                    changed.remove(fileName)
                    changed = [x.s for x in changed]
                    removed += changed
                    balt.showList(self,u'${count} '+_(u'Children deactivated:'),changed,10,fileName.s)
            except bosh.liblo.LibloError as e:
                if (e.msg == 'LIBLO_ERROR_INVALID_ARGS:Plugins may not be sorted before the game\'s master file.'):
                    msg = _(u'Plugins may not be sorted before the game\'s master file.')
                else:
                    msg = e.msg
                balt.showError(self,_(u'%s') % msg)
        #--Select?
        else:
            ## For now, allow selecting unicode named files, for testing
            ## I'll leave the warning in place, but maybe we can get the
            ## game to load these files.s
            #if fileName in self.data.bad_names: return
            try:
                self.data.select(fileName)
                changed = bolt.listSubtract(bosh.modInfos.ordered,oldFiles)
                if len(changed) > ((fileName in changed) + (GPath(u'Oblivion.esm') in changed)):
                    changed.remove(fileName)
                    changed = [x.s for x in changed]
                    balt.showList(self,u'${count} '+_(u'Masters activated:'),changed,10,fileName.s)
            except bosh.PluginsFullError:
                balt.showError(self,_(u'Unable to add mod %s because load list is full.')
                    % fileName.s)
                return
    #--Refresh
    bosh.modInfos.refresh()
    self.RefreshUI()
    #--Mark sort as dirty
    if self.selectedFirst:
        self.sortDirty = 1
        self.colReverse[self.sort] = not self.colReverse.get(self.sort,0)
@Utumno Utumno added this to the 304.4 milestone May 27, 2014
@Utumno
Copy link
Member Author

Utumno commented May 27, 2014

Assigned this to you Lo - seems ok ? A quick and dirty commit on dev would suffice ? If not change the milestone

@lojack5
Copy link
Member

lojack5 commented May 31, 2014

Looks to me like it's already in the code, after testing every possible things and not coming up with anything, checked the code and the change is already in.

@lojack5 lojack5 closed this as completed May 31, 2014
@Infernio Infernio added the M-relnotes Misc: Issue should be listed in the version history for its milestone label Nov 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Bug, an acknowledged defect in the program M-relnotes Misc: Issue should be listed in the version history for its milestone M-svn Misc: Issue was carried over from the old SVN repo
Projects
None yet
Development

No branches or pull requests

3 participants