Skip to content

Commit 901b428

Browse files
committed
ensure showing the first item's background art on library open even if we've got multiple chunks
1 parent ff959a7 commit 901b428

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

lib/windows/library.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,18 +1221,21 @@ def updateItem(self, mli=None):
12211221
backgroundthread.BGThreader.moveToFront(task)
12221222
break
12231223

1224-
def setBackground(self, items, randomize=True):
1225-
if randomize:
1226-
if self.backgroundSet:
1227-
return
1228-
self.backgroundSet = True
1224+
def setBackground(self, items, position, randomize=True):
1225+
if self.backgroundSet:
1226+
return
12291227

1228+
if randomize:
12301229
item = random.choice(items)
12311230
self.setProperty('background', util.backgroundFromArt(item.art, width=self.width, height=self.height))
12321231
else:
1233-
if items:
1234-
self.setProperty('background', util.backgroundFromArt(items[0].art,
1235-
width=self.width, height=self.height))
1232+
# we want the first item of the first chunk
1233+
if position is not 0:
1234+
return
1235+
1236+
self.setProperty('background', util.backgroundFromArt(items[0].art,
1237+
width=self.width, height=self.height))
1238+
self.backgroundSet = True
12361239

12371240
def fill(self):
12381241
if self.chunkMode:
@@ -1504,7 +1507,7 @@ def _chunkCallback(self, items, start):
15041507
if self.chunkMode and not self.chunkMode.posIsValid(start):
15051508
return
15061509
pos = start
1507-
self.setBackground(items, randomize=not util.advancedSettings.dynamicBackgrounds)
1510+
self.setBackground(items, pos, randomize=not util.advancedSettings.dynamicBackgrounds)
15081511

15091512
thumbDim = TYPE_KEYS.get(self.section.type, TYPE_KEYS['movie'])['thumb_dim']
15101513
artDim = TYPE_KEYS.get(self.section.type, TYPE_KEYS['movie']).get('art_dim', (256, 256))

0 commit comments

Comments
 (0)