def __init__(self, parent): wx.ListCtrl.__init__(self, parent, style=wx.LC_REPORT | wx.LC_NO_HEADER | wx.LC_SINGLE_SEL) self.parent = parent self.SetTextColour(Theme.fetch().get('foreground')) self.SetBackgroundColour(Theme.fetch().get('background')) font = wx.Font(prefs.get('font')) self.SetFont(font) self.Bind(wx.EVT_KEY_DOWN, self.parent.parent.check_for_interesting_keystrokes)
def __init__(self, parent, connection): wx.PopupWindow.__init__(self, parent, flags=wx.BORDER_SIMPLE) self.verbs = [] self.names = [] self.parent = parent self.completers = None self.completion_list = CompletionList(self) self.last_completed = None self.connection = connection self.SetBackgroundColour(Theme.fetch().get('foreground')) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.completion_list, 1, wx.ALL | wx.EXPAND, 2) self.SetSizer(sizer)
def restyle_thyself(self): basic_style = rtc.RichTextAttr() self.theme = Theme.fetch() basic_style.SetTextColour(self.fg_colour) basic_style.SetBackgroundColour(self.bg_colour) self.SetBackgroundColour(self.bg_colour) self.SetBasicStyle(basic_style) self.basic_style = basic_style font = wx.Font(prefs.get('font')) self.SetFont(font) # set one-half character's worth of left / top margin font_width, font_height = self.font_size() # Apparently Centos' Wx doesn't have this, so commenting it out. #self.SetMargins((font_width / 2, -1)) self.update_size()
def __init__(self, parent, connection, style): rtc.RichTextCtrl.__init__(self, parent, style) self.connection = connection self.cols = 0 self.rows = 0 self.basic_style = None self.theme = Theme.fetch() self.fg_colour = self.theme.get('foreground') self.bg_colour = self.theme.get('background') self.is_dragging = False self.Clear() self.restyle_thyself() self.Bind(wx.EVT_MIDDLE_DOWN, self.paste_with_middle_mouse) self.Bind(wx.EVT_LEFT_UP, self.left_mouse_up) self.Bind(wx.EVT_LEFT_DOWN, self.left_mouse_down) self.Bind(wx.EVT_MOTION, self.mouse_moved)
def update_sample_text(self, evt): fp = self.fonts_page theme = Theme.fetch(fp.theme_picker.GetStringSelection()) fgcolour = theme.get('foreground') bgcolour = theme.get('background') font = fp.font_ctrl.GetSelectedFont() textattr = wx.TextAttr(fgcolour, bgcolour, font) fp.sample.SetBackgroundColour(bgcolour) fp.sample.SetValue(""" Emerson says, "This is what your window will look like." Emerson waves around a brightly-colored banner. It's super effective! 01234567 89ABCDEF """) fp.sample.SetStyle(0, fp.sample.GetLastPosition(), textattr) # Mock up ANSI if ANSI pref is on # TODO - maybe actually just shove ANSI-code-ful stuff through the actual output_panel ANSIfier? if fp.ansi_checkbox.GetValue(): textattr.SetTextColour(theme.Colour('blue')) fp.sample.SetStyle(1, 8, textattr) fp.sample.SetStyle(58, 66, textattr) textattr.SetTextColour(theme.Colour('red')) fp.sample.SetStyle(81, 89, textattr) textattr.SetTextColour(theme.Colour('yellow')) fp.sample.SetStyle(90, 97, textattr) textattr.SetTextColour(theme.Colour('green')) fp.sample.SetStyle(98, 104, textattr) fp.theme_picker.Enable() textattr.SetTextColour(theme.Colour('white')) textattr.SetFontWeight(wx.FONTWEIGHT_BOLD) fp.sample.SetStyle(107, 128, textattr) textattr.SetTextColour(theme.Colour('red', 'bright')) fp.sample.SetStyle(112, 117, textattr) textattr.SetFontWeight(wx.FONTWEIGHT_NORMAL) textattr.SetTextColour(theme.Colour('black')) fp.sample.SetStyle(130, 131, textattr) textattr.SetTextColour(theme.Colour('red')) fp.sample.SetStyle(131, 132, textattr) textattr.SetTextColour(theme.Colour('green')) fp.sample.SetStyle(132, 133, textattr) textattr.SetTextColour(theme.Colour('yellow')) fp.sample.SetStyle(133, 134, textattr) textattr.SetTextColour(theme.Colour('blue')) fp.sample.SetStyle(134, 135, textattr) textattr.SetTextColour(theme.Colour('magenta')) fp.sample.SetStyle(135, 136, textattr) textattr.SetTextColour(theme.Colour('cyan')) fp.sample.SetStyle(136, 137, textattr) textattr.SetTextColour(theme.Colour('white')) fp.sample.SetStyle(137, 138, textattr) textattr.SetTextColour(fgcolour) textattr.SetBackgroundColour(theme.Colour('black')) fp.sample.SetStyle(139, 140, textattr) textattr.SetBackgroundColour(theme.Colour('red')) fp.sample.SetStyle(140, 141, textattr) textattr.SetBackgroundColour(theme.Colour('green')) fp.sample.SetStyle(141, 142, textattr) textattr.SetBackgroundColour(theme.Colour('yellow')) fp.sample.SetStyle(142, 143, textattr) textattr.SetBackgroundColour(theme.Colour('blue')) fp.sample.SetStyle(143, 144, textattr) textattr.SetBackgroundColour(theme.Colour('magenta')) fp.sample.SetStyle(144, 145, textattr) textattr.SetBackgroundColour(theme.Colour('cyan')) fp.sample.SetStyle(145, 146, textattr) textattr.SetBackgroundColour(theme.Colour('white')) fp.sample.SetStyle(146, 147, textattr) else: fp.theme_picker.Disable() if evt: evt.Skip()