From 8ee74f2b8d0a021af8d4aa27a619e855d0fa0914 Mon Sep 17 00:00:00 2001 From: Frederik Berlaen Date: Mon, 12 Feb 2024 11:07:55 +0100 Subject: [PATCH] add support for bordered in a PopUpButton and a list2 PopUpButton --- Lib/vanilla/vanillaList2.py | 4 +++- Lib/vanilla/vanillaPopUpButton.py | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Lib/vanilla/vanillaList2.py b/Lib/vanilla/vanillaList2.py index 9bd270b..7597805 100644 --- a/Lib/vanilla/vanillaList2.py +++ b/Lib/vanilla/vanillaList2.py @@ -1316,11 +1316,13 @@ class PopUpButtonList2Cell(PopUpButton): def __init__(self, items=[], editable=False, - callback=None + callback=None, + bordered=False, ): super().__init__( "auto", items=items, + bordered=bordered, sizeStyle="small", callback=callback ) diff --git a/Lib/vanilla/vanillaPopUpButton.py b/Lib/vanilla/vanillaPopUpButton.py index 056f9c1..890e9f1 100644 --- a/Lib/vanilla/vanillaPopUpButton.py +++ b/Lib/vanilla/vanillaPopUpButton.py @@ -68,7 +68,7 @@ def popUpButtonCallback(self, sender): "regular": (-3, -4, 6, 6), } - def __init__(self, posSize, items, callback=None, sizeStyle="regular"): + def __init__(self, posSize, items, callback=None, sizeStyle="regular", bordered=True): self._setupView(self.nsPopUpButtonClass, posSize) if self.nsPopUpButtonCellClass != NSPopUpButtonCell: self._nsObject.setCell_(self.nsPopUpButtonCellClass.alloc().init()) @@ -76,6 +76,7 @@ def __init__(self, posSize, items, callback=None, sizeStyle="regular"): self._setCallback(callback) self._setSizeStyle(sizeStyle) self.setItems(items) + self._nsObject.setBordered_(bordered) def getNSPopUpButton(self): """ @@ -212,10 +213,9 @@ def subFirstCallback(self, sender): """ def __init__(self, posSize, items, sizeStyle="regular", bordered=True): - super().__init__(posSize, items, sizeStyle=sizeStyle) + super().__init__(posSize, items, sizeStyle=sizeStyle, bordered=bordered) self._nsObject.setPullsDown_(True) self._nsObject.setBezelStyle_(NSTexturedRoundedBezelStyle) - self._nsObject.setBordered_(bordered) def _breakCycles(self): self._menuItemCallbackWrappers = None