Пример #1
0
        def callback():
            this = yield

            # Setup the loading notice
            frames = ['Loading package list' + f for f in busy_frames]
            stop_status_loop = loop_status_msg(frames, 0.15)

            # Run the search/list command
            output, return_code = yield Thread(target=run_nimble,
                                               args=('-y list -i',
                                                     this.send)).start()

            # Set the status to show we've finished searching
            yield stop_status_loop(get_next_method(this))

            if return_code != 0:
                sublime.status_message(
                    "Nimble Installed Package Listing Failed")
            else:
                items = []
                packages = parse_package_descriptions(output)

                if len(packages) == 0:
                    sublime.status_message("No Installed Packages Found")
                else:
                    for package in packages:
                        items.append([
                            package['name'],
                            package.get('description', ''),
                            package.get('url', '')
                        ])

                    selection = yield window.show_quick_panel(items, this.send)

                    if selection != -1:
                        target_name = items[selection][0]
                        # Setup the loading notice
                        loading_notice = "Uninstalling package"
                        frames = [loading_notice + f for f in busy_frames]
                        stop_status_loop = loop_status_msg(frames, 0.15)

                        # Run the install command
                        output, return_code = yield Thread(
                            target=run_nimble,
                            args=('-y uninstall ' + escape_shell(target_name),
                                  this.send)).start()

                        yield stop_status_loop(get_next_method(this))

                        self.output_content(output, window)
                        if return_code == 0:
                            sublime.status_message(
                                "Uninstalled Nimble Package")
                        else:
                            sublime.status_message(
                                'Nimble Package Uninstallation Failed')
            yield
Пример #2
0
        def callback():
            this = yield

            # Get user input
            search_term = yield window.show_input_panel(
                "Package Search Term?", '', this.send, None, None
            )

            # Setup the loading notice
            frames = ['Searching package list' + f for f in busy_frames]
            stop_status_loop = loop_status_msg(frames, 0.15)

            # Run the main command
            output, return_code = yield Thread(
                target=run_nimble,
                args=('-y search ' + escape_shell(search_term), this.send)
            ).start()

            # Set the status to show we've finished
            yield stop_status_loop(get_next_method(this))

            # List output
            if self.send_to_quickpanel:
                items = []
                packages = parse_package_descriptions(output)
                for package in packages:
                    items.append([
                        package['name'],
                        package.get('description', ''),
                        package.get('url', '')
                    ])
                window.show_quick_panel(items, None)

            # Show output
            self.output_content(output, window)

            if return_code == 0:
                sublime.status_message("Listing Nimble Packages")
            else:
                sublime.status_message('Nimble Package List Retrieval Failed')
            yield
Пример #3
0
        def callback():
            this = yield

            # Get user input
            search_term = yield window.show_input_panel(
                "Package Search Term?", '', this.send, None, None)

            # Setup the loading notice
            frames = ['Searching package list' + f for f in busy_frames]
            stop_status_loop = loop_status_msg(frames, 0.15)

            # Run the main command
            output, return_code = yield Thread(
                target=run_nimble,
                args=('-y search ' + escape_shell(search_term),
                      this.send)).start()

            # Set the status to show we've finished
            yield stop_status_loop(get_next_method(this))

            # List output
            if self.send_to_quickpanel:
                items = []
                packages = parse_package_descriptions(output)
                for package in packages:
                    items.append([
                        package['name'],
                        package.get('description', ''),
                        package.get('url', '')
                    ])
                window.show_quick_panel(items, None)

            # Show output
            self.output_content(output, window)

            if return_code == 0:
                sublime.status_message("Listing Nimble Packages")
            else:
                sublime.status_message('Nimble Package List Retrieval Failed')
            yield
Пример #4
0
        def callback():
            this = yield

            if self.preemptive_search:
                # Get user input
                search_term = yield window.show_input_panel(
                    "Package to install?", '', this.send, None, None)

                loading_notice = 'Searching package list'
                process_args = ('-y search ' + escape_shell(search_term),
                                this.send)
            else:
                loading_notice = 'Loading package list'
                process_args = ('-y list ', this.send)

            # Setup the loading notice
            frames = [loading_notice + f for f in busy_frames]
            stop_status_loop = loop_status_msg(frames, 0.15)

            # Run the search/list command
            output, return_code = yield Thread(target=run_nimble,
                                               args=process_args).start()

            # Set the status to show we've finished searching
            yield stop_status_loop(get_next_method(this))

            if return_code != 0:
                sublime.status_message("Nimble Package Load Failed")
            else:
                items = []
                packages = parse_package_descriptions(output)

                if len(packages) == 0:
                    sublime.status_message("No Matching Packages Found")
                else:
                    for package in packages:
                        items.append([
                            package['name'],
                            package.get('description', ''),
                            package.get('url', '')
                        ])

                    selection = yield window.show_quick_panel(items, this.send)

                    if selection != -1:
                        target_name = items[selection][0]
                        # Setup the loading notice
                        loading_notice = "Installing package"
                        frames = [loading_notice + f for f in busy_frames]
                        stop_status_loop = loop_status_msg(frames, 0.15)

                        # Run the install command
                        output, return_code = yield Thread(
                            target=run_nimble,
                            args=('-y install ' + escape_shell(target_name),
                                  this.send)).start()

                        yield stop_status_loop(get_next_method(this))

                        self.output_content(output, window)
                        if return_code == 0:
                            sublime.status_message("Installed Nimble Package")
                        else:
                            sublime.status_message(
                                'Nimble Package Installation Failed')
            yield
Пример #5
0
        def callback():
            this = yield

            # Setup the loading notice
            frames = ['Loading package list' + f for f in busy_frames]
            stop_status_loop = loop_status_msg(frames, 0.15)

            # Run the search/list command
            output, return_code = yield Thread(
                target=run_nimble,
                args=('-y list -i', this.send)
            ).start()

            # Set the status to show we've finished searching
            yield stop_status_loop(get_next_method(this))

            if return_code != 0:
                sublime.status_message(
                    "Nimble Installed Package Listing Failed")
            else:
                items = []
                packages = parse_package_descriptions(output)

                if len(packages) == 0:
                    sublime.status_message("No Installed Packages Found")
                else:
                    for package in packages:
                        items.append([
                            package['name'],
                            package.get('description', ''),
                            package.get('url', '')
                        ])

                    selection = yield window.show_quick_panel(items, this.send)

                    if selection != -1:
                        target_name = items[selection][0]
                        # Setup the loading notice
                        loading_notice = "Uninstalling package"
                        frames = [loading_notice + f for f in busy_frames]
                        stop_status_loop = loop_status_msg(frames, 0.15)

                        # Run the install command
                        output, return_code = yield Thread(
                            target=run_nimble,
                            args=(
                                '-y uninstall ' + escape_shell(target_name),
                                this.send
                            )
                        ).start()

                        yield stop_status_loop(get_next_method(this))

                        self.output_content(output, window)
                        if return_code == 0:
                            sublime.status_message(
                                "Uninstalled Nimble Package")
                        else:
                            sublime.status_message(
                                'Nimble Package Uninstallation Failed'
                            )
            yield
Пример #6
0
        def callback():
            this = yield

            if self.preemptive_search:
                # Get user input
                search_term = yield window.show_input_panel(
                    "Package to install?", '', this.send, None, None
                )

                loading_notice = 'Searching package list'
                process_args = (
                    '-y search ' + escape_shell(search_term),
                    this.send
                )
            else:
                loading_notice = 'Loading package list'
                process_args = ('-y list ', this.send)

            # Setup the loading notice
            frames = [loading_notice + f for f in busy_frames]
            stop_status_loop = loop_status_msg(frames, 0.15)

            # Run the search/list command
            output, return_code = yield Thread(
                target=run_nimble,
                args=process_args
            ).start()

            # Set the status to show we've finished searching
            yield stop_status_loop(get_next_method(this))

            if return_code != 0:
                sublime.status_message("Nimble Package Load Failed")
            else:
                items = []
                packages = parse_package_descriptions(output)

                if len(packages) == 0:
                    sublime.status_message("No Matching Packages Found")
                else:
                    for package in packages:
                        items.append([
                            package['name'],
                            package.get('description', ''),
                            package.get('url', '')
                        ])

                    selection = yield window.show_quick_panel(items, this.send)

                    if selection != -1:
                        target_name = items[selection][0]
                        # Setup the loading notice
                        loading_notice = "Installing package"
                        frames = [loading_notice + f for f in busy_frames]
                        stop_status_loop = loop_status_msg(frames, 0.15)

                        # Run the install command
                        output, return_code = yield Thread(
                            target=run_nimble,
                            args=(
                                '-y install ' + escape_shell(target_name),
                                this.send
                            )
                        ).start()

                        yield stop_status_loop(get_next_method(this))

                        self.output_content(output, window)
                        if return_code == 0:
                            sublime.status_message("Installed Nimble Package")
                        else:
                            sublime.status_message(
                                'Nimble Package Installation Failed'
                            )
            yield