wxPython/wxGlade-0.9.1/codegen/__init__.py
def _add_object_init(self, sub_obj):
        """Perform some initial actions for L{add_object()}
        
        Widgets without code generator or widget that are not supporting the
        requested wx version are blacklisted at L{blacklisted_widgets}.

        @return: Top level source code object and the widget builder instance or C{None, None} in case of errors."""
        # initialise internal variables first
        klass = None
        builder = None

        # Check for proper source code instance
        top_obj = self.toplevel
        if top_obj.klass in self.classes:
            klass = self.classes[top_obj.klass]
        else:
            klass = self.classes[top_obj.klass] = self.ClassLines()

        # Check for widget builder object
        try:
            builder = self.obj_builders[sub_obj.base]
        except KeyError:
            # no code generator found: write a comment about it
            name = getattr(sub_obj, "name", "None")
            name = self._format_name(name)
            msg = _('Code for instance "%s" of "%s" not generated: no suitable writer found') % (name, sub_obj.klass )
            self._source_warning(klass, msg, sub_obj)
            self.warning(msg)
            # ignore widget later too
            self.blacklisted_widgets[sub_obj] = 1
            return None, None

        # check for supported versions
        if hasattr(builder, 'is_widget_supported'):
            is_supported = builder.is_widget_supported(*self.for_version)
        else:
            is_supported = True
        if not is_supported:
            supported_versions = [misc.format_supported_by(version) for version in builder.config['supported_by']]
            msg = _('Code for instance "%(name)s" of "%(klass)s" was\n'
                    'not created, because the widget is not available for wx version %(requested_version)s.\n'
                    'It is available for wx versions %(supported_versions)s only.') % {
                        'name':  self._format_name(sub_obj.name), 'klass': sub_obj.klass,
                        'requested_version':  str(misc.format_for_version(self.for_version)),
                        'supported_versions': ', '.join(supported_versions) }
            self._source_warning(klass, msg, sub_obj)
            self.warning(msg)
            # ignore widget later too
            self.blacklisted_widgets[sub_obj] = 1
            return None, None

        return klass, builder
Perform some initial actions for L{add_object()}
        
        Widgets without code generator or widget that are not supporting the
        requested wx version are blacklisted at L{blacklisted_widgets}.

        @return: Top level source code object and the widget builder instance or C{None, None} in case of errors.
Perform some initial actions for L{add_object()}
Widgets without code generator or widget that are not supporting the
requested wx version are blacklisted at L{blacklisted_widgets}.
Perform some initial actions for L { add_object () } Widgets without code generator or widget that are not supporting the requested wx version are blacklisted at L { blacklisted_widgets } .
def _add_object_init(self, sub_obj):
        klass = None
        builder = None
        top_obj = self.toplevel
        if top_obj.klass in self.classes:
            klass = self.classes[top_obj.klass]
        else:
            klass = self.classes[top_obj.klass] = self.ClassLines()
        try:
            builder = self.obj_builders[sub_obj.base]
        except KeyError:
            name = getattr(sub_obj, "name", "None")
            name = self._format_name(name)
            msg = _('Code for instance "%s" of "%s" not generated: no suitable writer found') % (name, sub_obj.klass )
            self._source_warning(klass, msg, sub_obj)
            self.warning(msg)
            self.blacklisted_widgets[sub_obj] = 1
            return None, None
        if hasattr(builder, 'is_widget_supported'):
            is_supported = builder.is_widget_supported(*self.for_version)
        else:
            is_supported = True
        if not is_supported:
            supported_versions = [misc.format_supported_by(version) for version in builder.config['supported_by']]
            msg = _('Code for instance "%(name)s" of "%(klass)s" was\n'
                    'not created, because the widget is not available for wx version %(requested_version)s.\n'
                    'It is available for wx versions %(supported_versions)s only.') % {
                        'name':  self._format_name(sub_obj.name), 'klass': sub_obj.klass,
                        'requested_version':  str(misc.format_for_version(self.for_version)),
                        'supported_versions': ', '.join(supported_versions) }
            self._source_warning(klass, msg, sub_obj)
            self.warning(msg)
            self.blacklisted_widgets[sub_obj] = 1
            return None, None
        return klass, builder
def _add_object_init ( self , sub_obj ) : klass = None builder = None top_obj = self . toplevel if top_obj . klass in self . classes : klass = self . classes [ top_obj . klass ] else : klass = self . classes [ top_obj . klass ] = self . ClassLines ( ) try : builder = self . obj_builders [ sub_obj . base ] except KeyError : name = getattr ( sub_obj , "name" , "None" ) name = self . _format_name ( name ) msg = _ ( 'Code for instance "%s" of "%s" not generated: no suitable writer found' ) % ( name , sub_obj . klass ) self . _source_warning ( klass , msg , sub_obj ) self . warning ( msg ) self . blacklisted_widgets [ sub_obj ] = 1 return None , None if hasattr ( builder , 'is_widget_supported' ) : is_supported = builder . is_widget_supported ( * self . for_version ) else : is_supported = True if not is_supported : supported_versions = [ misc . format_supported_by ( version ) for version in builder . config [ 'supported_by' ] ] msg = _ ( 'Code for instance "%(name)s" of "%(klass)s" was\n' 'not created, because the widget is not available for wx version %(requested_version)s.\n' 'It is available for wx versions %(supported_versions)s only.' ) % { 'name' : self . _format_name ( sub_obj . name ) , 'klass' : sub_obj . klass , 'requested_version' : str ( misc . format_for_version ( self . for_version ) ) , 'supported_versions' : ', ' . join ( supported_versions ) } self . _source_warning ( klass , msg , sub_obj ) self . warning ( msg ) self . blacklisted_widgets [ sub_obj ] = 1 return None , None return klass , builder
Perform some initial actions for L{add_object()}
Widgets without code generator or widget that are not supporting the
requested wx version are blacklisted at L{blacklisted_widgets}.
Perform some initial actions for L { add_object () } Widgets without code generator or widget that are not supporting the requested wx version are blacklisted at L { blacklisted_widgets } .
"""Perform some initial actions for L{add_object()}
        
        Widgets without code generator or widget that are not supporting the
        requested wx version are blacklisted at L{blacklisted_widgets}.

        @return: Top level source code object and the widget builder instance or C{None, None} in case of errors.""" # initialise internal variables first # Check for proper source code instance # Check for widget builder object # no code generator found: write a comment about it # ignore widget later too # check for supported versions # ignore widget later too
Top level source code object and the widget builder instance or C{None, None} in case of errors.
Top level source code object and the widget builder instance or C { None None } in case of errors .
self
sub_obj