def msg_curse(self, args=None, max_width=None):
        """Return the dict to display in the curse interface."""
        # Init the return message
        ret = []

        # Only process if stats exist and display plugin enable...
        if not self.stats or import_error_tag or self.is_disable():
            return ret

        # Max size for the interface name
        ifname_max_width = max_width - 5

        # Build the string message
        # Header
        msg = '{:{width}}'.format('WIFI', width=ifname_max_width)
        ret.append(self.curse_add_line(msg, "TITLE"))
        msg = '{:>7}'.format('dBm')
        ret.append(self.curse_add_line(msg))

        # Hotspot list (sorted by name)
        for i in sorted(self.stats, key=operator.itemgetter(self.get_key())):
            # Do not display hotspot with no name (/ssid)...
            # of ssid/signal None... See issue #1151 and #issue1973
            if i['ssid'] == '' or i['ssid'] is None or i['signal'] is None:
                continue
            ret.append(self.curse_new_line())
            # New hotspot
            hotspotname = i['ssid']
            # Add the encryption type (if it is available)
            if i['encrypted']:
                hotspotname += ' {}'.format(i['encryption_type'])
            # Cut hotspotname if it is too long
            if len(hotspotname) > ifname_max_width:
                hotspotname = '_' + hotspotname[-ifname_max_width + 1:]
            # Add the new hotspot to the message
            msg = '{:{width}}'.format(nativestr(hotspotname),
                                      width=ifname_max_width)
            ret.append(self.curse_add_line(msg))
            msg = '{:>7}'.format(i['signal'], width=ifname_max_width)
            ret.append(self.curse_add_line(msg,
                                           self.get_views(item=i[self.get_key()],
                                                          key='signal',
                                                          option='decoration')))

        return ret
def msg_curse ( self , args = None , max_width = None ) : ret = [ ] if not self . stats or import_error_tag or self . is_disable ( ) : return ret ifname_max_width = max_width - 5 msg = '{:{width}}' . format ( 'WIFI' , width = ifname_max_width ) ret . append ( self . curse_add_line ( msg , "TITLE" ) ) msg = '{:>7}' . format ( 'dBm' ) ret . append ( self . curse_add_line ( msg ) ) for i in sorted ( self . stats , key = operator . itemgetter ( self . get_key ( ) ) ) : if i [ 'ssid' ] == '' or i [ 'ssid' ] is None or i [ 'signal' ] is None : continue ret . append ( self . curse_new_line ( ) ) hotspotname = i [ 'ssid' ] if i [ 'encrypted' ] : hotspotname += ' {}' . format ( i [ 'encryption_type' ] ) if len ( hotspotname ) > ifname_max_width : hotspotname = '_' + hotspotname [ - ifname_max_width + 1 : ] msg = '{:{width}}' . format ( nativestr ( hotspotname ) , width = ifname_max_width ) ret . append ( self . curse_add_line ( msg ) ) msg = '{:>7}' . format ( i [ 'signal' ] , width = ifname_max_width ) ret . append ( self . curse_add_line ( msg , self . get_views ( item = i [ self . get_key ( ) ] , key = 'signal' , option = 'decoration' ) ) ) return ret
Return the dict to display in the curse interface.