/usr/lib/python2.7/dist-packages/dispcalGUI/debughelpers.py is in dispcalgui 1.7.1.6-1.
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 | # -*- coding: utf-8 -*-
import sys
import config
from config import fs_enc
from log import logbuffer, safe_print
from meta import name as appname
from util_str import safe_unicode
wxEventTypes = {}
def getevtobjname(event, window=None):
""" Get and return the event object's name. """
try:
event_object = event.GetEventObject()
if not event_object and window:
event_object = window.FindWindowById(event.GetId())
if event_object and hasattr(event_object, "GetName"):
return event_object.GetName()
except Exception, exception:
pass
def getevttype(event):
""" Get and return the event object's type. """
if not wxEventTypes:
from wxaddons import wx
try:
for name in dir(wx):
if name.find("EVT_") == 0:
attr = getattr(wx, name)
if hasattr(attr, "evtType"):
wxEventTypes[attr.evtType[0]] = name
except Exception, exception:
pass
typeId = event.GetEventType()
if typeId in wxEventTypes:
return wxEventTypes[typeId]
def handle_error(error, parent=None, silent=False):
""" Log an error string and show an error dialog. """
error = safe_unicode(error)
safe_print(error)
if not silent:
try:
from wxaddons import wx
if wx.GetApp() is None and parent is None:
app = wx.App(redirect=False)
if parent:
try:
parent.IsShownOnScreen()
except:
# If the parent is still being constructed, we can't use it
parent = None
dlg = wx.MessageDialog(parent if parent not in (False, None) and
parent.IsShownOnScreen() else None,
error, appname, wx.OK | wx.ICON_ERROR)
dlg.ShowModal()
dlg.Destroy()
except Exception, exception:
safe_print("Warning: handle_error():", safe_unicode(exception))
|