source: projects/pygtk-rpminstall/trunk/src/dependdialog.py @ 5093

Revision 5093, 2.1 KB checked in by yasumichi, 12 years ago (diff)

fixed gettext related.

Line 
1# dependdialog.py
2#
3# Copyright (C) 2011 - Yasumichi Akahoshi
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18from gi.repository import Gtk, GdkPixbuf, Gdk
19import os, sys, rpm
20
21UI_FILE = "ui/dependdialog.ui"
22
23class DependDialog:
24        def __init__(self, unresolved_dependencies):
25                self.builder = Gtk.Builder()
26                self.builder.set_translation_domain('rpminstall')
27                self.builder.add_from_file(os.path.join (os.path.dirname(__file__), UI_FILE))
28                self.builder.connect_signals(self)
29                self.build_depend_listview()
30                depend_liststore = self.builder.get_object('depend_liststore')
31                for tup in unresolved_dependencies:
32                        object_package = '-'.join(tup[0])
33                        depend_package = '-'.join(tup[1])
34                        if tup[3] == rpm.RPMDEP_SENSE_CONFLICTS:
35                                reason = _("Conflict")
36                        elif tup[3] == rpm.RPMDEP_SENSE_REQUIRES:
37                                reason = _("Requires")
38                        else:
39                                reason = _("Unknown")
40                        depend_liststore.append([object_package, depend_package, reason])
41
42        def build_depend_listview(self):
43                depend_listview = self.builder.get_object('depend_listview')
44                index = 0
45                for column_title in [_("Object Package"), _("Depend Package"), _("Reason")]:
46                        column_text = Gtk.TreeViewColumn(column_title)
47                        renderer_text = Gtk.CellRendererText()
48                        column_text.pack_start(renderer_text, True)
49                        column_text.add_attribute(renderer_text, "text", index)
50                        index += 1
51                        depend_listview.append_column(column_text)
52
53        def run(self):
54                self.dialog = self.builder.get_object('dialog1')
55                self.dialog.run()
56
57        def ok(self, widget):
58                self.dialog.destroy()
Note: See TracBrowser for help on using the repository browser.