예제 #1
0
파일: misc.py 프로젝트: nemesiscodex/jarabe
def _downgrade_option_alert(bundle):
    alert = ConfirmationAlert()
    alert.props.title = _('Older Version Of %s Activity') % (bundle.get_name())
    alert.props.msg = _('Do you want to downgrade to version %s') % \
                        bundle.get_activity_version()
    alert.connect('response', _downgrade_alert_response_cb, bundle)
    journalwindow.get_journal_window().add_alert(alert)
    alert.show()
예제 #2
0
 def confirmation_alert(self, msg, title=None, confirmation_cb=None):
     alert = ConfirmationAlert()
     alert.props.title = title
     alert.props.msg = msg
     alert.pydebug_cb = confirmation_cb
     alert.connect('response', self._alert_response_cb)
     self._activity.add_alert(alert)
     return alert
예제 #3
0
 def _overwrite_bookmarklet_cb(self, store, name, url):
     '''Ask for confirmation'''
     alert = ConfirmationAlert()
     alert.props.title = _('Add bookmarklet')
     alert.props.msg = _('"%s" already exists. Overwrite?') % name
     alert.connect('response', self._overwrite_bookmarklet_response_cb)
     
     # send the arguments through the alert object
     alert._bm = (name, url)
     
     self.add_alert(alert)
예제 #4
0
    def confirmation_alert(self, title, msg, cb, *cb_args):
        """Raise standard confirmation alert"""
        alert = ConfirmationAlert(title=title, msg=msg)

        def response(alert, response_id, self, cb, *cb_args):
            self.remove_alert(alert)
            if response_id is gtk.RESPONSE_OK:
                cb(*cb_args)

        alert.connect('response', response, self, cb, *cb_args)
        alert.show_all()
        self.add_alert(alert)
예제 #5
0
 def _userscript_found_cb(self, listener, location):
     '''Ask user whether to install the userscript'''
     alert = ConfirmationAlert()
     alert.props.title = _('Add userscript')
     if usercode.script_exists(location):
         alert.props.msg = _('Userscript already exists. Overwrite?') 
     else:
         alert.props.msg = _('Do you want to add this userscript?')    
     alert.connect('response', self._userscript_found_response_cb)
             
     # send the argument through the alert object
     alert._location = location
     
     self.add_alert(alert)
예제 #6
0
import gtk
from sugar.graphics.alert import ConfirmationAlert

window = gtk.Window()

box = gtk.VBox()
window.add(box)


def _alert_response_cb(alert, response_id, entry):
    print entry.get_text()
    if response_id is gtk.RESPONSE_OK:
        print 'Ok'
    elif response_id is gtk.RESPONSE_CANCEL:
        print 'Cancel'
    box.remove(alert)
    gtk.main_quit()


alert = ConfirmationAlert()
alert.props.title = 'Title of ConfirmationAlert'
alert.props.msg = 'Text of confirmation alert, either button will quit'
box.add(alert)
entry = alert.add_entry()
entry.set_text('this entry')
alert.connect('response', _alert_response_cb, entry)

window.show_all()

gtk.main()
예제 #7
0
import gtk
from sugar.graphics.alert import ConfirmationAlert

window = gtk.Window()

box = gtk.VBox()
window.add(box)

def _alert_response_cb(alert, response_id, entry):
    print entry.get_text()
    if response_id is gtk.RESPONSE_OK:
        print 'Ok'
    elif response_id is gtk.RESPONSE_CANCEL:
        print 'Cancel'
    box.remove(alert)
    gtk.main_quit()

alert = ConfirmationAlert()
alert.props.title='Title of ConfirmationAlert'
alert.props.msg = 'Text of confirmation alert, either button will quit'
box.add(alert)
entry = alert.add_entry()
entry.set_text('this entry')
alert.connect('response', _alert_response_cb, entry)

window.show_all()

gtk.main()