Repository: spyder-ide/spyder

Issue:
new icon theme broken on OSX
The new icon theme looks fine on Windows (tested earlier today on Windows 7), but all of the icons are broken on OSX.  On 10.7.5 I get the results shown below, and I just confirmed that I get the same results on 10.10.4.  Both machines are running Python 2.7.10, from Anaconda 2.2.0 or 2.3.0.

![image](https://cloud.githubusercontent.com/assets/12973799/9126525/f82f81d0-3c7b-11e5-8073-58710b6768c1.png)

![image](https://cloud.githubusercontent.com/assets/12973799/9126581/fb7b988c-3c7c-11e5-8fdf-b0942f2c5dbc.png)



Discussion:
@joshburnett thanks for reporting. Do you see any error message in the internal console?

Not sure which console you're referring to.  The Console tab in Spyder shows nothing unusual.
The OSX Console shows the following text after I open Spyder:

8/6/15 10:20:36.734 PM python: _GetISImageRefFromIconRefInternal: could not retain image ref 0x28ba0002 (err=-2580)
8/6/15 10:20:36.735 PM python: _GetISImageRefFromIconRefInternal: could not retain image ref 0x28ba0002 (err=-2580)
8/6/15 10:20:36.735 PM python: PlotIconRef 0x1 InContext 0x118415b30 in {0.000000,0.000000,16.000000,16.000000}, inAlign:0, inTransform:0, inFlags:0 failed. Invalid image ref (err=-2582)
8/6/15 10:20:36.735 PM python: _GetISImageRefFromIconRefInternal: could not retain image ref 0x28ba0002 (err=-2580)
8/6/15 10:20:36.735 PM python: _GetISImageRefFromIconRefInternal: could not retain image ref 0x28ba0002 (err=-2580)
8/6/15 10:20:36.735 PM python: PlotIconRef 0x1 InContext 0x11841a270 in {0.000000,0.000000,32.000000,32.000000}, inAlign:0, inTransform:0, inFlags:0 failed. Invalid image ref (err=-2582)
8/6/15 10:20:36.735 PM python: _GetISImageRefFromIconRefInternal: could not retain image ref 0x28ba0002 (err=-2580)
8/6/15 10:20:36.735 PM python: _GetISImageRefFromIconRefInternal: could not retain image ref 0x28ba0002 (err=-2580)
8/6/15 10:20:36.735 PM python: PlotIconRef 0x1 InContext 0x118428ce0 in {0.000000,0.000000,64.000000,64.000000}, inAlign:0, inTransform:0, inFlags:0 failed. Invalid image ref (err=-2582)
8/6/15 10:20:36.735 PM python: _GetISImageRefFromIconRefInternal: could not retain image ref 0x28ba0002 (err=-2580)
8/6/15 10:20:36.736 PM python: _GetISImageRefFromIconRefInternal: could not retain image ref 0x28ba0002 (err=-2580)
8/6/15 10:20:36.736 PM python: PlotIconRef 0x1 InContext 0x118425020 in {0.000000,0.000000,128.000000,128.000000}, inAlign:0, inTransform:0, inFlags:0 failed. Invalid image ref (err=-2582)
8/6/15 10:20:36.824 PM python: _GetISImageRefFromIconRefInternal: could not retain image ref 0x27f80002 (err=-2580)
8/6/15 10:20:36.824 PM python: _GetISImageRefFromIconRefInternal: could not retain image ref 0x27f80002 (err=-2580)
8/6/15 10:20:36.824 PM python: PlotIconRef 0x1 InContext 0x1184f0330 in {0.000000,0.000000,16.000000,16.000000}, inAlign:0, inTransform:0, inFlags:0 failed. Invalid image ref (err=-2582)
8/6/15 10:20:36.824 PM python: _GetISImageRefFromIconRefInternal: could not retain image ref 0x27f80002 (err=-2580)
8/6/15 10:20:36.824 PM python: _GetISImageRefFromIconRefInternal: could not retain image ref 0x27f80002 (err=-2580)
8/6/15 10:20:36.824 PM python: PlotIconRef 0x1 InContext 0x118b051e0 in {0.000000,0.000000,32.000000,32.000000}, inAlign:0, inTransform:0, inFlags:0 failed. Invalid image ref (err=-2582)
8/6/15 10:20:36.824 PM python: _GetISImageRefFromIconRefInternal: could not retain image ref 0x27f80002 (err=-2580)
8/6/15 10:20:36.824 PM python: _GetISImageRefFromIconRefInternal: could not retain image ref 0x27f80002 (err=-2580)
8/6/15 10:20:36.824 PM python: PlotIconRef 0x1 InContext 0x118b051e0 in {0.000000,0.000000,64.000000,64.000000}, inAlign:0, inTransform:0, inFlags:0 failed. Invalid image ref (err=-2582)
8/6/15 10:20:36.825 PM python: _GetISImageRefFromIconRefInternal: could not retain image ref 0x27f80002 (err=-2580)
8/6/15 10:20:36.825 PM python: _GetISImageRefFromIconRefInternal: could not retain image ref 0x27f80002 (err=-2580)
8/6/15 10:20:36.825 PM python: PlotIconRef 0x1 InContext 0x116fba980 in {0.000000,0.000000,128.000000,128.000000}, inAlign:0, inTransform:0, inFlags:0 failed. Invalid image ref (err=-2582)

The terminal window I launched Spyder from doesn't show any extra output.

Spyder has an "internal console" tab which can be enable with `View->Panes->Internal console`. It generally contains internal error messages from Spyder which are useful for debugging. 

I don't have a Mac to test at the moment, but this might give us some clues.

@SylvainCorlay, I have OSX and I'm seeing the same problem when running from bootstrap.  Nothing is printed to the console or the terminal.

@blink1073 thanks for the info. I will be getting a mac by the end of the month, and I should be able to troubleshoot.

This is really bad. Let's hope @SylvainCorlay can fix it for beta2.

Yeah, I should be able to test thoroughly on a mac soon. Also, running the tests of qtawesome on a mac could be useful.

@blink1073 has it ever worked on your mac, or did it just stop working?

I tried doing a `git bisect`, but there were a ton of broken commits and eventually I chose `git bisect bad` instead of `git bisect skip` by accident and gave up.

I cloned the repo and ran `example.py`:

<img width="206" alt="screen shot 2015-08-09 at 11 03 01 am" src="https://cloud.githubusercontent.com/assets/2096628/9155712/427b9308-3e86-11e5-9c04-b5969b5f61a0.png">


Resolving patch:
diff --git a/spyderlib/external/qtawesome/iconic_font.py b/spyderlib/external/qtawesome/iconic_font.py
--- a/spyderlib/external/qtawesome/iconic_font.py
+++ b/spyderlib/external/qtawesome/iconic_font.py
@@ -14,7 +14,7 @@
     'color_disabled': QColor(150, 150, 150),
     'opacity': 1.0,
     'scale_factor': 1.0,
-    }
+}
 
 
 def set_global_defaults(**kwargs):
@@ -150,13 +150,11 @@ def hook(obj):
             directory = os.path.join(
                 os.path.dirname(os.path.realpath(__file__)), 'fonts')
 
-        with open(os.path.join(directory, ttf_filename), 'rb') as f:
-            font_data = QByteArray(f.read())
-
         with open(os.path.join(directory, charmap_filename), 'r') as codes:
             self.charmap[prefix] = json.load(codes, object_hook=hook)
 
-        id_ = QFontDatabase.addApplicationFontFromData(font_data)
+        id_ = QFontDatabase.addApplicationFont(os.path.join(directory, ttf_filename))
+
         loadedFontFamilies = QFontDatabase.applicationFontFamilies(id_)
 
         if(loadedFontFamilies):


Test patch: