# Path: Wammu/Locales.py
# def ugettext(message):
#     if _TRANSLATION:
#         if six.PY2:
#             return _TRANSLATION.ugettext(message)
#         return _TRANSLATION.gettext(message)
#     return message


import sys
import threading
import wx
import Wammu.Events
from Wammu.Locales import ugettext as _
Generic thread wrapper used for reading things from phone
'''



class Thread(threading.Thread):
    def __init__(self, win, sm):
        threading.Thread.__init__(self)
        self.win = win
        self.sm = sm
        self.canceled = False

    def run(self):
        try:
            self.Run()
        except:
            evt = Wammu.Events.ExceptionEvent(data=sys.exc_info())
            wx.PostEvent(self.win, evt)
            self.ShowProgress(100)

    def Cancel(self):
        self.canceled = True

    def ShowError(self, info, finish=False):
        if finish:
            self.ShowProgress(100)
        lck = threading.Lock()
        lck.acquire()
        evt = Wammu.Events.ShowMessageEvent(
            message=Wammu.Utils.FormatError(

# Path: Wammu/Locales.py
# def ugettext(message):
#     if _TRANSLATION:
#         if six.PY2:
#             return _TRANSLATION.ugettext(message)
#         return _TRANSLATION.gettext(message)
#     return message


# Path: Wammu/Thread.py
import sys
import threading
import wx
import Wammu.Events
from Wammu.Locales import ugettext as _

Generic thread wrapper used for reading things from phone
'''



class Thread(threading.Thread):
    def __init__(self, win, sm):
        threading.Thread.__init__(self)
        self.win = win
        self.sm = sm
        self.canceled = False

    def run(self):
        try:
            self.Run()
        except:
            evt = Wammu.Events.ExceptionEvent(data=sys.exc_info())
            wx.PostEvent(self.win, evt)
            self.ShowProgress(100)

    def Cancel(self):
        self.canceled = True

    def ShowError(self, info, finish=False):
        if finish:
            self.ShowProgress(100)
        lck = threading.Lock()
        lck.acquire()
        evt = Wammu.Events.ShowMessageEvent(
            message=Wammu.Utils.FormatError(

                _('Error while communicating with phone'),