How to use the ko/prefs.getString function in ko

To help you get started, we’ve selected a few ko examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Komodo / KomodoEdit / src / chrome / komodo / content / sdk / colorscheme.js View on Github external
var _applyInterface = () =>
    {
        var style = "";
        
        var name = prefs.getString("interface-scheme");
        var scheme = schemeService.getScheme(name);
        
        // Write interfaceChrome.less
        path = koFile.join(koDirSvc.userDataDir, "interfaceChrome.less");
        fp = koFile.open(path, "w");
        style = scheme.getInterfaceStyle("css", "code") || "";
        fp.write(style);
        fp.close();
        
        var defer = prefs.getBoolean("interface-font-defer");
        var font = prefs.getString("interface-font");
        var size = prefs.getString("interface-font-size");
        
        // Write colors.less
        style = "";
        var path = koFile.join(koDirSvc.userDataDir, "colors.less");
        var fp = koFile.open(path, "w");
        var _apply = (scheme, mapping) =>
        {
            for (let k in mapping)
            {
                // Defer font to global pref
                if ( ! defer && k == "font")
                {
                    style += `@${k}: ${font};` + "\n";
                    continue;
                }
github Komodo / KomodoEdit / src / chrome / komodo / content / sdk / colorscheme.js View on Github external
{
        var style = "";
        
        var name = prefs.getString("interface-scheme");
        var scheme = schemeService.getScheme(name);
        
        // Write interfaceChrome.less
        path = koFile.join(koDirSvc.userDataDir, "interfaceChrome.less");
        fp = koFile.open(path, "w");
        style = scheme.getInterfaceStyle("css", "code") || "";
        fp.write(style);
        fp.close();
        
        var defer = prefs.getBoolean("interface-font-defer");
        var font = prefs.getString("interface-font");
        var size = prefs.getString("interface-font-size");
        
        // Write colors.less
        style = "";
        var path = koFile.join(koDirSvc.userDataDir, "colors.less");
        var fp = koFile.open(path, "w");
        var _apply = (scheme, mapping) =>
        {
            for (let k in mapping)
            {
                // Defer font to global pref
                if ( ! defer && k == "font")
                {
                    style += `@${k}: ${font};` + "\n";
                    continue;
                }
github Komodo / KomodoEdit / src / modules / scope_packages / content / packages.js View on Github external
// Import the XPI addon manager as "AddonManager".
    Cu.import("resource://gre/modules/AddonManager.jsm");
    // Import the HTTP downloader as "Downloads".
    Cu.import("resource://gre/modules/Downloads.jsm");
    // Import OS-specific file management as "OS".
    Cu.import("resource://gre/modules/osfile.jsm");
    // Import asynchronous task management for downloads as "Task".
    Cu.import("resource://gre/modules/Task.jsm");
    
    /** Locale bundle. */
    const bundle = Cc["@mozilla.org/intl/stringbundle;1"].getService(Ci.nsIStringBundleService).
        createBundle("chrome://scope-packages/locale/scope-packages.properties");
    
    /** The root directory for package archives. */
    const ROOT = prefs.getString("package_api_endpoint");
    
    /** The names of the files (no extension) that lists available packages of given kind. */
    const ADDONS = "addons";
    const TOOLBOX = "toolbox";
    const MACROS = "macros";
    const SCHEMES = "schemes";
    const SKINS = "skins";
    const KEYBINDS = "keybinds";
    const LANGS = "languages";
    
    this.ADDONS = ADDONS;
    this.TOOLBOX = TOOLBOX;
    this.MACROS = MACROS;
    this.SCHEMES = SCHEMES;
    this.SKINS = SKINS;
    this.KEYBINDS = KEYBINDS;
github Komodo / KomodoEdit / src / chrome / komodo / content / sdk / colorscheme.js View on Github external
var _applyInterface = () =>
    {
        var style = "";
        
        var name = prefs.getString("interface-scheme");
        var scheme = schemeService.getScheme(name);
        
        // Write interfaceChrome.less
        path = koFile.join(koDirSvc.userDataDir, "interfaceChrome.less");
        fp = koFile.open(path, "w");
        style = scheme.getInterfaceStyle("css", "code") || "";
        fp.write(style);
        fp.close();
        
        var defer = prefs.getBoolean("interface-font-defer");
        var font = prefs.getString("interface-font");
        var size = prefs.getString("interface-font-size");
        
        // Write colors.less
        style = "";
        var path = koFile.join(koDirSvc.userDataDir, "colors.less");
github Komodo / KomodoEdit / src / chrome / komodo / content / sdk / profiler.js View on Github external
this.start = (name = "") =>
    {
        if (name == "" && ! enabled)
            return;

        if (name)
        {
            if (prefs.getString("profilerEnabledName", "") !== name)
                return;
        }

        this.stop(activeProfiler);
        activeProfiler = name;

        var features = prefs.getString("profilerFeatures", "stackwalk,js").split(",");
        profiler.StartProfiler(
            prefs.getLong("profilerMemory", 10000000),
            prefs.getLong("profilerSampleRate", 1),
            features,
            features.length
        );
    };
github Komodo / KomodoEdit / src / chrome / komodo / content / startupWizard / startupWizard.js View on Github external
this.getFieldBrowsers = () =>
    {
        var currentBrowser = prefs.getString('selectedbrowser', '');
        var koWebbrowser = Components.classes['@activestate.com/koWebbrowser;1'].
                       getService(Components.interfaces.koIWebbrowser);
        var knownBrowsers = koWebbrowser.get_possible_browsers({});
        
        var menulist = require("ko/ui/menulist").create();
        menulist.addMenuItem({ attributes: {
            label: platform == "winnt" ? "System defined default browser" : "Ask when browser is launched the next time",
            value: "",
            selected: currentBrowser === ""
        } });
        
        for (let browser of knownBrowsers)
        {
            menulist.addMenuItem({ attributes: {
                label: browser,
                selected: browser == currentBrowser
github Komodo / KomodoEdit / src / modules / console / content / js / console.js View on Github external
(function() {
    
    var prefs = require("ko/prefs");
    var win = require("ko/windows").getMain();
    var elem = {
        statusbar: document.getElementById("statusbar"),
        input: document.getElementById("input"),
        inputMock: document.getElementById("input-mock"),
        console: document.getElementById("output").parentNode,
        output: document.getElementById("output")
    }
    
    var history = JSON.parse(prefs.getString("console_history", "[]"));
    var historyPos = -1;
    
    var charWidth = elem.inputMock.offsetWidth;
    var charHeight = elem.inputMock.offsetHeight / 2;
    
    this.init = function()
    {
        elem.input.addEventListener("select", this.updateCaretPos.bind(this));
        elem.input.addEventListener("click", this.updateCaretPos.bind(this));
        elem.input.addEventListener("change", this.updateCaretPos.bind(this));
        elem.input.addEventListener("keyup", this.updateCaretPos.bind(this));
        
        elem.input.addEventListener("keypress", this.onKeyNav.bind(this));
        
        new autoComplete({
            selector: "#input",
github Komodo / KomodoEdit / src / chrome / komodo / content / startupWizard / startupWizard.js View on Github external
this.getFieldColorSchemes = () =>
    {
        var currentScheme = prefs.getString("editor-scheme");
        var schemeService = Cc['@activestate.com/koScintillaSchemeService;1'].getService();
        var schemes = [];
        schemeService.getSchemeNames(schemes, {});
        schemes = schemes.value;
        
        var menulist = require("ko/ui/menulist").create();
        for(let scheme of schemes)
        {
            let s = schemeService.getScheme(scheme);
            
            if ( ! s)
                continue;
            
            menulist.addMenuItem({
                attributes: {
                    label: scheme,
github Defman21 / komodo-terminal-butterfly / content / widget.js View on Github external
this.init = () =>
    {
        pinned = JSON.parse(require('ko/prefs').getString('komodo_terminal_pinned_tabs', '[]'));
        
        menupopup = $("#menupopup", window);
        
        for (let pin of pinned) {
            this.newTab(null, pin);
        }
        
        this.newTab(null, null);
        
        $("tabs", window).element().newTabButton.addEventListener("command", this.newTab);
    };
github Komodo / KomodoEdit / src / chrome / komodo / content / sdk / colorscheme.js View on Github external
{
                    style += `@${k}: ${size};` + "\n";
                    continue;
                }
                
                let v = mapping[k];
                let value = scheme.getInterfaceStyle(v[0], v[1]);
                
                if (value && value.length)
                    style += `@${k}: ${value};` + "\n";
            }
        };
        
        _apply(scheme, interfaceMapping);
        
        scheme = schemeService.getScheme(prefs.getString('widget-scheme'));
        _apply(scheme, interfaceMappingWidgets);
        
        fp.write(style);
        fp.close();
        
        require("ko/less").reload(true);
        
        var observerSvc = Cc["@mozilla.org/observer-service;1"].
                            getService(Ci.nsIObserverService);
        observerSvc.notifyObservers(null, 'interface-scheme-changed', name);
    }
    _applyInterface.timer = null;