def group_tabs_together(self): """Group files that belongs to the same project together.""" ninjaide = IDE.get_service('ide') projects = ninjaide.get_opened_projects() for project in projects: project_name = projects[project].name project_path = projects[project].path tabGroup = tab_group.TabGroup(project_path, project_name, self) self.connect(tabGroup, SIGNAL("expandAll()"), self.deactivate_tabs_groups) for index in reversed(list(range(self.tabs.count()))): widget = self.tabs.widget(index) if (isinstance(widget, editor.Editor) and widget.project == projects[project]): tabGroup.add_widget(widget) self.tabs.removeTab(index) if tabGroup.tabs: self.tabs.add_tab(tabGroup, project_name)
def group_tabs_together(self): 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(xrange( 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)