1
# -*- coding: utf-8 -*-
2
#############################################
3
# Rafael Proença <cypherbios@ubuntu.com>
4
# Laudeci Oliveira <laudeci@gmail.com>
6
# Copyright 2006 APTonCD DevTeam.
8
# This program is free software; you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published
10
# by the Free Software Foundation; version 2 only.
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
15
# GNU General Public License for more details.
16
#############################################
19
from APTonCD.core import gui
20
from APTonCD.core import constants
21
from APTonCD.core.package import DebPackage
23
WINDOW_NAME = 'pkgProperties'
27
Class to show a property info from selected package
29
def __init__(self, package, controller = None, pixbuf = None):
33
self.glade = gui.get_glade(constants.PROPERTY_GUI, WINDOW_NAME)
34
self.package = package
36
self.window = gui.get_widget(self.glade, WINDOW_NAME)
37
self.window.set_title(" %s " % self.package.package + constants.MESSAGE_0072)
40
self.window.set_transient_for(controller.get_main_window())
48
Setup the user interface.
50
gui.get_widget(self.glade, 'lblPackage').set_text(self.package.package)
51
gui.get_widget(self.glade, 'lblVersion').set_text(self.package.version)
53
# FIXME: Use this method to show the lblStatus
54
# for a more verbose and elegant label
55
#compare = DebPackage()
56
#status = compare.compare_version(self.package.version)
59
# gui.get_widget(self.glade, 'lblStatus').set_text("This package is the same as the installed")
61
# gui.get_widget(self.glade, 'lblStatus').set_text("An older version is installed")
63
# gui.get_widget(self.glade, 'lblStatus').set_text("A later version is already installed")
65
# gui.get_widget(self.glade, 'lblStatus').set_text("This package is not installed")
67
if self.package.installed == True:
68
gui.get_widget(self.glade, 'lblStatus').set_text(constants.MESSAGE_0058)
70
gui.get_widget(self.glade, 'lblStatus').set_text(constants.MESSAGE_0059)
72
gui.get_widget(self.glade, 'lblFilename').set_text(self.package.deb_filename)
73
gui.get_widget(self.glade, 'lblSize').set_text(self.package.size_text)
75
if self.package.custom == True:
76
gui.get_widget(self.glade, 'lblCustom').set_text(constants.MESSAGE_0060)
78
gui.get_widget(self.glade, 'lblCustom').set_text(constants.MESSAGE_0061)
80
gui.get_widget(self.glade, 'lblDescription').set_text(self.package.short_description)
82
textview = gui.get_widget(self.glade, 'txtvwDesc').get_buffer()
83
textview.set_text(self.package.long_description)
86
gui.get_widget(self.glade, 'imgPackage').set_from_pixbuf(self.pixbuf)
87
gui.get_widget(self.glade,'button1').connect('clicked', self.on_click)
89
def on_click(self, widget):