It's good to finally find out where these start-up errors are coming from.

The easiest workaround is simply not to use AdvancedSplashScreen. AFAICT, there 
is no point to using this at the present, since all the arguments we are using 
are the same for the normal wx.SplashScreen and the wx.AdvancedSplash splash 
screen.

A little digging into the code in wx.AdvancedSplash and experimentation on my 
part indicates that the argument description in the wx.Python 2.8 docs are 
incorrect. However, using the correct arguments and values (as found in the 
code itself) also raises errors. For example, the docs list an extrastyles 
argument, but this does not exist. The correct syntax is agwStyle. AFAICT, only 
the AS_TIMEOUT and AS_SHADOW_BITMAP values are recognized at present, and 
AS_TIMEOUT raises other errors when used.  It seems like this module is buggy. 
Although the current errors do not cause problems, trying to make any use of 
the 'advanced' features would. 

So my suggestion is simply to drop using wx.AdvancedSplash for now.

Michael



On Mar 18, 2012, at 1:44 PM, Anna Kratochvílová wrote:

> Hi,
> 
> 2012/3/18 Michael Barton <[email protected]>:
>> I found the problem. It's the 'advanced splash screen' (in the agw package) 
>> called fromwxgui.py.
>> 
>> Although the advanced splash screen can do some additional things beyond the 
>> normal splash screen, we don't really use much (or any?) of those 
>> capabilities.
>> 
> 
> I don't have any experience with it. You can try to use wx.CallAfter
> (as advised in the wxwidgets bug report) when setting splash screen.
> 
> Something like:
> 
> def SetSplashScreen(self, splashScreen):
>     splashScreen.Set...
>     ....
> 
> 
> if SC:
>      splash = SC.AdvancedSplash(bitmap = introBmp, timeout = 2000,
> parent = None, id = wx.ID_ANY)
>      wx.CallAfter(self.SetSplashScreen, splash)
> 
> Again, I really don't know what's going on. I think it's not GRASS gui
> fault, problem seems to be in wxwidgets and Mac. The same for the next
> error message (CFURLCreateWithString ...), I doubt anything can be
> done by GRASS developers. Maybe some workaround exists but I can't
> google anything now.
> 
> Anna
> 
> 
>> try:
>>    import wx.lib.agw.advancedsplash as SC
>> except ImportError:
>>    SC = None
>> 
>> 
>> ...
>> 
>>        if SC:
>>            splash = SC.AdvancedSplash(bitmap = introBmp,
>>                                       timeout = 2000, parent = None, id = 
>> wx.ID_ANY)
>>            splash.SetText(_('Starting GRASS GUI...'))
>>            splash.SetTextColour(wx.Colour(45, 52, 27))
>>            splash.SetTextFont(wx.Font(pointSize = 15, family = wx.DEFAULT, 
>> style = wx.NORMAL,
>>                                       weight = wx.BOLD))
>>            splash.SetTextPosition((150, 430))
>> 
>> 
>> 
>> Every call to splash produces "<Error>: CGContextRestoreGState: invalid 
>> context 0x0"
>> 
>> Michael
>> 
>> On Mar 18, 2012, at 12:53 AM, Anna Kratochvílová wrote:
>> 
>>> 2012/3/17 Michael Barton <[email protected]>:
>>>> Anna,
>>>> 
>>>> Where did you insert this? I can do a quick test. I'd be delighted if we
>>>> could avoid those annoying error messages.
>>> 
>>> Not sure what 'where' means, here [1] is the changeset. According to
>>> this email [2] the error message 'CGContextRestoreGState: invalid
>>> context' is supposed to show up immediately after wxGUI start. This
>>> fix is just a guess, I really don't understand what's going on. Are
>>> there any other annoying messages on Mac?
>>> 
>>> Anna
>>> 
>>> [1] http://trac.osgeo.org/grass/changeset/51089
>>> [2] http://lists.osgeo.org/pipermail/grass-user/2012-March/063996.html
>>>> 
>>>> Michael
>>>> 
>>>> Begin forwarded message:
>>>> 
>>>> Hi,
>>>> 
>>>> I added CallAfter as suggested (r51089), let's see if it helps.
>>>> 
>>>> Anna
>>>> 
>>>> 
>>>> _____________________
>>>> C. Michael Barton
>>>> Visiting Scientist, Integrated Science Program
>>>> National Center for Atmospheric Research &
>>>> University Consortium for Atmospheric Research
>>>> 303-497-2889 (voice)
>>>> 
>>>> Director, Center for Social Dynamics & Complexity
>>>> Professor of Anthropology, School of Human Evolution & Social Change
>>>> Arizona State University
>>>> www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>> 
>> _____________________
>> C. Michael Barton
>> Visiting Scientist, Integrated Science Program
>> National Center for Atmospheric Research &
>> University Consortium for Atmospheric Research
>> 303-497-2889 (voice)
>> 
>> Director, Center for Social Dynamics & Complexity
>> Professor of Anthropology, School of Human Evolution & Social Change
>> Arizona State University
>> www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu
>> 
>> 
>> 
>> 
>> 

_____________________
C. Michael Barton
Visiting Scientist, Integrated Science Program
National Center for Atmospheric Research &
University Consortium for Atmospheric Research
303-497-2889 (voice)

Director, Center for Social Dynamics & Complexity 
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu





_______________________________________________
grass-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to