Skip to content

Commit de0e872

Browse files
authored
Merge pull request #224 from robotools/addingArgsInPathControl
adding fileTypes and isEditable as args
2 parents 7dad4e9 + d588327 commit de0e872

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Lib/vanilla/vanillaPathControl.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,26 @@ class PathControl(VanillaBaseControl):
4949
+-----------+
5050
| "mini" |
5151
+-----------+
52+
53+
**isEditable* (optional) A boolean representing of the control is editable or not.
54+
55+
**fileTypes** (optional) A list of file supported file extensions.
5256
"""
5357

5458
nsPathControlClass = NSPathControl
5559

56-
def __init__(self, posSize, url, callback=None, pathStyle="standard", sizeStyle="regular"):
60+
def __init__(self, posSize, url, callback=None, pathStyle="standard", sizeStyle="regular", fileTypes=None, isEditable=None):
5761
self._setupView(self.nsPathControlClass, posSize, callback=callback)
5862
self._nsObject.setPathStyle_(_pathStylesMap[pathStyle])
5963
self._setSizeStyle(sizeStyle)
6064
self._nsObject.setBackgroundColor_(NSColor.clearColor())
6165
self._nsObject.setFocusRingType_(NSFocusRingTypeNone)
6266
self._nsObject.cell().setBordered_(True)
6367
self._nsObject.cell().setBezelStyle_(NSRoundedBezelStyle)
68+
if isEditable is not None:
69+
self.setEditable(isEditable)
70+
if fileTypes is not None:
71+
self._nsObject.setAllowedTypes_(fileTypes)
6472
self.set(url)
6573

6674
def set(self, url):
@@ -82,3 +90,6 @@ def getSelected(self):
8290
if cell == self._nsObject.clickedPathComponentCell():
8391
break
8492
return os.sep.join(path)
93+
94+
def setEditable(self, value):
95+
self._nsObject.setEditable_(value)

0 commit comments

Comments
 (0)