gnue-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUe-dev] Adding Startup Error Dialogs to Designer


From: Michael Grinder
Subject: [GNUe-dev] Adding Startup Error Dialogs to Designer
Date: Wed, 05 Nov 2003 18:01:35 -0700

One of my pet peeves is when GUI programs only display error messages on
the console. This afternoon, I tried running the latest version of
Designer from the "Run Application" option of the Gnome start menu. When
nothing appeared, I investigated and found that an error message was
printed to the console stating that connections.conf did not exist and
then the program exited. Since I've wanted to start contributing to gnue
for awhile, I decided to look into providing startup error dialogs for
Designer. I hacked the startup error code from the wx driver in Forms
into Designer.py. I'm sure there's a much more elegant way to do this.
Anyway, here's a cvs diff of my changes.

Michael Grinder
   

Index: src/Designer.py
===================================================================
RCS file: /cvsroot/gnue/gnue-designer/src/Designer.py,v
retrieving revision 1.74
diff -r1.74 Designer.py
73a74
> from gnue.forms.uidrivers.wx.GFwxApp import getWxApp
369a371,376
>   #
>   #  Display a startup error and exit gracefully with a message on
>   #  how to get help
>   #
>   def handleStartupError(self, msg):
>     self.printVersion()
370a378,392
>     # if msg is multiline, then surround with dashes to set it apart
>     if string.find("%s" % msg, "\n") + 1:
>       print '-' * 60
>     print _("Error: %s") % msg
>     if string.find("%s" % msg, "\n") + 1:
>       print '-' * 60
>     print _("\nFor help, type:\n   %s --help\n") % (self.COMMAND)
>     _StartupErrorDisplay(str(msg)).ShowModal()
>     sys.exit()
> 
> class _StartupErrorDisplay(wxMessageDialog):
>   def __init__(self, errortext):
>     self._wxapp = getWxApp()
>     wxMessageDialog.__init__(self, None, _('Unable to start GNUe
Designer:') + '\n\n %s' % errortext,
>                      'GNUe Designer', wxICON_ERROR|wxCENTRE|wxOK)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]