def _updateColor(self, cat): if cat: stat = self.stats_data.GetStatistics(cat) back_c = wx.Colour([int(x) for x in stat.color.split(':')]) text_c = wx.Colour(*ContrastColor(back_c)) else: back_c = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BACKGROUND) text_c = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNTEXT) self.choice.SetForegroundColour(text_c) self.choice.SetBackgroundColour(back_c)
def OnGetItemAttr(self, item): cat_id = self.cats_mgr.GetCategories()[item] cattr = self.cats_mgr.GetCategoryAttrs(cat_id) if cattr['show']: c = cattr['color'] back_c = wx.Colour(*map(int, c.split(':'))) text_c = wx.Colour(*ContrastColor(back_c)) else: back_c = wx.SystemSettings.GetColour(wx.SYS_COLOUR_INACTIVECAPTION) text_c = wx.SystemSettings.GetColour( wx.SYS_COLOUR_INACTIVECAPTIONTEXT) # if it is in scope of the method, gui falls, using self solved it self.l = wx.ListItemAttr(colText=text_c, colBack=back_c) return self.l
def OnGetItemAttr(self, item): cat_id = self.cats_mgr.GetCategories()[item] cattr = self.cats_mgr.GetCategoryAttrs(cat_id) if cattr["show"]: c = cattr["color"] back_c = wx.Colour(*map(int, c.split(":"))) text_c = wx.Colour(*ContrastColor(back_c)) else: back_c = wx.SystemSettings.GetColour(wx.SYS_COLOUR_INACTIVECAPTION) text_c = wx.SystemSettings.GetColour(wx.SYS_COLOUR_INACTIVECAPTIONTEXT) # if it is in scope of the method, gui falls, using self solved it self.l = wx.ListItemAttr() self.l.SetBackgroundColour(back_c) self.l.SetTextColour(text_c) return self.l