Test chiusura globalsearch

This commit is contained in:
Alhaziel01
2022-10-25 20:06:59 +02:00
parent 0a4cba7489
commit 88ccec0b15

View File

@@ -23,6 +23,7 @@ close_action = False
update_lock = threading.Lock() update_lock = threading.Lock()
moduleDict = {} moduleDict = {}
searchActions = [] searchActions = []
thread = None
def busy(state): def busy(state):
@@ -78,6 +79,7 @@ EPISODESLIST = 200
SERVERLIST = 300 SERVERLIST = 300
class SearchWindow(xbmcgui.WindowXML): class SearchWindow(xbmcgui.WindowXML):
global thread
def start(self, item, thActions=None): def start(self, item, thActions=None):
logger.debug() logger.debug()
self.exit = False self.exit = False
@@ -539,8 +541,8 @@ class SearchWindow(xbmcgui.WindowXML):
if self.item.type: if self.item.type:
self.item.mode = self.item.type self.item.mode = self.item.type
self.item.text = scrapertools.title_unify(self.item.text) self.item.text = scrapertools.title_unify(self.item.text)
self.thread = Thread(target=self.search) thread = Thread(target=self.search)
self.thread.start() thread.start()
elif self.item.mode in ['movie', 'tvshow', 'person_']: elif self.item.mode in ['movie', 'tvshow', 'person_']:
self.select() self.select()
elif self.item.mode in ['person']: elif self.item.mode in ['person']:
@@ -740,15 +742,11 @@ class SearchWindow(xbmcgui.WindowXML):
def Close(self): def Close(self):
self.exit = True self.exit = True
if self.thread and self.thread.is_alive(): if thread and thread.is_alive():
busy(True) busy(True)
for th in self.search_threads: for th in self.search_threads:
th.cancel() th.cancel()
try: thread.join()
self.thread.join()
except:
import traceback
logger.error(traceback.format_exc())
busy(False) busy(False)
self.close() self.close()