vpackager / src / vpackager / message.py

#!/usr/bin/env python

#    This file is part of vpackager.
#
#    vpackager 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.
#
#    vpackager 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 vpackager.  If not, see <http://www.gnu.org/licenses/>.


import gtk

__author__ = 'M0E-lnx'
__author_email__ = 'moc.liamg@xnl.E0M'[::-1]
__version__ = '0.1'


def _(str):
    return str

class Error(gtk.MessageDialog):
    ''' Generic gtk error message '''
    def __init__(self, text, parent=None):
        gtk.MessageDialog.__init__(self, parent = parent,
            type = gtk.MESSAGE_ERROR,
            buttons = gtk.BUTTONS_OK)
        self.set_markup(text)
        self.set_title(_('Error'))

class Question(gtk.MessageDialog):
    """ Question dialog that can return a gtk.RESPONSE_OK value"""
    def __init__(self, text, parent=None):
        gtk.MessageDialog.__init__(self, parent = parent,
                type = gtk.MESSAGE_QUESTION,
                buttons = gtk.BUTTONS_YES_NO)
        self.set_markup(text)
        self.set_title(_('Question'))

class Info(gtk.MessageDialog):
    """ Informational dialog message."""
    def __init__(self, text, parent=None):
        gtk.MessageDialog.__init__(self, parent=parent,
                type = gtk.MESSAGE_INFO,
                buttons = gtk.BUTTONS_OK)
        self.set_markup(text)
        self.set_title(_('For Your Information'))

class Warning(gtk.MessageDialog):
    """ Warning dialog box."""
    def __init__(self, text, parent = None):
        gtk.MessageDialog.__init__(self, parent = parent,
                type = gtk.MESSAGE_WARNING,
                buttons = gtk.BUTTONS_OK)
        self.set_markup(text)
        self.set_title(_('Warning'))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.