Esempio n. 1
0
    def do_activate(self):
        api = self.object
        self.app = api.app
        self.app.settings.addConfigSection("console")

        self.app.settings.addConfigOption(attrname="consoleColor",
                                          section="console",
                                          key="console-color",
                                          notify=True,
                                          default=Console.DEFAULT_COLOR)

        self.app.settings.addConfigOption(attrname="consoleErrorColor",
                                          section="console",
                                          key="console-error-color",
                                          notify=True,
                                          default=Console.DEFAULT_STDERR_COLOR)

        self.app.settings.addConfigOption(attrname="consoleOutputColor",
                                          section="console",
                                          key="console-output-color",
                                          notify=True,
                                          default=Console.DEFAULT_STDOUT_COLOR)

        self.app.settings.addConfigOption(
            attrname="consoleFont",
            section="console",
            key="console-font",
            notify=True,
            default=Console.DEFAULT_FONT.to_string())

        self.app.settings.reload_attribute_from_file("console", "consoleColor")
        self.app.settings.reload_attribute_from_file("console",
                                                     "consoleErrorColor")
        self.app.settings.reload_attribute_from_file("console",
                                                     "consoleOutputColor")
        self.app.settings.reload_attribute_from_file("console", "consoleFont")

        PreferencesDialog.add_section("console", _("Console"))
        PreferencesDialog.addColorPreference(attrname="consoleColor",
                                             label=_("Color"),
                                             description=None,
                                             section="console")
        PreferencesDialog.addColorPreference(
            attrname="consoleErrorColor",
            # Translators: The color of the content from stderr.
            label=_("Standard error color"),
            description=None,
            section="console")
        PreferencesDialog.addColorPreference(
            attrname="consoleOutputColor",
            # Translators: The color of the content from stdout.
            label=_("Standard output color"),
            description=None,
            section="console")
        PreferencesDialog.addFontPreference(attrname="consoleFont",
                                            label=_("Font"),
                                            description=None,
                                            section="console")

        open_action = Gio.SimpleAction.new("open_console", None)
        open_action.connect("activate", self.__menu_item_activate_cb)
        self.app.add_action(open_action)
        self.app.shortcuts.add("app.open_console", ["<Primary>d"],
                               _("Developer Console"))

        self._setup_dialog()
        self.add_menu_item()
        self.menu_item.show()
Esempio n. 2
0
    def do_activate(self):
        api = self.object
        self.app = api.app
        try:
            self.app.settings.addConfigSection("console")
        except ConfigError:
            pass

        try:
            self.app.settings.addConfigOption(attrname="consoleColor",
                                              section="console",
                                              key="console-color",
                                              notify=True,
                                              default=Console.DEFAULT_COLOR)
        except ConfigError:
            pass

        try:
            self.app.settings.addConfigOption(
                attrname="consoleErrorColor",
                section="console",
                key="console-error-color",
                notify=True,
                default=Console.DEFAULT_STDERR_COLOR)
        except ConfigError:
            pass

        try:
            self.app.settings.addConfigOption(
                attrname="consoleOutputColor",
                section="console",
                key="console-output-color",
                notify=True,
                default=Console.DEFAULT_STDOUT_COLOR)
        except ConfigError:
            pass

        try:
            self.app.settings.addConfigOption(
                attrname="consoleFont",
                section="console",
                key="console-font",
                notify=True,
                default=Console.DEFAULT_FONT.to_string())
        except ConfigError:
            pass

        self.app.settings.reload_attribute_from_file("console", "consoleColor")
        self.app.settings.reload_attribute_from_file("console",
                                                     "consoleErrorColor")
        self.app.settings.reload_attribute_from_file("console",
                                                     "consoleOutputColor")
        self.app.settings.reload_attribute_from_file("console", "consoleFont")

        PreferencesDialog.add_section("console", _("Console"))
        PreferencesDialog.addColorPreference(attrname="consoleColor",
                                             label=_("Color"),
                                             description=None,
                                             section="console")
        PreferencesDialog.addColorPreference(
            attrname="consoleErrorColor",
            # Translators: The color of the content from stderr.
            label=_("Standard error color"),
            description=None,
            section="console")
        PreferencesDialog.addColorPreference(
            attrname="consoleOutputColor",
            # Translators: The color of the content from stdout.
            label=_("Standard output color"),
            description=None,
            section="console")
        PreferencesDialog.addFontPreference(attrname="consoleFont",
                                            label=_("Font"),
                                            description=None,
                                            section="console")

        self._setup_dialog()
        self.add_menu_item()
        self.menu_item.show()
Esempio n. 3
0
    def do_activate(self):
        api = self.object
        self.app = api.app
        try:
            self.app.settings.addConfigSection("console")
        except ConfigError:
            pass

        try:
            self.app.settings.addConfigOption(attrname="consoleColor",
                                              section="console",
                                              key="console-color",
                                              notify=True,
                                              default=Console.DEFAULT_COLOR)
        except ConfigError:
            pass

        try:
            self.app.settings.addConfigOption(attrname="consoleErrorColor",
                                              section="console",
                                              key="console-error-color",
                                              notify=True,
                                              default=Console.DEFAULT_STDERR_COLOR)
        except ConfigError:
            pass

        try:
            self.app.settings.addConfigOption(attrname="consoleOutputColor",
                                              section="console",
                                              key="console-output-color",
                                              notify=True,
                                              default=Console.DEFAULT_STDOUT_COLOR)
        except ConfigError:
            pass

        try:
            self.app.settings.addConfigOption(attrname="consoleFont",
                                              section="console",
                                              key="console-font",
                                              notify=True,
                                              default=Console.DEFAULT_FONT.to_string())
        except ConfigError:
            pass

        self.app.settings.reload_attribute_from_file("console", "consoleColor")
        self.app.settings.reload_attribute_from_file("console",
                                                     "consoleErrorColor")
        self.app.settings.reload_attribute_from_file("console",
                                                     "consoleOutputColor")
        self.app.settings.reload_attribute_from_file("console", "consoleFont")

        PreferencesDialog.add_section("console", _("Console"))
        PreferencesDialog.addColorPreference(attrname="consoleColor",
                                             label=_("Color"),
                                             description=None,
                                             section="console")
        PreferencesDialog.addColorPreference(attrname="consoleErrorColor",
                                             # Translators: The color of the content from stderr.
                                             label=_("Standard error color"),
                                             description=None,
                                             section="console")
        PreferencesDialog.addColorPreference(attrname="consoleOutputColor",
                                             # Translators: The color of the content from stdout.
                                             label=_("Standard output color"),
                                             description=None,
                                             section="console")
        PreferencesDialog.addFontPreference(attrname="consoleFont",
                                            label=_("Font"),
                                            description=None,
                                            section="console")

        open_action = Gio.SimpleAction.new("open_console", None)
        open_action.connect("activate", self.__menu_item_activate_cb)
        self.app.add_action(open_action)
        self.app.shortcuts.add("app.open_console", ["<Primary>d"], _("Developer Console"))

        self._setup_dialog()
        self.add_menu_item()
        self.menu_item.show()