Index: src/sas/qtgui/Utilities/ImageViewer.py
===================================================================
--- src/sas/qtgui/Utilities/ImageViewer.py	(revision 1942f63fd40fb768b5b323cfa92c277de4367c13)
+++ src/sas/qtgui/Utilities/ImageViewer.py	(revision 5584deeacf00237a8abb92d6cd626e586c4b9b3c)
@@ -2,7 +2,4 @@
 Image viewer widget.
 """
-from PyQt5 import QtCore
-from PyQt5 import QtGui
-from PyQt5 import QtWidgets
 
 import os
@@ -10,6 +7,7 @@
 import numpy as np
 import matplotlib
-matplotlib.interactive(False)
 import matplotlib.image as mpimg
+
+from PyQt5 import QtWidgets
 
 from sas.sascalc.dataloader.manipulations import reader2D_converter
@@ -23,4 +21,5 @@
 from sas.qtgui.Utilities.UI.ImageViewerUI import Ui_ImageViewerUI
 from sas.qtgui.Utilities.UI.ImageViewerOptionsUI import Ui_ImageViewerOptionsUI
+matplotlib.interactive(False)
 
 class ImageViewer(QtWidgets.QMainWindow, Ui_ImageViewerUI):
@@ -34,19 +33,16 @@
         self.setupUi(self)
 
-        # add plotter to the frame
+        # Other globals
         self.plotter = None
         self.hbox = None
+        self.filename = None
+        self.is_png = False
+        self.image = None
 
         # disable menu items on empty canvas
         self.disableMenus()
 
-        # set up signal callbacks
-        self.addCallbacks()
-
         # set up menu item triggers
         self.addTriggers()
-
-    def addCallbacks(self):
-        pass
 
     def disableMenus(self):
@@ -121,5 +117,5 @@
         """
         if self.plotter is not None:
-           self.plotter.onClipboardCopy()
+            self.plotter.onClipboardCopy()
 
     def actionConvertToData(self):
@@ -135,9 +131,7 @@
         try:
             self.convertImage(image, xmin, xmax, ymin, ymax, zscale)
-        except:
-            err_msg = "Error occurred while converting Image to Data."
+        except Exception as ex:
+            err_msg = "Error occurred while converting Image to Data: " + str(ex)
             logging.error(err_msg)
-
-        pass
 
     def actionHowTo(self):
@@ -174,5 +168,5 @@
             # Any other formats (tiff, jpeg, etc) are passed
             # to PIL which seems to have a problem in version
-            # 1.1.7 that causes a close error which shows up in 
+            # 1.1.7 that causes a close error which shows up in
             # the log file.  This does not seem to have any adverse
             # effects.  PDB   --- September 17, 2017.
@@ -184,5 +178,5 @@
             origin = None
             if self.is_png:
-                origin='lower'
+                origin = 'lower'
             self.plotter.imageShow(flipped_image, origin=origin)
             if not self.is_png:
@@ -191,5 +185,5 @@
             ax.set_ylabel('y [pixel]')
             self.plotter.figure.subplots_adjust(left=0.15, bottom=0.1,
-                                        right=0.95, top=0.95)
+                                                right=0.95, top=0.95)
             title = 'Picture: ' + self.filename
             self.setWindowTitle(title)
@@ -197,9 +191,9 @@
         except IOError as ex:
             err_msg = "Failed to load '%s'.\n" % self.filename
-            logging.error(err_msg)
+            logging.error(err_msg+str(ex))
             return
         except Exception as ex:
             err_msg = "Failed to show '%s'.\n" % self.filename
-            logging.error(err_msg)
+            logging.error(err_msg+str(ex))
             return
 
@@ -239,6 +233,6 @@
         output.ymin = ymin
         output.ymax = ymax
-        output.xaxis('\\rm{Q_{x}}', '\AA^{-1}')
-        output.yaxis('\\rm{Q_{y}}', '\AA^{-1}')
+        output.xaxis('\\rm{Q_{x}}', r'\AA^{-1}')
+        output.yaxis('\\rm{Q_{y}}', r'\AA^{-1}')
         # Store loading process information
         output.meta_data['loader'] = self.filename.split('.')[-1] + "Reader"
@@ -269,8 +263,8 @@
             grey = np.rollaxis(rgb, axis=0)
         else:
-            red, green, blue = np.rollaxis(rgb[..., :3], axis= -1)
+            red, green, blue = np.rollaxis(rgb[..., :3], axis=-1)
             grey = 0.299 * red + 0.587 * green + 0.114 * blue
         max_i = rgb.max()
-        factor = 255.0 / max_i
+        factor = 255.0/max_i
         grey *= factor
         return np.array(grey)
@@ -332,3 +326,2 @@
 
         return (xmin, xmax, ymin, ymax, zscale)
-
