Last active
December 23, 2015 03:19
-
-
Save yanmhlv/6573094 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def register_thread(self, thread, thread_name, started_connect, finished_connect, error_connect = None): | |
"Метод регистрации стандартных потоков." | |
self.threads[thread_name] = thread | |
self.threads[thread_name].started.connect(started_connect) | |
self.threads[thread_name].finished.connect(finished_connect) | |
if error_connect: | |
self.threads[thread_name].error.connect(error_connect) | |
def terminate_thread(self, thread_name = None): | |
"Закрытие потока. Если имя потока отсутствует - закрываются все потоки" | |
if thread_name is None: | |
for thread_name, thread in self.threads.items(): | |
try: | |
self.terminate_thread(thread_name) | |
except Exception as err: | |
log.info(u"При закрытии потока [%s] произошла ошибка! [%s]", thread_name, err) | |
else: | |
if thread_name in self.threads: | |
try: | |
thread = self.threads[thread_name] | |
log.info(u"Закрывается поток [%s]", thread_name) | |
try: | |
thread.finished.disconnect() | |
except Exception as err: | |
log.error(err) | |
try: | |
thread.started.disconnect() | |
except Exception as err: | |
log.error(err) | |
#print 'try terminate thread [%s], [%s], [%s]' % (thread_name, thread, type(thread)) | |
#thread.terminate() | |
thread.quit() | |
del self.threads[thread_name] | |
except Exception as err: | |
log.error(err) | |
else: | |
log.info(u"Поток [%s] закрыт!", thread_name) | |
else: | |
log.info(u"Поток [%s] отсутствует!", thread_name) | |
def change_game_status(self, status): | |
log.debug(u"Статус лаунчера - [%s]", status) | |
self.game_status = status | |
self.repaint_main_button(status) | |
def repaint_main_button(self, status): | |
if status is None: | |
pass | |
elif status == 'play': | |
pass | |
elif status == 'update': | |
pass | |
#### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment