/usr/share/pyshared/Wammu/ErrorMessage.py is in wammu 0.36-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | # -*- coding: UTF-8 -*-
# vim: expandtab sw=4 ts=4 sts=4:
'''
Wammu - Phone manager
Error messages
'''
__author__ = 'Michal Čihař'
__email__ = 'michal@cihar.com'
__license__ = '''
Copyright © 2003 - 2010 Michal Čihař
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 as published by
the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
'''
import wx
import os
import Wammu
import Wammu.Webbrowser
import Wammu.Paths
import Wammu.ErrorLog
BUG_SEARCH_URL = 'http://bugs.cihar.com/view_all_set.php?f=3&type=1&search=%s'
BUG_REPORT_URL = 'http://bugs.cihar.com/set_project.php?ref=bug_report_page.php&project_id=1'
class ErrorMessage(wx.Dialog):
'''
Error message box with support for saving debug log and reporting
bug to http://bugs.cihar.com/.
'''
def __init__(self, parent, message, title, traceid=None,
autolog=None, exception=None):
wx.Dialog.__init__(self, parent, -1, title)
sizer = wx.BoxSizer(wx.VERTICAL)
textsizer = wx.BoxSizer(wx.HORIZONTAL)
sizer.Add(textsizer, flag=wx.ALL, border=10)
bitmap = wx.Bitmap(Wammu.Paths.MiscPath('error'))
icon = wx.StaticBitmap(self, -1, bitmap,
size = (bitmap.GetWidth(), bitmap.GetHeight()))
textsizer.Add(icon, flag=wx.RIGHT, border=10)
if exception is not None:
message += '\n\n'
message += exception
if autolog is not None:
message += '\n\n'
message += (
_('Debug log has been automatically saved to %s, you are strongly encouraged to include it in bugreport.')
% autolog)
msg = wx.StaticText(self, -1, message)
msg.Wrap(400)
textsizer.Add(msg)
buttonsizer = wx.StdDialogButtonSizer()
buttonsizer.AddButton(wx.Button(self, wx.ID_OK))
if traceid is None:
savebutton = wx.Button(self, -1, _('Save debug log...'))
buttonsizer.SetCancelButton(savebutton)
self.Bind(wx.EVT_BUTTON, self.OnSave, savebutton)
else:
self.traceid = traceid
searchbutton = wx.Button(self, -1, _('Search for similar reports'))
buttonsizer.SetCancelButton(searchbutton)
self.Bind(wx.EVT_BUTTON, self.OnSearch, searchbutton)
self.reportbutton = wx.Button(self, -1, _('Report bug'))
buttonsizer.SetNegativeButton(self.reportbutton)
self.Bind(wx.EVT_BUTTON, self.OnReport, self.reportbutton)
buttonsizer.Realize()
sizer.Add(buttonsizer, flag = wx.ALIGN_RIGHT | wx.ALL, border = 10)
sizer.Fit(self)
self.SetAutoLayout(True)
self.SetSizer(sizer)
def OnSave(self, evt):
'''
Saves debug log to file.
'''
dlg = wx.FileDialog(self,
_('Save debug log as...'),
os.getcwd(),
'wammu.log',
'',
wx.SAVE | wx.OVERWRITE_PROMPT | wx.CHANGE_DIR)
if dlg.ShowModal() == wx.ID_OK:
Wammu.ErrorLog.SaveLog(filename = dlg.GetPath())
def OnSearch(self, evt):
'''
Opens search for simmilar problems in browser.
'''
Wammu.Webbrowser.Open(BUG_SEARCH_URL % self.traceid)
def OnReport(self, evt):
'''
Opens web browser with bug reporting page.
'''
Wammu.Webbrowser.Open(BUG_REPORT_URL)
|