Esempio n. 1
0
    def __init__(self,
                 parent,
                 donnees=[],
                 nbreLignesDescription=1,
                 wrap=False,
                 hauteur=None,
                 style=wx.CB_READONLY):
        self.donnees = donnees
        self.nbreLignesDescription = nbreLignesDescription
        if hauteur == None:
            self.hauteurItem = 33 + (self.nbreLignesDescription * 14)
        else:
            self.hauteurItem = hauteur
        self.wrap = wrap
        self.selection = None

        # Init du contrôle
        listeLabels = []
        for donnee in self.donnees:
            listeLabels.append(donnee["label"])

        OwnerDrawnComboBox.__init__(self,
                                    parent,
                                    -1,
                                    choices=listeLabels,
                                    size=(-1, self.hauteurItem),
                                    style=style)

        self.Bind(wx.EVT_COMBOBOX, self.OnSelection)
Esempio n. 2
0
    def __init__(self, *args, **kwargs):
        """
        Initialize a font face combobox.

        In addition to the public attributes describes as public attributes,
        the constructor understands the following parameters:

        extendedText
            This string will be added to the face name to give an indication
            of how the font appears. Typically a panagram.
        """
        self.fontHeight = kwargs.pop("fontHeight", 18)
        self.maximumPopupWidth = kwargs.pop("maximumPopupWidth", 400)
        self.evenRowBackground = kwargs.pop("evenRowBackground", wx.WHITE)
        self.oddRowBackground = kwargs.pop("oddRowBackground", wx.Colour(191, 239, 255))
        extendedText = kwargs.pop("extendedText", " - Big fjords vex quick waltz nymph")

        # Build the data behind the control
        fe = wx.FontEnumerator()
        fe.EnumerateFacenames()
        self.fontInfo = [ Bucket(name=x, display=x+extendedText) for x in sorted(fe.GetFacenames(), key=unicode.lower) ]

        kwargs['style'] = kwargs.get("style", 0) | wx.CB_READONLY
        kwargs["choices"] = [x.name for x in self.fontInfo]
        OwnerDrawnComboBox.__init__(self, *args, **kwargs)

        # Fill in some other information that is better to precalculate.
        # Measuring text has to be done after the control is initialized
        measuringDC = wx.ClientDC(self)
        for x in self.fontInfo:
            if 'phoenix' in wx.PlatformInfo:
                x.font = wx.FFont(self.fontHeight, wx.FONTFAMILY_DEFAULT, faceName=x.name)
            else:
                x.font = wx.FFont(self.fontHeight, wx.FONTFAMILY_DEFAULT, face=x.name)
            x.extent = measuringDC.GetFullTextExtent(x.display, font=x.font)
Esempio n. 3
0
 def __init__(self, parent, id=-1, **kwargs):
     if kwargs.get('choices', None) is None:
         choices = db.get_linkable_tables()
         choices += [TableComboBox.OTHER_TABLE]
     else:
         choices = kwargs['choices']
     ComboBox.__init__(self, parent, id, choices=choices, **kwargs)
     if p.image_table:
         self.SetStringSelection(p.image_table)
     else:
         self.Select(0)
Esempio n. 4
0
    def __init__(self, *args, **kwargs):
        self.popupRowHeight = kwargs.pop("popupRowHeight", 24)

        # Collect the colours with different values
        self.colourList = []
        lastColour = None
        for x in wx.lib.colourdb.getColourInfoList():
            colour = x[1:]
            if colour != lastColour:
                self.colourList.append(Bucket(name=x[0], colour=wx.Colour(*colour), intensity=sum(colour)))
                lastColour = colour

        kwargs['style'] = kwargs.get('style', 0) | wx.CB_READONLY
        kwargs['choices'] = [x.name for x in self.colourList]
        OwnerDrawnComboBox.__init__(self, *args, **kwargs)
Esempio n. 5
0
    def __init__(self, parent, donnees=[], nbreLignesDescription=1, wrap=False, hauteur=None, style=wx.CB_READONLY) :
        self.donnees = donnees
        self.nbreLignesDescription = nbreLignesDescription
        if hauteur == None :
            self.hauteurItem = 33 + (self.nbreLignesDescription*14)
        else :
            self.hauteurItem = hauteur
        self.wrap = wrap
        self.selection = None
            
        # Init du contrôle
        listeLabels = []
        for donnee in self.donnees :
            listeLabels.append(donnee["label"])

        OwnerDrawnComboBox.__init__(self, parent, -1, choices=listeLabels, size=(-1, self.hauteurItem), style=style)

        self.Bind(wx.EVT_COMBOBOX, self.OnSelection)
Esempio n. 6
0
 def __init__(self, *args, **kwargs):
     OwnerDrawnComboBox_.__init__(self, *args, **kwargs)