Source

controlcenter / widgets / message.py

#!/usr/bin/env python

#    This file is part of controlcenter.
#
#    controlcenter is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License v2 as published by
#    the Free Software Foundation.
#
#    controlcenter is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with controlcenter.  If not, see <http://www.gnu.org/licenses/>.
import gtk

def _(str): return str

class Error(gtk.MessageDialog):
    def __init__(self, parent=None, text=None):
        gtk.MessageDialog.__init__(self, type=gtk.MESSAGE_ERROR, parent=parent,
        buttons = gtk.BUTTONS_OK)
        self.set_property('text', text)
        self.set_property('title', _('Error'))
    
class Warning(gtk.MessageDialog):
    def __init__(self, parent=None, text=None):
        gtk.MessageDialog.__init__(self, type=gtk.MESSAGE_WARNING, parent=parent,
        buttons=gtk.BUTTONS_OK)
        self.set_property('text', text)
        self.set_property('title', _('Warning'))
        
class Info(gtk.MessageDialog):
    def __init__(self, parent=None, text=None):
        gtk.MessageDialog.__init____(self, type=gtk.MESSAGE_INFO, parent=parent,
        buttons = gtk.BUTTONS_OK)
        self.set_property('title', _('Info'))
        self.set_property('text', text)

class Question(gtk.MessageDialog):
    def __init__(self, parent=None, text=None):
        gtk.MessageDialog.__init__(self, type=gtk.MESSAGE_QUESTION, parent=parent,
        buttons=gtk.BUTTONS_YES_NO)
        self.set_property('title', _('Question'))
        self.set_property('text', text)




if __name__ == '__main__':
    box = Question(text='Questiiion')
    if box.run():
        box.hide()