# Path: Wammu/Paths.py
# def AppIconPath(*args):
#     if sys.platform == 'win32':
#         ext = 'ico'
#     else:
#         ext = 'png'
#     p = os.path.join(*args) + os.extsep + ext
#     if os.path.exists(os.path.join(sys.exec_prefix, 'share', 'pixmaps', p)):
#         return os.path.join(sys.exec_prefix, 'share', 'pixmaps', p)
#     elif os.path.exists(os.path.join(DATAPATH, '..', 'pixmaps', p)):
#         return os.path.join(DATAPATH, '..', 'pixmaps', p)
#     elif os.path.exists(os.path.join('usr', 'share', 'pixmaps', p)):
#         return os.path.join('usr', 'share', 'pixmaps', p)
#     else:
#         return os.path.join('.', 'icon', p)
# 
# def IconPath(*args):
#     return ImagePath('icons', *args)
# 
# Path: Wammu/Locales.py
# def StrConv(txt):
#     """
#     This function coverts something (txt) to string form usable by wxPython. There
#     is problem that in default configuration in most distros (maybe all) default
#     encoding for unicode objects is ascii. This leads to exception when converting
#     something different than ascii. And this exception is not catched inside
#     wxPython and leads to segfault.
# 
#     So if wxPython supports unicode, we give it unicode, otherwise locale
#     dependant text.
#     """
#     try:
#         if isinstance(txt, unicode):
#             return txt
#         elif isinstance(txt, str):
#             return unicode(txt, LOCALE_CHARSET)
#         return str(txt)
#     except UnicodeEncodeError:
#         return '???'
# 
# def ConsoleStrConv(txt):
#     """
#     This function coverts something (txt) to string form usable on console.
#     """
#     try:
#         if isinstance(txt, str):
#             return txt
#         elif isinstance(txt, unicode):
#             return str(CONSOLE_ENCODER(txt, 'replace')[0])
#         return str(txt)
#     except UnicodeEncodeError:
#         return '???'
# 
# def ugettext(message):
#     if _TRANSLATION:
#         if six.PY2:
#             return _TRANSLATION.ugettext(message)
#         return _TRANSLATION.gettext(message)
#     return message


import wx
import wx.html
import sys
import os
import datetime
import time
import copy
import tempfile
import Wammu.Webbrowser
import Wammu
import re
    import dbus
    import dbus.glib
    import gammu
import Wammu.Events
import Wammu.Displayer
import Wammu.Browser
import Wammu.Editor
import Wammu.Error
import Wammu.Info
import Wammu.Utils
import Wammu.Logger
import Wammu.Message
import Wammu.Memory
import Wammu.Todo
import Wammu.Calendar
import Wammu.Settings
import wx.lib.wxpTag
import wx.lib.dialogs
import Wammu.Data
import Wammu.Composer
import Wammu.MessageDisplay
import Wammu.PhoneSearch
import Wammu.About
import Wammu.ErrorMessage
import Wammu.TalkbackDialog
import Wammu.WammuSettings
import Wammu.SMSExport
import Wammu.SMSXML
import Wammu.ContactsXML
from Wammu.Paths import AppIconPath, IconPath
from Wammu.Locales import StrConv, ConsoleStrConv, ugettext as _
        Wammu.Events.EVT_SEND(self, self.OnSend)
        Wammu.Events.EVT_CALL(self, self.OnCall)
        Wammu.Events.EVT_MESSAGE(self, self.OnMessage)
        Wammu.Events.EVT_DUPLICATE(self, self.OnDuplicate)
        Wammu.Events.EVT_REPLY(self, self.OnReply)
        Wammu.Events.EVT_DELETE(self, self.OnDelete)
        Wammu.Events.EVT_BACKUP(self, self.OnBackup)
        Wammu.Events.EVT_EXCEPTION(self, self.OnException)

        self.splitter = wx.SplitterWindow(self, -1)
        il = wx.ImageList(16, 16)

        self.tree = wx.TreeCtrl(self.splitter)
        self.tree.AssignImageList(il)

        self.treei = {}
        self.values = {}

        keys = list(displaydata.keys())
        keys.sort(SortDataKeys)
        for type in keys:
            self.treei[type] = {}
            self.values[type] = {}
            subkeys = list(displaydata[type].keys())
            subkeys.sort(SortDataSubKeys)
            for subtype in subkeys:
                self.values[type][subtype] = displaydata[type][subtype][4]
                if displaydata[type][subtype][0] == '':
                    self.treei[type][subtype] = self.tree.AddRoot(
                        displaydata[type][subtype][1],

# Path: Wammu/Paths.py
# def AppIconPath(*args):
#     if sys.platform == 'win32':
#         ext = 'ico'
#     else:
#         ext = 'png'
#     p = os.path.join(*args) + os.extsep + ext
#     if os.path.exists(os.path.join(sys.exec_prefix, 'share', 'pixmaps', p)):
#         return os.path.join(sys.exec_prefix, 'share', 'pixmaps', p)
#     elif os.path.exists(os.path.join(DATAPATH, '..', 'pixmaps', p)):
#         return os.path.join(DATAPATH, '..', 'pixmaps', p)
#     elif os.path.exists(os.path.join('usr', 'share', 'pixmaps', p)):
#         return os.path.join('usr', 'share', 'pixmaps', p)
#     else:
#         return os.path.join('.', 'icon', p)
# 
# def IconPath(*args):
#     return ImagePath('icons', *args)
# 
# Path: Wammu/Locales.py
# def StrConv(txt):
#     """
#     This function coverts something (txt) to string form usable by wxPython. There
#     is problem that in default configuration in most distros (maybe all) default
#     encoding for unicode objects is ascii. This leads to exception when converting
#     something different than ascii. And this exception is not catched inside
#     wxPython and leads to segfault.
# 
#     So if wxPython supports unicode, we give it unicode, otherwise locale
#     dependant text.
#     """
#     try:
#         if isinstance(txt, unicode):
#             return txt
#         elif isinstance(txt, str):
#             return unicode(txt, LOCALE_CHARSET)
#         return str(txt)
#     except UnicodeEncodeError:
#         return '???'
# 
# def ConsoleStrConv(txt):
#     """
#     This function coverts something (txt) to string form usable on console.
#     """
#     try:
#         if isinstance(txt, str):
#             return txt
#         elif isinstance(txt, unicode):
#             return str(CONSOLE_ENCODER(txt, 'replace')[0])
#         return str(txt)
#     except UnicodeEncodeError:
#         return '???'
# 
# def ugettext(message):
#     if _TRANSLATION:
#         if six.PY2:
#             return _TRANSLATION.ugettext(message)
#         return _TRANSLATION.gettext(message)
#     return message


# Path: Wammu/Main.py
import wx
import wx.html
import sys
import os
import datetime
import time
import copy
import tempfile
import Wammu.Webbrowser
import Wammu
import re
    import dbus
    import dbus.glib
    import gammu
import Wammu.Events
import Wammu.Displayer
import Wammu.Browser
import Wammu.Editor
import Wammu.Error
import Wammu.Info
import Wammu.Utils
import Wammu.Logger
import Wammu.Message
import Wammu.Memory
import Wammu.Todo
import Wammu.Calendar
import Wammu.Settings
import wx.lib.wxpTag
import wx.lib.dialogs
import Wammu.Data
import Wammu.Composer
import Wammu.MessageDisplay
import Wammu.PhoneSearch
import Wammu.About
import Wammu.ErrorMessage
import Wammu.TalkbackDialog
import Wammu.WammuSettings
import Wammu.SMSExport
import Wammu.SMSXML
import Wammu.ContactsXML
from Wammu.Paths import AppIconPath, IconPath
from Wammu.Locales import StrConv, ConsoleStrConv, ugettext as _

        Wammu.Events.EVT_SEND(self, self.OnSend)
        Wammu.Events.EVT_CALL(self, self.OnCall)
        Wammu.Events.EVT_MESSAGE(self, self.OnMessage)
        Wammu.Events.EVT_DUPLICATE(self, self.OnDuplicate)
        Wammu.Events.EVT_REPLY(self, self.OnReply)
        Wammu.Events.EVT_DELETE(self, self.OnDelete)
        Wammu.Events.EVT_BACKUP(self, self.OnBackup)
        Wammu.Events.EVT_EXCEPTION(self, self.OnException)

        self.splitter = wx.SplitterWindow(self, -1)
        il = wx.ImageList(16, 16)

        self.tree = wx.TreeCtrl(self.splitter)
        self.tree.AssignImageList(il)

        self.treei = {}
        self.values = {}

        keys = list(displaydata.keys())
        keys.sort(SortDataKeys)
        for type in keys:
            self.treei[type] = {}
            self.values[type] = {}
            subkeys = list(displaydata[type].keys())
            subkeys.sort(SortDataSubKeys)
            for subtype in subkeys:
                self.values[type][subtype] = displaydata[type][subtype][4]
                if displaydata[type][subtype][0] == '':
                    self.treei[type][subtype] = self.tree.AddRoot(
                        displaydata[type][subtype][1],

                        il.Add(wx.Bitmap(IconPath(displaydata[type][subtype][3]))))