def __start__(self, fileloadpath, fileloadname, filesavepath,
                  filesavename):

        if fileloadpath[-1:] != '\\':
            fileloadpath += '\\'
        if filesavepath[-1:] != '\\':
            filesavepath += '\\'

        self.fileloadpath = fileloadpath
        self.fileloadname = fileloadname
        self.filesavepath = filesavepath
        self.filesavename = filesavename

        starterror = False

        if self.fileloadpath == '':
            eg.PrintError('Load path cannot be blank.')
            starterror = True

        if self.fileloadname == '':
            eg.PrintError('Load filename cannot be blank.')
            starterror = True

        if self.filesavepath == '':
            eg.PrintError('Save path cannot be blank.')
            starterror = True

        if self.filesavename == '':
            eg.PrintError('Save filename cannot be blank.')
            starterror = True

        if starterror: return

        self.LoadFile(self.fileloadpath, self.fileloadname)
    def Query(self, key1, key2, key3):

        if key2 != None and key2 != '' and key3 != None and key3 != '':
            try:
                eg.TriggerEvent('QueryResults.' + str(DBase[key1][key2][key3]),
                                prefix='SystemDatabase',
                                payload=DBase[key1][key2][key3])

                return DBase[key1][key2][key3]
            except KeyError:
                eg.PrintError('Key Error')
                print key1, key2, key3
                return 'KeyError'

        elif key2 != None and key2 != '':
            try:
                eg.TriggerEvent('QueryResults.' + str(DBase[key1][key2]),
                                prefix='SystemDatabase',
                                payload=DBase[key1][key2])
                return DBase[key1][key2]
            except KeyError:
                eg.PrintError('Key Error')
                print key1, key2
                return 'KeyError'

        else:
            try:
                eg.TriggerEvent('QueryResults.' + str(DBase[key1]),
                                prefix='SystemDatabase',
                                payload=DBase[key1])
                return DBase[key1]
            except KeyError:
                eg.PrintError('Key Error')
                print key1
                return 'KeyError'
예제 #3
0
 def initiate_close(self):
     try:
         self.close_when_done()
     except:
         eg.PrintError("Error 1: Closing Socket: " + str(sys.exc_info()))
     
     self.plugin.EndLastEvent()
     try:
         self.close()
     except:
         eg.PrintError("Error 2: Closing Socket: " + str(sys.exc_info()))
예제 #4
0
    def FileError(self, fpath, fname, state):

        stateerror = False

        if fpath == '':
            eg.PrintError(state + ' path cannot be blank.')
            stateerror = True

        if fname == '':
            eg.PrintError(state + ' filename cannot be blank.')
            stateerror = True

        return stateerror
예제 #5
0
def replaceEgVars(script):
    """Replaces variables that start with eg with actual Eventghost variables"""
    if script.find("#eg.") != -1:
        words = script.split("#eg.")
        for w in range(1, len(words)):
            var = "eg." + words[w].split("#", 1)[0]
            try:
                # Replaces Eventghost Variable with it's actual value
                script = script.replace('#' + var + '#', str(eval(var)))
            except SyntaxError:
                eg.PrintError("AHK: Make sure all eg variables end with a '#'")
                break
            except ImportError:
                eg.PrintError("AHK: Variable '" + var + "' does not exist.")
    return script
 def __call__ (self):
     if self.plugin.is_connected == True:
         if self.plugin.is_open == False:
             lphmo = pointer(self.plugin.hmo)
             uDeviceID = self.plugin.uDeviceID
             dwCallback = self.plugin.Callback
             dwCallbackInstance = None
             dwFlags = CALLBACK_FUNCTION
             result = midiOutOpen(lphmo,uDeviceID,dwCallback,dwCallbackInstance,dwFlags)
             if result == MMSYSERR_NOERROR:
                 self.plugin.is_open = True
             else:
                 eg.PrintError('MMSYSERROR')
     else:
         eg.PrintError(self.plugin.device_name+' is not connected')
 def init(self):
     self.audioEndpointIDToNameDict = {}
     self.audioEndpointNames = []
     self.audioEndpointIDs = []
     command = [
         self.info.path +
         '\\EndPointController\\EndPointControllerModified.exe', '-g'
     ]
     ret, data = self.popen(command)
     if not ret:
         data = data.split("\r\n")[:-1]
         for currData in data:
             currDataArray = unicode(currData.decode(
                 eg.systemEncoding)).split(";;")
             self.audioEndpointIDToNameDict[
                 currDataArray[3]] = currDataArray[0]
             if currDataArray[1] == "1":
                 self.audioEndpointNames.append(currDataArray[0])
                 self.audioEndpointIDs.append(currDataArray[3])
             if currDataArray[
                     2] == "1" and self.activeAudioEndpoint != currDataArray[
                         3]:
                 self.activeAudioEndpoint = currDataArray[3]
                 self.TriggerEvent(
                     "Default.Render.Console." + currDataArray[0],
                     [currDataArray[3]])
                 self.TriggerEvent(
                     "Default.Render.Multimedia." + currDataArray[0],
                     [currDataArray[3]])
         return True
     else:
         eg.PrintError("AudioEndpoint: ERROR calling " + str(command) +
                       ": " + str(ret))
         return False
    def __start__(self,
                  port,
                  longpresstimeout,
                  prefix='X10-Mouse',
                  enduringevent=False,
                  logbytes=False,
                  longpressreset=0.075):

        if enduringevent:
            self.info.eventPrefix = prefix
        else:
            self.TriggerEvent = eg.TriggerEvent
        try:
            self.Serial = SerialThread(
                eg.WinApi.serial.Serial(port,
                                        baudrate=1200,
                                        bytesize=7,
                                        stopbits=1,
                                        parity='N'),
                win32event.CreateEvent(None, 1, 0, None), logbytes, prefix,
                self.TriggerEvent, longpresstimeout, longpressreset)
        except Exception as err:
            self.Serial = None
            eg.PrintError(str([err]))
            eg.Print('X-10 Mouse Plugin Has Stopped')
        else:
            eg.Print('X-10 Mouse Plugin Has Started')
            self.Serial.start()
예제 #9
0
    def __call__(self,
                 com_port=None,
                 adapter_name=None,
                 device='TV',
                 key=None):
        if key is None:
            key = getattr(self, 'value', None)
            if key is None or (com_port is None and adapter_name is None):
                eg.PrintNotice(
                    'CEC: This action needs to be configured before use.')
                return

        adapter = self._find_adapter(com_port, adapter_name)

        if adapter is None:
            eg.PrintNotice('CEC: Adapter %s on com port %s not found' %
                           (adapter_name, com_port))
        else:
            d = getattr(adapter, device.lower().replace(' ', ''), None)
            if d is None:
                eg.PrintNotice('CEC: Device %s not found in adapter %s' %
                               (device, adpater.name))
            else:
                remote = getattr(d, key, None)
                if remote is None:
                    eg.PrintError(
                        'CEC: Key %s not found for device %s on adapter %s' %
                        (key, device, adpater.name))
                else:
                    import time
                    remote.send_key_press()
                    time.sleep(0.1)
                    remote.send_key_release()
예제 #10
0
    def __start__(self, *adapters):
        def start_connections(*adptrs):
            while self.adapters:
                pass

            cec_lib = cec.ICECAdapter.Create(cec.libcec_configuration())
            available_coms = list(a.strComName
                                  for a in cec_lib.DetectAdapters())
            cec_lib.Close()

            for item in adptrs:
                com_port = item[0]

                if com_port in available_coms:
                    try:
                        self.adapters += [CECAdapter(*item)]
                    except AdapterError:
                        continue
                else:
                    eg.PrintError('CEC Error: adapter on %s is not found' %
                                  com_port)

            if not self.adapters:
                eg.PrintError('CEC Error: no CEC adapters found')
                self.__stop__()

        for items in adapters:
            if not isinstance(items, tuple):
                eg.PrintError('You cannot upgrade to this version.\n'
                              'Delete the plugin from the plugins folder '
                              'and then install this one')
                break
        else:
            threading.Thread(target=start_connections, args=adapters).start()
예제 #11
0
    def CreateInstance(self, args, evalName, treeItem):
        self.args = args
        self.treeItem = treeItem
        self.actions = {}
        pluginCls = self.pluginCls
        try:
            plugin = pluginCls.__new__(pluginCls)
        except:
            eg.PrintTraceback()
            return None
        plugin.info = self
        self.instance = plugin

        # create an unique exception for every plugin instance
        class _Exception(eg.PluginBase.Exception):
            obj = plugin

        plugin.Exception = _Exception
        plugin.Exceptions = eg.ExceptionsProvider(plugin)

        if evalName is None:
            evalName = pluginCls.__name__
            i = 1
            while hasattr(eg.plugins, evalName):
                i += 1
                evalName = pluginCls.__name__ + str(i)
        assert not hasattr(eg.plugins, evalName)
        self.evalName = evalName
        setattr(eg.plugins, evalName, PluginProxy(plugin))
        eg.pluginList.append(plugin)

        if evalName != pluginCls.__name__:
            numStr = evalName[len(pluginCls.__name__):]
            plugin.name = self.name + " #" + numStr
        else:
            plugin.name = self.name
        plugin.description = self.description
        self.eventPrefix = evalName
        self.actionGroup = eg.ActionGroup(plugin, plugin.name,
                                          plugin.description)
        eg.actionGroup.items.append(self.actionGroup)
        plugin.AddAction = self.actionGroup.AddAction
        plugin.AddGroup = self.actionGroup.AddGroup
        try:
            plugin.__init__()
            self.initFailed = False
        except eg.Exceptions.PluginNotFound as exc:
            pass
        except eg.Exception as exc:
            eg.PrintError(exc.text.decode(eg.systemEncoding))
        except:
            eg.PrintTraceback()

        if hasattr(plugin, "Compile"):
            plugin.Compile(*args)
        try:
            self.label = plugin.GetLabel(*args)
        except:
            self.label = self.name
        return self
예제 #12
0
    def Value(self, attrLoc=None):
        if attrLoc is None:
            attrLoc = self.Dialog('lookupValueMessage')
            if attrLoc != NOValue:
                if not attrLoc.startswith('eg.globals'):
                    attrLoc = 'eg.globals.' + attrLoc
            else:
                return

        attrLoc = attrLoc.split('.')
        attr = self.GetAttribute(attrLoc[2:-1])
        if attr != NOValue:
            attrName = attrLoc[-1]
            try:
                value = str(getattr(attr, attrName))
            except AttributeError:
                eg.PrintError(Text.attributeError % (repr(attr), attrName))
                return

            newValue = self.Dialog('setValueMessage', value)
            if newValue != NOValue:
                try:
                    newValue = eval(newValue)
                except:
                    pass
                setattr(attr, attrName, newValue)
    def LoadFile(self, fpath='', fname=''):

        try:
            strDict = ''

            try:
                with open(fpath + fname, "r") as f:
                    strDict = f.readline()
            except IOError:
                with open(fpath + fname, "w") as f:
                    f.write("{}")
                with open(fpath + fname, "r") as f:
                    strDict = f.readline()
            try:
                DBase = ast.literal_eval(strDict)
                self.filesavepath = fpath
                self.filesavename = fname
                return True
            except:
                eg.PrintError("Database data is malformed")
                return False

        except IOError:
            if not self.FileError(fpath, fname, 'Load'):
                return False
예제 #14
0
    def __call__(self, imagePath, evtID, cType, evtF, evtNF):
        script = "\nSysGet, VirtualWidth, 78\nSysGet, VirtualWidth, 79"
        script += "\nImageSearch, imageX, imageY, 0, 0"
        script += ", %A_ScreenWidth%, %A_ScreenHeight%, " + imagePath
        if cType != 0:
            script += "\nif ErrorLevel = 0"
            if cType == 1:
                script += "\n    Click %imageX%, %imageY%, left"
            if cType == 2:
                script += "\n    Click %imageX%, %imageY%, 2"
            if cType == 3:
                script += "\n    Click %imageX%, %imageY%, right"

        script = replaceEgVars(script)
        ImgScript = ahk.Script()
        ImgScript.variable("imageX", int)
        ImgScript.variable("imageY", int)
        ahk.execute(str(script))
        errorLevel = ImgScript.ErrorLevel
        if evtID:
            evtID += "."
        if errorLevel == 0 and evtF == True:
            eg.TriggerEvent(evtID + "ImageFound",
                            prefix="AHK.ImageSearch",
                            payload=[ImgScript.imageX, ImgScript.imageY])
        if errorLevel == 1 and evtNF == True:
            eg.TriggerEvent(evtID + "ImageNotFound", prefix="AHK.ImageSearch")
        if errorLevel == 2:
            eg.PrintError("There was an error. Try another image format.")
예제 #15
0
 def __call__(self, line=1):
     line = self.plugin.parseArgument(line) - 1
     if line < self.plugin.rows:
         return self.plugin.PrintCommand(line)
     else:
         eg.PrintError(
             "XXXXXXXXXXXXXXXXXXX BAD LINE XXXXXXXXXXXXXXXXXXXXXXXXXX")
예제 #16
0
    def __init__(self, port, password, handler):
        try:
            self.handler = handler
            self.password = password

            # Call parent class constructor explicitly
            asyncore.dispatcher.__init__(self)

            # Create socket of requested type
            self.create_socket(socket.AF_INET, socket.SOCK_STREAM)

            # restart the asyncore loop, so it notices the new socket
            eg.RestartAsyncore()

            # Set it to re-use address
            # self.set_reuse_addr()
            # self.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

            # Bind to all interfaces of this host at specified port
            self.bind(('', port))

            # Start listening for incoming requests. The parameter is the maximum number of queued connections.
            self.listen(5)
        except:
            eg.PrintError("TCPEvents: Error in Server.__init__: " +
                          str(sys.exc_info()))
예제 #17
0
 def OnButtonOff(self, evt):
     hwnd = GetHwnd()
     if not hwnd:
         eg.PrintError(self.plugin.text.err1)
         return
     eg.plugins.VirtualHouse.SetAllLightsOff()
     evt.Skip()
예제 #18
0
    def __call__(self,
                 key,
                 subkey,
                 valueName,
                 action,
                 keyType,
                 newValue,
                 disableParsing=False):
        if not disableParsing:
            newValue = eg.ParseString(newValue)
        if not key:
            self.PrintError(self.text2.noKeyError)
            return 0
        if not subkey:
            self.PrintError(self.text2.noSubkeyError)
            return 0
        if not valueName:
            self.PrintError(self.text2.noValueNameError)
            return 0

        #try to get handle
        try:
            if action == 0:
                regHandle = _winreg.CreateKey(key, subkey)
            else:
                regHandle = _winreg.OpenKey(
                    key, subkey, 0, _winreg.KEY_WRITE | _winreg.KEY_READ)
        except EnvironmentError, exc:
            if action != 1:
                eg.PrintError(self.text2.keyOpenError + ": " + str(exc))
            return 0
예제 #19
0
 def initiate_close(self):
     try:
         self.push("close\n")
         self.close_when_done()
     except:
         eg.PrintError(
             "Error in ServerHandler.initiate_close(push/close_when_done): "
             + str(sys.exc_info()))
     # asynchat.async_chat.handle_close(self)
     self.plugin.EndLastEvent()
     self.state = self.state1
     try:
         self.close()
     except:
         eg.PrintError("Error in ServerHandler.initiate_close (close)" +
                       str(sys.exc_info()))
예제 #20
0
 def __call__(self, deviceIndex, state):
     print("Changing device state...")
     try:
         device = self.plugin.devices[deviceIndex]
         newState = str(state)
         #Options
         url = device.url + "?token=" + self.plugin.token
         data = {
             "method": "passthrough",
             "params": {
                 "deviceId":
                 device.id,
                 "requestData":
                 "{\"system\":{\"set_relay_state\":{\"state\":" + newState +
                 "}}}"
             }
         }
         headers = {
             'Content-type': 'application/json',
             'Accept': 'text/plain'
         }
         #Get device list
         r = requests.post(url,
                           data=json.dumps(data),
                           headers=headers,
                           verify=False)
     except AttributeError:
         eg.PrintError(
             "Something went wrong. Please make sure you called Authenticate and Get Device List!"
         )
예제 #21
0
    def __call__(self):
        print "Retrieving device list..."

        try:
            #Options
            url = "https://wap.tplinkcloud.com?token=" + self.plugin.token
            data = {"method": "getDeviceList"}
            headers = {
                'Content-type': 'application/json',
                'Accept': 'text/plain'
            }
            #Get device list
            r = requests.post(url,
                              data=json.dumps(data),
                              headers=headers,
                              verify=False)
            deviceList = json.loads(r.text)['result']['deviceList']

            self.plugin.devices = []
            self.plugin.deviceAlias = []
            for device in deviceList:
                mac = device['deviceMac']
                mac = "-".join(mac[i:i + 2] for i in range(0, len(mac), 2))
                device = Device(device['deviceId'], device['alias'], mac,
                                device['appServerUrl'])
                self.plugin.devices.append(device)
                self.plugin.deviceAlias.append(device.alias)
        except AttributeError:
            eg.PrintError(
                "Something went wrong. Please make sure you called Authenticate!"
            )
예제 #22
0
def Reset():
    eg.stopExecutionFlag = True
    eg.programCounter = None
    del eg.programReturnStack[:]
    eg.eventThread.ClearPendingEvents()
    eg.actionThread.ClearPendingEvents()
    eg.PrintError("Execution stopped by user")
def auto_detect_ip_threaded(self):
    """
    Blasts the network with requests, attempting to find any and all yamaha receivers
    on the local network. First it detects the user's local ip address, eg 192.168.1.100.
    Then, it converts that to the network prefix, eg 192.168.1, and then sends a request
    to every ip on that subnet, eg 192.168.1.1 -> 192.168.1.254. It does each request on
    a separate thread in order to avoid waiting for the timeout for every 254 requests
    one by one.
    """
    devices = []
    print "this is rList"
    print self.rList
    # Get network prefix (eg 192.168.1)
    net_prefix = get_network_prefix()
    print net_prefix
    ip_range = create_ip_range(net_prefix + '.1', net_prefix + '.254')
    print ip_range
    threads = []
    for ip in ip_range:
        t = Thread(target=try_connect, kwargs={'self': self, 'ip': ip})
        t.daemon = True
        threads.append(t)
        t.start()
    for t in threads:
        t.join()

    if devices is not None:
        pass
    else:
        eg.PrintError("No Roku Was Not Found!")
예제 #24
0
    def __init__(self, parent, node):
        TreeItem.__init__(self, parent, node)
        text = node.text
        if not text:
            # this should never happen
            return
        text = text.strip()
        objStr, remainder = text.split('(', 1)
        objStr = PATCHES.get(objStr, objStr)
        argString, _ = remainder.rsplit(')', 1)
        pluginStr, actionStr = objStr.split(".", 1)
        plugin = getattr(eg.plugins, pluginStr).plugin
        try:
            action = plugin.info.actions[actionStr]
        except KeyError:
            eg.PrintError("Can't find action: " + text)
            action = None
        if action is None or not issubclass(action, eg.ActionBase):
            action = eg.plugins.EventGhost.plugin.info.actions["PythonCommand"]
            argString = repr(text)
        try:
            self.executable = action()
        except:
            eg.PrintTraceback(msg="Error in action: " + repr(text))
            self.executable = eg.plugins.EventGhost.PythonCommand
            argString = repr(text)

        self.icon = action.info.icon
        self.SetArgumentString(argString)
 def __call__(self):
     if self.plugin.is_open == True:
         result = midiOutClose(self.plugin.hmo)
         if result == MMSYSERR_NOERROR:
             self.plugin.is_open = False
         else:
             eg.PrintError('MMSYSERROR')
 def Configure(self, device_name=''):
     uDeviceID = 0
     n = midiOutGetNumDevs()
     midi_out_caps = MIDIOUTCAPS()
     lpMidiOutCaps = pointer(midi_out_caps)
     cbMidiOutCaps = MIDIOUTCAPS_SIZE
     device_names = []
     # create a list of the MIDI output device names
     while uDeviceID < n:
         result = midiOutGetDevCaps(uDeviceID, lpMidiOutCaps, cbMidiOutCaps)
         if result == MMSYSERR_NOERROR:
             device_names.append(midi_out_caps.szPname)
         else:
             eg.PrintError('MMSYSERROR')
         uDeviceID = uDeviceID + 1
     # determine the current device, if any
     if device_name in device_names:
         current_device_index = device_names.index(device_name)
     else:
         current_device_index = -1
     # create the configuration dialog
     panel = eg.ConfigPanel()
     dropdown_listbox = panel.Choice(current_device_index, device_names)
     panel.AddLine('choose output device: ', dropdown_listbox)
     while panel.Affirmed():
         panel.SetResult(device_names[dropdown_listbox.GetValue()])
예제 #27
0
파일: __init__.py 프로젝트: as00paf/Wink
    def Configure(self, deviceIndex=0, state=LightBulbState(False, 0)):
        try:
            panel = eg.ConfigPanel()
            device = self.plugin.devices[deviceIndex]

            self.labelDevice = wx.StaticText(panel,
                                             label="Select Device",
                                             style=wx.ALIGN_LEFT)
            panel.sizer.Add(self.labelDevice, 0, wx.ALIGN_LEFT)

            self.deviceCombo = wx.ComboBox(panel,
                                           -1,
                                           size=(150, -1),
                                           value=device.alias,
                                           choices=self.plugin.deviceAlias)
            panel.sizer.Add(self.deviceCombo, 0, wx.ALIGN_CENTER_VERTICAL)

            self.labelState = wx.StaticText(panel,
                                            label="Select State",
                                            style=wx.ALIGN_LEFT)
            panel.sizer.Add(self.labelState, 0, wx.ALIGN_LEFT, 20)

            self.states = ["OFF", "ON"]
            self.stateCombo = wx.ComboBox(panel,
                                          -1,
                                          size=(150, -1),
                                          value="ON",
                                          choices=self.states)
            panel.sizer.Add(self.stateCombo, 0, wx.ALIGN_LEFT)

            self.labelBrightness = wx.StaticText(panel,
                                                 label="Select Brightness",
                                                 style=wx.ALIGN_LEFT)
            panel.sizer.Add(self.labelBrightness, 0, wx.ALIGN_LEFT, 20)

            self.brightnessSlider = wx.Slider(panel,
                                              -1,
                                              size=(150, -1),
                                              value=state.brightness,
                                              minValue=0,
                                              maxValue=100,
                                              style=wx.SL_HORIZONTAL
                                              | wx.SL_LABELS)
            panel.sizer.Add(self.brightnessSlider, 0, wx.ALIGN_LEFT)

            while panel.Affirmed():
                powered = True
                if (self.stateCombo.GetCurrentSelection() == 0):
                    powered = False

                brightness = self.brightnessSlider.GetValue()
                state = LightBulbState(powered, brightness)
                print(state.toString())
                deviceIndex = self.deviceCombo.GetCurrentSelection()
                panel.SetResult(deviceIndex, state)
        except AttributeError:
            eg.PrintError(
                "Something went wrong. Please make sure you called Authenticate and Get Device List!"
            )
 def HandleAction(self, action):
     try:
         action()
     except eg.PluginBase.Exception as exc:
         pluginInfo = exc.obj.info
         eg.PrintError(exc.message, source=pluginInfo.treeItem)
         pluginInfo.lastException = exc
         pluginInfo.treeItem.Refresh()
예제 #29
0
    def do_GET(self):
        """Serve a GET request."""
        # First do Basic HTTP-Authentication, if set
        if not self.Authenticate():
            return

        path, dummy, remaining = self.path.partition("?")
        if remaining:
            if "message=" in remaining:
                message = remaining.split("message=")[1]
                message = unquote_plus(message).decode("utf-8")
                message, andSign, rest = message.partition("&")
            queries = remaining.split("#", 1)[0].split("&")
            queries = [unquote_plus(part).decode("latin1") for part in queries]
            if len(queries) > 0:
                event = "Message"

            if "withoutRelease" in queries:
                queries.remove("withoutRelease")
                event = self.plugin.TriggerEnduringEvent(event, queries)
                while not event.isEnded:
                    time.sleep(0.05)
            elif event == "ButtonReleased":
                self.plugin.EndLastEvent()
            else:
                params, seperator, commands = message.partition("=:=")
                params = params.split(" ")
                if "=:=" in commands:
                    commands = commands.split("=:=")
                payload = AutoRemotePayload(params, commands)
                event = event + "." + params[0]
                event = self.plugin.TriggerEvent(event, payload)
                while not event.isEnded:
                    time.sleep(0.05)
        try:
            self.SendContent(path)
        except Exception, exc:
            self.plugin.EndLastEvent()
            eg.PrintError("Webserver error", self.path)
            eg.PrintError("Exception", unicode(exc))
            if exc.args[0] == 10053:  # Software caused connection abort
                pass
            elif exc.args[0] == 10054:  # Connection reset by peer
                pass
            else:
                raise
 def __stop__(self):
     print('WinCallbackTest stopped.')
     if self.is_open == True:
         result = midiOutClose(self.hmo)
         if result == MMSYSERR_NOERROR:
             self.is_open = False
         else:
             eg.PrintError('MMSYSERROR')