def fill_watch_folders_tree_widget(self):
    self.watchFoldersTreeWidget.clear()
    if self.watch_folders_dict:
        for (i, asset_skey) in enumerate(self.watch_folders_dict.get('assets_skeys')):
            root_item = QtGui.QTreeWidgetItem()
            root_item.setData(0, QtCore.Qt.UserRole, asset_skey)
            root_item.setText(1, self.watch_folders_dict['assets_stypes'][i])
            root_item.setText(2, self.watch_folders_dict['assets_names'][i])
            repos_names = []
            for repo in self.watch_folders_dict['repos'][i]:
                repos_names.append(env_tactic.get_base_dir(repo)['value'][1])
            root_item.setText(3, ', '.join(repos_names))
            if self.watch_folders_dict['statuses'][i]:
                if self.check_for_item_in_watch(asset_skey):
                    root_item.setText(0, 'Watching')
                    self.start_watch_by_skey(asset_skey)
                else:
                    root_item.setText(0, 'Waiting')
            else:
                root_item.setText(0, 'Stopped')
                self.stop_watch_by_skey(asset_skey)
            self.watchFoldersTreeWidget.addTopLevelItem(root_item)
        self.watchFoldersTreeWidget.resizeColumnToContents(0)
        self.watchFoldersTreeWidget.resizeColumnToContents(1)
        self.watchFoldersTreeWidget.resizeColumnToContents(2)
        self.watchFoldersTreeWidget.resizeColumnToContents(3)
    if self.watched_items:
        self.start_watching()
    else:
        self.stop_watching()
def fill_watch_folders_tree_widget(self):
    self.watchFoldersTreeWidget.clear()
    if self.watch_folders_dict:
        for (i, asset_skey) in enumerate(self.watch_folders_dict.get('assets_skeys')):
            root_item = QtGui.QTreeWidgetItem()
            root_item.setData(0, QtCore.Qt.UserRole, asset_skey)
            root_item.setText(1, self.watch_folders_dict['assets_stypes'][i])
            root_item.setText(2, self.watch_folders_dict['assets_names'][i])
            repos_names = []
            for repo in self.watch_folders_dict['repos'][i]:
                repos_names.append(env_tactic.get_base_dir(repo)['value'][1])
            root_item.setText(3, ', '.join(repos_names))
            if self.watch_folders_dict['statuses'][i]:
                if self.check_for_item_in_watch(asset_skey):
                    root_item.setText(0, 'Watching')
                    self.start_watch_by_skey(asset_skey)
                else:
                    root_item.setText(0, 'Waiting')
            else:
                root_item.setText(0, 'Stopped')
                self.stop_watch_by_skey(asset_skey)
            self.watchFoldersTreeWidget.addTopLevelItem(root_item)
        self.watchFoldersTreeWidget.resizeColumnToContents(0)
        self.watchFoldersTreeWidget.resizeColumnToContents(1)
        self.watchFoldersTreeWidget.resizeColumnToContents(2)
        self.watchFoldersTreeWidget.resizeColumnToContents(3)
    if self.watched_items:
        self.start_watching()
    else:
        self.stop_watching()