Skip to content

Commit

Permalink
show first item's background art on library open; show background art…
Browse files Browse the repository at this point in the history
… per focussed library item
  • Loading branch information
pannal committed Sep 2, 2018
1 parent c9bfd59 commit d16083e
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions lib/windows/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,14 @@ def onAction(self, action):
self.setBoolProperty('dragging', self.dragging)

if action.getId() in MOVE_SET:
if util.advancedSettings.dynamicBackgrounds:
mli = self.showPanelControl.getSelectedItem()
if mli and mli.dataSource:
self.setProperty(
'background', util.backgroundFromArt(mli.dataSource.art, width=self.width,
height=self.height)
)

controlID = self.getFocusId()
if controlID == self.POSTERS_PANEL_ID or controlID == self.SCROLLBAR_ID:
self.updateKey()
Expand Down Expand Up @@ -1229,13 +1237,18 @@ def updateItem(self, mli=None):
backgroundthread.BGThreader.moveToFront(task)
break

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

item = random.choice(items)
self.setProperty('background', util.backgroundFromArt(item.art, width=self.width, height=self.height))
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))

def fill(self):
if self.chunkMode:
Expand Down Expand Up @@ -1507,7 +1520,8 @@ def _chunkCallback(self, items, start):
if self.chunkMode and not self.chunkMode.posIsValid(start):
return
pos = start
self.setBackground(items)
self.setBackground(items, 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

0 comments on commit d16083e

Please sign in to comment.