code: def set_project_dir(self, directory):
          
          if directory is not None:
              self.treewidget.set_root_path(osp.dirname(directory))
              self.treewidget.set_folder_names([osp.basename(directory)])
          self.treewidget.setup_project_view()
          try:
              self.treewidget.setExpanded(self.treewidget.get_index(directory),
                                          True)
          except TypeError:
              pass
docs: Set the project directory