Skip to content

Commit

Permalink
ensure showing the first item's background art on library open even i…
Browse files Browse the repository at this point in the history
…f we've got multiple chunks
  • Loading branch information
pannal committed Aug 13, 2018
1 parent f236f9e commit a5c5d47
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
21 changes: 12 additions & 9 deletions lib/windows/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -1225,18 +1225,21 @@ def updateItem(self, mli=None):
backgroundthread.BGThreader.moveToFront(task)
break

def setBackground(self, items, randomize=True):
if randomize:
if self.backgroundSet:
return
self.backgroundSet = True
def setBackground(self, items, position, randomize=True):
if self.backgroundSet:
return

if randomize:
item = random.choice(items)
self.setProperty('background', util.backgroundFromArt(item.art, width=self.width, height=self.height))
else:
if items:
self.setProperty('background', util.backgroundFromArt(items[0].art,
width=self.width, height=self.height))
# we want the first item of the first chunk
if position is not 0:
return

self.setProperty('background', util.backgroundFromArt(items[0].art,
width=self.width, height=self.height))
self.backgroundSet = True

def fill(self):
if self.chunkMode:
Expand Down Expand Up @@ -1508,7 +1511,7 @@ def _chunkCallback(self, items, start):
if self.chunkMode and not self.chunkMode.posIsValid(start):
return
pos = start
self.setBackground(items, randomize=not util.advancedSettings.dynamicBackgrounds)
self.setBackground(items, pos, randomize=not util.advancedSettings.dynamicBackgrounds)

thumbDim = TYPE_KEYS.get(self.section.type, TYPE_KEYS['movie'])['thumb_dim']
artDim = TYPE_KEYS.get(self.section.type, TYPE_KEYS['movie']).get('art_dim', (256, 256))
Expand Down
2 changes: 1 addition & 1 deletion resources/language/English/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ msgid "Automatically seek selected position after a delay"
msgstr ""

msgctxt "#32467"
msgid "Appearance"
msgid "User Interface"
msgstr ""

msgctxt "#32468"
Expand Down
4 changes: 2 additions & 2 deletions resources/language/German/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -963,8 +963,8 @@ msgid "Automatically seek to the selected timeline position after a second"
msgstr "Nach Verzögerung automatisch zur aktuell gewählten Position springen"

msgctxt "#32467"
msgid "Appearance"
msgstr "Darstellung"
msgid "User Interface"
msgstr "Benutzeroberfläche"

msgctxt "#32468"
msgid "Show dynamic background art"
Expand Down

0 comments on commit a5c5d47

Please sign in to comment.