Exemplo n.º 1
0
 def _createFontPicker(self, currentFont, currentColor):
     defaultFont = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT)
     picker = widgets.FontPickerCtrl(self,
                                     font=currentFont or defaultFont,
                                     colour=currentColor)
     picker.Bind(wx.EVT_FONTPICKER_CHANGED, self.onFontPicked)
     return picker
Exemplo n.º 2
0
    def addAppearanceSetting(self, fgColorSection, fgColorSetting,
                             bgColorSection, bgColorSetting, fontSection,
                             fontSetting, iconSection, iconSetting, text):
        currentFgColor = self.getvalue(fgColorSection, fgColorSetting)
        fgColorButton = wx.ColourPickerCtrl(self, col=currentFgColor)
        currentBgColor = self.getvalue(bgColorSection, bgColorSetting)
        bgColorButton = wx.ColourPickerCtrl(self, col=currentBgColor)
        defaultFont = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT)
        nativeInfoString = self.gettext(fontSection, fontSetting)
        currentFont = wx.FontFromNativeInfoString(
            nativeInfoString) if nativeInfoString else None
        fontButton = widgets.FontPickerCtrl(self,
                                            font=currentFont or defaultFont,
                                            colour=currentFgColor)
        fontButton.SetBackgroundColour(currentBgColor)
        iconEntry = wx.combo.BitmapComboBox(self, style=wx.CB_READONLY)
        imageNames = sorted(artprovider.chooseableItemImages.keys())
        for imageName in imageNames:
            label = artprovider.chooseableItemImages[imageName]
            bitmap = wx.ArtProvider_GetBitmap(imageName, wx.ART_MENU, (16, 16))
            item = iconEntry.Append(label, bitmap)
            iconEntry.SetClientData(item, imageName)
        currentIcon = self.gettext(iconSection, iconSetting)
        currentSelectionIndex = imageNames.index(currentIcon)
        iconEntry.SetSelection(currentSelectionIndex)  # pylint: disable=E1101

        self.addEntry(
            text,
            fgColorButton,
            bgColorButton,
            fontButton,
            iconEntry,
            flags=(
                wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                wx.ALL | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL,
                wx.ALL | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL,
                wx.ALL | wx.
                ALIGN_CENTER_VERTICAL,  # wx.EXPAND causes the button to be top aligned on Mac OS X
                wx.ALL | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL))
        self._colorSettings.append(
            (fgColorSection, fgColorSetting, fgColorButton))
        self._colorSettings.append(
            (bgColorSection, bgColorSetting, bgColorButton))
        self._iconSettings.append((iconSection, iconSetting, iconEntry))
        self._fontSettings.append((fontSection, fontSetting, fontButton))
        self._syncers.append(
            FontColorSyncer(fgColorButton, bgColorButton, fontButton))
Exemplo n.º 3
0
 def addFontSetting(self, section, setting, text):
     default_font = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT)
     native_info_string = self.gettext(section, setting)
     current_font = wx.FontFromNativeInfoString(native_info_string) \
                    if native_info_string else None
     font_button = widgets.FontPickerCtrl(self,
                                          font=current_font or default_font,
                                          colour=(0, 0, 0, 255))
     font_button.SetBackgroundColour((255, 255, 255, 255))
     self.addEntry(
         text,
         font_button,
         flags=(
             wx.ALL | wx.ALIGN_CENTER_VERTICAL,
             wx.ALL | wx.
             ALIGN_CENTER_VERTICAL  # wx.EXPAND causes the button to be top aligned on Mac OS X
         ))
     self._fontSettings.append((section, setting, font_button))