Python sublime.MONOSPACE_FONT Examples

The following are 30 code examples of sublime.MONOSPACE_FONT(). 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: dired.py    From SublimeFileBrowser with MIT License 6 votes vote down vote up
def run(self, immediate=False, single_pane=False, project=False, other_group=False):
        path, goto = self._determine_path()
        if project:
            folders = self.window.folders()
            if len(folders) == 1:
                path = folders[0]
            elif folders:
                names = [basename(f) for f in folders]
                longest_name = max([len(n) for n in names])
                for i, f in enumerate(folders):
                    name     = names[i]
                    offset   = ' ' * (longest_name - len(name) + 1)
                    names[i] = u'%s%s%s' % (name, offset, self.display_path(f))
                self.window.show_quick_panel(names, lambda i: self._show_folder(i, path, goto, single_pane, other_group), sublime.MONOSPACE_FONT)
                return
        if immediate:
            show(self.window, path, goto=goto, single_pane=single_pane, other_group=other_group)
        else:
            prompt.start('Directory:', self.window, path, self._show) 
Example #2
Source File: sfdx.py    From SalesforceXyTools with Apache License 2.0 6 votes vote down vote up
def run(self, args=None):
        if self.index > 0:
            pre_data = self.command_params[self.index-1]
            ui_type = pre_data["type"]
            if ui_type == "input":
                pre_data["value"] = args
            elif ui_type == "select":
                if 0 <= args and args < len(pre_data["option-v"]):
                    pre_data["value"] = pre_data["option-v"][args]

        if self.index < len(self.command_params):
            curr_data = self.command_params[self.index]
            if curr_data["type"] == "input":
                caption = "Please Input your %s: " % curr_data["key"]
                self.window.show_input_panel(caption, curr_data["value"], self.run, None, None)
            elif curr_data["type"] == "select":
                show_opts = curr_data["option"]
                self.window.show_quick_panel(show_opts, self.run, sublime.MONOSPACE_FONT)
            self.index = self.index + 1
        else:
            self.callback(self.command_params) 
Example #3
Source File: sfdx.py    From SalesforceXyTools with Apache License 2.0 6 votes vote down vote up
def run(self):
        self.sf_basic_config = SfBasicConfig()
        self.settings = self.sf_basic_config.get_setting()
        self.sublconsole = SublConsole(self.sf_basic_config)
        self.window = sublime.active_window()
        self.osutil = util.OsUtil(self.sf_basic_config)

        s = sublime.load_settings(SFDX_SETTINGS)
        tasks = s.get("tasks")
        
        self.env = s.get("custom_env")
        self.env.update(DxEnv().get_env())
        self.env.update(CommandEnv(self.window, self.sf_basic_config.get_project_dir()).get_env())
        self.sel_keys = [task["label"] for task in tasks]
        self.sel_vals = [task for task in tasks]

        self.window.show_quick_panel(self.sel_keys, self.panel_done, sublime.MONOSPACE_FONT) 
Example #4
Source File: main_project.py    From SalesforceXyTools with Apache License 2.0 6 votes vote down vote up
def on_input(self, args):
        print(args)
        if self.input_index > 0:
            pre_conf = self.input_conf[self.input_index-1]
            ui_type = pre_conf["type"]
            if ui_type == "input":
                pre_conf["value"] = args
            elif ui_type == "select":
                if 0 <= args and args < len(pre_conf["option-v"]):
                    pre_conf["value"] = pre_conf["option-v"][args]

        if self.input_index < len(self.input_conf):
            current_conf = self.input_conf[self.input_index]
            if current_conf["type"] == "input":
                caption = "Please Input your %s: " % current_conf["key"]
                self.window.show_input_panel(caption, current_conf["value"], self.on_input, None, None)
            elif current_conf["type"] == "select":
                show_opts = current_conf["option"]
                self.window.show_quick_panel(show_opts, self.on_input, sublime.MONOSPACE_FONT)
            self.input_index = self.input_index + 1
        else:
            self._save_conf() 
Example #5
Source File: main_project.py    From SalesforceXyTools with Apache License 2.0 6 votes vote down vote up
def on_input(self, args):
        print(args)
        if self.input_index > 0:
            pre_conf = self.input_conf[self.input_index-1]
            ui_type = pre_conf["type"]
            if ui_type == "input":
                pre_conf["value"] = args
            elif ui_type == "select":
                if 0 <= args and args < len(pre_conf["option-v"]):
                    pre_conf["value"] = pre_conf["option-v"][args]

        if self.input_index < len(self.input_conf):
            current_conf = self.input_conf[self.input_index]
            if current_conf["type"] == "input":
                caption = "Please Input your %s: " % current_conf["key"]
                self.window.show_input_panel(caption, current_conf["value"], self.on_input, None, None)
            elif current_conf["type"] == "select":
                show_opts = current_conf["option"]
                self.window.show_quick_panel(show_opts, self.on_input, sublime.MONOSPACE_FONT)
            self.input_index = self.input_index + 1
        else:
            self._save_conf() 
Example #6
Source File: main.py    From SalesforceXyTools with Apache License 2.0 6 votes vote down vote up
def run(self):
        try:
            self.sf_basic_config = SfBasicConfig()
            self.settings = self.sf_basic_config.get_setting()
            self.sublconsole = SublConsole(self.sf_basic_config)

            self.dirs = self.sf_basic_config.get_browser_setting2()
            dirs = []
            for dir in self.dirs:
                dirs.append(dir[0])

            self.window.show_quick_panel(dirs, self.panel_done,sublime.MONOSPACE_FONT)

        except Exception as e:
            self.sublconsole.showlog(e)
            return 
Example #7
Source File: main.py    From SalesforceXyTools with Apache License 2.0 6 votes vote down vote up
def run(self):
        try:
            self.sf_basic_config = SfBasicConfig()
            self.settings = self.sf_basic_config.get_setting()
            self.sublconsole = SublConsole(self.sf_basic_config)
            settings = self.settings
            auth_type = settings["authentication"]
            self.dirs = [setting.AUTHENTICATION_OAUTH2, setting.AUTHENTICATION_PASSWORD]
            show_dirs = []
            for dirstr in self.dirs:
                if auth_type == dirstr:
                    show_dirs.append('[○]' + dirstr)
                else:
                    show_dirs.append('[X]' + dirstr)

            self.window.show_quick_panel(show_dirs, self.panel_done,sublime.MONOSPACE_FONT)

        except Exception as e:
            self.sublconsole.showlog(e)
            return 
Example #8
Source File: lightningsave.py    From sublime-lightning with MIT License 6 votes vote down vote up
def show_package_list(self):
        """Sample doc string."""
        self.messages = []
        p = popen_force_cli(["describe", "-t", "metadata", "-j"])
        result, err = p.communicate()
        if err:
            sublime.error_message(err.decode("utf-8"))
        else:
            try:
                m = json.loads(result.decode("utf-8"))
                for mm in m:
                    x = [mm['XmlName'], "In folder: " + mm['DirectoryName'],
                         "Suffix: " + mm['Suffix']]
                    self.messages.append(x)

                self.window = sublime.active_window()
                self.window.show_quick_panel(self.messages,
                                             self.open_selected_metadata,
                                             sublime.MONOSPACE_FONT)

            except:
                return 
Example #9
Source File: lightningsave.py    From sublime-lightning with MIT License 6 votes vote down vote up
def show_list(self, data):
            m = json.loads(data)
            if len(m) == 0:
                sublime.message_dialog(
                    "There aren't any lightning components "
                    " in this org.")
                return

            print("data: " + str(m))
            self.messages.append(["All Bundles", "*", "Every Bundle",
                                  "All the lightning bundles "
                                  "in your org!"])
            print("And now here")
            for mm in m:
                x = [mm['MasterLabel'], mm['Id'], mm["DeveloperName"],
                     mm["Description"]]
                self.messages.append(x)

            self.window = sublime.active_window()
            self.window.show_quick_panel(self.messages,
                                         self.open_selected_bundle,
                                         sublime.MONOSPACE_FONT) 
Example #10
Source File: ignore.py    From GitSavvy with MIT License 6 votes vote down vote up
def run_async(self):
        all_file_lines = (
            line.split(" ", 1)
            for line in self.git("ls-files", "-v").split("\n")
        )

        self._ignored_files = tuple(f[1] for f in all_file_lines if f[0] == "h")

        if not self._ignored_files:
            self.window.show_quick_panel(["No files are assumed unchanged."], None)
        else:
            self.window.show_quick_panel(
                self._ignored_files,
                self.on_selection,
                flags=sublime.MONOSPACE_FONT
            ) 
Example #11
Source File: log.py    From GitSavvy with MIT License 6 votes vote down vote up
def run_async(self, **kwargs):
        email = self.git("config", "user.email").strip()
        self._entries = []

        commiter_str = self.git("shortlog", "-sne", "HEAD")
        for line in commiter_str.split('\n'):
            m = re.search(r'\s*(\d*)\s*(.*)\s<(.*)>', line)
            if m is None:
                continue
            commit_count, author_name, author_email = m.groups()
            author_text = "{} <{}>".format(author_name, author_email)
            self._entries.append((commit_count, author_name, author_email, author_text))

        try:
            selected_index = (list(line[2] for line in self._entries)).index(email)
        except ValueError:
            selected_index = 0

        self.window.show_quick_panel(
            [entry[3] for entry in self._entries],
            lambda index: self.on_author_selection(index, **kwargs),
            flags=sublime.MONOSPACE_FONT,
            selected_index=selected_index
        ) 
Example #12
Source File: flow.py    From GitSavvy with MIT License 6 votes vote down vote up
def _generic_select(self, help_text, options, callback,
                        no_opts="There are no branches available"):
        """
        Display quick_panel with help_text as first option and options as
        the rest and passes given callback to `show_quick_panel`.

        In case options is empty or None displays only `no_opts` text.
        """
        if not options:
            self.window.show_quick_panel([no_opts], None)
        else:
            self.window.show_quick_panel(
                [help_text] + options,
                callback,
                flags=sublime.MONOSPACE_FONT
            ) 
Example #13
Source File: branch.py    From GitSavvy with MIT License 6 votes vote down vote up
def offer_force_deletion(self, branch_name):
        # type: (str) -> None

        actions = [
            "Abort, '{}' is not fully merged.".format(branch_name),
            "Delete anyway."
        ]

        def on_action_selection(index):
            if index < 1:
                return

            self.window.run_command("gs_delete_branch", {
                "branch": branch_name,
                "force": True
            })

        self.window.show_quick_panel(
            actions,
            on_action_selection,
            flags=sublime.MONOSPACE_FONT,
        ) 
Example #14
Source File: main_metadata.py    From SalesforceXyTools with Apache License 2.0 6 votes vote down vote up
def open_category_panel(self, thread, sel_category, timeout=200):
        if thread.is_alive():
            self.sublconsole.showlog("loading metadata , please wait...")
            timeout=200
            sublime.set_timeout(lambda: self.open_category_panel(thread, sel_category, timeout), timeout)
            return
        self.sublconsole.showlog("load metadata ok!")

        try:
            self.sel_category_list = self.metadata_cache.get_meta_category()
            if sel_category and sel_category in self.sel_category_list:
                self.open_detail_panel(sel_category)
            else:
                self.window.show_quick_panel(self.sel_category_list, self.panel_done, sublime.MONOSPACE_FONT)
        except Exception as e:
            self.sublconsole.showlog(e)
            return 
Example #15
Source File: main_metadata.py    From SalesforceXyTools with Apache License 2.0 6 votes vote down vote up
def run(self, type=None, object_name=None):
        try:
            self.sf_basic_config = SfBasicConfig()
            self.settings = self.sf_basic_config.get_setting()
            self.sublconsole = SublConsole(self.sf_basic_config)
            self.type = type
            self.attr = self.get_attr(self.type)
            self.save_dir = self.sf_basic_config.get_src_dir(sub_folder=self.attr["folder"])
            self.template = Template()
            self.template_config_dict = self.template.load_config_dict(self.type)
            self.template_config_list = list(self.template_config_dict.keys())
            self.object_name = object_name
            self.window.show_quick_panel(self.template_config_list, self.panel_done,sublime.MONOSPACE_FONT)
        except Exception as e:
            self.sublconsole.showlog(e)
            return 
Example #16
Source File: main_toolbox.py    From SalesforceXyTools with Apache License 2.0 6 votes vote down vote up
def run(self, edit, deploy_file_list=None):
        self.window = sublime.active_window()
        if deploy_file_list:
            self.open_files = deploy_file_list
            self.current_file = None
            self.sel_type_list = ["Deploy Directory", "Deploy Directory To Server(check only)"]
            self.sel_type_key_list = ["DeployOpenFiles", "CheckDeployOpenFiles"]
        else:
            self.open_files = []
            for _view in self.window.views():
                file_name = _view.file_name()
                if file_name:
                    self.open_files.append(file_name)
            self.current_file = self.view.file_name()
            self.sel_type_list = ["Config Ant Metadata Tool", "Backup All Metadata", "Deploy Open Files To Server", "Deploy Open Files To Server(check only)"]
            self.sel_type_key_list = ["Build", "Backup", "DeployOpenFiles", "CheckDeployOpenFiles"]

        if self.current_file:
            file_path, file_name = os.path.split(self.current_file)
            self.sel_type_list.append("Deploy Current File To Server : %s" % file_name)
            self.sel_type_list.append("Deploy Current File To Server : %s (check only)" % file_name)
            self.sel_type_key_list.append("DeployOne")
            self.sel_type_key_list.append("CheckDeployOne")
        self.window.show_quick_panel(self.sel_type_list, self.panel_done, sublime.MONOSPACE_FONT) 
Example #17
Source File: jumping.py    From SublimeFileBrowser with MIT License 6 votes vote down vote up
def run(self, edit, new_window=False):
        jp = jump_points()
        if not jp:
            status_message("No jump points available. To create jump point for this directory use 'P'.")
            return
        # show_quick_panel didn't work with dict_items
        self.new_window = new_window
        self.jump_points = [[n, t] for n, t in jp]
        self.display_jump_points = []
        longest_name = max([len(n) for n in jump_names().values()])
        for n, t in jp:
            n = n if ST3 else n.decode('utf8')
            offset = ' ' * (longest_name - len(n) + 1)
            path = self.display_path(t)
            name = u'%s%s%s' % (n, offset, path.rstrip(os.sep))
            self.display_jump_points.append(name)
        self.view.window().show_quick_panel(self.display_jump_points, self.on_pick_point, sublime.MONOSPACE_FONT) 
Example #18
Source File: log_graph.py    From GitSavvy with MIT License 5 votes vote down vote up
def run(self):
        view = self.window.active_view()
        if not view:
            return

        remotes = set(self.get_remotes().keys())
        infos = list(filter_(
            describe_graph_line(line, remotes)
            for line in unique(
                view.substr(line)
                for s in view.sel()
                for line in view.lines(s)
            )
        ))
        if not infos:
            return

        actions = (
            self.actions_for_single_line(view, infos[0], remotes)
            if len(infos) == 1
            else self.actions_for_multiple_lines(view, infos, remotes)
        )
        if not actions:
            return

        def on_action_selection(index):
            if index == -1:
                return

            self.selected_index = index
            description, action = actions[index]
            action()

        self.window.show_quick_panel(
            [a[0] for a in actions],
            on_action_selection,
            flags=sublime.MONOSPACE_FONT,
            selected_index=self.selected_index,
        ) 
Example #19
Source File: reset.py    From GitSavvy with MIT License 5 votes vote down vote up
def do_action(self, commit_hash, **kwargs):
        if not commit_hash:
            return
        self._selected_hash = commit_hash

        use_reset_mode = self.savvy_settings.get("use_reset_mode")
        if use_reset_mode:
            self.on_reset(use_reset_mode)
        else:
            self.window.show_quick_panel(
                GIT_RESET_MODES,
                self.on_reset_mode_selection,
                flags=sublime.MONOSPACE_FONT
            ) 
Example #20
Source File: ignore.py    From GitSavvy with MIT License 5 votes vote down vote up
def run_async(self):
        self._unstaged_files = tuple(
            f.path for f in self.get_status()
            if f.working_status in UNSTAGED_WORKING_STATUSES
        )

        self.window.show_quick_panel(
            self._unstaged_files,
            self.on_selection,
            flags=sublime.MONOSPACE_FONT
        ) 
Example #21
Source File: tags.py    From GitSavvy with MIT License 5 votes vote down vote up
def run_async(self, push_all):
        self.remotes = tuple(self.get_remotes().keys())
        if not self.remotes:
            self.view.window().show_quick_panel([NO_REMOTES_MESSAGE], None)
            return

        self.view.window().show_quick_panel(
            self.remotes,
            lambda idx: self.push_async(idx, push_all=push_all),
            flags=sublime.MONOSPACE_FONT
        ) 
Example #22
Source File: quick_panel.py    From GitSavvy with MIT License 5 votes vote down vote up
def show_panel(self, actions=None, pre_selected_index=None):
        window = self.window if hasattr(self, 'window') else self.view.window()
        if pre_selected_index:
            self.on_action_selection(pre_selected_index)
            return

        window.show_quick_panel(
            [a[1] for a in actions or self.actions],
            self.on_action_selection,
            flags=sublime.MONOSPACE_FONT,
            selected_index=self.selected_index,
        ) 
Example #23
Source File: quick_panel.py    From GitSavvy with MIT License 5 votes vote down vote up
def select_branch(self, remote=None):

        if self.local_branches_only:
            self.all_branches = [b.name_with_remote for b in self.get_branches() if not b.remote]
        elif self.remote_branches_only:
            self.all_branches = [b.name_with_remote for b in self.get_branches() if b.remote]
        else:
            self.all_branches = [b.name_with_remote for b in self.get_branches()]

        if self.ignore_current_branch:
            current_branch = self.get_current_branch_name()
            self.all_branches = [b for b in self.all_branches if b != current_branch]
        elif self.selected_branch is None:
            self.selected_branch = self.get_current_branch_name()

        if remote:
            self.all_branches = [b for b in self.all_branches if b.startswith(remote + "/")]

        if not self.all_branches:
            self.window.show_quick_panel(["There are no branches available."], None)
            return

        if self.selected_branch:
            selected_index = self.get_pre_selected_branch_index(self.selected_branch, remote)
        else:
            selected_index = 0

        self.window.show_quick_panel(
            self.all_branches,
            self.on_branch_selection,
            flags=sublime.MONOSPACE_FONT,
            selected_index=selected_index
        ) 
Example #24
Source File: EasyClangComplete.py    From EasyClangComplete with MIT License 5 votes vote down vote up
def run(self, edit):
        """Show all errors available in this view.

        This function shows all errors that are available from within a view.
        Note that the errors can be from different files.
        """
        if not SublBridge.is_valid_view(self.view):
            return
        config_manager = EasyClangComplete.view_config_manager
        if not config_manager:
            log.error("No ViewConfigManager available.")
            return
        config = config_manager.get_from_cache(self.view)
        log.debug("config: %s", config)
        if not config:
            log.error("No ViewConfig for view: %s.", self.view.buffer_id())
            return
        if not config.completer:
            log.error("No Completer for view: %s.", self.view.buffer_id())
        handler = QuickPanelHandler(self.view, config.completer.latest_errors)
        start_idx = 0
        self.view.window().show_quick_panel(
            handler.items_to_show(),
            handler.on_done,
            sublime.MONOSPACE_FONT,
            start_idx,
            handler.on_highlighted) 
Example #25
Source File: di.py    From sublimetext-cfml with MIT License 5 votes vote down vote up
def run(self, edit, property_name=None):

        pt = self.view.sel()[0].begin()

        if not self.view.match_selector(pt, "source.cfml meta.class"):
            return

        if property_name:
            self.insert_property(edit, property_name)
            return

        cfml_view = CfmlView(self.view, pt)

        if not cfml_view.project_name:
            return

        cfc_info, metadata, function_name, regions = documentation.find_cfc(cfml_view)

        if cfc_info:
            self.insert_property(edit, cfc_info["name"])
        else:
            cfc_list = cfcs.get_cfc_list(cfml_view.project_name)

            def callback(i):
                if i > -1:
                    self.view.run_command(
                        "cfml_di_property", {"property_name": cfc_list[i]}
                    )

            self.view.window().show_quick_panel(
                cfc_list, callback, flags=sublime.MONOSPACE_FONT
            ) 
Example #26
Source File: lightningsave.py    From sublime-lightning with MIT License 5 votes vote down vote up
def show_metadata_type_list(self, activedir):
        """Sample doc string."""
        working_dir = self.get_md_dir(activedir)
        if working_dir == "not found":
            self.open_selected_bundle(-1)
            return

        self.activedir = activedir
        self.messages = []
        p = popen_force_cli(["describe", "-t", "metadata", "-j"])
        result, err = p.communicate()
        if err:
            sublime.error_message(err.decode("utf-8"))
        else:
            try:
                m = json.loads(result.decode("utf-8"))
                for mm in m:
                    x = [mm['XmlName'], "In folder: " + mm['DirectoryName'],
                         "Suffix: " + mm['Suffix']]
                    self.messages.append(x)

                self.window = sublime.active_window()
                self.window.show_quick_panel(self.messages,
                                             self.open_selected_metadata,
                                             sublime.MONOSPACE_FONT)

            except:
                print("There was some kind of error...")
                return 
Example #27
Source File: lightningsave.py    From sublime-lightning with MIT License 5 votes vote down vote up
def show_metadata_instance_list(self, metaname, activedir):
        """Sample doc string."""
        self.type = metaname
        self.activedir = activedir
        self.messages = []
        p = popen_force_cli(["describe", "-t", "metadata", "-n",
                            quote(metaname), "-j"])
        result, err = p.communicate()
        if err:
            sublime.error_message(err.decode("utf-8"))
        else:
            try:
                m = json.loads(result.decode("utf-8"))
                if str(m) == "None":
                    sublime.message_dialog(
                        "There are no instances of " + metaname +
                        " in this org.")
                    return

                for mm in m:
                    x = [mm['FullName'], "Modified by: " +
                         mm['LastModifiedByName'],
                         "File name: " + mm['FileName'],
                         "Id: " + mm['Id']]
                    self.messages.append(x)
                    print(x)

                self.window = sublime.active_window()
                sublime.set_timeout(
                    lambda:
                    self.window.show_quick_panel(
                        self.messages,
                        self.fetch_selected_metadata,
                        sublime.MONOSPACE_FONT), 10)
            except:
                return 
Example #28
Source File: main.py    From SalesforceXyTools with Apache License 2.0 5 votes vote down vote up
def run(self):
        try:
            self.sf_basic_config = SfBasicConfig()
            self.settings = self.sf_basic_config.get_setting()
            self.sublconsole = SublConsole(self.sf_basic_config)
            self.dirs = self.sf_basic_config.get_browser_setting()
            dirs = []
            for dir in self.dirs:
                dirs.append(dir[0])

            self.window.show_quick_panel(dirs, self.panel_done,sublime.MONOSPACE_FONT)

        except Exception as e:
            self.sublconsole.showlog(e)
            return 
Example #29
Source File: dired_file_operations.py    From SublimeFileBrowser with MIT License 5 votes vote down vote up
def show_quick_panel(self):
        '''dialog asks if user would like to duplicate, overwrite, or skip item'''
        t, f    = self.errors.popitem()
        options = self.actions + [[u'from %s' % f, 'Skip'], [u'to   %s' % t, 'Skip']]
        done    = lambda i: self.user_input(i, f, t)
        sublime.set_timeout(lambda: self.window.show_quick_panel(options, done, sublime.MONOSPACE_FONT), 10)
        return 
Example #30
Source File: main_toolbox.py    From SalesforceXyTools with Apache License 2.0 5 votes vote down vote up
def _show_panel(self):
        self.sobject_name_list, self.sobject_show_list = self._get_sobject_panel_data()
        self.window.show_quick_panel(self.sobject_show_list, self.panel_done,sublime.MONOSPACE_FONT)