Commit 63512a51 authored by Steve Frécinaux's avatar Steve Frécinaux Committed by Paolo Borelli

Use a GtkSourceView and text wrapping for command text view. Also fix bug

2006-02-22  Steve Frécinaux  <steve@istique.net>

	* plugins/externaltools/tools/tools.glade:
	* plugins/externaltools/tools/manager.py:

	Use a GtkSourceView and text wrapping for command text view.
	Also fix bug #331114 by removing all the size requests.
parent 2b1965a4
2006-02-22 Steve Frécinaux <steve@istique.net>
* plugins/externaltools/tools/tools.glade:
* plugins/externaltools/tools/manager.py:
Use a GtkSourceView and text wrapping for command text view.
Also fix bug #331114 by removing all the size requests.
2006-02-22 Jesse van den Kieboom <jesse@icecrew.nl>
* plugins/snippets/snippets/SnippetsLibrary.py: fixed get_snippets()
......
......@@ -19,6 +19,7 @@
__all__ = ('Manager', )
import gtk
import gtksourceview as gsv
from gtk import glade
import os.path
from gettext import gettext as _
......@@ -30,12 +31,10 @@ class Manager:
GLADE_FILE = os.path.join(os.path.dirname(__file__), "tools.glade")
GCONF_DIR = '/apps/gedit-2/plugins/tools'
LABEL_COLUMN = 0 # For Combo and Tree
NODE_COLUMN = 1 # For Tree only
NAME_COLUMN = 1 # For Combo only
__shared_state = None
combobox_items = {
......@@ -80,6 +79,7 @@ class Manager:
}
# Load the "main-window" widget from the glade file.
glade.set_custom_handler(self.custom_handler)
self.ui = glade.XML(self.GLADE_FILE, 'tool-manager-dialog')
self.ui.signal_autoconnect(callbacks)
self.dialog = self.ui.get_widget('tool-manager-dialog')
......@@ -127,6 +127,21 @@ class Manager:
"""Convenience function to get a widget from its name"""
return self.ui.get_widget(key)
def custom_handler(self, xml, function_name, widget_name,
str1, str2, int1 , int2):
if function_name == 'create_commands':
buf = gsv.SourceBuffer()
manager = gsv.SourceLanguagesManager()
language = manager.get_language_from_mime_type('text/x-shellscript')
buf.set_language(language)
buf.set_highlight(True)
view = gsv.SourceView(buf)
view.set_wrap_mode(gtk.WRAP_WORD)
view.show()
return view
else:
return None
def set_active_by_name(self, combo_name, option_name):
combo = self[combo_name]
model = combo.get_model()
......@@ -233,7 +248,7 @@ class Manager:
def on_view_selection_changed(self, selection, userdata):
self.save_current_tool()
piter, node = self.get_selected_tool()
self['remove-tool-button'].set_sensitive(piter is not None)
if node is not None:
......
......@@ -159,11 +159,10 @@
<property name="border_width">6</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="position">160</property>
<property name="position">1</property>
<child>
<widget class="GtkVBox" id="vbox2">
<property name="width_request">200</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
......@@ -225,7 +224,6 @@
<child>
<widget class="GtkHBox" id="hbox2">
<property name="width_request">180</property>
<property name="visible">True</property>
<property name="homogeneous">True</property>
<property name="spacing">8</property>
......@@ -250,7 +248,6 @@
<child>
<widget class="GtkButton" id="remove-tool-button">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_default">True</property>
<property name="label">gtk-remove</property>
<property name="use_stock">True</property>
......@@ -280,7 +277,6 @@
<child>
<widget class="GtkVBox" id="vbox5">
<property name="width_request">400</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
......@@ -380,28 +376,6 @@
</packing>
</child>
<child>
<widget class="GtkEntry" id="description">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes" context="yes">Run “make” in the document dir</property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
<signal name="focus_out_event" handler="on_description_focus_out" last_modification_time="Fri, 13 Jan 2006 17:37:56 GMT"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label3">
<property name="visible">True</property>
......@@ -431,30 +405,6 @@
</packing>
</child>
<child>
<widget class="GtkEntry" id="accelerator">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes" context="yes">F7</property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
<signal name="focus_out_event" handler="on_accelerator_focus_out" last_modification_time="Mon, 16 Jan 2006 00:02:25 GMT"/>
<signal name="focus_in_event" handler="on_accelerator_focus_in" last_modification_time="Mon, 16 Jan 2006 00:02:39 GMT"/>
<signal name="key_press_event" handler="on_accelerator_key_press" last_modification_time="Mon, 16 Jan 2006 00:02:58 GMT"/>
</widget>
<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="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label6">
<property name="label" translatable="yes" context="yes">_Save:</property>
......@@ -541,58 +491,27 @@
</child>
<child>
<widget class="GtkComboBox" id="output">
<property name="visible">True</property>
<property name="items" translatable="yes"></property>
<property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property>
<signal name="focus_out_event" handler="on_output_focus_out" last_modification_time="Sun, 15 Jan 2006 12:52:08 GMT"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow3">
<widget class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTextView" id="commands">
<property name="height_request">120</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="overwrite">False</property>
<property name="accepts_tab">True</property>
<property name="justification">GTK_JUSTIFY_LEFT</property>
<property name="wrap_mode">GTK_WRAP_NONE</property>
<property name="cursor_visible">True</property>
<property name="pixels_above_lines">0</property>
<property name="pixels_below_lines">0</property>
<property name="pixels_inside_wrap">0</property>
<property name="left_margin">0</property>
<property name="right_margin">0</property>
<property name="indent">0</property>
<property name="text" translatable="yes">cd $GEDIT_CURRENT_DOCUMENT_DIR
make</property>
<signal name="focus_out_event" handler="on_commands_focus_out" last_modification_time="Sun, 15 Jan 2006 10:06:22 GMT"/>
</widget>
</child>
<property name="label" translatable="yes" context="yes">Co_mmand(s):</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">scrolledwindow3</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
......@@ -601,19 +520,19 @@ make</property>
</child>
<child>
<widget class="GtkLabel" id="label4">
<widget class="GtkLabel" id="label23">
<property name="visible">True</property>
<property name="label" translatable="yes" context="yes">Co_mmand(s):</property>
<property name="label" translatable="yes">_Applicability:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">scrolledwindow3</property>
<property name="mnemonic_widget">applicability</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
......@@ -622,10 +541,10 @@ make</property>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
......@@ -643,7 +562,7 @@ All documents</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="x_options">expand|shrink|fill</property>
<property name="y_options">fill</property>
</packing>
</child>
......@@ -661,37 +580,26 @@ All documents</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">fill</property>
<property name="x_options">expand|shrink|fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label23">
<widget class="GtkComboBox" id="output">
<property name="visible">True</property>
<property name="label" translatable="yes">_Applicability:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">applicability</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
<property name="items" translatable="yes"></property>
<property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property>
<signal name="focus_out_event" handler="on_output_focus_out" last_modification_time="Sun, 15 Jan 2006 12:52:08 GMT"/>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">expand|shrink|fill</property>
<property name="y_options">fill</property>
</packing>
</child>
......@@ -708,10 +616,86 @@ All documents</property>
<property name="right_attach">2</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">fill</property>
<property name="x_options">expand|shrink|fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="accelerator">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes" context="yes">F7</property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
<signal name="focus_out_event" handler="on_accelerator_focus_out" last_modification_time="Mon, 16 Jan 2006 00:02:25 GMT"/>
<signal name="focus_in_event" handler="on_accelerator_focus_in" last_modification_time="Mon, 16 Jan 2006 00:02:39 GMT"/>
<signal name="key_press_event" handler="on_accelerator_key_press" last_modification_time="Mon, 16 Jan 2006 00:02:58 GMT"/>
</widget>
<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">expand|shrink|fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="description">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes" context="yes">Run “make” in the document dir</property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
<signal name="focus_out_event" handler="on_description_focus_out" last_modification_time="Fri, 13 Jan 2006 17:37:56 GMT"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">expand|shrink|fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow3">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="Custom" id="commands">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="creation_function">create_commands</property>
<property name="int1">0</property>
<property name="int2">0</property>
<property name="last_modification_time">Thu, 23 Feb 2006 00:29:56 GMT</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment