def set_root_path(self, path, hide_extra_columns=True):
        """
        Sets the root path to watch
        :param path: root path - str
        :param hide_extra_columns: Hide extra column (size, paths,...)
        """
        if not self.isVisible():
            self._path_to_set = path
            self._hide_extra_colums = hide_extra_columns
            return
        if sys.platform == 'win32' and os.path.splitunc(path)[0]:
            mdl = QtGui.QStandardItemModel(1, 1)
            item = QtGui.QStandardItem(
                QtGui.QIcon.fromTheme(
                    'dialog-warning',
                    QtGui.QIcon(':/pyqode-icons/rc/dialog-warning.png')),
                'UNC pathnames not supported.')
            mdl.setItem(0, 0, item)
            self.setModel(mdl)
            self.root_path = None
            return
        self._hide_extra_colums = hide_extra_columns

        if os.path.isfile(path):
            path = os.path.abspath(os.path.join(path, os.pardir))
        self._fs_model_source = QtWidgets.QFileSystemModel()
        self._fs_model_source.setFilter(QtCore.QDir.Dirs | QtCore.QDir.Files |
                                        QtCore.QDir.NoDotAndDotDot |
                                        QtCore.QDir.Hidden)
        self._fs_model_source.setIconProvider(self._icon_provider)
        self._fs_model_proxy = self.FilterProxyModel()
        for item in self._ignored_patterns:
            self._fs_model_proxy.ignored_patterns.append(item)
        self._fs_model_proxy.setSourceModel(self._fs_model_source)
        self._fs_model_proxy.set_root_path(path)
        # takes parent of the root path, filter will keep only `path`, that
        # way `path` appear as the top level node of the tree
        self._root_path = os.path.dirname(path)
        self.root_path = path
        self._fs_model_source.directoryLoaded.connect(self._on_path_loaded)
        self._fs_model_source.setRootPath(self._root_path)
def set_root_path ( self , path , hide_extra_columns = True ) : if not self . isVisible ( ) : self . _path_to_set = path self . _hide_extra_colums = hide_extra_columns return if sys . platform == 'win32' and os . path . splitunc ( path ) [ 0 ] : mdl = QtGui . QStandardItemModel ( 1 , 1 ) item = QtGui . QStandardItem ( QtGui . QIcon . fromTheme ( 'dialog-warning' , QtGui . QIcon ( ':/pyqode-icons/rc/dialog-warning.png' ) ) , 'UNC pathnames not supported.' ) mdl . setItem ( 0 , 0 , item ) self . setModel ( mdl ) self . root_path = None return self . _hide_extra_colums = hide_extra_columns if os . path . isfile ( path ) : path = os . path . abspath ( os . path . join ( path , os . pardir ) ) self . _fs_model_source = QtWidgets . QFileSystemModel ( ) self . _fs_model_source . setFilter ( QtCore . QDir . Dirs | QtCore . QDir . Files | QtCore . QDir . NoDotAndDotDot | QtCore . QDir . Hidden ) self . _fs_model_source . setIconProvider ( self . _icon_provider ) self . _fs_model_proxy = self . FilterProxyModel ( ) for item in self . _ignored_patterns : self . _fs_model_proxy . ignored_patterns . append ( item ) self . _fs_model_proxy . setSourceModel ( self . _fs_model_source ) self . _fs_model_proxy . set_root_path ( path ) self . _root_path = os . path . dirname ( path ) self . root_path = path self . _fs_model_source . directoryLoaded . connect ( self . _on_path_loaded ) self . _fs_model_source . setRootPath ( self . _root_path )
Sets the root path to watch
        :param path: root path - str
        :param hide_extra_columns: Hide extra column (size, paths,...)