Eduardo Mucelli Rezende Oliveira has proposed merging lp:~eduardo-mucelli/cairo-dock-plug-ins-extras/Twitter into lp:cairo-dock-plug-ins-extras.
Requested reviews: Cairo-Dock Team (cairo-dock-team) For more details, see: https://code.launchpad.net/~eduardo-mucelli/cairo-dock-plug-ins-extras/Twitter/+merge/102034 Configurable notifications. -- https://code.launchpad.net/~eduardo-mucelli/cairo-dock-plug-ins-extras/Twitter/+merge/102034 Your team Cairo-Dock Team is requested to review the proposed merge of lp:~eduardo-mucelli/cairo-dock-plug-ins-extras/Twitter into lp:cairo-dock-plug-ins-extras.
=== modified file 'Twitter/ChangeLog' --- Twitter/ChangeLog 2012-03-22 00:14:49 +0000 +++ Twitter/ChangeLog 2012-04-15 17:45:24 +0000 @@ -1,3 +1,4 @@ +0.2.2: (April/15/2012): Configurable notifications. 0.2.1: (March/22/2012): Added user timeline. 0.2: (March/19/2012): Possible to retweet tweets. Tweets being shown with standard menu. 0.1.4: (March/18/2012): Alerts for new direct messages arriving on the stream, possible to answer them. Organizing the menus for new/all tweets, and messages. Play alert sound when tweet/message arrives on the stream. === modified file 'Twitter/Twitter' --- Twitter/Twitter 2012-04-03 19:37:31 +0000 +++ Twitter/Twitter 2012-04-15 17:45:24 +0000 @@ -202,32 +202,43 @@ def play_alert_sound(self): os.popen('aplay %s' % os.path.abspath("./data/alert.wav")) + + def animate_icon(self, animation): + if len(animation) == 0: + animation = 'default' + self.icon.DemandsAttention(True, animation) + + def send_alert(self): + if self.config['sound']: + self.play_alert_sound() + if self.config['animation']: + self.animate_icon(self.config['animation_type']) # Twitter methods # This method is a callback that is called as soon as a new entry arrives on the stream # The method is passed as parameter when creating the instance for the TwitterStreamAPI # TwitterStreamAPI(access_key, access_secret, self.on_receive_new_entry_into_stream_callback) - # TODO: Make configurable the alerts, sound, animation, etc def on_receive_new_entry_into_stream_callback(self, entry): if 'user' in entry: # tweet if not entry['user']['screen_name'] == self.user.screen_name: # not sent by the own user logp("Inserting new tweet on the stream Queue: %s" % entry) self.tweet_stream.put(entry) # put the new tweet on the stream queue self.refresh_emblem_counter() - self.play_alert_sound() + if self.config['alert']: # user wants alert? + self.send_alert() elif 'direct_message' in entry: # direct messages if not entry['direct_message']['sender']['screen_name'] == self.user.screen_name: # not sent by the own user logp("Inserting new message on the message Queue: %s" % entry) self.message_stream.put(entry) # put the new message on the message queue self.refresh_emblem_counter() - self.play_alert_sound() + if self.config['alert']: # user wants alert? + self.send_alert() def show_user_timeline(self): self.inform_start_of_waiting_process() timeline = self.api.user_timeline() - print timeline[0] if len(timeline) > 0: ut_menu = menu.Menu(self.icon) # callback not set since there is no action when clicking ... for status in timeline: # ... on the menu generated from this list @@ -508,6 +519,10 @@ def get_config(self, keyfile): self.config['emblem_size'] = keyfile.get('Configuration', 'emblem_size') + self.config['alert'] = keyfile.getboolean('Configuration', 'alert') + self.config['sound'] = keyfile.getboolean('Configuration', 'sound') + self.config['animation'] = keyfile.getboolean('Configuration', 'animation') + self.config['animation_type'] = keyfile.get('Configuration', 'animation_type') def reload(self): self.refresh_emblem_counter() @@ -548,8 +563,16 @@ logp("Retweeting") self.api.retweet(self.retweet_tweet_id) + # If there is nothing to be seen, the left click opens the dialog to write a tweet + # Otherwise we check if there is something new, likely to be what the user wants + # to see quickly def on_click(self, key): - self.ask_for_tweet() + if not self.tweet_stream.empty(): + self.show_new_tweets() + elif not self.message_stream.empty(): + self.show_new_direct_messages() + else: + self.ask_for_tweet() def on_middle_click(self): self.show_home_timeline() === modified file 'Twitter/Twitter.conf' --- Twitter/Twitter.conf 2012-04-02 18:38:28 +0000 +++ Twitter/Twitter.conf 2012-04-15 17:45:24 +0000 @@ -104,3 +104,14 @@ #L+[Small;Medium;Large] Size of the emblem that shows the number of new tweets, and messages: emblem_size=Medium +#B[3] Alert when you receive a new tweet or message? +alert=true +#b Play a sound? +#{Should the applet play a sound as a notification?} +sound=true +#B[1] Icon animation? +#{Should the applet animate the icon as a notification?} +animation=true +#a Choose animation: +#{Which animation should apply to the icon?} +animation_type=
_______________________________________________ Mailing list: https://launchpad.net/~cairo-dock-team Post to : cairo-dock-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~cairo-dock-team More help : https://help.launchpad.net/ListHelp