예제 #1
0
    def toast_update(self, event, *a):
        def meetme(*a):
            '''meetme : {'age', 'gender', 'location', 'sender_display_name', 'sender_url',
                         'sender_thumbnail', 'sender_uid', 'meetme_url', 'isMatch'}'''
            fire_opts.update(title = _('Meet Me') + _('Match from: %s') if event['isMatch'] else _('Interest from: %s') % event['sender_display_name'],
                             msg = '')
            if event['isMatch']:
                fire_opts.update(input = lambda text, opts, *a: self.send_message(text, opts, event))

        def message(*a):
            '''message : {'sender_display_name', 'sender_url', 'sender_uid',
                          'subject', 'message', 'message_id', 'sender_thumbnail'}'''
            fire_opts.update(title = _('New Message from: %s') % event['sender_display_name'],
                             msg = strings.strip_html(event['message']).strip(),
                             sticky = True,
                             input = lambda text, opts, *a: self.send_message(text, opts, event))

        def friend_request(*a):
            '''friend_request : {'isNewFriend', 'age', 'gender', 'location', 'sender_display_name',
                                 'sender_url', 'sender_uid', 'sender_thumbnail'}'''
            fire_opts.update(title = _('%s is now your friend') if event['isNewFriend'] else _('Friend Request from: %s') % event['sender_display_name'],
                             msg = '')
            if event['isNewFriend']:
                fire_opts.update(input = lambda text, opts, *a: self.send_message(text, opts, event))

        def topics(*a):
            '''topics : {'topics_type', 'conv_id', 'post_id', 'init_text', 'text', 'sender_displayName',
                         'sender_url', 'sender_thumbnail', 'sender_uid'}'''
            pass # TODO implement topics

        fire_opts = dict(onclick = lambda *a: TU.launchbrowser(event['sender_url']),
                         popupid = 'tagged_toast!%r!%r' % (event['sender_uid'], id(self)))

        {'meetme'         : meetme,
         'message'        : message,
         'friend_request' : friend_request,
         'topics'         : topics
         }[event['sub_type']]()

        if event['sub_type'] != 'topics': # TODO implement topics
            fire('tagged.toast', **fire_opts)
예제 #2
0
    def elections_project_contribution(self, event, *a):
        '''project : {'hash', 'total_contributions', 'contributors', 'max_contribution',
                      'starter_id', 'contributions', 'id', 'starter', 'num_contributors',
                      'finish_time', 'state', 'catalog_id', 'time_remaining'}'''

        project = event['project']
        state = project['state']

        if state == -1:  # FAILED
            msg = _('not able to get fully funded')

        elif state == 0: # ACTIVE
            msg = _('contributed')

        elif state == 1: # COMPLETED
            msg = _('completed')

        fire('tagged.elections',
             title = _('Elections'),
             msg = _('A project was %s') % msg, # TODO we need the projects catalog to be more specific
             onclick = lambda *a: TU.launchbrowser('apps/elections.html'))
예제 #3
0
 def openurl_Games(self):
     TU.launchbrowser('games.html')
예제 #4
0
 def openurl_People(self):
     TU.launchbrowser('people.html')
예제 #5
0
 def openurl_Messages(self):
     TU.launchbrowser('messages.html')
예제 #6
0
 def openurl_Profile(self):
     TU.launchbrowser('profile.html')
예제 #7
0
 def openurl_Home(self):
     TU.launchbrowser('')
예제 #8
0
 def openurl_Games(self):
     TU.launchbrowser('games.html')
예제 #9
0
 def openurl_People(self):
     TU.launchbrowser('people.html')
예제 #10
0
 def openurl_Messages(self):
     TU.launchbrowser('messages.html')
예제 #11
0
 def openurl_Profile(self):
     TU.launchbrowser('profile.html')
예제 #12
0
 def openurl_Home(self):
     TU.launchbrowser('')
예제 #13
0
 def onclick(link):
     if link != '':
         TU.launchbrowser(link)