better error UI

This commit is contained in:
iperov 2021-11-23 14:57:36 +04:00
parent 640ff5db62
commit eff8c1e595
3 changed files with 7 additions and 6 deletions

View file

@ -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_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]) 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 row = 0
grid_l.addWidget(q_model_label, row, 0, alignment=Qt.AlignmentFlag.AlignRight | Qt.AlignmentFlag.AlignVCenter ) 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 ) grid_l.addLayout(lib_qt.QXHBoxLayout([q_model, 2, btn_open_folder, 2, q_model_info_label]), row, 1, alignment=Qt.AlignmentFlag.AlignLeft )

View file

@ -10,7 +10,8 @@ from xlib.mp import csw as lib_csw
from .QCSWControl import QCSWControl from .QCSWControl import QCSWControl
class QErrorCSWError(QCSWControl): class QErrorCSWError(QCSWControl):
""" """
Implements lib_csw.Error control as widget Implements lib_csw.Error control as widget
@ -28,7 +29,7 @@ class QErrorCSWError(QCSWControl):
fixed_size=(32,32), 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( 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)) , [ lib_qt.QXWidget(layout=lib_qt.QXHBoxLayout([label_warning]), size_policy=(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Minimum)) ,

View file

@ -154,8 +154,8 @@ class DFMModelInitializer:
INITIALIZING, DOWNLOADING, INITIALIZED, ERROR, = range(4) INITIALIZING, DOWNLOADING, INITIALIZED, ERROR, = range(4)
downloader : ThreadFileDownloader = None downloader : ThreadFileDownloader = None
url = dfm_model_info.get_url()
status = None status = None
while True: while True:
events = DFMModelInitializer.Events() events = DFMModelInitializer.Events()
@ -168,7 +168,7 @@ class DFMModelInitializer:
model_path = dfm_model_info.get_model_path() model_path = dfm_model_info.get_model_path()
if not model_path.exists(): if not model_path.exists():
url = dfm_model_info.get_url()
if url is None: if url is None:
new_status = ERROR new_status = ERROR
events.error = 'Model file is not found and URL is not defined.' events.error = 'Model file is not found and URL is not defined.'
@ -199,7 +199,7 @@ class DFMModelInitializer:
events.download_progress = progress events.download_progress = progress
else: else:
new_status = ERROR new_status = ERROR
events.error = error events.error = f'Unable to download {url}, error:' + error
if new_status != status: if new_status != status:
events.prev_status_initializing = status == INITIALIZING events.prev_status_initializing = status == INITIALIZING