Re: FBuntu: Facebook Notifier for Messaging Menu
Python doesn't really require you to specify data types or begin variable names with special characters, it just kindof figures it out on the fly by what you set to it. Yeah, mmText is the variable that contains what is shown. self.response is a dictionary (in Python speak), which contains the 'title' info you want to display.
self.response['title'] is a string, hence mmText will be a string, but you can slice strings apart like you can with lists/arrays, so:
So, yeah, just throw an if statement in there to see if the string is over a certain length so you can cut it up however you want, else show it all.
# To get the first twenty characters and add ' ...'
mmText = self.response['title'][:20] + ' ...'
# slightly more elaborate: put an ellipsis between the first and last ten chars
mmText = '%s ... %s' % (self.response['title'][:10], self.response['title'][-10:])
Any advice given is the direct result of my experience solving my problems on my system. I have no idea what I'm talking about. ~bouge