Skip to content

Commit f2b77d6

Browse files
committed
Image Viewer: Improve error messages
1 parent 942d912 commit f2b77d6

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

orangecontrib/imageanalytics/widgets/owimageviewer.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,16 @@ class Outputs:
218218
selected_data = Output("Selected Images", Orange.data.Table)
219219
data = Output("Data", Orange.data.Table)
220220

221-
class Error(OWWidget.Error):
221+
class Warning(OWWidget.Warning):
222222
no_images_shown = Msg(
223-
"Unable to display images! Please ensure that the chosen "
224-
"Image Filename Attribute store the correct paths to the images."
223+
"Unable to display images. Check that the chosen "
224+
"Image Filename Attribute stores correct paths to images."
225225
)
226-
no_image_attr = Msg(
227-
"Data does not contain any variables with image names.\n"
228-
"Numeric variables cannot store image names."
226+
227+
class Error(OWWidget.Error):
228+
no_image_attr = Msg(
229+
"Data does not contain any variables with image file names or URLs.\n"
230+
"Data contains no text variables."
229231
)
230232

231233
settingsHandler = settings.DomainContextHandler()
@@ -350,7 +352,7 @@ def _propose_image_and_title_attr(self):
350352

351353
def clear(self):
352354
self.data = None
353-
self.Error.no_images_shown.clear()
355+
self.Warning.no_images_shown.clear()
354356
self.Error.no_image_attr.clear()
355357
if self.__watcher is not None:
356358
self.__watcher.finishedAt.disconnect(self.__on_load_finished)
@@ -364,7 +366,7 @@ def clear(self):
364366
self.selected_items = set()
365367

366368
def setupModel(self):
367-
self.Error.no_images_shown.clear()
369+
self.Warning.no_images_shown.clear()
368370
if self.data is not None:
369371
urls = column_data_as_qurl(self.data, self.image_attr)
370372
titles = column_data_as_str(self.data, self.title_attr)
@@ -479,7 +481,7 @@ def commit(self):
479481
def _updateStatus(self):
480482
count = len([item for item in self.items if item.future is not None])
481483
if self._errcount == count:
482-
self.Error.no_images_shown()
484+
self.Warning.no_images_shown()
483485

484486
def onDeleteWidget(self):
485487
self.clear()

0 commit comments

Comments
 (0)