Skip to content

Commit

Permalink
Fixed crashing on cancelling gif import
Browse files Browse the repository at this point in the history
  • Loading branch information
UncertainProd committed Jul 14, 2022
1 parent d38484b commit a70e938
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/xmlpngUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,18 @@ def ranged_deletion_handler(self, selected_spriteframe):

def open_gif(self):
gifpath = self.get_asset_path("Select the GIF file", "GIF images (*.gif)")
update_prog_bar, progbar = display_progress_bar(self, "Extracting sprite frames....")
QApplication.processEvents()

sprites = spritesheetutils.get_gif_frames(gifpath, update_prog_bar)
for i, spfr in enumerate(sprites):
spfr.frameparent = self
self.add_spriteframe(spfr)
update_prog_bar(50 + ((i+1)*50//len(sprites)), f"Adding frames from: {gifpath}")
progbar.close()

self.ui.posename_btn.setDisabled(self.num_labels <= 0)
if gifpath != '':
update_prog_bar, progbar = display_progress_bar(self, "Extracting sprite frames....")
QApplication.processEvents()

sprites = spritesheetutils.get_gif_frames(gifpath, update_prog_bar)
for i, spfr in enumerate(sprites):
spfr.frameparent = self
self.add_spriteframe(spfr)
update_prog_bar(50 + ((i+1)*50//len(sprites)), f"Adding frames from: {gifpath}")
progbar.close()

self.ui.posename_btn.setDisabled(self.num_labels <= 0)

def handle_psychengine_checkbox(self, checked):
self.ui.uploadicongrid_btn.setEnabled(not checked)
Expand Down

0 comments on commit a70e938

Please sign in to comment.