Esempio n. 1
0
    def __init__(self, handle):
        activity.Activity.__init__(self, handle)

        self.max_participants = 1

        self.build_toolbar()

        # Create the main container
        self._main_view = gtk.VBox()

        try:
            conf = Config("./properties.conf")

            if (conf.is_plugin_installed()):
                # Step 1: Load class, which creates ActivityWindows.widget
                self.ActivityWindows = ActivityWindows()
                # Step 2: Remove the widget's parent
                if self.ActivityWindows.widget.parent:
                    self.ActivityWindows.widget.parent.remove(
                        self.ActivityWindows.widget)

                # Step 3: We attach that widget to our window
                self._main_view.pack_start(self.ActivityWindows.widget)

                # Display everything
                self.ActivityWindows.widget.show()
                self._main_view.show()
            else:
                alert = Alert()
                # Populate the title and text body of the alert.
                alert.props.title = _('Error Fatal!')
                alert.props.msg = _('No tienes instalado el plugin')
                # Call the add_alert() method (inherited via the sugar.graphics.Window superclass of Activity)
                # to add this alert to the activity window.
                self.add_alert(alert)
                alert.show()
        except Exception as inst:
            print _("NewPatternsActivity - Error inesperado:")
            print type(inst)  # la instancia de excepción
            print inst.args  # argumentos guardados en .args
            print inst  # __str__ permite imprimir args directamente
            # Create a new simple alert
            alert = Alert()
            # Populate the title and text body of the alert.
            alert.props.title = _('Error Fatal!')
            alert.props.msg = inst  #_('No tienes instalado TortuBots o compatible')
            # Call the add_alert() method (inherited via the sugar.graphics.Window superclass of Activity)
            # to add this alert to the activity window.
            self.add_alert(alert)
            alert.show()

        self.set_canvas(self._main_view)
        self.show_all()
Esempio n. 2
0
    def __accept_clicked_cb(self, widget):
        if self._section_view.needs_restart:
            self._section_toolbar.accept_button.set_sensitive(False)
            self._section_toolbar.cancel_button.set_sensitive(False)
            alert = Alert()
            alert.props.title = _('Warning')
            alert.props.msg = _('Changes require restart')

            icon = Icon(icon_name='dialog-cancel')
            alert.add_button(gtk.RESPONSE_CANCEL, _('Cancel changes'), icon)
            icon.show()

            if self._current_option != 'aboutme':
                icon = Icon(icon_name='dialog-ok')
                alert.add_button(gtk.RESPONSE_ACCEPT, _('Later'), icon)
                icon.show()

            icon = Icon(icon_name='system-restart')
            alert.add_button(gtk.RESPONSE_APPLY, _('Restart now'), icon)
            icon.show()

            self._vbox.pack_start(alert, False)
            self._vbox.reorder_child(alert, 2)
            alert.connect('response', self.__response_cb)
            alert.show()
        else:
            self._show_main_view()
Esempio n. 3
0
    def _value_changed(self, cell, path, new_text, model, activity):
        _logger.info("Change '%s' to '%s'" % (model[path][1], new_text))
        is_number = True
        number = new_text.replace(",", ".")
        try:
            float(number)
        except ValueError:
            is_number = False

        if is_number:
            decimals = utils.get_decimals(str(float(number)))
            new_text = locale.format('%.' + decimals + 'f', float(number))
            model[path][1] = str(new_text)

            self.emit("value-changed", str(path), number)

        elif not is_number:
            alert = Alert()

            alert.props.title = _('Invalid Value')
            alert.props.msg = \
                           _('The value must be a number (integer or decimal)')

            ok_icon = Icon(icon_name='dialog-ok')
            alert.add_button(gtk.RESPONSE_OK, _('Ok'), ok_icon)
            ok_icon.show()

            alert.connect('response', lambda a, r: activity.remove_alert(a))

            activity.add_alert(alert)

            alert.show()
Esempio n. 4
0
    def _object_chooser(self, mime_type, type_name):
        chooser = ObjectChooser()
        matches_mime_type = False

        response = chooser.run()
        if response == gtk.RESPONSE_ACCEPT:
            jobject = chooser.get_selected_object()
            metadata = jobject.metadata
            file_path = jobject.file_path

            if metadata['mime_type'] == mime_type:
                matches_mime_type = True

            else:
                alert = Alert()

                alert.props.title = _('Invalid object')
                alert.props.msg = \
                       _('The selected object must be a %s file' % (type_name))

                ok_icon = Icon(icon_name='dialog-ok')
                alert.add_button(gtk.RESPONSE_OK, _('Ok'), ok_icon)
                ok_icon.show()

                alert.connect('response', lambda a, r: self.remove_alert(a))

                self.add_alert(alert)

                alert.show()

        return matches_mime_type, file_path, metadata['title']
Esempio n. 5
0
 def __register_activate_cb(self, icon):
     alert = Alert()
     try:
         schoolserver.register_laptop()
     except RegisterError, e:
         alert.props.title = _('Registration Failed')
         alert.props.msg = '%s' % e
Esempio n. 6
0
    def __init__(self, handle):
        activity.Activity.__init__(self, handle)
        self.set_canvas(canvas.widget)
        toolbox = activity.ActivityToolbox(self)
        self.set_toolbox(toolbox)
        toolbox.show()

        alert = Alert()
        # Populate the title and text body of the alert.
        alert.props.title = 'Current Recording'
        alert.props.msg = 'recording information goes here'
        stop_icon = Icon(icon_name='dialog-cancel')
        stop_icon.set_pixel_size(50)
        alert.add_button(gtk.RESPONSE_CANCEL, 'End', stop_icon)
        stop_icon.show()
        alert.connect('response', singletab.stop)
        alert.connect('response', incramentaltab.stop)
        alert.connect('response', lapsetab.stop)
        # Call the add_alert() method (inherited via the sugar.graphics.Window superclass of Activity)
        # to add this alert to the activity window.
        self.add_alert(alert)
        alert.hide()

        for tab in tabs:
            toolbox.add_toolbar(tab.tab_name, tab.widget)
            tab.set_alert(alert)
Esempio n. 7
0
    def _export_turtleblocks_cb(self, button=None):
        alert = Alert()
        alert.props.title = _('Save as TurtleBlocks project')
        self.add_alert(alert)
        alert.show()

        gobject.idle_add(self._export_turtleblocks, alert)
Esempio n. 8
0
    def _show_stop_dialog(self):
        for button in self._stop_buttons:
            button.set_sensitive(False)
        alert = Alert()
        alert.props.title = _('Stop')
        alert.props.msg = _('Stop: name your journal entry')

        title = self._jobject.metadata['title']
        alert.entry = alert.add_entry()
        alert.entry.set_text(title)

        label, tip = self._get_save_label_tip(title)
        button = alert.add_button(gtk.RESPONSE_OK, label,
                                  Icon(icon_name='dialog-ok'))
        button.add_accelerator('clicked', self.sugar_accel_group,
                               gtk.keysyms.Return, 0, 0)
        button.set_tooltip_text(tip)
        alert.ok = button

        label, tip = self._get_erase_label_tip()
        button = alert.add_button(gtk.RESPONSE_ACCEPT, label,
                                  Icon(icon_name='list-remove'))
        button.set_tooltip_text(tip)

        button = alert.add_button(gtk.RESPONSE_CANCEL, _('Cancel'),
                                  Icon(icon_name='dialog-cancel'))
        button.add_accelerator('clicked', self.sugar_accel_group,
                               gtk.keysyms.Escape, 0, 0)
        button.set_tooltip_text(_('Cancel stop and continue the activity'))

        alert.connect('realize', self.__stop_dialog_realize_cb)
        alert.connect('response', self.__stop_dialog_response_cb)
        alert.entry.connect('changed', self.__stop_dialog_changed_cb, alert)
        self.add_alert(alert)
        alert.show()
Esempio n. 9
0
    def okAlert(self, title, msg, callback):
        self.alert = Alert()
        icon = Icon(icon_name='dialog-ok')
        self.alert.add_button(gtk.RESPONSE_OK, _('_Ok'), icon)

        self.alert.props.title = title
        self.alert.props.msg = msg

        self.alert.connect('response', callback)
        self.myAct.add_alert(self.alert)
Esempio n. 10
0
 def _alert(self, title, text=None):
     try:
         self.remove_alert(self.alert)
     finally:
         self.alert = Alert()
         self.alert.props.title = title
         self.alert.props.msg = text
         self.add_alert(self.alert)
         self.alert.connect('response', self._alert_cancel_cb)
         self.alert.show()
Esempio n. 11
0
    def _shared_cb(self, activity):
        self._logger.debug('My activity was shared')
        self.alert = Alert()
        self.alert.props.title = 'Shared Activity'
        self.alert.props.msg = 'Shared messages to be displayed here'
        self.add_alert(self.alert)
        self.initiating = True
        self._sharing_setup()

        self._logger.debug('This is my activity: making a tube...')
        id = self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].OfferDBusTube(
            SERVICE, {})
Esempio n. 12
0
    def _show_keep_failed_dialog(self):
        alert = Alert()
        alert.props.title = _('Keep error')
        alert.props.msg = _('Keep error: all changes will be lost')

        cancel_icon = Icon(icon_name='dialog-cancel')
        alert.add_button(gtk.RESPONSE_CANCEL, _('Don\'t stop'), cancel_icon)

        stop_icon = Icon(icon_name='dialog-ok')
        alert.add_button(gtk.RESPONSE_OK, _('Stop anyway'), stop_icon)

        self.add_alert(alert)
        alert.connect('response', self._keep_failed_dialog_response_cb)

        self.reveal()
Esempio n. 13
0
    def _saved_dsobject_alert(self, dsobject):
        saved_alert = Alert()
        saved_alert.props.title = _('Download completed')
        saved_alert.props.msg = dsobject.metadata['title']
        saved_alert.add_button(gtk.RESPONSE_APPLY, _('Show in Journal'),
                               Icon(icon_name='zoom-activity'))
        saved_alert.add_button(gtk.RESPONSE_OK, _('Ok'),
                               Icon(icon_name='dialog-ok'))

        def response_cb(alert, response_id):
            if response_id is gtk.RESPONSE_APPLY:
                activity.show_object_in_journal(dsobject.object_id)
            self.remove_alert(alert)

        saved_alert.connect('response', response_cb)
        self.add_alert(saved_alert)
        saved_alert.show_all()
Esempio n. 14
0
    def __erase_activated_cb(self, tree_view, bundle_id):
        registry = bundleregistry.get_registry()
        activity_info = registry.get_bundle(bundle_id)

        alert = Alert()
        alert.props.title = _('Confirm erase')
        alert.props.msg = \
                _('Confirm erase: Do you want to permanently erase %s?') \
                % activity_info.get_name()

        cancel_icon = Icon(icon_name='dialog-cancel')
        alert.add_button(gtk.RESPONSE_CANCEL, _('Keep'), cancel_icon)

        erase_icon = Icon(icon_name='dialog-ok')
        alert.add_button(gtk.RESPONSE_OK, _('Erase'), erase_icon)

        alert.connect('response', self.__erase_confirmation_dialog_response_cb,
                      bundle_id)

        self.add_alert(alert)
Esempio n. 15
0
    def _show_keep_failed_dialog(self):
        '''
        A keep error means the activity write_file method raised an
        exception before writing the file, or the datastore cannot be
        written to.
        '''
        alert = Alert()
        alert.props.title = _('Keep error')
        alert.props.msg = _('Keep error: all changes will be lost')

        cancel_icon = Icon(icon_name='dialog-cancel')
        alert.add_button(gtk.RESPONSE_CANCEL, _('Don\'t stop'), cancel_icon)

        stop_icon = Icon(icon_name='dialog-ok')
        alert.add_button(gtk.RESPONSE_OK, _('Stop anyway'), stop_icon)

        self.add_alert(alert)
        alert.connect('response', self.__keep_failed_dialog_response_cb)

        self.reveal()
Esempio n. 16
0
    def show_software_updates_alert(self):
        alert = Alert()
        updater_icon = Icon(icon_name='module-updater',
                            pixel_size=style.STANDARD_ICON_SIZE)
        alert.props.icon = updater_icon
        updater_icon.show()
        alert.props.title = _('Software Update')
        alert.props.msg = _('Update your activities to ensure'
                            ' compatibility with your new software')

        cancel_icon = Icon(icon_name='dialog-cancel')
        alert.add_button(gtk.RESPONSE_CANCEL, _('Cancel'), cancel_icon)

        alert.add_button(gtk.RESPONSE_REJECT, _('Later'))

        erase_icon = Icon(icon_name='dialog-ok')
        alert.add_button(gtk.RESPONSE_OK, _('Check now'), erase_icon)

        if self._list_view in self.get_children():
            self._list_view.add_alert(alert)
        else:
            self._favorites_view.add_alert(alert)
        alert.connect('response', self.__software_update_response_cb)
Esempio n. 17
0
class Numbers:
    timeout = 0
    hasOp = True
    oldSign = 0
    lifes = 2
    difScore = 0
    difText = ''
    score = 0
    rounds = 0
    player = ''
    alert = Alert()

    def __init__(self, runAsLib=True):
        self.builder = gtk.Builder()
        self.builder.add_from_file('num.ui')
        self.window = self.builder.get_object('numWindow')
        self.menuView = self.builder.get_object('menuView')
        self.lbTitle = self.builder.get_object('lbTitle')
        self.lbSubt = self.builder.get_object('lbSubt')
        self.btnEasy = self.builder.get_object('btnEasy')
        self.btnHard = self.builder.get_object('btnHard')
        self.btnMed = self.builder.get_object('btnMed')
        self.scoreView = self.builder.get_object('scoreView')
        self.scoreMain = self.builder.get_object('scoreMain')
        self.lbScore = self.builder.get_object('lbScore')
        self.scoreList = self.builder.get_object('scoreList')
        self.nameView = self.builder.get_object('nameView')
        self.txtPlayer = self.builder.get_object('txtPlayer')
        self.gameView = self.builder.get_object('gameView')
        self.lbNum1 = self.builder.get_object('lbNum1')
        self.lbNum2 = self.builder.get_object('lbNum2')
        self.lbSign = self.builder.get_object('lbSign')
        self.lbEqual = self.builder.get_object('lbEqual')
        self.txtRes = self.builder.get_object('txtRes')
        self.lbMsg = self.builder.get_object('lbMsg')
        self.imgCheck = self.builder.get_object('imgCheck')
        self.pBar = self.builder.get_object('progressBar')
        self.btnCalc = self.builder.get_object('btnCalc')
        self.btnNext = self.builder.get_object('btnNext')
        self.lifeBox = self.builder.get_object('lifeBox')
        self.modelScore = listView(self.scoreList)
        self.widget = self.window.get_child()

        gtk.rc_parse_string("""
			style "mystyle"
				{
					font_name = "sans 30"
				}
			class 'GtkEntry' style 'mystyle' 
		""")

        self.lbLife = [gtk.Label(), gtk.Label(), gtk.Label(), gtk.Label()]
        i = 0
        for label in self.lifeBox.get_children():
            self.lbLife[i] = label
            self.pangoLabel(self.lbLife[i], self.rgbToPango(153, 84, 244), 2)
            i += 1

        self.markMe(self.btnCalc)
        self.markMe(self.btnNext)
        self.pangoLabel(self.lbNum1, self.rgbToPango(29, 97, 252), 5)
        self.pangoLabel(self.lbNum2, self.rgbToPango(227, 126, 0), 5)
        self.pangoLabel(self.lbSign, self.rgbToPango(255, 0, 0), 5)
        self.pangoLabel(self.lbEqual, self.rgbToPango(145, 225, 36), 5)
        self.forceLocales()

        self.builder.connect_signals(self)
        self.alert.hide()

        if not runAsLib:
            self.window.show_all()

        dbPath = '%s/.MathMe.db' % path.expanduser('~')
        dbExists = False
        if path.isfile(dbPath):
            dbExists = True
        self.dataCon = sqlite3.connect(dbPath)
        self.dataCursor = self.dataCon.cursor()
        initDb = 'create table mathMe (player text, score int, rounds int, difficulty text);'
        if not dbExists:
            self.dataCursor.execute(initDb)

    def numbers_term(self, widget, data=0):
        gtk.main_quit()

    def numbers_calcOp(self, widget):
        if not self.hasOp:
            self.lbMsg.set_label(' ')
            num1 = int(self.lbNum1.get_label())
            num2 = int(self.lbNum2.get_label())
            sign = self.lbSign.get_label()
            res = 0.0

            try:
                txRes = int(self.txtRes.get_text())
                if sign == '+':
                    res = num1 + num2
                    pointFactor = 1 + self.difScore
                elif sign == '-':
                    res = num1 - num2
                    pointFactor = 1 + self.difScore
                elif sign == '×':
                    res = num1 * num2
                    pointFactor = 2 + self.difScore
                elif sign == '÷':
                    res = num1 / num2
                    pointFactor = 2 + self.difScore

                if (txRes == res):
                    self.sendMsg(True)
                    self.score += pointFactor
                else:
                    self.sendMsg(False, res)

                self.rounds += 1
                self.btnNext.grab_focus()
            except ValueError:
                if self.txtRes.get_text() != '':
                    self.lbMsg.set_label(
                        self.pangoMark('purple', 'white',
                                       _('Insert numbers, not letters')))
                    self.txtRes.set_text('')
                    self.txtRes.grab_focus()

    def numbers_oper(self, widget=gtk.Widget):
        self.imgCheck.clear()
        self.lbMsg.set_label('')
        num1 = randint(1, 10)
        num2 = randrange(1, 10)
        newSign = randint(1, 4)
        sign = ''

        if self.lifes < 0 and self.hasOp:
            widget = self.txtPlayer
            widget.grab_focus()
            self.showScore(self.gameView, True)
            self.gameView.set_sensitive(False)
        else:
            widget = self.txtRes

        while newSign == self.oldSign:
            newSign = randrange(1, 4)

        self.oldSign = newSign

        if newSign == 1:
            sign = '+'
        elif newSign == 2:
            sign = '-'
        elif newSign == 3:
            sign = '×'
        elif newSign == 4:
            sign = '÷'

        if (self.hasOp):
            if sign == '÷':
                while num1 % num2 != 0 or num1 == num2 or (num1 == 1
                                                           or num2 == 1):
                    num1 = randint(1, 10)
                    num2 = randrange(1, 10)
            elif sign == '-':
                while num1 < num2 or num1 == num2:
                    num1 = randint(1, 10)
                    num2 = randrange(1, 10)
            self.lbNum1.set_label(str(num1))
            self.lbNum2.set_label(str(num2))
            self.lbSign.set_label(sign)
            self.txtRes.set_text('')
            self.hasOp = False
        else:
            self.lbMsg.set_label(
                self.pangoMark('#095DF0', 'white',
                               _('Type the result, then press calculate')))
        widget.grab_focus()
        timeout_add(self.timeout, self.setProgress)

    def numbers_txtActivate(self, widget):
        if widget.get_text() != '':
            self.btnCalc.grab_focus()

    def numbers_chDiff(self, action):
        actionN = action.get_name()
        if actionN == 'easy':
            self.timeout = 100
            self.difScore = 1
            self.difText = unicode(_('Easy'))
        elif actionN == 'medium':
            self.timeout = 50
            self.difScore = 2
            self.difText = unicode(_('Medium'))
            print _('Medium')
        elif actionN == 'hard':
            self.timeout = 25
            self.difScore = 3
            self.difText = unicode(_('Hard'))

        self.gameView.show()
        self.gameView.set_sensitive(True)
        self.menuView.hide()
        self.numbers_oper()

    def numbers_savePlayer(self, widget, respid=0):
        self.myAct.remove_alert(self.alert)
        self.scoreMain.show()
        self.player = unicode(self.txtPlayer.get_text())
        #Saving Data
        self.dataCursor.execute(
            'INSERT INTO mathMe (player, score, rounds, difficulty) VALUES (?, ?, ?, ?)',
            (self.player, self.score, self.rounds, self.difText))
        self.dataCon.commit()
        #Filling listView
        self.fillScore()

        self.okAlert(_('To start a New Game press Ok'), '',
                     self.numbers_setScore)
        self.nameView.hide()

    def numbers_setScore(self, widget, respid=0):
        self.myAct.remove_alert(self.alert)
        self.initLifes()

    def showScore(self, widget, internal=False):
        widget.hide()
        self.scoreView.show()
        if internal:
            self.scoreMain.hide()
            self.nameView.show()
            self.txtPlayer.grab_focus()
            self.okAlert(_('Game Over'), '', self.numbers_savePlayer)
        else:
            self.fillScore()
            self.scoreMain.show()
            self.nameView.hide()
            self.okAlert(_('To go back press Ok'), '', self.numbers_setScore)

    def numbers_actEnd(self, widget):
        self.dataCon.commit()
        self.dataCursor.close()
        self.dataCon.close()

    def markMe(self, widget, data=0):
        widgetLabel = widget.get_child()
        foreg = self.rgbToPango(153, 38, 244)
        self.pangoLabel(widgetLabel, foreg, 1.5)

    def sendMsg(self, isRight, res=0):
        if isRight:
            self.lbMsg.set_label(
                self.pangoMark('#4DC406', 'white', _('Great!')))
            self.imgCheck.set_from_file('icons/face-laugh.png')
        else:
            if (self.lifes < 0):
                self.lbMsg.set_label(
                    '<span foreground = "white" background = "purple" size = "x-large">  %s <b>%d  </b>, %s</span>'
                    % (_('The result is:'), res, _('Game Over')))
            else:
                self.lbMsg.set_label(
                    '<span foreground = "white" background = "orange" size = "x-large">  %s <b>%d  </b></span>'
                    % (_('The result is:'), res))
            self.imgCheck.set_from_file('icons/face-sad.png')
            self.lbLife[self.lifes].set_label(' ')
            self.lifes -= 1

        self.hasOp = True

    def setProgress(self):
        fraction = self.pBar.get_fraction()
        fraction += 0.01
        if not self.hasOp:
            if fraction < 1:
                self.pBar.set_fraction(fraction)
            else:
                if self.txtRes.get_text() == '':
                    self.txtRes.set_text('0')
                self.numbers_calcOp(self.btnCalc)
                self.pBar.set_fraction(0.0)
        else:
            self.pBar.set_fraction(0.0)

        return not self.hasOp

    def initLifes(self):
        i = 0
        while i < 3:
            self.lbLife[i].set_label('☺')
            i += 1

        self.gameView.hide()
        self.scoreView.hide()
        self.menuView.show()
        self.pBar.set_fraction(0)
        self.btnEasy.grab_focus()
        self.lifes = 3
        self.score = 0
        self.rounds = 0

    def forceLocales(self):
        #This nasty function is needed due to lack of doc how-to localize a GtkBuilder activity
        btnScore = self.builder.get_object('btnScore')
        btnScoreOk = self.builder.get_object('btnScoreOk')
        btnScMainOk = self.builder.get_object('btnScMainOk')
        lbScore = self.builder.get_object('lbScore')
        lbPlayer = self.builder.get_object('lbPlayer')

        self.lbTitle.set_label(_('New Game'))
        self.pangoLabel(self.lbTitle, (0, 0, 0), 3)
        self.lbSubt.set_label(_('Choose difficulty'))
        self.pangoLabel(self.lbSubt, (0, 0, 0), 1.5)
        self.btnEasy.set_label(_('_Easy'))
        self.btnMed.set_label(_('_Medium'))
        self.btnHard.set_label(_('_Hard'))
        self.btnNext.set_label(_('_Next'))
        self.btnCalc.set_label(_('_Calculate'))
        btnScore.set_label(_('_Score'))
        btnScMainOk.set_label(_('Ok'))
        btnScoreOk.set_label(_('_Ok'))
        lbScore.set_label(_('Score'))
        self.pangoLabel(lbScore, (0, 0, 0), 3)
        lbPlayer.set_label(_('Write Your Name'))
        self.pangoLabel(lbPlayer, (0, 0, 0), 3)

    def pangoLabel(self, label, fg, scale):
        atr = pango.AttrList()
        foreg = pango.AttrForeground(fg[0], fg[1], fg[2], 0, 100)
        scale = pango.AttrScale(scale, 0, 100)
        atr.insert(foreg)
        atr.insert(scale)
        label.set_attributes(atr)

    def pangoMark(self, bg, fg, content):
        return '<span foreground = "%s" background = "%s" size = "x-large">  %s  </span>' % (
            fg, bg, content)

    def rgbToPango(self, r, g, b):
        r = (r * 65535) / 255
        g = (g * 65535) / 255
        b = (b * 65535) / 255

        return (r, g, b)

    def fillScore(self):
        self.dataCursor.execute(
            'SELECT * FROM mathMe ORDER BY score COLLATE NOCASE DESC')
        self.modelScore.clear()
        for row in self.dataCursor:
            self.modelScore.append(row)

    def okAlert(self, title, msg, callback):
        self.alert = Alert()
        icon = Icon(icon_name='dialog-ok')
        self.alert.add_button(gtk.RESPONSE_OK, _('_Ok'), icon)

        self.alert.props.title = title
        self.alert.props.msg = msg

        self.alert.connect('response', callback)
        self.myAct.add_alert(self.alert)

    def setActivity(self, act):
        self.myAct = act