Ejemplo n.º 1
0
    def __update_local_files(self, *args):
        if not os.path.isfile(self.__recentf_path):
            _logger.debug("no recent files")
            self._recentbox.append(hippo.CanvasText(text="No recent files"))            
            return
        f = open(self.__recentf_path, 'r')
        doc = xml.dom.minidom.parse(f)

        self.__remove_files_for_key('files') 
        # we sort the list of files after we add them, so reversing doesn't
        # really matter anymore
        for child in reversed(xml_query(doc.documentElement, 'bookmark*')):         
            local_file = LocalFile(child)
            local_file.connect("changed", self.__on_local_file_changed)
            local_file.connect('activated', self.__on_file_activated)            
            self.__files.append(local_file)
        self.__files.sort(compare_by_date)
        self.__refresh_files()
Ejemplo n.º 2
0
    def __load_app_from_xml(self, node):
        id = node.getAttribute("id")
        #_logger.debug("parsing application id=%s", id)
        attrs = xml_get_attrs(node, ['id', 'rank', 'usageCount', 
                                     'iconUrl', 
                                     'category',
                                     'name', 'desktopNames', 'packageNames',
                                     ('tooltip', True),
                                     ('genericName', True)
                                    ])
        description = xml_query(node, 'description#')
        if description:
            attrs['description'] = description

        ## the old http format uses 'category' for what the data model
        ## calls 'categoryDisplayName'
        if attrs.has_key('category') and not attrs.has_key('categoryDisplayName'):
            attrs['categoryDisplayName'] = attrs['category']
            del attrs['category']

        return attrs