Translated using Weblate.
[wammu.git] / Wammu / App.py
blobdaa5d1f1d08af9237b8ea4de104889d6fdff7457
1 # -*- coding: UTF-8 -*-
2 # vim: expandtab sw=4 ts=4 sts=4:
3 '''
4 Wammu - Phone manager
5 Main Wammu application
6 '''
7 __author__ = 'Michal Čihař'
8 __email__ = 'michal@cihar.com'
9 __license__ = '''
10 Copyright © 2003 - 2010 Michal Čihař
12 This program is free software; you can redistribute it and/or modify it
13 under the terms of the GNU General Public License version 2 as published by
14 the Free Software Foundation.
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
19 more details.
21 You should have received a copy of the GNU General Public License along with
22 this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 '''
26 import wx
27 import sys
28 import Wammu.Main
29 import Wammu.Error
30 from Wammu.Locales import StrConv
32 class WammuApp(wx.App):
33 '''
34 Wammu appliction class, it initializes wx and creates main Wammu window.
35 '''
37 def OnInit(self):
38 '''
39 wxWindows call this method to initialize the application.
40 '''
42 self.SetAppName('Wammu')
43 vendor = StrConv(u'Michal Čihař')
44 if vendor.find('?') != -1:
45 vendor = 'Michal Čihař'
46 self.SetVendorName(vendor)
48 wx.InitAllImageHandlers()
50 frame = Wammu.Main.WammuFrame(None, -1)
51 Wammu.Error.HANDLER_PARENT = frame
53 frame.Show(True)
54 frame.PostInit(self)
55 self.SetTopWindow(frame)
57 # Return a success flag
58 return True
60 def Run():
61 '''
62 Wrapper to execute Wammu. Installs graphical error handler and launches
63 WammuApp.
64 '''
65 try:
66 sys.excepthook = Wammu.Error.Handler
67 except:
68 print _('Failed to set exception handler.')
69 app = WammuApp()
70 app.MainLoop()