Michael's latest batch of new gnome files.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3387 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2002-01-16 12:31:39 +00:00
parent 3f0903efb0
commit 704cbee94b
4 changed files with 692 additions and 0 deletions

View File

@ -0,0 +1,108 @@
from xml.sax import *
import re, sys
###
# Real name. This RE distinguishes 'filler' widgets from the
# widgets we actually care about.
###
rn = re.compile(r"^r_")
def cppClass(gladeClass):
gtk = re.compile(r"^Gtk")
gnome = re.compile(r"^Gnome")
if gtk.search(gladeClass):
return "Gtk::" + gladeClass[3:]
elif gnome.search(gladeClass):
return "Gnome::" + gladeClass[5:]
class widget:
def __init__(self, clss, name):
self.clss = cppClass(clss)
self.name = name
def getAccessor(self):
function = ""
function += self.clss + " * " + dialog +"::" + self.name
function += "() const \n{\n return getWidget<" + self.clss
function += ">(\"" + "r_" + self.name + "\");\n}\n"
return function
def getDeclaration(self):
function = "/// generated by accessors.py\n"
function += self.clss + " * " + self.name
function += "() const;\n";
return function
class GnomeFrontendHandler(ContentHandler):
def __init__(self):
self.elemstack = []
self.widget = 0
self.TODO = []
def startElement(self, name, attrs):
self.elemstack.append(name)
def endElement(self, name):
self.elemstack.pop()
if name == "widget":
self.currclass = ""
def characters(self, data):
elem = self.elemstack[-1]
if elem == "class":
self.currclass = data
elif elem == "name":
if rn.search(data):
self.TODO.append(widget(self.currclass,
re.sub("^r_", "", data)))
def widgets(self):
return self.TODO
dialog = sys.argv[2]
glade = open(sys.argv[1])
## parse the document
prs = make_parser()
hndlr = GnomeFrontendHandler()
prs.setContentHandler(hndlr)
prs.parse(glade)
## write the definitions to .C_gen
dotC = open(dialog + ".C_gen", "w+")
for i in hndlr.widgets():
dotC.write( i.getAccessor())
dotC.close()
## write the declarations to .h_gen
dotH = open(dialog + ".h_gen", "w+")
for i in hndlr.widgets():
dotH.write( i.getDeclaration())
dotH.close()

View File

@ -0,0 +1,100 @@
<?xml version="1.0"?>
<GTK-Interface>
<project>
<name>diainserturl</name>
<program_name>diainserturl</program_name>
<directory></directory>
<source_directory></source_directory>
<pixmaps_directory>pixmaps</pixmaps_directory>
<language>C</language>
<gnome_support>True</gnome_support>
<gettext_support>True</gettext_support>
<use_widget_names>True</use_widget_names>
<output_main_file>False</output_main_file>
<output_build_files>False</output_build_files>
<gnome_help_support>True</gnome_help_support>
<main_source_file>diainserturl_interface.c</main_source_file>
<main_header_file>diainserturl_interface.h</main_header_file>
<handler_source_file>diainserturl_callbacks.c</handler_source_file>
<handler_header_file>diainserturl_callbacks.h</handler_header_file>
</project>
<widget>
<class>GnomeDialog</class>
<name>FormError</name>
<title>Error</title>
<type>GTK_WINDOW_DIALOG</type>
<position>GTK_WIN_POS_NONE</position>
<modal>False</modal>
<allow_shrink>False</allow_shrink>
<allow_grow>True</allow_grow>
<auto_shrink>False</auto_shrink>
<auto_close>False</auto_close>
<hide_on_close>True</hide_on_close>
<widget>
<class>GtkVBox</class>
<child_name>GnomeDialog:vbox</child_name>
<name>dialog-vbox1</name>
<homogeneous>False</homogeneous>
<spacing>8</spacing>
<child>
<padding>4</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkHButtonBox</class>
<child_name>GnomeDialog:action_area</child_name>
<name>dialog-action_area1</name>
<layout_style>GTK_BUTTONBOX_END</layout_style>
<spacing>8</spacing>
<child_min_width>85</child_min_width>
<child_min_height>27</child_min_height>
<child_ipad_x>7</child_ipad_x>
<child_ipad_y>0</child_ipad_y>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
<pack>GTK_PACK_END</pack>
</child>
<widget>
<class>GtkButton</class>
<name>r_button_close</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<stock_button>GNOME_STOCK_BUTTON_CLOSE</stock_button>
</widget>
</widget>
<widget>
<class>GtkScrolledWindow</class>
<name>scrolledwindow1</name>
<hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_NEVER</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkText</class>
<name>r_textarea</name>
<width>250</width>
<height>200</height>
<can_focus>True</can_focus>
<editable>False</editable>
<text></text>
</widget>
</widget>
</widget>
</widget>
</GTK-Interface>

View File

@ -0,0 +1,215 @@
<?xml version="1.0"?>
<GTK-Interface>
<project>
<name>DiaInsertTabular</name>
<program_name>diainserttabular</program_name>
<directory></directory>
<source_directory>src</source_directory>
<pixmaps_directory>pixmaps</pixmaps_directory>
<language>C</language>
<gnome_support>True</gnome_support>
<gettext_support>True</gettext_support>
</project>
<widget>
<class>GnomeDialog</class>
<name>FormTabularCreate</name>
<title>Insert Tabular</title>
<type>GTK_WINDOW_DIALOG</type>
<position>GTK_WIN_POS_NONE</position>
<modal>False</modal>
<allow_shrink>False</allow_shrink>
<allow_grow>False</allow_grow>
<auto_shrink>False</auto_shrink>
<auto_close>False</auto_close>
<hide_on_close>True</hide_on_close>
<widget>
<class>GtkVBox</class>
<child_name>GnomeDialog:vbox</child_name>
<name>dialog-vbox1</name>
<homogeneous>False</homogeneous>
<spacing>8</spacing>
<child>
<padding>4</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkHButtonBox</class>
<child_name>GnomeDialog:action_area</child_name>
<name>dialog-action_area1</name>
<layout_style>GTK_BUTTONBOX_END</layout_style>
<spacing>8</spacing>
<child_min_width>85</child_min_width>
<child_min_height>27</child_min_height>
<child_ipad_x>7</child_ipad_x>
<child_ipad_y>0</child_ipad_y>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
<pack>GTK_PACK_END</pack>
</child>
<widget>
<class>GtkButton</class>
<name>r_ok_btn</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
</widget>
<widget>
<class>GtkButton</class>
<name>r_apply_btn</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<stock_button>GNOME_STOCK_BUTTON_APPLY</stock_button>
</widget>
<widget>
<class>GtkButton</class>
<name>r_cancel_btn</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
</widget>
</widget>
<widget>
<class>GtkTable</class>
<name>table1</name>
<rows>2</rows>
<columns>2</columns>
<homogeneous>True</homogeneous>
<row_spacing>0</row_spacing>
<column_spacing>0</column_spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>label2</name>
<label>Rows</label>
<justify>GTK_JUSTIFY_RIGHT</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label3</name>
<label>Columns</label>
<justify>GTK_JUSTIFY_RIGHT</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkSpinButton</class>
<name>r_rows</name>
<can_focus>True</can_focus>
<climb_rate>1</climb_rate>
<digits>0</digits>
<numeric>False</numeric>
<update_policy>GTK_UPDATE_ALWAYS</update_policy>
<snap>False</snap>
<wrap>False</wrap>
<value>1</value>
<lower>1</lower>
<upper>50</upper>
<step>1</step>
<page>10</page>
<page_size>10</page_size>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkSpinButton</class>
<name>r_cols</name>
<can_focus>True</can_focus>
<climb_rate>1</climb_rate>
<digits>0</digits>
<numeric>False</numeric>
<update_policy>GTK_UPDATE_ALWAYS</update_policy>
<snap>False</snap>
<wrap>False</wrap>
<value>1</value>
<lower>1</lower>
<upper>50</upper>
<step>1</step>
<page>10</page>
<page_size>10</page_size>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
</widget>
</widget>
</widget>
</GTK-Interface>

View File

@ -0,0 +1,269 @@
<?xml version="1.0"?>
<GTK-Interface>
<project>
<name>diainserturl</name>
<program_name>diainserturl</program_name>
<directory></directory>
<source_directory></source_directory>
<pixmaps_directory>pixmaps</pixmaps_directory>
<language>C</language>
<gnome_support>True</gnome_support>
<gettext_support>True</gettext_support>
<use_widget_names>True</use_widget_names>
<output_main_file>False</output_main_file>
<output_build_files>False</output_build_files>
<gnome_help_support>True</gnome_help_support>
<main_source_file>diainserturl_interface.c</main_source_file>
<main_header_file>diainserturl_interface.h</main_header_file>
<handler_source_file>diainserturl_callbacks.c</handler_source_file>
<handler_header_file>diainserturl_callbacks.h</handler_header_file>
</project>
<widget>
<class>GnomeDialog</class>
<name>FormUrl</name>
<border_width>2</border_width>
<visible>False</visible>
<title>Insert URL</title>
<type>GTK_WINDOW_DIALOG</type>
<position>GTK_WIN_POS_NONE</position>
<modal>False</modal>
<allow_shrink>True</allow_shrink>
<allow_grow>True</allow_grow>
<auto_shrink>False</auto_shrink>
<auto_close>False</auto_close>
<hide_on_close>True</hide_on_close>
<widget>
<class>GtkVBox</class>
<child_name>GnomeDialog:vbox</child_name>
<name>dialog-vbox1</name>
<homogeneous>False</homogeneous>
<spacing>8</spacing>
<child>
<padding>4</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkHButtonBox</class>
<child_name>GnomeDialog:action_area</child_name>
<name>dialog-action_area1</name>
<layout_style>GTK_BUTTONBOX_DEFAULT_STYLE</layout_style>
<spacing>8</spacing>
<child_min_width>85</child_min_width>
<child_min_height>27</child_min_height>
<child_ipad_x>7</child_ipad_x>
<child_ipad_y>0</child_ipad_y>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
<pack>GTK_PACK_END</pack>
</child>
<widget>
<class>GtkButton</class>
<name>r_restore_btn</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<label>Restore</label>
<stock_pixmap>GNOME_STOCK_PIXMAP_UNDO</stock_pixmap>
</widget>
<widget>
<class>GtkButton</class>
<name>r_ok_btn</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
</widget>
<widget>
<class>GtkButton</class>
<name>r_apply_btn</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<stock_button>GNOME_STOCK_BUTTON_APPLY</stock_button>
</widget>
<widget>
<class>GtkButton</class>
<name>r_cancel_btn</name>
<can_default>True</can_default>
<has_default>True</has_default>
<can_focus>True</can_focus>
<stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
</widget>
</widget>
<widget>
<class>GtkVBox</class>
<name>vbox1</name>
<homogeneous>False</homogeneous>
<spacing>2</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkTable</class>
<name>table1</name>
<rows>2</rows>
<columns>2</columns>
<homogeneous>False</homogeneous>
<row_spacing>2</row_spacing>
<column_spacing>2</column_spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>label2</name>
<label>_Name</label>
<justify>GTK_JUSTIFY_LEFT</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<default_focus_target>r_name</default_focus_target>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>False</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label1</name>
<label>_URL</label>
<justify>GTK_JUSTIFY_LEFT</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<default_focus_target>r_url</default_focus_target>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GnomeEntry</class>
<name>url1</name>
<border_width>1</border_width>
<history_id>FormUrl_url</history_id>
<max_saved>10</max_saved>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
<widget>
<class>GtkEntry</class>
<child_name>GnomeEntry:entry</child_name>
<name>r_url</name>
<can_default>True</can_default>
<has_default>True</has_default>
<can_focus>True</can_focus>
<has_focus>True</has_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
</widget>
</widget>
<widget>
<class>GnomeEntry</class>
<name>name1</name>
<border_width>1</border_width>
<history_id>FormUrl_name</history_id>
<max_saved>10</max_saved>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
<widget>
<class>GtkEntry</class>
<child_name>GnomeEntry:entry</child_name>
<name>r_name</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
</widget>
</widget>
</widget>
<widget>
<class>GtkCheckButton</class>
<name>r_html_cb</name>
<border_width>2</border_width>
<can_focus>True</can_focus>
<label>_HTML type</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
</widget>
</widget>
</GTK-Interface>