Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A session name property for Session objects #118

Closed
wants to merge 1 commit into from

Conversation

pelegm
Copy link

@pelegm pelegm commented Aug 18, 2015

I am not entirely familiar with the object, but using the API, I found it more intuitive to call session.name than to call session.get('session_name'). If you think that's a proper way to go, I can add similar properties.

@tony
Copy link
Member

tony commented Aug 23, 2015

@pelegm Thank you for this.

I have no objections. If we're going to go this route, we may as well do it for Window and so on. Have you looked at adding this via TmuxMappingObject?

@pelegm
Copy link
Author

pelegm commented Aug 24, 2015

The problem is that in a Session object the key name is session_name and in a Window object the key name is window_name I can do some magic like

@property
def name(self):
    return self.get("{}_name".format(self.__class__.__name__.lower()))

or so, but that is not so elegant.

@tony
Copy link
Member

tony commented Aug 28, 2015

@pelegm You're on the right track. There are patterns where you can automatically map object attributes without having to declare a @property.

You know how django and sqlachemy automatically attribute column names to attributes? You could change the way https://github.com/tony/tmuxp/blob/c5244c44d847a8eb06cab4f70db42cacb83002d7/tmuxp/util.py#L124 works to map the object properties to attributes on a Server, Session, Window or Pane object.

@tony
Copy link
Member

tony commented May 23, 2016

@pelegm The python API has been decoupled to https://github.com/tony/libtmux. I'm closing this now

If you want to continue this, let me know. A refactoring of the api is probably in store

@tony tony closed this May 23, 2016
tony added a commit to tmux-python/libtmux that referenced this pull request May 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants