aboutsummaryrefslogtreecommitdiff
blob: bd22c1e282b2d0a24c4ec382f355e54c41b3450c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"""

    This file is part of the Ventoo program.

    This is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    It 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 this software.  If not, see <http://www.gnu.org/licenses/>.

    Copyright 2010 Christopher Harvey

"""

import sys
import os.path as osp
import pygtk
pygtk.require('2.0')
import gtk
import augeas_utils

class ErrorDialog(gtk.Dialog):
    def __init__(self, errorDict):
        gtk.Dialog.__init__(self, "Error dialog", None,
                            gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
                            (gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
        self.set_default_size(400,300)
        errorScroll = gtk.ScrolledWindow()
        errorBox = gtk.TextView()
        errorBox.set_editable(False)
        errorScroll.add(errorBox)
        errorScroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        self.vbox.pack_start(errorScroll)
        errorBuf = errorBox.get_buffer()
        for k, v in errorDict.iteritems():
            errorBuf.insert_at_cursor(k + " -> " + v + "\n")