Beispiel #1
0
    def _create_image_grid(self, parent):
        """ Populates a specified window with a grid of image buttons.
        """
        # Create the panel to hold the ImageControl buttons:
        self.control = panel = TraitsUIPanel(parent, -1)

        # Create the main sizer:
        if self.factory.cols > 1:
            sizer = wx.GridSizer(0, self.factory.cols, 0, 0)
        else:
            sizer = wx.BoxSizer(wx.VERTICAL)

        # Add the set of all possible choices:
        factory = self.factory
        mapping = factory._mapping
        cur_value = self.value
        for name in self.factory._names:
            value = mapping[name]
            control = ImageControl(
                panel,
                bitmap_cache('%s%s%s' % (factory.prefix, name, factory.suffix),
                             False, factory._image_path), value == cur_value,
                self.update_object)
            control.value = value
            sizer.Add(control, 0, wx.ALL, 2)
            self.set_tooltip(control)

        # Finish setting up the control layout:
        panel.SetSizerAndFit(sizer)
Beispiel #2
0
    def _create_image_grid ( self, parent ):
        """ Populates a specified window with a grid of image buttons.
        """
        # Create the panel to hold the ImageControl buttons:
        self.control = panel = TraitsUIPanel( parent, -1 )

        # Create the main sizer:
        if self.factory.cols > 1:
           sizer = wx.GridSizer( 0, self.factory.cols, 0, 0 )
        else:
           sizer = wx.BoxSizer( wx.VERTICAL )

        # Add the set of all possible choices:
        factory   = self.factory
        mapping   = factory._mapping
        cur_value = self.value
        for name in self.factory._names:
            value   = mapping[ name ]
            control = ImageControl( panel,
                          bitmap_cache( '%s%s%s' % ( factory.prefix, name,
                              factory.suffix ), False, factory._image_path ),
                          value == cur_value,
                          self.update_object )
            control.value = value
            sizer.Add( control, 0, wx.ALL, 2 )
            self.set_tooltip( control )

        # Finish setting up the control layout:
        panel.SetSizerAndFit( sizer )
Beispiel #3
0
    def _create_image_grid ( self, parent ):
        """ Populates a specified window with a grid of image buttons.
        """
        # Create the panel to hold the ImageControl buttons:
        self.control = panel = wx.Panel( parent, -1 )
        
        # Create the main sizer:
        if self.factory.cols > 1:
           sizer = wx.GridSizer( 0, self.factory.cols, 0, 0 )
        else:
           sizer = wx.BoxSizer( wx.VERTICAL )
        
        # Add the set of all possible choices:
        cur_value = self.str_value
        for value in self.factory._names:
            control = ImageControl( panel, 
                          bitmap_cache( value + self.factory.suffix, False, 
                                        self.factory._image_path ),
                          value == cur_value, 
                          self.update_object )
            control.value = value
            sizer.Add( control, 0, wx.ALL, 2 )
            self.set_tooltip( control )
 
        # Finish setting up the control layout:
        panel.SetAutoLayout( True )
        panel.SetSizer( sizer )
        sizer.Fit( panel )
    def _create_image_grid(self, parent):
        """ Populates a specified window with a grid of image buttons.
        """
        # Create the panel to hold the ImageControl buttons:
        self.control = panel = wx.Panel(parent, -1)

        # Create the main sizer:
        if self.factory.cols > 1:
            sizer = wx.GridSizer(0, self.factory.cols, 0, 0)
        else:
            sizer = wx.BoxSizer(wx.VERTICAL)

        # Add the set of all possible choices:
        cur_value = self.str_value
        for value in self.factory._names:
            control = ImageControl(
                panel,
                bitmap_cache(value + self.factory.suffix, False,
                             self.factory._image_path), value == cur_value,
                self.update_object)
            control.value = value
            sizer.Add(control, 0, wx.ALL, 2)
            self.set_tooltip(control)

        # Finish setting up the control layout:
        panel.SetAutoLayout(True)
        panel.SetSizer(sizer)
        sizer.Fit(panel)