# installed.py # # Copyright (C) 2011 - Yasumichi Akahoshi # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 program. If not, see . from gi.repository import Gtk, GdkPixbuf, Gdk import os, sys, rpm UI_FILE = "ui/installed.ui" class InstalledDialog: def __init__(self, newer_installed): self.builder = Gtk.Builder() self.builder.set_translation_domain('rpminstall') self.builder.add_from_file(os.path.join (os.path.dirname(__file__), UI_FILE)) self.builder.connect_signals(self) self.build_installed_listview() installed_liststore = self.builder.get_object('installed_liststore') for tup in newer_installed: installed_liststore.append(tup) def build_installed_listview(self): installed_listview = self.builder.get_object('installed_listview') index = 0 for column_title in [_("Package Name"), _("Object Version"), _("Installed version")]: column_text = Gtk.TreeViewColumn(column_title) renderer_text = Gtk.CellRendererText() column_text.pack_start(renderer_text, True) column_text.add_attribute(renderer_text, "text", index) index += 1 installed_listview.append_column(column_text) def run(self): self.dialog = self.builder.get_object('dialog1') self.dialog.set_modal(True) self.dialog.run() def ok(self, widget): self.dialog.destroy()