本文整理汇总了Python中ninja_ide.core.file_manager.belongs_to_folder函数的典型用法代码示例。如果您正苦于以下问题:Python belongs_to_folder函数的具体用法?Python belongs_to_folder怎么用?Python belongs_to_folder使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了belongs_to_folder函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: save_project
def save_project(self, projectFolder):
for i in xrange(self._tabMain.count()):
editorWidget = self._tabMain.widget(i)
if type(editorWidget) is editor.Editor and file_manager.belongs_to_folder(projectFolder, editorWidget.ID):
self.save_file(editorWidget)
for i in xrange(self._tabSecondary.count()):
editorWidget = self._tabSecondary.widget(i)
if type(editorWidget) is editor.Editor and file_manager.belongs_to_folder(projectFolder, editorWidget.ID):
self.save_file(editorWidget)
示例2: close_files_from_project
def close_files_from_project(self, project):
if project:
tabMain = self.ide.mainContainer._tabMain
for tabIndex in reversed(xrange(tabMain.count())):
if file_manager.belongs_to_folder(
project, tabMain.widget(tabIndex).ID):
tabMain.removeTab(tabIndex)
tabSecondary = self.ide.mainContainer._tabSecondary
for tabIndex in reversed(xrange(tabSecondary.count())):
if file_manager.belongs_to_folder(
project, tabSecondary.widget(tabIndex).ID):
tabSecondary.removeTab(tabIndex)
示例3: save_project
def save_project(self, projectFolder):
for i in xrange(self._tabMain.count()):
editorWidget = self._tabMain.widget(i)
if type(editorWidget) is editor.Editor and file_manager.belongs_to_folder(projectFolder, editorWidget.ID):
reloaded = self._tabMain.check_for_external_modifications(editorWidget)
if not reloaded:
self.save_file(editorWidget)
for i in xrange(self._tabSecondary.count()):
editorWidget = self._tabSecondary.widget(i)
if type(editorWidget) is editor.Editor and file_manager.belongs_to_folder(projectFolder, editorWidget.ID):
reloaded = self._tabSecondary.check_for_external_modifications(editorWidget)
if not reloaded:
self.save_file(editorWidget)
示例4: close_files_from_project
def close_files_from_project(self, project):
"""Close the files related to this project."""
if project:
tabMain = self.ide.mainContainer._tabMain
for tabIndex in reversed(range(tabMain.count())):
if file_manager.belongs_to_folder(project, tabMain.widget(tabIndex).ID):
tabMain.removeTab(tabIndex)
tabSecondary = self.ide.mainContainer._tabSecondary
for tabIndex in reversed(range(tabSecondary.count())):
if file_manager.belongs_to_folder(project, tabSecondary.widget(tabIndex).ID):
tabSecondary.removeTab(tabIndex)
self.ide.profile = None
示例5: get_item_for_path
def get_item_for_path(self, path):
items = self.findItems(file_manager.get_basename(path),
Qt.MatchRecursive, 0)
folder = file_manager.get_folder(path)
for item in items:
if file_manager.belongs_to_folder(folder, item.path):
return item
示例6: _refresh_project_by_path
def _refresh_project_by_path(self, project_folder):
project_folder = unicode(project_folder)
project = [path for path in self._projects if \
file_manager.belongs_to_folder(path, project_folder)]
if project:
item = self._projects[unicode(project[0])]
self._refresh_project(item)
示例7: add_standalone_watcher
def add_standalone_watcher(self, filename, not_start=True):
# Add File Watcher if needed
opened_projects = self._parent.explorer.get_opened_projects()
opened_projects = [p.path for p in opened_projects]
alone = not_start
for folder in opened_projects:
if file_manager.belongs_to_folder(folder, filename):
alone = False
if alone or sys.platform == 'darwin':
self._file_watcher.add_file_watch(filename)
self._watched_simple_files.append(filename)
示例8: _refresh_project_by_path
def _refresh_project_by_path(self, event, folder):
if event not in (DELETED, ADDED, REMOVE, RENAME):
return
folder = unicode(folder)
oprojects = self.get_open_projects()
for each_project in oprojects:
p_path = unicode(each_project.path)
if file_manager.belongs_to_folder(p_path, folder) and \
file_manager.is_supported_extension(folder,
each_project.extensions):
self._refresh_project(each_project)
break
示例9: find_occurrences
def find_occurrences(self, word):
self._find_widget.pattern_line_edit.setText(word)
editorWidget = main_container.MainContainer().get_actual_editor()
explorerContainer = explorer_container.ExplorerContainer()
projects_obj = explorerContainer.get_opened_projects()
projects = [p.path for p in projects_obj]
project = explorerContainer.get_actual_project()
for p in projects:
if file_manager.belongs_to_folder(p, editorWidget.ID):
project = p
break
self._find_widget.dir_combo.clear()
self._find_widget.dir_combo.addItem(project)
self._find_widget._find_in_files()
示例10: _refresh_project_by_path
def _refresh_project_by_path(self, event, folder):
if event not in (DELETED, ADDED, REMOVE, RENAME):
return
oprojects = self.get_open_projects()
for each_project in oprojects:
p_path = each_project.path
if file_manager.belongs_to_folder(p_path, folder) and \
file_manager.is_supported_extension(folder,
each_project.extensions) and folder[:1] != '.':
self._refresh_projects_queue.append(each_project)
break
if not self._timer_running:
self._timeout()
QTimer.singleShot(3000, self._timeout)
self._timer_running = True
示例11: get_project_owner
def get_project_owner(self, editorWidget=None):
"""
Return the project where this file belongs, or an empty string.
"""
#if not editor try to get the current
if editorWidget is None:
editorWidget = self._main.get_actual_editor()
belongs = ''
if editorWidget is None:
return belongs
#get the opened projects
opened_projects_obj = self._explorer.get_opened_projects()
for project in opened_projects_obj:
if file_manager.belongs_to_folder(project.path, editorWidget.ID):
belongs = project.path
break
return belongs
示例12: _close_project
def _close_project(self):
item = self.currentItem()
index = self.indexOfTopLevelItem(item)
pathKey = item.path
for directory in self._fileWatcher.directories():
directory = unicode(directory)
if file_manager.belongs_to_folder(pathKey, directory):
self._fileWatcher.removePath(directory)
self._fileWatcher.removePath(pathKey)
self.takeTopLevelItem(index)
self._projects.pop(pathKey)
if self.__enableCloseNotification:
self.emit(SIGNAL("closeProject(QString)"), pathKey)
self.emit(SIGNAL("closeFilesFromProjectClosed(QString)"), pathKey)
item = self.currentItem()
if item:
self.set_default_project(item)
示例13: group_tabs_together
def group_tabs_together(self):
"""Group files that belongs to the same project together."""
if self.ide.explorer._treeProjects is None:
return
projects_obj = self.ide.explorer.get_opened_projects()
projects = [p.path for p in projects_obj]
for project in projects:
projectName = self.ide.explorer.get_project_name(project)
if not projectName:
projectName = file_manager.get_basename(project)
tabGroup = tab_group.TabGroup(project, projectName, self)
for index in reversed(range(self.ide.mainContainer._tabMain.count())):
widget = self.ide.mainContainer._tabMain.widget(index)
if type(widget) is editor.Editor and file_manager.belongs_to_folder(project, widget.ID):
tabGroup.add_widget(widget)
self.ide.mainContainer._tabMain.removeTab(index)
if tabGroup.tabs:
self.ide.mainContainer._tabMain.add_tab(tabGroup, projectName)
示例14: _is_django_project
def _is_django_project(self, fileName):
fileName = unicode(fileName)
projects_obj = self.explorer_s.get_opened_projects()
for each_project in projects_obj:
if belongs_to_folder(unicode(each_project.path), fileName):
return each_project.projectType == PROJECT_TYPE