wxPython/wxGlade-0.9.1/xml_parse.py
def _process_app_attrs(self, attrs):
        "Process attributes of the application tag; Check only existence of attributes not the logical correctness"
        res = {}

        res['encoding'] = self._get_encoding(attrs)

        for_version = attrs.get('for_version', '%s.%s' % config.for_version)
        for_version_tuple = tuple([int(t) for t in for_version.split('.')[:2]])
        if for_version_tuple < (2, 8):
            logging.warning( _('The loaded wxGlade designs are created for wxWidgets "%s", '
                               'but this version is not supported anymore.'),
                             for_version )
            logging.warning( _('The designs will be loaded and converted to wxWidgets "%s" partially. '
                               'Please check the designs carefully.'),
                            '%s.%s' % config.for_version )
            for_version = '%s.%s' % config.for_version
        res['for_version'] = for_version

        try:
            is_template = int(attrs['is_template'])
        except (KeyError, ValueError):
            is_template = False
        res['is_template'] = is_template

        res['class'] = attrs.get('class')

        try:
            indent_amount = int(attrs['indent_amount'])
        except (KeyError, ValueError):
            indent_amount = config.default_indent_amount
        res['indent_amount'] = indent_amount

        res['indent_symbol'] = attrs.get('indent_symbol', {" ":"space","\t":":tab"}[config.default_indent_symbol])

        if 'language' in attrs:
            res['language'] = attrs['language']
        elif hasattr(self, 'code_writer'):
            res['language'] = attrs.get('language', self.code_writer.language)
        else:
            res['language'] = config.default_language

        res['name'] = attrs.get('name')

        try:
            multiple_files = bool(int(attrs['option']))
        except (KeyError, ValueError):
            multiple_files = config.default_multiple_files
        res['option'] = multiple_files

        try:
            overwrite = int(attrs['overwrite'])
        except (KeyError, ValueError):
            overwrite = config.default_overwrite
        res['overwrite'] = bool(overwrite)

        try:
            mark_blocks = int(attrs['mark_blocks'])
        except (KeyError, ValueError):
            mark_blocks = True # config.mark_blocks
        if not overwrite and not mark_blocks:
            mark_blocks = True
        res['mark_blocks'] = bool(mark_blocks)


        res['path'] = attrs.get('path')

        res['header_extension'] = attrs.get('header_extension', config.default_header_extension)
        res['source_extension'] = attrs.get('source_extension', config.default_source_extension)

        res['top_window'] = attrs.get('top_window')

        try:
            use_gettext = int(attrs["use_gettext"])
        except (KeyError, ValueError):
            use_gettext = config.default_use_gettext
        res['use_gettext'] = bool(use_gettext)

        if attrs.get('use_new_namespace') == u'0' and attrs.get('language') == 'python':
            logging.warning( _('The loaded wxGlade designs are created to use the old Python import style '
                               '("from wxPython.wx import *)". The old import style is not supported anymore.') )
            logging.warning( _('The designs will be loaded and the import style will be converted to new style imports '
                               '("import wx"). Please check your design carefully.') )
            # no update necessary - the attribute will not be used anymore
        return res
Process attributes of the application tag; Check only existence of attributes not the logical correctness
Process attributes of the application tag; Check only existence of attributes not the logical correctness
Process attributes of the application tag ; Check only existence of attributes not the logical correctness
def _process_app_attrs(self, attrs):
        res = {}
        res['encoding'] = self._get_encoding(attrs)
        for_version = attrs.get('for_version', '%s.%s' % config.for_version)
        for_version_tuple = tuple([int(t) for t in for_version.split('.')[:2]])
        if for_version_tuple < (2, 8):
            logging.warning( _('The loaded wxGlade designs are created for wxWidgets "%s", '
                               'but this version is not supported anymore.'),
                             for_version )
            logging.warning( _('The designs will be loaded and converted to wxWidgets "%s" partially. '
                               'Please check the designs carefully.'),
                            '%s.%s' % config.for_version )
            for_version = '%s.%s' % config.for_version
        res['for_version'] = for_version
        try:
            is_template = int(attrs['is_template'])
        except (KeyError, ValueError):
            is_template = False
        res['is_template'] = is_template
        res['class'] = attrs.get('class')
        try:
            indent_amount = int(attrs['indent_amount'])
        except (KeyError, ValueError):
            indent_amount = config.default_indent_amount
        res['indent_amount'] = indent_amount
        res['indent_symbol'] = attrs.get('indent_symbol', {" ":"space","\t":":tab"}[config.default_indent_symbol])
        if 'language' in attrs:
            res['language'] = attrs['language']
        elif hasattr(self, 'code_writer'):
            res['language'] = attrs.get('language', self.code_writer.language)
        else:
            res['language'] = config.default_language
        res['name'] = attrs.get('name')
        try:
            multiple_files = bool(int(attrs['option']))
        except (KeyError, ValueError):
            multiple_files = config.default_multiple_files
        res['option'] = multiple_files
        try:
            overwrite = int(attrs['overwrite'])
        except (KeyError, ValueError):
            overwrite = config.default_overwrite
        res['overwrite'] = bool(overwrite)
        try:
            mark_blocks = int(attrs['mark_blocks'])
        except (KeyError, ValueError):
            mark_blocks = True 
        if not overwrite and not mark_blocks:
            mark_blocks = True
        res['mark_blocks'] = bool(mark_blocks)
        res['path'] = attrs.get('path')
        res['header_extension'] = attrs.get('header_extension', config.default_header_extension)
        res['source_extension'] = attrs.get('source_extension', config.default_source_extension)
        res['top_window'] = attrs.get('top_window')
        try:
            use_gettext = int(attrs["use_gettext"])
        except (KeyError, ValueError):
            use_gettext = config.default_use_gettext
        res['use_gettext'] = bool(use_gettext)
        if attrs.get('use_new_namespace') == u'0' and attrs.get('language') == 'python':
            logging.warning( _('The loaded wxGlade designs are created to use the old Python import style '
                               '("from wxPython.wx import *)". The old import style is not supported anymore.') )
            logging.warning( _('The designs will be loaded and the import style will be converted to new style imports '
                               '("import wx"). Please check your design carefully.') )
        return res
def _process_app_attrs ( self , attrs ) : res = { } res [ 'encoding' ] = self . _get_encoding ( attrs ) for_version = attrs . get ( 'for_version' , '%s.%s' % config . for_version ) for_version_tuple = tuple ( [ int ( t ) for t in for_version . split ( '.' ) [ : 2 ] ] ) if for_version_tuple < ( 2 , 8 ) : logging . warning ( _ ( 'The loaded wxGlade designs are created for wxWidgets "%s", ' 'but this version is not supported anymore.' ) , for_version ) logging . warning ( _ ( 'The designs will be loaded and converted to wxWidgets "%s" partially. ' 'Please check the designs carefully.' ) , '%s.%s' % config . for_version ) for_version = '%s.%s' % config . for_version res [ 'for_version' ] = for_version try : is_template = int ( attrs [ 'is_template' ] ) except ( KeyError , ValueError ) : is_template = False res [ 'is_template' ] = is_template res [ 'class' ] = attrs . get ( 'class' ) try : indent_amount = int ( attrs [ 'indent_amount' ] ) except ( KeyError , ValueError ) : indent_amount = config . default_indent_amount res [ 'indent_amount' ] = indent_amount res [ 'indent_symbol' ] = attrs . get ( 'indent_symbol' , { " " : "space" , "\t" : ":tab" } [ config . default_indent_symbol ] ) if 'language' in attrs : res [ 'language' ] = attrs [ 'language' ] elif hasattr ( self , 'code_writer' ) : res [ 'language' ] = attrs . get ( 'language' , self . code_writer . language ) else : res [ 'language' ] = config . default_language res [ 'name' ] = attrs . get ( 'name' ) try : multiple_files = bool ( int ( attrs [ 'option' ] ) ) except ( KeyError , ValueError ) : multiple_files = config . default_multiple_files res [ 'option' ] = multiple_files try : overwrite = int ( attrs [ 'overwrite' ] ) except ( KeyError , ValueError ) : overwrite = config . default_overwrite res [ 'overwrite' ] = bool ( overwrite ) try : mark_blocks = int ( attrs [ 'mark_blocks' ] ) except ( KeyError , ValueError ) : mark_blocks = True if not overwrite and not mark_blocks : mark_blocks = True res [ 'mark_blocks' ] = bool ( mark_blocks ) res [ 'path' ] = attrs . get ( 'path' ) res [ 'header_extension' ] = attrs . get ( 'header_extension' , config . default_header_extension ) res [ 'source_extension' ] = attrs . get ( 'source_extension' , config . default_source_extension ) res [ 'top_window' ] = attrs . get ( 'top_window' ) try : use_gettext = int ( attrs [ "use_gettext" ] ) except ( KeyError , ValueError ) : use_gettext = config . default_use_gettext res [ 'use_gettext' ] = bool ( use_gettext ) if attrs . get ( 'use_new_namespace' ) == u'0' and attrs . get ( 'language' ) == 'python' : logging . warning ( _ ( 'The loaded wxGlade designs are created to use the old Python import style ' '("from wxPython.wx import *)". The old import style is not supported anymore.' ) ) logging . warning ( _ ( 'The designs will be loaded and the import style will be converted to new style imports ' '("import wx"). Please check your design carefully.' ) ) return res
Process attributes of the application tag; Check only existence of attributes not the logical correctness
Process attributes of the application tag ; Check only existence of attributes not the logical correctness
"Process attributes of the application tag; Check only existence of attributes not the logical correctness" # config.mark_blocks # no update necessary - the attribute will not be used anymore
self
attrs