navigation fix

pull/15/head
DiMartinoXBMC 2016-12-15 21:05:49 +03:00
parent cb6883c3f0
commit 87e80dda3f
1 changed files with 21 additions and 10 deletions

View File

@ -221,9 +221,17 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
self.update_navigation() self.update_navigation()
def navi_route(self, mode, params = None, last_listing_item = 0): def navi_route(self, mode, params = None, last_listing_item = 0):
self.navi['route'].append({'mode': mode, log('navi_route init')
'params': {} if not params else params, if not params or not params.get('back'):
'last_listing_item': last_listing_item}) log('***** self.navi[\'route\'].append *****' + str(mode) + str(params) + str(last_listing_item))
if not params:
params = {'back': True}
else:
params['back'] = True
self.navi['route'].append({'mode': mode,
'params': params,
'last_listing_item': last_listing_item})
self.right_menu(mode) self.right_menu(mode)
self.listing.reset() self.listing.reset()
@ -268,19 +276,20 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
self.last_query = query self.last_query = query
elif len(query) == 0: elif len(query) == 0:
self.filesList = [] self.filesList = []
if 1 == 1:
if self.filesList: if self.filesList:
for (order, seeds, leechers, size, title, link, image) in self.filesList: for (order, seeds, leechers, size, title, link, image) in self.filesList:
title = titleMake(seeds, leechers, size, title) title = titleMake(seeds, leechers, size, title)
self.drawItem(title, {'mode': 'search_item', 'filename': link}, image) self.drawItem(title, {'mode': 'search_item', 'filename': link}, image)
self.setFocus(self.listing) self.setFocus(self.listing)
def history(self, params = None): def history(self, params = None):
self.navi_route('history') self.navi_route('history', params)
db = HistoryDB() db = HistoryDB()
items = db.get_all() items = db.get_all()
favlist = [(1, '[B]%s[/B]'), (0, '%s')] favlist = [(1, '[B]%s[/B]'), (0, '%s')]
last_listing_item = 0
if items: if items:
for favbool, bbstring in favlist: for favbool, bbstring in favlist:
for addtime, string, fav in items: for addtime, string, fav in items:
@ -289,12 +298,14 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
if int(fav) == 1: if int(fav) == 1:
img = __root__ + '/icons/fav.png' img = __root__ + '/icons/fav.png'
last_listing_item += 1
else: else:
img = __root__ + '/icons/unfav.png' img = __root__ + '/icons/unfav.png'
link = {'mode': 'history_search_item', 'filename': title, 'addtime': str(addtime), link = {'mode': 'history_search_item', 'filename': title, 'addtime': str(addtime),
'fav': str(fav)} 'fav': str(fav)}
self.drawItem(bbstring % title, link, img) self.drawItem(bbstring % title, link, img)
self.navi['route'][-1]['last_listing_item'] = last_listing_item
def history_action(self, action, addtime, fav): def history_action(self, action, addtime, fav):
db = HistoryDB() db = HistoryDB()