source: projects/pygtk-rpminstall/trunk/src/installed.py @ 5107

Revision 5107, 1.8 KB checked in by yasumichi, 12 years ago (diff)

check installed version.

Line 
1# installed.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/installed.ui"
22
23class InstalledDialog:
24        def __init__(self, newer_installed):
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_installed_listview()
30                installed_liststore = self.builder.get_object('installed_liststore')
31                for tup in newer_installed:
32                        installed_liststore.append(tup)
33
34        def build_installed_listview(self):
35                installed_listview = self.builder.get_object('installed_listview')
36                index = 0
37                for column_title in [_("Package Name"), _("Object Version"), _("Installed version")]:
38                        column_text = Gtk.TreeViewColumn(column_title)
39                        renderer_text = Gtk.CellRendererText()
40                        column_text.pack_start(renderer_text, True)
41                        column_text.add_attribute(renderer_text, "text", index)
42                        index += 1
43                        installed_listview.append_column(column_text)
44
45        def run(self):
46                self.dialog = self.builder.get_object('dialog1')
47                self.dialog.set_modal(True)
48                self.dialog.run()
49
50        def ok(self, widget):
51                self.dialog.destroy()
Note: See TracBrowser for help on using the repository browser.