Fix tabs not disabling. It was primarily an issue with event propagation not being handled correctly, as well as some missing helper code in chrome_tabs
This commit is contained in:
@@ -30,6 +30,7 @@ class CommandFits(ContextMenu):
|
||||
if evt is None or not ids.isdisjoint(cls.commandTypeIDs):
|
||||
# we are adding or removing an item that defines a command fit. Need to refresh fit list
|
||||
cls.populateFits(evt)
|
||||
evt.Skip()
|
||||
|
||||
@classmethod
|
||||
def populateFits(cls, evt):
|
||||
|
||||
@@ -542,7 +542,7 @@ class _TabRenderer:
|
||||
|
||||
# draw the tab icon
|
||||
if self.tab_img:
|
||||
bmp = wx.Bitmap(self.tab_img)
|
||||
bmp = wx.Bitmap(self.tab_img.ConvertToGreyscale() if self.disabled else self.tab_img)
|
||||
# @todo: is this conditional relevant anymore?
|
||||
if self.content_width > 16:
|
||||
# Draw tab icon
|
||||
@@ -595,6 +595,12 @@ class _TabRenderer:
|
||||
self.tab_bitmap = bmp
|
||||
|
||||
|
||||
def __repr__(self):
|
||||
return "_TabRenderer(text={}, disabled={}) at {}".format(
|
||||
self.text, self.disabled, hex(id(self))
|
||||
)
|
||||
|
||||
|
||||
class _AddRenderer:
|
||||
def __init__(self):
|
||||
"""Renders the add tab button"""
|
||||
@@ -901,6 +907,8 @@ class _TabsContainer(wx.Panel):
|
||||
return True
|
||||
|
||||
if self.TabHitTest(tab, x, y):
|
||||
if tab.disabled:
|
||||
return
|
||||
tab.SetSelected(True)
|
||||
old_sel_tab.SetSelected(False)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user