Skip to content

Commit 28d423d

Browse files
committed
[__main__] launch indefinite progress indicator dialog during slicing
1 parent 326dc57 commit 28d423d

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/slice/__main__.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
SliceAboutDialog,
5555
SliceErrorDialog,
5656
SliceOpenFileDialog,
57+
SliceProgressDialog,
5758
SliceSaveFileDialog,
5859
)
5960
from .ui.widgets import DragDropLineEdit
@@ -531,9 +532,7 @@ def menu_clicked_source(self):
531532
QDesktopServices.openUrl(QUrl("https://github.com/source-foundry/Slice"))
532533

533534
def menu_clicked_updatecheck(self):
534-
QDesktopServices.openUrl(
535-
QUrl("https://github.com/source-foundry/Slice/releases")
536-
)
535+
QDesktopServices.openUrl(QUrl("https://github.com/source-foundry/Slice/releases"))
537536

538537
#
539538
# Button click events
@@ -584,6 +583,7 @@ def btn_clicked_slice(self):
584583
self.collect_head_bit_checkbox_fields(),
585584
)
586585
try:
586+
# set up instance worker
587587
instance_worker = InstanceWorker(
588588
outpath,
589589
self.font_model,
@@ -592,6 +592,11 @@ def btn_clicked_slice(self):
592592
bit_model,
593593
)
594594

595+
# launch progress bar dialog
596+
self.progress_dialog = SliceProgressDialog(
597+
instance_worker.signals.finished
598+
)
599+
595600
# attach InstanceWorker signals / slots
596601
instance_worker.signals.result.connect(self._instance_worker_output)
597602
instance_worker.signals.finished.connect(
@@ -603,8 +608,9 @@ def btn_clicked_slice(self):
603608
self.threadpool.start(instance_worker)
604609
self.statusbar.showMessage("Slicing...")
605610
self.sliceButton.setDisabled(True)
606-
607611
except Exception as e:
612+
# hide progress dialog if exception occurred
613+
self.progress_dialog.hide()
608614
SliceErrorDialog(
609615
"Font processing failed with an error. See details below.",
610616
detailed_text=str(e),
@@ -654,6 +660,8 @@ def _instance_worker_complete(self):
654660
self.statusbar.showMessage("Complete")
655661

656662
def _instance_worker_error(self, error_string):
663+
# hide progress dialog before presentation of error dialog
664+
self.progress_dialog.hide()
657665
# Instance worker errored
658666
# Propagate the exception to an error dialog
659667
SliceErrorDialog(
@@ -692,9 +700,7 @@ def load_font(self, filepath):
692700
axis_value_table_was_set = self.fvar_table_model.load_font(self.font_model)
693701

694702
self.fvar_table_view.resizeColumnToContents(0)
695-
self.fvar_table_view.verticalHeader().resizeSections(
696-
QHeaderView.ResizeToContents
697-
)
703+
self.fvar_table_view.verticalHeader().resizeSections(QHeaderView.ResizeToContents)
698704

699705
# uncheck all bit flag setting check boxes
700706
self.os2_fsselection_bit_0_checkbox.setChecked(False)

0 commit comments

Comments
 (0)