diff --git a/generateDS.py b/generateDS.py index 49c5ef21f9b09e36ac7104da89eb2e30fd0fd661..e63e492631e33ec8c96707ded22a2a309480c1b3 100755 --- a/generateDS.py +++ b/generateDS.py @@ -290,6 +290,7 @@ NonNegativeIntegerType = None BooleanType = None FloatType = None DoubleType = None +NumericTypes = None ElementType = None ComplexTypeType = None GroupType = None @@ -2652,8 +2653,8 @@ def generateExportAttributes(wrt, element, hasAttributes): attrDefType == TokenType or attrDefType in DateTimeGroupType): s1 = '''%s outfile.write(' %s=%%s' %% ''' \ - '''(self.gds_encode(self.gds_format_string(quote_attrib(''' \ - '''self.%s), ''' \ + '''(self.gds_encode(self.gds_format_string(''' \ + '''quote_attrib(self.%s), ''' \ '''input_name='%s')), ))\n''' % \ (indent, orig_name, cleanName, name, ) elif (attrDefType in IntegerType or @@ -2952,7 +2953,7 @@ def generateExportLiteralFn_1(wrt, child, name, fill): wrt("%s outfile.write('%s=%%s,\\n' %% " "self.gds_encode(quote_python(' '.join(self.%s)))" ") \n" % - (fill, mappedName, mappedName, encoding, )) + (fill, mappedName, mappedName, )) wrt("%s else:\n" % (fill, )) wrt("%s outfile.write('%s=None,\\n')\n" % (fill, mappedName, )) @@ -6778,6 +6779,48 @@ def fixSilence(txt, silent): return txt +def capture_cleanup_name_list(option): + cleanupNameList = [] + if not option: + return cleanupNameList + cleanup_str = option + from ast import literal_eval + try: + cleanup_list = literal_eval(cleanup_str) + except ValueError: + raise RuntimeError( + 'Unable to parse option --cleanup-name-list.') + if type(cleanup_list) not in (list, tuple): + raise RuntimeError( + 'Option --cleanup-name-list must be a list or a tuple.') + for cleanup_pair in cleanup_list: + if sys.version_info.major == 2: + if (type(cleanup_pair) not in (list, tuple) or + len(cleanup_pair) != 2 or + not isinstance(cleanup_pair[0], BaseStrType) or + not isinstance(cleanup_pair[1], BaseStrType)): + raise RuntimeError( + 'Option --cleanup-name-list contains ' + 'invalid element.') + else: + if (type(cleanup_pair) not in (list, tuple) or + len(cleanup_pair) != 2 or + not isinstance(cleanup_pair[0], str) or + not isinstance(cleanup_pair[1], str)): + raise RuntimeError( + 'Option --cleanup-name-list contains ' + 'invalid element.') + try: + cleanupNameList.append( + (re.compile(cleanup_pair[0]), cleanup_pair[1])) + except Exception: + raise RuntimeError( + 'Option --cleanup-name-list contains invalid ' + 'pattern "%s".' + % cleanup_pair[0]) + return cleanupNameList + + def err_msg(msg): sys.stderr.write(msg) @@ -6893,6 +6936,28 @@ def main(): ExternalEncoding = sessionObj.get_external_encoding() if sessionObj.get_member_specs() in ('list', 'dict'): MemberSpecs = sessionObj.get_member_specs() + exports = sessionObj.get_export_spec() + if exports: + ExportWrite = False + ExportEtree = False + ExportLiteral = False + exports = exports.split() + if 'write' in exports: + ExportWrite = True + if 'etree' in exports: + ExportEtree = True + if 'literal' in exports: + ExportLiteral = True + if sessionObj.get_one_file_per_xsd(): + SingleFileOutput = False + if sessionObj.get_output_directory(): + OutputDirectory = sessionObj.get_output_directory() + if sessionObj.get_module_suffix(): + ModuleSuffix = sessionObj.get_module_suffix() + if sessionObj.get_preserve_cdata_tags(): + PreserveCdataTags = True + CleanupNameList = capture_cleanup_name_list( + sessionObj.get_cleanup_name_list()) break for option in options: if option[0] == '-h' or option[0] == '--help': @@ -6979,43 +7044,7 @@ def main(): elif option[0] == "--preserve-cdata-tags": PreserveCdataTags = True elif option[0] == '--cleanup-name-list': - cleanup_str = option[1] - from ast import literal_eval - try: - cleanup_list = literal_eval(cleanup_str) - except ValueError: - raise RuntimeError( - 'Unable to parse option --cleanup-name-list.') - if type(cleanup_list) not in (list, tuple): - raise RuntimeError( - 'Option --cleanup-name-list must be a list or a tuple.') - CleanupNameList = [] - for cleanup_pair in cleanup_list: - if sys.version_info.major == 2: - if (type(cleanup_pair) not in (list, tuple) or - len(cleanup_pair) != 2 or - not isinstance(cleanup_pair[0], BaseStrType) or - not isinstance(cleanup_pair[1], BaseStrType)): - raise RuntimeError( - 'Option --cleanup-name-list contains ' - 'invalid element.') - else: - if (type(cleanup_pair) not in (list, tuple) or - len(cleanup_pair) != 2 or - not isinstance(cleanup_pair[0], str) or - not isinstance(cleanup_pair[1], str)): - raise RuntimeError( - 'Option --cleanup-name-list contains ' - 'invalid element.') - try: - CleanupNameList.append( - (re.compile(cleanup_pair[0]), cleanup_pair[1])) - except Exception: - raise RuntimeError( - 'Option --cleanup-name-list contains invalid ' - 'pattern "%s".' - % cleanup_pair[0]) - + CleanupNameList = capture_cleanup_name_list(option[1]) if showVersion: print('generateDS.py version %s' % VERSION) sys.exit(0) diff --git a/gui/generateds_gui.glade b/gui/generateds_gui.glade index db1fc98cc0256defcc0f1b141c3aa7d8afa1e32f..a64fc51ddd14ed0fd9b0d538508cb2c15065fc12 100644 --- a/gui/generateds_gui.glade +++ b/gui/generateds_gui.glade @@ -1,89 +1,186 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.18.3 --> <interface> - <requires lib="gtk+" version="2.16"/> - <!-- interface-naming-policy project-wide --> + <requires lib="gtk+" version="3.0"/> + <object class="GtkAccelGroup" id="accelgroup1"/> + <object class="GtkDialog" id="content_dialog"> + <property name="can_focus">False</property> + <property name="border_width">5</property> + <property name="title" translatable="yes">Messages and Content</property> + <property name="default_width">800</property> + <property name="default_height">600</property> + <property name="type_hint">normal</property> + <child internal-child="vbox"> + <object class="GtkBox" id="dialog-vbox3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">2</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="content_dialog_ok_button"> + <property name="label" translatable="yes">OK</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <signal name="activate" handler="on_ok_button_activate" swapped="no"/> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkScrolledWindow" id="scrolledwindow1"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="min_content_width">250</property> + <property name="min_content_height">500</property> + <child> + <object class="GtkTextView" id="content_textview"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">False</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> + <action-widgets> + <action-widget response="0">content_dialog_ok_button</action-widget> + </action-widgets> + </object> + <object class="GtkImage" id="image1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="stock">gtk-save</property> + </object> + <object class="GtkImage" id="image2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="stock">gtk-save-as</property> + </object> + <object class="GtkImage" id="image3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="stock">gtk-open</property> + </object> + <object class="GtkImage" id="image4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="stock">gtk-clear</property> + </object> <object class="GtkWindow" id="window1"> + <property name="can_focus">False</property> <accel-groups> <group name="accelgroup1"/> </accel-groups> - <signal name="delete_event" handler="on_window_delete_event"/> + <signal name="delete-event" handler="on_window_delete_event" swapped="no"/> <child> <object class="GtkVBox" id="vbox1"> <property name="visible">True</property> + <property name="can_focus">False</property> <child> <object class="GtkMenuBar" id="menubar1"> <property name="visible">True</property> + <property name="can_focus">False</property> <child> <object class="GtkMenuItem" id="menuitem1"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="label" translatable="yes">_File</property> <property name="use_underline">True</property> <child type="submenu"> <object class="GtkMenu" id="menu1"> <property name="visible">True</property> + <property name="can_focus">False</property> <child> <object class="GtkImageMenuItem" id="clear_menuitem"> <property name="label">Clear</property> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="image">image4</property> <property name="use_stock">False</property> <property name="accel_group">accelgroup1</property> + <signal name="activate" handler="on_clear_menuitem_activate" swapped="no"/> <accelerator key="n" signal="activate" modifiers="GDK_CONTROL_MASK"/> - <signal name="activate" handler="on_clear_menuitem_activate"/> </object> </child> <child> <object class="GtkImageMenuItem" id="open_session_menuitem"> <property name="label">_Load session</property> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Load a previous saved session.</property> <property name="use_underline">True</property> <property name="image">image3</property> <property name="use_stock">False</property> <property name="accel_group">accelgroup1</property> + <signal name="activate" handler="on_open_session_menuitem_activate" swapped="no"/> <accelerator key="o" signal="activate" modifiers="GDK_CONTROL_MASK"/> - <signal name="activate" handler="on_open_session_menuitem_activate"/> </object> </child> <child> <object class="GtkImageMenuItem" id="save_session_menuitem"> <property name="label">_Save session</property> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Save the current session.</property> <property name="use_underline">True</property> <property name="image">image1</property> <property name="use_stock">False</property> <property name="accel_group">accelgroup1</property> + <signal name="activate" handler="on_save_session_menuitem_activate" swapped="no"/> <accelerator key="s" signal="activate" modifiers="GDK_CONTROL_MASK"/> - <signal name="activate" handler="on_save_session_menuitem_activate"/> </object> </child> <child> <object class="GtkImageMenuItem" id="save_session_as_menuitem"> <property name="label">Save session as ...</property> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Save the current session in file chosen by the user.</property> <property name="image">image2</property> <property name="use_stock">False</property> <property name="accel_group">accelgroup1</property> - <signal name="activate" handler="on_save_session_as_menuitem_activate"/> + <signal name="activate" handler="on_save_session_as_menuitem_activate" swapped="no"/> </object> </child> <child> <object class="GtkSeparatorMenuItem" id="menuitem5"> <property name="visible">True</property> + <property name="can_focus">False</property> </object> </child> <child> <object class="GtkImageMenuItem" id="imagemenuitem5"> <property name="label">gtk-quit</property> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Exit from the application.</property> <property name="use_underline">True</property> <property name="use_stock">True</property> <property name="accel_group">accelgroup1</property> - <signal name="activate" handler="on_quit_menu_item_activate"/> + <signal name="activate" handler="on_quit_menu_item_activate" swapped="no"/> </object> </child> </object> @@ -93,30 +190,34 @@ file chosen by the user.</property> <child> <object class="GtkMenuItem" id="menuitem2"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="label" translatable="yes">_Tools</property> <property name="use_underline">True</property> <child type="submenu"> <object class="GtkMenu" id="menu2"> <property name="visible">True</property> + <property name="can_focus">False</property> <child> <object class="GtkMenuItem" id="capture_cl_menuitem"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Capture the command line that would be used to generate the bindings modules.</property> <property name="label" translatable="yes">_Capture CL</property> <property name="use_underline">True</property> + <signal name="activate" handler="on_capture_cl_menuitem_activate" swapped="no"/> <accelerator key="t" signal="activate" modifiers="GDK_CONTROL_MASK"/> - <signal name="activate" handler="on_capture_cl_menuitem_activate"/> </object> </child> <child> <object class="GtkMenuItem" id="generate_menuitem"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Generate the bindings modules.</property> <property name="label" translatable="yes">_Generate</property> <property name="use_underline">True</property> + <signal name="activate" handler="on_generate_menuitem_activate" swapped="no"/> <accelerator key="g" signal="activate" modifiers="GDK_CONTROL_MASK"/> - <signal name="activate" handler="on_generate_menuitem_activate"/> </object> </child> </object> @@ -126,19 +227,22 @@ to generate the bindings modules.</property> <child> <object class="GtkMenuItem" id="menuitem4"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="label" translatable="yes">_Help</property> <property name="use_underline">True</property> <child type="submenu"> <object class="GtkMenu" id="menu3"> <property name="visible">True</property> + <property name="can_focus">False</property> <child> <object class="GtkImageMenuItem" id="imagemenuitem10"> <property name="label">gtk-about</property> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="use_underline">True</property> <property name="use_stock">True</property> <property name="accel_group">accelgroup1</property> - <signal name="activate" handler="on_about_menu_item_activate"/> + <signal name="activate" handler="on_about_menu_item_activate" swapped="no"/> </object> </child> </object> @@ -148,1099 +252,1384 @@ to generate the bindings modules.</property> </object> <packing> <property name="expand">False</property> + <property name="fill">True</property> <property name="position">0</property> </packing> </child> <child> - <object class="GtkTable" id="table1"> + <object class="GtkScrolledWindow" id="scrolledwindow2"> <property name="visible">True</property> - <property name="n_rows">23</property> - <property name="n_columns">4</property> - <child> - <object class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Input schema file:</property> - </object> - </child> - <child> - <object class="GtkLabel" id="label2"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Output superclass file:</property> - </object> - <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label3"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Output subclass file:</property> - </object> - <packing> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label4"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Overwrite without asking:</property> - </object> - <packing> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - </packing> - </child> + <property name="can_focus">True</property> + <property name="shadow_type">in</property> + <property name="min_content_width">1000</property> + <property name="min_content_height">600</property> <child> - <object class="GtkCheckButton" id="force_checkbutton"> - <property name="label" translatable="yes">Force</property> + <object class="GtkViewport" id="viewport1"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Always overwrite output files. + <property name="can_focus">False</property> + <child> + <object class="GtkTable" id="table1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="n_rows">29</property> + <property name="n_columns">4</property> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Input schema file:</property> + <property name="xalign">0</property> + </object> + </child> + <child> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Output superclass file:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Output subclass file:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Overwrite without asking:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="force_checkbutton"> + <property name="label" translatable="yes">Force</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Always overwrite output files. Do not ask for confirmation.</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="input_schema_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">The path and name of the + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="input_schema_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">The path and name of the input XML schema defining the bindings to be generated.</property> - <property name="invisible_char">â—</property> - <property name="width_chars">80</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="output_superclass_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">The path and name of the output file + <property name="invisible_char">â—</property> + <property name="width_chars">80</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="output_superclass_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">The path and name of the output file to be generated and to contain the superclasses.</property> - <property name="invisible_char">â—</property> - <signal name="changed" handler="on_output_superclass_entry_changed"/> - </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> - </packing> - </child> - <child> - <object class="GtkEntry" id="output_subclass_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">The path and name of the output file + <property name="invisible_char">â—</property> + <signal name="changed" handler="on_output_superclass_entry_changed" swapped="no"/> + </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> + </packing> + </child> + <child> + <object class="GtkEntry" id="output_subclass_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">The path and name of the output file to be generated and to contain the subclasses.</property> - <property name="invisible_char">â—</property> - </object> - <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> - <child> - <object class="GtkLabel" id="label5"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Prefix (for class names):</property> - </object> - <packing> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="prefix_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Prefix for class names.</property> - <property name="invisible_char">â—</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label6"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Namespace prefix:</property> - </object> - <packing> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="namespace_prefix_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="events">GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property> - <property name="tooltip_text" translatable="yes">Override default namespace + <property name="invisible_char">â—</property> + </object> + <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> + <child> + <object class="GtkLabel" id="label5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Prefix (for class names):</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="prefix_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Prefix for class names.</property> + <property name="invisible_char">â—</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label6"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Namespace prefix:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">5</property> + <property name="bottom_attach">6</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="namespace_prefix_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="events">GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property> + <property name="tooltip_text" translatable="yes">Override default namespace prefix in schema file. Example: -a "xsd:" Default: "xs:".</property> - <property name="invisible_char">â—</property> - <signal name="changed" handler="on_namespace_prefix_entry_changed"/> - </object> - <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> - </packing> - </child> - <child> - <object class="GtkLabel" id="label7"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Behavior file name:</property> - </object> - <packing> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="behavior_filename_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Input file name for behaviors + <property name="invisible_char">â—</property> + <signal name="changed" handler="on_namespace_prefix_entry_changed" swapped="no"/> + </object> + <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> + </packing> + </child> + <child> + <object class="GtkLabel" id="label7"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Behavior file name:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">6</property> + <property name="bottom_attach">7</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="behavior_filename_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Input file name for behaviors added to subclasses.</property> - <property name="invisible_char">â—</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label8"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Generate Python properties:</property> - </object> - <packing> - <property name="top_attach">7</property> - <property name="bottom_attach">8</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="properties_checkbutton"> - <property name="label" translatable="yes">Properties</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Generate Python properties for member variables + <property name="invisible_char">â—</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">6</property> + <property name="bottom_attach">7</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label8"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Generate Python properties:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">7</property> + <property name="bottom_attach">8</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="properties_checkbutton"> + <property name="label" translatable="yes">Properties</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Generate Python properties for member variables so that the value can be retrieved and modified without calling getter and setter functions. </property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">7</property> - <property name="bottom_attach">8</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label9"> - <property name="visible">True</property> - <property name="tooltip_text" translatable="yes">Search these directories for additional -schema files</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Search path:</property> - </object> - <packing> - <property name="top_attach">8</property> - <property name="bottom_attach">9</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="search_path_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Search these directories for additional -schema files.</property> - <property name="invisible_char">â—</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">8</property> - <property name="bottom_attach">9</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label10"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Subclass suffix:</property> - </object> - <packing> - <property name="top_attach">9</property> - <property name="bottom_attach">10</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="subclass_suffix_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Append this text to the generated subclass names. + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">7</property> + <property name="bottom_attach">8</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label10"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Subclass suffix:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">9</property> + <property name="bottom_attach">10</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="subclass_suffix_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Append this text to the generated subclass names. Default="Sub".</property> - <property name="invisible_char">â—</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">9</property> - <property name="bottom_attach">10</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label11"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Root element:</property> - </object> - <packing> - <property name="top_attach">10</property> - <property name="bottom_attach">11</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="root_element_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Assume that this value is the name + <property name="invisible_char">â—</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">9</property> + <property name="bottom_attach">10</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label11"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Root element:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">10</property> + <property name="bottom_attach">11</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="root_element_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Assume that this value is the name of the root element of instance docs. Default is first element defined in schema.</property> - <property name="invisible_char">â—</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">10</property> - <property name="bottom_attach">11</property> - </packing> - </child> - <child> - <object class="GtkButton" id="input_schema_chooser_button"> - <property name="label" translatable="yes">Choose</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Choose the input schema file.</property> - <signal name="clicked" handler="on_input_schema_chooser_button_clicked"/> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - </packing> - </child> - <child> - <object class="GtkButton" id="output_superclass_chooser_button"> - <property name="label" translatable="yes">Choose</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Choose the output superclass bindings file.</property> - <signal name="clicked" handler="on_output_superclass_chooser_button_clicked"/> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - </packing> - </child> - <child> - <object class="GtkButton" id="output_subclass_chooser_button"> - <property name="label" translatable="yes">Choose</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Choose the output subclass bindings file.</property> - <signal name="clicked" handler="on_output_subclass_chooser_button_clicked"/> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - </packing> - </child> - <child> - <object class="GtkButton" id="behavior_filename_chooser_button"> - <property name="label" translatable="yes">Choose</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Choose the nput file name for + <property name="invisible_char">â—</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">10</property> + <property name="bottom_attach">11</property> + </packing> + </child> + <child> + <object class="GtkButton" id="input_schema_chooser_button"> + <property name="label" translatable="yes">Choose</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Choose the input schema file.</property> + <signal name="clicked" handler="on_input_schema_chooser_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + </packing> + </child> + <child> + <object class="GtkButton" id="output_superclass_chooser_button"> + <property name="label" translatable="yes">Choose</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Choose the output superclass bindings file.</property> + <signal name="clicked" handler="on_output_superclass_chooser_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + </packing> + </child> + <child> + <object class="GtkButton" id="output_subclass_chooser_button"> + <property name="label" translatable="yes">Choose</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Choose the output subclass bindings file.</property> + <signal name="clicked" handler="on_output_subclass_chooser_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + </packing> + </child> + <child> + <object class="GtkButton" id="behavior_filename_chooser_button"> + <property name="label" translatable="yes">Choose</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Choose the nput file name for behaviors added to subclasses.</property> - <signal name="clicked" handler="on_behavior_filename_chooser_button_clicked"/> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label12"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Superclass module:</property> - </object> - <packing> - <property name="top_attach">11</property> - <property name="bottom_attach">12</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="superclass_module_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Superclass module name in subclass module. + <signal name="clicked" handler="on_behavior_filename_chooser_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">6</property> + <property name="bottom_attach">7</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label12"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Superclass module:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">11</property> + <property name="bottom_attach">12</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="superclass_module_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Superclass module name in subclass module. Default="???".</property> - <property name="invisible_char">â—</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">11</property> - <property name="bottom_attach">12</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label13"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Use old getters and setters:</property> - </object> - <packing> - <property name="top_attach">12</property> - <property name="bottom_attach">13</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="old_getters_setters_checkbutton"> - <property name="label" translatable="yes">Old getters and setters</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Name getters and setters getVar() and setVar(), + <property name="invisible_char">â—</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">11</property> + <property name="bottom_attach">12</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label13"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Use old getters and setters:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">12</property> + <property name="bottom_attach">13</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="old_getters_setters_checkbutton"> + <property name="label" translatable="yes">Old getters and setters</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Name getters and setters getVar() and setVar(), instead of get_var() and set_var().</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">12</property> - <property name="bottom_attach">13</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label14"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Validator bodies path:</property> - </object> - <packing> - <property name="top_attach">13</property> - <property name="bottom_attach">14</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label15"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">User methods module:</property> - </object> - <packing> - <property name="top_attach">14</property> - <property name="bottom_attach">15</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label16"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">No dates:</property> - </object> - <packing> - <property name="top_attach">15</property> - <property name="bottom_attach">16</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label17"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">No versions:</property> - </object> - <packing> - <property name="top_attach">16</property> - <property name="bottom_attach">17</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="no_dates_checkbutton"> - <property name="label" translatable="yes">No dates in generated output</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Do not include the current date in the generated + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">12</property> + <property name="bottom_attach">13</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label14"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Validator bodies path:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">13</property> + <property name="bottom_attach">14</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label15"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">User methods module:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">14</property> + <property name="bottom_attach">15</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label16"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">No dates:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">15</property> + <property name="bottom_attach">16</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label17"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">No versions:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">16</property> + <property name="bottom_attach">17</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="no_dates_checkbutton"> + <property name="label" translatable="yes">No dates in generated output</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Do not include the current date in the generated files. This is useful if you want to minimize the amount of (no-operation) changes to the generated python code.</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">15</property> - <property name="bottom_attach">16</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="validator_bodies_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Path to a directory containing files that provide + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">15</property> + <property name="bottom_attach">16</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="validator_bodies_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Path to a directory containing files that provide bodies (implementations) of validator methods.</property> - <property name="invisible_char">â—</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">13</property> - <property name="bottom_attach">14</property> - </packing> - </child> - <child> - <object class="GtkButton" id="validator_bodies_chooser_button"> - <property name="label" translatable="yes">Choose</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Choose the path to a directory containing files that provide + <property name="invisible_char">â—</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">13</property> + <property name="bottom_attach">14</property> + </packing> + </child> + <child> + <object class="GtkButton" id="validator_bodies_chooser_button"> + <property name="label" translatable="yes">Choose</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Choose the path to a directory containing files that provide bodies (implementations) of validator methods.</property> - <signal name="clicked" handler="on_validator_bodies_chooser_button_clicked"/> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">13</property> - <property name="bottom_attach">14</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="no_versions_checkbutton"> - <property name="label" translatable="yes">No version info in generated output</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Do not include the current version in the generated + <signal name="clicked" handler="on_validator_bodies_chooser_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">13</property> + <property name="bottom_attach">14</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="no_versions_checkbutton"> + <property name="label" translatable="yes">No version info in generated output</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Do not include the current version in the generated files. This is useful if you want to minimize the amount of (no-operation) changes to the generated python code.</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">16</property> - <property name="bottom_attach">17</property> - </packing> - </child> - <child> - <object class="GtkButton" id="user_methods_button"> - <property name="label" translatable="yes">Choose</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Choose the optional module containing user methods. See + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">16</property> + <property name="bottom_attach">17</property> + </packing> + </child> + <child> + <object class="GtkButton" id="user_methods_button"> + <property name="label" translatable="yes">Choose</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Choose the optional module containing user methods. See section "User Methods" in the documentation.</property> - <signal name="clicked" handler="on_user_methods_chooser_button_clicked"/> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">14</property> - <property name="bottom_attach">15</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="user_methods_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Optional module containing user methods. See + <signal name="clicked" handler="on_user_methods_chooser_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">14</property> + <property name="bottom_attach">15</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="user_methods_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Optional module containing user methods. See section "User Methods" in the documentation.</property> - <property name="invisible_char">â—</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">14</property> - <property name="bottom_attach">15</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label18"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">No process includes:</property> - </object> - <packing> - <property name="top_attach">17</property> - <property name="bottom_attach">18</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label19"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Silence:</property> - </object> - <packing> - <property name="top_attach">18</property> - <property name="bottom_attach">19</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="no_process_includes_checkbutton"> - <property name="label" translatable="yes">Do not process includes in schema</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Do not process included XML Schema files. By + <property name="invisible_char">â—</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">14</property> + <property name="bottom_attach">15</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label18"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">No process includes:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">17</property> + <property name="bottom_attach">18</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label19"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Silence:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">18</property> + <property name="bottom_attach">19</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="no_process_includes_checkbutton"> + <property name="label" translatable="yes">Do not process includes in schema</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Do not process included XML Schema files. By default, generateDS.py will insert content from files referenced by <include ... /> elements into the XML Schema to be processed.</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">17</property> - <property name="bottom_attach">18</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="silence_checkbutton"> - <property name="label" translatable="yes">Generate code that does not echo the parsed XML</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Normally, the code generated with generateDS + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">17</property> + <property name="bottom_attach">18</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="silence_checkbutton"> + <property name="label" translatable="yes">Generate code that does not echo the parsed XML</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Normally, the code generated with generateDS echoes the information being parsed. Use this option to turn off that behavior. </property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">18</property> - <property name="bottom_attach">19</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label20"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Namespace definitions:</property> - </object> - <packing> - <property name="top_attach">19</property> - <property name="bottom_attach">20</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label21"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">External encoding:</property> - </object> - <packing> - <property name="top_attach">20</property> - <property name="bottom_attach">21</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label22"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Member specs:</property> - </object> - <packing> - <property name="top_attach">22</property> - <property name="bottom_attach">23</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="namespace_defs_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Namespace definition to be passed in as the + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">18</property> + <property name="bottom_attach">19</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label20"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Namespace definitions:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">19</property> + <property name="bottom_attach">20</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label21"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">External encoding:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">20</property> + <property name="bottom_attach">21</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label22"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Member specs:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">22</property> + <property name="bottom_attach">23</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="namespace_defs_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Namespace definition to be passed in as the value for the namespacedef_ parameter of the export() method by the generated parse() and parseString() functions. Default=''. Example: xmlns:abc="http://www.abc.com"</property> - <property name="invisible_char">â—</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">19</property> - <property name="bottom_attach">20</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="external_encoding_entry"> - <property name="visible">True</property> - <property name="tooltip_text" translatable="yes">Encode output written by the generated export + <property name="invisible_char">â—</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">19</property> + <property name="bottom_attach">20</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="external_encoding_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Encode output written by the generated export methods using this encoding. Default, if omitted, is the value returned by sys.getdefaultencoding(). Example: utf-8.</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">20</property> - <property name="bottom_attach">21</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="member_specs_combobox_container"> - <property name="visible">True</property> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">22</property> - <property name="bottom_attach">23</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="empty_namespace_prefix_checkbutton"> - <property name="label" translatable="yes">Empty</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Assume an empty namespace + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">20</property> + <property name="bottom_attach">21</property> + </packing> + </child> + <child> + <object class="GtkHBox" id="member_specs_combobox_container"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">22</property> + <property name="bottom_attach">23</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="empty_namespace_prefix_checkbutton"> + <property name="label" translatable="yes">Empty</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Assume an empty namespace prefix in the XML schema, not the default ("xs:").</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_empty_namespace_prefix_checkbutton_toggled"/> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="auto_super_checkbutton"> - <property name="label" translatable="yes">Auto</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Use the superclass file name + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="on_empty_namespace_prefix_checkbutton_toggled" swapped="no"/> + </object> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">5</property> + <property name="bottom_attach">6</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="auto_super_checkbutton"> + <property name="label" translatable="yes">Auto</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Use the superclass file name stem as the super-class module name.</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_auto_super_checkbutton_toggled"/> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">11</property> - <property name="bottom_attach">12</property> - </packing> - </child> - <child> - <object class="GtkButton" id="input_schema_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the input schema file entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - </packing> - </child> - <child> - <object class="GtkButton" id="output_superclass_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the output superclass file entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - </packing> - </child> - <child> - <object class="GtkButton" id="output_subclass_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the output subclass file entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - </packing> - </child> - <child> - <object class="GtkButton" id="prefix_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the prefix entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - </packing> - </child> - <child> - <object class="GtkButton" id="namespace_prefix_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the XML namespace prefix entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> - </packing> - </child> - <child> - <object class="GtkButton" id="behavior_filename_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the behavior file name entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> - </packing> - </child> - <child> - <object class="GtkButton" id="search_path_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the search path entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">8</property> - <property name="bottom_attach">9</property> - </packing> - </child> - <child> - <object class="GtkButton" id="subclass_suffix_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the subclass suffix.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">9</property> - <property name="bottom_attach">10</property> - </packing> - </child> - <child> - <object class="GtkButton" id="root_element_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the root element entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">10</property> - <property name="bottom_attach">11</property> - </packing> - </child> - <child> - <object class="GtkButton" id="superclass_module_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the superclass module entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">11</property> - <property name="bottom_attach">12</property> - </packing> - </child> - <child> - <object class="GtkButton" id="validator_bodies_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the validator bodies path entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">13</property> - <property name="bottom_attach">14</property> - </packing> - </child> - <child> - <object class="GtkButton" id="user_methods_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the user methods module entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">14</property> - <property name="bottom_attach">15</property> - </packing> - </child> - <child> - <object class="GtkButton" id="namespace_defs_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the namespace definitions entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">19</property> - <property name="bottom_attach">20</property> - </packing> - </child> - <child> - <object class="GtkButton" id="external_encoding_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the external encoding entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">20</property> - <property name="bottom_attach">21</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label23"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Get encoded</property> - </object> - <packing> - <property name="top_attach">21</property> - <property name="bottom_attach">22</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="get_encoded_checkbutton"> - <property name="label" translatable="yes">Getters return encoded values by default</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Getters return encoded value by default if true. + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="on_auto_super_checkbutton_toggled" swapped="no"/> + </object> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">11</property> + <property name="bottom_attach">12</property> + </packing> + </child> + <child> + <object class="GtkButton" id="input_schema_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the input schema file entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + </packing> + </child> + <child> + <object class="GtkButton" id="output_superclass_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the output superclass file entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + </packing> + </child> + <child> + <object class="GtkButton" id="output_subclass_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the output subclass file entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + </packing> + </child> + <child> + <object class="GtkButton" id="prefix_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the prefix entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + </packing> + </child> + <child> + <object class="GtkButton" id="namespace_prefix_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the XML namespace prefix entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">5</property> + <property name="bottom_attach">6</property> + </packing> + </child> + <child> + <object class="GtkButton" id="behavior_filename_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the behavior file name entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">6</property> + <property name="bottom_attach">7</property> + </packing> + </child> + <child> + <object class="GtkButton" id="subclass_suffix_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the subclass suffix.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">9</property> + <property name="bottom_attach">10</property> + </packing> + </child> + <child> + <object class="GtkButton" id="root_element_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the root element entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">10</property> + <property name="bottom_attach">11</property> + </packing> + </child> + <child> + <object class="GtkButton" id="superclass_module_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the superclass module entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">11</property> + <property name="bottom_attach">12</property> + </packing> + </child> + <child> + <object class="GtkButton" id="validator_bodies_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the validator bodies path entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">13</property> + <property name="bottom_attach">14</property> + </packing> + </child> + <child> + <object class="GtkButton" id="user_methods_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the user methods module entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">14</property> + <property name="bottom_attach">15</property> + </packing> + </child> + <child> + <object class="GtkButton" id="namespace_defs_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the namespace definitions entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">19</property> + <property name="bottom_attach">20</property> + </packing> + </child> + <child> + <object class="GtkButton" id="external_encoding_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the external encoding entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">20</property> + <property name="bottom_attach">21</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label23"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Get encoded:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">21</property> + <property name="bottom_attach">22</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="get_encoded_checkbutton"> + <property name="label" translatable="yes">Getters return encoded values by default</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Getters return encoded value by default if true. Can be changed at run-time by either (1) changing global variable GetEncodedValue or (2) using optional parameter to getter.</property> - <property name="draw_indicator">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">21</property> + <property name="bottom_attach">22</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label24"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Exports:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">23</property> + <property name="bottom_attach">24</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="export_spec_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Specifies export functions to be generated. Value is a whitespace separated list of any of the following: "write" (write XML to file), "literal" (write out python code), "etree" (build element tree (can serialize to XML)). Example: "write etree". Default: "write".</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">23</property> + <property name="bottom_attach">24</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label25"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">One file per XSD:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">24</property> + <property name="bottom_attach">25</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="one_file_per_xsd_checkbutton"> + <property name="label" translatable="yes">Create a python module for each XSD processed.</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Create a python module for each XSD processed.</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">24</property> + <property name="bottom_attach">25</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label26"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Output directory:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">25</property> + <property name="bottom_attach">26</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="output_directory_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Used in conjunction with --one-file-per-xsd. The directory where the modules will be created.</property> + <property name="invisible_char">â—</property> + <property name="width_chars">80</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">25</property> + <property name="bottom_attach">26</property> + </packing> + </child> + <child> + <object class="GtkButton" id="output_directory_chooser_button"> + <property name="label" translatable="yes">Choose</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Choose the output directory for one-file-per-xsd.</property> + <signal name="clicked" handler="on_output_directory_chooser_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">25</property> + <property name="bottom_attach">26</property> + </packing> + </child> + <child> + <object class="GtkButton" id="output_directory_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the output directory entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">25</property> + <property name="bottom_attach">26</property> + </packing> + </child> + <child> + <object class="GtkButton" id="export_spec_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the exports entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">23</property> + <property name="bottom_attach">24</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label27"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Module suffix:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">26</property> + <property name="bottom_attach">27</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label28"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Preserve CData tags:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">27</property> + <property name="bottom_attach">28</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label29"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Cleanup name list:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">28</property> + <property name="bottom_attach">29</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="module_suffix_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">To be used in conjunction with --one-file-per-xsd. Append XXX to the end of each file created.</property> + <property name="invisible_char">â—</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">26</property> + <property name="bottom_attach">27</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="cleanup_name_list_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Specifies list of 2-tuples used for cleaning names. First element is a regular expression search pattern and second is a replacement. Example: "[('[-:.]', '_'), ('^__', 'Special')]". Default: "[('[-:.]', '_')]".</property> + <property name="invisible_char">â—</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">28</property> + <property name="bottom_attach">29</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="preserve_cdata_tags_checkbutton"> + <property name="label" translatable="yes">Preserve CData tags</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Preserve CDATA tags. Default: False.</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">27</property> + <property name="bottom_attach">28</property> + </packing> + </child> + <child> + <object class="GtkButton" id="module_suffix_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the module suffix entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">26</property> + <property name="bottom_attach">27</property> + </packing> + </child> + <child> + <object class="GtkButton" id="cleanup_name_list_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the cleanup name list entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">28</property> + <property name="bottom_attach">29</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + </object> + </child> </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">21</property> - <property name="bottom_attach">22</property> - </packing> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> </child> </object> <packing> + <property name="expand">True</property> + <property name="fill">True</property> <property name="position">1</property> </packing> </child> <child> <object class="GtkHBox" id="hbox1"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="homogeneous">True</property> <child> <object class="GtkButton" id="generate_button"> @@ -1249,9 +1638,11 @@ Can be changed at run-time by either <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="tooltip_text" translatable="yes">Generate the bindings modules.</property> - <signal name="clicked" handler="on_generate_button_clicked"/> + <signal name="clicked" handler="on_generate_button_clicked" swapped="no"/> </object> <packing> + <property name="expand">True</property> + <property name="fill">True</property> <property name="position">0</property> </packing> </child> @@ -1262,24 +1653,30 @@ Can be changed at run-time by either <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="tooltip_text" translatable="yes">Exit from the application.</property> - <signal name="clicked" handler="on_quit_button_clicked"/> + <signal name="clicked" handler="on_quit_button_clicked" swapped="no"/> </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">2</property> </packing> </child> <child> <object class="GtkStatusbar" id="statusbar1"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="spacing">2</property> </object> <packing> <property name="expand">False</property> + <property name="fill">True</property> <property name="position">3</property> </packing> </child> @@ -1289,86 +1686,9 @@ Can be changed at run-time by either </object> </child> </object> - <object class="GtkAccelGroup" id="accelgroup1"/> - <object class="GtkDialog" id="content_dialog"> - <property name="border_width">5</property> - <property name="title" translatable="yes">Messages and Content</property> - <property name="default_width">800</property> - <property name="default_height">600</property> - <property name="type_hint">normal</property> - <child internal-child="vbox"> - <object class="GtkVBox" id="dialog-vbox3"> - <property name="visible">True</property> - <property name="spacing">2</property> - <child> - <object class="GtkScrolledWindow" id="scrolledwindow1"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">automatic</property> - <property name="vscrollbar_policy">automatic</property> - <property name="min_content_width">250</property> - <property name="min_content_height">500</property> - <child> - <object class="GtkTextView" id="content_textview"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">False</property> - </object> - </child> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - <child internal-child="action_area"> - <object class="GtkHButtonBox" id="dialog-action_area3"> - <property name="visible">True</property> - <property name="layout_style">end</property> - <child> - <object class="GtkButton" id="content_dialog_ok_button"> - <property name="label" translatable="yes">OK</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <signal name="activate" handler="on_ok_button_activate"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="pack_type">end</property> - <property name="position">0</property> - </packing> - </child> - </object> - </child> - <action-widgets> - <action-widget response="0">content_dialog_ok_button</action-widget> - </action-widgets> - </object> - <object class="GtkImage" id="image1"> - <property name="visible">True</property> - <property name="stock">gtk-save</property> - </object> - <object class="GtkImage" id="image2"> - <property name="visible">True</property> - <property name="stock">gtk-save-as</property> - </object> - <object class="GtkImage" id="image3"> - <property name="visible">True</property> - <property name="stock">gtk-open</property> - </object> - <object class="GtkImage" id="image4"> - <property name="visible">True</property> - <property name="stock">gtk-clear</property> - </object> <object class="GtkImage" id="image5"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="stock">gtk-missing-image</property> </object> </interface> diff --git a/gui/generateds_gui.py b/gui/generateds_gui.py index 3c0aa94fc65cf78d3471c6c93bff869b688951a7..70a191a3ef9461cbd6abe45ef0c38d23a04e5de9 100755 --- a/gui/generateds_gui.py +++ b/gui/generateds_gui.py @@ -3,13 +3,11 @@ import sys import os from optparse import OptionParser from configparser import ConfigParser -from xml.dom import minidom from xml.parsers import expat import subprocess import re - if sys.version_info.major == 2: import gtk else: @@ -18,7 +16,7 @@ else: import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk as gtk - + # import pango from libgenerateDS.gui import generateds_gui_session #import generateds_gui_session @@ -30,7 +28,7 @@ from libgenerateDS.gui import generateds_gui_session ## ipshell = IPShellEmbed(args, ## banner = 'Dropping into IPython', ## exit_msg = 'Leaving Interpreter, back to program.') -## +## # Then use the following line where and when you want to drop into the # IPython shell: # ipshell('<some message> -- Entering ipshell.\\nHit Ctrl-D to exit') @@ -69,9 +67,15 @@ CmdTemplate = ( '%(namespace_defs)s' + '%(external_encoding)s' + '%(member_specs)s' + + '%(export_spec)s' + + '%(one_file_per_xsd)s' + + '%(output_directory)s' + + '%(module_suffix)s' + + '%(preserve_cdata_tags)s' + + '%(cleanup_name_list)s' + ' %(input_schema)s' + '' - ) +) CaptureCmdTemplate = ( '%(exec_path)s --no-questions' + '%(force)s' + @@ -94,14 +98,20 @@ CaptureCmdTemplate = ( '%(namespace_defs)s' + '%(external_encoding)s' + '%(member_specs)s' + + '%(export_spec)s' + + '%(one_file_per_xsd)s' + + '%(output_directory)s' + + '%(module_suffix)s' + + '%(preserve_cdata_tags)s' + + '%(cleanup_name_list)s' + ' \\\n %(input_schema)s' + '' - ) +) ErrorMessages = [ '', 'Must enter input schema name.', 'Must enter either output superclass name or output subclass file name.', - ] +] Memberspecs_tooltip_text = '''\ Generate member (type) specifications in each class: a dictionary of instances of class @@ -120,12 +130,24 @@ class UIItemSpec(object): self.name = name self.ui_type = ui_type self.access_action = access_action - def get_name(self): return self.name - def set_name(self, name): self.name = name - def get_ui_type(self): return self.ui_type - def set_ui_type(self, ui_type): self.ui_type = ui_type - def get_access_action(self): return self.access_action - def set_access_action(self, access_action): self.access_action = access_action + + def get_name(self): + return self.name + + def set_name(self, name): + self.name = name + + def get_ui_type(self): + return self.ui_type + + def set_ui_type(self, ui_type): + self.ui_type = ui_type + + def get_access_action(self): + return self.access_action + + def set_access_action(self, access_action): + self.access_action = access_action class GeneratedsGui(object): @@ -142,11 +164,12 @@ class GeneratedsGui(object): self.ui_obj_dict = {} self.session_filename = None self.current_folder = None - # use GtkBuilder to build our interface from the XML file + # use GtkBuilder to build our interface from the XML file ui_spec_filename = options.impl_gui try: if ui_spec_filename is None: - Builder.add_from_string(branch_version('Ui_spec, len(Ui_spec)','Ui_spec')) + Builder.add_from_string(branch_version( + 'Ui_spec, len(Ui_spec)', 'Ui_spec')) else: Builder.add_from_file(ui_spec_filename) except: @@ -163,14 +186,16 @@ class GeneratedsGui(object): setattr(self, s1, bgo(s1)) self.ui_obj_dict[s1] = bgo(s1) # Create the member-specs combobox. - member_specs_combobox = branch_version('gtk.combo_box_new_text()', 'gtk.ComboBoxText()') + member_specs_combobox = branch_version( + 'gtk.combo_box_new_text()', 'gtk.ComboBoxText()') member_specs_combobox.set_name('member_specs_combobox') member_specs_combobox.set_tooltip_text(Memberspecs_tooltip_text) self.ui_obj_dict['member_specs_combobox'] = member_specs_combobox member_specs_combobox.append_text("none") member_specs_combobox.append_text("list") member_specs_combobox.append_text("dict") - member_specs_combobox_container = bgo('member_specs_combobox_container') + member_specs_combobox_container = bgo( + 'member_specs_combobox_container') member_specs_combobox_container.add(member_specs_combobox) member_specs_combobox.set_active(0) member_specs_combobox.show() @@ -179,9 +204,12 @@ class GeneratedsGui(object): Builder.connect_signals(self) Builder.connect_signals(self.content_dialog) # set the default icon to the GTK "edit" icon - branch_version('gtk.window_set_default_icon_name(gtk.STOCK_EDIT)','gtk.Window.set_default_icon_name(gtk.STOCK_EDIT)') + branch_version( + 'gtk.window_set_default_icon_name(gtk.STOCK_EDIT)', + 'gtk.Window.set_default_icon_name(gtk.STOCK_EDIT)') # setup and initialize our statusbar - self.statusbar_cid = self.statusbar.get_context_id("Tutorial GTK+ Text Editor") + self.statusbar_cid = self.statusbar.get_context_id( + "Tutorial GTK+ Text Editor") self.reset_default_status() self.params = generateds_gui_session.sessionType() # Load a session if specified. @@ -197,8 +225,8 @@ class GeneratedsGui(object): self.trans_gui_2_obj() self.saved_params = self.params.copy() - # When our window is destroyed, we want to break out of the GTK main loop. - # We do this by calling gtk_main_quit(). We could have also just specified + # When our window is destroyed, we want to break out of the GTK main loop. + # We do this by calling gtk_main_quit(). We could have also just specified # gtk_main_quit as the handler in Glade! def on_window_destroy(self, widget, data=None): self.trans_gui_2_obj() @@ -206,36 +234,40 @@ class GeneratedsGui(object): ## self.dump_params('params:', self.params) if self.params != self.saved_params: message = 'Session data has changed.\n\nSave?' - if sys.version_info.major == 2 : - dialog = gtk.MessageDialog(None, - gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, - gtk.MESSAGE_ERROR, - gtk.BUTTONS_NONE, - message) + if sys.version_info.major == 2: + dialog = gtk.MessageDialog( + None, + gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, + gtk.MESSAGE_ERROR, + gtk.BUTTONS_NONE, + message) dialog.add_buttons( gtk.STOCK_YES, gtk.RESPONSE_YES, '_Discard', 1, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - ) - else : - dialog = gtk.MessageDialog(None, - gtk.DialogFlags.MODAL | gtk.DialogFlags.DESTROY_WITH_PARENT, - gtk.MessageType.ERROR, - gtk.ButtonsType.NONE, - message) - + ) + else: + dialog = gtk.MessageDialog( + None, + (gtk.DialogFlags.MODAL | + gtk.DialogFlags.DESTROY_WITH_PARENT), + gtk.MessageType.ERROR, + gtk.ButtonsType.NONE, + message) dialog.add_buttons( - gtk.STOCK_YES, gtk.ResponseType.YES, - '_Discard', 1, - gtk.STOCK_CANCEL, gtk.ResponseType.CANCEL, + gtk.STOCK_YES, gtk.ResponseType.YES, + '_Discard', 1, + gtk.STOCK_CANCEL, gtk.ResponseType.CANCEL, ) response = dialog.run() dialog.destroy() - if response == branch_version('gtk.RESPONSE_YES', 'gtk.ResponseType.YES'): + if response == branch_version( + 'gtk.RESPONSE_YES', 'gtk.ResponseType.YES'): self.save_session_action() elif response == 1: pass - elif response == branch_version('gtk.RESPONSE_CANCEL', 'gtk.ResponseType.CANCEL'): + elif response == branch_version( + 'gtk.RESPONSE_CANCEL', 'gtk.ResponseType.CANCEL'): return gtk.main_quit() @@ -250,7 +282,7 @@ class GeneratedsGui(object): # Get the values from the widgets in the UI. # Format the command line. - # Generate the output files. + # Generate the output files. def on_generate_menuitem_activate(self, menuitem, data=None): self.trans_gui_2_obj() params_dict = self.trans_params_2_dict() @@ -280,6 +312,8 @@ class GeneratedsGui(object): cmd = cmd.replace(' --', ' \\\n --') cmd = cmd.replace(' -o', ' \\\n -o') cmd = cmd.replace(' -s', ' \\\n -s') + cmd = cmd.replace(' -f', ' \\\n -f') + cmd = cmd.replace(' -m', ' \\\n -m') self.display_content('Command line', cmd) return True @@ -297,8 +331,9 @@ class GeneratedsGui(object): else: self.params.set_member_specs('none') else: - s2 = '%s_%s' % (item.get_name(), item.get_ui_type(), ) - method = getattr(ui_obj, 'get_%s' % item.get_access_action()) + #s2 = '%s_%s' % (item.get_name(), item.get_ui_type(), ) + method = getattr( + ui_obj, 'get_%s' % item.get_access_action()) value = method() setattr(self.params, item.get_name(), value) @@ -323,7 +358,8 @@ class GeneratedsGui(object): value = False elif item.get_ui_type() == 'combobox': value = 0 - method = getattr(ui_obj, + method = getattr( + ui_obj, 'set_%s' % item.get_access_action()) method(value) @@ -346,35 +382,62 @@ class GeneratedsGui(object): self.transform_1_param(params, pd, 'namespace_prefix', 'a') self.transform_1_param(params, pd, 'behavior_filename', 'b') pd['properties'] = (' -m' if params.get_properties() else '') - self.transform_1_param(params, pd, 'subclass_suffix', 'subclass-suffix', True) - self.transform_1_param(params, pd, 'root_element', 'root-element', True) - self.transform_1_param(params, pd, 'superclass_module', 'super', True) - pd['old_getters_setters'] = (' --use-old-getter-setter' if params.get_old_getters_setters() else '') - self.transform_1_param(params, pd, 'user_methods', 'user-methods', True) - self.transform_1_param(params, pd, 'validator_bodies', 'validator-bodies', True) + self.transform_1_param( + params, pd, 'subclass_suffix', 'subclass-suffix', True) + self.transform_1_param( + params, pd, 'root_element', 'root-element', True) + self.transform_1_param( + params, pd, 'superclass_module', 'super', True) + pd['old_getters_setters'] = ( + ' --use-old-getter-setter' + if params.get_old_getters_setters() + else '') + self.transform_1_param( + params, pd, 'user_methods', 'user-methods', True) + self.transform_1_param( + params, pd, 'validator_bodies', 'validator-bodies', True) pd['no_dates'] = (' --no-dates' if params.get_no_dates() else '') - pd['no_versions'] = (' --no-versions' if params.get_no_versions() else '') - pd['no_process_includes'] = (' --no-process-includes' if params.get_no_process_includes() else '') + pd['no_versions'] = ( + ' --no-versions' if params.get_no_versions() else '') + pd['no_process_includes'] = ( + ' --no-process-includes' + if params.get_no_process_includes() + else '') pd['silence'] = (' --silence' if params.get_silence() else '') # Special case for namespacedefs because of quoting. - #self.transform_1_param(params, pd, 'namespace_defs', 'namespacedef', True) name = 'namespace_defs' flag = 'namespacedef' value = getattr(params, name) params_dict[name] = ( - " --%s='%s'" % (flag, value, ) - if value.strip() - else '') - self.transform_1_param(params, pd, 'external_encoding', 'external-encoding', True) + " --%s='%s'" % (flag, value, ) + if value.strip() + else '') + self.transform_1_param( + params, pd, 'external_encoding', 'external-encoding', True) if params.get_member_specs() == 'list': pd['member_specs'] = ' --member-specs=list' elif params.get_member_specs() == 'dict': pd['member_specs'] = ' --member-specs=dict' else: pd['member_specs'] = '' + self.transform_1_param( + params, pd, 'export_spec', 'export', True) + pd['one_file_per_xsd'] = ( + ' --one-file-per-xsd' if params.get_one_file_per_xsd() else '') + self.transform_1_param( + params, pd, 'output_directory', 'output-directory', True) + self.transform_1_param( + params, pd, 'module_suffix', 'module-suffix', True) + pd['preserve_cdata_tags'] = ( + ' --preserve-cdata-tags' + if params.get_preserve_cdata_tags() + else '') + self.transform_1_param( + params, pd, 'cleanup_name_list', 'cleanup-name-list', True) return pd - def transform_1_param(self, params, params_dict, name, flag, longopt=False): + def transform_1_param( + self, params, params_dict, name, flag, longopt=False): value = getattr(params, name) if longopt: params_dict[name] = ( @@ -399,37 +462,36 @@ class GeneratedsGui(object): msg = '' if not p['input_schema']: result = 1 - elif not (p['output_superclass'] or - p['output_subclass']): + elif not (p['output_superclass'] or p['output_subclass']): result = 2 if result: msg = ErrorMessages[result] return result, msg - # Clear all the fields/widgets to default values. + # Clear all the fields/widgets to default values. def on_clear_menuitem_activate(self, menuitem, data=None): message = 'Clear all entries?\nAre you sure?' - - if sys.version_info.major == 2 : + + if sys.version_info.major == 2: dialog = gtk.MessageDialog( - None, - gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, - gtk.MESSAGE_WARNING, - gtk.BUTTONS_OK_CANCEL, - message - ) - else : + None, + gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, + gtk.MESSAGE_WARNING, + gtk.BUTTONS_OK_CANCEL, + message + ) + else: dialog = gtk.MessageDialog( - None, - gtk.DialogFlags.MODAL | gtk.DialogFlags.DESTROY_WITH_PARENT, - gtk.MessageType.WARNING, - gtk.ButtonsType.OK_CANCEL, - message - ) - + None, + gtk.DialogFlags.MODAL | gtk.DialogFlags.DESTROY_WITH_PARENT, + gtk.MessageType.WARNING, + gtk.ButtonsType.OK_CANCEL, + message + ) response = dialog.run() dialog.destroy() - if response == branch_version('gtk.RESPONSE_OK','gtk.ResponseType.OK'): + if response == branch_version( + 'gtk.RESPONSE_OK', 'gtk.ResponseType.OK'): self.session_filename = None self.params = generateds_gui_session.sessionType( input_schema='', @@ -455,13 +517,20 @@ class GeneratedsGui(object): namespace_defs='', external_encoding='', member_specs='', - ) + export_spec='', + one_file_per_xsd=False, + output_directory='', + module_suffix='', + preserve_cdata_tags=False, + cleanup_name_list='', + ) self.trans_obj_2_gui() def run_command(self, cmd): - spobj = subprocess.Popen(cmd, + spobj = subprocess.Popen( + cmd, shell=True, - stdout=subprocess.PIPE, + stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=False) outcontent = spobj.stdout.read() @@ -475,7 +544,9 @@ class GeneratedsGui(object): error = True if not error: msg = 'Successfully generated.' - self.error_message(msg, branch_version('gtk.MESSAGE_INFO','gtk.MessageType.INFO')) + self.error_message( + msg, + branch_version('gtk.MESSAGE_INFO', 'gtk.MessageType.INFO')) def display_content(self, title, content): #content_dialog = ContentDialog() @@ -487,43 +558,47 @@ class GeneratedsGui(object): ## self.dump_params('params:', self.params) if self.params != self.saved_params: message = 'Session data has changed.\n\nSave?' - - if sys.version_info.major == 2 : - dialog = gtk.MessageDialog(None, - gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, - gtk.MESSAGE_ERROR, - gtk.BUTTONS_NONE, - message) + if sys.version_info.major == 2: + dialog = gtk.MessageDialog( + None, + gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, + gtk.MESSAGE_ERROR, + gtk.BUTTONS_NONE, + message) dialog.add_buttons( gtk.STOCK_YES, gtk.RESPONSE_YES, '_Discard', 1, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - ) - else : - dialog = gtk.MessageDialog(None, - gtk.DialogFlags.MODAL | gtk.DialogFlags.DESTROY_WITH_PARENT, - gtk.MessageType.ERROR, - gtk.ButtonsType.NONE, - message) - + ) + else: + dialog = gtk.MessageDialog( + None, + (gtk.DialogFlags.MODAL | + gtk.DialogFlags.DESTROY_WITH_PARENT), + gtk.MessageType.ERROR, + gtk.ButtonsType.NONE, + message) dialog.add_buttons( - gtk.STOCK_YES, gtk.ResponseType.YES, - '_Discard', 1, - gtk.STOCK_CANCEL, gtk.ResponseType.CANCEL, - ) - + gtk.STOCK_YES, gtk.ResponseType.YES, + '_Discard', 1, + gtk.STOCK_CANCEL, gtk.ResponseType.CANCEL, + ) response = dialog.run() dialog.destroy() - if response == branch_version('gtk.RESPONSE_YES','gtk.ResponseType.YES'): + if response == branch_version( + 'gtk.RESPONSE_YES', 'gtk.ResponseType.YES'): self.save_session_action() elif response == 1: pass - elif response == branch_version('gtk.RESPONSE_CANCEL','gtk.ResponseType.CANCEL'): + elif response == branch_version( + 'gtk.RESPONSE_CANCEL', 'gtk.ResponseType.CANCEL'): return session_filename = self.choose_filename( - branch_version('gtk.FILE_CHOOSER_ACTION_OPEN','gtk.FileChooserAction.OPEN'), + branch_version( + 'gtk.FILE_CHOOSER_ACTION_OPEN', + 'gtk.FileChooserAction.OPEN'), (('Session *.session', '*.session'),) - ) + ) if session_filename: self.session_filename = session_filename self.load_session(self.session_filename) @@ -537,15 +612,22 @@ class GeneratedsGui(object): def save_session_action(self): if not self.session_filename: filename = self.choose_filename( - branch_version('gtk.FILE_CHOOSER_ACTION_SAVE','gtk.FileChooserAction.SAVE'), + branch_version( + 'gtk.FILE_CHOOSER_ACTION_SAVE', + 'gtk.FileChooserAction.SAVE'), (('Session *.session', '*.session'),), confirm_overwrite=True, initfilename=self.session_filename, buttons=( - gtk.STOCK_CANCEL, branch_version('gtk.RESPONSE_CANCEL','gtk.ResponseType.CANCEL'), - gtk.STOCK_SAVE, branch_version('gtk.RESPONSE_OK','gtk.ResponseType.OK'), - ) + gtk.STOCK_CANCEL, + branch_version( + 'gtk.RESPONSE_CANCEL', + 'gtk.ResponseType.CANCEL'), + gtk.STOCK_SAVE, branch_version( + 'gtk.RESPONSE_OK', + 'gtk.ResponseType.OK'), ) + ) if filename: self.session_filename = filename if self.session_filename: @@ -559,15 +641,22 @@ class GeneratedsGui(object): def on_save_session_as_menuitem_activate(self, menuitem, data=None): filename = self.choose_filename( - branch_version('gtk.FILE_CHOOSER_ACTION_SAVE','gtk.FileChooserAction.SAVE'), + branch_version( + 'gtk.FILE_CHOOSER_ACTION_SAVE', + 'gtk.FileChooserAction.SAVE'), (('Session *.session', '*.session'),), confirm_overwrite=True, initfilename=self.session_filename, buttons=( - gtk.STOCK_CANCEL, branch_version('gtk.RESPONSE_CANCEL','gtk.ResponseType.CANCEL'), - gtk.STOCK_SAVE, branch_version('gtk.RESPONSE_OK','gtk.ResponseType.OK'), - ) + gtk.STOCK_CANCEL, + branch_version( + 'gtk.RESPONSE_CANCEL', + 'gtk.ResponseType.CANCEL'), + gtk.STOCK_SAVE, branch_version( + 'gtk.RESPONSE_OK', + 'gtk.ResponseType.OK'), ) + ) if filename: self.session_filename = filename stem, ext = os.path.splitext(self.session_filename) @@ -583,11 +672,12 @@ class GeneratedsGui(object): sessionObj = self.params outfile = open(filename, 'w') outfile.write('<?xml version="1.0" ?>\n') - sessionObj.export(outfile, 0, name_="session", + sessionObj.export( + outfile, 0, name_="session", namespacedef_='') outfile.close() msg = 'Session saved to file:\n%s' % (filename, ) - msgTy = branch_version('gtk.MESSAGE_INFO','gtk.MessageType.INFO') + msgTy = branch_version('gtk.MESSAGE_INFO', 'gtk.MessageType.INFO') self.error_message(msg, msgTy) self.saved_params = self.params.copy() @@ -597,7 +687,7 @@ class GeneratedsGui(object): rootNode = doc.getroot() rootTag, rootClass = generateds_gui_session.get_root_tag(rootNode) if rootClass is None: - rootTag = 'session' + #rootTag = 'session' rootClass = generateds_gui_session.sessionType sessionObj = rootClass.factory() sessionObj.build(rootNode) @@ -629,13 +719,16 @@ class GeneratedsGui(object): about_dialog.set_comments("GTK+ and Glade3 GUI front end") about_dialog.set_authors(authors) about_dialog.set_logo_icon_name(gtk.STOCK_EDIT) + # callbacks for destroying the dialog def close(dialog, response, editor): editor.about_dialog = None dialog.destroy() + def delete_event(dialog, event, editor): editor.about_dialog = None return True + about_dialog.connect("response", close, self) about_dialog.connect("delete-event", delete_event, self) self.about_dialog = about_dialog @@ -646,12 +739,21 @@ class GeneratedsGui(object): #print message # create an error message dialog and display modally to the user if message_type is None: - message_type = branch_version('gtk.MESSAGE_ERROR','gtk.MessageType.ERROR') - - dialog = gtk.MessageDialog(None, - branch_version('gtk.DIALOG_MODAL','gtk.DialogFlags.MODAL') | branch_version('gtk.DIALOG_DESTROY_WITH_PARENT','gtk.DialogFlags.DESTROY_WITH_PARENT'), - message_type, branch_version('gtk.BUTTONS_OK','gtk.ButtonsType.OK'), message) - + message_type = branch_version( + 'gtk.MESSAGE_ERROR', + 'gtk.MessageType.ERROR') + dialog = gtk.MessageDialog( + None, + branch_version( + 'gtk.DIALOG_MODAL', + 'gtk.DialogFlags.MODAL') | + branch_version( + 'gtk.DIALOG_DESTROY_WITH_PARENT', + 'gtk.DialogFlags.DESTROY_WITH_PARENT'), + message_type, branch_version( + 'gtk.BUTTONS_OK', + 'gtk.ButtonsType.OK'), + message) dialog.run() dialog.destroy() @@ -661,7 +763,10 @@ class GeneratedsGui(object): self.statusbar.push(self.statusbar_cid, msg) def on_input_schema_chooser_button_clicked(self, button, data=None): - filename = self.choose_filename(branch_version('gtk.FILE_CHOOSER_ACTION_OPEN','gtk.FileChooserAction.OPEN'), + filename = self.choose_filename( + branch_version( + 'gtk.FILE_CHOOSER_ACTION_OPEN', + 'gtk.FileChooserAction.OPEN'), (('Schemas *.xsd', '*.xsd'),)) if filename: self.input_schema_entry.set_text(filename) @@ -679,41 +784,66 @@ class GeneratedsGui(object): self.output_subclass_entry.set_text(filename) def on_behavior_filename_chooser_button_clicked(self, button, data=None): - filename = self.choose_filename(branch_version('gtk.FILE_CHOOSER_ACTION_OPEN','gtk.FileChooserAction.OPEN'), + filename = self.choose_filename( + branch_version( + 'gtk.FILE_CHOOSER_ACTION_OPEN', + 'gtk.FileChooserAction.OPEN'), (('Python *.py', '*.py'),)) if filename: self.behavior_filename_entry.set_text(filename) def on_validator_bodies_chooser_button_clicked(self, button, data=None): - filename = self.choose_filename(branch_version('gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER','gtk.FileChooserAction.SELECT_FOLDER'), - ) + filename = self.choose_filename( + branch_version( + 'gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER', + 'gtk.FileChooserAction.SELECT_FOLDER'), + ) if filename: self.validator_bodies_entry.set_text(filename) def on_user_methods_chooser_button_clicked(self, button, data=None): - filename = self.choose_filename(branch_version('gtk.FILE_CHOOSER_ACTION_OPEN','gtk.FileChooserAction.OPEN'), + filename = self.choose_filename( + branch_version( + 'gtk.FILE_CHOOSER_ACTION_OPEN', + 'gtk.FileChooserAction.OPEN'), (('Python *.py', '*.py'),)) if filename: self.user_methods_entry.set_text(filename) - def choose_filename(self, action=None, - patterns=(), confirm_overwrite=False, initfilename=None, - buttons=None): + def on_output_directory_chooser_button_clicked(self, button, data=None): + filename = self.choose_filename( + branch_version( + 'gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER', + 'gtk.FileChooserAction.SELECT_FOLDER'), + ) + if filename: + self.output_directory_entry.set_text(filename) + + def choose_filename( + self, + action=None, + patterns=(), + confirm_overwrite=False, + initfilename=None, + buttons=None): if action is None: - action = branch_version('gtk.FILE_CHOOSER_ACTION_SAVE','gtk.FileChooserAction.SAVE') + action = branch_version( + 'gtk.FILE_CHOOSER_ACTION_SAVE', 'gtk.FileChooserAction.SAVE') filename = None - ty_CANCEL = branch_version('gtk.RESPONSE_CANCEL','gtk.ResponseType.CANCEL') - ty_OK = branch_version('gtk.RESPONSE_OK','gtk.ResponseType.OK') + ty_CANCEL = branch_version( + 'gtk.RESPONSE_CANCEL', + 'gtk.ResponseType.CANCEL') + ty_OK = branch_version('gtk.RESPONSE_OK', 'gtk.ResponseType.OK') if buttons is None: - buttons=( + buttons = ( gtk.STOCK_CANCEL, ty_CANCEL, gtk.STOCK_OPEN, ty_OK, - ) + ) dialog = gtk.FileChooserDialog( title=None, action=action, buttons=buttons, - ) + ) if self.current_folder is not None: dialog.set_current_folder(self.current_folder) if initfilename is not None: @@ -730,23 +860,25 @@ class GeneratedsGui(object): dialog.add_filter(filter) dialog.set_do_overwrite_confirmation(confirm_overwrite) response = dialog.run() - if response == branch_version('gtk.RESPONSE_OK','gtk.ResponseType.OK'): + if response == branch_version( + 'gtk.RESPONSE_OK', 'gtk.ResponseType.OK'): filename = dialog.get_filename() self.current_folder = dialog.get_current_folder() - elif response == branch_version('gtk.RESPONSE_CANCEL','gtk.ResponseType.CANCEL'): + elif response == branch_version( + 'gtk.RESPONSE_CANCEL', 'gtk.ResponseType.CANCEL'): pass dialog.destroy() return filename def on_namespace_prefix_entry_changed(self, widget, data=None): - entry = self.ui_obj_dict['namespace_prefix_entry'] + #entry = self.ui_obj_dict['namespace_prefix_entry'] checkbutton = self.ui_obj_dict['empty_namespace_prefix_checkbutton'] checkbutton.set_active(False) return True def on_empty_namespace_prefix_checkbutton_toggled(self, widget, data=None): entry = self.ui_obj_dict['namespace_prefix_entry'] - checkbutton = self.ui_obj_dict['empty_namespace_prefix_checkbutton'] + #checkbutton = self.ui_obj_dict['empty_namespace_prefix_checkbutton'] if widget.get_active(): entry.set_text('') return True @@ -766,7 +898,7 @@ class GeneratedsGui(object): entry = self.ui_obj_dict['superclass_module_entry'] superclass_entry = self.ui_obj_dict['output_superclass_entry'] #checkbutton = self.auto_super_checkbutton - checkbutton = widget + #checkbutton = widget if widget.get_active(): path = superclass_entry.get_text() if path: @@ -787,9 +919,13 @@ class GeneratedsGui(object): # name of the button and the name of the related entry, # for example, xxx_yyy_entry : xxx_yyy_clear_button. def on_clear_button_clicked(self, widget, data=None): - name = widget.get_name() if sys.version_info.major == 2 else gtk.Buildable.get_name(widget) # http://python.6.x6.nabble.com/Confused-about-a-widget-s-name-td5015372.html + # http://python.6.x6.nabble.com/Confused-about-a-widget-s-name-td5015372.html + name = ( + widget.get_name() + if sys.version_info.major == 2 + else gtk.Buildable.get_name(widget)) mo = GeneratedsGui.name_pat1.search(name) - if not mo is None: + if mo is not None: stem = mo.group(1) name1 = '%s_entry' % (stem, ) ui_obj = self.ui_obj_dict[name1] @@ -806,14 +942,14 @@ class ContentDialog(gtk.Dialog): global Builder self.content_dialog = Builder.get_object('content_dialog') self.content_textview = Builder.get_object('content_textview') - buf = self.content_textview.get_buffer().set_text('') + self.content_textview.get_buffer().set_text('') def show(self, content): #Builder.connect_signals(self) if isinstance(content, bytes): content = content.decode('utf-8') self.content_textview.get_buffer().set_text(content) - response = self.content_dialog.run() + self.content_dialog.run() self.content_dialog.hide() def on_ok_button_activate(self, widget, data=None): @@ -835,13 +971,14 @@ def branch_version(for_2, for_3): return eval(for_3) else: return eval(for_3) - + + def capture_options(options): config_parser = ConfigParser() config_parser.read([ os.path.expanduser('~/.generateds_gui.ini'), './generateds_gui.ini', - ]) + ]) section = 'general' names = ('exec-path', 'exec_path') capture_1_option(options, config_parser, section, names) @@ -855,12 +992,14 @@ def capture_options(options): if options.exec_path is None: options.exec_path = 'generateDS.py' + def capture_1_option(options, config_parser, section, names): - if (getattr(options, names[1]) is None and - config_parser.has_option(section, names[0]) - ): + if ( + getattr(options, names[1]) is None and + config_parser.has_option(section, names[0])): setattr(options, names[1], config_parser.get(section, names[0])) + def capture_ui_names(): items = generateds_gui_session.sessionType.member_data_items_ for item in items: @@ -885,6 +1024,7 @@ USAGE_TEXT = """ example: python %prog somefile.xxx""" + def usage(parser): parser.print_help() sys.exit(1) @@ -892,25 +1032,29 @@ def usage(parser): def main(): parser = OptionParser(USAGE_TEXT) - parser.add_option("--exec-path", + parser.add_option( + "--exec-path", type="string", action="store", dest="exec_path", #default="generateDS.py", - help='path to executable generated in command line.' + help=( + 'path to executable generated in command line.' ' Example: "python /path/to/generateDS.py".' ' Default: "./generateDS.py".' - ' Use Tools/Generate CL (Ctrl-T) to see it.' - ) - parser.add_option("--impl-gui", + ' Use Tools/Generate CL (Ctrl-T) to see it.') + ) + parser.add_option( + "--impl-gui", type="string", action="store", dest="impl_gui", help="name of glade file that defines the GUI if not embedded." - ) - parser.add_option("-s", "--session", + ) + parser.add_option( + "-s", "--session", type="string", action="store", dest="session", help="name of a session file to be loaded." - ) + ) (options, args) = parser.parse_args() capture_options(options) capture_ui_names() @@ -922,93 +1066,190 @@ def main(): # Do not change the next 3 lines. ## UI_SPECIFICATION ## -Ui_spec = """<?xml version="1.0" encoding="UTF-8"?> +Ui_spec = """ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.18.3 --> <interface> - <requires lib="gtk+" version="2.16"/> - <!-- interface-naming-policy project-wide --> + <requires lib="gtk+" version="3.0"/> + <object class="GtkAccelGroup" id="accelgroup1"/> + <object class="GtkDialog" id="content_dialog"> + <property name="can_focus">False</property> + <property name="border_width">5</property> + <property name="title" translatable="yes">Messages and Content</property> + <property name="default_width">800</property> + <property name="default_height">600</property> + <property name="type_hint">normal</property> + <child internal-child="vbox"> + <object class="GtkBox" id="dialog-vbox3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">2</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="content_dialog_ok_button"> + <property name="label" translatable="yes">OK</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <signal name="activate" handler="on_ok_button_activate" swapped="no"/> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkScrolledWindow" id="scrolledwindow1"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="min_content_width">250</property> + <property name="min_content_height">500</property> + <child> + <object class="GtkTextView" id="content_textview"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">False</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> + <action-widgets> + <action-widget response="0">content_dialog_ok_button</action-widget> + </action-widgets> + </object> + <object class="GtkImage" id="image1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="stock">gtk-save</property> + </object> + <object class="GtkImage" id="image2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="stock">gtk-save-as</property> + </object> + <object class="GtkImage" id="image3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="stock">gtk-open</property> + </object> + <object class="GtkImage" id="image4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="stock">gtk-clear</property> + </object> <object class="GtkWindow" id="window1"> + <property name="can_focus">False</property> <accel-groups> <group name="accelgroup1"/> </accel-groups> - <signal name="delete_event" handler="on_window_delete_event"/> + <signal name="delete-event" handler="on_window_delete_event" swapped="no"/> <child> <object class="GtkVBox" id="vbox1"> <property name="visible">True</property> - <property name="orientation">vertical</property> + <property name="can_focus">False</property> <child> <object class="GtkMenuBar" id="menubar1"> <property name="visible">True</property> + <property name="can_focus">False</property> <child> <object class="GtkMenuItem" id="menuitem1"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="label" translatable="yes">_File</property> <property name="use_underline">True</property> <child type="submenu"> <object class="GtkMenu" id="menu1"> <property name="visible">True</property> + <property name="can_focus">False</property> <child> <object class="GtkImageMenuItem" id="clear_menuitem"> <property name="label">Clear</property> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="image">image4</property> <property name="use_stock">False</property> <property name="accel_group">accelgroup1</property> + <signal name="activate" handler="on_clear_menuitem_activate" swapped="no"/> <accelerator key="n" signal="activate" modifiers="GDK_CONTROL_MASK"/> - <signal name="activate" handler="on_clear_menuitem_activate"/> </object> </child> <child> <object class="GtkImageMenuItem" id="open_session_menuitem"> <property name="label">_Load session</property> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Load a previous saved session.</property> <property name="use_underline">True</property> <property name="image">image3</property> <property name="use_stock">False</property> <property name="accel_group">accelgroup1</property> + <signal name="activate" handler="on_open_session_menuitem_activate" swapped="no"/> <accelerator key="o" signal="activate" modifiers="GDK_CONTROL_MASK"/> - <signal name="activate" handler="on_open_session_menuitem_activate"/> </object> </child> <child> <object class="GtkImageMenuItem" id="save_session_menuitem"> <property name="label">_Save session</property> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Save the current session.</property> <property name="use_underline">True</property> <property name="image">image1</property> <property name="use_stock">False</property> <property name="accel_group">accelgroup1</property> + <signal name="activate" handler="on_save_session_menuitem_activate" swapped="no"/> <accelerator key="s" signal="activate" modifiers="GDK_CONTROL_MASK"/> - <signal name="activate" handler="on_save_session_menuitem_activate"/> </object> </child> <child> <object class="GtkImageMenuItem" id="save_session_as_menuitem"> <property name="label">Save session as ...</property> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Save the current session in file chosen by the user.</property> <property name="image">image2</property> <property name="use_stock">False</property> <property name="accel_group">accelgroup1</property> - <signal name="activate" handler="on_save_session_as_menuitem_activate"/> + <signal name="activate" handler="on_save_session_as_menuitem_activate" swapped="no"/> </object> </child> <child> <object class="GtkSeparatorMenuItem" id="menuitem5"> <property name="visible">True</property> + <property name="can_focus">False</property> </object> </child> <child> <object class="GtkImageMenuItem" id="imagemenuitem5"> <property name="label">gtk-quit</property> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Exit from the application.</property> <property name="use_underline">True</property> <property name="use_stock">True</property> <property name="accel_group">accelgroup1</property> - <signal name="activate" handler="on_quit_menu_item_activate"/> + <signal name="activate" handler="on_quit_menu_item_activate" swapped="no"/> </object> </child> </object> @@ -1018,30 +1259,34 @@ file chosen by the user.</property> <child> <object class="GtkMenuItem" id="menuitem2"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="label" translatable="yes">_Tools</property> <property name="use_underline">True</property> <child type="submenu"> <object class="GtkMenu" id="menu2"> <property name="visible">True</property> + <property name="can_focus">False</property> <child> <object class="GtkMenuItem" id="capture_cl_menuitem"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Capture the command line that would be used to generate the bindings modules.</property> <property name="label" translatable="yes">_Capture CL</property> <property name="use_underline">True</property> + <signal name="activate" handler="on_capture_cl_menuitem_activate" swapped="no"/> <accelerator key="t" signal="activate" modifiers="GDK_CONTROL_MASK"/> - <signal name="activate" handler="on_capture_cl_menuitem_activate"/> </object> </child> <child> <object class="GtkMenuItem" id="generate_menuitem"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Generate the bindings modules.</property> <property name="label" translatable="yes">_Generate</property> <property name="use_underline">True</property> + <signal name="activate" handler="on_generate_menuitem_activate" swapped="no"/> <accelerator key="g" signal="activate" modifiers="GDK_CONTROL_MASK"/> - <signal name="activate" handler="on_generate_menuitem_activate"/> </object> </child> </object> @@ -1051,19 +1296,22 @@ to generate the bindings modules.</property> <child> <object class="GtkMenuItem" id="menuitem4"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="label" translatable="yes">_Help</property> <property name="use_underline">True</property> <child type="submenu"> <object class="GtkMenu" id="menu3"> <property name="visible">True</property> + <property name="can_focus">False</property> <child> <object class="GtkImageMenuItem" id="imagemenuitem10"> <property name="label">gtk-about</property> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="use_underline">True</property> <property name="use_stock">True</property> <property name="accel_group">accelgroup1</property> - <signal name="activate" handler="on_about_menu_item_activate"/> + <signal name="activate" handler="on_about_menu_item_activate" swapped="no"/> </object> </child> </object> @@ -1073,1018 +1321,1384 @@ to generate the bindings modules.</property> </object> <packing> <property name="expand">False</property> + <property name="fill">True</property> <property name="position">0</property> </packing> </child> <child> - <object class="GtkTable" id="table1"> + <object class="GtkScrolledWindow" id="scrolledwindow2"> <property name="visible">True</property> - <property name="n_rows">22</property> - <property name="n_columns">4</property> - <child> - <object class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Input schema file:</property> - </object> - </child> - <child> - <object class="GtkLabel" id="label2"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Output superclass file:</property> - </object> - <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label3"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Output subclass file:</property> - </object> - <packing> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label4"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Overwrite without asking:</property> - </object> - <packing> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - </packing> - </child> + <property name="can_focus">True</property> + <property name="shadow_type">in</property> + <property name="min_content_width">1000</property> + <property name="min_content_height">600</property> <child> - <object class="GtkCheckButton" id="force_checkbutton"> - <property name="label" translatable="yes">Force</property> + <object class="GtkViewport" id="viewport1"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Always overwrite output files. + <property name="can_focus">False</property> + <child> + <object class="GtkTable" id="table1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="n_rows">29</property> + <property name="n_columns">4</property> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Input schema file:</property> + <property name="xalign">0</property> + </object> + </child> + <child> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Output superclass file:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Output subclass file:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Overwrite without asking:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="force_checkbutton"> + <property name="label" translatable="yes">Force</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Always overwrite output files. Do not ask for confirmation.</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="input_schema_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">The path and name of the + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="input_schema_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">The path and name of the input XML schema defining the bindings to be generated.</property> - <property name="invisible_char">●</property> - <property name="width_chars">80</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="output_superclass_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">The path and name of the output file + <property name="invisible_char">â—</property> + <property name="width_chars">80</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="output_superclass_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">The path and name of the output file to be generated and to contain the superclasses.</property> - <property name="invisible_char">●</property> - <signal name="changed" handler="on_output_superclass_entry_changed"/> - </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> - </packing> - </child> - <child> - <object class="GtkEntry" id="output_subclass_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">The path and name of the output file + <property name="invisible_char">â—</property> + <signal name="changed" handler="on_output_superclass_entry_changed" swapped="no"/> + </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> + </packing> + </child> + <child> + <object class="GtkEntry" id="output_subclass_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">The path and name of the output file to be generated and to contain the subclasses.</property> - <property name="invisible_char">●</property> - </object> - <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> - <child> - <object class="GtkLabel" id="label5"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Prefix (for class names):</property> - </object> - <packing> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="prefix_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Prefix for class names.</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label6"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Namespace prefix:</property> - </object> - <packing> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="namespace_prefix_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="events">GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property> - <property name="tooltip_text" translatable="yes">Override default namespace + <property name="invisible_char">â—</property> + </object> + <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> + <child> + <object class="GtkLabel" id="label5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Prefix (for class names):</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="prefix_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Prefix for class names.</property> + <property name="invisible_char">â—</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label6"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Namespace prefix:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">5</property> + <property name="bottom_attach">6</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="namespace_prefix_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="events">GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property> + <property name="tooltip_text" translatable="yes">Override default namespace prefix in schema file. Example: -a "xsd:" Default: "xs:".</property> - <property name="invisible_char">●</property> - <signal name="changed" handler="on_namespace_prefix_entry_changed"/> - </object> - <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> - </packing> - </child> - <child> - <object class="GtkLabel" id="label7"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Behavior file name:</property> - </object> - <packing> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="behavior_filename_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Input file name for behaviors + <property name="invisible_char">â—</property> + <signal name="changed" handler="on_namespace_prefix_entry_changed" swapped="no"/> + </object> + <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> + </packing> + </child> + <child> + <object class="GtkLabel" id="label7"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Behavior file name:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">6</property> + <property name="bottom_attach">7</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="behavior_filename_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Input file name for behaviors added to subclasses.</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label8"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Generate Python properties:</property> - </object> - <packing> - <property name="top_attach">7</property> - <property name="bottom_attach">8</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="properties_checkbutton"> - <property name="label" translatable="yes">Properties</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Generate Python properties for member variables + <property name="invisible_char">â—</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">6</property> + <property name="bottom_attach">7</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label8"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Generate Python properties:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">7</property> + <property name="bottom_attach">8</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="properties_checkbutton"> + <property name="label" translatable="yes">Properties</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Generate Python properties for member variables so that the value can be retrieved and modified without calling getter and setter functions. </property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">7</property> - <property name="bottom_attach">8</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label10"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Subclass suffix:</property> - </object> - <packing> - <property name="top_attach">9</property> - <property name="bottom_attach">10</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="subclass_suffix_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Append this text to the generated subclass names. + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">7</property> + <property name="bottom_attach">8</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label10"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Subclass suffix:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">9</property> + <property name="bottom_attach">10</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="subclass_suffix_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Append this text to the generated subclass names. Default="Sub".</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">9</property> - <property name="bottom_attach">10</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label11"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Root element:</property> - </object> - <packing> - <property name="top_attach">10</property> - <property name="bottom_attach">11</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="root_element_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Assume that this value is the name + <property name="invisible_char">â—</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">9</property> + <property name="bottom_attach">10</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label11"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Root element:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">10</property> + <property name="bottom_attach">11</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="root_element_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Assume that this value is the name of the root element of instance docs. Default is first element defined in schema.</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">10</property> - <property name="bottom_attach">11</property> - </packing> - </child> - <child> - <object class="GtkButton" id="input_schema_chooser_button"> - <property name="label" translatable="yes">Choose</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Choose the input schema file.</property> - <signal name="clicked" handler="on_input_schema_chooser_button_clicked"/> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - </packing> - </child> - <child> - <object class="GtkButton" id="output_superclass_chooser_button"> - <property name="label" translatable="yes">Choose</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Choose the output superclass bindings file.</property> - <signal name="clicked" handler="on_output_superclass_chooser_button_clicked"/> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - </packing> - </child> - <child> - <object class="GtkButton" id="output_subclass_chooser_button"> - <property name="label" translatable="yes">Choose</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Choose the output subclass bindings file.</property> - <signal name="clicked" handler="on_output_subclass_chooser_button_clicked"/> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - </packing> - </child> - <child> - <object class="GtkButton" id="behavior_filename_chooser_button"> - <property name="label" translatable="yes">Choose</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Choose the nput file name for + <property name="invisible_char">â—</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">10</property> + <property name="bottom_attach">11</property> + </packing> + </child> + <child> + <object class="GtkButton" id="input_schema_chooser_button"> + <property name="label" translatable="yes">Choose</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Choose the input schema file.</property> + <signal name="clicked" handler="on_input_schema_chooser_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + </packing> + </child> + <child> + <object class="GtkButton" id="output_superclass_chooser_button"> + <property name="label" translatable="yes">Choose</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Choose the output superclass bindings file.</property> + <signal name="clicked" handler="on_output_superclass_chooser_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + </packing> + </child> + <child> + <object class="GtkButton" id="output_subclass_chooser_button"> + <property name="label" translatable="yes">Choose</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Choose the output subclass bindings file.</property> + <signal name="clicked" handler="on_output_subclass_chooser_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + </packing> + </child> + <child> + <object class="GtkButton" id="behavior_filename_chooser_button"> + <property name="label" translatable="yes">Choose</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Choose the nput file name for behaviors added to subclasses.</property> - <signal name="clicked" handler="on_behavior_filename_chooser_button_clicked"/> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label12"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Superclass module:</property> - </object> - <packing> - <property name="top_attach">11</property> - <property name="bottom_attach">12</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="superclass_module_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Superclass module name in subclass module. + <signal name="clicked" handler="on_behavior_filename_chooser_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">6</property> + <property name="bottom_attach">7</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label12"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Superclass module:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">11</property> + <property name="bottom_attach">12</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="superclass_module_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Superclass module name in subclass module. Default="???".</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">11</property> - <property name="bottom_attach">12</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label13"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Use old getters and setters:</property> - </object> - <packing> - <property name="top_attach">12</property> - <property name="bottom_attach">13</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="old_getters_setters_checkbutton"> - <property name="label" translatable="yes">Old getters and setters</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Name getters and setters getVar() and setVar(), + <property name="invisible_char">â—</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">11</property> + <property name="bottom_attach">12</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label13"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Use old getters and setters:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">12</property> + <property name="bottom_attach">13</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="old_getters_setters_checkbutton"> + <property name="label" translatable="yes">Old getters and setters</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Name getters and setters getVar() and setVar(), instead of get_var() and set_var().</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">12</property> - <property name="bottom_attach">13</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label14"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Validator bodies path:</property> - </object> - <packing> - <property name="top_attach">13</property> - <property name="bottom_attach">14</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label15"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">User methods module:</property> - </object> - <packing> - <property name="top_attach">14</property> - <property name="bottom_attach">15</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label16"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">No dates:</property> - </object> - <packing> - <property name="top_attach">15</property> - <property name="bottom_attach">16</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label17"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">No versions:</property> - </object> - <packing> - <property name="top_attach">16</property> - <property name="bottom_attach">17</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="no_dates_checkbutton"> - <property name="label" translatable="yes">No dates in generated output</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Do not include the current date in the generated + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">12</property> + <property name="bottom_attach">13</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label14"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Validator bodies path:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">13</property> + <property name="bottom_attach">14</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label15"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">User methods module:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">14</property> + <property name="bottom_attach">15</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label16"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">No dates:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">15</property> + <property name="bottom_attach">16</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label17"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">No versions:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">16</property> + <property name="bottom_attach">17</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="no_dates_checkbutton"> + <property name="label" translatable="yes">No dates in generated output</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Do not include the current date in the generated files. This is useful if you want to minimize the amount of (no-operation) changes to the generated python code.</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">15</property> - <property name="bottom_attach">16</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="validator_bodies_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Path to a directory containing files that provide + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">15</property> + <property name="bottom_attach">16</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="validator_bodies_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Path to a directory containing files that provide bodies (implementations) of validator methods.</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">13</property> - <property name="bottom_attach">14</property> - </packing> - </child> - <child> - <object class="GtkButton" id="validator_bodies_chooser_button"> - <property name="label" translatable="yes">Choose</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Choose the path to a directory containing files that provide + <property name="invisible_char">â—</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">13</property> + <property name="bottom_attach">14</property> + </packing> + </child> + <child> + <object class="GtkButton" id="validator_bodies_chooser_button"> + <property name="label" translatable="yes">Choose</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Choose the path to a directory containing files that provide bodies (implementations) of validator methods.</property> - <signal name="clicked" handler="on_validator_bodies_chooser_button_clicked"/> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">13</property> - <property name="bottom_attach">14</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="no_versions_checkbutton"> - <property name="label" translatable="yes">No version info in generated output</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Do not include the current version in the generated + <signal name="clicked" handler="on_validator_bodies_chooser_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">13</property> + <property name="bottom_attach">14</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="no_versions_checkbutton"> + <property name="label" translatable="yes">No version info in generated output</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Do not include the current version in the generated files. This is useful if you want to minimize the amount of (no-operation) changes to the generated python code.</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">16</property> - <property name="bottom_attach">17</property> - </packing> - </child> - <child> - <object class="GtkButton" id="user_methods_button"> - <property name="label" translatable="yes">Choose</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Choose the optional module containing user methods. See + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">16</property> + <property name="bottom_attach">17</property> + </packing> + </child> + <child> + <object class="GtkButton" id="user_methods_button"> + <property name="label" translatable="yes">Choose</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Choose the optional module containing user methods. See section "User Methods" in the documentation.</property> - <signal name="clicked" handler="on_user_methods_chooser_button_clicked"/> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">14</property> - <property name="bottom_attach">15</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="user_methods_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Optional module containing user methods. See + <signal name="clicked" handler="on_user_methods_chooser_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">14</property> + <property name="bottom_attach">15</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="user_methods_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Optional module containing user methods. See section "User Methods" in the documentation.</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">14</property> - <property name="bottom_attach">15</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label18"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">No process includes:</property> - </object> - <packing> - <property name="top_attach">17</property> - <property name="bottom_attach">18</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label19"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Silence:</property> - </object> - <packing> - <property name="top_attach">18</property> - <property name="bottom_attach">19</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="no_process_includes_checkbutton"> - <property name="label" translatable="yes">Do not process includes in schema</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Do not process included XML Schema files. By + <property name="invisible_char">â—</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">14</property> + <property name="bottom_attach">15</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label18"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">No process includes:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">17</property> + <property name="bottom_attach">18</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label19"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Silence:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">18</property> + <property name="bottom_attach">19</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="no_process_includes_checkbutton"> + <property name="label" translatable="yes">Do not process includes in schema</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Do not process included XML Schema files. By default, generateDS.py will insert content from files referenced by <include ... /> elements into the XML Schema to be processed.</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">17</property> - <property name="bottom_attach">18</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="silence_checkbutton"> - <property name="label" translatable="yes">Generate code that does not echo the parsed XML</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Normally, the code generated with generateDS + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">17</property> + <property name="bottom_attach">18</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="silence_checkbutton"> + <property name="label" translatable="yes">Generate code that does not echo the parsed XML</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Normally, the code generated with generateDS echoes the information being parsed. Use this option to turn off that behavior. </property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">18</property> - <property name="bottom_attach">19</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label20"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Namespace definitions:</property> - </object> - <packing> - <property name="top_attach">19</property> - <property name="bottom_attach">20</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label21"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">External encoding:</property> - </object> - <packing> - <property name="top_attach">20</property> - <property name="bottom_attach">21</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label22"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Member specs:</property> - </object> - <packing> - <property name="top_attach">21</property> - <property name="bottom_attach">22</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="namespace_defs_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Namespace definition to be passed in as the + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">18</property> + <property name="bottom_attach">19</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label20"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Namespace definitions:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">19</property> + <property name="bottom_attach">20</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label21"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">External encoding:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">20</property> + <property name="bottom_attach">21</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label22"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Member specs:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">22</property> + <property name="bottom_attach">23</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="namespace_defs_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Namespace definition to be passed in as the value for the namespacedef_ parameter of the export() method by the generated parse() and parseString() functions. Default=''. Example: xmlns:abc="http://www.abc.com"</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">19</property> - <property name="bottom_attach">20</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="external_encoding_entry"> - <property name="visible">True</property> - <property name="tooltip_text" translatable="yes">Encode output written by the generated export + <property name="invisible_char">â—</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">19</property> + <property name="bottom_attach">20</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="external_encoding_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Encode output written by the generated export methods using this encoding. Default, if omitted, is the value returned by sys.getdefaultencoding(). Example: utf-8.</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">20</property> - <property name="bottom_attach">21</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="member_specs_combobox_container"> - <property name="visible">True</property> - <child> - <placeholder/> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">20</property> + <property name="bottom_attach">21</property> + </packing> + </child> + <child> + <object class="GtkHBox" id="member_specs_combobox_container"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">22</property> + <property name="bottom_attach">23</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="empty_namespace_prefix_checkbutton"> + <property name="label" translatable="yes">Empty</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Assume an empty namespace +prefix in the XML schema, not +the default ("xs:").</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="on_empty_namespace_prefix_checkbutton_toggled" swapped="no"/> + </object> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">5</property> + <property name="bottom_attach">6</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="auto_super_checkbutton"> + <property name="label" translatable="yes">Auto</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Use the superclass file name +stem as the super-class module +name.</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="on_auto_super_checkbutton_toggled" swapped="no"/> + </object> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">11</property> + <property name="bottom_attach">12</property> + </packing> + </child> + <child> + <object class="GtkButton" id="input_schema_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the input schema file entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + </packing> + </child> + <child> + <object class="GtkButton" id="output_superclass_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the output superclass file entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + </packing> + </child> + <child> + <object class="GtkButton" id="output_subclass_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the output subclass file entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + </packing> + </child> + <child> + <object class="GtkButton" id="prefix_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the prefix entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + </packing> + </child> + <child> + <object class="GtkButton" id="namespace_prefix_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the XML namespace prefix entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">5</property> + <property name="bottom_attach">6</property> + </packing> + </child> + <child> + <object class="GtkButton" id="behavior_filename_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the behavior file name entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">6</property> + <property name="bottom_attach">7</property> + </packing> + </child> + <child> + <object class="GtkButton" id="subclass_suffix_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the subclass suffix.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">9</property> + <property name="bottom_attach">10</property> + </packing> + </child> + <child> + <object class="GtkButton" id="root_element_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the root element entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">10</property> + <property name="bottom_attach">11</property> + </packing> + </child> + <child> + <object class="GtkButton" id="superclass_module_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the superclass module entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">11</property> + <property name="bottom_attach">12</property> + </packing> + </child> + <child> + <object class="GtkButton" id="validator_bodies_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the validator bodies path entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">13</property> + <property name="bottom_attach">14</property> + </packing> + </child> + <child> + <object class="GtkButton" id="user_methods_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the user methods module entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">14</property> + <property name="bottom_attach">15</property> + </packing> + </child> + <child> + <object class="GtkButton" id="namespace_defs_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the namespace definitions entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">19</property> + <property name="bottom_attach">20</property> + </packing> + </child> + <child> + <object class="GtkButton" id="external_encoding_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the external encoding entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">20</property> + <property name="bottom_attach">21</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label23"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Get encoded:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">21</property> + <property name="bottom_attach">22</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="get_encoded_checkbutton"> + <property name="label" translatable="yes">Getters return encoded values by default</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Getters return encoded value by default if true. +Can be changed at run-time by either +(1) changing global variable GetEncodedValue or +(2) using optional parameter to getter.</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">21</property> + <property name="bottom_attach">22</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label24"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Exports:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">23</property> + <property name="bottom_attach">24</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="export_spec_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Specifies export functions to be generated. Value is a whitespace separated list of any of the following: "write" (write XML to file), "literal" (write out python code), "etree" (build element tree (can serialize to XML)). Example: "write etree". Default: "write".</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">23</property> + <property name="bottom_attach">24</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label25"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">One file per XSD:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">24</property> + <property name="bottom_attach">25</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="one_file_per_xsd_checkbutton"> + <property name="label" translatable="yes">Create a python module for each XSD processed.</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Create a python module for each XSD processed.</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">24</property> + <property name="bottom_attach">25</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label26"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Output directory:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">25</property> + <property name="bottom_attach">26</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="output_directory_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Used in conjunction with --one-file-per-xsd. The directory where the modules will be created.</property> + <property name="invisible_char">â—</property> + <property name="width_chars">80</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">25</property> + <property name="bottom_attach">26</property> + </packing> + </child> + <child> + <object class="GtkButton" id="output_directory_chooser_button"> + <property name="label" translatable="yes">Choose</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Choose the output directory for one-file-per-xsd.</property> + <signal name="clicked" handler="on_output_directory_chooser_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">25</property> + <property name="bottom_attach">26</property> + </packing> + </child> + <child> + <object class="GtkButton" id="output_directory_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the output directory entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">25</property> + <property name="bottom_attach">26</property> + </packing> + </child> + <child> + <object class="GtkButton" id="export_spec_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the exports entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">23</property> + <property name="bottom_attach">24</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label27"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Module suffix:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">26</property> + <property name="bottom_attach">27</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label28"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Preserve CData tags:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">27</property> + <property name="bottom_attach">28</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label29"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Cleanup name list:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="top_attach">28</property> + <property name="bottom_attach">29</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="module_suffix_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">To be used in conjunction with --one-file-per-xsd. Append XXX to the end of each file created.</property> + <property name="invisible_char">â—</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">26</property> + <property name="bottom_attach">27</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="cleanup_name_list_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Specifies list of 2-tuples used for cleaning names. First element is a regular expression search pattern and second is a replacement. Example: "[('[-:.]', '_'), ('^__', 'Special')]". Default: "[('[-:.]', '_')]".</property> + <property name="invisible_char">â—</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">28</property> + <property name="bottom_attach">29</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="preserve_cdata_tags_checkbutton"> + <property name="label" translatable="yes">Preserve CData tags</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Preserve CDATA tags. Default: False.</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">27</property> + <property name="bottom_attach">28</property> + </packing> + </child> + <child> + <object class="GtkButton" id="module_suffix_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the module suffix entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">26</property> + <property name="bottom_attach">27</property> + </packing> + </child> + <child> + <object class="GtkButton" id="cleanup_name_list_clear_button"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Clear the cleanup name list entry.</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_clear_button_clicked" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">28</property> + <property name="bottom_attach">29</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + </object> </child> </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">21</property> - <property name="bottom_attach">22</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="empty_namespace_prefix_checkbutton"> - <property name="label" translatable="yes">Empty</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Assume an empty namespace -prefix in the XML schema, not -the default ("xs:").</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_empty_namespace_prefix_checkbutton_toggled"/> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="auto_super_checkbutton"> - <property name="label" translatable="yes">Auto</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Use the superclass file name -stem as the super-class module -name.</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_auto_super_checkbutton_toggled"/> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">11</property> - <property name="bottom_attach">12</property> - </packing> - </child> - <child> - <object class="GtkButton" id="input_schema_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the input schema file entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - </packing> - </child> - <child> - <object class="GtkButton" id="output_superclass_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the output superclass file entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - </packing> - </child> - <child> - <object class="GtkButton" id="output_subclass_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the output subclass file entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - </packing> - </child> - <child> - <object class="GtkButton" id="prefix_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the prefix entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - </packing> - </child> - <child> - <object class="GtkButton" id="namespace_prefix_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the XML namespace prefix entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> - </packing> - </child> - <child> - <object class="GtkButton" id="behavior_filename_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the behavior file name entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> - </packing> - </child> - <child> - <object class="GtkButton" id="subclass_suffix_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the subclass suffix.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">9</property> - <property name="bottom_attach">10</property> - </packing> - </child> - <child> - <object class="GtkButton" id="root_element_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the root element entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">10</property> - <property name="bottom_attach">11</property> - </packing> - </child> - <child> - <object class="GtkButton" id="superclass_module_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the superclass module entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">11</property> - <property name="bottom_attach">12</property> - </packing> - </child> - <child> - <object class="GtkButton" id="validator_bodies_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the validator bodies path entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">13</property> - <property name="bottom_attach">14</property> - </packing> - </child> - <child> - <object class="GtkButton" id="user_methods_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the user methods module entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">14</property> - <property name="bottom_attach">15</property> - </packing> - </child> - <child> - <object class="GtkButton" id="namespace_defs_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the namespace definitions entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">19</property> - <property name="bottom_attach">20</property> - </packing> - </child> - <child> - <object class="GtkButton" id="external_encoding_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the external encoding entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">20</property> - <property name="bottom_attach">21</property> - </packing> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> </child> </object> <packing> + <property name="expand">True</property> + <property name="fill">True</property> <property name="position">1</property> </packing> </child> <child> <object class="GtkHBox" id="hbox1"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="homogeneous">True</property> <child> <object class="GtkButton" id="generate_button"> @@ -2093,9 +2707,11 @@ name.</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="tooltip_text" translatable="yes">Generate the bindings modules.</property> - <signal name="clicked" handler="on_generate_button_clicked"/> + <signal name="clicked" handler="on_generate_button_clicked" swapped="no"/> </object> <packing> + <property name="expand">True</property> + <property name="fill">True</property> <property name="position">0</property> </packing> </child> @@ -2106,24 +2722,30 @@ name.</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="tooltip_text" translatable="yes">Exit from the application.</property> - <signal name="clicked" handler="on_quit_button_clicked"/> + <signal name="clicked" handler="on_quit_button_clicked" swapped="no"/> </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">2</property> </packing> </child> <child> <object class="GtkStatusbar" id="statusbar1"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="spacing">2</property> </object> <packing> <property name="expand">False</property> + <property name="fill">True</property> <property name="position">3</property> </packing> </child> @@ -2133,87 +2755,9 @@ name.</property> </object> </child> </object> - <object class="GtkAccelGroup" id="accelgroup1"/> - <object class="GtkDialog" id="content_dialog"> - <property name="border_width">5</property> - <property name="title" translatable="yes">Messages and Content</property> - <property name="default_width">800</property> - <property name="default_height">600</property> - <property name="type_hint">normal</property> - <child internal-child="vbox"> - <object class="GtkVBox" id="dialog-vbox3"> - <property name="visible">True</property> - <property name="orientation">vertical</property> - <property name="spacing">2</property> - <child> - <object class="GtkScrolledWindow" id="scrolledwindow1"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">automatic</property> - <property name="vscrollbar_policy">automatic</property> - <property name="min_content_width">250</property> - <property name="min_content_height">500</property> - <child> - <object class="GtkTextView" id="content_textview"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">False</property> - </object> - </child> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - <child internal-child="action_area"> - <object class="GtkHButtonBox" id="dialog-action_area3"> - <property name="visible">True</property> - <property name="layout_style">end</property> - <child> - <object class="GtkButton" id="content_dialog_ok_button"> - <property name="label" translatable="yes">OK</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <signal name="activate" handler="on_ok_button_activate"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="pack_type">end</property> - <property name="position">0</property> - </packing> - </child> - </object> - </child> - <action-widgets> - <action-widget response="0">content_dialog_ok_button</action-widget> - </action-widgets> - </object> - <object class="GtkImage" id="image1"> - <property name="visible">True</property> - <property name="stock">gtk-save</property> - </object> - <object class="GtkImage" id="image2"> - <property name="visible">True</property> - <property name="stock">gtk-save-as</property> - </object> - <object class="GtkImage" id="image3"> - <property name="visible">True</property> - <property name="stock">gtk-open</property> - </object> - <object class="GtkImage" id="image4"> - <property name="visible">True</property> - <property name="stock">gtk-clear</property> - </object> <object class="GtkImage" id="image5"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="stock">gtk-missing-image</property> </object> </interface> @@ -2223,7 +2767,5 @@ name.</property> # Do not change the above 3 lines. - if __name__ == "__main__": main() - diff --git a/gui/generateds_gui_session.py b/gui/generateds_gui_session.py index 4a4ef0966fcbaf35198d0b3cd25ab2b6c0f6edce..1d11fb4d58e0162e11da1472c3c1c44f7e1ddbe9 100644 --- a/gui/generateds_gui_session.py +++ b/gui/generateds_gui_session.py @@ -1,862 +1,1344 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# -# Generated Wed Dec 8 14:24:46 2010 by generateDS.py version 2.3a. -# - -import sys -import getopt -import re as re_ - -etree_ = None -Verbose_import_ = False -( XMLParser_import_none, XMLParser_import_lxml, - XMLParser_import_elementtree - ) = list(range(3)) -XMLParser_import_library = None -try: - # lxml - from lxml import etree as etree_ - XMLParser_import_library = XMLParser_import_lxml - if Verbose_import_: - print("running with lxml.etree") -except ImportError: - try: - # cElementTree from Python 2.5+ - import xml.etree.cElementTree as etree_ - XMLParser_import_library = XMLParser_import_elementtree - if Verbose_import_: - print("running with cElementTree on Python 2.5+") - except ImportError: - try: - # ElementTree from Python 2.5+ - import xml.etree.ElementTree as etree_ - XMLParser_import_library = XMLParser_import_elementtree - if Verbose_import_: - print("running with ElementTree on Python 2.5+") - except ImportError: - try: - # normal cElementTree install - import cElementTree as etree_ - XMLParser_import_library = XMLParser_import_elementtree - if Verbose_import_: - print("running with cElementTree") - except ImportError: - try: - # normal ElementTree install - import elementtree.ElementTree as etree_ - XMLParser_import_library = XMLParser_import_elementtree - if Verbose_import_: - print("running with ElementTree") - except ImportError: - raise ImportError("Failed to import ElementTree from any known place") - -def parsexml_(*args, **kwargs): - if (XMLParser_import_library == XMLParser_import_lxml and - 'parser' not in kwargs): - # Use the lxml ElementTree compatible parser so that, e.g., - # we ignore comments. - kwargs['parser'] = etree_.ETCompatXMLParser() - doc = etree_.parse(*args, **kwargs) - return doc - -# -# User methods -# -# Calls to the methods in these classes are generated by generateDS.py. -# You can replace these methods by re-implementing the following class -# in a module named generatedssuper.py. - -try: - from generatedssuper import GeneratedsSuper -except ImportError as exp: - - class GeneratedsSuper(object): - def gds_format_string(self, input_data, input_name=''): - return input_data.decode('utf-8') if isinstance(input_data, bytes) else input_data - def gds_format_integer(self, input_data, input_name=''): - return '%d' % input_data - def gds_format_float(self, input_data, input_name=''): - return '%f' % input_data - def gds_format_double(self, input_data, input_name=''): - return '%e' % input_data - def gds_format_boolean(self, input_data, input_name=''): - return '%s' % input_data - def gds_str_lower(self, instring): - return instring.lower() - - - -# -# If you have installed IPython you can uncomment and use the following. -# IPython is available from http://ipython.scipy.org/. -# - -## from IPython.Shell import IPShellEmbed -## args = '' -## ipshell = IPShellEmbed(args, -## banner = 'Dropping into IPython', -## exit_msg = 'Leaving Interpreter, back to program.') - -# Then use the following line where and when you want to drop into the -# IPython shell: -# ipshell('<some message> -- Entering ipshell.\nHit Ctrl-D to exit') - -# -# Globals -# - -ExternalEncoding = 'ascii' -Tag_pattern_ = re_.compile(r'({.*})?(.*)') -STRING_CLEANUP_PAT = re_.compile(r"[\n\r\s]+") - -# -# Support/utility functions. -# - -def showIndent(outfile, level): - for idx in range(level): - outfile.write(' ') - -def quote_xml(inStr): - if not inStr: - return '' - s1 = (isinstance(inStr, str) and inStr or - '%s' % inStr) - s1 = s1.replace('&', '&') - s1 = s1.replace('<', '<') - s1 = s1.replace('>', '>') - return s1 - -def quote_attrib(inStr): - s1 = (isinstance(inStr, str) and inStr or - '%s' % inStr) - s1 = s1.replace('&', '&') - s1 = s1.replace('<', '<') - s1 = s1.replace('>', '>') - if '"' in s1: - if "'" in s1: - s1 = '"%s"' % s1.replace('"', """) - else: - s1 = "'%s'" % s1 - else: - s1 = '"%s"' % s1 - return s1 - -def quote_python(inStr): - s1 = inStr - if s1.find("'") == -1: - if s1.find('\n') == -1: - return "'%s'" % s1 - else: - return "'''%s'''" % s1 - else: - if s1.find('"') != -1: - s1 = s1.replace('"', '\\"') - if s1.find('\n') == -1: - return '"%s"' % s1 - else: - return '"""%s"""' % s1 - - -def get_all_text_(node): - if node.text is not None: - text = node.text - else: - text = '' - for child in node: - if child.tail is not None: - text += child.tail - return text - - -class GDSParseError(Exception): - pass - -def raise_parse_error(node, msg): - if XMLParser_import_library == XMLParser_import_lxml: - msg = '%s (element %s/line %d)' % (msg, node.tag, node.sourceline, ) - else: - msg = '%s (element %s)' % (msg, node.tag, ) - raise GDSParseError(msg) - - -class MixedContainer: - # Constants for category: - CategoryNone = 0 - CategoryText = 1 - CategorySimple = 2 - CategoryComplex = 3 - # Constants for content_type: - TypeNone = 0 - TypeText = 1 - TypeString = 2 - TypeInteger = 3 - TypeFloat = 4 - TypeDecimal = 5 - TypeDouble = 6 - TypeBoolean = 7 - def __init__(self, category, content_type, name, value): - self.category = category - self.content_type = content_type - self.name = name - self.value = value - def getCategory(self): - return self.category - def getContenttype(self, content_type): - return self.content_type - def getValue(self): - return self.value - def getName(self): - return self.name - def export(self, outfile, level, name, namespace): - if self.category == MixedContainer.CategoryText: - # Prevent exporting empty content as empty lines. - if self.value.strip(): - outfile.write(self.value) - elif self.category == MixedContainer.CategorySimple: - self.exportSimple(outfile, level, name) - else: # category == MixedContainer.CategoryComplex - self.value.export(outfile, level, namespace,name) - def exportSimple(self, outfile, level, name): - if self.content_type == MixedContainer.TypeString: - outfile.write('<%s>%s</%s>' % (self.name, self.value, self.name)) - elif self.content_type == MixedContainer.TypeInteger or \ - self.content_type == MixedContainer.TypeBoolean: - outfile.write('<%s>%d</%s>' % (self.name, self.value, self.name)) - elif self.content_type == MixedContainer.TypeFloat or \ - self.content_type == MixedContainer.TypeDecimal: - outfile.write('<%s>%f</%s>' % (self.name, self.value, self.name)) - elif self.content_type == MixedContainer.TypeDouble: - outfile.write('<%s>%g</%s>' % (self.name, self.value, self.name)) - def exportLiteral(self, outfile, level, name): - if self.category == MixedContainer.CategoryText: - showIndent(outfile, level) - outfile.write('model_.MixedContainer(%d, %d, "%s", "%s"),\n' % \ - (self.category, self.content_type, self.name, self.value)) - elif self.category == MixedContainer.CategorySimple: - showIndent(outfile, level) - outfile.write('model_.MixedContainer(%d, %d, "%s", "%s"),\n' % \ - (self.category, self.content_type, self.name, self.value)) - else: # category == MixedContainer.CategoryComplex - showIndent(outfile, level) - outfile.write('model_.MixedContainer(%d, %d, "%s",\n' % \ - (self.category, self.content_type, self.name,)) - self.value.exportLiteral(outfile, level + 1) - showIndent(outfile, level) - outfile.write(')\n') - - -class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0): - self.name = name - self.data_type = data_type - self.container = container - def set_name(self, name): self.name = name - def get_name(self): return self.name - def set_data_type(self, data_type): self.data_type = data_type - def get_data_type_chain(self): return self.data_type - def get_data_type(self): - if isinstance(self.data_type, list): - if len(self.data_type) > 0: - return self.data_type[-1] - else: - return 'xs:string' - else: - return self.data_type - def set_container(self, container): self.container = container - def get_container(self): return self.container - -def _cast(typ, value): - if typ is None or value is None: - return value - return typ(value) - -# -# Mixin class for additional behaviors. -# - -class SessionTypeMixin(object): - def copy(self): - """Produce a copy of myself. - """ - new_session = sessionType( - input_schema = self.input_schema, - output_superclass = self.output_superclass, - output_subclass = self.output_subclass, - force = self.force, - prefix = self.prefix, - namespace_prefix = self.namespace_prefix, - empty_namespace_prefix = self.empty_namespace_prefix, - behavior_filename = self.behavior_filename, - properties = self.properties, - subclass_suffix = self.subclass_suffix, - root_element = self.root_element, - superclass_module = self.superclass_module, - auto_super = self.auto_super, - old_getters_setters = self.old_getters_setters, - validator_bodies = self.validator_bodies, - user_methods = self.user_methods, - no_dates = self.no_dates, - no_versions = self.no_versions, - no_process_includes = self.no_process_includes, - silence = self.silence, - namespace_defs = self.namespace_defs, - external_encoding = self.external_encoding, - member_specs = self.member_specs, - ) - return new_session - - def __eq__(self, obj): - """Implement the == operator. - """ - if ( - obj.input_schema == self.input_schema and - obj.output_superclass == self.output_superclass and - obj.output_subclass == self.output_subclass and - obj.force == self.force and - obj.prefix == self.prefix and - obj.namespace_prefix == self.namespace_prefix and - obj.empty_namespace_prefix == self.empty_namespace_prefix and - obj.behavior_filename == self.behavior_filename and - obj.properties == self.properties and - obj.subclass_suffix == self.subclass_suffix and - obj.root_element == self.root_element and - obj.superclass_module == self.superclass_module and - obj.auto_super == self.auto_super and - obj.old_getters_setters == self.old_getters_setters and - obj.validator_bodies == self.validator_bodies and - obj.user_methods == self.user_methods and - obj.no_dates == self.no_dates and - obj.no_versions == self.no_versions and - obj.no_process_includes == self.no_process_includes and - obj.silence == self.silence and - obj.namespace_defs == self.namespace_defs and - obj.external_encoding == self.external_encoding and - obj.member_specs == self.member_specs): - return True - else: - return False - - def __ne__(self, obj): - """Implement the != operator. - """ - return not self.__eq__(obj) - -# -# Data representation classes. -# - -class sessionType(GeneratedsSuper, SessionTypeMixin): - member_data_items_ = [ - MemberSpec_('input_schema', 'xs:string', 0), - MemberSpec_('output_superclass', 'xs:string', 0), - MemberSpec_('output_subclass', 'xs:string', 0), - MemberSpec_('force', 'xs:boolean', 0), - MemberSpec_('prefix', 'xs:string', 0), - MemberSpec_('namespace_prefix', 'xs:string', 0), - MemberSpec_('empty_namespace_prefix', 'xs:boolean', 0), - MemberSpec_('behavior_filename', 'xs:string', 0), - MemberSpec_('properties', 'xs:boolean', 0), - MemberSpec_('subclass_suffix', 'xs:string', 0), - MemberSpec_('root_element', 'xs:string', 0), - MemberSpec_('superclass_module', 'xs:string', 0), - MemberSpec_('auto_super', 'xs:boolean', 0), - MemberSpec_('old_getters_setters', 'xs:boolean', 0), - MemberSpec_('validator_bodies', 'xs:string', 0), - MemberSpec_('user_methods', 'xs:string', 0), - MemberSpec_('no_dates', 'xs:boolean', 0), - MemberSpec_('no_versions', 'xs:boolean', 0), - MemberSpec_('no_process_includes', 'xs:boolean', 0), - MemberSpec_('silence', 'xs:boolean', 0), - MemberSpec_('namespace_defs', 'xs:string', 0), - MemberSpec_('external_encoding', 'xs:string', 0), - MemberSpec_('member_specs', 'xs:string', 0), - ] - subclass = None - superclass = None - def __init__(self, input_schema=None, output_superclass=None, output_subclass=None, force=None, prefix=None, namespace_prefix=None, empty_namespace_prefix=None, behavior_filename=None, properties=None, subclass_suffix=None, root_element=None, superclass_module=None, auto_super=None, old_getters_setters=None, validator_bodies=None, user_methods=None, no_dates=None, no_versions=None, no_process_includes=None, silence=None, namespace_defs=None, external_encoding=None, member_specs=None): - self.input_schema = input_schema - self.output_superclass = output_superclass - self.output_subclass = output_subclass - self.force = force - self.prefix = prefix - self.namespace_prefix = namespace_prefix - self.empty_namespace_prefix = empty_namespace_prefix - self.behavior_filename = behavior_filename - self.properties = properties - self.subclass_suffix = subclass_suffix - self.root_element = root_element - self.superclass_module = superclass_module - self.auto_super = auto_super - self.old_getters_setters = old_getters_setters - self.validator_bodies = validator_bodies - self.user_methods = user_methods - self.no_dates = no_dates - self.no_versions = no_versions - self.no_process_includes = no_process_includes - self.silence = silence - self.namespace_defs = namespace_defs - self.external_encoding = external_encoding - self.member_specs = member_specs - def factory(*args_, **kwargs_): - if sessionType.subclass: - return sessionType.subclass(*args_, **kwargs_) - else: - return sessionType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_input_schema(self): return self.input_schema - def set_input_schema(self, input_schema): self.input_schema = input_schema - def get_output_superclass(self): return self.output_superclass - def set_output_superclass(self, output_superclass): self.output_superclass = output_superclass - def get_output_subclass(self): return self.output_subclass - def set_output_subclass(self, output_subclass): self.output_subclass = output_subclass - def get_force(self): return self.force - def set_force(self, force): self.force = force - def get_prefix(self): return self.prefix - def set_prefix(self, prefix): self.prefix = prefix - def get_namespace_prefix(self): return self.namespace_prefix - def set_namespace_prefix(self, namespace_prefix): self.namespace_prefix = namespace_prefix - def get_empty_namespace_prefix(self): return self.empty_namespace_prefix - def set_empty_namespace_prefix(self, empty_namespace_prefix): self.empty_namespace_prefix = empty_namespace_prefix - def get_behavior_filename(self): return self.behavior_filename - def set_behavior_filename(self, behavior_filename): self.behavior_filename = behavior_filename - def get_properties(self): return self.properties - def set_properties(self, properties): self.properties = properties - def get_subclass_suffix(self): return self.subclass_suffix - def set_subclass_suffix(self, subclass_suffix): self.subclass_suffix = subclass_suffix - def get_root_element(self): return self.root_element - def set_root_element(self, root_element): self.root_element = root_element - def get_superclass_module(self): return self.superclass_module - def set_superclass_module(self, superclass_module): self.superclass_module = superclass_module - def get_auto_super(self): return self.auto_super - def set_auto_super(self, auto_super): self.auto_super = auto_super - def get_old_getters_setters(self): return self.old_getters_setters - def set_old_getters_setters(self, old_getters_setters): self.old_getters_setters = old_getters_setters - def get_validator_bodies(self): return self.validator_bodies - def set_validator_bodies(self, validator_bodies): self.validator_bodies = validator_bodies - def get_user_methods(self): return self.user_methods - def set_user_methods(self, user_methods): self.user_methods = user_methods - def get_no_dates(self): return self.no_dates - def set_no_dates(self, no_dates): self.no_dates = no_dates - def get_no_versions(self): return self.no_versions - def set_no_versions(self, no_versions): self.no_versions = no_versions - def get_no_process_includes(self): return self.no_process_includes - def set_no_process_includes(self, no_process_includes): self.no_process_includes = no_process_includes - def get_silence(self): return self.silence - def set_silence(self, silence): self.silence = silence - def get_namespace_defs(self): return self.namespace_defs - def set_namespace_defs(self, namespace_defs): self.namespace_defs = namespace_defs - def get_external_encoding(self): return self.external_encoding - def set_external_encoding(self, external_encoding): self.external_encoding = external_encoding - def get_member_specs(self): return self.member_specs - def set_member_specs(self, member_specs): self.member_specs = member_specs - def export(self, outfile, level, namespace_='', name_='sessionType', namespacedef_=''): - showIndent(outfile, level) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - self.exportAttributes(outfile, level, [], namespace_, name_='sessionType') - if self.hasContent_(): - outfile.write('>\n') - self.exportChildren(outfile, level + 1, namespace_, name_) - showIndent(outfile, level) - outfile.write('</%s%s>\n' % (namespace_, name_)) - else: - outfile.write('/>\n') - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='sessionType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='sessionType'): - if self.input_schema is not None: - showIndent(outfile, level) - outfile.write('<%sinput_schema>%s</%sinput_schema>\n' % (namespace_, self.gds_format_string(quote_xml(self.input_schema).encode(ExternalEncoding), input_name='input_schema'), namespace_)) - if self.output_superclass is not None: - showIndent(outfile, level) - outfile.write('<%soutput_superclass>%s</%soutput_superclass>\n' % (namespace_, self.gds_format_string(quote_xml(self.output_superclass).encode(ExternalEncoding), input_name='output_superclass'), namespace_)) - if self.output_subclass is not None: - showIndent(outfile, level) - outfile.write('<%soutput_subclass>%s</%soutput_subclass>\n' % (namespace_, self.gds_format_string(quote_xml(self.output_subclass).encode(ExternalEncoding), input_name='output_subclass'), namespace_)) - if self.force is not None: - showIndent(outfile, level) - outfile.write('<%sforce>%s</%sforce>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.force)), input_name='force'), namespace_)) - if self.prefix is not None: - showIndent(outfile, level) - outfile.write('<%sprefix>%s</%sprefix>\n' % (namespace_, self.gds_format_string(quote_xml(self.prefix).encode(ExternalEncoding), input_name='prefix'), namespace_)) - if self.namespace_prefix is not None: - showIndent(outfile, level) - outfile.write('<%snamespace_prefix>%s</%snamespace_prefix>\n' % (namespace_, self.gds_format_string(quote_xml(self.namespace_prefix).encode(ExternalEncoding), input_name='namespace_prefix'), namespace_)) - if self.empty_namespace_prefix is not None: - showIndent(outfile, level) - outfile.write('<%sempty_namespace_prefix>%s</%sempty_namespace_prefix>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.empty_namespace_prefix)), input_name='empty_namespace_prefix'), namespace_)) - if self.behavior_filename is not None: - showIndent(outfile, level) - outfile.write('<%sbehavior_filename>%s</%sbehavior_filename>\n' % (namespace_, self.gds_format_string(quote_xml(self.behavior_filename).encode(ExternalEncoding), input_name='behavior_filename'), namespace_)) - if self.properties is not None: - showIndent(outfile, level) - outfile.write('<%sproperties>%s</%sproperties>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.properties)), input_name='properties'), namespace_)) - if self.subclass_suffix is not None: - showIndent(outfile, level) - outfile.write('<%ssubclass_suffix>%s</%ssubclass_suffix>\n' % (namespace_, self.gds_format_string(quote_xml(self.subclass_suffix).encode(ExternalEncoding), input_name='subclass_suffix'), namespace_)) - if self.root_element is not None: - showIndent(outfile, level) - outfile.write('<%sroot_element>%s</%sroot_element>\n' % (namespace_, self.gds_format_string(quote_xml(self.root_element).encode(ExternalEncoding), input_name='root_element'), namespace_)) - if self.superclass_module is not None: - showIndent(outfile, level) - outfile.write('<%ssuperclass_module>%s</%ssuperclass_module>\n' % (namespace_, self.gds_format_string(quote_xml(self.superclass_module).encode(ExternalEncoding), input_name='superclass_module'), namespace_)) - if self.auto_super is not None: - showIndent(outfile, level) - outfile.write('<%sauto_super>%s</%sauto_super>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.auto_super)), input_name='auto_super'), namespace_)) - if self.old_getters_setters is not None: - showIndent(outfile, level) - outfile.write('<%sold_getters_setters>%s</%sold_getters_setters>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.old_getters_setters)), input_name='old_getters_setters'), namespace_)) - if self.validator_bodies is not None: - showIndent(outfile, level) - outfile.write('<%svalidator_bodies>%s</%svalidator_bodies>\n' % (namespace_, self.gds_format_string(quote_xml(self.validator_bodies).encode(ExternalEncoding), input_name='validator_bodies'), namespace_)) - if self.user_methods is not None: - showIndent(outfile, level) - outfile.write('<%suser_methods>%s</%suser_methods>\n' % (namespace_, self.gds_format_string(quote_xml(self.user_methods).encode(ExternalEncoding), input_name='user_methods'), namespace_)) - if self.no_dates is not None: - showIndent(outfile, level) - outfile.write('<%sno_dates>%s</%sno_dates>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.no_dates)), input_name='no_dates'), namespace_)) - if self.no_versions is not None: - showIndent(outfile, level) - outfile.write('<%sno_versions>%s</%sno_versions>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.no_versions)), input_name='no_versions'), namespace_)) - if self.no_process_includes is not None: - showIndent(outfile, level) - outfile.write('<%sno_process_includes>%s</%sno_process_includes>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.no_process_includes)), input_name='no_process_includes'), namespace_)) - if self.silence is not None: - showIndent(outfile, level) - outfile.write('<%ssilence>%s</%ssilence>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.silence)), input_name='silence'), namespace_)) - if self.namespace_defs is not None: - showIndent(outfile, level) - outfile.write('<%snamespace_defs>%s</%snamespace_defs>\n' % (namespace_, self.gds_format_string(quote_xml(self.namespace_defs).encode(ExternalEncoding), input_name='namespace_defs'), namespace_)) - if self.external_encoding is not None: - showIndent(outfile, level) - outfile.write('<%sexternal_encoding>%s</%sexternal_encoding>\n' % (namespace_, self.gds_format_string(quote_xml(self.external_encoding).encode(ExternalEncoding), input_name='external_encoding'), namespace_)) - if self.member_specs is not None: - showIndent(outfile, level) - outfile.write('<%smember_specs>%s</%smember_specs>\n' % (namespace_, self.gds_format_string(quote_xml(self.member_specs).encode(ExternalEncoding), input_name='member_specs'), namespace_)) - def hasContent_(self): - if ( - self.input_schema is not None or - self.output_superclass is not None or - self.output_subclass is not None or - self.force is not None or - self.prefix is not None or - self.namespace_prefix is not None or - self.empty_namespace_prefix is not None or - self.behavior_filename is not None or - self.properties is not None or - self.subclass_suffix is not None or - self.root_element is not None or - self.superclass_module is not None or - self.auto_super is not None or - self.old_getters_setters is not None or - self.validator_bodies is not None or - self.user_methods is not None or - self.no_dates is not None or - self.no_versions is not None or - self.no_process_includes is not None or - self.silence is not None or - self.namespace_defs is not None or - self.external_encoding is not None or - self.member_specs is not None - ): - return True - else: - return False - def exportLiteral(self, outfile, level, name_='sessionType'): - level += 1 - self.exportLiteralAttributes(outfile, level, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.input_schema is not None: - showIndent(outfile, level) - outfile.write('input_schema=%s,\n' % quote_python(self.input_schema).encode(ExternalEncoding)) - if self.output_superclass is not None: - showIndent(outfile, level) - outfile.write('output_superclass=%s,\n' % quote_python(self.output_superclass).encode(ExternalEncoding)) - if self.output_subclass is not None: - showIndent(outfile, level) - outfile.write('output_subclass=%s,\n' % quote_python(self.output_subclass).encode(ExternalEncoding)) - if self.force is not None: - showIndent(outfile, level) - outfile.write('force=%s,\n' % self.force) - if self.prefix is not None: - showIndent(outfile, level) - outfile.write('prefix=%s,\n' % quote_python(self.prefix).encode(ExternalEncoding)) - if self.namespace_prefix is not None: - showIndent(outfile, level) - outfile.write('namespace_prefix=%s,\n' % quote_python(self.namespace_prefix).encode(ExternalEncoding)) - if self.empty_namespace_prefix is not None: - showIndent(outfile, level) - outfile.write('empty_namespace_prefix=%s,\n' % self.empty_namespace_prefix) - if self.behavior_filename is not None: - showIndent(outfile, level) - outfile.write('behavior_filename=%s,\n' % quote_python(self.behavior_filename).encode(ExternalEncoding)) - if self.properties is not None: - showIndent(outfile, level) - outfile.write('properties=%s,\n' % self.properties) - if self.subclass_suffix is not None: - showIndent(outfile, level) - outfile.write('subclass_suffix=%s,\n' % quote_python(self.subclass_suffix).encode(ExternalEncoding)) - if self.root_element is not None: - showIndent(outfile, level) - outfile.write('root_element=%s,\n' % quote_python(self.root_element).encode(ExternalEncoding)) - if self.superclass_module is not None: - showIndent(outfile, level) - outfile.write('superclass_module=%s,\n' % quote_python(self.superclass_module).encode(ExternalEncoding)) - if self.auto_super is not None: - showIndent(outfile, level) - outfile.write('auto_super=%s,\n' % self.auto_super) - if self.old_getters_setters is not None: - showIndent(outfile, level) - outfile.write('old_getters_setters=%s,\n' % self.old_getters_setters) - if self.validator_bodies is not None: - showIndent(outfile, level) - outfile.write('validator_bodies=%s,\n' % quote_python(self.validator_bodies).encode(ExternalEncoding)) - if self.user_methods is not None: - showIndent(outfile, level) - outfile.write('user_methods=%s,\n' % quote_python(self.user_methods).encode(ExternalEncoding)) - if self.no_dates is not None: - showIndent(outfile, level) - outfile.write('no_dates=%s,\n' % self.no_dates) - if self.no_versions is not None: - showIndent(outfile, level) - outfile.write('no_versions=%s,\n' % self.no_versions) - if self.no_process_includes is not None: - showIndent(outfile, level) - outfile.write('no_process_includes=%s,\n' % self.no_process_includes) - if self.silence is not None: - showIndent(outfile, level) - outfile.write('silence=%s,\n' % self.silence) - if self.namespace_defs is not None: - showIndent(outfile, level) - outfile.write('namespace_defs=%s,\n' % quote_python(self.namespace_defs).encode(ExternalEncoding)) - if self.external_encoding is not None: - showIndent(outfile, level) - outfile.write('external_encoding=%s,\n' % quote_python(self.external_encoding).encode(ExternalEncoding)) - if self.member_specs is not None: - showIndent(outfile, level) - outfile.write('member_specs=%s,\n' % quote_python(self.member_specs).encode(ExternalEncoding)) - def build(self, node): - self.buildAttributes(node, node.attrib, []) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, nodeName_) - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, nodeName_, from_subclass=False): - if nodeName_ == 'input_schema': - input_schema_ = child_.text - self.input_schema = input_schema_ - elif nodeName_ == 'output_superclass': - output_superclass_ = child_.text - self.output_superclass = output_superclass_ - elif nodeName_ == 'output_subclass': - output_subclass_ = child_.text - self.output_subclass = output_subclass_ - elif nodeName_ == 'force': - sval_ = child_.text - if sval_ in ('true', '1'): - ival_ = True - elif sval_ in ('false', '0'): - ival_ = False - else: - raise_parse_error(child_, 'requires boolean') - self.force = ival_ - elif nodeName_ == 'prefix': - prefix_ = child_.text - self.prefix = prefix_ - elif nodeName_ == 'namespace_prefix': - namespace_prefix_ = child_.text - self.namespace_prefix = namespace_prefix_ - elif nodeName_ == 'empty_namespace_prefix': - sval_ = child_.text - if sval_ in ('true', '1'): - ival_ = True - elif sval_ in ('false', '0'): - ival_ = False - else: - raise_parse_error(child_, 'requires boolean') - self.empty_namespace_prefix = ival_ - elif nodeName_ == 'behavior_filename': - behavior_filename_ = child_.text - self.behavior_filename = behavior_filename_ - elif nodeName_ == 'properties': - sval_ = child_.text - if sval_ in ('true', '1'): - ival_ = True - elif sval_ in ('false', '0'): - ival_ = False - else: - raise_parse_error(child_, 'requires boolean') - self.properties = ival_ - elif nodeName_ == 'subclass_suffix': - subclass_suffix_ = child_.text - self.subclass_suffix = subclass_suffix_ - elif nodeName_ == 'root_element': - root_element_ = child_.text - self.root_element = root_element_ - elif nodeName_ == 'superclass_module': - superclass_module_ = child_.text - self.superclass_module = superclass_module_ - elif nodeName_ == 'auto_super': - sval_ = child_.text - if sval_ in ('true', '1'): - ival_ = True - elif sval_ in ('false', '0'): - ival_ = False - else: - raise_parse_error(child_, 'requires boolean') - self.auto_super = ival_ - elif nodeName_ == 'old_getters_setters': - sval_ = child_.text - if sval_ in ('true', '1'): - ival_ = True - elif sval_ in ('false', '0'): - ival_ = False - else: - raise_parse_error(child_, 'requires boolean') - self.old_getters_setters = ival_ - elif nodeName_ == 'validator_bodies': - validator_bodies_ = child_.text - self.validator_bodies = validator_bodies_ - elif nodeName_ == 'user_methods': - user_methods_ = child_.text - self.user_methods = user_methods_ - elif nodeName_ == 'no_dates': - sval_ = child_.text - if sval_ in ('true', '1'): - ival_ = True - elif sval_ in ('false', '0'): - ival_ = False - else: - raise_parse_error(child_, 'requires boolean') - self.no_dates = ival_ - elif nodeName_ == 'no_versions': - sval_ = child_.text - if sval_ in ('true', '1'): - ival_ = True - elif sval_ in ('false', '0'): - ival_ = False - else: - raise_parse_error(child_, 'requires boolean') - self.no_versions = ival_ - elif nodeName_ == 'no_process_includes': - sval_ = child_.text - if sval_ in ('true', '1'): - ival_ = True - elif sval_ in ('false', '0'): - ival_ = False - else: - raise_parse_error(child_, 'requires boolean') - self.no_process_includes = ival_ - elif nodeName_ == 'silence': - sval_ = child_.text - if sval_ in ('true', '1'): - ival_ = True - elif sval_ in ('false', '0'): - ival_ = False - else: - raise_parse_error(child_, 'requires boolean') - self.silence = ival_ - elif nodeName_ == 'namespace_defs': - namespace_defs_ = child_.text - self.namespace_defs = namespace_defs_ - elif nodeName_ == 'external_encoding': - external_encoding_ = child_.text - self.external_encoding = external_encoding_ - elif nodeName_ == 'member_specs': - member_specs_ = child_.text - self.member_specs = member_specs_ -# end class sessionType - - -USAGE_TEXT = """ -Usage: python <Parser>.py [ -s ] <in_xml_file> -""" - -def usage(): - print(USAGE_TEXT) - sys.exit(1) - - -def get_root_tag(node): - tag = Tag_pattern_.match(node.tag).groups()[-1] - rootClass = globals().get(tag) - return tag, rootClass - - -def parse(inFileName): - doc = parsexml_(inFileName) - rootNode = doc.getroot() - rootTag, rootClass = get_root_tag(rootNode) - if rootClass is None: - rootTag = 'session' - rootClass = sessionType - rootObj = rootClass.factory() - rootObj.build(rootNode) - # Enable Python to collect the space used by the DOM. - doc = None - sys.stdout.write('<?xml version="1.0" ?>\n') - rootObj.export(sys.stdout, 0, name_=rootTag, - namespacedef_='') - return rootObj - - -def parseString(inString): - from io import StringIO - doc = parsexml_(StringIO(inString)) - rootNode = doc.getroot() - rootTag, rootClass = get_root_tag(rootNode) - if rootClass is None: - rootTag = 'session' - rootClass = sessionType - rootObj = rootClass.factory() - rootObj.build(rootNode) - # Enable Python to collect the space used by the DOM. - doc = None - sys.stdout.write('<?xml version="1.0" ?>\n') - rootObj.export(sys.stdout, 0, name_="session", - namespacedef_='') - return rootObj - - -def parseLiteral(inFileName): - doc = parsexml_(inFileName) - rootNode = doc.getroot() - rootTag, rootClass = get_root_tag(rootNode) - if rootClass is None: - rootTag = 'session' - rootClass = sessionType - rootObj = rootClass.factory() - rootObj.build(rootNode) - # Enable Python to collect the space used by the DOM. - doc = None - sys.stdout.write('#from generateds_gui_session import *\n\n') - sys.stdout.write('import generateds_gui_session as model_\n\n') - sys.stdout.write('rootObj = model_.rootTag(\n') - rootObj.exportLiteral(sys.stdout, 0, name_=rootTag) - sys.stdout.write(')\n') - return rootObj - - -def main(): - args = sys.argv[1:] - if len(args) == 1: - parse(args[0]) - else: - usage() - - -if __name__ == '__main__': - #import pdb; pdb.set_trace() - main() - - -__all__ = [ - "sessionType" - ] +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Generated Fri Apr 8 12:08:30 2016 by generateDS.py version 2.21a. +# +# Command line options: +# ('-f', '') +# ('-o', 'generateds_gui_session.py') +# ('--member-specs', 'list') +# +# Command line arguments: +# generateds_gui_session.xsd +# +# Command line: +# ../generateDS.py -f -o "generateds_gui_session.py" --member-specs="list" generateds_gui_session.xsd +# +# Current working directory (os.getcwd()): +# gui +# + +import sys +import re as re_ +import base64 +import datetime as datetime_ +import warnings as warnings_ +from lxml import etree as etree_ + + +Validate_simpletypes_ = True +if sys.version_info.major == 2: + BaseStrType_ = basestring +else: + BaseStrType_ = str + + +def parsexml_(infile, parser=None, **kwargs): + if parser is None: + # Use the lxml ElementTree compatible parser so that, e.g., + # we ignore comments. + parser = etree_.ETCompatXMLParser() + doc = etree_.parse(infile, parser=parser, **kwargs) + return doc + +# +# User methods +# +# Calls to the methods in these classes are generated by generateDS.py. +# You can replace these methods by re-implementing the following class +# in a module named generatedssuper.py. + +try: + from generatedssuper import GeneratedsSuper +except ImportError as exp: + + class GeneratedsSuper(object): + tzoff_pattern = re_.compile(r'(\+|-)((0\d|1[0-3]):[0-5]\d|14:00)$') + class _FixedOffsetTZ(datetime_.tzinfo): + def __init__(self, offset, name): + self.__offset = datetime_.timedelta(minutes=offset) + self.__name = name + def utcoffset(self, dt): + return self.__offset + def tzname(self, dt): + return self.__name + def dst(self, dt): + return None + def gds_format_string(self, input_data, input_name=''): + return input_data + def gds_validate_string(self, input_data, node=None, input_name=''): + if not input_data: + return '' + else: + return input_data + def gds_format_base64(self, input_data, input_name=''): + return base64.b64encode(input_data) + def gds_validate_base64(self, input_data, node=None, input_name=''): + return input_data + def gds_format_integer(self, input_data, input_name=''): + return '%d' % input_data + def gds_validate_integer(self, input_data, node=None, input_name=''): + return input_data + def gds_format_integer_list(self, input_data, input_name=''): + return '%s' % ' '.join(input_data) + def gds_validate_integer_list( + self, input_data, node=None, input_name=''): + values = input_data.split() + for value in values: + try: + int(value) + except (TypeError, ValueError): + raise_parse_error(node, 'Requires sequence of integers') + return values + def gds_format_float(self, input_data, input_name=''): + return ('%.15f' % input_data).rstrip('0') + def gds_validate_float(self, input_data, node=None, input_name=''): + return input_data + def gds_format_float_list(self, input_data, input_name=''): + return '%s' % ' '.join(input_data) + def gds_validate_float_list( + self, input_data, node=None, input_name=''): + values = input_data.split() + for value in values: + try: + float(value) + except (TypeError, ValueError): + raise_parse_error(node, 'Requires sequence of floats') + return values + def gds_format_double(self, input_data, input_name=''): + return '%e' % input_data + def gds_validate_double(self, input_data, node=None, input_name=''): + return input_data + def gds_format_double_list(self, input_data, input_name=''): + return '%s' % ' '.join(input_data) + def gds_validate_double_list( + self, input_data, node=None, input_name=''): + values = input_data.split() + for value in values: + try: + float(value) + except (TypeError, ValueError): + raise_parse_error(node, 'Requires sequence of doubles') + return values + def gds_format_boolean(self, input_data, input_name=''): + return ('%s' % input_data).lower() + def gds_validate_boolean(self, input_data, node=None, input_name=''): + return input_data + def gds_format_boolean_list(self, input_data, input_name=''): + return '%s' % ' '.join(input_data) + def gds_validate_boolean_list( + self, input_data, node=None, input_name=''): + values = input_data.split() + for value in values: + if value not in ('true', '1', 'false', '0', ): + raise_parse_error( + node, + 'Requires sequence of booleans ' + '("true", "1", "false", "0")') + return values + def gds_validate_datetime(self, input_data, node=None, input_name=''): + return input_data + def gds_format_datetime(self, input_data, input_name=''): + if input_data.microsecond == 0: + _svalue = '%04d-%02d-%02dT%02d:%02d:%02d' % ( + input_data.year, + input_data.month, + input_data.day, + input_data.hour, + input_data.minute, + input_data.second, + ) + else: + _svalue = '%04d-%02d-%02dT%02d:%02d:%02d.%s' % ( + input_data.year, + input_data.month, + input_data.day, + input_data.hour, + input_data.minute, + input_data.second, + ('%f' % (float(input_data.microsecond) / 1000000))[2:], + ) + if input_data.tzinfo is not None: + tzoff = input_data.tzinfo.utcoffset(input_data) + if tzoff is not None: + total_seconds = tzoff.seconds + (86400 * tzoff.days) + if total_seconds == 0: + _svalue += 'Z' + else: + if total_seconds < 0: + _svalue += '-' + total_seconds *= -1 + else: + _svalue += '+' + hours = total_seconds // 3600 + minutes = (total_seconds - (hours * 3600)) // 60 + _svalue += '{0:02d}:{1:02d}'.format(hours, minutes) + return _svalue + @classmethod + def gds_parse_datetime(cls, input_data): + tz = None + if input_data[-1] == 'Z': + tz = GeneratedsSuper._FixedOffsetTZ(0, 'UTC') + input_data = input_data[:-1] + else: + results = GeneratedsSuper.tzoff_pattern.search(input_data) + if results is not None: + tzoff_parts = results.group(2).split(':') + tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1]) + if results.group(1) == '-': + tzoff *= -1 + tz = GeneratedsSuper._FixedOffsetTZ( + tzoff, results.group(0)) + input_data = input_data[:-6] + time_parts = input_data.split('.') + if len(time_parts) > 1: + micro_seconds = int(float('0.' + time_parts[1]) * 1000000) + input_data = '%s.%s' % (time_parts[0], micro_seconds, ) + dt = datetime_.datetime.strptime( + input_data, '%Y-%m-%dT%H:%M:%S.%f') + else: + dt = datetime_.datetime.strptime( + input_data, '%Y-%m-%dT%H:%M:%S') + dt = dt.replace(tzinfo=tz) + return dt + def gds_validate_date(self, input_data, node=None, input_name=''): + return input_data + def gds_format_date(self, input_data, input_name=''): + _svalue = '%04d-%02d-%02d' % ( + input_data.year, + input_data.month, + input_data.day, + ) + try: + if input_data.tzinfo is not None: + tzoff = input_data.tzinfo.utcoffset(input_data) + if tzoff is not None: + total_seconds = tzoff.seconds + (86400 * tzoff.days) + if total_seconds == 0: + _svalue += 'Z' + else: + if total_seconds < 0: + _svalue += '-' + total_seconds *= -1 + else: + _svalue += '+' + hours = total_seconds // 3600 + minutes = (total_seconds - (hours * 3600)) // 60 + _svalue += '{0:02d}:{1:02d}'.format( + hours, minutes) + except AttributeError: + pass + return _svalue + @classmethod + def gds_parse_date(cls, input_data): + tz = None + if input_data[-1] == 'Z': + tz = GeneratedsSuper._FixedOffsetTZ(0, 'UTC') + input_data = input_data[:-1] + else: + results = GeneratedsSuper.tzoff_pattern.search(input_data) + if results is not None: + tzoff_parts = results.group(2).split(':') + tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1]) + if results.group(1) == '-': + tzoff *= -1 + tz = GeneratedsSuper._FixedOffsetTZ( + tzoff, results.group(0)) + input_data = input_data[:-6] + dt = datetime_.datetime.strptime(input_data, '%Y-%m-%d') + dt = dt.replace(tzinfo=tz) + return dt.date() + def gds_validate_time(self, input_data, node=None, input_name=''): + return input_data + def gds_format_time(self, input_data, input_name=''): + if input_data.microsecond == 0: + _svalue = '%02d:%02d:%02d' % ( + input_data.hour, + input_data.minute, + input_data.second, + ) + else: + _svalue = '%02d:%02d:%02d.%s' % ( + input_data.hour, + input_data.minute, + input_data.second, + ('%f' % (float(input_data.microsecond) / 1000000))[2:], + ) + if input_data.tzinfo is not None: + tzoff = input_data.tzinfo.utcoffset(input_data) + if tzoff is not None: + total_seconds = tzoff.seconds + (86400 * tzoff.days) + if total_seconds == 0: + _svalue += 'Z' + else: + if total_seconds < 0: + _svalue += '-' + total_seconds *= -1 + else: + _svalue += '+' + hours = total_seconds // 3600 + minutes = (total_seconds - (hours * 3600)) // 60 + _svalue += '{0:02d}:{1:02d}'.format(hours, minutes) + return _svalue + def gds_validate_simple_patterns(self, patterns, target): + # pat is a list of lists of strings/patterns. We should: + # - AND the outer elements + # - OR the inner elements + found1 = True + for patterns1 in patterns: + found2 = False + for patterns2 in patterns1: + if re_.search(patterns2, target) is not None: + found2 = True + break + if not found2: + found1 = False + break + return found1 + @classmethod + def gds_parse_time(cls, input_data): + tz = None + if input_data[-1] == 'Z': + tz = GeneratedsSuper._FixedOffsetTZ(0, 'UTC') + input_data = input_data[:-1] + else: + results = GeneratedsSuper.tzoff_pattern.search(input_data) + if results is not None: + tzoff_parts = results.group(2).split(':') + tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1]) + if results.group(1) == '-': + tzoff *= -1 + tz = GeneratedsSuper._FixedOffsetTZ( + tzoff, results.group(0)) + input_data = input_data[:-6] + if len(input_data.split('.')) > 1: + dt = datetime_.datetime.strptime(input_data, '%H:%M:%S.%f') + else: + dt = datetime_.datetime.strptime(input_data, '%H:%M:%S') + dt = dt.replace(tzinfo=tz) + return dt.time() + def gds_str_lower(self, instring): + return instring.lower() + def get_path_(self, node): + path_list = [] + self.get_path_list_(node, path_list) + path_list.reverse() + path = '/'.join(path_list) + return path + Tag_strip_pattern_ = re_.compile(r'\{.*\}') + def get_path_list_(self, node, path_list): + if node is None: + return + tag = GeneratedsSuper.Tag_strip_pattern_.sub('', node.tag) + if tag: + path_list.append(tag) + self.get_path_list_(node.getparent(), path_list) + def get_class_obj_(self, node, default_class=None): + class_obj1 = default_class + if 'xsi' in node.nsmap: + classname = node.get('{%s}type' % node.nsmap['xsi']) + if classname is not None: + names = classname.split(':') + if len(names) == 2: + classname = names[1] + class_obj2 = globals().get(classname) + if class_obj2 is not None: + class_obj1 = class_obj2 + return class_obj1 + def gds_build_any(self, node, type_name=None): + return None + @classmethod + def gds_reverse_node_mapping(cls, mapping): + return dict(((v, k) for k, v in mapping.iteritems())) + @staticmethod + def gds_encode(instring): + if sys.version_info.major == 2: + return instring.encode(ExternalEncoding) + else: + return instring + + def getSubclassFromModule_(module, class_): + '''Get the subclass of a class from a specific module.''' + name = class_.__name__ + 'Sub' + if hasattr(module, name): + return getattr(module, name) + else: + return None + + +# +# If you have installed IPython you can uncomment and use the following. +# IPython is available from http://ipython.scipy.org/. +# + +## from IPython.Shell import IPShellEmbed +## args = '' +## ipshell = IPShellEmbed(args, +## banner = 'Dropping into IPython', +## exit_msg = 'Leaving Interpreter, back to program.') + +# Then use the following line where and when you want to drop into the +# IPython shell: +# ipshell('<some message> -- Entering ipshell.\nHit Ctrl-D to exit') + +# +# Globals +# + +ExternalEncoding = 'ascii' +Tag_pattern_ = re_.compile(r'({.*})?(.*)') +String_cleanup_pat_ = re_.compile(r"[\n\r\s]+") +Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)') +CDATA_pattern_ = re_.compile(r"<!\[CDATA\[.*?\]\]>", re_.DOTALL) + +# Change this to redirect the generated superclass module to use a +# specific subclass module. +CurrentSubclassModule_ = None + +# +# Support/utility functions. +# + + +def showIndent(outfile, level, pretty_print=True): + if pretty_print: + for idx in range(level): + outfile.write(' ') + + +def quote_xml(inStr): + "Escape markup chars, but do not modify CDATA sections." + if not inStr: + return '' + s1 = (isinstance(inStr, BaseStrType_) and inStr or '%s' % inStr) + s2 = '' + pos = 0 + matchobjects = CDATA_pattern_.finditer(s1) + for mo in matchobjects: + s3 = s1[pos:mo.start()] + s2 += quote_xml_aux(s3) + s2 += s1[mo.start():mo.end()] + pos = mo.end() + s3 = s1[pos:] + s2 += quote_xml_aux(s3) + return s2 + + +def quote_xml_aux(inStr): + s1 = inStr.replace('&', '&') + s1 = s1.replace('<', '<') + s1 = s1.replace('>', '>') + return s1 + + +def quote_attrib(inStr): + s1 = (isinstance(inStr, BaseStrType_) and inStr or '%s' % inStr) + s1 = s1.replace('&', '&') + s1 = s1.replace('<', '<') + s1 = s1.replace('>', '>') + if '"' in s1: + if "'" in s1: + s1 = '"%s"' % s1.replace('"', """) + else: + s1 = "'%s'" % s1 + else: + s1 = '"%s"' % s1 + return s1 + + +def quote_python(inStr): + s1 = inStr + if s1.find("'") == -1: + if s1.find('\n') == -1: + return "'%s'" % s1 + else: + return "'''%s'''" % s1 + else: + if s1.find('"') != -1: + s1 = s1.replace('"', '\\"') + if s1.find('\n') == -1: + return '"%s"' % s1 + else: + return '"""%s"""' % s1 + + +def get_all_text_(node): + if node.text is not None: + text = node.text + else: + text = '' + for child in node: + if child.tail is not None: + text += child.tail + return text + + +def find_attr_value_(attr_name, node): + attrs = node.attrib + attr_parts = attr_name.split(':') + value = None + if len(attr_parts) == 1: + value = attrs.get(attr_name) + elif len(attr_parts) == 2: + prefix, name = attr_parts + namespace = node.nsmap.get(prefix) + if namespace is not None: + value = attrs.get('{%s}%s' % (namespace, name, )) + return value + + +class GDSParseError(Exception): + pass + + +def raise_parse_error(node, msg): + msg = '%s (element %s/line %d)' % (msg, node.tag, node.sourceline, ) + raise GDSParseError(msg) + + +class MixedContainer: + # Constants for category: + CategoryNone = 0 + CategoryText = 1 + CategorySimple = 2 + CategoryComplex = 3 + # Constants for content_type: + TypeNone = 0 + TypeText = 1 + TypeString = 2 + TypeInteger = 3 + TypeFloat = 4 + TypeDecimal = 5 + TypeDouble = 6 + TypeBoolean = 7 + TypeBase64 = 8 + def __init__(self, category, content_type, name, value): + self.category = category + self.content_type = content_type + self.name = name + self.value = value + def getCategory(self): + return self.category + def getContenttype(self, content_type): + return self.content_type + def getValue(self): + return self.value + def getName(self): + return self.name + def export(self, outfile, level, name, namespace, pretty_print=True): + if self.category == MixedContainer.CategoryText: + # Prevent exporting empty content as empty lines. + if self.value.strip(): + outfile.write(self.value) + elif self.category == MixedContainer.CategorySimple: + self.exportSimple(outfile, level, name) + else: # category == MixedContainer.CategoryComplex + self.value.export(outfile, level, namespace, name, pretty_print) + def exportSimple(self, outfile, level, name): + if self.content_type == MixedContainer.TypeString: + outfile.write('<%s>%s</%s>' % ( + self.name, self.value, self.name)) + elif self.content_type == MixedContainer.TypeInteger or \ + self.content_type == MixedContainer.TypeBoolean: + outfile.write('<%s>%d</%s>' % ( + self.name, self.value, self.name)) + elif self.content_type == MixedContainer.TypeFloat or \ + self.content_type == MixedContainer.TypeDecimal: + outfile.write('<%s>%f</%s>' % ( + self.name, self.value, self.name)) + elif self.content_type == MixedContainer.TypeDouble: + outfile.write('<%s>%g</%s>' % ( + self.name, self.value, self.name)) + elif self.content_type == MixedContainer.TypeBase64: + outfile.write('<%s>%s</%s>' % ( + self.name, base64.b64encode(self.value), self.name)) + def to_etree(self, element): + if self.category == MixedContainer.CategoryText: + # Prevent exporting empty content as empty lines. + if self.value.strip(): + if len(element) > 0: + if element[-1].tail is None: + element[-1].tail = self.value + else: + element[-1].tail += self.value + else: + if element.text is None: + element.text = self.value + else: + element.text += self.value + elif self.category == MixedContainer.CategorySimple: + subelement = etree_.SubElement(element, '%s' % self.name) + subelement.text = self.to_etree_simple() + else: # category == MixedContainer.CategoryComplex + self.value.to_etree(element) + def to_etree_simple(self): + if self.content_type == MixedContainer.TypeString: + text = self.value + elif (self.content_type == MixedContainer.TypeInteger or + self.content_type == MixedContainer.TypeBoolean): + text = '%d' % self.value + elif (self.content_type == MixedContainer.TypeFloat or + self.content_type == MixedContainer.TypeDecimal): + text = '%f' % self.value + elif self.content_type == MixedContainer.TypeDouble: + text = '%g' % self.value + elif self.content_type == MixedContainer.TypeBase64: + text = '%s' % base64.b64encode(self.value) + return text + def exportLiteral(self, outfile, level, name): + if self.category == MixedContainer.CategoryText: + showIndent(outfile, level) + outfile.write( + 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( + self.category, self.content_type, self.name, self.value)) + elif self.category == MixedContainer.CategorySimple: + showIndent(outfile, level) + outfile.write( + 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( + self.category, self.content_type, self.name, self.value)) + else: # category == MixedContainer.CategoryComplex + showIndent(outfile, level) + outfile.write( + 'model_.MixedContainer(%d, %d, "%s",\n' % ( + self.category, self.content_type, self.name,)) + self.value.exportLiteral(outfile, level + 1) + showIndent(outfile, level) + outfile.write(')\n') + + +class MemberSpec_(object): + def __init__(self, name='', data_type='', container=0): + self.name = name + self.data_type = data_type + self.container = container + def set_name(self, name): self.name = name + def get_name(self): return self.name + def set_data_type(self, data_type): self.data_type = data_type + def get_data_type_chain(self): return self.data_type + def get_data_type(self): + if isinstance(self.data_type, list): + if len(self.data_type) > 0: + return self.data_type[-1] + else: + return 'xs:string' + else: + return self.data_type + def set_container(self, container): self.container = container + def get_container(self): return self.container + + +def _cast(typ, value): + if typ is None or value is None: + return value + return typ(value) + +# +# Mixin class for additional behaviors. +# + +class SessionTypeMixin(object): + def copy(self): + """Produce a copy of myself. + """ + new_session = sessionType( + input_schema=self.input_schema, + output_superclass=self.output_superclass, + output_subclass=self.output_subclass, + force=self.force, + prefix=self.prefix, + namespace_prefix=self.namespace_prefix, + empty_namespace_prefix=self.empty_namespace_prefix, + behavior_filename=self.behavior_filename, + properties=self.properties, + subclass_suffix=self.subclass_suffix, + root_element=self.root_element, + superclass_module=self.superclass_module, + auto_super=self.auto_super, + old_getters_setters=self.old_getters_setters, + validator_bodies=self.validator_bodies, + user_methods=self.user_methods, + no_dates=self.no_dates, + no_versions=self.no_versions, + no_process_includes=self.no_process_includes, + silence=self.silence, + namespace_defs=self.namespace_defs, + external_encoding=self.external_encoding, + member_specs=self.member_specs, + export_spec=self.export_spec, + one_file_per_xsd=self.one_file_per_xsd, + output_directory=self.output_directory, + module_suffix=self.module_suffix, + preserve_cdata_tags=self.preserve_cdata_tags, + cleanup_name_list=self.cleanup_name_list, + ) + return new_session + + def __eq__(self, obj): + """Implement the == operator. + """ + if ( + obj.input_schema == self.input_schema and + obj.output_superclass == self.output_superclass and + obj.output_subclass == self.output_subclass and + obj.force == self.force and + obj.prefix == self.prefix and + obj.namespace_prefix == self.namespace_prefix and + obj.empty_namespace_prefix == self.empty_namespace_prefix and + obj.behavior_filename == self.behavior_filename and + obj.properties == self.properties and + obj.subclass_suffix == self.subclass_suffix and + obj.root_element == self.root_element and + obj.superclass_module == self.superclass_module and + obj.auto_super == self.auto_super and + obj.old_getters_setters == self.old_getters_setters and + obj.validator_bodies == self.validator_bodies and + obj.user_methods == self.user_methods and + obj.no_dates == self.no_dates and + obj.no_versions == self.no_versions and + obj.no_process_includes == self.no_process_includes and + obj.silence == self.silence and + obj.namespace_defs == self.namespace_defs and + obj.external_encoding == self.external_encoding and + obj.member_specs == self.member_specs and + obj.export_spec == self.export_spec and + obj.one_file_per_xsd == self.one_file_per_xsd and + obj.output_directory == self.output_directory and + obj.module_suffix == self.module_suffix and + obj.preserve_cdata_tags == self.preserve_cdata_tags and + obj.cleanup_name_list == self.cleanup_name_list): + return True + else: + return False + + def __ne__(self, obj): + """Implement the != operator. + """ + return not self.__eq__(obj) + + +# +# Data representation classes. +# + + +class sessionType(GeneratedsSuper, SessionTypeMixin): + member_data_items_ = [ + MemberSpec_('input_schema', 'xs:string', 0), + MemberSpec_('output_superclass', 'xs:string', 0), + MemberSpec_('output_subclass', 'xs:string', 0), + MemberSpec_('force', 'xs:boolean', 0), + MemberSpec_('prefix', 'xs:string', 0), + MemberSpec_('namespace_prefix', 'xs:string', 0), + MemberSpec_('empty_namespace_prefix', 'xs:boolean', 0), + MemberSpec_('behavior_filename', 'xs:string', 0), + MemberSpec_('properties', 'xs:boolean', 0), + MemberSpec_('subclass_suffix', 'xs:string', 0), + MemberSpec_('root_element', 'xs:string', 0), + MemberSpec_('superclass_module', 'xs:string', 0), + MemberSpec_('auto_super', 'xs:boolean', 0), + MemberSpec_('old_getters_setters', 'xs:boolean', 0), + MemberSpec_('validator_bodies', 'xs:string', 0), + MemberSpec_('user_methods', 'xs:string', 0), + MemberSpec_('no_dates', 'xs:boolean', 0), + MemberSpec_('no_versions', 'xs:boolean', 0), + MemberSpec_('no_process_includes', 'xs:boolean', 0), + MemberSpec_('silence', 'xs:boolean', 0), + MemberSpec_('namespace_defs', 'xs:string', 0), + MemberSpec_('external_encoding', 'xs:string', 0), + MemberSpec_('get_encoded', 'xs:boolean', 0), + MemberSpec_('member_specs', 'xs:string', 0), + MemberSpec_('export_spec', 'xs:string', 0), + MemberSpec_('one_file_per_xsd', 'xs:boolean', 0), + MemberSpec_('output_directory', 'xs:string', 0), + MemberSpec_('module_suffix', 'xs:string', 0), + MemberSpec_('preserve_cdata_tags', 'xs:boolean', 0), + MemberSpec_('cleanup_name_list', 'xs:string', 0), + ] + subclass = None + superclass = None + def __init__(self, input_schema=None, output_superclass=None, output_subclass=None, force=None, prefix=None, namespace_prefix=None, empty_namespace_prefix=None, behavior_filename=None, properties=None, subclass_suffix=None, root_element=None, superclass_module=None, auto_super=None, old_getters_setters=None, validator_bodies=None, user_methods=None, no_dates=None, no_versions=None, no_process_includes=None, silence=None, namespace_defs=None, external_encoding=None, get_encoded=None, member_specs=None, export_spec=None, one_file_per_xsd=None, output_directory=None, module_suffix=None, preserve_cdata_tags=None, cleanup_name_list=None): + self.original_tagname_ = None + self.input_schema = input_schema + self.output_superclass = output_superclass + self.output_subclass = output_subclass + self.force = force + self.prefix = prefix + self.namespace_prefix = namespace_prefix + self.empty_namespace_prefix = empty_namespace_prefix + self.behavior_filename = behavior_filename + self.properties = properties + self.subclass_suffix = subclass_suffix + self.root_element = root_element + self.superclass_module = superclass_module + self.auto_super = auto_super + self.old_getters_setters = old_getters_setters + self.validator_bodies = validator_bodies + self.user_methods = user_methods + self.no_dates = no_dates + self.no_versions = no_versions + self.no_process_includes = no_process_includes + self.silence = silence + self.namespace_defs = namespace_defs + self.external_encoding = external_encoding + self.get_encoded = get_encoded + self.member_specs = member_specs + self.export_spec = export_spec + self.one_file_per_xsd = one_file_per_xsd + self.output_directory = output_directory + self.module_suffix = module_suffix + self.preserve_cdata_tags = preserve_cdata_tags + self.cleanup_name_list = cleanup_name_list + def factory(*args_, **kwargs_): + if CurrentSubclassModule_ is not None: + subclass = getSubclassFromModule_( + CurrentSubclassModule_, sessionType) + if subclass is not None: + return subclass(*args_, **kwargs_) + if sessionType.subclass: + return sessionType.subclass(*args_, **kwargs_) + else: + return sessionType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_input_schema(self): return self.input_schema + def set_input_schema(self, input_schema): self.input_schema = input_schema + def get_output_superclass(self): return self.output_superclass + def set_output_superclass(self, output_superclass): self.output_superclass = output_superclass + def get_output_subclass(self): return self.output_subclass + def set_output_subclass(self, output_subclass): self.output_subclass = output_subclass + def get_force(self): return self.force + def set_force(self, force): self.force = force + def get_prefix(self): return self.prefix + def set_prefix(self, prefix): self.prefix = prefix + def get_namespace_prefix(self): return self.namespace_prefix + def set_namespace_prefix(self, namespace_prefix): self.namespace_prefix = namespace_prefix + def get_empty_namespace_prefix(self): return self.empty_namespace_prefix + def set_empty_namespace_prefix(self, empty_namespace_prefix): self.empty_namespace_prefix = empty_namespace_prefix + def get_behavior_filename(self): return self.behavior_filename + def set_behavior_filename(self, behavior_filename): self.behavior_filename = behavior_filename + def get_properties(self): return self.properties + def set_properties(self, properties): self.properties = properties + def get_subclass_suffix(self): return self.subclass_suffix + def set_subclass_suffix(self, subclass_suffix): self.subclass_suffix = subclass_suffix + def get_root_element(self): return self.root_element + def set_root_element(self, root_element): self.root_element = root_element + def get_superclass_module(self): return self.superclass_module + def set_superclass_module(self, superclass_module): self.superclass_module = superclass_module + def get_auto_super(self): return self.auto_super + def set_auto_super(self, auto_super): self.auto_super = auto_super + def get_old_getters_setters(self): return self.old_getters_setters + def set_old_getters_setters(self, old_getters_setters): self.old_getters_setters = old_getters_setters + def get_validator_bodies(self): return self.validator_bodies + def set_validator_bodies(self, validator_bodies): self.validator_bodies = validator_bodies + def get_user_methods(self): return self.user_methods + def set_user_methods(self, user_methods): self.user_methods = user_methods + def get_no_dates(self): return self.no_dates + def set_no_dates(self, no_dates): self.no_dates = no_dates + def get_no_versions(self): return self.no_versions + def set_no_versions(self, no_versions): self.no_versions = no_versions + def get_no_process_includes(self): return self.no_process_includes + def set_no_process_includes(self, no_process_includes): self.no_process_includes = no_process_includes + def get_silence(self): return self.silence + def set_silence(self, silence): self.silence = silence + def get_namespace_defs(self): return self.namespace_defs + def set_namespace_defs(self, namespace_defs): self.namespace_defs = namespace_defs + def get_external_encoding(self): return self.external_encoding + def set_external_encoding(self, external_encoding): self.external_encoding = external_encoding + def get_get_encoded(self): return self.get_encoded + def set_get_encoded(self, get_encoded): self.get_encoded = get_encoded + def get_member_specs(self): return self.member_specs + def set_member_specs(self, member_specs): self.member_specs = member_specs + def get_export_spec(self): return self.export_spec + def set_export_spec(self, export_spec): self.export_spec = export_spec + def get_one_file_per_xsd(self): return self.one_file_per_xsd + def set_one_file_per_xsd(self, one_file_per_xsd): self.one_file_per_xsd = one_file_per_xsd + def get_output_directory(self): return self.output_directory + def set_output_directory(self, output_directory): self.output_directory = output_directory + def get_module_suffix(self): return self.module_suffix + def set_module_suffix(self, module_suffix): self.module_suffix = module_suffix + def get_preserve_cdata_tags(self): return self.preserve_cdata_tags + def set_preserve_cdata_tags(self, preserve_cdata_tags): self.preserve_cdata_tags = preserve_cdata_tags + def get_cleanup_name_list(self): return self.cleanup_name_list + def set_cleanup_name_list(self, cleanup_name_list): self.cleanup_name_list = cleanup_name_list + def hasContent_(self): + if ( + self.input_schema is not None or + self.output_superclass is not None or + self.output_subclass is not None or + self.force is not None or + self.prefix is not None or + self.namespace_prefix is not None or + self.empty_namespace_prefix is not None or + self.behavior_filename is not None or + self.properties is not None or + self.subclass_suffix is not None or + self.root_element is not None or + self.superclass_module is not None or + self.auto_super is not None or + self.old_getters_setters is not None or + self.validator_bodies is not None or + self.user_methods is not None or + self.no_dates is not None or + self.no_versions is not None or + self.no_process_includes is not None or + self.silence is not None or + self.namespace_defs is not None or + self.external_encoding is not None or + self.get_encoded is not None or + self.member_specs is not None or + self.export_spec is not None or + self.one_file_per_xsd is not None or + self.output_directory is not None or + self.module_suffix is not None or + self.preserve_cdata_tags is not None or + self.cleanup_name_list is not None + ): + return True + else: + return False + def export(self, outfile, level, namespace_='', name_='sessionType', namespacedef_='', pretty_print=True): + if pretty_print: + eol_ = '\n' + else: + eol_ = '' + if self.original_tagname_ is not None: + name_ = self.original_tagname_ + showIndent(outfile, level, pretty_print) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = set() + self.exportAttributes(outfile, level, already_processed, namespace_, name_='sessionType') + if self.hasContent_(): + outfile.write('>%s' % (eol_, )) + self.exportChildren(outfile, level + 1, namespace_='', name_='sessionType', pretty_print=pretty_print) + showIndent(outfile, level, pretty_print) + outfile.write('</%s%s>%s' % (namespace_, name_, eol_)) + else: + outfile.write('/>%s' % (eol_, )) + def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='sessionType'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='sessionType', fromsubclass_=False, pretty_print=True): + if pretty_print: + eol_ = '\n' + else: + eol_ = '' + if self.input_schema is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%sinput_schema>%s</%sinput_schema>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.input_schema), input_name='input_schema')), namespace_, eol_)) + if self.output_superclass is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%soutput_superclass>%s</%soutput_superclass>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.output_superclass), input_name='output_superclass')), namespace_, eol_)) + if self.output_subclass is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%soutput_subclass>%s</%soutput_subclass>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.output_subclass), input_name='output_subclass')), namespace_, eol_)) + if self.force is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%sforce>%s</%sforce>%s' % (namespace_, self.gds_format_boolean(self.force, input_name='force'), namespace_, eol_)) + if self.prefix is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%sprefix>%s</%sprefix>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.prefix), input_name='prefix')), namespace_, eol_)) + if self.namespace_prefix is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%snamespace_prefix>%s</%snamespace_prefix>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.namespace_prefix), input_name='namespace_prefix')), namespace_, eol_)) + if self.empty_namespace_prefix is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%sempty_namespace_prefix>%s</%sempty_namespace_prefix>%s' % (namespace_, self.gds_format_boolean(self.empty_namespace_prefix, input_name='empty_namespace_prefix'), namespace_, eol_)) + if self.behavior_filename is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%sbehavior_filename>%s</%sbehavior_filename>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.behavior_filename), input_name='behavior_filename')), namespace_, eol_)) + if self.properties is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%sproperties>%s</%sproperties>%s' % (namespace_, self.gds_format_boolean(self.properties, input_name='properties'), namespace_, eol_)) + if self.subclass_suffix is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%ssubclass_suffix>%s</%ssubclass_suffix>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.subclass_suffix), input_name='subclass_suffix')), namespace_, eol_)) + if self.root_element is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%sroot_element>%s</%sroot_element>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.root_element), input_name='root_element')), namespace_, eol_)) + if self.superclass_module is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%ssuperclass_module>%s</%ssuperclass_module>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.superclass_module), input_name='superclass_module')), namespace_, eol_)) + if self.auto_super is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%sauto_super>%s</%sauto_super>%s' % (namespace_, self.gds_format_boolean(self.auto_super, input_name='auto_super'), namespace_, eol_)) + if self.old_getters_setters is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%sold_getters_setters>%s</%sold_getters_setters>%s' % (namespace_, self.gds_format_boolean(self.old_getters_setters, input_name='old_getters_setters'), namespace_, eol_)) + if self.validator_bodies is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%svalidator_bodies>%s</%svalidator_bodies>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.validator_bodies), input_name='validator_bodies')), namespace_, eol_)) + if self.user_methods is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%suser_methods>%s</%suser_methods>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.user_methods), input_name='user_methods')), namespace_, eol_)) + if self.no_dates is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%sno_dates>%s</%sno_dates>%s' % (namespace_, self.gds_format_boolean(self.no_dates, input_name='no_dates'), namespace_, eol_)) + if self.no_versions is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%sno_versions>%s</%sno_versions>%s' % (namespace_, self.gds_format_boolean(self.no_versions, input_name='no_versions'), namespace_, eol_)) + if self.no_process_includes is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%sno_process_includes>%s</%sno_process_includes>%s' % (namespace_, self.gds_format_boolean(self.no_process_includes, input_name='no_process_includes'), namespace_, eol_)) + if self.silence is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%ssilence>%s</%ssilence>%s' % (namespace_, self.gds_format_boolean(self.silence, input_name='silence'), namespace_, eol_)) + if self.namespace_defs is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%snamespace_defs>%s</%snamespace_defs>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.namespace_defs), input_name='namespace_defs')), namespace_, eol_)) + if self.external_encoding is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%sexternal_encoding>%s</%sexternal_encoding>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.external_encoding), input_name='external_encoding')), namespace_, eol_)) + if self.get_encoded is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%sget_encoded>%s</%sget_encoded>%s' % (namespace_, self.gds_format_boolean(self.get_encoded, input_name='get_encoded'), namespace_, eol_)) + if self.member_specs is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%smember_specs>%s</%smember_specs>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.member_specs), input_name='member_specs')), namespace_, eol_)) + if self.export_spec is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%sexport_spec>%s</%sexport_spec>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.export_spec), input_name='export_spec')), namespace_, eol_)) + if self.one_file_per_xsd is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%sone_file_per_xsd>%s</%sone_file_per_xsd>%s' % (namespace_, self.gds_format_boolean(self.one_file_per_xsd, input_name='one_file_per_xsd'), namespace_, eol_)) + if self.output_directory is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%soutput_directory>%s</%soutput_directory>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.output_directory), input_name='output_directory')), namespace_, eol_)) + if self.module_suffix is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%smodule_suffix>%s</%smodule_suffix>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.module_suffix), input_name='module_suffix')), namespace_, eol_)) + if self.preserve_cdata_tags is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%spreserve_cdata_tags>%s</%spreserve_cdata_tags>%s' % (namespace_, self.gds_format_boolean(self.preserve_cdata_tags, input_name='preserve_cdata_tags'), namespace_, eol_)) + if self.cleanup_name_list is not None: + showIndent(outfile, level, pretty_print) + outfile.write('<%scleanup_name_list>%s</%scleanup_name_list>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.cleanup_name_list), input_name='cleanup_name_list')), namespace_, eol_)) + def build(self, node): + already_processed = set() + self.buildAttributes(node, node.attrib, already_processed) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + return self + def buildAttributes(self, node, attrs, already_processed): + pass + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'input_schema': + input_schema_ = child_.text + input_schema_ = self.gds_validate_string(input_schema_, node, 'input_schema') + self.input_schema = input_schema_ + elif nodeName_ == 'output_superclass': + output_superclass_ = child_.text + output_superclass_ = self.gds_validate_string(output_superclass_, node, 'output_superclass') + self.output_superclass = output_superclass_ + elif nodeName_ == 'output_subclass': + output_subclass_ = child_.text + output_subclass_ = self.gds_validate_string(output_subclass_, node, 'output_subclass') + self.output_subclass = output_subclass_ + elif nodeName_ == 'force': + sval_ = child_.text + if sval_ in ('true', '1'): + ival_ = True + elif sval_ in ('false', '0'): + ival_ = False + else: + raise_parse_error(child_, 'requires boolean') + ival_ = self.gds_validate_boolean(ival_, node, 'force') + self.force = ival_ + elif nodeName_ == 'prefix': + prefix_ = child_.text + prefix_ = self.gds_validate_string(prefix_, node, 'prefix') + self.prefix = prefix_ + elif nodeName_ == 'namespace_prefix': + namespace_prefix_ = child_.text + namespace_prefix_ = self.gds_validate_string(namespace_prefix_, node, 'namespace_prefix') + self.namespace_prefix = namespace_prefix_ + elif nodeName_ == 'empty_namespace_prefix': + sval_ = child_.text + if sval_ in ('true', '1'): + ival_ = True + elif sval_ in ('false', '0'): + ival_ = False + else: + raise_parse_error(child_, 'requires boolean') + ival_ = self.gds_validate_boolean(ival_, node, 'empty_namespace_prefix') + self.empty_namespace_prefix = ival_ + elif nodeName_ == 'behavior_filename': + behavior_filename_ = child_.text + behavior_filename_ = self.gds_validate_string(behavior_filename_, node, 'behavior_filename') + self.behavior_filename = behavior_filename_ + elif nodeName_ == 'properties': + sval_ = child_.text + if sval_ in ('true', '1'): + ival_ = True + elif sval_ in ('false', '0'): + ival_ = False + else: + raise_parse_error(child_, 'requires boolean') + ival_ = self.gds_validate_boolean(ival_, node, 'properties') + self.properties = ival_ + elif nodeName_ == 'subclass_suffix': + subclass_suffix_ = child_.text + subclass_suffix_ = self.gds_validate_string(subclass_suffix_, node, 'subclass_suffix') + self.subclass_suffix = subclass_suffix_ + elif nodeName_ == 'root_element': + root_element_ = child_.text + root_element_ = self.gds_validate_string(root_element_, node, 'root_element') + self.root_element = root_element_ + elif nodeName_ == 'superclass_module': + superclass_module_ = child_.text + superclass_module_ = self.gds_validate_string(superclass_module_, node, 'superclass_module') + self.superclass_module = superclass_module_ + elif nodeName_ == 'auto_super': + sval_ = child_.text + if sval_ in ('true', '1'): + ival_ = True + elif sval_ in ('false', '0'): + ival_ = False + else: + raise_parse_error(child_, 'requires boolean') + ival_ = self.gds_validate_boolean(ival_, node, 'auto_super') + self.auto_super = ival_ + elif nodeName_ == 'old_getters_setters': + sval_ = child_.text + if sval_ in ('true', '1'): + ival_ = True + elif sval_ in ('false', '0'): + ival_ = False + else: + raise_parse_error(child_, 'requires boolean') + ival_ = self.gds_validate_boolean(ival_, node, 'old_getters_setters') + self.old_getters_setters = ival_ + elif nodeName_ == 'validator_bodies': + validator_bodies_ = child_.text + validator_bodies_ = self.gds_validate_string(validator_bodies_, node, 'validator_bodies') + self.validator_bodies = validator_bodies_ + elif nodeName_ == 'user_methods': + user_methods_ = child_.text + user_methods_ = self.gds_validate_string(user_methods_, node, 'user_methods') + self.user_methods = user_methods_ + elif nodeName_ == 'no_dates': + sval_ = child_.text + if sval_ in ('true', '1'): + ival_ = True + elif sval_ in ('false', '0'): + ival_ = False + else: + raise_parse_error(child_, 'requires boolean') + ival_ = self.gds_validate_boolean(ival_, node, 'no_dates') + self.no_dates = ival_ + elif nodeName_ == 'no_versions': + sval_ = child_.text + if sval_ in ('true', '1'): + ival_ = True + elif sval_ in ('false', '0'): + ival_ = False + else: + raise_parse_error(child_, 'requires boolean') + ival_ = self.gds_validate_boolean(ival_, node, 'no_versions') + self.no_versions = ival_ + elif nodeName_ == 'no_process_includes': + sval_ = child_.text + if sval_ in ('true', '1'): + ival_ = True + elif sval_ in ('false', '0'): + ival_ = False + else: + raise_parse_error(child_, 'requires boolean') + ival_ = self.gds_validate_boolean(ival_, node, 'no_process_includes') + self.no_process_includes = ival_ + elif nodeName_ == 'silence': + sval_ = child_.text + if sval_ in ('true', '1'): + ival_ = True + elif sval_ in ('false', '0'): + ival_ = False + else: + raise_parse_error(child_, 'requires boolean') + ival_ = self.gds_validate_boolean(ival_, node, 'silence') + self.silence = ival_ + elif nodeName_ == 'namespace_defs': + namespace_defs_ = child_.text + namespace_defs_ = self.gds_validate_string(namespace_defs_, node, 'namespace_defs') + self.namespace_defs = namespace_defs_ + elif nodeName_ == 'external_encoding': + external_encoding_ = child_.text + external_encoding_ = self.gds_validate_string(external_encoding_, node, 'external_encoding') + self.external_encoding = external_encoding_ + elif nodeName_ == 'get_encoded': + sval_ = child_.text + if sval_ in ('true', '1'): + ival_ = True + elif sval_ in ('false', '0'): + ival_ = False + else: + raise_parse_error(child_, 'requires boolean') + ival_ = self.gds_validate_boolean(ival_, node, 'get_encoded') + self.get_encoded = ival_ + elif nodeName_ == 'member_specs': + member_specs_ = child_.text + member_specs_ = self.gds_validate_string(member_specs_, node, 'member_specs') + self.member_specs = member_specs_ + elif nodeName_ == 'export_spec': + export_spec_ = child_.text + export_spec_ = self.gds_validate_string(export_spec_, node, 'export_spec') + self.export_spec = export_spec_ + elif nodeName_ == 'one_file_per_xsd': + sval_ = child_.text + if sval_ in ('true', '1'): + ival_ = True + elif sval_ in ('false', '0'): + ival_ = False + else: + raise_parse_error(child_, 'requires boolean') + ival_ = self.gds_validate_boolean(ival_, node, 'one_file_per_xsd') + self.one_file_per_xsd = ival_ + elif nodeName_ == 'output_directory': + output_directory_ = child_.text + output_directory_ = self.gds_validate_string(output_directory_, node, 'output_directory') + self.output_directory = output_directory_ + elif nodeName_ == 'module_suffix': + module_suffix_ = child_.text + module_suffix_ = self.gds_validate_string(module_suffix_, node, 'module_suffix') + self.module_suffix = module_suffix_ + elif nodeName_ == 'preserve_cdata_tags': + sval_ = child_.text + if sval_ in ('true', '1'): + ival_ = True + elif sval_ in ('false', '0'): + ival_ = False + else: + raise_parse_error(child_, 'requires boolean') + ival_ = self.gds_validate_boolean(ival_, node, 'preserve_cdata_tags') + self.preserve_cdata_tags = ival_ + elif nodeName_ == 'cleanup_name_list': + cleanup_name_list_ = child_.text + cleanup_name_list_ = self.gds_validate_string(cleanup_name_list_, node, 'cleanup_name_list') + self.cleanup_name_list = cleanup_name_list_ +# end class sessionType + + +GDSClassesMapping = { + 'session': sessionType, +} + + +USAGE_TEXT = """ +Usage: python <Parser>.py [ -s ] <in_xml_file> +""" + + +def usage(): + print(USAGE_TEXT) + sys.exit(1) + + +def get_root_tag(node): + tag = Tag_pattern_.match(node.tag).groups()[-1] + rootClass = GDSClassesMapping.get(tag) + if rootClass is None: + rootClass = globals().get(tag) + return tag, rootClass + + +def parse(inFileName, silence=False): + parser = None + doc = parsexml_(inFileName, parser) + rootNode = doc.getroot() + rootTag, rootClass = get_root_tag(rootNode) + if rootClass is None: + rootTag = 'sessionType' + rootClass = sessionType + rootObj = rootClass.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None + if not silence: + sys.stdout.write('<?xml version="1.0" ?>\n') + rootObj.export( + sys.stdout, 0, name_=rootTag, + namespacedef_='', + pretty_print=True) + return rootObj + + +def parseEtree(inFileName, silence=False): + parser = None + doc = parsexml_(inFileName, parser) + rootNode = doc.getroot() + rootTag, rootClass = get_root_tag(rootNode) + if rootClass is None: + rootTag = 'sessionType' + rootClass = sessionType + rootObj = rootClass.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None + mapping = {} + rootElement = rootObj.to_etree(None, name_=rootTag, mapping_=mapping) + reverse_mapping = rootObj.gds_reverse_node_mapping(mapping) + if not silence: + content = etree_.tostring( + rootElement, pretty_print=True, + xml_declaration=True, encoding="utf-8") + sys.stdout.write(content) + sys.stdout.write('\n') + return rootObj, rootElement, mapping, reverse_mapping + + +def parseString(inString, silence=False): + from StringIO import StringIO + parser = None + doc = parsexml_(StringIO(inString), parser) + rootNode = doc.getroot() + rootTag, rootClass = get_root_tag(rootNode) + if rootClass is None: + rootTag = 'sessionType' + rootClass = sessionType + rootObj = rootClass.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None + if not silence: + sys.stdout.write('<?xml version="1.0" ?>\n') + rootObj.export( + sys.stdout, 0, name_=rootTag, + namespacedef_='') + return rootObj + + +def parseLiteral(inFileName, silence=False): + parser = None + doc = parsexml_(inFileName, parser) + rootNode = doc.getroot() + rootTag, rootClass = get_root_tag(rootNode) + if rootClass is None: + rootTag = 'sessionType' + rootClass = sessionType + rootObj = rootClass.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None + if not silence: + sys.stdout.write('#from generateds_gui_session import *\n\n') + sys.stdout.write('import generateds_gui_session as model_\n\n') + sys.stdout.write('rootObj = model_.rootClass(\n') + rootObj.exportLiteral(sys.stdout, 0, name_=rootTag) + sys.stdout.write(')\n') + return rootObj + + +def main(): + args = sys.argv[1:] + if len(args) == 1: + parse(args[0]) + else: + usage() + + +if __name__ == '__main__': + #import pdb; pdb.set_trace() + main() + + +__all__ = [ + "sessionType" +] diff --git a/gui/generateds_gui_session.xsd b/gui/generateds_gui_session.xsd index bb4904523148f4add6e8434a22d45e44d95b37df..986a982acbe73bd61fc6313b680147e987907bb4 100644 --- a/gui/generateds_gui_session.xsd +++ b/gui/generateds_gui_session.xsd @@ -29,6 +29,12 @@ <xs:element name="external_encoding" type="xs:string" /> <xs:element name="get_encoded" type="xs:boolean" /> <xs:element name="member_specs" type="xs:string" /> + <xs:element name="export_spec" type="xs:string" /> + <xs:element name="one_file_per_xsd" type="xs:boolean" /> + <xs:element name="output_directory" type="xs:string" /> + <xs:element name="module_suffix" type="xs:string" /> + <xs:element name="preserve_cdata_tags" type="xs:boolean" /> + <xs:element name="cleanup_name_list" type="xs:string" /> </xs:sequence> </xs:complexType> diff --git a/gui/run_generate_session b/gui/run_generate_session new file mode 100755 index 0000000000000000000000000000000000000000..1abdbd21d857ac901951c88e95f5f73ebd73fc10 --- /dev/null +++ b/gui/run_generate_session @@ -0,0 +1,5 @@ +#!/bin/bash +../generateDS.py \ + -o generateds_gui_session.py \ + --member-specs=list \ + generateds_gui_session.xsd diff --git a/libgenerateDS/gui/generateds_gui.py b/libgenerateDS/gui/generateds_gui.py deleted file mode 100755 index 7076369a8c1741d8839867dfaacec1d9349ffe6f..0000000000000000000000000000000000000000 --- a/libgenerateDS/gui/generateds_gui.py +++ /dev/null @@ -1,2225 +0,0 @@ -#!/usr/bin/env python -import sys -import os -from optparse import OptionParser -from configparser import ConfigParser -from xml.dom import minidom -from xml.parsers import expat -import subprocess -import re - - - -if sys.version_info.major == 2: - import gtk -else: - # https://sourceforge.net/projects/pygobjectwin32/files/ - # https://blogs.gnome.org/kittykat/2014/01/29/developing-gtk-3-apps-with-python-on-windows/ - import gi - gi.require_version('Gtk', '3.0') - from gi.repository import Gtk as gtk - -# import pango -from libgenerateDS.gui import generateds_gui_session -#import generateds_gui_session - -## import warnings -## warnings.warn('importing IPShellEmbed', UserWarning) -## from IPython.Shell import IPShellEmbed -## args = '' -## ipshell = IPShellEmbed(args, -## banner = 'Dropping into IPython', -## exit_msg = 'Leaving Interpreter, back to program.') -## -# Then use the following line where and when you want to drop into the -# IPython shell: -# ipshell('<some message> -- Entering ipshell.\\nHit Ctrl-D to exit') - -# Globals and constants: - -# -# Do not modify the following VERSION comments. -# Used by updateversion.py. -##VERSION## -VERSION = '2.20a' -##VERSION## - - -Builder = None -ParamNameList = [] -CmdTemplate = ( - '%(exec_path)s --no-questions' + - '%(force)s' + - '%(output_superclass)s' + - '%(output_subclass)s' + - '%(prefix)s' + - '%(namespace_prefix)s' + - '%(behavior_filename)s' + - '%(properties)s' + - '%(old_getters_setters)s' + - '%(subclass_suffix)s' + - '%(root_element)s' + - '%(superclass_module)s' + - '%(validator_bodies)s' + - '%(user_methods)s' + - '%(no_dates)s' + - '%(no_versions)s' + - '%(no_process_includes)s' + - '%(silence)s' + - '%(namespace_defs)s' + - '%(external_encoding)s' + - '%(member_specs)s' + - ' %(input_schema)s' + - '' - ) -CaptureCmdTemplate = ( - '%(exec_path)s --no-questions' + - '%(force)s' + - '%(properties)s' + - '%(namespace_prefix)s' + - '%(output_superclass)s' + - '%(output_subclass)s' + - '%(prefix)s' + - '%(behavior_filename)s' + - '%(old_getters_setters)s' + - '%(subclass_suffix)s' + - '%(root_element)s' + - '%(superclass_module)s' + - '%(validator_bodies)s' + - '%(user_methods)s' + - '%(no_dates)s' + - '%(no_versions)s' + - '%(no_process_includes)s' + - '%(silence)s' + - '%(namespace_defs)s' + - '%(external_encoding)s' + - '%(member_specs)s' + - ' \\\n %(input_schema)s' + - '' - ) -ErrorMessages = [ - '', - 'Must enter input schema name.', - 'Must enter either output superclass name or output subclass file name.', - ] -Memberspecs_tooltip_text = '''\ -Generate member (type) specifications in each -class: a dictionary of instances of class -MemberSpec_ containing member name, type, -and array or not. Allowed values are -"list" or "dict". Default: None. -''' - - -# -# Classes -# - -class UIItemSpec(object): - def __init__(self, name='', ui_type='', access_action=''): - self.name = name - self.ui_type = ui_type - self.access_action = access_action - def get_name(self): return self.name - def set_name(self, name): self.name = name - def get_ui_type(self): return self.ui_type - def set_ui_type(self, ui_type): self.ui_type = ui_type - def get_access_action(self): return self.access_action - def set_access_action(self, access_action): self.access_action = access_action - - -class GeneratedsGui(object): - - def __init__(self, options): - global Builder - # Default values - Builder = gtk.Builder() - self.options = options - # self.ui_spec_filename = ui_spec_filename - self.filename = None - self.about_dialog = None - self.params = generateds_gui_session.sessionType() - self.ui_obj_dict = {} - self.session_filename = None - self.current_folder = None - # use GtkBuilder to build our interface from the XML file - ui_spec_filename = options.impl_gui - try: - if ui_spec_filename is None: - Builder.add_from_string(branch_version('Ui_spec, len(Ui_spec)','Ui_spec')) - else: - Builder.add_from_file(ui_spec_filename) - except: - msg = "Failed to load UI XML file: %s" % ui_spec_filename - self.error_message(msg) - sys.exit(1) - # get the widgets which will be referenced in callbacks - bgo = Builder.get_object - self.window = bgo("window1") - self.statusbar = bgo("statusbar1") - for item in ParamNameList: - if item.get_ui_type() != 'combobox': - s1 = '%s_%s' % (item.get_name(), item.get_ui_type(), ) - setattr(self, s1, bgo(s1)) - self.ui_obj_dict[s1] = bgo(s1) - # Create the member-specs combobox. - member_specs_combobox = branch_version('gtk.combo_box_new_text()', 'gtk.ComboBoxText()') - member_specs_combobox.set_name('member_specs_combobox') - member_specs_combobox.set_tooltip_text(Memberspecs_tooltip_text) - self.ui_obj_dict['member_specs_combobox'] = member_specs_combobox - member_specs_combobox.append_text("none") - member_specs_combobox.append_text("list") - member_specs_combobox.append_text("dict") - member_specs_combobox_container = bgo('member_specs_combobox_container') - member_specs_combobox_container.add(member_specs_combobox) - member_specs_combobox.set_active(0) - member_specs_combobox.show() - self.content_dialog = ContentDialog() - # connect signals - Builder.connect_signals(self) - Builder.connect_signals(self.content_dialog) - # set the default icon to the GTK "edit" icon - branch_version('gtk.window_set_default_icon_name(gtk.STOCK_EDIT)','gtk.Window.set_default_icon_name(gtk.STOCK_EDIT)') - # setup and initialize our statusbar - self.statusbar_cid = self.statusbar.get_context_id("Tutorial GTK+ Text Editor") - self.reset_default_status() - self.params = generateds_gui_session.sessionType() - # Load a session if specified. - session = self.options.session - if session: - session = os.path.abspath(session) - self.session_filename = session - self.load_session(session) - msg = 'Session file: %s' % (self.session_filename, ) - self.statusbar.pop(self.statusbar_cid) - self.statusbar.push(self.statusbar_cid, msg) - else: - self.trans_gui_2_obj() - self.saved_params = self.params.copy() - - # When our window is destroyed, we want to break out of the GTK main loop. - # We do this by calling gtk_main_quit(). We could have also just specified - # gtk_main_quit as the handler in Glade! - def on_window_destroy(self, widget, data=None): - self.trans_gui_2_obj() -## self.dump_params('saved_params:', self.saved_params) -## self.dump_params('params:', self.params) - if self.params != self.saved_params: - message = 'Session data has changed.\n\nSave?' - if sys.version_info.major == 2 : - dialog = gtk.MessageDialog(None, - gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, - gtk.MESSAGE_ERROR, - gtk.BUTTONS_NONE, - message) - dialog.add_buttons( - gtk.STOCK_YES, gtk.RESPONSE_YES, - '_Discard', 1, - gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - ) - else : - dialog = gtk.MessageDialog(None, - gtk.DialogFlags.MODAL | gtk.DialogFlags.DESTROY_WITH_PARENT, - gtk.MessageType.ERROR, - gtk.ButtonsType.NONE, - message) - - dialog.add_buttons( - gtk.STOCK_YES, gtk.ResponseType.YES, - '_Discard', 1, - gtk.STOCK_CANCEL, gtk.ResponseType.CANCEL, - ) - response = dialog.run() - dialog.destroy() - if response == branch_version('gtk.RESPONSE_YES', 'gtk.ResponseType.YES'): - self.save_session_action() - elif response == 1: - pass - elif response == branch_version('gtk.RESPONSE_CANCEL', 'gtk.ResponseType.CANCEL'): - return - gtk.main_quit() - - def on_window_delete_event(self, widget, event, data=None): - self.on_window_destroy(widget, data) - - def on_quit_menu_item_activate(self, widget, data=None): - self.on_window_destroy(widget, data) - - def on_quit_button_clicked(self, widget, data=None): - self.on_window_destroy(widget, data) - - # Get the values from the widgets in the UI. - # Format the command line. - # Generate the output files. - def on_generate_menuitem_activate(self, menuitem, data=None): - self.trans_gui_2_obj() - params_dict = self.trans_params_2_dict() - result, msg = self.validate_params(params_dict) - if result: - self.statusbar.pop(self.statusbar_cid) - self.statusbar.push(self.statusbar_cid, 'Error: %s' % (msg, )) - self.error_message(msg) - else: - cmd = self.create_command_line(params_dict, CmdTemplate) - #print 'cmd: %s' % (cmd, ) - self.run_command(cmd) - return True - - on_generate_button_clicked = on_generate_menuitem_activate - - def on_capture_cl_menuitem_activate(self, menuitem, data=None): - self.trans_gui_2_obj() - params_dict = self.trans_params_2_dict() - result, msg = self.validate_params(params_dict) - if result: - self.statusbar.pop(self.statusbar_cid) - self.statusbar.push(self.statusbar_cid, 'Error: %s' % (msg, )) - self.error_message(msg) - else: - cmd = self.create_command_line(params_dict, CaptureCmdTemplate) - cmd = cmd.replace(' --', ' \\\n --') - cmd = cmd.replace(' -o', ' \\\n -o') - cmd = cmd.replace(' -s', ' \\\n -s') - self.display_content('Command line', cmd) - return True - - def trans_gui_2_obj(self): - for item in ParamNameList: - ui_name = '%s_%s' % (item.get_name(), item.get_ui_type(), ) - ui_obj = self.ui_obj_dict[ui_name] - if ui_obj is not None: - if item.get_name() == 'member_specs': - value = ui_obj.get_active() - if value == 1: - self.params.set_member_specs('list') - elif value == 2: - self.params.set_member_specs('dict') - else: - self.params.set_member_specs('none') - else: - s2 = '%s_%s' % (item.get_name(), item.get_ui_type(), ) - method = getattr(ui_obj, 'get_%s' % item.get_access_action()) - value = method() - setattr(self.params, item.get_name(), value) - - def trans_obj_2_gui(self): - for item in ParamNameList: - ui_name = '%s_%s' % (item.get_name(), item.get_ui_type(), ) - ui_obj = self.ui_obj_dict[ui_name] - if ui_obj is not None: - if item.get_name() == 'member_specs': - if self.params.get_member_specs() == 'list': - ui_obj.set_active(1) - elif self.params.get_member_specs() == 'dict': - ui_obj.set_active(2) - else: - ui_obj.set_active(0) - else: - value = getattr(self.params, item.get_name()) - if value is None: - if item.get_ui_type() == 'entry': - value = '' - elif item.get_ui_type() == 'checkbutton': - value = False - elif item.get_ui_type() == 'combobox': - value = 0 - method = getattr(ui_obj, - 'set_%s' % item.get_access_action()) - method(value) - - def dump_params(self, msg, params): - print(msg) - params.export(sys.stdout, 0, name_='session') - - def trans_params_2_dict(self): - params = self.params - params_dict = {} - pd = params_dict - pd['input_schema'] = getattr(params, 'input_schema') - self.transform_1_param(params, pd, 'output_superclass', 'o') - self.transform_1_param(params, pd, 'output_subclass', 's') - pd['force'] = (' -f' if params.get_force() else '') - self.transform_1_param(params, pd, 'prefix', 'p') - if params.get_empty_namespace_prefix(): - pd['namespace_prefix'] = ' -a ""' - else: - self.transform_1_param(params, pd, 'namespace_prefix', 'a') - self.transform_1_param(params, pd, 'behavior_filename', 'b') - pd['properties'] = (' -m' if params.get_properties() else '') - self.transform_1_param(params, pd, 'subclass_suffix', 'subclass-suffix', True) - self.transform_1_param(params, pd, 'root_element', 'root-element', True) - self.transform_1_param(params, pd, 'superclass_module', 'super', True) - pd['old_getters_setters'] = (' --use-old-getter-setter' if params.get_old_getters_setters() else '') - self.transform_1_param(params, pd, 'user_methods', 'user-methods', True) - self.transform_1_param(params, pd, 'validator_bodies', 'validator-bodies', True) - pd['no_dates'] = (' --no-dates' if params.get_no_dates() else '') - pd['no_versions'] = (' --no-versions' if params.get_no_versions() else '') - pd['no_process_includes'] = (' --no-process-includes' if params.get_no_process_includes() else '') - pd['silence'] = (' --silence' if params.get_silence() else '') - # Special case for namespacedefs because of quoting. - #self.transform_1_param(params, pd, 'namespace_defs', 'namespacedef', True) - name = 'namespace_defs' - flag = 'namespacedef' - value = getattr(params, name) - params_dict[name] = ( - " --%s='%s'" % (flag, value, ) - if value.strip() - else '') - self.transform_1_param(params, pd, 'external_encoding', 'external-encoding', True) - if params.get_member_specs() == 'list': - pd['member_specs'] = ' --member-specs=list' - elif params.get_member_specs() == 'dict': - pd['member_specs'] = ' --member-specs=dict' - else: - pd['member_specs'] = '' - return pd - - def transform_1_param(self, params, params_dict, name, flag, longopt=False): - value = getattr(params, name) - if longopt: - params_dict[name] = ( - ' --%s="%s"' % (flag, value, ) - if value.strip() - else '') - else: - params_dict[name] = ( - ' -%s "%s"' % (flag, value, ) - if value.strip() - else '') - - def create_command_line(self, params_dict, template): - params_dict['exec_path'] = self.options.exec_path - cmd = template % params_dict - return cmd - - def validate_params(self, params_dict): - p = params_dict - #print sorted(p.keys()) - result = 0 - msg = '' - if not p['input_schema']: - result = 1 - elif not (p['output_superclass'] or - p['output_subclass']): - result = 2 - if result: - msg = ErrorMessages[result] - return result, msg - - # Clear all the fields/widgets to default values. - def on_clear_menuitem_activate(self, menuitem, data=None): - message = 'Clear all entries?\nAre you sure?' - - if sys.version_info.major == 2 : - dialog = gtk.MessageDialog( - None, - gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, - gtk.MESSAGE_WARNING, - gtk.BUTTONS_OK_CANCEL, - message - ) - else : - dialog = gtk.MessageDialog( - None, - gtk.DialogFlags.MODAL | gtk.DialogFlags.DESTROY_WITH_PARENT, - gtk.MessageType.WARNING, - gtk.ButtonsType.OK_CANCEL, - message - ) - - response = dialog.run() - dialog.destroy() - if response == branch_version('gtk.RESPONSE_OK','gtk.ResponseType.OK'): - self.session_filename = None - self.params = generateds_gui_session.sessionType( - input_schema='', - output_superclass='', - output_subclass='', - force=False, - prefix='', - namespace_prefix='', - empty_namespace_prefix=False, - behavior_filename='', - properties=False, - subclass_suffix='', - root_element='', - superclass_module='', - auto_super=False, - old_getters_setters=False, - validator_bodies='', - user_methods='', - no_dates=False, - no_versions=False, - no_process_includes=False, - silence=False, - namespace_defs='', - external_encoding='', - member_specs='', - ) - self.trans_obj_2_gui() - - def run_command(self, cmd): - spobj = subprocess.Popen(cmd, - shell=True, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - close_fds=False) - outcontent = spobj.stdout.read() - errcontent = spobj.stderr.read() - error = False - if outcontent.strip(): - self.display_content('Messages', outcontent) - error = True - if errcontent.strip(): - self.display_content('Errors', errcontent) - error = True - if not error: - msg = 'Successfully generated.' - self.error_message(msg, branch_version('gtk.MESSAGE_INFO','gtk.MessageType.INFO')) - - def display_content(self, title, content): - #content_dialog = ContentDialog() - self.content_dialog.show(content) - - def on_open_session_menuitem_activate(self, menuitem, data=None): - self.trans_gui_2_obj() -## self.dump_params('saved_params:', self.saved_params) -## self.dump_params('params:', self.params) - if self.params != self.saved_params: - message = 'Session data has changed.\n\nSave?' - - if sys.version_info.major == 2 : - dialog = gtk.MessageDialog(None, - gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, - gtk.MESSAGE_ERROR, - gtk.BUTTONS_NONE, - message) - dialog.add_buttons( - gtk.STOCK_YES, gtk.RESPONSE_YES, - '_Discard', 1, - gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - ) - else : - dialog = gtk.MessageDialog(None, - gtk.DialogFlags.MODAL | gtk.DialogFlags.DESTROY_WITH_PARENT, - gtk.MessageType.ERROR, - gtk.ButtonsType.NONE, - message) - - dialog.add_buttons( - gtk.STOCK_YES, gtk.ResponseType.YES, - '_Discard', 1, - gtk.STOCK_CANCEL, gtk.ResponseType.CANCEL, - ) - - response = dialog.run() - dialog.destroy() - if response == branch_version('gtk.RESPONSE_YES','gtk.ResponseType.YES'): - self.save_session_action() - elif response == 1: - pass - elif response == branch_version('gtk.RESPONSE_CANCEL','gtk.ResponseType.CANCEL'): - return - session_filename = self.choose_filename( - branch_version('gtk.FILE_CHOOSER_ACTION_OPEN','gtk.FileChooserAction.OPEN'), - (('Session *.session', '*.session'),) - ) - if session_filename: - self.session_filename = session_filename - self.load_session(self.session_filename) - msg = 'Session file: %s' % (self.session_filename, ) - self.statusbar.pop(self.statusbar_cid) - self.statusbar.push(self.statusbar_cid, msg) - - def on_save_session_menuitem_activate(self, menuitem, data=None): - self.save_session_action() - - def save_session_action(self): - if not self.session_filename: - filename = self.choose_filename( - branch_version('gtk.FILE_CHOOSER_ACTION_SAVE','gtk.FileChooserAction.SAVE'), - (('Session *.session', '*.session'),), - confirm_overwrite=True, - initfilename=self.session_filename, - buttons=( - gtk.STOCK_CANCEL, branch_version('gtk.RESPONSE_CANCEL','gtk.ResponseType.CANCEL'), - gtk.STOCK_SAVE, branch_version('gtk.RESPONSE_OK','gtk.ResponseType.OK'), - ) - ) - if filename: - self.session_filename = filename - if self.session_filename: - stem, ext = os.path.splitext(self.session_filename) - if not ext: - self.session_filename += '.session' - self.save_session(self.session_filename) - msg = 'Session file: %s' % (self.session_filename, ) - self.statusbar.pop(self.statusbar_cid) - self.statusbar.push(self.statusbar_cid, msg) - - def on_save_session_as_menuitem_activate(self, menuitem, data=None): - filename = self.choose_filename( - branch_version('gtk.FILE_CHOOSER_ACTION_SAVE','gtk.FileChooserAction.SAVE'), - (('Session *.session', '*.session'),), - confirm_overwrite=True, - initfilename=self.session_filename, - buttons=( - gtk.STOCK_CANCEL, branch_version('gtk.RESPONSE_CANCEL','gtk.ResponseType.CANCEL'), - gtk.STOCK_SAVE, branch_version('gtk.RESPONSE_OK','gtk.ResponseType.OK'), - ) - ) - if filename: - self.session_filename = filename - stem, ext = os.path.splitext(self.session_filename) - if not ext: - self.session_filename += '.session' - self.save_session(self.session_filename) - msg = 'Session file: %s' % (self.session_filename, ) - self.statusbar.pop(self.statusbar_cid) - self.statusbar.push(self.statusbar_cid, msg) - - def save_session(self, filename): - self.trans_gui_2_obj() - sessionObj = self.params - outfile = open(filename, 'w') - outfile.write('<?xml version="1.0" ?>\n') - sessionObj.export(outfile, 0, name_="session", - namespacedef_='') - outfile.close() - msg = 'Session saved to file:\n%s' % (filename, ) - msgTy = branch_version('gtk.MESSAGE_INFO','gtk.MessageType.INFO') - self.error_message(msg, msgTy) - self.saved_params = self.params.copy() - - def load_session(self, filename): - try: - doc = generateds_gui_session.parsexml_(filename) - rootNode = doc.getroot() - rootTag, rootClass = generateds_gui_session.get_root_tag(rootNode) - if rootClass is None: - rootTag = 'session' - rootClass = generateds_gui_session.sessionType - sessionObj = rootClass.factory() - sessionObj.build(rootNode) - self.params = sessionObj - self.trans_obj_2_gui() - self.trans_gui_2_obj() - self.saved_params = self.params.copy() - except IOError as exp: - msg = str(exp) - self.error_message(msg) - except expat.ExpatError as exp: - msg = '%s file: %s' % (str(exp), filename, ) - self.error_message(msg) - - def on_about_menu_item_activate(self, menuitem, data=None): - if self.about_dialog: - self.about_dialog.present() - return - authors = [ - 'Dave Kuhlman <dkuhlman@rexx.com>', - ] - about_dialog = gtk.AboutDialog() - about_dialog.set_transient_for(self.window) - about_dialog.set_destroy_with_parent(True) - about_dialog.set_name("generateDS.py Python bindings generator") - about_dialog.set_version(VERSION) - about_dialog.set_copyright("Copyright \xc2\xa9 2009 Dave Kuhlman") - about_dialog.set_website("http://www.rexx.com/~dkuhlman") - about_dialog.set_comments("GTK+ and Glade3 GUI front end") - about_dialog.set_authors(authors) - about_dialog.set_logo_icon_name(gtk.STOCK_EDIT) - # callbacks for destroying the dialog - def close(dialog, response, editor): - editor.about_dialog = None - dialog.destroy() - def delete_event(dialog, event, editor): - editor.about_dialog = None - return True - about_dialog.connect("response", close, self) - about_dialog.connect("delete-event", delete_event, self) - self.about_dialog = about_dialog - about_dialog.show() - - def error_message(self, message, message_type=None): - # log to terminal window - #print message - # create an error message dialog and display modally to the user - if message_type is None: - message_type = branch_version('gtk.MESSAGE_ERROR','gtk.MessageType.ERROR') - - dialog = gtk.MessageDialog(None, - branch_version('gtk.DIALOG_MODAL','gtk.DialogFlags.MODAL') | branch_version('gtk.DIALOG_DESTROY_WITH_PARENT','gtk.DialogFlags.DESTROY_WITH_PARENT'), - message_type, branch_version('gtk.BUTTONS_OK','gtk.ButtonsType.OK'), message) - - dialog.run() - dialog.destroy() - - def reset_default_status(self): - msg = "Session file: (UNTITLED)" - self.statusbar.pop(self.statusbar_cid) - self.statusbar.push(self.statusbar_cid, msg) - - def on_input_schema_chooser_button_clicked(self, button, data=None): - filename = self.choose_filename(branch_version('gtk.FILE_CHOOSER_ACTION_OPEN','gtk.FileChooserAction.OPEN'), - (('Schemas *.xsd', '*.xsd'),)) - if filename: - self.input_schema_entry.set_text(filename) - - def on_output_superclass_chooser_button_clicked(self, widget, data=None): - filename = self.choose_filename(patterns=(('Python *.py', '*.py'), )) - if filename: - self.output_superclass_entry.set_text(filename) - #self.on_output_superclass_entry_changed( - # self.output_superclass_entry, data) - - def on_output_subclass_chooser_button_clicked(self, button, data=None): - filename = self.choose_filename(patterns=(('Python *.py', '*.py'), )) - if filename: - self.output_subclass_entry.set_text(filename) - - def on_behavior_filename_chooser_button_clicked(self, button, data=None): - filename = self.choose_filename(branch_version('gtk.FILE_CHOOSER_ACTION_OPEN','gtk.FileChooserAction.OPEN'), - (('Python *.py', '*.py'),)) - if filename: - self.behavior_filename_entry.set_text(filename) - - def on_validator_bodies_chooser_button_clicked(self, button, data=None): - filename = self.choose_filename(branch_version('gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER','gtk.FileChooserAction.SELECT_FOLDER'), - ) - if filename: - self.validator_bodies_entry.set_text(filename) - - def on_user_methods_chooser_button_clicked(self, button, data=None): - filename = self.choose_filename(branch_version('gtk.FILE_CHOOSER_ACTION_OPEN','gtk.FileChooserAction.OPEN'), - (('Python *.py', '*.py'),)) - if filename: - self.user_methods_entry.set_text(filename) - - def choose_filename(self, action=None, - patterns=(), confirm_overwrite=False, initfilename=None, - buttons=None): - if action is None: - action = branch_version('gtk.FILE_CHOOSER_ACTION_SAVE','gtk.FileChooserAction.SAVE') - filename = None - ty_CANCEL = branch_version('gtk.RESPONSE_CANCEL','gtk.ResponseType.CANCEL') - ty_OK = branch_version('gtk.RESPONSE_OK','gtk.ResponseType.OK') - if buttons is None: - buttons=( - gtk.STOCK_CANCEL, ty_CANCEL, - gtk.STOCK_OPEN, ty_OK, - ) - dialog = gtk.FileChooserDialog( - title=None, - action=action, - buttons=buttons, - ) - if self.current_folder is not None: - dialog.set_current_folder(self.current_folder) - if initfilename is not None: - dialog.set_filename(initfilename) - if patterns: - filter = gtk.FileFilter() - for name, pattern in patterns: - filter.set_name(name) - filter.add_pattern(pattern) - dialog.add_filter(filter) - filter = gtk.FileFilter() - filter.set_name("All files *.*") - filter.add_pattern("*") - dialog.add_filter(filter) - dialog.set_do_overwrite_confirmation(confirm_overwrite) - response = dialog.run() - if response == branch_version('gtk.RESPONSE_OK','gtk.ResponseType.OK'): - filename = dialog.get_filename() - self.current_folder = dialog.get_current_folder() - elif response == branch_version('gtk.RESPONSE_CANCEL','gtk.ResponseType.CANCEL'): - pass - dialog.destroy() - return filename - - def on_namespace_prefix_entry_changed(self, widget, data=None): - entry = self.ui_obj_dict['namespace_prefix_entry'] - checkbutton = self.ui_obj_dict['empty_namespace_prefix_checkbutton'] - checkbutton.set_active(False) - return True - - def on_empty_namespace_prefix_checkbutton_toggled(self, widget, data=None): - entry = self.ui_obj_dict['namespace_prefix_entry'] - checkbutton = self.ui_obj_dict['empty_namespace_prefix_checkbutton'] - if widget.get_active(): - entry.set_text('') - return True - - def on_output_superclass_entry_changed(self, widget, data=None): - entry = self.ui_obj_dict['superclass_module_entry'] - checkbutton = self.auto_super_checkbutton - if checkbutton.get_active(): - path = widget.get_text() - if path: - stem = os.path.splitext(os.path.split(path)[1])[0] - if stem: - entry.set_text(stem) - return True - - def on_auto_super_checkbutton_toggled(self, widget, data=None): - entry = self.ui_obj_dict['superclass_module_entry'] - superclass_entry = self.ui_obj_dict['output_superclass_entry'] - #checkbutton = self.auto_super_checkbutton - checkbutton = widget - if widget.get_active(): - path = superclass_entry.get_text() - if path: - stem = os.path.splitext(os.path.split(path)[1])[0] - if stem: - entry.set_text(stem) - return True - - def on_ok_button_activate(self, widget, data=None): - #print( '(GeneratedsGui) widget:', widget) - response = self.content_dialog.on_ok_button_activate( - self.content_dialog, data) - return response - - name_pat1 = re.compile(r'^(.*)_clear_button') - - # This method keys off the correspondence between the - # name of the button and the name of the related entry, - # for example, xxx_yyy_entry : xxx_yyy_clear_button. - def on_clear_button_clicked(self, widget, data=None): - name = widget.get_name() if sys.version_info.major == 2 else gtk.Buildable.get_name(widget) # http://python.6.x6.nabble.com/Confused-about-a-widget-s-name-td5015372.html - mo = GeneratedsGui.name_pat1.search(name) - if not mo is None: - stem = mo.group(1) - name1 = '%s_entry' % (stem, ) - ui_obj = self.ui_obj_dict[name1] - ui_obj.set_text('') - - # Run main application window - def main(self): - self.window.show() - gtk.main() - - -class ContentDialog(gtk.Dialog): - def __init__(self): - global Builder - self.content_dialog = Builder.get_object('content_dialog') - self.content_textview = Builder.get_object('content_textview') - buf = self.content_textview.get_buffer().set_text('') - - def show(self, content): - #Builder.connect_signals(self) - self.content_textview.get_buffer().set_text(content) - response = self.content_dialog.run() - self.content_dialog.hide() - - def on_ok_button_activate(self, widget, data=None): - #print( '(content_dialog) widget:', widget) - return False - - -# -# Functions for internal use -# - -def branch_version(for_2, for_3): - """ - The Branch works depends on the version of Python - """ - if sys.version_info.major == 2: - return eval(for_2) - elif sys.version_info.major == 3: - return eval(for_3) - else: - return eval(for_3) - -def capture_options(options): - config_parser = ConfigParser() - config_parser.read([ - os.path.expanduser('~/.generateds_gui.ini'), - './generateds_gui.ini', - ]) - section = 'general' - names = ('exec-path', 'exec_path') - capture_1_option(options, config_parser, section, names) -## names = ('impl-schema', 'impl_schema') -## capture_1_option(options, config_parser, section, names) - names = ('impl-gui', 'impl_gui') - capture_1_option(options, config_parser, section, names) - names = ('session', 'session') - capture_1_option(options, config_parser, section, names) - # Set some defaults. - if options.exec_path is None: - options.exec_path = 'generateDS.py' - -def capture_1_option(options, config_parser, section, names): - if (getattr(options, names[1]) is None and - config_parser.has_option(section, names[0]) - ): - setattr(options, names[1], config_parser.get(section, names[0])) - -def capture_ui_names(): - items = generateds_gui_session.sessionType.member_data_items_ - for item in items: - ui_item = UIItemSpec(item.get_name()) - if item.get_name() == 'member_specs': - ui_item.set_ui_type('combobox') - ui_item.set_access_action('active') - elif item.get_data_type() == 'xs:string': - ui_item.set_ui_type('entry') - ui_item.set_access_action('text') - elif item.get_data_type() == 'xs:boolean': - ui_item.set_ui_type('checkbutton') - ui_item.set_access_action('active') - ParamNameList.append(ui_item) -## print 'ParamNameList:' -## for item in ParamNameList: -## print ' %s %s' % (item.get_name(), item.get_ui_type(), ) - - -USAGE_TEXT = """ - python %prog [options] <somefile.xxx> -example: - python %prog somefile.xxx""" - -def usage(parser): - parser.print_help() - sys.exit(1) - - -def main(): - parser = OptionParser(USAGE_TEXT) - parser.add_option("--exec-path", - type="string", action="store", - dest="exec_path", - #default="generateDS.py", - help='path to executable generated in command line.' - ' Example: "python /path/to/generateDS.py".' - ' Default: "./generateDS.py".' - ' Use Tools/Generate CL (Ctrl-T) to see it.' - ) - parser.add_option("--impl-gui", - type="string", action="store", - dest="impl_gui", - help="name of glade file that defines the GUI if not embedded." - ) - parser.add_option("-s", "--session", - type="string", action="store", - dest="session", - help="name of a session file to be loaded." - ) - (options, args) = parser.parse_args() - capture_options(options) - capture_ui_names() - if len(args) > 0: - usage(parser) - editor = GeneratedsGui(options) - editor.main() - -# Do not change the next 3 lines. -## UI_SPECIFICATION ## - -Ui_spec = """<?xml version="1.0" encoding="UTF-8"?> -<interface> - <requires lib="gtk+" version="2.16"/> - <!-- interface-naming-policy project-wide --> - <object class="GtkWindow" id="window1"> - <accel-groups> - <group name="accelgroup1"/> - </accel-groups> - <signal name="delete_event" handler="on_window_delete_event"/> - <child> - <object class="GtkVBox" id="vbox1"> - <property name="visible">True</property> - <property name="orientation">vertical</property> - <child> - <object class="GtkMenuBar" id="menubar1"> - <property name="visible">True</property> - <child> - <object class="GtkMenuItem" id="menuitem1"> - <property name="visible">True</property> - <property name="label" translatable="yes">_File</property> - <property name="use_underline">True</property> - <child type="submenu"> - <object class="GtkMenu" id="menu1"> - <property name="visible">True</property> - <child> - <object class="GtkImageMenuItem" id="clear_menuitem"> - <property name="label">Clear</property> - <property name="visible">True</property> - <property name="image">image4</property> - <property name="use_stock">False</property> - <property name="accel_group">accelgroup1</property> - <accelerator key="n" signal="activate" modifiers="GDK_CONTROL_MASK"/> - <signal name="activate" handler="on_clear_menuitem_activate"/> - </object> - </child> - <child> - <object class="GtkImageMenuItem" id="open_session_menuitem"> - <property name="label">_Load session</property> - <property name="visible">True</property> - <property name="tooltip_text" translatable="yes">Load a previous saved session.</property> - <property name="use_underline">True</property> - <property name="image">image3</property> - <property name="use_stock">False</property> - <property name="accel_group">accelgroup1</property> - <accelerator key="o" signal="activate" modifiers="GDK_CONTROL_MASK"/> - <signal name="activate" handler="on_open_session_menuitem_activate"/> - </object> - </child> - <child> - <object class="GtkImageMenuItem" id="save_session_menuitem"> - <property name="label">_Save session</property> - <property name="visible">True</property> - <property name="tooltip_text" translatable="yes">Save the current session.</property> - <property name="use_underline">True</property> - <property name="image">image1</property> - <property name="use_stock">False</property> - <property name="accel_group">accelgroup1</property> - <accelerator key="s" signal="activate" modifiers="GDK_CONTROL_MASK"/> - <signal name="activate" handler="on_save_session_menuitem_activate"/> - </object> - </child> - <child> - <object class="GtkImageMenuItem" id="save_session_as_menuitem"> - <property name="label">Save session as ...</property> - <property name="visible">True</property> - <property name="tooltip_text" translatable="yes">Save the current session in -file chosen by the user.</property> - <property name="image">image2</property> - <property name="use_stock">False</property> - <property name="accel_group">accelgroup1</property> - <signal name="activate" handler="on_save_session_as_menuitem_activate"/> - </object> - </child> - <child> - <object class="GtkSeparatorMenuItem" id="menuitem5"> - <property name="visible">True</property> - </object> - </child> - <child> - <object class="GtkImageMenuItem" id="imagemenuitem5"> - <property name="label">gtk-quit</property> - <property name="visible">True</property> - <property name="tooltip_text" translatable="yes">Exit from the application.</property> - <property name="use_underline">True</property> - <property name="use_stock">True</property> - <property name="accel_group">accelgroup1</property> - <signal name="activate" handler="on_quit_menu_item_activate"/> - </object> - </child> - </object> - </child> - </object> - </child> - <child> - <object class="GtkMenuItem" id="menuitem2"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Tools</property> - <property name="use_underline">True</property> - <child type="submenu"> - <object class="GtkMenu" id="menu2"> - <property name="visible">True</property> - <child> - <object class="GtkMenuItem" id="capture_cl_menuitem"> - <property name="visible">True</property> - <property name="tooltip_text" translatable="yes">Capture the command line that would be used -to generate the bindings modules.</property> - <property name="label" translatable="yes">_Capture CL</property> - <property name="use_underline">True</property> - <accelerator key="t" signal="activate" modifiers="GDK_CONTROL_MASK"/> - <signal name="activate" handler="on_capture_cl_menuitem_activate"/> - </object> - </child> - <child> - <object class="GtkMenuItem" id="generate_menuitem"> - <property name="visible">True</property> - <property name="tooltip_text" translatable="yes">Generate the bindings modules.</property> - <property name="label" translatable="yes">_Generate</property> - <property name="use_underline">True</property> - <accelerator key="g" signal="activate" modifiers="GDK_CONTROL_MASK"/> - <signal name="activate" handler="on_generate_menuitem_activate"/> - </object> - </child> - </object> - </child> - </object> - </child> - <child> - <object class="GtkMenuItem" id="menuitem4"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Help</property> - <property name="use_underline">True</property> - <child type="submenu"> - <object class="GtkMenu" id="menu3"> - <property name="visible">True</property> - <child> - <object class="GtkImageMenuItem" id="imagemenuitem10"> - <property name="label">gtk-about</property> - <property name="visible">True</property> - <property name="use_underline">True</property> - <property name="use_stock">True</property> - <property name="accel_group">accelgroup1</property> - <signal name="activate" handler="on_about_menu_item_activate"/> - </object> - </child> - </object> - </child> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkTable" id="table1"> - <property name="visible">True</property> - <property name="n_rows">22</property> - <property name="n_columns">4</property> - <child> - <object class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Input schema file:</property> - </object> - </child> - <child> - <object class="GtkLabel" id="label2"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Output superclass file:</property> - </object> - <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label3"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Output subclass file:</property> - </object> - <packing> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label4"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Overwrite without asking:</property> - </object> - <packing> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="force_checkbutton"> - <property name="label" translatable="yes">Force</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Always overwrite output files. -Do not ask for confirmation.</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="input_schema_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">The path and name of the -input XML schema defining the -bindings to be generated.</property> - <property name="invisible_char">●</property> - <property name="width_chars">80</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="output_superclass_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">The path and name of the output file -to be generated and to contain the -superclasses.</property> - <property name="invisible_char">●</property> - <signal name="changed" handler="on_output_superclass_entry_changed"/> - </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> - </packing> - </child> - <child> - <object class="GtkEntry" id="output_subclass_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">The path and name of the output file -to be generated and to contain the -subclasses.</property> - <property name="invisible_char">●</property> - </object> - <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> - <child> - <object class="GtkLabel" id="label5"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Prefix (for class names):</property> - </object> - <packing> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="prefix_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Prefix for class names.</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label6"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Namespace prefix:</property> - </object> - <packing> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="namespace_prefix_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="events">GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property> - <property name="tooltip_text" translatable="yes">Override default namespace -prefix in schema file. -Example: -a "xsd:" -Default: "xs:".</property> - <property name="invisible_char">●</property> - <signal name="changed" handler="on_namespace_prefix_entry_changed"/> - </object> - <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> - </packing> - </child> - <child> - <object class="GtkLabel" id="label7"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Behavior file name:</property> - </object> - <packing> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="behavior_filename_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Input file name for behaviors -added to subclasses.</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label8"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Generate Python properties:</property> - </object> - <packing> - <property name="top_attach">7</property> - <property name="bottom_attach">8</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="properties_checkbutton"> - <property name="label" translatable="yes">Properties</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Generate Python properties for member variables -so that the value can be retrieved and modified -without calling getter and setter functions. -</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">7</property> - <property name="bottom_attach">8</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label10"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Subclass suffix:</property> - </object> - <packing> - <property name="top_attach">9</property> - <property name="bottom_attach">10</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="subclass_suffix_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Append this text to the generated subclass names. -Default="Sub".</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">9</property> - <property name="bottom_attach">10</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label11"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Root element:</property> - </object> - <packing> - <property name="top_attach">10</property> - <property name="bottom_attach">11</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="root_element_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Assume that this value is the name -of the root element of instance docs. -Default is first element defined in schema.</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">10</property> - <property name="bottom_attach">11</property> - </packing> - </child> - <child> - <object class="GtkButton" id="input_schema_chooser_button"> - <property name="label" translatable="yes">Choose</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Choose the input schema file.</property> - <signal name="clicked" handler="on_input_schema_chooser_button_clicked"/> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - </packing> - </child> - <child> - <object class="GtkButton" id="output_superclass_chooser_button"> - <property name="label" translatable="yes">Choose</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Choose the output superclass bindings file.</property> - <signal name="clicked" handler="on_output_superclass_chooser_button_clicked"/> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - </packing> - </child> - <child> - <object class="GtkButton" id="output_subclass_chooser_button"> - <property name="label" translatable="yes">Choose</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Choose the output subclass bindings file.</property> - <signal name="clicked" handler="on_output_subclass_chooser_button_clicked"/> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - </packing> - </child> - <child> - <object class="GtkButton" id="behavior_filename_chooser_button"> - <property name="label" translatable="yes">Choose</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Choose the nput file name for -behaviors added to subclasses.</property> - <signal name="clicked" handler="on_behavior_filename_chooser_button_clicked"/> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label12"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Superclass module:</property> - </object> - <packing> - <property name="top_attach">11</property> - <property name="bottom_attach">12</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="superclass_module_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Superclass module name in subclass module. -Default="???".</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">11</property> - <property name="bottom_attach">12</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label13"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Use old getters and setters:</property> - </object> - <packing> - <property name="top_attach">12</property> - <property name="bottom_attach">13</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="old_getters_setters_checkbutton"> - <property name="label" translatable="yes">Old getters and setters</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Name getters and setters getVar() and setVar(), -instead of get_var() and set_var().</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">12</property> - <property name="bottom_attach">13</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label14"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Validator bodies path:</property> - </object> - <packing> - <property name="top_attach">13</property> - <property name="bottom_attach">14</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label15"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">User methods module:</property> - </object> - <packing> - <property name="top_attach">14</property> - <property name="bottom_attach">15</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label16"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">No dates:</property> - </object> - <packing> - <property name="top_attach">15</property> - <property name="bottom_attach">16</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label17"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">No versions:</property> - </object> - <packing> - <property name="top_attach">16</property> - <property name="bottom_attach">17</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="no_dates_checkbutton"> - <property name="label" translatable="yes">No dates in generated output</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Do not include the current date in the generated -files. This is useful if you want to minimize -the amount of (no-operation) changes to the -generated python code.</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">15</property> - <property name="bottom_attach">16</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="validator_bodies_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Path to a directory containing files that provide -bodies (implementations) of validator methods.</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">13</property> - <property name="bottom_attach">14</property> - </packing> - </child> - <child> - <object class="GtkButton" id="validator_bodies_chooser_button"> - <property name="label" translatable="yes">Choose</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Choose the path to a directory containing files that provide -bodies (implementations) of validator methods.</property> - <signal name="clicked" handler="on_validator_bodies_chooser_button_clicked"/> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">13</property> - <property name="bottom_attach">14</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="no_versions_checkbutton"> - <property name="label" translatable="yes">No version info in generated output</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Do not include the current version in the generated -files. This is useful if you want to minimize -the amount of (no-operation) changes to the -generated python code.</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">16</property> - <property name="bottom_attach">17</property> - </packing> - </child> - <child> - <object class="GtkButton" id="user_methods_button"> - <property name="label" translatable="yes">Choose</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Choose the optional module containing user methods. See -section "User Methods" in the documentation.</property> - <signal name="clicked" handler="on_user_methods_chooser_button_clicked"/> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">14</property> - <property name="bottom_attach">15</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="user_methods_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Optional module containing user methods. See -section "User Methods" in the documentation.</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">14</property> - <property name="bottom_attach">15</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label18"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">No process includes:</property> - </object> - <packing> - <property name="top_attach">17</property> - <property name="bottom_attach">18</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label19"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Silence:</property> - </object> - <packing> - <property name="top_attach">18</property> - <property name="bottom_attach">19</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="no_process_includes_checkbutton"> - <property name="label" translatable="yes">Do not process includes in schema</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Do not process included XML Schema files. By -default, generateDS.py will insert content -from files referenced by <include ... /> -elements into the XML Schema to be processed.</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">17</property> - <property name="bottom_attach">18</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="silence_checkbutton"> - <property name="label" translatable="yes">Generate code that does not echo the parsed XML</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Normally, the code generated with generateDS -echoes the information being parsed. Use -this option to turn off that behavior. -</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">18</property> - <property name="bottom_attach">19</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label20"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Namespace definitions:</property> - </object> - <packing> - <property name="top_attach">19</property> - <property name="bottom_attach">20</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label21"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">External encoding:</property> - </object> - <packing> - <property name="top_attach">20</property> - <property name="bottom_attach">21</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label22"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Member specs:</property> - </object> - <packing> - <property name="top_attach">21</property> - <property name="bottom_attach">22</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="namespace_defs_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Namespace definition to be passed in as the -value for the namespacedef_ parameter of -the export() method by the generated -parse() and parseString() functions. -Default=''. Example: -xmlns:abc="http://www.abc.com"</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">19</property> - <property name="bottom_attach">20</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="external_encoding_entry"> - <property name="visible">True</property> - <property name="tooltip_text" translatable="yes">Encode output written by the generated export -methods using this encoding. Default, if omitted, -is the value returned by sys.getdefaultencoding(). -Example: utf-8.</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">20</property> - <property name="bottom_attach">21</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="member_specs_combobox_container"> - <property name="visible">True</property> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">21</property> - <property name="bottom_attach">22</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="empty_namespace_prefix_checkbutton"> - <property name="label" translatable="yes">Empty</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Assume an empty namespace -prefix in the XML schema, not -the default ("xs:").</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_empty_namespace_prefix_checkbutton_toggled"/> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="auto_super_checkbutton"> - <property name="label" translatable="yes">Auto</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Use the superclass file name -stem as the super-class module -name.</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_auto_super_checkbutton_toggled"/> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">11</property> - <property name="bottom_attach">12</property> - </packing> - </child> - <child> - <object class="GtkButton" id="input_schema_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the input schema file entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - </packing> - </child> - <child> - <object class="GtkButton" id="output_superclass_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the output superclass file entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - </packing> - </child> - <child> - <object class="GtkButton" id="output_subclass_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the output subclass file entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - </packing> - </child> - <child> - <object class="GtkButton" id="prefix_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the prefix entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - </packing> - </child> - <child> - <object class="GtkButton" id="namespace_prefix_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the XML namespace prefix entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> - </packing> - </child> - <child> - <object class="GtkButton" id="behavior_filename_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the behavior file name entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> - </packing> - </child> - <child> - <object class="GtkButton" id="subclass_suffix_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the subclass suffix.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">9</property> - <property name="bottom_attach">10</property> - </packing> - </child> - <child> - <object class="GtkButton" id="root_element_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the root element entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">10</property> - <property name="bottom_attach">11</property> - </packing> - </child> - <child> - <object class="GtkButton" id="superclass_module_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the superclass module entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">11</property> - <property name="bottom_attach">12</property> - </packing> - </child> - <child> - <object class="GtkButton" id="validator_bodies_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the validator bodies path entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">13</property> - <property name="bottom_attach">14</property> - </packing> - </child> - <child> - <object class="GtkButton" id="user_methods_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the user methods module entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">14</property> - <property name="bottom_attach">15</property> - </packing> - </child> - <child> - <object class="GtkButton" id="namespace_defs_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the namespace definitions entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">19</property> - <property name="bottom_attach">20</property> - </packing> - </child> - <child> - <object class="GtkButton" id="external_encoding_clear_button"> - <property name="label">gtk-clear</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Clear the external encoding entry.</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_clear_button_clicked"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">20</property> - <property name="bottom_attach">21</property> - </packing> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="hbox1"> - <property name="visible">True</property> - <property name="homogeneous">True</property> - <child> - <object class="GtkButton" id="generate_button"> - <property name="label" translatable="yes">Generate</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Generate the bindings modules.</property> - <signal name="clicked" handler="on_generate_button_clicked"/> - </object> - <packing> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButton" id="quit_button"> - <property name="label" translatable="yes">Quit</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Exit from the application.</property> - <signal name="clicked" handler="on_quit_button_clicked"/> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkStatusbar" id="statusbar1"> - <property name="visible">True</property> - <property name="spacing">2</property> - </object> - <packing> - <property name="expand">False</property> - <property name="position">3</property> - </packing> - </child> - <child> - <placeholder/> - </child> - </object> - </child> - </object> - <object class="GtkAccelGroup" id="accelgroup1"/> - <object class="GtkDialog" id="content_dialog"> - <property name="border_width">5</property> - <property name="title" translatable="yes">Messages and Content</property> - <property name="default_width">800</property> - <property name="default_height">600</property> - <property name="type_hint">normal</property> - <child internal-child="vbox"> - <object class="GtkVBox" id="dialog-vbox3"> - <property name="visible">True</property> - <property name="orientation">vertical</property> - <property name="spacing">2</property> - <child> - <object class="GtkScrolledWindow" id="scrolledwindow1"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">automatic</property> - <property name="vscrollbar_policy">automatic</property> - <child> - <object class="GtkTextView" id="content_textview"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">False</property> - </object> - </child> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - <child internal-child="action_area"> - <object class="GtkHButtonBox" id="dialog-action_area3"> - <property name="visible">True</property> - <property name="layout_style">end</property> - <child> - <object class="GtkButton" id="content_dialog_ok_button"> - <property name="label" translatable="yes">OK</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <signal name="activate" handler="on_ok_button_activate"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="pack_type">end</property> - <property name="position">0</property> - </packing> - </child> - </object> - </child> - <action-widgets> - <action-widget response="0">content_dialog_ok_button</action-widget> - </action-widgets> - </object> - <object class="GtkImage" id="image1"> - <property name="visible">True</property> - <property name="stock">gtk-save</property> - </object> - <object class="GtkImage" id="image2"> - <property name="visible">True</property> - <property name="stock">gtk-save-as</property> - </object> - <object class="GtkImage" id="image3"> - <property name="visible">True</property> - <property name="stock">gtk-open</property> - </object> - <object class="GtkImage" id="image4"> - <property name="visible">True</property> - <property name="stock">gtk-clear</property> - </object> - <object class="GtkImage" id="image5"> - <property name="visible">True</property> - <property name="stock">gtk-missing-image</property> - </object> -</interface> -""" - -## UI_SPECIFICATION ## -# Do not change the above 3 lines. - - - -if __name__ == "__main__": - main() - diff --git a/libgenerateDS/gui/generateds_gui.py b/libgenerateDS/gui/generateds_gui.py new file mode 120000 index 0000000000000000000000000000000000000000..84913b4dd70988c23a2d3e34caf6719164a68cac --- /dev/null +++ b/libgenerateDS/gui/generateds_gui.py @@ -0,0 +1 @@ +../../gui/generateds_gui.py \ No newline at end of file diff --git a/libgenerateDS/gui/generateds_gui_session.py b/libgenerateDS/gui/generateds_gui_session.py deleted file mode 100644 index 4a4ef0966fcbaf35198d0b3cd25ab2b6c0f6edce..0000000000000000000000000000000000000000 --- a/libgenerateDS/gui/generateds_gui_session.py +++ /dev/null @@ -1,862 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# -# Generated Wed Dec 8 14:24:46 2010 by generateDS.py version 2.3a. -# - -import sys -import getopt -import re as re_ - -etree_ = None -Verbose_import_ = False -( XMLParser_import_none, XMLParser_import_lxml, - XMLParser_import_elementtree - ) = list(range(3)) -XMLParser_import_library = None -try: - # lxml - from lxml import etree as etree_ - XMLParser_import_library = XMLParser_import_lxml - if Verbose_import_: - print("running with lxml.etree") -except ImportError: - try: - # cElementTree from Python 2.5+ - import xml.etree.cElementTree as etree_ - XMLParser_import_library = XMLParser_import_elementtree - if Verbose_import_: - print("running with cElementTree on Python 2.5+") - except ImportError: - try: - # ElementTree from Python 2.5+ - import xml.etree.ElementTree as etree_ - XMLParser_import_library = XMLParser_import_elementtree - if Verbose_import_: - print("running with ElementTree on Python 2.5+") - except ImportError: - try: - # normal cElementTree install - import cElementTree as etree_ - XMLParser_import_library = XMLParser_import_elementtree - if Verbose_import_: - print("running with cElementTree") - except ImportError: - try: - # normal ElementTree install - import elementtree.ElementTree as etree_ - XMLParser_import_library = XMLParser_import_elementtree - if Verbose_import_: - print("running with ElementTree") - except ImportError: - raise ImportError("Failed to import ElementTree from any known place") - -def parsexml_(*args, **kwargs): - if (XMLParser_import_library == XMLParser_import_lxml and - 'parser' not in kwargs): - # Use the lxml ElementTree compatible parser so that, e.g., - # we ignore comments. - kwargs['parser'] = etree_.ETCompatXMLParser() - doc = etree_.parse(*args, **kwargs) - return doc - -# -# User methods -# -# Calls to the methods in these classes are generated by generateDS.py. -# You can replace these methods by re-implementing the following class -# in a module named generatedssuper.py. - -try: - from generatedssuper import GeneratedsSuper -except ImportError as exp: - - class GeneratedsSuper(object): - def gds_format_string(self, input_data, input_name=''): - return input_data.decode('utf-8') if isinstance(input_data, bytes) else input_data - def gds_format_integer(self, input_data, input_name=''): - return '%d' % input_data - def gds_format_float(self, input_data, input_name=''): - return '%f' % input_data - def gds_format_double(self, input_data, input_name=''): - return '%e' % input_data - def gds_format_boolean(self, input_data, input_name=''): - return '%s' % input_data - def gds_str_lower(self, instring): - return instring.lower() - - - -# -# If you have installed IPython you can uncomment and use the following. -# IPython is available from http://ipython.scipy.org/. -# - -## from IPython.Shell import IPShellEmbed -## args = '' -## ipshell = IPShellEmbed(args, -## banner = 'Dropping into IPython', -## exit_msg = 'Leaving Interpreter, back to program.') - -# Then use the following line where and when you want to drop into the -# IPython shell: -# ipshell('<some message> -- Entering ipshell.\nHit Ctrl-D to exit') - -# -# Globals -# - -ExternalEncoding = 'ascii' -Tag_pattern_ = re_.compile(r'({.*})?(.*)') -STRING_CLEANUP_PAT = re_.compile(r"[\n\r\s]+") - -# -# Support/utility functions. -# - -def showIndent(outfile, level): - for idx in range(level): - outfile.write(' ') - -def quote_xml(inStr): - if not inStr: - return '' - s1 = (isinstance(inStr, str) and inStr or - '%s' % inStr) - s1 = s1.replace('&', '&') - s1 = s1.replace('<', '<') - s1 = s1.replace('>', '>') - return s1 - -def quote_attrib(inStr): - s1 = (isinstance(inStr, str) and inStr or - '%s' % inStr) - s1 = s1.replace('&', '&') - s1 = s1.replace('<', '<') - s1 = s1.replace('>', '>') - if '"' in s1: - if "'" in s1: - s1 = '"%s"' % s1.replace('"', """) - else: - s1 = "'%s'" % s1 - else: - s1 = '"%s"' % s1 - return s1 - -def quote_python(inStr): - s1 = inStr - if s1.find("'") == -1: - if s1.find('\n') == -1: - return "'%s'" % s1 - else: - return "'''%s'''" % s1 - else: - if s1.find('"') != -1: - s1 = s1.replace('"', '\\"') - if s1.find('\n') == -1: - return '"%s"' % s1 - else: - return '"""%s"""' % s1 - - -def get_all_text_(node): - if node.text is not None: - text = node.text - else: - text = '' - for child in node: - if child.tail is not None: - text += child.tail - return text - - -class GDSParseError(Exception): - pass - -def raise_parse_error(node, msg): - if XMLParser_import_library == XMLParser_import_lxml: - msg = '%s (element %s/line %d)' % (msg, node.tag, node.sourceline, ) - else: - msg = '%s (element %s)' % (msg, node.tag, ) - raise GDSParseError(msg) - - -class MixedContainer: - # Constants for category: - CategoryNone = 0 - CategoryText = 1 - CategorySimple = 2 - CategoryComplex = 3 - # Constants for content_type: - TypeNone = 0 - TypeText = 1 - TypeString = 2 - TypeInteger = 3 - TypeFloat = 4 - TypeDecimal = 5 - TypeDouble = 6 - TypeBoolean = 7 - def __init__(self, category, content_type, name, value): - self.category = category - self.content_type = content_type - self.name = name - self.value = value - def getCategory(self): - return self.category - def getContenttype(self, content_type): - return self.content_type - def getValue(self): - return self.value - def getName(self): - return self.name - def export(self, outfile, level, name, namespace): - if self.category == MixedContainer.CategoryText: - # Prevent exporting empty content as empty lines. - if self.value.strip(): - outfile.write(self.value) - elif self.category == MixedContainer.CategorySimple: - self.exportSimple(outfile, level, name) - else: # category == MixedContainer.CategoryComplex - self.value.export(outfile, level, namespace,name) - def exportSimple(self, outfile, level, name): - if self.content_type == MixedContainer.TypeString: - outfile.write('<%s>%s</%s>' % (self.name, self.value, self.name)) - elif self.content_type == MixedContainer.TypeInteger or \ - self.content_type == MixedContainer.TypeBoolean: - outfile.write('<%s>%d</%s>' % (self.name, self.value, self.name)) - elif self.content_type == MixedContainer.TypeFloat or \ - self.content_type == MixedContainer.TypeDecimal: - outfile.write('<%s>%f</%s>' % (self.name, self.value, self.name)) - elif self.content_type == MixedContainer.TypeDouble: - outfile.write('<%s>%g</%s>' % (self.name, self.value, self.name)) - def exportLiteral(self, outfile, level, name): - if self.category == MixedContainer.CategoryText: - showIndent(outfile, level) - outfile.write('model_.MixedContainer(%d, %d, "%s", "%s"),\n' % \ - (self.category, self.content_type, self.name, self.value)) - elif self.category == MixedContainer.CategorySimple: - showIndent(outfile, level) - outfile.write('model_.MixedContainer(%d, %d, "%s", "%s"),\n' % \ - (self.category, self.content_type, self.name, self.value)) - else: # category == MixedContainer.CategoryComplex - showIndent(outfile, level) - outfile.write('model_.MixedContainer(%d, %d, "%s",\n' % \ - (self.category, self.content_type, self.name,)) - self.value.exportLiteral(outfile, level + 1) - showIndent(outfile, level) - outfile.write(')\n') - - -class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0): - self.name = name - self.data_type = data_type - self.container = container - def set_name(self, name): self.name = name - def get_name(self): return self.name - def set_data_type(self, data_type): self.data_type = data_type - def get_data_type_chain(self): return self.data_type - def get_data_type(self): - if isinstance(self.data_type, list): - if len(self.data_type) > 0: - return self.data_type[-1] - else: - return 'xs:string' - else: - return self.data_type - def set_container(self, container): self.container = container - def get_container(self): return self.container - -def _cast(typ, value): - if typ is None or value is None: - return value - return typ(value) - -# -# Mixin class for additional behaviors. -# - -class SessionTypeMixin(object): - def copy(self): - """Produce a copy of myself. - """ - new_session = sessionType( - input_schema = self.input_schema, - output_superclass = self.output_superclass, - output_subclass = self.output_subclass, - force = self.force, - prefix = self.prefix, - namespace_prefix = self.namespace_prefix, - empty_namespace_prefix = self.empty_namespace_prefix, - behavior_filename = self.behavior_filename, - properties = self.properties, - subclass_suffix = self.subclass_suffix, - root_element = self.root_element, - superclass_module = self.superclass_module, - auto_super = self.auto_super, - old_getters_setters = self.old_getters_setters, - validator_bodies = self.validator_bodies, - user_methods = self.user_methods, - no_dates = self.no_dates, - no_versions = self.no_versions, - no_process_includes = self.no_process_includes, - silence = self.silence, - namespace_defs = self.namespace_defs, - external_encoding = self.external_encoding, - member_specs = self.member_specs, - ) - return new_session - - def __eq__(self, obj): - """Implement the == operator. - """ - if ( - obj.input_schema == self.input_schema and - obj.output_superclass == self.output_superclass and - obj.output_subclass == self.output_subclass and - obj.force == self.force and - obj.prefix == self.prefix and - obj.namespace_prefix == self.namespace_prefix and - obj.empty_namespace_prefix == self.empty_namespace_prefix and - obj.behavior_filename == self.behavior_filename and - obj.properties == self.properties and - obj.subclass_suffix == self.subclass_suffix and - obj.root_element == self.root_element and - obj.superclass_module == self.superclass_module and - obj.auto_super == self.auto_super and - obj.old_getters_setters == self.old_getters_setters and - obj.validator_bodies == self.validator_bodies and - obj.user_methods == self.user_methods and - obj.no_dates == self.no_dates and - obj.no_versions == self.no_versions and - obj.no_process_includes == self.no_process_includes and - obj.silence == self.silence and - obj.namespace_defs == self.namespace_defs and - obj.external_encoding == self.external_encoding and - obj.member_specs == self.member_specs): - return True - else: - return False - - def __ne__(self, obj): - """Implement the != operator. - """ - return not self.__eq__(obj) - -# -# Data representation classes. -# - -class sessionType(GeneratedsSuper, SessionTypeMixin): - member_data_items_ = [ - MemberSpec_('input_schema', 'xs:string', 0), - MemberSpec_('output_superclass', 'xs:string', 0), - MemberSpec_('output_subclass', 'xs:string', 0), - MemberSpec_('force', 'xs:boolean', 0), - MemberSpec_('prefix', 'xs:string', 0), - MemberSpec_('namespace_prefix', 'xs:string', 0), - MemberSpec_('empty_namespace_prefix', 'xs:boolean', 0), - MemberSpec_('behavior_filename', 'xs:string', 0), - MemberSpec_('properties', 'xs:boolean', 0), - MemberSpec_('subclass_suffix', 'xs:string', 0), - MemberSpec_('root_element', 'xs:string', 0), - MemberSpec_('superclass_module', 'xs:string', 0), - MemberSpec_('auto_super', 'xs:boolean', 0), - MemberSpec_('old_getters_setters', 'xs:boolean', 0), - MemberSpec_('validator_bodies', 'xs:string', 0), - MemberSpec_('user_methods', 'xs:string', 0), - MemberSpec_('no_dates', 'xs:boolean', 0), - MemberSpec_('no_versions', 'xs:boolean', 0), - MemberSpec_('no_process_includes', 'xs:boolean', 0), - MemberSpec_('silence', 'xs:boolean', 0), - MemberSpec_('namespace_defs', 'xs:string', 0), - MemberSpec_('external_encoding', 'xs:string', 0), - MemberSpec_('member_specs', 'xs:string', 0), - ] - subclass = None - superclass = None - def __init__(self, input_schema=None, output_superclass=None, output_subclass=None, force=None, prefix=None, namespace_prefix=None, empty_namespace_prefix=None, behavior_filename=None, properties=None, subclass_suffix=None, root_element=None, superclass_module=None, auto_super=None, old_getters_setters=None, validator_bodies=None, user_methods=None, no_dates=None, no_versions=None, no_process_includes=None, silence=None, namespace_defs=None, external_encoding=None, member_specs=None): - self.input_schema = input_schema - self.output_superclass = output_superclass - self.output_subclass = output_subclass - self.force = force - self.prefix = prefix - self.namespace_prefix = namespace_prefix - self.empty_namespace_prefix = empty_namespace_prefix - self.behavior_filename = behavior_filename - self.properties = properties - self.subclass_suffix = subclass_suffix - self.root_element = root_element - self.superclass_module = superclass_module - self.auto_super = auto_super - self.old_getters_setters = old_getters_setters - self.validator_bodies = validator_bodies - self.user_methods = user_methods - self.no_dates = no_dates - self.no_versions = no_versions - self.no_process_includes = no_process_includes - self.silence = silence - self.namespace_defs = namespace_defs - self.external_encoding = external_encoding - self.member_specs = member_specs - def factory(*args_, **kwargs_): - if sessionType.subclass: - return sessionType.subclass(*args_, **kwargs_) - else: - return sessionType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_input_schema(self): return self.input_schema - def set_input_schema(self, input_schema): self.input_schema = input_schema - def get_output_superclass(self): return self.output_superclass - def set_output_superclass(self, output_superclass): self.output_superclass = output_superclass - def get_output_subclass(self): return self.output_subclass - def set_output_subclass(self, output_subclass): self.output_subclass = output_subclass - def get_force(self): return self.force - def set_force(self, force): self.force = force - def get_prefix(self): return self.prefix - def set_prefix(self, prefix): self.prefix = prefix - def get_namespace_prefix(self): return self.namespace_prefix - def set_namespace_prefix(self, namespace_prefix): self.namespace_prefix = namespace_prefix - def get_empty_namespace_prefix(self): return self.empty_namespace_prefix - def set_empty_namespace_prefix(self, empty_namespace_prefix): self.empty_namespace_prefix = empty_namespace_prefix - def get_behavior_filename(self): return self.behavior_filename - def set_behavior_filename(self, behavior_filename): self.behavior_filename = behavior_filename - def get_properties(self): return self.properties - def set_properties(self, properties): self.properties = properties - def get_subclass_suffix(self): return self.subclass_suffix - def set_subclass_suffix(self, subclass_suffix): self.subclass_suffix = subclass_suffix - def get_root_element(self): return self.root_element - def set_root_element(self, root_element): self.root_element = root_element - def get_superclass_module(self): return self.superclass_module - def set_superclass_module(self, superclass_module): self.superclass_module = superclass_module - def get_auto_super(self): return self.auto_super - def set_auto_super(self, auto_super): self.auto_super = auto_super - def get_old_getters_setters(self): return self.old_getters_setters - def set_old_getters_setters(self, old_getters_setters): self.old_getters_setters = old_getters_setters - def get_validator_bodies(self): return self.validator_bodies - def set_validator_bodies(self, validator_bodies): self.validator_bodies = validator_bodies - def get_user_methods(self): return self.user_methods - def set_user_methods(self, user_methods): self.user_methods = user_methods - def get_no_dates(self): return self.no_dates - def set_no_dates(self, no_dates): self.no_dates = no_dates - def get_no_versions(self): return self.no_versions - def set_no_versions(self, no_versions): self.no_versions = no_versions - def get_no_process_includes(self): return self.no_process_includes - def set_no_process_includes(self, no_process_includes): self.no_process_includes = no_process_includes - def get_silence(self): return self.silence - def set_silence(self, silence): self.silence = silence - def get_namespace_defs(self): return self.namespace_defs - def set_namespace_defs(self, namespace_defs): self.namespace_defs = namespace_defs - def get_external_encoding(self): return self.external_encoding - def set_external_encoding(self, external_encoding): self.external_encoding = external_encoding - def get_member_specs(self): return self.member_specs - def set_member_specs(self, member_specs): self.member_specs = member_specs - def export(self, outfile, level, namespace_='', name_='sessionType', namespacedef_=''): - showIndent(outfile, level) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - self.exportAttributes(outfile, level, [], namespace_, name_='sessionType') - if self.hasContent_(): - outfile.write('>\n') - self.exportChildren(outfile, level + 1, namespace_, name_) - showIndent(outfile, level) - outfile.write('</%s%s>\n' % (namespace_, name_)) - else: - outfile.write('/>\n') - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='sessionType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='sessionType'): - if self.input_schema is not None: - showIndent(outfile, level) - outfile.write('<%sinput_schema>%s</%sinput_schema>\n' % (namespace_, self.gds_format_string(quote_xml(self.input_schema).encode(ExternalEncoding), input_name='input_schema'), namespace_)) - if self.output_superclass is not None: - showIndent(outfile, level) - outfile.write('<%soutput_superclass>%s</%soutput_superclass>\n' % (namespace_, self.gds_format_string(quote_xml(self.output_superclass).encode(ExternalEncoding), input_name='output_superclass'), namespace_)) - if self.output_subclass is not None: - showIndent(outfile, level) - outfile.write('<%soutput_subclass>%s</%soutput_subclass>\n' % (namespace_, self.gds_format_string(quote_xml(self.output_subclass).encode(ExternalEncoding), input_name='output_subclass'), namespace_)) - if self.force is not None: - showIndent(outfile, level) - outfile.write('<%sforce>%s</%sforce>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.force)), input_name='force'), namespace_)) - if self.prefix is not None: - showIndent(outfile, level) - outfile.write('<%sprefix>%s</%sprefix>\n' % (namespace_, self.gds_format_string(quote_xml(self.prefix).encode(ExternalEncoding), input_name='prefix'), namespace_)) - if self.namespace_prefix is not None: - showIndent(outfile, level) - outfile.write('<%snamespace_prefix>%s</%snamespace_prefix>\n' % (namespace_, self.gds_format_string(quote_xml(self.namespace_prefix).encode(ExternalEncoding), input_name='namespace_prefix'), namespace_)) - if self.empty_namespace_prefix is not None: - showIndent(outfile, level) - outfile.write('<%sempty_namespace_prefix>%s</%sempty_namespace_prefix>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.empty_namespace_prefix)), input_name='empty_namespace_prefix'), namespace_)) - if self.behavior_filename is not None: - showIndent(outfile, level) - outfile.write('<%sbehavior_filename>%s</%sbehavior_filename>\n' % (namespace_, self.gds_format_string(quote_xml(self.behavior_filename).encode(ExternalEncoding), input_name='behavior_filename'), namespace_)) - if self.properties is not None: - showIndent(outfile, level) - outfile.write('<%sproperties>%s</%sproperties>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.properties)), input_name='properties'), namespace_)) - if self.subclass_suffix is not None: - showIndent(outfile, level) - outfile.write('<%ssubclass_suffix>%s</%ssubclass_suffix>\n' % (namespace_, self.gds_format_string(quote_xml(self.subclass_suffix).encode(ExternalEncoding), input_name='subclass_suffix'), namespace_)) - if self.root_element is not None: - showIndent(outfile, level) - outfile.write('<%sroot_element>%s</%sroot_element>\n' % (namespace_, self.gds_format_string(quote_xml(self.root_element).encode(ExternalEncoding), input_name='root_element'), namespace_)) - if self.superclass_module is not None: - showIndent(outfile, level) - outfile.write('<%ssuperclass_module>%s</%ssuperclass_module>\n' % (namespace_, self.gds_format_string(quote_xml(self.superclass_module).encode(ExternalEncoding), input_name='superclass_module'), namespace_)) - if self.auto_super is not None: - showIndent(outfile, level) - outfile.write('<%sauto_super>%s</%sauto_super>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.auto_super)), input_name='auto_super'), namespace_)) - if self.old_getters_setters is not None: - showIndent(outfile, level) - outfile.write('<%sold_getters_setters>%s</%sold_getters_setters>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.old_getters_setters)), input_name='old_getters_setters'), namespace_)) - if self.validator_bodies is not None: - showIndent(outfile, level) - outfile.write('<%svalidator_bodies>%s</%svalidator_bodies>\n' % (namespace_, self.gds_format_string(quote_xml(self.validator_bodies).encode(ExternalEncoding), input_name='validator_bodies'), namespace_)) - if self.user_methods is not None: - showIndent(outfile, level) - outfile.write('<%suser_methods>%s</%suser_methods>\n' % (namespace_, self.gds_format_string(quote_xml(self.user_methods).encode(ExternalEncoding), input_name='user_methods'), namespace_)) - if self.no_dates is not None: - showIndent(outfile, level) - outfile.write('<%sno_dates>%s</%sno_dates>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.no_dates)), input_name='no_dates'), namespace_)) - if self.no_versions is not None: - showIndent(outfile, level) - outfile.write('<%sno_versions>%s</%sno_versions>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.no_versions)), input_name='no_versions'), namespace_)) - if self.no_process_includes is not None: - showIndent(outfile, level) - outfile.write('<%sno_process_includes>%s</%sno_process_includes>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.no_process_includes)), input_name='no_process_includes'), namespace_)) - if self.silence is not None: - showIndent(outfile, level) - outfile.write('<%ssilence>%s</%ssilence>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.silence)), input_name='silence'), namespace_)) - if self.namespace_defs is not None: - showIndent(outfile, level) - outfile.write('<%snamespace_defs>%s</%snamespace_defs>\n' % (namespace_, self.gds_format_string(quote_xml(self.namespace_defs).encode(ExternalEncoding), input_name='namespace_defs'), namespace_)) - if self.external_encoding is not None: - showIndent(outfile, level) - outfile.write('<%sexternal_encoding>%s</%sexternal_encoding>\n' % (namespace_, self.gds_format_string(quote_xml(self.external_encoding).encode(ExternalEncoding), input_name='external_encoding'), namespace_)) - if self.member_specs is not None: - showIndent(outfile, level) - outfile.write('<%smember_specs>%s</%smember_specs>\n' % (namespace_, self.gds_format_string(quote_xml(self.member_specs).encode(ExternalEncoding), input_name='member_specs'), namespace_)) - def hasContent_(self): - if ( - self.input_schema is not None or - self.output_superclass is not None or - self.output_subclass is not None or - self.force is not None or - self.prefix is not None or - self.namespace_prefix is not None or - self.empty_namespace_prefix is not None or - self.behavior_filename is not None or - self.properties is not None or - self.subclass_suffix is not None or - self.root_element is not None or - self.superclass_module is not None or - self.auto_super is not None or - self.old_getters_setters is not None or - self.validator_bodies is not None or - self.user_methods is not None or - self.no_dates is not None or - self.no_versions is not None or - self.no_process_includes is not None or - self.silence is not None or - self.namespace_defs is not None or - self.external_encoding is not None or - self.member_specs is not None - ): - return True - else: - return False - def exportLiteral(self, outfile, level, name_='sessionType'): - level += 1 - self.exportLiteralAttributes(outfile, level, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.input_schema is not None: - showIndent(outfile, level) - outfile.write('input_schema=%s,\n' % quote_python(self.input_schema).encode(ExternalEncoding)) - if self.output_superclass is not None: - showIndent(outfile, level) - outfile.write('output_superclass=%s,\n' % quote_python(self.output_superclass).encode(ExternalEncoding)) - if self.output_subclass is not None: - showIndent(outfile, level) - outfile.write('output_subclass=%s,\n' % quote_python(self.output_subclass).encode(ExternalEncoding)) - if self.force is not None: - showIndent(outfile, level) - outfile.write('force=%s,\n' % self.force) - if self.prefix is not None: - showIndent(outfile, level) - outfile.write('prefix=%s,\n' % quote_python(self.prefix).encode(ExternalEncoding)) - if self.namespace_prefix is not None: - showIndent(outfile, level) - outfile.write('namespace_prefix=%s,\n' % quote_python(self.namespace_prefix).encode(ExternalEncoding)) - if self.empty_namespace_prefix is not None: - showIndent(outfile, level) - outfile.write('empty_namespace_prefix=%s,\n' % self.empty_namespace_prefix) - if self.behavior_filename is not None: - showIndent(outfile, level) - outfile.write('behavior_filename=%s,\n' % quote_python(self.behavior_filename).encode(ExternalEncoding)) - if self.properties is not None: - showIndent(outfile, level) - outfile.write('properties=%s,\n' % self.properties) - if self.subclass_suffix is not None: - showIndent(outfile, level) - outfile.write('subclass_suffix=%s,\n' % quote_python(self.subclass_suffix).encode(ExternalEncoding)) - if self.root_element is not None: - showIndent(outfile, level) - outfile.write('root_element=%s,\n' % quote_python(self.root_element).encode(ExternalEncoding)) - if self.superclass_module is not None: - showIndent(outfile, level) - outfile.write('superclass_module=%s,\n' % quote_python(self.superclass_module).encode(ExternalEncoding)) - if self.auto_super is not None: - showIndent(outfile, level) - outfile.write('auto_super=%s,\n' % self.auto_super) - if self.old_getters_setters is not None: - showIndent(outfile, level) - outfile.write('old_getters_setters=%s,\n' % self.old_getters_setters) - if self.validator_bodies is not None: - showIndent(outfile, level) - outfile.write('validator_bodies=%s,\n' % quote_python(self.validator_bodies).encode(ExternalEncoding)) - if self.user_methods is not None: - showIndent(outfile, level) - outfile.write('user_methods=%s,\n' % quote_python(self.user_methods).encode(ExternalEncoding)) - if self.no_dates is not None: - showIndent(outfile, level) - outfile.write('no_dates=%s,\n' % self.no_dates) - if self.no_versions is not None: - showIndent(outfile, level) - outfile.write('no_versions=%s,\n' % self.no_versions) - if self.no_process_includes is not None: - showIndent(outfile, level) - outfile.write('no_process_includes=%s,\n' % self.no_process_includes) - if self.silence is not None: - showIndent(outfile, level) - outfile.write('silence=%s,\n' % self.silence) - if self.namespace_defs is not None: - showIndent(outfile, level) - outfile.write('namespace_defs=%s,\n' % quote_python(self.namespace_defs).encode(ExternalEncoding)) - if self.external_encoding is not None: - showIndent(outfile, level) - outfile.write('external_encoding=%s,\n' % quote_python(self.external_encoding).encode(ExternalEncoding)) - if self.member_specs is not None: - showIndent(outfile, level) - outfile.write('member_specs=%s,\n' % quote_python(self.member_specs).encode(ExternalEncoding)) - def build(self, node): - self.buildAttributes(node, node.attrib, []) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, nodeName_) - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, nodeName_, from_subclass=False): - if nodeName_ == 'input_schema': - input_schema_ = child_.text - self.input_schema = input_schema_ - elif nodeName_ == 'output_superclass': - output_superclass_ = child_.text - self.output_superclass = output_superclass_ - elif nodeName_ == 'output_subclass': - output_subclass_ = child_.text - self.output_subclass = output_subclass_ - elif nodeName_ == 'force': - sval_ = child_.text - if sval_ in ('true', '1'): - ival_ = True - elif sval_ in ('false', '0'): - ival_ = False - else: - raise_parse_error(child_, 'requires boolean') - self.force = ival_ - elif nodeName_ == 'prefix': - prefix_ = child_.text - self.prefix = prefix_ - elif nodeName_ == 'namespace_prefix': - namespace_prefix_ = child_.text - self.namespace_prefix = namespace_prefix_ - elif nodeName_ == 'empty_namespace_prefix': - sval_ = child_.text - if sval_ in ('true', '1'): - ival_ = True - elif sval_ in ('false', '0'): - ival_ = False - else: - raise_parse_error(child_, 'requires boolean') - self.empty_namespace_prefix = ival_ - elif nodeName_ == 'behavior_filename': - behavior_filename_ = child_.text - self.behavior_filename = behavior_filename_ - elif nodeName_ == 'properties': - sval_ = child_.text - if sval_ in ('true', '1'): - ival_ = True - elif sval_ in ('false', '0'): - ival_ = False - else: - raise_parse_error(child_, 'requires boolean') - self.properties = ival_ - elif nodeName_ == 'subclass_suffix': - subclass_suffix_ = child_.text - self.subclass_suffix = subclass_suffix_ - elif nodeName_ == 'root_element': - root_element_ = child_.text - self.root_element = root_element_ - elif nodeName_ == 'superclass_module': - superclass_module_ = child_.text - self.superclass_module = superclass_module_ - elif nodeName_ == 'auto_super': - sval_ = child_.text - if sval_ in ('true', '1'): - ival_ = True - elif sval_ in ('false', '0'): - ival_ = False - else: - raise_parse_error(child_, 'requires boolean') - self.auto_super = ival_ - elif nodeName_ == 'old_getters_setters': - sval_ = child_.text - if sval_ in ('true', '1'): - ival_ = True - elif sval_ in ('false', '0'): - ival_ = False - else: - raise_parse_error(child_, 'requires boolean') - self.old_getters_setters = ival_ - elif nodeName_ == 'validator_bodies': - validator_bodies_ = child_.text - self.validator_bodies = validator_bodies_ - elif nodeName_ == 'user_methods': - user_methods_ = child_.text - self.user_methods = user_methods_ - elif nodeName_ == 'no_dates': - sval_ = child_.text - if sval_ in ('true', '1'): - ival_ = True - elif sval_ in ('false', '0'): - ival_ = False - else: - raise_parse_error(child_, 'requires boolean') - self.no_dates = ival_ - elif nodeName_ == 'no_versions': - sval_ = child_.text - if sval_ in ('true', '1'): - ival_ = True - elif sval_ in ('false', '0'): - ival_ = False - else: - raise_parse_error(child_, 'requires boolean') - self.no_versions = ival_ - elif nodeName_ == 'no_process_includes': - sval_ = child_.text - if sval_ in ('true', '1'): - ival_ = True - elif sval_ in ('false', '0'): - ival_ = False - else: - raise_parse_error(child_, 'requires boolean') - self.no_process_includes = ival_ - elif nodeName_ == 'silence': - sval_ = child_.text - if sval_ in ('true', '1'): - ival_ = True - elif sval_ in ('false', '0'): - ival_ = False - else: - raise_parse_error(child_, 'requires boolean') - self.silence = ival_ - elif nodeName_ == 'namespace_defs': - namespace_defs_ = child_.text - self.namespace_defs = namespace_defs_ - elif nodeName_ == 'external_encoding': - external_encoding_ = child_.text - self.external_encoding = external_encoding_ - elif nodeName_ == 'member_specs': - member_specs_ = child_.text - self.member_specs = member_specs_ -# end class sessionType - - -USAGE_TEXT = """ -Usage: python <Parser>.py [ -s ] <in_xml_file> -""" - -def usage(): - print(USAGE_TEXT) - sys.exit(1) - - -def get_root_tag(node): - tag = Tag_pattern_.match(node.tag).groups()[-1] - rootClass = globals().get(tag) - return tag, rootClass - - -def parse(inFileName): - doc = parsexml_(inFileName) - rootNode = doc.getroot() - rootTag, rootClass = get_root_tag(rootNode) - if rootClass is None: - rootTag = 'session' - rootClass = sessionType - rootObj = rootClass.factory() - rootObj.build(rootNode) - # Enable Python to collect the space used by the DOM. - doc = None - sys.stdout.write('<?xml version="1.0" ?>\n') - rootObj.export(sys.stdout, 0, name_=rootTag, - namespacedef_='') - return rootObj - - -def parseString(inString): - from io import StringIO - doc = parsexml_(StringIO(inString)) - rootNode = doc.getroot() - rootTag, rootClass = get_root_tag(rootNode) - if rootClass is None: - rootTag = 'session' - rootClass = sessionType - rootObj = rootClass.factory() - rootObj.build(rootNode) - # Enable Python to collect the space used by the DOM. - doc = None - sys.stdout.write('<?xml version="1.0" ?>\n') - rootObj.export(sys.stdout, 0, name_="session", - namespacedef_='') - return rootObj - - -def parseLiteral(inFileName): - doc = parsexml_(inFileName) - rootNode = doc.getroot() - rootTag, rootClass = get_root_tag(rootNode) - if rootClass is None: - rootTag = 'session' - rootClass = sessionType - rootObj = rootClass.factory() - rootObj.build(rootNode) - # Enable Python to collect the space used by the DOM. - doc = None - sys.stdout.write('#from generateds_gui_session import *\n\n') - sys.stdout.write('import generateds_gui_session as model_\n\n') - sys.stdout.write('rootObj = model_.rootTag(\n') - rootObj.exportLiteral(sys.stdout, 0, name_=rootTag) - sys.stdout.write(')\n') - return rootObj - - -def main(): - args = sys.argv[1:] - if len(args) == 1: - parse(args[0]) - else: - usage() - - -if __name__ == '__main__': - #import pdb; pdb.set_trace() - main() - - -__all__ = [ - "sessionType" - ] diff --git a/libgenerateDS/gui/generateds_gui_session.py b/libgenerateDS/gui/generateds_gui_session.py new file mode 120000 index 0000000000000000000000000000000000000000..15763a3c8c258792483ecd124f732d3556b243e2 --- /dev/null +++ b/libgenerateDS/gui/generateds_gui_session.py @@ -0,0 +1 @@ +../../gui/generateds_gui_session.py \ No newline at end of file