[gedit-plugins] Added Color Scheme Editor plugin.
- From: Jono Finger <jonofinger src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit-plugins] Added Color Scheme Editor plugin.
- Date: Wed, 3 Apr 2013 19:49:22 +0000 (UTC)
commit 79956d46750ccffb127b04eee91d4d1c4088871c
Author: Jono Finger <jonofinger src gnome org>
Date: Wed Apr 3 15:48:40 2013 -0400
Added Color Scheme Editor plugin.
configure.ac | 9 +-
plugins/colorschemer/Makefile.am | 22 +
.../colorschemer/colorschemer.plugin.desktop.in.in | 10 +
plugins/colorschemer/schemer/Makefile.am | 16 +
plugins/colorschemer/schemer/__init__.py | 61 ++
plugins/colorschemer/schemer/languages.py | 277 ++++++++
plugins/colorschemer/schemer/schemer.py | 658 ++++++++++++++++++++
plugins/colorschemer/schemer/schemer.ui | 633 +++++++++++++++++++
8 files changed, 1683 insertions(+), 3 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 23074b2..9587e6c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -92,9 +92,9 @@ ALL_PLUGINS="bookmarks drawspaces wordcompletion"
USEFUL_PLUGINS="bookmarks drawspaces wordcompletion"
DEFAULT_PLUGINS="bookmarks drawspaces wordcompletion"
-PYTHON_ALL_PLUGINS="bracketcompletion charmap codecomment colorpicker commander dashboard joinlines
multiedit textsize smartspaces terminal synctex"
-PYTHON_USEFUL_PLUGINS="bracketcompletion charmap codecomment colorpicker commander dashboard joinlines
multiedit textsize smartspaces terminal synctex"
-PYTHON_DEFAULT_PLUGINS="bracketcompletion charmap codecomment colorpicker commander dashboard joinlines
multiedit textsize smartspaces terminal synctex"
+PYTHON_ALL_PLUGINS="bracketcompletion charmap codecomment colorpicker colorschemer commander dashboard
joinlines multiedit textsize smartspaces terminal synctex"
+PYTHON_USEFUL_PLUGINS="bracketcompletion charmap codecomment colorpicker colorschemer commander dashboard
joinlines multiedit textsize smartspaces terminal synctex"
+PYTHON_DEFAULT_PLUGINS="bracketcompletion charmap codecomment colorpicker colorschemer commander dashboard
joinlines multiedit textsize smartspaces terminal synctex"
DIST_PLUGINS="$ALL_PLUGINS $PYTHON_ALL_PLUGINS"
@@ -325,6 +325,9 @@ plugins/codecomment/codecomment.plugin.desktop.in
plugins/codecomment/Makefile
plugins/colorpicker/colorpicker.plugin.desktop.in
plugins/colorpicker/Makefile
+plugins/colorschemer/schemer/Makefile
+plugins/colorschemer/colorschemer.plugin.desktop.in
+plugins/colorschemer/Makefile
plugins/commander/commander/commands/Makefile
plugins/commander/commander.plugin.desktop.in
plugins/commander/commander/Makefile
diff --git a/plugins/colorschemer/Makefile.am b/plugins/colorschemer/Makefile.am
new file mode 100644
index 0000000..2202a2a
--- /dev/null
+++ b/plugins/colorschemer/Makefile.am
@@ -0,0 +1,22 @@
+# colorschemer
+
+SUBDIRS = schemer
+
+plugindir = $(GEDIT_PLUGINS_LIBS_DIR)
+
+plugin_in_files = colorschemer.plugin.desktop.in
+
+%.plugin: %.plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po)
+ $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
+
+plugin_DATA = $(plugin_in_files:.plugin.desktop.in=.plugin)
+
+EXTRA_DIST = $(plugin_in_files)
+
+CLEANFILES = $(plugin_DATA)
+
+DISTCLEANFILES = $(plugin_DATA)
+
+-include $(top_srcdir)/git.mk
+
+
diff --git a/plugins/colorschemer/colorschemer.plugin.desktop.in.in
b/plugins/colorschemer/colorschemer.plugin.desktop.in.in
new file mode 100644
index 0000000..2d2b1f0
--- /dev/null
+++ b/plugins/colorschemer/colorschemer.plugin.desktop.in.in
@@ -0,0 +1,10 @@
+[Plugin]
+Loader=python3
+Module=colorschemer
+IAge=3
+_Name=Color Scheme Editor
+_Description=Source code color scheme editor
+Authors=Jono <jono foodnotblogs com>
+Copyright=Copyright © 2013 Jono Finger
+Website=https://github.com/jonocodes/GeditSchemer
+Version= VERSION@
diff --git a/plugins/colorschemer/schemer/Makefile.am b/plugins/colorschemer/schemer/Makefile.am
new file mode 100644
index 0000000..4144c75
--- /dev/null
+++ b/plugins/colorschemer/schemer/Makefile.am
@@ -0,0 +1,16 @@
+# Colorschemer
+
+plugindir = $(GEDIT_PLUGINS_LIBS_DIR)/colorschemer
+
+plugin_PYTHON = \
+ __init__.py \
+ schemer.py \
+ languages.py
+
+uidir = $(GEDIT_PLUGINS_DATA_DIR)/colorschemer/ui
+ui_DATA = schemer.ui
+
+EXTRA_DIST = \
+ $(ui_DATA)
+
+-include $(top_srcdir)/git.mk
diff --git a/plugins/colorschemer/schemer/__init__.py b/plugins/colorschemer/schemer/__init__.py
new file mode 100644
index 0000000..ce0113c
--- /dev/null
+++ b/plugins/colorschemer/schemer/__init__.py
@@ -0,0 +1,61 @@
+#!/usr/bin/python
+#
+# Gedit Scheme Editor
+# https://github.com/jonocodes/GeditSchemer
+#
+# Copyright (C) Jono Finger 2013 <jono foodnotblogs com>
+#
+# The program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# The program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+from gi.repository import GObject, Gedit, Gtk
+import os
+
+from .schemer import GUI
+
+UI_XML = """<ui>
+<menubar name="MenuBar">
+ <menu name="EditMenu" action="Edit">
+ <placeholder name="EditOps_5">
+ <menuitem name="menuItemLaunchGui" action="LaunchGuiAction"/>
+ </placeholder>
+ </menu>
+</menubar>
+</ui>"""
+
+class WindowActivatable(GObject.Object, Gedit.WindowActivatable):
+
+ window = GObject.property(type=Gedit.Window)
+
+ def __init__(self):
+ GObject.Object.__init__(self)
+
+ def _add_ui(self):
+
+ manager = self.window.get_ui_manager()
+ self._actions = Gtk.ActionGroup("SchemerActions")
+ self._actions.add_actions([
+ ('LaunchGuiAction', Gtk.STOCK_INFO, "Color Scheme Editor",
+ None, "Launch color scheme editor for the current loaded scheme",
+ self.on_example_action_activate),
+ ])
+ manager.insert_action_group(self._actions)
+ self._ui_merge_id = manager.add_ui_from_string(UI_XML)
+ manager.ensure_update()
+
+ def on_example_action_activate(self, action, data=None):
+ schemer.GUI(Gedit.App, os.path.join(self.plugin_info.get_data_dir(), 'ui'))
+
+ def do_activate(self):
+ self._add_ui()
diff --git a/plugins/colorschemer/schemer/languages.py b/plugins/colorschemer/schemer/languages.py
new file mode 100644
index 0000000..a9971d3
--- /dev/null
+++ b/plugins/colorschemer/schemer/languages.py
@@ -0,0 +1,277 @@
+#!/usr/bin/python
+#
+# Gedit Scheme Editor
+# https://github.com/jonocodes/GeditSchemer
+#
+# Copyright (C) Jono Finger 2013 <jono foodnotblogs com>
+#
+# The program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# The program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+
+# please keep these in alphabetical order so it is easy to follow
+# see available languages: /usr/share/gtksourceview-3.0/language-specs
+# or run in python >>> GtkSource.LanguageManager().get_language_ids()
+
+samples = {}
+
+samples['ada'] = """
+with Ada.Text_Io; use Ada.Text_Io;
+
+ procedure Doors is
+ type Door_State is (Closed, Open);
+ type Door_List is array(Positive range 1..100) of Door_State;
+ The_Doors : Door_List := (others => Closed);
+ begin
+ for I in 1..100 loop
+ for J in The_Doors'range loop
+ if J mod I = 0 then
+ if The_Doors(J) = Closed then
+ The_Doors(J) := Open;
+ else
+ The_Doors(J) := Closed;
+ end if;
+ end if;
+ end loop;
+ end loop;
+ for I in The_Doors'range loop
+ Put_Line(Integer'Image(I) & " is " & Door_State'Image(The_Doors(I)));
+ end loop;
+ end Doors;
+"""
+
+samples['asp'] = """
+<html>
+<body>
+<form action="demo_reqquery.asp" method="get">
+Your name: <input type="text" name="fname" size="20" />
+<input type="submit" value="Submit" />
+</form>
+<%
+dim fname
+fname=Request.QueryString("fname")
+If fname<>"" Then
+ Response.Write("Hello " & fname & "!<br />")
+ Response.Write("How are you today?")
+End If
+%>
+</body>
+</html>
+"""
+
+# samples['automake'] = """
+
+samples['awk'] = """
+BEGIN {
+ for(i=1; i <= 100; i++) {
+ doors[i] = 0 # close the doors
+ }
+ for(i=1; i <= 100; i++) {
+ if ( int(sqrt(i)) == sqrt(i) ) {
+ doors[i] = 1
+ }
+ }
+ for(i=1; i <= 100; i++)
+ {
+ print i, doors[i] ? "open" : "close"
+ }
+}
+"""
+
+# samples['bennugd'] = """
+# samples['bibtex'] = """
+# samples['boo'] = """
+
+# do not remove this language since it is the fallback entry
+samples['c'] = """
+/* Some comments */
+#include <stdio.h>
+
+int main()
+{
+ int square = 1, increment = 3, door;
+ for (door = 1; door <= 100; ++door)
+ {
+ printf("door #%d", door);
+ if (door == square)
+ {
+ printf(" is open.");
+ square += increment;
+ increment += 2;
+ }
+ else
+ printf(" is closed.");
+ }
+ return 0;
+}
+"""
+
+samples['c-sharp'] ="""
+// Creates and initializes a new integer Array
+int[] intArray = new int[5] { 1, 2, 3, 4, 5 };
+//same as
+int[] intArray = new int[]{ 1, 2, 3, 4, 5 };
+//same as
+int[] intArray = { 1, 2, 3, 4, 5 };
+
+//Arrays are zero-based
+string[] stringArr = new string[5];
+stringArr[0] = "string";
+"""
+
+# samples['cg'] = """
+# samples['changelog'] = """
+# samples['chdr'] = """
+# samples['cmake'] = """
+# samples['cobol'] = """
+# samples['cpp'] = """
+# samples['css'] = """
+# samples['cuda'] = """
+# samples['d'] = """
+# samples['def'] = """
+# samples['desktop'] = """
+
+samples['diff'] = """
+--- xinetd.d/tftp 2003-12-17 13:11:20.000000000 -0500
++++ ./tftp 2004-01-22 11:46:14.479497688 -0500
+@@ -10,7 +10,7 @@
+ wait = yes
+ user = root
+ server = /usr/sbin/in.tftpd
+- server_args = -s /tftpboot
++ server_args = -p -u tftpd -s /tftpboot
+ disable = yes
+ per_source = 11
+ cps = 100 2
+"""
+# samples['docbook'] = """
+# samples['dosbatch'] = """
+# samples['dot'] = """
+# samples['dpatch'] = """
+# samples['dtd'] = """
+# samples['eiffel'] = """
+# samples['erlang'] = """
+# samples['fcl'] = """
+# samples['forth'] = """
+# samples['fortran'] = """
+# samples['fsharp'] = """
+# samples['gap'] = """
+# samples['gdb-log'] = """
+# samples['gettext-translation'] = """
+# samples['glsl'] = """
+# samples['go'] = """
+# samples['gtk-doc'] = """
+# samples['gtkrc'] = """
+# samples['haddock'] = """
+# samples['haskell'] = """
+# samples['haskell-literate'] = """
+
+samples['html'] = """
+<html>
+<body>
+
+<table border="1">
+ <caption>Monthly savings</caption>
+ <tr>
+ <th>Month</th>
+ <th>Savings</th>
+ </tr>
+ <tr>
+ <td>January</td>
+ <td>$100</td>
+ </tr>
+ <tr>
+ <td>February</td>
+ <td>$50</td>
+ </tr>
+</table>
+
+</body>
+</html>
+"""
+
+# samples['idl'] = """
+# samples['imagej'] = """
+# samples['ini'] = """
+# samples['java'] = """
+# samples['js'] = """
+# samples['json'] = """
+# samples['latex'] = """
+# samples['libtool'] = """
+# samples['lua'] = """
+# samples['m4'] = """
+# samples['makefile'] = """
+# samples['mallard'] = """
+# samples['markdown'] = """
+# samples['matlab'] = """
+# samples['nemerle'] = """
+# samples['nsis'] = """
+# samples['objc'] = """
+# samples['objective-caml'] = """
+# samples['objj'] = """
+# samples['ocl'] = """
+# samples['octave'] = """
+# samples['ooc'] = """
+# samples['opal'] = """
+# samples['opencl'] = """
+# samples['pascal'] = """
+# samples['perl'] = """
+
+samples['php'] = """
+/* ygtyuy */
+print 'hello world';
+"""
+# samples['pkgconfig'] = """
+# samples['prolog'] = """
+# samples['proto'] = """
+
+samples['python'] = """
+ def on_save_clicked(self, param):
+ if not self.currentSchemeFile:
+
+ filename = runSaveAsDialog(self.window, self.entryId.get_text() + '.xml')
+
+ if filename and not '.' in os.path.basename(filename):
+ filename = filename + '.xml'
+
+ if filename:
+ self.write_scheme(filename, self.entryId.get_text())
+ self.currentSchemeFile = filename
+
+ else:
+ self.write_scheme(self.currentSchemeFile, self.entryId.get_text())
+
+ # TODO handle case where there is a permissions issue
+"""
+
+# samples['r'] = """
+# samples['rpmspec'] = """
+# samples['ruby'] = """
+# samples['scheme'] = """
+# samples['scilab'] = """
+# samples['sh'] = """
+# samples['sml'] = """
+# samples['sparql'] = """
+# samples['sql'] = """
+# samples['systemverilog'] = """
+# samples['t2t'] = """
+# samples['tcl'] = """
+# samples['texinfo'] = """
+# samples['vala'] = """
+# samples['vbnet'] = """
+# samples['verilog'] = """
+# samples['vhdl'] = """
+# samples['xml'] = """
+# samples['xslt'] = """
+# samples['yacc'] = """
diff --git a/plugins/colorschemer/schemer/schemer.py b/plugins/colorschemer/schemer/schemer.py
new file mode 100644
index 0000000..f8ce1c9
--- /dev/null
+++ b/plugins/colorschemer/schemer/schemer.py
@@ -0,0 +1,658 @@
+#!/usr/bin/python
+#
+# Gedit Scheme Editor
+# https://github.com/jonocodes/GeditSchemer
+#
+# Copyright (C) Jono Finger 2013 <jono foodnotblogs com>
+#
+# The program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# The program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import os
+import sys
+import collections
+import tempfile
+from xml.etree import ElementTree as ET
+
+from gi.repository import Gtk, GdkPixbuf, Gdk, GtkSource, Gio, GLib
+
+from .languages import samples
+
+
+# Holds style properties for a GtkSourceStyle element
+class Props:
+
+ def __init__(self):
+
+ self.background = None # str
+ self.foreground = None # str
+ self.italic = False
+ self.bold = False
+ self.strikethrough = False
+ self.underline = False
+
+ def from_gtk_source_style(self, gtkStyle):
+
+ self.background = gtkStyle.props.background
+ self.foreground = gtkStyle.props.foreground
+ self.italic = gtkStyle.props.italic
+ self.bold = gtkStyle.props.bold
+ self.underline = gtkStyle.props.underline
+ self.strikethrough = gtkStyle.props.strikethrough
+
+ # here we make sure every color starts with a hash
+ # maybe this is a workaround for a bug that I should file
+ # or maybe this is a false assumption
+
+ # if self.foreground and self.foreground[0] != '#':
+ # self.foreground = '#' + self.foreground
+
+ # if self.background and self.background[0] != '#':
+ # self.background = '#' + self.background
+
+
+class GUI:
+
+ def __init__(self, geditApp, uiDir):
+
+ # constants
+
+ self.colorBlack = Gdk.color_parse('#000000');
+
+ # we set this explicitly since the API does not give us a method for it
+ self.guiStyleIds = ['bracket-match', 'bracket-mismatch',
+ 'current-line', 'cursor', 'line-numbers', 'secondary-cursor',
+ 'selection', 'selection-unfocused', 'text']
+
+ # set up GUI widgets and signals
+
+ GtkSource.View() # hack to get GtkSourceView widget to run from glade file
+
+ self.builder = Gtk.Builder()
+
+ uiFile = os.path.join(uiDir, 'schemer.ui')
+
+ if (os.path.isfile(uiFile)):
+ self.builder.add_from_file(uiFile)
+ else:
+ print('unable to find UI file')
+ sys.exit(1)
+
+ self.builder.connect_signals(self)
+
+ self.window = self.builder.get_object('window')
+ self.aboutDialog = self.builder.get_object('aboutdialog')
+
+ self.sourceBuffer = GtkSource.Buffer(max_undo_levels=0)
+ self.sourceView = self.builder.get_object('gtksourceviewSample')
+ self.sourceView.set_buffer(self.sourceBuffer)
+
+ self.liststoreStyles = self.builder.get_object('liststoreStyles')
+ self.liststoreLanguages = self.builder.get_object('liststoreLanguages')
+ self.comboboxLanguages = self.builder.get_object('comboboxLanguages')
+ self.treeviewStyles = self.builder.get_object('treeviewStyles')
+
+ self.colorbuttonForeground = self.builder.get_object('colorbuttonForeground')
+ self.colorbuttonBackground = self.builder.get_object('colorbuttonBackground')
+ self.togglebuttonItalic = self.builder.get_object('togglebuttonItalic')
+ self.togglebuttonBold = self.builder.get_object('togglebuttonBold')
+ self.togglebuttonUnderline = self.builder.get_object('togglebuttonUnderline')
+ self.togglebuttonStrikethrough = self.builder.get_object('togglebuttonStrikethrough')
+ self.checkbuttonForeground = self.builder.get_object('checkbuttonForeground')
+ self.checkbuttonBackground = self.builder.get_object('checkbuttonBackground')
+ self.resetButton = self.builder.get_object('resetButton')
+
+ self.entryName = self.builder.get_object('entryName')
+ self.entryAuthor = self.builder.get_object('entryAuthor')
+ self.entryDescription = self.builder.get_object('entryDescription')
+ self.entryId = self.builder.get_object('entryId')
+ self.labelSample = self.builder.get_object('labelSample')
+
+ self.colorbuttonBackground.connect('color-set', self.on_style_changed)
+ self.colorbuttonForeground.connect('color-set', self.on_style_changed)
+
+ self.builder.get_object('buttonCancel').connect('clicked', self.on_cancel_clicked)
+ self.builder.get_object('buttonSave').connect('clicked', self.on_save_clicked)
+
+ self.togglebuttonItalicHandler = self.togglebuttonItalic.connect(
+ 'toggled', self.on_style_changed)
+ self.togglebuttonBoldHandler = self.togglebuttonBold.connect(
+ 'toggled', self.on_style_changed)
+ self.togglebuttonUnderlineHandler = self.togglebuttonUnderline.connect(
+ 'toggled', self.on_style_changed)
+ self.togglebuttonStrikethroughHandler = self.togglebuttonStrikethrough.connect(
+ 'toggled', self.on_style_changed)
+
+ self.checkbuttonBackgroundHandler = self.checkbuttonBackground.connect(
+ 'toggled', self.on_background_toggled)
+ self.checkbuttonForegroundHandler = self.checkbuttonForeground.connect(
+ 'toggled', self.on_foreground_toggled)
+
+ self.resetButton.connect('clicked', self.on_reset_clicked)
+
+ self.schemeManager = GtkSource.StyleSchemeManager().get_default() # requires gedit 3.3.3 or newer
+ self.languageManager = GtkSource.LanguageManager()
+
+ self.dictAllStyles = collections.OrderedDict()
+
+ languages = self.languageManager.get_language_ids()
+ languages.sort()
+
+ self.geditApp = geditApp
+ self.geditView = geditApp.get_default().get_active_window().get_active_view()
+
+ self.defaultLanguageId = 'c'
+ self.defaultLanguageName = 'C'
+ self.defaultLanguage = self.languageManager.get_language(self.defaultLanguageId)
+
+ self.selectedLanguageId = self.defaultLanguageId
+ self.selectedLanguageName = self.defaultLanguageName
+ self.selectedLanguage = self.defaultLanguage
+
+ self.bufferLanguageId = self.defaultLanguageId
+ self.bufferLanguageName = self.defaultLanguageName
+ self.bufferLanguage = self.defaultLanguage
+
+ # guess the language from the current buffer
+ if self.geditView:
+ bufferLanguage = self.geditView.get_buffer().get_language()
+
+ if bufferLanguage and bufferLanguage.get_id() in languages:
+ self.bufferLanguageId = bufferLanguage.get_id()
+ self.bufferLanguageName = bufferLanguage.get_name()
+ self.bufferLanguage = bufferLanguage
+
+ # watch temp directory to help the sample viewer
+ self.schemeManagerOrigSearchPath = self.schemeManager.get_search_path()
+ self.schemeManager.append_search_path(tempfile.gettempdir())
+
+ self.origSchemeFile = None
+
+ if self.geditView: # if there is a view open, get the scheme from the buffer
+ self.load_scheme(self.geditView.get_buffer().get_style_scheme().get_filename())
+ else: # is there is no view, check gsettings
+ self.load_scheme(Gio.Settings('org.gnome.gedit.preferences.editor').get_string('scheme'))
+
+ for langStyleId in self.guiStyleIds:
+ self.liststoreStyles.append([langStyleId])
+
+ self.langMapNameToId = {}
+
+ # make a special case for Defaults which is moved to the top and includes GUI styles
+ self.liststoreLanguages.append([' Default styles'])
+ self.langMapNameToId[' Default styles'] = 'def'
+
+ for thisLanguage in languages:
+ langName = self.languageManager.get_language(thisLanguage).get_name()
+ self.langMapNameToId[langName] = thisLanguage
+
+ if langName != 'Defaults':
+ self.liststoreLanguages.append([langName])
+
+ renderer_text = Gtk.CellRendererText()
+ self.comboboxLanguages.pack_start(renderer_text, True)
+ self.comboboxLanguages.connect('changed', self.on_language_selected)
+ self.comboboxLanguages.add_attribute(renderer_text, 'text', 0)
+
+ self.treeviewStylesSelection = self.treeviewStyles.get_selection()
+ self.treeviewStylesSelection.connect('changed', self.on_style_selected)
+
+ # select the first language
+ self.comboboxLanguages.set_active(0)
+
+ # select the first style
+ treeIter = self.treeviewStyles.get_model().get_iter_first()
+ self.treeviewStylesSelection.select_iter(treeIter)
+ model = self.treeviewStyles.get_model()
+ self.selectedStyleId = model[treeIter][0]
+
+ def destroy(self, window):
+ self.window.destroy()
+
+ def on_cancel_clicked(self, param):
+ self.schemeManager.set_search_path(self.schemeManagerOrigSearchPath)
+ self.window.destroy()
+
+ def on_save_clicked(self, param):
+
+ inFile = self.origSchemeFile
+
+ tempDirectory = tempfile.gettempdir()
+
+ outFile = None
+
+ if os.access(inFile, os.W_OK) and (str(os.path.dirname(inFile)) != tempDirectory):
+ outFile = inFile
+ else:
+ possibleDirs = self.schemeManager.get_search_path()
+
+ # attempt to save to ~/.local/share/gedit/styles/
+ thisDir = os.path.join(GLib.get_user_data_dir(), "gedit", "styles")
+
+ if thisDir in possibleDirs:
+ if os.path.isdir(thisDir):
+ try:
+ os.makedirs(thisDir)
+ except:
+ pass
+
+ if (os.access(thisDir, os.W_OK)):
+ outFile = os.path.join(thisDir, self.entryId.get_text() + '.xml')
+
+ # if we cant save it there, save it where ever we have permission to save it
+ if not outFile:
+ for thisDir in possibleDirs:
+
+ if thisDir == tempDirectory:
+ continue
+
+ # create the directory if it does not exist
+ if not os.path.isdir(thisDir):
+ try:
+ os.makedirs(thisDir)
+ except:
+ pass
+
+ if (os.access(thisDir, os.W_OK)):
+ outFile = os.path.join(thisDir, self.entryId.get_text() + '.xml')
+ break
+
+ if outFile:
+
+ if inFile != outFile:
+
+ schemeIds = self.schemeManager.get_scheme_ids()
+
+ for thisSchemeId in schemeIds:
+ if self.entryId.get_text() == thisSchemeId or self.entryName.get_text() ==
self.schemeManager.get_scheme(thisSchemeId).get_name():
+
+ text = '<span weight="bold" size="larger">There was a problem saving the scheme</span>' \
+ '\n\nYou do not have permission to overwrite the scheme you have choosen.' \
+ '\nInstead a copy will be created.' \
+ '\n\nPlease be sure to choose a Name and ID that are not already in use.\n'
+ message_dialog(Gtk.MessageType.ERROR, text, parent=self.window,
+ buttons=Gtk.ButtonsType.NONE,
+ additional_buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL))
+
+ return
+
+ if not self.write_scheme(outFile, self.entryId.get_text(), self.entryName.get_text()):
+ message_dialog(Gtk.MessageType.ERROR, 'Error saving theme',
+ parent=self.window, buttons=Gtk.ButtonsType.NONE,
+ additional_buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL))
+ else:
+
+ self.schemeManager.force_rescan()
+ updatedScheme = self.schemeManager.get_scheme(self.entryId.get_text())
+
+ s = Gio.Settings('org.gnome.gedit.preferences.editor')
+ s.set_string('scheme', self.entryId.get_text())
+
+ # update the view in all open documents
+ for thisDoc in self.geditApp.get_default().get_documents():
+ thisDoc.set_style_scheme(updatedScheme)
+
+ else:
+ message_dialog(Gtk.MessageType.ERROR, 'Error saving theme',
+ buttons=Gtk.ButtonsType.NONE, parent=self.window,
+ additional_buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL))
+
+ self.schemeManager.set_search_path(self.schemeManagerOrigSearchPath)
+ self.window.destroy()
+
+ def load_scheme(self, schemeIdOrFile):
+ """ Load a scheme from a file or an existing scheme ID """
+
+ if os.path.isfile(schemeIdOrFile):
+
+ directory = os.path.dirname(schemeIdOrFile)
+
+ if directory not in self.schemeManager.get_search_path():
+ self.schemeManager.prepend_search_path(directory)
+
+ fp = open(schemeIdOrFile, 'r')
+ xmlTree = ET.parse(fp)
+ fp.close()
+
+ if xmlTree.getroot().tag == 'style-scheme':
+ thisScheme = self.schemeManager.get_scheme(xmlTree.getroot().attrib['id'])
+
+ if thisScheme == None:
+ return False
+
+ testFilename = thisScheme.get_filename()
+
+ if testFilename != schemeIdOrFile:
+ # there must have been some conflict, since it opened the wrong file
+
+ text = '<span weight="bold" size="larger">There was a problem opening the file</span>' \
+ '\n\nYou appear to have schemes with the same IDs in different directories\n'
+ message_dialog(Gtk.MessageType.ERROR, text,
+ parent=self.window, buttons=Gtk.ButtonsType.NONE,
+ additional_buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL))
+
+ return False
+
+ self.origSchemeFile = schemeIdOrFile
+
+ else:
+
+ thisScheme = self.schemeManager.get_scheme(schemeIdOrFile)
+
+ if thisScheme == None:
+ return False
+
+ self.currentScheme = thisScheme
+
+ self.entryName.set_text( thisScheme.get_name() )
+ self.entryAuthor.set_text(', '.join(thisScheme.get_authors()))
+ self.entryDescription.set_text(thisScheme.get_description())
+ self.entryId.set_text(thisScheme.get_id())
+
+ # get all the style elements
+ # since there are no API calls to do this, we parse the XML file for now
+ # also works around this https://bugzilla.gnome.org/show_bug.cgi?id=667194
+ self.origSchemeFile = self.currentScheme.get_filename()
+
+ fp = open(self.origSchemeFile, 'r')
+ xmlTree = ET.parse(fp)
+ fp.close()
+ styleElements = xmlTree.findall('style')
+
+ self.dictAllStyles.clear()
+
+ for styleElement in styleElements:
+ thisStyle = self.currentScheme.get_style(styleElement.attrib['name'])
+ styleProps = Props()
+ styleProps.from_gtk_source_style(thisStyle)
+ self.dictAllStyles[styleElement.attrib['name']] = styleProps;
+
+ self.sourceBuffer.set_style_scheme(self.currentScheme);
+
+ # set up temp file so the sample view can be updated
+ self.tempSchemeId = thisScheme.get_id() + '_temp'
+ self.tempSchemeName = thisScheme.get_name() + '_temp'
+ self.tempSchemeFile = tempfile.gettempdir() + '/' + self.tempSchemeId + '.xml'
+
+ return True
+
+ def clear_and_disable_style_buttons(self):
+ self.colorbuttonForeground.set_color(self.colorBlack)
+ self.colorbuttonBackground.set_color(self.colorBlack)
+ self.colorbuttonForeground.set_sensitive(False)
+ self.checkbuttonForeground.set_active(False)
+ self.colorbuttonBackground.set_sensitive(False)
+ self.checkbuttonBackground.set_active(False)
+
+ self.togglebuttonItalic.set_active(False)
+ self.togglebuttonBold.set_active(False)
+ self.togglebuttonStrikethrough.set_active(False)
+ self.togglebuttonUnderline.set_active(False)
+
+ self.resetButton.set_sensitive(False)
+
+ def update_sample_view(self):
+ """
+ Update the sample shown in the GUI.
+ To do this we must write the scheme to disk and reload it from there.
+ """
+
+ # write it to disk
+ self.write_scheme(self.tempSchemeFile, self.tempSchemeId, self.tempSchemeName)
+
+ # and reload it from disk
+ self.schemeManager.force_rescan()
+
+ newScheme = self.schemeManager.get_scheme(self.tempSchemeId)
+ self.sourceBuffer.set_style_scheme(newScheme);
+
+ def write_scheme(self, location, schemeId, schemeName):
+ """Write the scheme to disk
+
+ location -- the file location to write to
+ schemeId -- the ID of the scheme
+ """
+
+ output = '<style-scheme name="'+ schemeName + '" id="'+ schemeId +'" version="1.0">\n'
+
+ output += ' <author>'+ self.entryAuthor.get_text() +'</author>\n'
+ output += ' <description>'+ self.entryDescription.get_text() +'</description>\n\n'
+
+ for k, v in list(self.dictAllStyles.items()):
+ output += ' <style name="'+k+'"\t'
+
+ if (v.foreground): output += 'foreground="'+ v.foreground +'" '
+ if (v.background): output += 'background="'+ v.background +'" '
+ if (v.italic): output += 'italic="true" '
+ if (v.bold): output += 'bold="true" '
+ if (v.underline): output += 'underline="true" '
+ if (v.strikethrough): output += 'strikethrough="true" '
+
+ output += '/>\n'
+
+ output += '</style-scheme>\n'
+
+ try:
+ fp = open(location, 'w')
+ fp.write(output)
+ fp.close()
+ except:
+ return False
+
+ return True
+
+ def on_reset_clicked(self, param):
+
+ if self.selectedStyleId in self.dictAllStyles:
+
+ del self.dictAllStyles[self.selectedStyleId]
+
+ # reset the GUI
+ self.clear_and_disable_style_buttons()
+
+ self.update_sample_view()
+
+ def on_background_toggled(self, param):
+
+ if param.get_active():
+ self.colorbuttonBackground.set_sensitive(True)
+ self.colorbuttonBackground.activate()
+ else:
+ self.colorbuttonBackground.set_sensitive(False)
+ self.dictAllStyles[self.selectedStyleId].background = None;
+ self.update_sample_view()
+
+ def on_foreground_toggled(self, param):
+
+ if param.get_active():
+ self.colorbuttonForeground.set_sensitive(True)
+ self.colorbuttonForeground.activate()
+ else:
+ self.colorbuttonForeground.set_sensitive(False)
+ self.dictAllStyles[self.selectedStyleId].foreground = None;
+ self.update_sample_view()
+
+ def on_style_changed(self, data):
+
+ if self.selectedStyleId not in self.dictAllStyles:
+ self.dictAllStyles[self.selectedStyleId] = Props()
+
+ cScale = 255.0/65535.0
+
+ if data == self.colorbuttonBackground:
+ color = data.get_color()
+ self.dictAllStyles[self.selectedStyleId].background = ('#%02x%02x%02x' %
+ (color.red * cScale, color.green * cScale, color.blue * cScale))
+
+ elif data == self.colorbuttonForeground:
+ color = data.get_color()
+ self.dictAllStyles[self.selectedStyleId].foreground = ('#%02x%02x%02x' %
+ (color.red * cScale, color.green * cScale, color.blue * cScale))
+
+ elif data == self.togglebuttonBold:
+ self.dictAllStyles[self.selectedStyleId].bold = data.get_active()
+
+ elif data == self.togglebuttonItalic:
+ self.dictAllStyles[self.selectedStyleId].italic = data.get_active()
+
+ elif data == self.togglebuttonUnderline:
+ self.dictAllStyles[self.selectedStyleId].underline = data.get_active()
+
+ elif data == self.togglebuttonStrikethrough:
+ self.dictAllStyles[self.selectedStyleId].strikethrough = data.get_active()
+
+ self.update_sample_view()
+
+ def on_style_selected(self, selection):
+ model, treeiter = selection.get_selected()
+
+ # handle the special case for when the styles get cleared since the signal activates
+ if treeiter == None:
+ return
+
+ self.selectedStyleId = self.selectedLanguageId + ':' + model[treeiter][0]
+
+ # handle the special case for GUI styles
+ if self.selectedStyleId not in self.dictAllStyles and self.selectedLanguageId == 'def':
+ self.selectedStyleId = model[treeiter][0]
+
+ # block all the toggle handlers so they dont get triggered
+ self.togglebuttonItalic.handler_block(self.togglebuttonItalicHandler)
+ self.togglebuttonBold.handler_block(self.togglebuttonBoldHandler)
+ self.togglebuttonUnderline.handler_block(self.togglebuttonUnderlineHandler)
+ self.togglebuttonStrikethrough.handler_block(self.togglebuttonStrikethroughHandler)
+ self.checkbuttonBackground.handler_block(self.checkbuttonBackgroundHandler)
+ self.checkbuttonForeground.handler_block(self.checkbuttonForegroundHandler)
+
+ if self.selectedStyleId in self.dictAllStyles:
+
+ thisStyle = self.dictAllStyles[self.selectedStyleId]
+
+ # handle foreground and background colors
+
+ if thisStyle.foreground:
+ self.colorbuttonForeground.set_color(Gdk.color_parse(thisStyle.foreground))
+ self.colorbuttonForeground.set_sensitive(True)
+ self.checkbuttonForeground.set_active(True)
+ else:
+ self.colorbuttonForeground.set_color(self.colorBlack)
+ self.colorbuttonForeground.set_sensitive(False)
+ self.checkbuttonForeground.set_active(False)
+
+ if thisStyle.background:
+ self.colorbuttonBackground.set_color(Gdk.color_parse(thisStyle.background))
+ self.colorbuttonBackground.set_sensitive(True)
+ self.checkbuttonBackground.set_active(True)
+ else:
+ self.colorbuttonBackground.set_color(self.colorBlack)
+ self.colorbuttonBackground.set_sensitive(False)
+ self.checkbuttonBackground.set_active(False)
+
+ # handle text styling
+
+ self.togglebuttonItalic.set_active(thisStyle.italic)
+ self.togglebuttonBold.set_active(thisStyle.bold)
+ self.togglebuttonStrikethrough.set_active(thisStyle.strikethrough)
+ self.togglebuttonUnderline.set_active(thisStyle.underline)
+ self.resetButton.set_sensitive(True)
+
+ # if style does not exist, set to default GUI values
+ else:
+ self.clear_and_disable_style_buttons()
+
+ # unblock toggle handlers so the user can do stuff
+ self.togglebuttonItalic.handler_unblock(self.togglebuttonItalicHandler)
+ self.togglebuttonBold.handler_unblock(self.togglebuttonBoldHandler)
+ self.togglebuttonUnderline.handler_unblock(self.togglebuttonUnderlineHandler)
+ self.togglebuttonStrikethrough.handler_unblock(self.togglebuttonStrikethroughHandler)
+ self.checkbuttonBackground.handler_unblock(self.checkbuttonBackgroundHandler)
+ self.checkbuttonForeground.handler_unblock(self.checkbuttonForegroundHandler)
+
+ def on_language_selected(self, combo):
+
+ tree_iter = combo.get_active_iter()
+ if tree_iter != None:
+ model = combo.get_model()
+ self.selectedLanguageName = model[tree_iter][0]
+ self.selectedLanguageId = self.langMapNameToId[self.selectedLanguageName]
+
+ self.liststoreStyles.clear()
+
+ # remove the language namespace thing from the style name
+ removeLen = len(self.selectedLanguageId) + 1
+
+ thisLanguage = self.languageManager.get_language(self.selectedLanguageId)
+
+ if thisLanguage != None:
+ styleIds = thisLanguage.get_style_ids()
+
+ styleIds.sort() # make the styles list alphabetical
+
+ if self.selectedLanguageId == 'def':
+ for styleId in self.guiStyleIds:
+ self.liststoreStyles.append([styleId])
+
+ for styleId in styleIds:
+ self.liststoreStyles.append([styleId[removeLen:]])
+
+ # select the first style in the list
+ treeIter = self.treeviewStyles.get_model().get_iter_first()
+ self.treeviewStylesSelection.select_iter(treeIter)
+ model = self.treeviewStyles.get_model()
+ self.selectedStyleId = model[treeIter][0]
+
+ # update the sample view
+ if self.selectedLanguageId in samples:
+ self.sourceBuffer.set_language(thisLanguage);
+ self.sourceBuffer.set_text(samples[self.selectedLanguageId])
+ self.labelSample.set_text(self.selectedLanguageName + ' sample')
+ elif self.bufferLanguageId in samples:
+ self.sourceBuffer.set_language(self.bufferLanguage)
+ self.sourceBuffer.set_text(samples[self.bufferLanguageId])
+ self.labelSample.set_text(self.bufferLanguageName + ' sample')
+ else:
+ self.sourceBuffer.set_language(self.defaultLanguage);
+ self.sourceBuffer.set_text(samples[self.defaultLanguageId])
+ self.labelSample.set_text(self.defaultLanguageName + ' sample')
+
+
+def message_dialog(dialog_type, shortMsg, longMsg=None, parent=None,
+ buttons=Gtk.ButtonsType.OK, additional_buttons=None):
+
+ d = Gtk.MessageDialog(parent=parent, flags=Gtk.DialogFlags.MODAL,
+ type=dialog_type, buttons=buttons)
+
+ if additional_buttons:
+ d.add_buttons(*additional_buttons)
+
+ d.set_markup(shortMsg)
+
+ if longMsg:
+ if isinstance(longMsg, Gtk.Widget):
+ widget = longMsg
+ elif isinstance(longMsg, str):
+ widget = Gtk.Label()
+ widget.set_markup(longMsg)
+ else:
+ raise TypeError('"longMsg" must be a Gtk.Widget or a string')
+
+ expander = Gtk.Expander(label = 'Click here for details')
+ expander.set_border_width(6)
+ expander.add(widget)
+ d.vbox.pack_end(expander, True, True, 0)
+
+ d.show_all()
+ response = d.run()
+ d.destroy()
+ return response
+
diff --git a/plugins/colorschemer/schemer/schemer.ui b/plugins/colorschemer/schemer/schemer.ui
new file mode 100644
index 0000000..78ee5cf
--- /dev/null
+++ b/plugins/colorschemer/schemer/schemer.ui
@@ -0,0 +1,633 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtksourceview 3.0 -->
+ <object class="GtkListStore" id="liststoreLanguages">
+ <columns>
+ <!-- column-name gchararray2 -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
+ <object class="GtkListStore" id="liststoreStyles">
+ <columns>
+ <!-- column-name gchararray1 -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
+ <object class="GtkWindow" id="window">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="title" translatable="yes">Scheme Editor</property>
+ <property name="window_position">center</property>
+ <property name="default_width">700</property>
+ <property name="default_height">550</property>
+ <signal name="destroy" handler="destroy" swapped="no"/>
+ <child>
+ <object class="GtkVBox" id="vbox20">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkVBox" id="vbox21">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkHBox" id="hbox35">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">3</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkBox" id="boxLanguages">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkComboBox" id="comboboxLanguages">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="model">liststoreLanguages</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext1"/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindowLanguages">
+ <property name="width_request">200</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="shadow_type">etched-in</property>
+ <child>
+ <object class="GtkTreeView" id="treeviewStyles">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="model">liststoreStyles</property>
+ <property name="headers_visible">False</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview-selection1"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+ <property name="title" translatable="yes">X</property>
+ <child>
+ <object class="GtkCellRendererSpin" id="cellrendererspin1"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="boxStyleAndSample">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkBox" id="box1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">4</property>
+ <child>
+ <object class="GtkVBox" id="vboxStyles">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <property name="margin_left">16</property>
+ <property name="margin_bottom">10</property>
+ <property name="spacing">10</property>
+ <child>
+ <object class="GtkHBox" id="hbox36">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="homogeneous">True</property>
+ <child>
+ <object class="GtkToggleButton" id="togglebuttonBold">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip_markup" translatable="yes">Bold</property>
+ <property name="tooltip_text" translatable="yes">Bold</property>
+ <property name="use_action_appearance">False</property>
+ <property name="relief">none</property>
+ <child>
+ <object class="GtkImage" id="image30">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-bold</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleButton" id="togglebuttonItalic">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip_markup" translatable="yes">Italic</property>
+ <property name="tooltip_text" translatable="yes">Italic</property>
+ <property name="use_action_appearance">False</property>
+ <property name="relief">none</property>
+ <child>
+ <object class="GtkImage" id="image31">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-italic</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleButton" id="togglebuttonUnderline">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip_markup" translatable="yes">Underline</property>
+ <property name="tooltip_text" translatable="yes">Underline</property>
+ <property name="use_action_appearance">False</property>
+ <property name="relief">none</property>
+ <child>
+ <object class="GtkImage" id="image32">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-underline</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleButton" id="togglebuttonStrikethrough">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip_markup"
translatable="yes">Strikethrough</property>
+ <property name="tooltip_text" translatable="yes">Strikethrough</property>
+ <property name="use_action_appearance">False</property>
+ <property name="relief">none</property>
+ <child>
+ <object class="GtkImage" id="image33">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-strikethrough</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkTable" id="table8">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">12</property>
+ <child>
+ <object class="GtkColorButton" id="colorbuttonBackground">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="title" translatable="yes">Pick the background
color</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkColorButton" id="colorbuttonForeground">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="title" translatable="yes">Pick the foreground
color</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="checkbuttonBackground">
+ <property name="label" translatable="yes">_Background</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="halign">start</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="checkbuttonForeground">
+ <property name="label" translatable="yes">_Foreground</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="halign">start</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="resetButton">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <child>
+ <object class="GtkAlignment" id="alignment7">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <child>
+ <object class="GtkHBox" id="hbox37">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkImage" id="image34">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-undo</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label41">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">_Clear </property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="boxMetadata">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_left">30</property>
+ <property name="margin_right">10</property>
+ <property name="margin_bottom">5</property>
+ <property name="border_width">7</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">1</property>
+ <child>
+ <object class="GtkLabel" id="labelName">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Name</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entryName">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="labelId">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Id</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entryId">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="labelDescription">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Description</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entryDescription">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="invisible_char_set">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="labelAuthor">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Author</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entryAuthor">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">7</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="boxSample">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="labelSample">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Sample</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindowSample">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkSourceView" id="gtksourceviewSample">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="left_margin">2</property>
+ <property name="right_margin">2</property>
+ <property name="show_line_numbers">True</property>
+ <property name="tab_width">4</property>
+ <property name="auto_indent">True</property>
+ <property name="indent_on_tab">False</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButtonBox" id="buttonbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">4</property>
+ <property name="spacing">10</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="buttonCancel">
+ <property name="label">gtk-cancel</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="buttonSave">
+ <property name="label">gtk-save</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="padding">12</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]