Example #1
0
    def __add_group(self, button):
        dialog = GroupDialog()
        result = dialog.prompt()
        if result is None:
            return

        self.__quick_menu.add_group(result)
        self.__build_store()
Example #2
0
    def __edit(self, button):
        result = self.__get_selection()
        if result is None:
            return

        selection, depth = result

        # group
        if depth == 0:
            group_name = self.__store[selection][5]
            if group_name == '':
                return
            dialog = GroupDialog(group_name)
            result = dialog.prompt()
            if result is None:
                return
            self.__quick_menu.edit_group(group_name, result)

        # ssh entry
        elif depth == 1:
            group_name = self.__store[self.__store.iter_parent(selection)][5]
            host = self.__store[selection]
            host_id = host[0]
            host_username = host[1]
            host_hostname = host[2]
            host_port = host[3]
            host_label = host[4]

            dialog = HostDialog(self.__quick_menu.groups.keys(), host_username, host_hostname, host_port, host_label, group_name)
            result = dialog.prompt()

            if result is None:
                return
            new_group_name, hostname, username, port, label = result
            self.__quick_menu.edit_host(group_name, new_group_name, host_id, username, hostname, port, label)

        self.__build_store()