Make the app object be global in case it is run multiple times, such

as from encode_bitmaps.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39136 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2006-05-10 23:22:27 +00:00
parent 01f6b6d3c8
commit 2240b1aa74
3 changed files with 6 additions and 4 deletions

View File

@@ -40,10 +40,11 @@ import sys
import wx import wx
import img2img import img2img
app = None
def main(): def main():
# some bitmap related things need to have a wxApp initialized... # some bitmap related things need to have a wxApp initialized...
if wx.GetApp() is None: if wx.GetApp() is None:
global app
app = wx.PySimpleApp() app = wx.PySimpleApp()
img2img.main(sys.argv[1:], wx.BITMAP_TYPE_PNG, ".png", __doc__) img2img.main(sys.argv[1:], wx.BITMAP_TYPE_PNG, ".png", __doc__)

View File

@@ -124,7 +124,7 @@ def crunch_data(data, compressed):
return fp.getvalue() return fp.getvalue()
app = None
def main(args): def main(args):
if not args or ("-h" in args): if not args or ("-h" in args):
print __doc__ print __doc__
@@ -132,6 +132,7 @@ def main(args):
# some bitmap related things need to have a wxApp initialized... # some bitmap related things need to have a wxApp initialized...
if wx.GetApp() is None: if wx.GetApp() is None:
global app
app = wx.PySimpleApp() app = wx.PySimpleApp()
append = 0 append = 0

View File

@@ -36,14 +36,14 @@ Options:
""" """
import sys import sys
import wx import wx
import img2img import img2img
app = None
def main(): def main():
# some bitmap related things need to have a wxApp initialized... # some bitmap related things need to have a wxApp initialized...
if wx.GetApp() is None: if wx.GetApp() is None:
global app
app = wx.PySimpleApp() app = wx.PySimpleApp()
img2img.main(sys.argv[1:], wx.BITMAP_TYPE_XPM, ".xpm", __doc__) img2img.main(sys.argv[1:], wx.BITMAP_TYPE_XPM, ".xpm", __doc__)