From eff8c1e59572e149a3c93e27f4f368d9515d7487 Mon Sep 17 00:00:00 2001 From: iperov Date: Tue, 23 Nov 2021 14:57:36 +0400 Subject: [PATCH] better error UI --- apps/DeepFaceLive/ui/QFaceSwapper.py | 2 +- apps/DeepFaceLive/ui/widgets/QErrorCSWError.py | 5 +++-- modelhub/DFLive/DFMModel.py | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/DeepFaceLive/ui/QFaceSwapper.py b/apps/DeepFaceLive/ui/QFaceSwapper.py index e528ac8..09b75a3 100644 --- a/apps/DeepFaceLive/ui/QFaceSwapper.py +++ b/apps/DeepFaceLive/ui/QFaceSwapper.py @@ -60,7 +60,7 @@ class QFaceSwapper(QBackendPanel): q_two_pass_label = QLabelPopupInfo(label=L('@QFaceSwapper.two_pass'), popup_info_text=L('@QFaceSwapper.help.two_pass') ) q_two_pass = QCheckBoxCSWFlag(cs.two_pass, reflect_state_widgets=[q_two_pass_label]) - grid_l = lib_qt.QXGridLayout(spacing=5) + grid_l = lib_qt.QXGridLayout( spacing=5) row = 0 grid_l.addWidget(q_model_label, row, 0, alignment=Qt.AlignmentFlag.AlignRight | Qt.AlignmentFlag.AlignVCenter ) grid_l.addLayout(lib_qt.QXHBoxLayout([q_model, 2, btn_open_folder, 2, q_model_info_label]), row, 1, alignment=Qt.AlignmentFlag.AlignLeft ) diff --git a/apps/DeepFaceLive/ui/widgets/QErrorCSWError.py b/apps/DeepFaceLive/ui/widgets/QErrorCSWError.py index 88fcc6c..4a0306e 100644 --- a/apps/DeepFaceLive/ui/widgets/QErrorCSWError.py +++ b/apps/DeepFaceLive/ui/widgets/QErrorCSWError.py @@ -10,7 +10,8 @@ from xlib.mp import csw as lib_csw from .QCSWControl import QCSWControl - + + class QErrorCSWError(QCSWControl): """ Implements lib_csw.Error control as widget @@ -28,7 +29,7 @@ class QErrorCSWError(QCSWControl): fixed_size=(32,32), ) - label = self._label = lib_qt.QXLabel(font=QXFontDB.get_default_font(size=7), word_wrap=True) + label = self._label = lib_qt.QXTextEdit( font=QXFontDB.get_default_font(size=7), read_only=True, fixed_height=80 ) bar = lib_qt.QXFrame(layout=lib_qt.QXHBoxLayout( [ lib_qt.QXWidget(layout=lib_qt.QXHBoxLayout([label_warning]), size_policy=(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Minimum)) , diff --git a/modelhub/DFLive/DFMModel.py b/modelhub/DFLive/DFMModel.py index a2ff3d8..ec2cd34 100644 --- a/modelhub/DFLive/DFMModel.py +++ b/modelhub/DFLive/DFMModel.py @@ -154,8 +154,8 @@ class DFMModelInitializer: INITIALIZING, DOWNLOADING, INITIALIZED, ERROR, = range(4) downloader : ThreadFileDownloader = None + url = dfm_model_info.get_url() status = None - while True: events = DFMModelInitializer.Events() @@ -168,7 +168,7 @@ class DFMModelInitializer: model_path = dfm_model_info.get_model_path() if not model_path.exists(): - url = dfm_model_info.get_url() + if url is None: new_status = ERROR events.error = 'Model file is not found and URL is not defined.' @@ -199,7 +199,7 @@ class DFMModelInitializer: events.download_progress = progress else: new_status = ERROR - events.error = error + events.error = f'Unable to download {url}, error:' + error if new_status != status: events.prev_status_initializing = status == INITIALIZING