def update_path(self, path, grandparent_path=None):
        """Update label and icon according to given paths.

        Parameters
        ==========
        path (pathlib.Path or None)
            if it is a pathlib.Path, it will be the path
            this PathObject represents. If None, it causes
            this object to not blit itself anymore,
            appearing as if invisible.
        grandparent_path (pathlib.Path or None)
            used to determine whether we'll use special
            text indicating that this path object
            actually gives access to the grandparent
            directory of the 'path' argument.
        """
        ### if path is None, set the drawing behaviour to
        ### an empty function and the text attribute to
        ### an empty string

        if path is None:

            drawing_behaviour = empty_function
            self.text = ""

        ### otherwise, if path isn't None...

        else:

            ## update text attribute and text in labels

            if grandparent_path is None or path != grandparent_path:
                text = path.name

            else:
                text = PATH_OBJ_PARENT_TEXT

            self.text = text

            self.normal_text_surf = TEXT_SURFS_DB[self.normal_text_settings][
                "surf_map"
            ][text]

            self.selected_text_surf = TEXT_SURFS_DB[self.selected_text_settings][
                "surf_map"
            ][text]

            ### update icon

            self.icon = (
                ## folder icon if a folder
                FOLDER_ICON
                if path.is_dir()
                ## otherwise custom icon if file, based
                ## on suffix
                else ICON_MAP.get(path.suffix.lower(), FILE_ICON)
            )

            self.icon_rect = self.icon.get_rect()

            self.icon_rect.midleft = self.rect.move(self.padding, 0).midleft

            self.text_rect = self.normal_text_surf.get_rect()

            self.text_rect.midleft = self.icon_rect.move(self.padding, 0).midright

            ## set drawing behaviour to draw all objects
            drawing_behaviour = self.draw_objects

        ### finally store the path and drawing behaviour

        self.path = path
        self.draw = drawing_behaviour
Update label and icon according to given paths.

        Parameters
        ==========
        path (pathlib.Path or None)
            if it is a pathlib.Path, it will be the path
            this PathObject represents. If None, it causes
            this object to not blit itself anymore,
            appearing as if invisible.
        grandparent_path (pathlib.Path or None)
            used to determine whether we'll use special
            text indicating that this path object
            actually gives access to the grandparent
            directory of the 'path' argument.
        
nodezator/fileman/pathobj.py