Пример #1
0
    def _UploadToTwitpicAndPostToTwitter(self):
        
        def th_function():
            return self.model.uploadToTwitpicAndPostToTwitter(self.message)

        def th_finished(exception, retval):
            self.view.hide()
            result = 'Your photo has been<br> uploaded and posted in <br>twitter'
            
            def view_close():
                self.close()
            
            if(retval is None):
                result = 'Error<br> Check your connection'
            elif(retval != 'ok'):
                result = 'Error<br> ' + retval
            
            self.view = ResultMessageView(self.parent.last_panel, self.model.title, None, result)
            self.view.callback_ok_clicked = self.close
            self.view.show()
            
        self.view.hide()
        
        self.view = WaitMessageView(self.parent.last_panel, self.model.title, None, 'Uploading photo<br>Please Wait')
        self.view.show()
        ThreadedFunction(th_finished, th_function).start()
Пример #2
0
    def __init__(self, model, canvas, parent):
        ModalController.__init__(self, model, canvas, parent)
        self.model = model
        self.parent = parent
        
        if(not twitter_manager.isLogged()):
            self.view = ResultMessageView(self.parent.last_panel, self.model.title, None, 'Please sign in using<br> setting > Internet Media ><br> Twitter')
            self.view.callback_ok_clicked = self.close
            self.view.show()
        
        else:
            self.view = SetMessageView(parent.last_panel, model.title, None)

            self.view.callback_ok_clicked = self._on_ok_clicked
            self.view.callback_cancel_clicked = self.close
            self.view.callback_escape = self.close
            self.view.show()
Пример #3
0
    def _on_ok_clicked(self, comment):
            
        self.message = comment

        self.view.hide()
        
        self.view = ConfirmDialogView('Do You want this photo <br>posted to your twitter <br>account?', self.parent.last_panel, self.model.title, None)
        self.view.callback_yes_clicked = self._UploadToTwitpicAndPostToTwitter
        self.view.callback_no_clicked = self._UploadToTwitpic
        self.view.show()
Пример #4
0
 def th_finished(exception, retval):
     self.view.hide()
     result = 'Your photo has been<br> uploaded and posted in <br>twitter'
     
     def view_close():
         self.close()
     
     if(retval is None):
         result = 'Error<br> Check your connection'
     elif(retval != 'ok'):
         result = 'Error<br> ' + retval
     
     self.view = ResultMessageView(self.parent.last_panel, self.model.title, None, result)
     self.view.callback_ok_clicked = self.close
     self.view.show()
Пример #5
0
class UploadToTwitpicOptionsController(ModalController):
    terra_type = "Controller/Options/Folder/Image/Fullscreen/Submenu/Twitpic"

    def __init__(self, model, canvas, parent):
        ModalController.__init__(self, model, canvas, parent)
        self.model = model
        self.parent = parent
        
        if(not twitter_manager.isLogged()):
            self.view = ResultMessageView(self.parent.last_panel, self.model.title, None, 'Please sign in using<br> setting > Internet Media ><br> Twitter')
            self.view.callback_ok_clicked = self.close
            self.view.show()
        
        else:
            self.view = SetMessageView(parent.last_panel, model.title, None)

            self.view.callback_ok_clicked = self._on_ok_clicked
            self.view.callback_cancel_clicked = self.close
            self.view.callback_escape = self.close
            self.view.show()

    def close(self):
        def cb(*ignored):
            self.back()
            self.parent.back()
        self.view.hide(end_callback=cb)

    def _on_ok_clicked(self, comment):
            
        self.message = comment

        self.view.hide()
        
        self.view = ConfirmDialogView('Do You want this photo <br>posted to your twitter <br>account?', self.parent.last_panel, self.model.title, None)
        self.view.callback_yes_clicked = self._UploadToTwitpicAndPostToTwitter
        self.view.callback_no_clicked = self._UploadToTwitpic
        self.view.show()
        
    def _UploadToTwitpic(self):
        
        def th_function():
            return self.model.uploadToTwitpic(self.message)

        def th_finished(exception, retval):
            self.view.hide()
            result = 'Your photo has been<br> uploaded'
            
            def view_close():
                self.close()
                
            if(retval is None):
                result = 'Error<br> Check your connection'
            elif(retval != 'ok'):
                result = 'Error<br> ' + retval
            
            self.view = ResultMessageView(self.parent.last_panel, self.model.title, None, result)
            self.view.callback_ok_clicked = self.close
            self.view.show()
            
        self.view.hide()
        
        self.view = WaitMessageView(self.parent.last_panel, self.model.title, None, 'Uploading photo<br>Please Wait')
        self.view.show()
        ThreadedFunction(th_finished, th_function).start()
    
    def _UploadToTwitpicAndPostToTwitter(self):
        
        def th_function():
            return self.model.uploadToTwitpicAndPostToTwitter(self.message)

        def th_finished(exception, retval):
            self.view.hide()
            result = 'Your photo has been<br> uploaded and posted in <br>twitter'
            
            def view_close():
                self.close()
            
            if(retval is None):
                result = 'Error<br> Check your connection'
            elif(retval != 'ok'):
                result = 'Error<br> ' + retval
            
            self.view = ResultMessageView(self.parent.last_panel, self.model.title, None, result)
            self.view.callback_ok_clicked = self.close
            self.view.show()
            
        self.view.hide()
        
        self.view = WaitMessageView(self.parent.last_panel, self.model.title, None, 'Uploading photo<br>Please Wait')
        self.view.show()
        ThreadedFunction(th_finished, th_function).start()

    def delete(self):
        self.view.delete()
        self.view = None
        self.model = None