def _DoButDefaultFont(self, extra_flags, attr): baseFormat = getattr(self.scintilla._GetColorizer(), attr) flags = extra_flags | win32con.CF_SCREENFONTS | win32con.CF_EFFECTS | win32con.CF_FORCEFONTEXIST d=win32ui.CreateFontDialog(baseFormat, flags, None, self) if d.DoModal()==win32con.IDOK: setattr(self.scintilla._GetColorizer(), attr, d.GetCharFormat()) self.OnStyleUIChanged(0, win32con.BN_CLICKED)
def HandleCharFormatChange(self, id, code): if code == win32con.BN_CLICKED: editId = buttonControlMap.get(id) assert editId is not None, "Format button has no associated edit control" editControl = self.GetDlgItem(editId) existingFormat = editControl.GetDefaultCharFormat() flags = win32con.CF_SCREENFONTS d = win32ui.CreateFontDialog(existingFormat, flags, None, self) if d.DoModal() == win32con.IDOK: cf = d.GetCharFormat() editControl.SetDefaultCharFormat(cf) self.SetModified(1) return 0 # We handled this fully!
def OnButThisFont(self, id, code): if code==win32con.BN_CLICKED: flags = win32con.CF_SCREENFONTS | win32con.CF_EFFECTS | win32con.CF_FORCEFONTEXIST style = self.GetSelectedStyle() # If the selected style is based on the default, we need to apply # the default to it. def_format = self.scintilla._GetColorizer().GetDefaultFormat() format = style.GetCompleteFormat(def_format) d=win32ui.CreateFontDialog(format, flags, None, self) if d.DoModal()==win32con.IDOK: style.format = d.GetCharFormat() self.scintilla.ApplyFormattingStyles(0) return 1
def ChangeFormat(self, fmtAttribute, fmt): dlg = win32ui.CreateFontDialog(fmt) if dlg.DoModal() != win32con.IDOK: return None return dlg.GetCharFormat()
def demo(): dlg = win32ui.CreateFontDialog(None,win32con.CF_EFFECTS|win32con.CF_SCREENFONTS,None,None) if dlg.DoModal() != win32con.IDOK: return None print (dlg.GetCharFormat()) return (dlg.GetCharFormat())