wxPython/wxGlade-0.9.1/wcodegen/__init__.py
def _prepare_bitmaps(self, obj):
        "Prepare content for widgets with bitmaps"

        need_artprovider = have_constructor_argument = False
        for p_name in obj.property_names:
            p = obj.properties[p_name]
            if not isinstance(p, np.BitmapProperty): continue
            value = p.get_value()
            if value.startswith('art:'): need_artprovider = True
            if '%%(%s)s'%p_name in self.tmpl:
                # constructor argument
                self.tmpl_dict[p_name] = self.generate_code_bitmap(value)
                have_constructor_argument = True
            elif value and (not p.min_version or self.codegen.for_version>=p.min_version):
                # property to be set after construction, e.g.: ...SetBitmapDisabled(disabled_bitmap)
                self.tmpl_dict[p_name] = self.generate_code_bitmap(value)
                setname = p_name.replace( "_bitmap", "").capitalize()
                if compat.IS_CLASSIC and setname=="Pressed":
                    setname = "Selected"  # probably only wx 2.8
                if setname=="Bitmap": setname = ""
                # build template, e.g. '%(name)s.SetBitmapDisabled(%(disabled_bitmap)s)\n'
                tmpl = self.tmpl2_bitmap_property%(setname, p_name)
                self.tmpl_props.append(tmpl)

        # import artprovider?
        if need_artprovider:
            self.import_modules.append(self.tmpl_import_artprovider)

        # size
        if have_constructor_argument and not obj.check_prop('size') and self.tmpl_SetBestSize:
            self.tmpl_props.append(self.tmpl_SetBestSize)

        # default
        # XXX move this somewhere else?
        # its used by bitmap_button, button, calendar_ctrl, generic_calendar_ctrl
        self.has_setdefault = "default" in obj.properties and obj.default or False
Prepare content for widgets with bitmaps
Prepare content for widgets with bitmaps
Prepare content for widgets with bitmaps
def _prepare_bitmaps(self, obj):
        need_artprovider = have_constructor_argument = False
        for p_name in obj.property_names:
            p = obj.properties[p_name]
            if not isinstance(p, np.BitmapProperty): continue
            value = p.get_value()
            if value.startswith('art:'): need_artprovider = True
            if '%%(%s)s'%p_name in self.tmpl:
                self.tmpl_dict[p_name] = self.generate_code_bitmap(value)
                have_constructor_argument = True
            elif value and (not p.min_version or self.codegen.for_version>=p.min_version):
                self.tmpl_dict[p_name] = self.generate_code_bitmap(value)
                setname = p_name.replace( "_bitmap", "").capitalize()
                if compat.IS_CLASSIC and setname=="Pressed":
                    setname = "Selected"  
                if setname=="Bitmap": setname = ""
                tmpl = self.tmpl2_bitmap_property%(setname, p_name)
                self.tmpl_props.append(tmpl)
        if need_artprovider:
            self.import_modules.append(self.tmpl_import_artprovider)
        if have_constructor_argument and not obj.check_prop('size') and self.tmpl_SetBestSize:
            self.tmpl_props.append(self.tmpl_SetBestSize)
        self.has_setdefault = "default" in obj.properties and obj.default or False
def _prepare_bitmaps ( self , obj ) : need_artprovider = have_constructor_argument = False for p_name in obj . property_names : p = obj . properties [ p_name ] if not isinstance ( p , np . BitmapProperty ) : continue value = p . get_value ( ) if value . startswith ( 'art:' ) : need_artprovider = True if '%%(%s)s' % p_name in self . tmpl : self . tmpl_dict [ p_name ] = self . generate_code_bitmap ( value ) have_constructor_argument = True elif value and ( not p . min_version or self . codegen . for_version >= p . min_version ) : self . tmpl_dict [ p_name ] = self . generate_code_bitmap ( value ) setname = p_name . replace ( "_bitmap" , "" ) . capitalize ( ) if compat . IS_CLASSIC and setname == "Pressed" : setname = "Selected" if setname == "Bitmap" : setname = "" tmpl = self . tmpl2_bitmap_property % ( setname , p_name ) self . tmpl_props . append ( tmpl ) if need_artprovider : self . import_modules . append ( self . tmpl_import_artprovider ) if have_constructor_argument and not obj . check_prop ( 'size' ) and self . tmpl_SetBestSize : self . tmpl_props . append ( self . tmpl_SetBestSize ) self . has_setdefault = "default" in obj . properties and obj . default or False
Prepare content for widgets with bitmaps
Prepare content for widgets with bitmaps
"Prepare content for widgets with bitmaps" # constructor argument # property to be set after construction, e.g.: ...SetBitmapDisabled(disabled_bitmap) # probably only wx 2.8 # build template, e.g. '%(name)s.SetBitmapDisabled(%(disabled_bitmap)s)\n' # import artprovider? # size # default # XXX move this somewhere else? # its used by bitmap_button, button, calendar_ctrl, generic_calendar_ctrl
self
obj