Skip to content

Commit

Permalink
Merge pull request #203 from robotools/popupbuttonListBorder
Browse files Browse the repository at this point in the history
add support for bordered in a PopUpButton and a list2 PopUpButton
  • Loading branch information
typesupply committed Feb 12, 2024
2 parents 8c8403b + 8ee74f2 commit 7c5a803
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Lib/vanilla/vanillaList2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
6 changes: 3 additions & 3 deletions Lib/vanilla/vanillaPopUpButton.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,15 @@ 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())
if callback is not None:
self._setCallback(callback)
self._setSizeStyle(sizeStyle)
self.setItems(items)
self._nsObject.setBordered_(bordered)

def getNSPopUpButton(self):
"""
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7c5a803

Please sign in to comment.