src/specter.py
async def process_host_request(self, stream, popup=True):
        """
        This method is called whenever we got data from the host.
        It tries to find a proper app and pass the stream with data to it.
        """
        self.gui.show_loader(title="Processing host data...")
        res = None
        try:
            matching_apps = []
            for app in self.apps:
                stream.seek(0)
                # check if the app can process this stream
                if app.can_process(stream):
                    matching_apps.append(app)
            if len(matching_apps) == 0:
                raise HostError("Host command is not recognized")
            # TODO: if more than one - ask which one to use
            if len(matching_apps) > 1:
                raise HostError(
                    "Not sure what app to use... " "There are %d" % len(matching_apps)
                )
            stream.seek(0)
            app = matching_apps[0]
            res = await app.process_host_command(stream, self.gui.show_screen(popup))
        except Exception as e:
            if isinstance(e, BaseError):
                # error that has a meaningfull message, will be sent to the host
                raise HostError(str(e))
            else:
                # converted to "unknown error" on the host
                raise e
        finally:
            self.gui.hide_loader()
        return res

        This method is called whenever we got data from the host.
        It tries to find a proper app and pass the stream with data to it.
        
This method is called whenever we got data from the host.
It tries to find a proper app and pass the stream with data to it.
This method is called whenever we got data from the host . It tries to find a proper app and pass the stream with data to it .
async def process_host_request(self, stream, popup=True):
        self.gui.show_loader(title="Processing host data...")
        res = None
        try:
            matching_apps = []
            for app in self.apps:
                stream.seek(0)
                if app.can_process(stream):
                    matching_apps.append(app)
            if len(matching_apps) == 0:
                raise HostError("Host command is not recognized")
            if len(matching_apps) > 1:
                raise HostError(
                    "Not sure what app to use... " "There are %d" % len(matching_apps)
                )
            stream.seek(0)
            app = matching_apps[0]
            res = await app.process_host_command(stream, self.gui.show_screen(popup))
        except Exception as e:
            if isinstance(e, BaseError):
                raise HostError(str(e))
            else:
                raise e
        finally:
            self.gui.hide_loader()
        return res
async def process_host_request ( self , stream , popup = True ) : self . gui . show_loader ( title = "Processing host data..." ) res = None try : matching_apps = [ ] for app in self . apps : stream . seek ( 0 ) if app . can_process ( stream ) : matching_apps . append ( app ) if len ( matching_apps ) == 0 : raise HostError ( "Host command is not recognized" ) if len ( matching_apps ) > 1 : raise HostError ( "Not sure what app to use... " "There are %d" % len ( matching_apps ) ) stream . seek ( 0 ) app = matching_apps [ 0 ] res = await app . process_host_command ( stream , self . gui . show_screen ( popup ) ) except Exception as e : if isinstance ( e , BaseError ) : raise HostError ( str ( e ) ) else : raise e finally : self . gui . hide_loader ( ) return res
This method is called whenever we got data from the host.
This method is called whenever we got data from the host .
"""
        This method is called whenever we got data from the host.
        It tries to find a proper app and pass the stream with data to it.
        """ # check if the app can process this stream # TODO: if more than one - ask which one to use # error that has a meaningfull message, will be sent to the host # converted to "unknown error" on the host
self
stream
popup