Select_sheets alter name

Hi guys,

I run into an issue where select_sheets gets a bit limited.

I have a project with 200+ sheets where the questions are now: print the sheets with date x. So rather knowing which sheets to select, I want to use the search bar to be able to filter to a specific date.

selected_sheets = forms.select_sheets(title='PDF > SELECT SHEET(S)', filterfunc=lambda x: x.Name not in excludesheets )

Looking at pyrevit github it seems to me that the specific select_sheets doesn’t allow a change of displayed name.
Before I start to create a class and (try to) fix this myself: am I correct?

Sorry for the late reply. I hope I’m not too late but.

forms.select_sheets() does not provide a way of changing the display name of a sheet

However does
Check the function documentation here

Provide this puppy with name_attr and you could be in bussiness.

Afaik, name_attr is a str so it must refer to a property. Haven’t tried providing it with a function before, feel free to try.
I always create a very crude wrapper around my element and give it a name property. Works flawless, you can fully customise the display name that way.

Something like this

class SheetMenuItem(object):
   def __init__(self, sheet):
      self.sheet = sheet
    def name(self):
        return "{date} : {name}".format(, name=sheet.SheetName)

never too late.

And yeah that’s the same class I create too with indeed a selectfromlist.
(eventhough I somehow didn’t include the ini … which is kinda the basic. Hmmm time to review my coding)