~ubuntu-branches/ubuntu/trusty/pitivi/trusty

« back to all changes in this revision

Viewing changes to pitivi/ui/filelisterrordialog.py

  • Committer: Bazaar Package Importer
  • Author(s): Loic Minier
  • Date: 2007-01-31 15:32:37 UTC
  • mto: (3.2.1 hardy) (1.2.1 upstream) (6.1.1 sid)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20070131153237-de4p8lipjv8x5x3b
Tags: upstream-0.10.2
ImportĀ upstreamĀ versionĀ 0.10.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# PiTiVi , Non-linear video editor
 
2
#
 
3
#       ui/filelisterrordialog.py
 
4
#
 
5
# Copyright (c) 2005, Edward Hervey <bilboed@bilboed.com>
 
6
#
 
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.
 
11
#
 
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.
 
16
#
 
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.
 
21
 
 
22
"""
 
23
Dialog box listing files which had errors, and the reasons.
 
24
"""
 
25
 
 
26
import gobject
 
27
import gtk
 
28
import gst
 
29
import pango
 
30
from glade import GladeWindow
 
31
 
 
32
from gettext import gettext as _
 
33
 
 
34
class FileListErrorDialog(GladeWindow):
 
35
    """ Dialog box for showing errors in a list of files """
 
36
    glade_file = "filelisterrordialog.glade"
 
37
    __gsignals__ = {
 
38
        'close': (gobject.SIGNAL_RUN_LAST,
 
39
                  gobject.TYPE_NONE,
 
40
                  ( )),
 
41
        'response': (gobject.SIGNAL_RUN_LAST,
 
42
                     gobject.TYPE_NONE,
 
43
                     (gobject.TYPE_PYOBJECT, ))
 
44
        }
 
45
 
 
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)
 
53
        self._setUpTreeView()
 
54
 
 
55
    def _setUpTreeView(self):
 
56
        self.storemodel = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
 
57
        self.treeview.set_model(self.storemodel)
 
58
 
 
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)
 
64
 
 
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)
 
70
 
 
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
 
74
        discovered
 
75
        """
 
76
        gst.debug("Uri:%s, reason:%s" % (uri, reason))
 
77
        self.storemodel.append([str(uri), str(reason)])
 
78
 
 
79
    def isVisible(self):
 
80
        """ returns True if this dialog is currently shown """
 
81
        return self.window.get_property("visible")
 
82
 
 
83
    ## Callbacks from glade
 
84
 
 
85
    def _closeCb(self, unused_dialog):
 
86
        self.emit('close')
 
87
 
 
88
    def _responseCb(self, unused_dialog, response):
 
89
        self.emit('response', response)