Fix Launch Progressbar
This commit is contained in:
parent
93acab85c0
commit
709b4dcc8d
2 changed files with 4 additions and 5 deletions
|
@ -78,7 +78,6 @@ class LaunchDialog(QDialog):
|
||||||
|
|
||||||
def launch(self):
|
def launch(self):
|
||||||
# self.core = core
|
# self.core = core
|
||||||
self.pb_size = len(self.core.get_game_and_dlc_list())
|
|
||||||
self.info_text.setText(self.tr("Downloading Images"))
|
self.info_text.setText(self.tr("Downloading Images"))
|
||||||
self.thread = LaunchThread(self.core, self)
|
self.thread = LaunchThread(self.core, self)
|
||||||
self.thread.download_progess.connect(self.update_pb)
|
self.thread.download_progess.connect(self.update_pb)
|
||||||
|
@ -86,7 +85,7 @@ class LaunchDialog(QDialog):
|
||||||
self.thread.start()
|
self.thread.start()
|
||||||
|
|
||||||
def update_pb(self, i: int):
|
def update_pb(self, i: int):
|
||||||
self.info_pb.setValue(i / self.pb_size * 100)
|
self.info_pb.setValue(i)
|
||||||
|
|
||||||
def info(self, text: str):
|
def info(self, text: str):
|
||||||
if text == "finish":
|
if text == "finish":
|
||||||
|
|
|
@ -27,14 +27,14 @@ def download_images(signal: pyqtSignal, core: LegendaryCore):
|
||||||
dlc_list = []
|
dlc_list = []
|
||||||
for i in dlcs.values():
|
for i in dlcs.values():
|
||||||
dlc_list.append(i[0])
|
dlc_list.append(i[0])
|
||||||
l = games + dlc_list
|
game_list = games + dlc_list
|
||||||
for i, game in enumerate(l):
|
for i, game in enumerate(game_list):
|
||||||
try:
|
try:
|
||||||
download_image(game)
|
download_image(game)
|
||||||
except json.decoder.JSONDecodeError:
|
except json.decoder.JSONDecodeError:
|
||||||
shutil.rmtree(f"{IMAGE_DIR}/{game.app_name}")
|
shutil.rmtree(f"{IMAGE_DIR}/{game.app_name}")
|
||||||
download_image(game)
|
download_image(game)
|
||||||
signal.emit(i)
|
signal.emit(i/len(game_list)*100)
|
||||||
|
|
||||||
|
|
||||||
def download_image(game, force=False):
|
def download_image(game, force=False):
|
||||||
|
|
Loading…
Reference in a new issue