/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz
0.8.13 by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
1
# Copyright (C) 2006 by Szilveszter Farkas (Phanatic) <szilveszter.farkas@gmail.com>
0.8.46 by Szilveszter Farkas (Phanatic)
Modified OliveDialog class interface; huge cleanups.
2
#
0.8.13 by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
0.8.46 by Szilveszter Farkas (Phanatic)
Modified OliveDialog class interface; huge cleanups.
7
#
0.8.13 by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
0.8.46 by Szilveszter Farkas (Phanatic)
Modified OliveDialog class interface; huge cleanups.
12
#
0.8.13 by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
734.1.1 by Curtis Hovey
Mechanical changes made by pygi.convert.sh.
17
from gi.repository import Gtk
18
19
20
def _message_dialog(type, primary, secondary, parent=None, buttons=Gtk.ButtonsType.OK):
89 by Jelmer Vernooij
Rename OliveBranch -> BranchDialog.
21
    """ Display a given type of MessageDialog with the given message.
724 by Jelmer Vernooij
Fix formatting, imports.
22
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
23
    :param type: message dialog type
724 by Jelmer Vernooij
Fix formatting, imports.
24
89 by Jelmer Vernooij
Rename OliveBranch -> BranchDialog.
25
    :param message: the message you want to display.
26
    """
734.1.4 by Curtis Hovey
Updated commit to gtk3.
27
    dialog = Gtk.MessageDialog(parent=parent, flags=Gtk.DialogFlags.MODAL,
28
                               type=type, buttons=buttons)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
29
    dialog.set_markup('<big><b>' + primary + '</b></big>')
714.1.1 by Edward Ari Bichetero
Stop crashes when bzr errors include markup-like text (that is not valid markup).
30
    dialog.format_secondary_text(secondary)
66.3.1 by v.ladeuil+lp at free
Fix #73737. Check empty message at commit time.
31
    response = dialog.run()
32
    dialog.destroy()
33
    return response
0.13.3 by Jelmer Vernooij
Start removing dialog context (it's not required).
34
576.1.1 by Jasper Groenewegen
Add parent setting to dialogs and implement in gcommit
35
def error_dialog(primary, secondary, parent=None):
89 by Jelmer Vernooij
Rename OliveBranch -> BranchDialog.
36
    """ Display an error dialog with the given message. """
734.1.1 by Curtis Hovey
Mechanical changes made by pygi.convert.sh.
37
    return _message_dialog(Gtk.MessageType.ERROR, primary, secondary, parent)
0.13.3 by Jelmer Vernooij
Start removing dialog context (it's not required).
38
576.1.1 by Jasper Groenewegen
Add parent setting to dialogs and implement in gcommit
39
def info_dialog(primary, secondary, parent=None):
89 by Jelmer Vernooij
Rename OliveBranch -> BranchDialog.
40
    """ Display an info dialog with the given message. """
734.1.1 by Curtis Hovey
Mechanical changes made by pygi.convert.sh.
41
    return _message_dialog(Gtk.MessageType.INFO, primary, secondary, parent)
0.13.3 by Jelmer Vernooij
Start removing dialog context (it's not required).
42
576.1.1 by Jasper Groenewegen
Add parent setting to dialogs and implement in gcommit
43
def warning_dialog(primary, secondary, parent=None):
89 by Jelmer Vernooij
Rename OliveBranch -> BranchDialog.
44
    """ Display a warning dialog with the given message. """
734.1.1 by Curtis Hovey
Mechanical changes made by pygi.convert.sh.
45
    return _message_dialog(Gtk.MessageType.WARNING, primary, secondary, parent)
66.3.1 by v.ladeuil+lp at free
Fix #73737. Check empty message at commit time.
46
576.1.1 by Jasper Groenewegen
Add parent setting to dialogs and implement in gcommit
47
def question_dialog(primary, secondary, parent=None):
66.3.1 by v.ladeuil+lp at free
Fix #73737. Check empty message at commit time.
48
    """ Display a dialog with the given question. """
734.1.1 by Curtis Hovey
Mechanical changes made by pygi.convert.sh.
49
    return _message_dialog(Gtk.MessageType.QUESTION, primary, secondary, parent, Gtk.ButtonsType.YES_NO)