示例#1
0
 def add_path_to_search_item(self):
     itemdir = getexistingdirectory(self,
                                    'Select Directory Containing Projects')
     if itemdir:
         add_project_directory(itemdir)
         write_project_settings()
         self.set_items(projects())
示例#2
0
    def _update_available_project_menu(self):
        """
        Discover all projects and generate an action for each one.
        Then connect this action to _on_open_project_triggered
        """
        self.menu_available_projects.clear()
        self.action_available_project.clear()

        all_projects = {}  # dict parent dir -> list of Project objects
        for project in projects():
            all_projects.setdefault(project.projectdir, []).append(project)

        home = path(get_default_home_dir())
        for projectdir, _projects in all_projects.iteritems():
            relpath = home.relpathto(projectdir)
            label = unicode(relpath)
            menu = QtGui.QMenu(label, self.menu_available_projects)
            for project in sorted(_projects, key=lambda project: project.label):
                icon = obj_icon(project, default=DEFAULT_PROJECT_ICON, paths=[project.path])
                action = QtGui.QAction(icon, project.label, self.menu_available_projects)
                action.triggered.connect(self._on_open_project_triggered)
                menu.addAction(action)
                self.action_available_project[action] = project
            self.menu_available_projects.addMenu(menu)
        return self.menu_available_projects
示例#3
0
    def _update_available_project_menu(self):
        """
        Discover all projects and generate an action for each one.
        Then connect this action to _on_open_project_triggered
        """
        self.menu_available_projects.clear()
        self.action_available_project.clear()

        all_projects = {}  # dict parent dir -> list of Project objects
        for project in projects():
            all_projects.setdefault(project.projectdir, []).append(project)

        home = path(get_default_home_dir())
        for projectdir, _projects in all_projects.iteritems():
            relpath = home.relpathto(projectdir)
            label = unicode(relpath)
            menu = QtGui.QMenu(label, self.menu_available_projects)
            for project in sorted(_projects,
                                  key=lambda project: project.label):
                icon = obj_icon(project,
                                default=DEFAULT_PROJECT_ICON,
                                paths=[project.path])
                action = QtGui.QAction(icon, project.label,
                                       self.menu_available_projects)
                action.triggered.connect(self._on_open_project_triggered)
                menu.addAction(action)
                self.action_available_project[action] = project
            self.menu_available_projects.addMenu(menu)
        return self.menu_available_projects
示例#4
0
    def __init__(self, parent=None):
        ManagerExplorer.__init__(self, parent)
        self._explorer.search_item_request.connect(self.add_path_to_search_item)
        self._explorer.set_default_item_icon(DEFAULT_PROJECT_ICON)
        self.set_items(projects())
        self.set_criteria(self.criteria)

        self.groupby(filter_name="path")
示例#5
0
    def __init__(self, parent=None):
        ManagerExplorer.__init__(self, parent)
        self._explorer.search_item_request.connect(
            self.add_path_to_search_item)
        self._explorer.set_default_item_icon(DEFAULT_PROJECT_ICON)
        self.set_items(projects())
        self.set_criteria(self.criteria)

        self.groupby(filter_name="path")
示例#6
0
 def add_path_to_search_item(self):
     itemdir = getexistingdirectory(self, 'Select Directory Containing Projects')
     if itemdir:
         add_project_directory(itemdir)
         write_project_settings()
         self.set_items(projects())