1
# PiTiVi , Non-linear video editor
3
# ui/filelisterrordialog.py
5
# Copyright (c) 2005, Edward Hervey <bilboed@bilboed.com>
7
# This program is free software; you can redistribute it and/or
8
# modify it under the terms of the GNU Lesser General Public
9
# License as published by the Free Software Foundation; either
10
# version 2.1 of the License, or (at your option) any later version.
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
# Lesser General Public License for more details.
17
# You should have received a copy of the GNU Lesser General Public
18
# License along with this program; if not, write to the
19
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20
# Boston, MA 02111-1307, USA.
23
Dialog box listing files which had errors, and the reasons.
30
from glade import GladeWindow
32
from gettext import gettext as _
34
class FileListErrorDialog(GladeWindow):
35
""" Dialog box for showing errors in a list of files """
36
glade_file = "filelisterrordialog.glade"
38
'close': (gobject.SIGNAL_RUN_LAST,
41
'response': (gobject.SIGNAL_RUN_LAST,
43
(gobject.TYPE_PYOBJECT, ))
46
def __init__(self, title, headline):
47
GladeWindow.__init__(self)
48
self.window.set_modal(False)
49
self.widgets["headline"].set_text(headline)
50
self.window.set_title(title)
51
self.treeview = self.widgets["treeview"]
52
self.window.set_geometry_hints(min_width=400, min_height=300)
55
def _setUpTreeView(self):
56
self.storemodel = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
57
self.treeview.set_model(self.storemodel)
59
txtcell = gtk.CellRendererText()
60
txtcell.set_property("ellipsize", pango.ELLIPSIZE_START)
61
uricol = gtk.TreeViewColumn(_("File"), txtcell, text=0)
62
uricol.set_expand(True)
63
self.treeview.append_column(uricol)
65
txtcell2 = gtk.CellRendererText()
66
txtcell2.set_property("ellipsize", pango.ELLIPSIZE_END)
67
reasoncol = gtk.TreeViewColumn(_("Reason"), txtcell2, text=1)
68
reasoncol.set_expand(True)
69
self.treeview.append_column(reasoncol)
71
def addFailedFile(self, uri, reason=_("Unknown reason")):
72
"""Add the given uri to the list of failed files. You can optionnaly
73
give a string identifying the reason why the file failed to be
76
gst.debug("Uri:%s, reason:%s" % (uri, reason))
77
self.storemodel.append([str(uri), str(reason)])
80
""" returns True if this dialog is currently shown """
81
return self.window.get_property("visible")
83
## Callbacks from glade
85
def _closeCb(self, unused_dialog):
88
def _responseCb(self, unused_dialog, response):
89
self.emit('response', response)