Python sublime.status_message() Examples

The following are 30 code examples of sublime.status_message(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module sublime , or try the search function .
Example #1
Source File: base_command.py    From sublime-gulp with MIT License 6 votes vote down vote up
def show_output_panel(self, text):
        if self.silent:
            self.status_message(text)
            return

        if self.results_in_new_tab:
            new_tab_path = os.path.join(self.gulp_results_path(), "Gulp Results")
            self.output_view = self.window.open_file(new_tab_path)
            self.output_view.set_scratch(True)
        else:
            self.output_view = self.window.get_output_panel("gulp_output")
            self.show_panel()

        self.output_view.settings().set("scroll_past_end", False)
        self.add_syntax()
        self.append_to_output_view(text) 
Example #2
Source File: dired_file_operations.py    From SublimeFileBrowser with MIT License 6 votes vote down vote up
def run(self, edit, cut=False):
        self.index = self.get_all()
        filenames = self.get_marked(full=True) or self.get_selected(parent=False, full=True)
        if not filenames:
            return sublime.status_message('Nothing chosen')
        settings  = sublime.load_settings('dired.sublime-settings')
        copy_list = settings.get('dired_to_copy', [])
        cut_list  = settings.get('dired_to_move', [])
        # copied item shall not be added into cut list, and vice versa
        for f in filenames:
            if cut:
                if not f in copy_list:
                    cut_list.append(f)
            else:
                if not f in cut_list:
                    copy_list.append(f)
        settings.set('dired_to_move', list(set(cut_list)))
        settings.set('dired_to_copy', list(set(copy_list)))
        sublime.save_settings('dired.sublime-settings')
        self.show_hidden = self.view.settings().get('dired_show_hidden_files', True)
        self.set_status() 
Example #3
Source File: dired_file_operations.py    From SublimeFileBrowser with MIT License 6 votes vote down vote up
def run(self, edit):
        s = self.view.settings()
        sources_move = s.get('dired_to_move', [])
        sources_copy = s.get('dired_to_copy', [])
        if not (sources_move or sources_copy):
            return sublime.status_message('Nothing to paste')

        self.index  = self.get_all()
        path        = self.get_path()
        rel_path    = relative_path(self.get_selected(parent=False) or '')
        destination = join(path, rel_path) or path
        emit_event(u'ignore_view', self.view.id(), plugin=u'FileBrowserWFS')
        if NT:
            return call_SHFileOperationW(self.view, sources_move, sources_copy, destination)
        else:
            return call_SystemAgnosticFileOperation(self.view, sources_move, sources_copy, destination) 
Example #4
Source File: dired_file_operations.py    From SublimeFileBrowser with MIT License 6 votes vote down vote up
def run(self, edit, trash=False):
        self.index = self.get_all()
        files = self.get_marked() or self.get_selected(parent=False)
        if not files:
            return sublime.status_message('Nothing chosen')

        msg, trash = self.setup_msg(files, trash)

        emit_event(u'ignore_view', self.view.id(), plugin=u'FileBrowserWFS')
        if trash:
            need_confirm = self.view.settings().get('dired_confirm_send2trash', True)
            msg = msg.replace('Delete', 'Delete to trash', 1)
            if not need_confirm or (need_confirm and sublime.ok_cancel_dialog(msg)):
                self._to_trash(files)
        elif not trash and sublime.ok_cancel_dialog(msg):
            self._delete(files)
        else:
            print("Cancel delete or something wrong in DiredDeleteCommand")
        emit_event(u'watch_view', self.view.id(), plugin=u'FileBrowserWFS') 
Example #5
Source File: prompt.py    From SublimeFileBrowser with MIT License 6 votes vote down vote up
def run(self, edit):
        self.edit = edit
        self.prompt_region = Region(0, self.view.size())
        content, path, prefix = self.get_content()
        if not valid(path or content):
            return

        completions, error = self.get_completions(path, prefix)
        if error:
            return  # content of path is unavailable (access, permission, etc.)
        if not completions:
            return sublime.status_message('No matches')

        new_content = self.get_new_content(path, prefix, completions)

        if new_content:
            self.fill_prompt(new_content)
        else:
            self.completions = completions
            self._path = path
            self.w = self.view.window() or sublime.active_window()
            return self.w.show_quick_panel(completions, self.on_done) 
Example #6
Source File: controller.py    From FuzzyFilePath with Do What The F*ck You Want To Public License 6 votes vote down vote up
def get_filepath_completions(view):
    if not state.is_valid():
        Query.reset()
        return False

    verbose(ID, "get filepath completions")
    completions = Completion.get_filepaths(view, Query)

    if completions and len(completions[0]) > 0:
        Completion.start(Query.get_replacements())
        view.run_command('_enter_insert_mode') # vintageous
        log("{0} completions found".format(len(completions)))
    else:
        if Query.get_needle() is not None:
            sublime.status_message("FFP no filepaths found for '" + Query.get_needle() + "'")
        Completion.stop()

    Query.reset()
    return completions 
Example #7
Source File: dired_misc.py    From SublimeFileBrowser with MIT License 6 votes vote down vote up
def run(self, edit, fname=None):
        path = self.path
        if not fname:
            self.index = self.get_all()
            files = self.get_selected(parent=False)
            fname = join(path, files[0] if files else '')
        else:
            files = True
        p, f  = os.path.split(fname.rstrip(os.sep))

        if not exists(fname):
            return sublime.status_message(u'Directory doesn’t exist “%s”' % path)

        if NT and path == 'ThisPC\\':
            if not ST3:
                fname = fname.encode(locale.getpreferredencoding(False))
            return subprocess.Popen('explorer /select,"%s"' % fname)

        if files:
            self.view.window().run_command("open_dir", {"dir": p, "file": f})
        else:
            self.view.window().run_command("open_dir", {"dir": path}) 
Example #8
Source File: Hugofy.py    From Hugofy-sublime with MIT License 6 votes vote down vote up
def run(self,edit):
		setvars()
		server=settings.get("Server")
		startCmd = ["hugo", "server"]
		if server["THEME_FLAG"]:
			startCmd = startCmd + ["--theme={}".format(server["THEME"])]
		if server["DRAFTS_FLAG"]:
			startCmd = startCmd + ["--buildDrafts"]

		startCmd = startCmd + ["--watch", "--port={}".format(server["PORT"])] 

		try:
			out=subprocess.Popen(startCmd,stderr=subprocess.STDOUT,universal_newlines=True)
			sublime.status_message('Server Started: {}'.format(startCmd))
		except:
			sublime.error_message("Error starting server") 
Example #9
Source File: dired.py    From SublimeFileBrowser with MIT License 6 votes vote down vote up
def run(self, edit, toggle=False):
        '''
        toggle  if True, state of directory(s) will be toggled (i.e. expand/collapse)
        '''
        self.index = self.get_all()
        filenames = self.get_marked(full=True) or self.get_selected(parent=False, full=True)

        if len(filenames) == 1 and filenames[0][~0] == os.sep:
            return self.expand_single_directory(edit, filenames[0], toggle)
        elif filenames:
            # working with several selections at once is very tricky, thus for reliability we should
            # recreate the entire tree, despite it is supposedly slower, but not really, because
            # one view.replace/insert() call is faster than multiple ones
            self.view.run_command('dired_refresh', {'to_expand': filenames, 'toggle': toggle})
            return
        else:
            return sublime.status_message('Item cannot be expanded') 
Example #10
Source File: dired.py    From SublimeFileBrowser with MIT License 6 votes vote down vote up
def run(self, edit):
        self.index = self.get_all()
        filenames = self.get_selected(full=True)

        if not filenames:
            return sublime.status_message(u'Nothing to preview')

        fqn = filenames[0]

        if isdir(fqn) or fqn == PARENT_SYM:
            if not ST3:
                return sublime.status_message(u'No preview for directories')
            self.view.run_command('dired_preview_directory', {'fqn': fqn})
            return

        if exists(fqn):
            if ST3:
                self.view.run_command('dired_file_properties', {'fqn': fqn})
            window = self.view.window()
            dired_view = self.view
            self.focus_other_group(window)
            window.open_file(fqn, sublime.TRANSIENT)
            window.focus_view(dired_view)
        else:
            sublime.status_message(u'File does not exist (%s)' % (basename(fqn.rstrip(os.sep)) or fqn)) 
Example #11
Source File: plugin.py    From sublime-phpunit with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def run_nearest(self, options):
        file = self.view.file_name()
        if not file:
            return status_message('PHPUnit: not a test file')

        if has_test_case(self.view):
            if 'filter' not in options:
                selected_test_methods = find_selected_test_methods(self.view)
                if selected_test_methods:
                    options['filter'] = build_filter_option_pattern(selected_test_methods)

            self.run(file=file, options=options)
        else:
            find_switchable(
                self.view,
                on_select=lambda switchable: self.run(
                    file=switchable.file,
                    options=options
                )
            ) 
Example #12
Source File: ksp_plugin.py    From SublimeKSP with GNU General Public License v3.0 6 votes vote down vote up
def run(self, *args, **kwargs):
        # wait until any previous thread is finished
        if self.thread and self.thread.is_alive():
            sublime.status_message('Waiting for earlier compilation to finish...')
            self.thread.stop()
            self.thread.join()

        # find the view containing the code to compile
        view = None
        if kwargs.get('recompile', None) and self.last_filename:
            view = CompileKspThread.find_view_by_filename(self.last_filename)
        if view is None:
            view = sublime.active_window().active_view()

        self.thread = CompileKspThread(view)
        self.thread.start()
        self.last_filename = view.file_name() 
Example #13
Source File: thread_progress.py    From SyncSettings with MIT License 6 votes vote down vote up
def run(self, i):
        if not self.thread.is_alive():
            msg = '' if not self.success_message else 'Sync Settings: {}'.format(self.success_message)
            sublime.status_message(msg)
            return
        before = i % self.size
        after = (self.size - 1) - before

        sublime.status_message('Sync Settings: {} [{}={}]'.format(self.message, ' ' * before, ' ' * after))

        if not after:
            self.addend = -1
        if not before:
            self.addend = 1

        i += self.addend
        sublime.set_timeout(lambda: self.run(i), 100) 
Example #14
Source File: hackertyper.py    From sublime-hacker-typer with MIT License 6 votes vote down vote up
def on_activated(self, view):
        # Don't check for solution files if the plugin is disabled
        if hacker_enabled is False:
            return

        # Check if the current file has a solution
        filename = view.file_name()
        if filename is None:
            return

        solution = filename + ".hackertyper"
        self.solution_exists = os.path.isfile(solution)

        # Give a feedback message if no solution was found
        # Clear the status bar if one was found
        if not self.solution_exists:
            err = "HackerTyper Error: " + os.path.basename(filename)
            err += ".hackertyper not found"
            return sublime.status_message(err)
        else:
            sublime.status_message("")

        # Read the entire solution text
        self.hacker_buffer = open(solution, encoding='utf-8').read() 
Example #15
Source File: plugin.py    From sublime-phpunit with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def run_file(self, options=None):
        if options is None:
            options = {}

        file = self.view.file_name()
        if not file:
            return status_message('PHPUnit: not a test file')

        if has_test_case(self.view):
            self.run(file=file, options=options)
        else:
            find_switchable(
                self.view,
                on_select=lambda switchable: self.run(
                    file=switchable.file,
                    options=options
                )
            ) 
Example #16
Source File: dired.py    From dired with MIT License 6 votes vote down vote up
def run(self, edit):
        settings = sublime.load_settings('dired.sublime-settings')

        for key_name in ['reuse_view', 'bookmarks']:
            settings.set(key_name, settings.get(key_name))

        bm = bookmarks()

        def on_done(select) :
            if not select == -1 :
                bm.pop(select)
                sublime.status_message('Remove selected bookmark.')
                settings.set('bookmarks', bm)
                sublime.save_settings('dired.sublime-settings')

        self.view.window().show_quick_panel(bm, on_done) 
Example #17
Source File: dired.py    From dired with MIT License 6 votes vote down vote up
def run(self, edit, dirs):
        settings = sublime.load_settings('dired.sublime-settings')

        for key_name in ['reuse_view', 'bookmarks']:
            settings.set(key_name, settings.get(key_name))

        bm = bookmarks()
        for path in dirs :
            bm.append(path)
            settings.set('bookmarks', bm)

            # This command makes/writes a sublime-settings file at Packages/User/,
            # and doesn't write into one at Packages/dired/.
            sublime.save_settings('dired.sublime-settings')

            sublime.status_message('Bookmarking succeeded.')
            self.view.erase_regions('marked') 
Example #18
Source File: commands.py    From sublime-text-virtualenv with MIT License 6 votes vote down vote up
def set_virtualenv(self, venv):
        """Update the current virtualenv in project data.

        If the passed venv in None, remove virtualenv data from project.
        """
        project_data = self.window.project_data() or {}

        if venv:
            project_data['virtualenv'] = venv
            sublime.status_message("({}) ACTIVATED".format(os.path.basename(venv)))
        else:
            try:
                del project_data['virtualenv']
                sublime.status_message("DEACTIVATED")
            except KeyError:
                pass

        self.window.set_project_data(project_data)
        logger.info("Current virtualenv set to \"{}\".".format(venv)) 
Example #19
Source File: GitConflictResolver.py    From sublime-GitConflictResolver with MIT License 6 votes vote down vote up
def run(self):
        # Reload settings
        settings.load()

        # Ensure git executable is available
        if not self.git_executable_available():
            sublime.error_message(msgs.get('git_executable_not_found'))
            return

        self.git_repo = self.determine_git_repo()
        if not self.git_repo:
            sublime.status_message(msgs.get('no_git_repo_found'))
            return

        conflict_files = self.get_conflict_files()
        if not conflict_files:
            sublime.status_message(msgs.get('no_conflict_files_found', self.git_repo))
            return

        self.show_quickpanel_selection(conflict_files) 
Example #20
Source File: progress_notifier.py    From sublime-gulp with MIT License 6 votes vote down vote up
def run(self, i):
        if self.stopped:
            return

        before = i % self.size
        after = (self.size - 1) - before

        sublime.status_message('%s [%s=%s]' % (self.message, ' ' * before, ' ' * after))

        if not after:
            self.addend = -1
        if not before:
            self.addend = 1
        i += self.addend

        sublime.set_timeout(lambda: self.run(i), 100) 
Example #21
Source File: ksp_plugin.py    From SublimeKSP with GNU General Public License v3.0 6 votes vote down vote up
def run(self, setting, default):
        sksp_options_dict = {
            "ksp_compact_output" : "Remove Indents and Empty Lines",
            "ksp_compact_variables" : "Compact Variables",
            "ksp_extra_checks" : "Extra Syntax Checks",
            "ksp_optimize_code" : "Optimize Compiled Code",
            "ksp_signal_empty_ifcase" : "Raise Error on Empty 'if' or 'case' Statements",
            "ksp_add_compiled_date" : "Add Compilation Date/Time Comment",
            "ksp_comment_inline_functions" : "Insert Comments When Expanding Functions",
            "ksp_play_sound" : "Play Sound When Compilation Finishes"
        }

        s = sublime.load_settings("KSP.sublime-settings")
        s.set(setting, not s.get(setting, False))
        sublime.save_settings("KSP.sublime-settings")

        if s.get(setting, False):
            option_toggle = "enabled!"
        else:
            option_toggle = "disabled!"

        sublime.status_message('SublimeKSP option %s is %s' % (sksp_options_dict[setting], option_toggle)) 
Example #22
Source File: Glue.py    From glue with MIT License 6 votes vote down vote up
def progress_indicator(self, thread, i=0, direction=1):
        if thread.is_alive():
            before = i % 8
            after = (7) - before
            if not after:
                direction = -1
            if not before:
                direction = 1
            i += direction
            self.view.set_status('glue_status_indicator', 'Glue: Running command [%s|%s]' % (' ' * before, ' ' * after))
            sublime.set_timeout(lambda: self.progress_indicator(thread, i, direction), 75)
            return
        else:
            self.view.erase_status('glue_status_indicator')
            sublime.status_message('Glue: Command completed.')

    #------------------------------------------------------------------------------
    # [ execute_command method ] - execute a system command
    #   run in a separate thread from muterun() method above
    #   assigns stdout stderr and exitcode in instance attributes
    #------------------------------------------------------------------------------ 
Example #23
Source File: Completion.py    From YcmdCompletion with MIT License 5 votes vote down vote up
def print_status(msg):
    print(msg)
    sublime.status_message(msg) 
Example #24
Source File: mixin.py    From UnitTesting with MIT License 5 votes vote down vote up
def reload_package(self, package, dummy=False, show_reload_progress=False):
        if show_reload_progress:
            progress_bar = ProgressBar("Reloading %s" % package)
            progress_bar.start()

            try:
                reload_package(package, dummy=dummy, verbose=True)
            finally:
                progress_bar.stop()

            sublime.status_message("{} reloaded.".format(package))
        else:
            reload_package(package, dummy=dummy, verbose=False) 
Example #25
Source File: progress_notifier.py    From sublime-gulp with MIT License 5 votes vote down vote up
def stop(self):
        sublime.status_message(self.success_message)
        self.stopped = True 
Example #26
Source File: TestRunner.py    From FuzzyFilePath with Do What The F*ck You Want To Public License 5 votes vote down vote up
def tearDown(self, failed_tests, total_tests):
		# self.tools.view.close()
		print(LINE)
		if failed_tests > 0:
			notice = "{0} of {1} tests failed".format(failed_tests, total_tests)
			print(notice)
			sublime.status_message("FFP Intergration: " + notice)
		else:
			notice = "{0} tests successful".format(total_tests)
			print(notice)
			sublime.status_message("FFP Intergration: " + notice) 
Example #27
Source File: TodoReview.py    From SublimeTodoReview with MIT License 5 votes vote down vote up
def increment(self):
		with self.lock:
			self.i += 1
			sublime.status_message("TodoReview: {0} files scanned".format(self.i)) 
Example #28
Source File: plugin.py    From sublime-phpunit with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def message(msg, *args):
    if args:
        msg = msg % args

    msg = 'PHPUnit: ' + msg

    print(msg)
    status_message(msg) 
Example #29
Source File: plugin.py    From sublime-phpunit with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def open_coverage_report(self):
        working_dir = find_phpunit_working_directory(self.view.file_name(), self.window.folders())
        if not working_dir:
            return status_message('PHPUnit: could not find a PHPUnit working directory')

        coverage_html_index_html_file = os.path.join(working_dir, 'build/coverage/index.html')
        if not os.path.exists(coverage_html_index_html_file):
            return status_message('PHPUnit: could not find PHPUnit HTML code coverage %s' % coverage_html_index_html_file)  # noqa: E501

        import webbrowser
        webbrowser.open_new_tab('file://' + coverage_html_index_html_file) 
Example #30
Source File: plugin.py    From sublime-phpunit with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def run_last(self):
        last_test_args = get_window_setting('phpunit._test_last', window=self.window)
        if not last_test_args:
            return status_message('PHPUnit: no tests were run so far')

        self.run(**last_test_args)