Entropy/Spritz:
- get rid of the applet from here, splitting... git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@2255 cd1c1023-2f26-0410-ae45-c471fc1f0318
@@ -1,4 +1,4 @@
|
||||
SUBDIRS = src src/etpgui src/applet
|
||||
SUBDIRS = src src/etpgui
|
||||
PYFILES = $(wildcard *.py)
|
||||
PKGNAME = spritz
|
||||
VERSION=$(shell awk '/Version:/ { print $$2 }' ${PKGNAME}.spec)
|
||||
@@ -6,7 +6,7 @@ PYTHON=python
|
||||
SRCDIR=src
|
||||
MISCDIR=misc
|
||||
PIXDIR=gfx
|
||||
ALLDIRS=src src/etpgui gfx misc tools src/applet
|
||||
ALLDIRS=src src/etpgui gfx misc tools
|
||||
|
||||
all: subdirs
|
||||
|
||||
@@ -20,7 +20,6 @@ clean:
|
||||
install:
|
||||
mkdir -p $(DESTDIR)/usr/lib/entropy/spritz
|
||||
mkdir -p $(DESTDIR)/usr/share/pixmaps/spritz/packages
|
||||
mkdir -p $(DESTDIR)/usr/share/pixmaps/spritz/applet
|
||||
mkdir -p $(DESTDIR)/usr/share/applications
|
||||
mkdir -p $(DESTDIR)/usr/share/mimelnk/application
|
||||
mkdir -p $(DESTDIR)/usr/share/mime/packages
|
||||
@@ -31,19 +30,13 @@ install:
|
||||
mkdir -p $(DESTDIR)/etc/pam.d
|
||||
install -m644 COPYING $(DESTDIR)/usr/lib/entropy/spritz/.
|
||||
install -m755 $(MISCDIR)/spritz $(DESTDIR)/usr/bin/.
|
||||
install -m755 $(MISCDIR)/etp-applet-gui $(DESTDIR)/usr/bin/.
|
||||
install -m644 $(PIXDIR)/*.png $(DESTDIR)/usr/share/pixmaps/spritz/.
|
||||
install -m644 $(PIXDIR)/packages/*.png $(DESTDIR)/usr/share/pixmaps/spritz/packages/.
|
||||
install -m644 $(PIXDIR)/applet/*.png $(DESTDIR)/usr/share/pixmaps/spritz/applet/.
|
||||
install -m644 $(PIXDIR)/entropy-applet.png $(DESTDIR)/usr/share/pixmaps/.
|
||||
install -m644 $(MISCDIR)/spritz.pam $(DESTDIR)/etc/pam.d/spritz
|
||||
install -m644 $(MISCDIR)/kde_x-spritz.desktop $(DESTDIR)/usr/share/mimelnk/application/.
|
||||
install -m644 $(MISCDIR)/entropy-mimetypes.xml $(DESTDIR)/usr/share/mime/packages/.
|
||||
chmod +x $(DESTDIR)/usr/bin/spritz
|
||||
chmod +x $(DESTDIR)/usr/bin/etp-applet-gui
|
||||
install -m644 $(MISCDIR)/*.desktop $(DESTDIR)/usr/share/applications/.
|
||||
install -m644 $(MISCDIR)/etp-applet.desktop $(DESTDIR)/usr/share/autostart/.
|
||||
install -m644 $(MISCDIR)/etp-applet.desktop $(DESTDIR)/etc/xdg/autostart/.
|
||||
for d in $(SUBDIRS); do make DESTDIR=`cd $(DESTDIR); pwd` -C $$d install; [ $$? = 0 ] || exit 1; done
|
||||
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 916 B |
@@ -1,2 +0,0 @@
|
||||
#!/bin/bash
|
||||
python /usr/lib/entropy/spritz/applet/applet.py "$@"
|
||||
@@ -1,9 +0,0 @@
|
||||
[Desktop Entry]
|
||||
_Name=Entropy Alert Icon
|
||||
_Comment=Panel icon for indication that newer Entropy packages are available
|
||||
Icon=entropy-applet.png
|
||||
Exec=etp-applet-gui
|
||||
Type=Application
|
||||
Terminal=false
|
||||
Encoding=UTF-8
|
||||
Categories=System;Application;
|
||||
@@ -6,7 +6,6 @@ all:
|
||||
clean:
|
||||
rm -fv *.pyc *.pyo *~ *.bak *.gladep
|
||||
rm -fv etpgui/*.pyc etpgui/*.pyo etpgui/*~
|
||||
rm -fv applet/*.pyc etpgui/*.pyo applet/*~
|
||||
|
||||
install:
|
||||
mkdir -p $(DESTDIR)/usr/lib/entropy/spritz
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
PYTHON=python
|
||||
PACKAGE = $(shell basename `pwd`)
|
||||
PYFILES = $(wildcard *.py)
|
||||
PKGDIR = /usr/lib/entropy/spritz/applet
|
||||
|
||||
all:
|
||||
echo "Nothing to do"
|
||||
|
||||
clean:
|
||||
rm -f *.pyc *.pyo *~
|
||||
|
||||
install:
|
||||
mkdir -p $(DESTDIR)/$(PKGDIR)
|
||||
for p in $(PYFILES) ; do \
|
||||
install -m 755 $$p $(DESTDIR)/$(PKGDIR)/$$p; \
|
||||
done
|
||||
install -m 644 *.glade $(DESTDIR)/$(PKGDIR)
|
||||
$(PYTHON) -c "import compileall; compileall.compile_dir('$(DESTDIR)/$(PKGDIR)', 1, '$(PYDIR)', 1)"
|
||||
@@ -1,41 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
#
|
||||
# This file is a portion of the Red Hat Network Panel Applet
|
||||
#
|
||||
# Copyright (C) 1999-2002 Red Hat, Inc. All Rights Reserved.
|
||||
# Distributed under GPL version 2.
|
||||
#
|
||||
# $Id: applet.py,v 1.10 2003/09/15 15:07:19 veillard Exp $
|
||||
|
||||
import sys
|
||||
import signal
|
||||
sys.path.insert(0,'/usr/lib/entropy/client')
|
||||
sys.path.insert(0,'/usr/lib/entropy/libraries')
|
||||
sys.path.insert(0,'../../../client')
|
||||
sys.path.insert(0,'../../../libraries')
|
||||
sys.path.insert(0,'/usr/lib/entropy/spritz')
|
||||
sys.path.insert(0,'../')
|
||||
sys.argv.append('--no-pid-handling')
|
||||
|
||||
try:
|
||||
os.nice(10)
|
||||
except:
|
||||
pass
|
||||
|
||||
import etp_applet
|
||||
def child_reaper(*args):
|
||||
try:
|
||||
while os.waitpid(-1, os.WNOHANG):
|
||||
pass
|
||||
except:
|
||||
pass
|
||||
|
||||
def main():
|
||||
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
||||
signal.signal(signal.SIGCHLD, child_reaper)
|
||||
applet = etp_applet.rhnApplet()
|
||||
applet.run()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
||||
<!--*- mode: xml -*-->
|
||||
<glade-interface>
|
||||
<widget class="GtkDialog" id="notice_window_2">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">Package Manager Notification Window</property>
|
||||
<property name="window_position">GTK_WIN_POS_CENTER</property>
|
||||
<property name="default_width">600</property>
|
||||
<property name="default_height">300</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||
<child internal-child="vbox">
|
||||
<widget class="GtkVBox" id="dialog-vbox3">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">8</property>
|
||||
<child>
|
||||
<widget class="GtkNotebook" id="notice_notebook">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="scrollable">True</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox2">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="checklist_window">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="update_clist">
|
||||
<property name="visible">True</property>
|
||||
<property name="headers_clickable">True</property>
|
||||
<property name="reorderable">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label7">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Available Updates</property>
|
||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">tab</property>
|
||||
<property name="tab_fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child internal-child="action_area">
|
||||
<widget class="GtkHButtonBox" id="dialog-action_area3">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||
<child>
|
||||
<widget class="GtkButton" id="button9">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="has_default">True</property>
|
||||
<property name="response_id">0</property>
|
||||
<signal name="clicked" handler="on_launch_spritz_clicked"/>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment1">
|
||||
<property name="visible">True</property>
|
||||
<property name="xscale">0</property>
|
||||
<property name="yscale">0</property>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox4">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<widget class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-apply</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label8">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Load Package Manager</property>
|
||||
<property name="use_underline">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="button10">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-close</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="response_id">0</property>
|
||||
<signal name="clicked" handler="on_close_clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="pack_type">GTK_PACK_END</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</glade-interface>
|
||||
@@ -1,923 +0,0 @@
|
||||
# This file is a portion of the Red Hat Network Panel Applet
|
||||
#
|
||||
# Copyright (C) 1999-2002 Red Hat, Inc. All Rights Reserved.
|
||||
# Distributed under GPL version 2.
|
||||
#
|
||||
# Author: Chip Turner
|
||||
#
|
||||
# def help added by Tammy Fox
|
||||
#
|
||||
# $Id: rhn_applet.py,v 1.114 2003/11/09 16:56:33 veillard Exp $
|
||||
|
||||
import gnome
|
||||
import gnome.ui
|
||||
# from msw to avoid odd bugs in some pygtk builds
|
||||
try:
|
||||
from gtk import _disable_gdk_threading
|
||||
_disable_gdk_threading()
|
||||
except ImportError:
|
||||
pass
|
||||
import gtk
|
||||
import gobject
|
||||
import gtk.gdk
|
||||
import egg.trayicon
|
||||
import pynotify
|
||||
|
||||
import subprocess
|
||||
import os
|
||||
import sys
|
||||
import math
|
||||
import traceback
|
||||
import time
|
||||
import threading
|
||||
|
||||
import etp_applet_animation
|
||||
from etp_applet_dialogs import \
|
||||
rhnAppletNoticeWindow, \
|
||||
rhnRegistrationPromptDialog, \
|
||||
rhnAppletAboutWindow, \
|
||||
rhnAppletFirstTimeDruid, \
|
||||
rhnAppletErrorDialog, \
|
||||
rhnAppletExceptionDialog
|
||||
import etp_applet_config
|
||||
from etpgui import busyCursor,normalCursor,ProcessGtkEventsThread
|
||||
|
||||
# Entropy imports
|
||||
from entropyConstants import *
|
||||
import exceptionTools, entropyTools
|
||||
from entropy import EquoInterface, RepoInterface, urlFetcher
|
||||
from entropy_i18n import _
|
||||
|
||||
class Entropy(EquoInterface):
|
||||
|
||||
def __init__(self):
|
||||
EquoInterface.__init__(self, noclientdb = True)
|
||||
self.nocolor()
|
||||
|
||||
def connect_progress_objects(self, appletInterface):
|
||||
self.appletInterface = appletInterface
|
||||
self.progress_tooltip = self.appletInterface.update_tooltip
|
||||
self.progress_widget = self.appletInterface.tooltip
|
||||
self.updateProgress = self.appletUpdateProgress
|
||||
self.progress_tooltip_message_title = _("Updates Notification")
|
||||
self.appletCreateNotification()
|
||||
#self.progress_tooltip_notification_timer = None
|
||||
#gobject.timeout_add(1000, self.appletCreateNotification)
|
||||
self.urlFetcher = GuiUrlFetcher
|
||||
self.progress = self.appletPrintText # for the GuiUrlFetcher
|
||||
self.applet_last_message = ''
|
||||
|
||||
|
||||
def appletSetCoordinates(self):
|
||||
self.appletX,self.appletY = self.appletInterface.get_tray_coordinates()
|
||||
self.progress_tooltip_notification.set_hint("x", self.appletX+11)
|
||||
self.progress_tooltip_notification.set_hint("y", self.appletY+11)
|
||||
|
||||
def appletCreateNotification(self):
|
||||
pynotify.init("XY")
|
||||
self.progress_tooltip_notification = pynotify.Notification(self.progress_tooltip_message_title,"Hello world")
|
||||
self.progress_tooltip_notification.set_timeout(3000)
|
||||
self.appletSetCoordinates()
|
||||
|
||||
def appletUpdateProgress(self, text, header = "", footer = "", back = False, importance = 0, type = "info", count = [], percent = False):
|
||||
|
||||
count_str = ""
|
||||
if count:
|
||||
if percent:
|
||||
count_str = str(int(round((float(count[0])/count[1])*100,1)))+"% "
|
||||
else:
|
||||
count_str = "(%s/%s) " % (str(count[0]),str(count[1]),)
|
||||
|
||||
message = count_str+_(text)
|
||||
#if importance in (1,2):
|
||||
if importance == 2:
|
||||
self.progress_tooltip_message_title = message
|
||||
self.appletPrintText(self.applet_last_message)
|
||||
else:
|
||||
self.appletPrintText(message)
|
||||
|
||||
def appletPrintText(self, message):
|
||||
self.appletSetCoordinates()
|
||||
self.progress_tooltip_notification.update(self.progress_tooltip_message_title,message)
|
||||
self.progress_tooltip_notification.show()
|
||||
self.applet_last_message = message
|
||||
|
||||
class GuiUrlFetcher(urlFetcher):
|
||||
|
||||
def connect_to_gui(self, progress):
|
||||
self.progress = progress
|
||||
|
||||
def updateProgress(self):
|
||||
self.gather = self.downloadedsize
|
||||
message = "Fetching data %s/%s kB @ %s" % (
|
||||
str(round(float(self.downloadedsize)/1024,1)),
|
||||
str(round(self.remotesize,1)),
|
||||
str(self.entropyTools.bytesIntoHuman(self.datatransfer))+"/sec",
|
||||
)
|
||||
self.progress(message)
|
||||
|
||||
class rhnApplet:
|
||||
|
||||
def set_state(self, new_state, use_busy_icon = 0):
|
||||
if not new_state in etp_applet_config.APPLET_STATES:
|
||||
raise exceptionTools.IncorrectParameter("Error: invalid state %s" % new_state)
|
||||
|
||||
if self.refresh_timeout_tag and new_state not in [ "OKAY", "CRITICAL" ]:
|
||||
raise exceptionTools.IncorrectParameter("Error: can't switch to state %s while refresh timer is on" % new_state)
|
||||
|
||||
if new_state == "OKAY":
|
||||
self.animate_to("okay")
|
||||
elif new_state == "BUSY":
|
||||
if use_busy_icon:
|
||||
self.set_displayed_image("busy")
|
||||
elif new_state == "CRITICAL":
|
||||
if self.never_viewed_notices:
|
||||
self.animate_to("critical", "critical-blank")
|
||||
else:
|
||||
self.set_displayed_image("critical")
|
||||
elif new_state == "NOCONSENT":
|
||||
if self.never_viewed_consent:
|
||||
self.animate_to("noconsent", "noconsent-blank")
|
||||
else:
|
||||
self.set_displayed_image("noconsent")
|
||||
elif new_state == "DISCONNECTED":
|
||||
self.animate_to("disconnect")
|
||||
elif new_state == "ERROR":
|
||||
self.animate_to("error")
|
||||
|
||||
self.current_state = new_state
|
||||
|
||||
|
||||
def __init__(self):
|
||||
|
||||
# this must be done before !!
|
||||
self.destroyed = 0
|
||||
self.isWorking = False
|
||||
self.tooltip_text = ""
|
||||
gnome.program_init("spritz-updater", etpConst['entropyversion'])
|
||||
self.tooltip = gtk.Tooltips()
|
||||
self.applet_window = egg.trayicon.TrayIcon("spritz-updater")
|
||||
self.applet_window.connect("destroy", self.exit_applet)
|
||||
|
||||
#
|
||||
# Cope with a change in the Gnome python bindings naming
|
||||
#
|
||||
try:
|
||||
self.session = gnome.ui.gnome_master_client()
|
||||
except:
|
||||
self.session = gnome.ui.master_client()
|
||||
if self.session:
|
||||
gtk.Object.connect(self.session, "save-yourself",
|
||||
self.save_yourself)
|
||||
gtk.Object.connect(self.session, "die", self.exit_applet)
|
||||
|
||||
self.consent = {}
|
||||
self.never_viewed_consent = 1
|
||||
self.never_viewed_notices = 1
|
||||
|
||||
self.skip_check_locked = False
|
||||
self.current_image = None
|
||||
self.refresh_timeout_tag = None
|
||||
self.animate_timeout_tag = None
|
||||
self.current_state = None
|
||||
self.old_critical_text = None
|
||||
self.network_timeout_tag = None
|
||||
|
||||
self.icons = etp_applet_animation.rhnAppletIconPixbuf()
|
||||
|
||||
self.icons.add_file("okay", "applet-okay.png")
|
||||
self.icons.add_file("error", "applet-error.png")
|
||||
self.icons.add_file("busy", "applet-busy.png")
|
||||
self.icons.add_file("critical", "applet-critical.png")
|
||||
self.icons.add_file("critical-blank", "applet-critical-blank.png")
|
||||
self.icons.add_file("noconsent", "applet-critical.png")
|
||||
self.icons.add_file("noconsent-blank", "applet-critical-blank.png")
|
||||
self.icons.add_file("disconnect", "applet-disconnect.png")
|
||||
self.icons.add_file("spritz","spritz.png")
|
||||
self.icons.add_file("about","applet-about.png")
|
||||
self.icons.add_file("web","applet-web.png")
|
||||
self.icons.add_file("configuration","applet-configuration.png")
|
||||
self.applet_size = 22
|
||||
|
||||
menu_items = (
|
||||
("disable_applet", _("_Disable Notification Applet"), _("Disable Notification Applet"), self.disable_applet),
|
||||
("enable_applet", _("_Enable Notification Applet"), _("Enable Notification Applet"), self.enable_applet),
|
||||
("check_now", _("_Check for updates"), _("Check for updates"), self.update_from_server),
|
||||
("update_now", _("_Launch Package Manager"), _("Launch Package Manager"), self.launch_package_manager),
|
||||
("web_panel", _("_Packages Website"), _("Use Packages web interface"), self.load_packages_url),
|
||||
("web_site", _("_Sabayon Linux Website"), _("Launch Sabayon Linux Website"), self.load_website),
|
||||
None,
|
||||
("about", _("_About"), _("About..."), self.about),
|
||||
("exit", _("_Exit"), _("Exit"), self.exit_applet),
|
||||
)
|
||||
|
||||
self.menu = gtk.Menu()
|
||||
self.menu_items = {}
|
||||
for i in menu_items:
|
||||
if i is None:
|
||||
self.menu.add(gtk.SeparatorMenuItem())
|
||||
else:
|
||||
sid = None
|
||||
myid = i[0]
|
||||
if myid == "exit":
|
||||
sid = "gtk-quit"
|
||||
if sid:
|
||||
w = gtk.ImageMenuItem(stock_id = sid)
|
||||
else:
|
||||
w = gtk.ImageMenuItem(i[1])
|
||||
self.set_menu_image(w, myid)
|
||||
self.menu_items[myid] = w
|
||||
w.connect('activate', i[3])
|
||||
w.show()
|
||||
self.menu.add(w)
|
||||
|
||||
self.menu.show_all()
|
||||
|
||||
self.event_box = gtk.EventBox()
|
||||
self.image_widget = gtk.Image()
|
||||
self.event_box.add(self.image_widget)
|
||||
self.event_box.set_events(gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.POINTER_MOTION_MASK | gtk.gdk.POINTER_MOTION_HINT_MASK | gtk.gdk.CONFIGURE)
|
||||
|
||||
self.image_widget.show()
|
||||
self.event_box.connect("button_press_event", self.applet_face_click)
|
||||
self.image_widget.connect('destroy', self.on_destroy)
|
||||
|
||||
self.applet_window.add(self.event_box)
|
||||
self.applet_window.show_all()
|
||||
|
||||
self.animator = None
|
||||
self.client = None
|
||||
self.notice_window = None
|
||||
self.rhnreg_dialog = None
|
||||
self.error_dialog = None
|
||||
self.error_threshold = 0
|
||||
self.about_window = None
|
||||
self.last_error = None
|
||||
self.last_error_is_exception = 0
|
||||
self.last_error_is_network_error = 0
|
||||
self.change_number = 0
|
||||
self.available_packages = []
|
||||
self.last_alert = None
|
||||
|
||||
self.gtkEventThread = ProcessGtkEventsThread()
|
||||
self.gtkEventThread.start()
|
||||
|
||||
hide_menu = False
|
||||
message = ''
|
||||
workdir_perms_issue = False
|
||||
if os.path.isdir(etpConst['entropyworkdir']):
|
||||
gid = os.stat(etpConst['entropyworkdir'])[5]
|
||||
if gid != etpConst['entropygid']:
|
||||
workdir_perms_issue = True
|
||||
|
||||
permitted = entropyTools.is_user_in_entropy_group()
|
||||
if not permitted:
|
||||
hide_menu = True
|
||||
message = "%s: %s" % (_("You must add yourself to this group"),etpConst['sysgroup'],)
|
||||
elif workdir_perms_issue:
|
||||
hide_menu = True
|
||||
message = _("Please run Equo/Spritz as root to update Entropy permissions")
|
||||
else:
|
||||
# first refresh should be 2 minutes after execution; this
|
||||
# should give the rest of the user's desktop environment time
|
||||
# to load, etc, and avoid competing with nautilus or whatever
|
||||
# else is loading. subsequent intervals will be much larger.
|
||||
self.set_state("OKAY")
|
||||
self.enable_refresh_timer(50000)
|
||||
|
||||
# Entropy initialization
|
||||
self.Entropy = Entropy()
|
||||
self.Entropy.connect_progress_objects(self)
|
||||
|
||||
if etp_applet_config.settings['APPLET_ENABLED']:
|
||||
self.enable_applet()
|
||||
else:
|
||||
self.disable_applet()
|
||||
|
||||
if hide_menu:
|
||||
self.disable_refresh_timer()
|
||||
self.set_state("ERROR")
|
||||
self.update_tooltip(message)
|
||||
for key in self.menu_items:
|
||||
if key in ['exit','web_site','about','web_panel','update_now']:
|
||||
continue
|
||||
w = self.menu_items[key]
|
||||
w.set_sensitive(False)
|
||||
w.hide()
|
||||
|
||||
def get_tray_coordinates(self):
|
||||
"""
|
||||
get the trayicon coordinates to send to
|
||||
notification-daemon
|
||||
trayicon=egg.trayicon.TrayIcon
|
||||
return : [x,y]
|
||||
"""
|
||||
trayicon = self.applet_window
|
||||
coordinates = trayicon.window.get_origin()
|
||||
size = trayicon.window.get_size()
|
||||
screen = trayicon.window.get_screen()
|
||||
screen_height = screen.get_height()
|
||||
if coordinates[1] <= screen_height/2:
|
||||
y=coordinates[1]+size[1]/2
|
||||
else:
|
||||
y=coordinates[1]-size[1]/2
|
||||
msg_xy=[coordinates[0],y]
|
||||
return tuple(msg_xy)
|
||||
|
||||
def set_menu_image(self, widget, name):
|
||||
img = gtk.Image()
|
||||
if name == "update_now":
|
||||
pix = self.icons.best_match("spritz",22)
|
||||
elif name == "about":
|
||||
pix = self.icons.best_match("about",22)
|
||||
elif name in ["web_panel","web_site"]:
|
||||
pix = self.icons.best_match("web",22)
|
||||
elif name == "configure_applet":
|
||||
pix = self.icons.best_match("configuration",22)
|
||||
elif name == "disable_applet":
|
||||
pix = self.icons.best_match("disconnect",22)
|
||||
elif name == "enable_applet":
|
||||
pix = self.icons.best_match("okay",22)
|
||||
else:
|
||||
pix = self.icons.best_match("busy",22)
|
||||
|
||||
img.set_from_pixbuf(pix)
|
||||
widget.set_image(img)
|
||||
|
||||
def enable_refresh_timer(self, when = etp_applet_config.settings['REFRESH_INTERVAL'] * 1000, force = 0):
|
||||
#if self.current_state not in [ "OKAY", "CRITICAL" ]:
|
||||
# return
|
||||
if not self.refresh_timeout_tag:
|
||||
self.refresh_timeout_tag = gobject.timeout_add(when, self.refresh_handler, force)
|
||||
|
||||
def disable_refresh_timer(self):
|
||||
if self.refresh_timeout_tag:
|
||||
gobject.source_remove(self.refresh_timeout_tag)
|
||||
self.refresh_timeout_tag = None
|
||||
|
||||
def handle_gtk_events(self):
|
||||
while gtk.events_pending():
|
||||
gtk.main_iteration(False)
|
||||
|
||||
def refresh_callback(self):
|
||||
self.handle_gtk_events()
|
||||
|
||||
def start_working(self):
|
||||
self.isWorking = True
|
||||
busyCursor(self.applet_window)
|
||||
self.gtkEventThread.startProcessing()
|
||||
|
||||
def end_working(self):
|
||||
self.isWorking = False
|
||||
normalCursor(self.applet_window)
|
||||
self.gtkEventThread.endProcessing()
|
||||
|
||||
def on_do_draw(self, *data):
|
||||
self.redraw()
|
||||
|
||||
def on_bg_change(self, *data):
|
||||
self.redraw()
|
||||
|
||||
def on_size_allocate(self, *data):
|
||||
self.redraw()
|
||||
|
||||
def on_configure(self, widget, event):
|
||||
if event.type == gtk.gdk.CONFIGURE:
|
||||
self.redraw()
|
||||
|
||||
def animate_stop(self):
|
||||
self.disable_animation_timer()
|
||||
|
||||
# not animating? then our current image is correct
|
||||
if self.animator:
|
||||
self.set_displayed_image(self.animator.final_frame)
|
||||
self.animator = None
|
||||
|
||||
self.redraw()
|
||||
|
||||
def disable_animation_timer(self):
|
||||
if self.animate_timeout_tag:
|
||||
gobject.source_remove(self.animate_timeout_tag)
|
||||
self.animate_timeout_tag = None
|
||||
|
||||
def animate_handler(self, *data):
|
||||
next_frame = self.animator.next_frame()
|
||||
if not next_frame:
|
||||
self.disable_animation_timer()
|
||||
return False
|
||||
|
||||
self.current_image = next_frame
|
||||
self.redraw()
|
||||
|
||||
return True
|
||||
|
||||
def animate_to(self, image, cycle_image = None):
|
||||
|
||||
# logic: one way animation? then we skip this if we're asked
|
||||
# to animate to the same, and let it finish. if it's a cycle,
|
||||
# and the start and end images are the same, then we also just
|
||||
# continue
|
||||
|
||||
if self.current_image == image:
|
||||
if cycle_image:
|
||||
if self.animation_cycle == cycle_image:
|
||||
return
|
||||
else:
|
||||
return
|
||||
|
||||
if self.current_image:
|
||||
from_image = self.current_image.copy()
|
||||
else:
|
||||
from_image = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, 1, 8, self.applet_size, self.applet_size)
|
||||
from_image.fill(0)
|
||||
|
||||
to_image = self.icons.best_match(image, self.applet_size)
|
||||
|
||||
frames = etp_applet_animation.alpha_tween(from_image, to_image, 16)
|
||||
|
||||
self.animator = etp_applet_animation.rhnAppletAnimation()
|
||||
|
||||
# if we're already in the to_image state, let's just start cycling
|
||||
if self.current_image != to_image or cycle_image:
|
||||
self.animator.append_frames(frames)
|
||||
|
||||
if cycle_image:
|
||||
cycle_frames = []
|
||||
|
||||
to_image = self.icons.best_match(image, self.applet_size)
|
||||
from_image = self.icons.best_match(cycle_image, self.applet_size)
|
||||
cycle_frames = etp_applet_animation.alpha_tween(to_image, from_image, 16)
|
||||
|
||||
self.animator.append_cycle(cycle_frames)
|
||||
|
||||
if not self.animate_timeout_tag:
|
||||
self.animate_timeout_tag = gobject.timeout_add(int(math.floor(1000 * etp_applet_config.settings['ANIMATION_TOTAL_TIME']/len(frames))), self.animate_handler)
|
||||
|
||||
self.animate_handler()
|
||||
|
||||
def set_displayed_image(self, image):
|
||||
if type(image) == type(""):
|
||||
new_image = self.icons.best_match(image, self.applet_size)
|
||||
else:
|
||||
new_image = image
|
||||
|
||||
self.disable_animation_timer()
|
||||
|
||||
self.current_image = new_image
|
||||
self.redraw()
|
||||
|
||||
def redraw(self):
|
||||
if not self.current_image:
|
||||
return
|
||||
|
||||
self.image_widget.set_from_pixbuf(self.current_image)
|
||||
|
||||
def on_destroy(self, *data):
|
||||
self.destroyed = 1
|
||||
self.disable_refresh_timer()
|
||||
self.disable_animation_timer()
|
||||
|
||||
def load_packages_url(self, *data):
|
||||
try:
|
||||
gnome.url_show("http://packages.sabayonlinux.org/")
|
||||
except gobject.GError:
|
||||
self.load_browser("http://packages.sabayonlinux.org/")
|
||||
|
||||
def load_website(self, *data):
|
||||
try:
|
||||
gnome.url_show("http://www.sabayonlinux.org/")
|
||||
except gobject.GError:
|
||||
self.load_browser("http://www.sabayonlinux.org/")
|
||||
|
||||
def load_browser(self, url):
|
||||
browser = None
|
||||
konq_ret = subprocess.call("which konqueror &> /dev/null", shell = True)
|
||||
if os.access("/usr/bin/firefox",os.X_OK):
|
||||
browser = "/usr/bin/firefox"
|
||||
elif konq_ret:
|
||||
browser = "konqueror"
|
||||
elif os.access("/usr/bin/opera",os.X_OK):
|
||||
browser = "/usr/bin/opera"
|
||||
if browser:
|
||||
subprocess.call([browser,url])
|
||||
|
||||
def disable_applet(self, *data):
|
||||
self.update_tooltip(_("Updates Notification Applet Disabled"))
|
||||
self.disable_refresh_timer()
|
||||
self.set_state("DISCONNECTED")
|
||||
etp_applet_config.settings['APPLET_ENABLED'] = 0
|
||||
etp_applet_config.save_settings(etp_applet_config.settings)
|
||||
self.menu_items['disable_applet'].hide()
|
||||
self.menu_items['enable_applet'].show()
|
||||
|
||||
|
||||
|
||||
def enable_applet(self, *data):
|
||||
self.update_tooltip(_("Updates Notification Applet Enabled"))
|
||||
self.enable_refresh_timer()
|
||||
self.set_state("OKAY")
|
||||
etp_applet_config.settings['APPLET_ENABLED'] = 1
|
||||
etp_applet_config.save_settings(etp_applet_config.settings)
|
||||
self.menu_items['disable_applet'].show()
|
||||
self.menu_items['enable_applet'].hide()
|
||||
|
||||
|
||||
def launch_package_manager(self, *data):
|
||||
pid = os.fork()
|
||||
if not pid:
|
||||
pid2 = os.fork()
|
||||
if not pid2:
|
||||
os.execv('/usr/bin/spritz', ['spritz'])
|
||||
os.perror(_("Cannot load Spritz"))
|
||||
else:
|
||||
os._exit(-1)
|
||||
|
||||
def show_alert(self, title, text, urgency = None):
|
||||
|
||||
if (title,text) == self.last_alert:
|
||||
return
|
||||
|
||||
pynotify.init("XY")
|
||||
n = pynotify.Notification(title, text)
|
||||
if urgency == 'critical':
|
||||
n.set_urgency(pynotify.URGENCY_CRITICAL)
|
||||
elif urgency == 'low':
|
||||
n.set_urgency(pynotify.URGENCY_LOW)
|
||||
|
||||
x,y = self.get_tray_coordinates()
|
||||
n.set_hint("x", x+11)
|
||||
n.set_hint("y", y+11)
|
||||
self.last_alert = (title,text)
|
||||
n.show()
|
||||
|
||||
def compare_repositories_status(self):
|
||||
repos = {}
|
||||
try:
|
||||
repoConn = RepoInterface(self.Entropy, list(etpRepositories), noEquoCheck = True)
|
||||
except exceptionTools.MissingParameter:
|
||||
return repos,1 # no repositories specified
|
||||
except exceptionTools.OnlineMirrorError:
|
||||
return repos,2 # not connected ??
|
||||
except Exception, e:
|
||||
return repos,str(e) # unknown error
|
||||
# now get remote
|
||||
for repoid in etpRepositories:
|
||||
if repoConn.is_repository_updatable(repoid):
|
||||
self.Entropy.repository_move_clear_cache(repoid)
|
||||
repos[repoid] = {}
|
||||
repos[repoid]['local_revision'] = self.Entropy.get_repository_revision(repoid)
|
||||
repos[repoid]['remote_revision'] = repoConn.get_online_repository_revision(repoid)
|
||||
|
||||
return repos, 0
|
||||
|
||||
# every N seconds we poke the model to see if anything has
|
||||
# changed. changes can be new package lists from the server, the
|
||||
# rpmdb being updated, etc. the model caches aggressively, so
|
||||
# this isn't expensive. this is done asynchronous to all GUI
|
||||
# updates, to try to avoid stalling the UI
|
||||
def refresh_handler(self, force = 0):
|
||||
self.refresh(force)
|
||||
|
||||
def refresh(self, force=0):
|
||||
|
||||
if not etp_applet_config.settings['APPLET_ENABLED']:
|
||||
return
|
||||
|
||||
locked = self.Entropy.application_lock_check(silent = True)
|
||||
|
||||
self.start_working()
|
||||
old_tip = self.tooltip_text
|
||||
old_state = self.current_state
|
||||
|
||||
self.disable_refresh_timer()
|
||||
self.disable_network_timer()
|
||||
|
||||
self.set_state("BUSY", use_busy_icon = force)
|
||||
self.update_tooltip(_("Checking for updates..."))
|
||||
self.handle_gtk_events()
|
||||
self.last_error = None
|
||||
self.last_error_is_network_error = 0
|
||||
self.error_threshold = 0
|
||||
self.available_packages = []
|
||||
|
||||
rc = 0
|
||||
if not locked:
|
||||
|
||||
# compare repos
|
||||
repositories_to_update, rc = self.compare_repositories_status()
|
||||
if repositories_to_update and rc == 0:
|
||||
repos = repositories_to_update.keys()
|
||||
|
||||
try:
|
||||
repoConn = self.Entropy.Repositories(repos, fetchSecurity = False, noEquoCheck = True)
|
||||
except exceptionTools.MissingParameter:
|
||||
self.last_error = "%s: %s" % (_("No repositories specified in"),etpConst['repositoriesconf'],)
|
||||
self.error_threshold += 1
|
||||
except exceptionTools.OnlineMirrorError:
|
||||
self.last_error = _("Repository Network Error")
|
||||
self.last_error_is_network_error = 1
|
||||
except Exception, e:
|
||||
self.error_threshold += 1
|
||||
self.last_error_is_exception = 1
|
||||
self.last_error = "%s: %s" % (_('Unhandled exception'),e,)
|
||||
else:
|
||||
# -128: sync error, something bad happened
|
||||
# -2: repositories not available (all)
|
||||
# -1: not able to update all the repositories
|
||||
rc = repoConn.sync()
|
||||
rc = rc*-1
|
||||
|
||||
if rc == 1:
|
||||
err = _("No repositories specified. Cannot check for package updates.")
|
||||
self.show_alert( _("Updates: attention"), err )
|
||||
self.error_threshold += 1
|
||||
self.last_error = err
|
||||
elif rc == 2:
|
||||
err = _("Cannot connect to the Updates Service, you're probably not connected to the world.")
|
||||
self.show_alert( _("Updates: connection issues"), err )
|
||||
self.last_error_is_network_error = 1
|
||||
self.last_error = err
|
||||
elif rc == -1:
|
||||
err = _("Not all the repositories have been fetched for checking")
|
||||
self.show_alert( _("Updates: repository issues"), err )
|
||||
self.last_error_is_network_error = 1
|
||||
self.last_error = err
|
||||
elif rc == -2:
|
||||
err = _("No repositories found online")
|
||||
self.show_alert( _("Updates: repository issues"), err )
|
||||
self.last_error_is_network_error = 1
|
||||
self.last_error = err
|
||||
elif rc == -128:
|
||||
err = _("Synchronization errors. Cannot update repositories. Check logs.")
|
||||
self.show_alert( _("Updates: sync issues"), err )
|
||||
self.error_threshold += 1
|
||||
self.last_error = err
|
||||
elif type(rc) is str:
|
||||
self.show_alert( _("Updates: unhandled error"), rc )
|
||||
self.error_threshold += 1
|
||||
self.last_error_is_exception = 1
|
||||
self.last_error = rc
|
||||
|
||||
if self.last_error_is_network_error:
|
||||
self.update_tooltip(_("Updates: connection issues"))
|
||||
self.set_state("DISCONNECTED")
|
||||
self.disable_refresh_timer()
|
||||
self.enable_network_timer()
|
||||
self.end_working()
|
||||
return False
|
||||
|
||||
try:
|
||||
update, remove, fine = self.Entropy.calculate_world_updates()
|
||||
del fine, remove
|
||||
except Exception, e:
|
||||
msg = "%s: %s" % (_("Updates: error"),e,)
|
||||
self.show_alert(msg)
|
||||
self.error_threshold += 1
|
||||
self.last_error_is_exception = 1
|
||||
self.last_error = str(e)
|
||||
|
||||
if self.last_error:
|
||||
self.disable_refresh_timer()
|
||||
msg = "%s: %s" % (_("Updates issue:"),self.last_error,)
|
||||
self.update_tooltip(msg)
|
||||
self.set_state("ERROR")
|
||||
self.end_working()
|
||||
return False
|
||||
|
||||
if rc == 0:
|
||||
self.update_tooltip(old_tip)
|
||||
|
||||
# it is possible that the applet was destroyed during the time it
|
||||
# took to update the model. If the applet is gone, bail now.
|
||||
if self.destroyed:
|
||||
self.end_working()
|
||||
return False
|
||||
|
||||
if update:
|
||||
self.available_packages = update[:]
|
||||
self.set_state("CRITICAL")
|
||||
msg = "%s %d %s" % (_("There are"),len(update),_("updates available."),)
|
||||
self.update_tooltip(msg)
|
||||
self.show_alert( _("Updates available"),
|
||||
msg,
|
||||
urgency = 'critical'
|
||||
)
|
||||
if self.notice_window:
|
||||
self.refresh_notice_window()
|
||||
|
||||
else:
|
||||
self.set_state(old_state)
|
||||
self.update_tooltip(_("So far, so good. w00t!"))
|
||||
self.show_alert( _("Everything up-to-date"),
|
||||
_("So far, so good. w00t!"),
|
||||
urgency = 'low'
|
||||
)
|
||||
|
||||
self.disable_refresh_timer()
|
||||
self.enable_refresh_timer()
|
||||
self.end_working()
|
||||
return True
|
||||
|
||||
#
|
||||
# Detection and handling of network related errors, the
|
||||
# server may be unreachable, or refusing connections, quite
|
||||
# common in case of laptops. If such an error is detected
|
||||
# the applet will try to retry the connections after a timeout
|
||||
# of etp_applet_config.settings['NETWORK_RETRY_INTERVAL'] seconds (one minute)
|
||||
# until it suceeeds reaching the server and then exit the
|
||||
# DISCONNECTED state
|
||||
#
|
||||
def is_network_error(self, msg):
|
||||
# print "is_network_error: '%s'" % (msg)
|
||||
if msg.find("SysCallError") >= 0 and msg.find("104") >= 0:
|
||||
return 1
|
||||
if msg.find("onnection") >= 0:
|
||||
return 1
|
||||
if msg.find("etwork") >= 0:
|
||||
return 1
|
||||
if msg.find("certificate verify failed") >= 0:
|
||||
return 0
|
||||
if msg.find("SSL") >= 0:
|
||||
return 1
|
||||
return 0
|
||||
|
||||
def network_retry_handler(self, force):
|
||||
self.refresh(force)
|
||||
|
||||
def enable_network_timer(self, when = etp_applet_config.settings['NETWORK_RETRY_INTERVAL'] * 1000, force = 0):
|
||||
if self.current_state != "DISCONNECTED":
|
||||
raise "Can't enable network timer unless in DISCONNECTED state"
|
||||
if not self.network_timeout_tag:
|
||||
self.network_timeout_tag = gobject.timeout_add(when, self.network_retry_handler, force)
|
||||
|
||||
def disable_network_timer(self):
|
||||
if self.network_timeout_tag:
|
||||
gobject.source_remove(self.network_timeout_tag)
|
||||
self.network_timeout_tag = None
|
||||
|
||||
def update_tooltip(self, tip):
|
||||
self.tooltip_text = tip
|
||||
self.tooltip.set_tip(self.applet_window, tip)
|
||||
|
||||
def update_from_server(self, widget=None):
|
||||
self.enable_applet()
|
||||
self.refresh(force = 1)
|
||||
|
||||
def user_consented(self):
|
||||
self.consent = 1
|
||||
|
||||
def notice_window_closed(self):
|
||||
self.notice_window = None
|
||||
#ignored_package_str = "|".join(self.model.ignored_package_list())
|
||||
|
||||
def help (self, args):
|
||||
gnome.help.goto ("file:///usr/share/doc/rhn-applet-@VERSION@/index.html")
|
||||
|
||||
|
||||
def exit_applet(self, *args):
|
||||
self.gtkEventThread.doQuit()
|
||||
gtk.main_quit()
|
||||
sys.exit(0)
|
||||
|
||||
def save_yourself(self, *args):
|
||||
if self.session:
|
||||
self.session.set_clone_command(1, ["/usr/bin/entropy-update-applet"])
|
||||
self.session.set_restart_command(1, ["/usr/bin/entropy-update-applet"])
|
||||
|
||||
return True
|
||||
|
||||
def about(self, *data):
|
||||
if self.about_window:
|
||||
return
|
||||
|
||||
self.about_window = rhnAppletAboutWindow(self)
|
||||
|
||||
def about_dialog_closed(self):
|
||||
self.about_window = None
|
||||
|
||||
def rhnreg_dialog_closed(self):
|
||||
self.rhnreg_dialog = None
|
||||
|
||||
def error_dialog_closed(self):
|
||||
self.error_dialog = None
|
||||
self.last_error = None
|
||||
self.last_error_is_exception = 0
|
||||
self.last_error_is_network_error = 0
|
||||
self.set_state("OKAY")
|
||||
self.update_tooltip(_("Waiting before checkin..."))
|
||||
|
||||
self.enable_refresh_timer()
|
||||
|
||||
def applet_face_click(self, window, event, *data):
|
||||
if event.button == 3:
|
||||
self.menu.popup(None, None, None, 0, event.time)
|
||||
return
|
||||
|
||||
if self.current_state in [ "CRITICAL", "NOCONSENT" ]:
|
||||
self.animate_stop()
|
||||
|
||||
if not self.current_state in [ "OKAY", "ERROR", "DISCONNECTED", "CRITICAL" ]:
|
||||
return
|
||||
|
||||
if self.last_error:
|
||||
if self.error_dialog:
|
||||
return
|
||||
if self.last_error_is_exception:
|
||||
self.error_dialog = rhnAppletExceptionDialog(self, self.last_error)
|
||||
else:
|
||||
self.error_dialog = rhnAppletErrorDialog(self, self.last_error)
|
||||
return
|
||||
|
||||
# clicked the face while it was loaded, and not while telling
|
||||
# them to register? well, let's close it
|
||||
|
||||
self.never_viewed_notices = 0
|
||||
if self.notice_window and not self.rhnreg_dialog:
|
||||
self.notice_window.close_window()
|
||||
return
|
||||
|
||||
if not self.notice_window:
|
||||
self.notice_window = rhnAppletNoticeWindow(self)
|
||||
|
||||
self.refresh_notice_window()
|
||||
|
||||
if self.rhnreg_dialog:
|
||||
self.rhnreg_dialog.set_transient(self.notice_window)
|
||||
self.rhnreg_dialog.raise_()
|
||||
|
||||
def refresh_notice_window(self):
|
||||
self.notice_window.clear_window()
|
||||
|
||||
if not self.available_packages:
|
||||
return
|
||||
|
||||
names = {}
|
||||
entropy_data = {}
|
||||
for pkg in self.available_packages:
|
||||
dbconn = self.Entropy.openRepositoryDatabase(pkg[1])
|
||||
atom = dbconn.retrieveAtom(pkg[0])
|
||||
avail = dbconn.retrieveVersion(pkg[0])
|
||||
avail_rev = dbconn.retrieveRevision(pkg[0])
|
||||
key, slot = dbconn.retrieveKeySlot(pkg[0])
|
||||
installed_match = self.Entropy.clientDbconn.atomMatch(key, matchSlot = slot)
|
||||
|
||||
if installed_match[0] != -1:
|
||||
installed = self.Entropy.clientDbconn.retrieveVersion(installed_match[0])
|
||||
installed_rev = self.Entropy.clientDbconn.retrieveRevision(installed_match[0])
|
||||
else:
|
||||
installed = _("Not installed")
|
||||
if key == "sys-apps/entropy":
|
||||
entropy_data['avail'] = avail+"~"+str(avail_rev)[:]
|
||||
entropy_data['installed'] = installed+"~"+str(installed_rev)
|
||||
|
||||
names[atom] = {}
|
||||
names[atom]['installed'] = installed+"~"+str(installed_rev)
|
||||
names[atom]['avail'] = avail+"~"+str(avail_rev)
|
||||
|
||||
|
||||
ordered_names = names.keys()
|
||||
ordered_names.sort()
|
||||
for name in ordered_names:
|
||||
self.notice_window.add_package( name,
|
||||
names[name]['installed'],
|
||||
names[name]['avail']
|
||||
)
|
||||
|
||||
critical_text = []
|
||||
if entropy_data.has_key("avail"):
|
||||
msg = "%s sys-apps/entropy <b>%s</b> %s, %s <b>%s</b>. %s." % (
|
||||
_("Your system currently has"),
|
||||
entropy_data['installed'],
|
||||
_("installed"),
|
||||
_("but the latest available version is"),
|
||||
entropy_data['avail'],
|
||||
_("It is recommended that you upgrade to the latest before updating any other packages")
|
||||
)
|
||||
critical_text.append(msg)
|
||||
|
||||
if critical_text:
|
||||
if self.old_critical_text != critical_text:
|
||||
self.notice_window.set_critical('<br><br>'.join(critical_text), critical_active = 1)
|
||||
else:
|
||||
self.notice_window.set_critical('<br><br>'.join(critical_text), critical_active = 0)
|
||||
self.old_critical_text = critical_text
|
||||
else:
|
||||
self.notice_window.remove_critical()
|
||||
|
||||
|
||||
def set_ignored(self, name, new_value):
|
||||
self.never_viewed_notices = 0
|
||||
|
||||
'''
|
||||
if self.model.is_package_ignored(name) and not new_value:
|
||||
self.model.remove_ignored_package(name)
|
||||
|
||||
if not self.model.is_package_ignored(name) and new_value:
|
||||
self.model.add_ignored_package(name)
|
||||
|
||||
needed_packages, ignored_needed_packages = self.model.needed_packages()
|
||||
self.system_needs_packages(needed_packages, ignored_needed_packages)
|
||||
'''
|
||||
|
||||
def run(self):
|
||||
gtk.main()
|
||||
@@ -1,111 +0,0 @@
|
||||
# This file is a portion of the Red Hat Network Panel Applet
|
||||
#
|
||||
# Copyright (C) 1999-2002 Red Hat, Inc. All Rights Reserved.
|
||||
# Distributed under GPL version 2.
|
||||
#
|
||||
# Author: Chip Turner
|
||||
#
|
||||
# def help added by Tammy Fox
|
||||
#
|
||||
# $Id: rhn_applet_animation.py,v 1.3 2002/09/02 22:26:11 cturner Exp $
|
||||
|
||||
import gtk
|
||||
import gtk.gdk
|
||||
import math
|
||||
import os
|
||||
from spritz_setup import const
|
||||
|
||||
class rhnAppletIconPixbuf:
|
||||
def __init__(self):
|
||||
self.images = {}
|
||||
def add_file(self, name, filename):
|
||||
if not self.images.has_key(name):
|
||||
self.images[name] = []
|
||||
|
||||
filepath = const.PIXMAPS_PATH + "/applet/" + filename
|
||||
if not os.path.isfile(filepath):
|
||||
filename = "../../gfx/applet/" + filename
|
||||
else:
|
||||
filename = filepath
|
||||
|
||||
if not os.access(filename, os.R_OK):
|
||||
raise Exception,"Cannot open image file %s" % filename
|
||||
|
||||
pixbuf = gtk.gdk.pixbuf_new_from_file(filename)
|
||||
|
||||
self.add(name, pixbuf)
|
||||
def add(self, name, pixbuf):
|
||||
self.images[name].append(pixbuf)
|
||||
|
||||
# find image closest to the requested size. will be scaled later...
|
||||
def best_match(self, name, size):
|
||||
best = None
|
||||
|
||||
for image in self.images[name]:
|
||||
if not best:
|
||||
best = image
|
||||
continue
|
||||
if abs(size - image.height) < abs(size - best.height):
|
||||
best = image
|
||||
|
||||
return best
|
||||
|
||||
class rhnAppletAnimation:
|
||||
def __init__(self):
|
||||
self.frames = []
|
||||
self.cycle_frames = []
|
||||
|
||||
self.frame = 0
|
||||
self.direction = 1
|
||||
|
||||
# final frame is a PUBLIC DATA MEMBER... yeah, naughty
|
||||
self.final_frame = None
|
||||
|
||||
def append_frames(self, frames):
|
||||
self.frames = self.frames + frames
|
||||
self.final_frame = self.frames[-1]
|
||||
|
||||
def append_cycle(self, frames):
|
||||
self.cycle_frames = self.cycle_frames + frames
|
||||
|
||||
def next_frame(self):
|
||||
if len(self.frames):
|
||||
return self.frames.pop(0)
|
||||
|
||||
if len(self.cycle_frames):
|
||||
ret = self.cycle_frames[self.frame]
|
||||
self.frame = self.frame + self.direction
|
||||
|
||||
if self.frame < 0 or self.frame >= len(self.cycle_frames):
|
||||
# oops, we moved too far. change direction, undo last move
|
||||
self.direction = -self.direction
|
||||
self.frame = self.frame + self.direction
|
||||
|
||||
return ret
|
||||
|
||||
return None
|
||||
|
||||
def alpha_tween(start_image, end_image, steps):
|
||||
tmp = start_image.copy() #start_image.scale_simple(end_image.get_width(), end_image.get_height(), gtk.gdk.INTERP_BILINEAR)
|
||||
|
||||
frames = [ start_image ]
|
||||
stepsize = 256/steps
|
||||
|
||||
for i in range(2, steps):
|
||||
buf = tmp.copy()
|
||||
|
||||
end_image.composite(buf,
|
||||
# dest x, y, w, h
|
||||
0, 0, buf.get_width(), buf.get_height(),
|
||||
# ofset x, y
|
||||
0, 0,
|
||||
# scale factor x, y
|
||||
1.0, 1.0,
|
||||
gtk.gdk.INTERP_BILINEAR,
|
||||
i * stepsize - 1)
|
||||
|
||||
frames.append(buf)
|
||||
|
||||
frames.append(end_image)
|
||||
|
||||
return frames
|
||||
@@ -1,65 +0,0 @@
|
||||
# This file is a portion of the Red Hat Network Panel Applet
|
||||
#
|
||||
# Copyright (C) 2008 Sabayon Linux
|
||||
# Distributed under GPL version 2.
|
||||
#
|
||||
# $Id: applet.py,v 1.10 2003/09/15 15:07:19 veillard Exp $
|
||||
|
||||
import os
|
||||
import dumpTools
|
||||
|
||||
APPLET_STATES = [ "STARTUP", "NOCONSENT", "CONFIGURING", "OKAY", "CRITICAL", "BUSY", "ERROR", "DISCONNECTED" ]
|
||||
APPLET_MENUS = [ "about", "update_now", "web_panel", "web_site", "configure_applet", "check_now" ]
|
||||
|
||||
APPLET_SENSITIVE_MENU = {
|
||||
"STARTUP" : [ "" ],
|
||||
"NOCONSENT" : [ "about", "configure_applet", "update_now", "busy" ],
|
||||
"CONFIGURING" : [ "about", "update_now" ],
|
||||
"OKAY" : APPLET_MENUS,
|
||||
"CRITICAL" : APPLET_MENUS,
|
||||
"BUSY" : [ ],
|
||||
"ERROR" : [ "about", "update_now", "check_now" ],
|
||||
"DISCONNECTED": [ "about", "update_now", "check_now" ],
|
||||
}
|
||||
|
||||
REFRESH_INTERVAL = 60 # seconds
|
||||
NETWORK_RETRY_INTERVAL = 180
|
||||
ERROR_THRESHOLD = 3
|
||||
APPLET_ENABLED = 1
|
||||
|
||||
ANIMATION_TOTAL_TIME = 0.75
|
||||
|
||||
home = os.getenv("HOME")
|
||||
if not home:
|
||||
home = "/tmp"
|
||||
SETTINGS_FILE = os.path.join(home, ".config/entropy/settings")
|
||||
|
||||
def save_settings(settings):
|
||||
global SETTINGS_FILE
|
||||
try:
|
||||
if not os.path.isdir(os.path.dirname(SETTINGS_FILE)):
|
||||
os.makedirs(os.path.dirname(SETTINGS_FILE))
|
||||
dumpTools.dumpobj(SETTINGS_FILE, settings, completePath = True)
|
||||
except:
|
||||
pass
|
||||
|
||||
settings = dumpTools.loadobj(SETTINGS_FILE, completePath = True)
|
||||
if settings == None:
|
||||
settings = {}
|
||||
|
||||
myconst = [
|
||||
['REFRESH_INTERVAL',int],
|
||||
['NETWORK_RETRY_INTERVAL',int],
|
||||
['ERROR_THRESHOLD',int],
|
||||
['ANIMATION_TOTAL_TIME',float],
|
||||
['APPLET_ENABLED',int],
|
||||
]
|
||||
|
||||
for x in myconst:
|
||||
if not settings.has_key(x[0]):
|
||||
settings[x[0]] = eval(x[0])
|
||||
else:
|
||||
if not isinstance(settings[x[0]],x[1]):
|
||||
settings[x[0]] = eval(x[0])
|
||||
|
||||
save_settings(settings)
|
||||
@@ -1,416 +0,0 @@
|
||||
# This file is a portion of the Red Hat Network Panel Applet
|
||||
#
|
||||
# Copyright (C) 1999-2002 Red Hat, Inc. All Rights Reserved.
|
||||
# Distributed under GPL version 2.
|
||||
#
|
||||
# Author: Chip Turner
|
||||
#
|
||||
# $Id: rhn_applet_dialogs.py,v 1.30 2003/10/14 17:41:34 veillard Exp $
|
||||
|
||||
from entropyConstants import *
|
||||
from entropy_i18n import _
|
||||
import gnome
|
||||
import gnome.ui
|
||||
import gobject
|
||||
import gtk.glade
|
||||
gtk.glade.bindtextdomain('entropy', "/usr/share/locale")
|
||||
import gtk
|
||||
import gtkhtml2
|
||||
|
||||
class rhnGladeWindow:
|
||||
def __init__(self, filename, window_name):
|
||||
self.filename = filename
|
||||
if not os.path.isfile(filename):
|
||||
self.filename = "/usr/lib/entropy/spritz/applet/%s" % (filename,)
|
||||
self.xml = gtk.glade.XML(self.filename, window_name, domain="entropy")
|
||||
self.window = self.xml.get_widget(window_name)
|
||||
|
||||
def get_widget(self, widget):
|
||||
return self.xml.get_widget(widget)
|
||||
|
||||
class rhnAppletNoticeWindow(rhnGladeWindow):
|
||||
def __init__(self, parent):
|
||||
rhnGladeWindow.__init__(self, "etp_applet.glade", "notice_window_2")
|
||||
|
||||
self.parent = parent
|
||||
self.window.connect('delete_event', self.close_window)
|
||||
|
||||
self.package_list = self.get_widget('update_clist')
|
||||
self.package_list.append_column(gtk.TreeViewColumn(_("Package Name"), gtk.CellRendererText(), text=0))
|
||||
self.package_list.append_column(gtk.TreeViewColumn(_("Version Installed"), gtk.CellRendererText(), text=1))
|
||||
self.package_list.append_column(gtk.TreeViewColumn(_("Available"), gtk.CellRendererText(), text=2))
|
||||
self.package_list.get_selection().set_mode(gtk.SELECTION_NONE)
|
||||
|
||||
self.notebook = self.get_widget('notice_notebook')
|
||||
self.critical_tab = None
|
||||
self.critical_tab_contents = None
|
||||
|
||||
self.package_list_model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING)
|
||||
self.package_list.set_model(self.package_list_model)
|
||||
|
||||
self.xml.signal_autoconnect (
|
||||
{
|
||||
"on_launch_spritz_clicked" : self.on_spritz,
|
||||
"on_ignore_clicked" : self.on_ignore_clicked,
|
||||
"on_unignore_clicked" : self.on_unignore_clicked,
|
||||
"on_close_clicked" : self.on_close,
|
||||
})
|
||||
|
||||
def on_spritz(self, button):
|
||||
self.parent.launch_package_manager()
|
||||
|
||||
def on_close(self, close_button):
|
||||
self.close_window()
|
||||
|
||||
def close_window(self, *rest):
|
||||
self.window.destroy()
|
||||
self.parent.notice_window_closed()
|
||||
|
||||
def clear_window(self):
|
||||
self.package_list_model.clear()
|
||||
|
||||
def on_link_clicked(self, html, url):
|
||||
print "url: %s" % url
|
||||
|
||||
def set_critical(self, text, critical_active):
|
||||
if not self.critical_tab_contents:
|
||||
html_view = gtkhtml2.View()
|
||||
self.html_view = html_view
|
||||
self.html_doc = gtkhtml2.Document()
|
||||
|
||||
sw = gtk.ScrolledWindow()
|
||||
sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
||||
sw.set_border_width(2)
|
||||
sw.add(html_view)
|
||||
|
||||
tab_label = gtk.Label(_("Critical Information"))
|
||||
tab_label.show()
|
||||
|
||||
html_view.show()
|
||||
sw.show()
|
||||
|
||||
self.critical_tab = self.notebook.prepend_page(sw, tab_label)
|
||||
self.critical_tab_contents = sw
|
||||
|
||||
if critical_active:
|
||||
self.notebook.set_current_page(self.notebook.page_num(self.critical_tab_contents))
|
||||
|
||||
self.set_critical_tab_text(text)
|
||||
else:
|
||||
if self.critical_tab_text != text:
|
||||
self.set_critical_tab_text(text)
|
||||
|
||||
def set_critical_tab_text(self, text):
|
||||
self.critical_tab_text = text
|
||||
|
||||
self.html_doc.clear()
|
||||
self.html_doc.connect('link_clicked', self.on_link_clicked)
|
||||
self.html_doc.open_stream("text/html")
|
||||
self.html_doc.write_stream('<meta http-equiv="Content-Type" content="text/html; charset=utf-8">' + text)
|
||||
self.html_doc.close_stream()
|
||||
self.html_view.set_document(self.html_doc)
|
||||
|
||||
def remove_critical(self):
|
||||
if not self.critical_tab_contents:
|
||||
return
|
||||
|
||||
self.notebook.remove_page(self.notebook.page_num(self.critical_tab_contents))
|
||||
|
||||
def on_ignore_clicked(self, *data):
|
||||
selection = self.available_list.get_selection()
|
||||
(model, iter) = selection.get_selected()
|
||||
if not iter:
|
||||
return
|
||||
|
||||
name = model.get_value(iter, 0)
|
||||
self.parent.set_ignored(name, 1)
|
||||
|
||||
def on_unignore_clicked(self, *data):
|
||||
selection = self.ignore_list.get_selection()
|
||||
(model, iter) = selection.get_selected()
|
||||
if not iter:
|
||||
return
|
||||
|
||||
name = model.get_value(iter, 0)
|
||||
self.parent.set_ignored(name, 0)
|
||||
|
||||
def add_package(self, name, installed, avail):
|
||||
iter = self.package_list_model.append()
|
||||
self.package_list_model.set_value(iter, 0, name)
|
||||
self.package_list_model.set_value(iter, 1, installed)
|
||||
self.package_list_model.set_value(iter, 2, avail)
|
||||
|
||||
|
||||
class rhnRegistrationPromptDialog(rhnGladeWindow):
|
||||
def __init__(self, parent):
|
||||
rhnGladeWindow.__init__(self, "etp_applet.glade", "need_to_register_dialog")
|
||||
|
||||
self.parent = parent
|
||||
self.window.connect('delete_event', self.close_dialog)
|
||||
self.xml.signal_autoconnect (
|
||||
{
|
||||
"on_launch_rhnreg_clicked" : self.on_rhnreg,
|
||||
"on_close_clicked" : self.on_close,
|
||||
})
|
||||
|
||||
def raise_(self):
|
||||
self.window.window.raise_()
|
||||
|
||||
def set_transient(self, papa):
|
||||
self.window.set_transient_for(papa.window)
|
||||
|
||||
def on_rhnreg(self, button):
|
||||
self.parent.launch_rhnreg()
|
||||
self.close_dialog()
|
||||
|
||||
def close_dialog(self, *rest):
|
||||
self.window.destroy()
|
||||
self.parent.rhnreg_dialog_closed()
|
||||
|
||||
def on_close(self, close_button):
|
||||
self.close_dialog()
|
||||
|
||||
class rhnAppletAboutWindow:
|
||||
def __init__(self, parent):
|
||||
self.window = gnome.ui.About("%s Updates Applet" % (etpConst['systemname'],),
|
||||
etpConst['entropyversion'], "Copyright (C) 2008, Sabayon Linux",
|
||||
"Sabayon Linux. What else?",
|
||||
[ "Sabayon Linux Team", "devel@sabayonlinux.org" ])
|
||||
self.window.connect("destroy", self.on_close)
|
||||
self.parent = parent
|
||||
self.window.show()
|
||||
|
||||
def close_dialog(self, *rest):
|
||||
self.parent.about_dialog_closed()
|
||||
|
||||
def on_close(self, *data):
|
||||
self.close_dialog()
|
||||
|
||||
class rhnAppletFirstTimeDruid(rhnGladeWindow):
|
||||
def __init__(self, parent, proxy_url, proxy_username, proxy_password):
|
||||
rhnGladeWindow.__init__(self, "etp_applet.glade", "first_time_druid")
|
||||
|
||||
self.parent = parent
|
||||
self.window.connect('delete_event', self.close_dialog)
|
||||
self.xml.signal_autoconnect (
|
||||
{
|
||||
"on_cancel" : self.on_cancel,
|
||||
"on_remove_from_panel" : self.on_remove_from_panel,
|
||||
"on_finish" : self.on_finish,
|
||||
})
|
||||
|
||||
color = gtk.gdk.color_parse("#cc0000")
|
||||
page = self.xml.get_widget("druidpagestart1")
|
||||
page.set_bg_color(color)
|
||||
page = self.xml.get_widget("druidpagefinish1")
|
||||
page.set_bg_color(color)
|
||||
|
||||
html_sw = self.get_widget("tos_window")
|
||||
self.tos_document = gtkhtml2.Document()
|
||||
self.tos_view = gtkhtml2.View()
|
||||
html_sw.add(self.tos_view)
|
||||
self.tos_view.show()
|
||||
html_sw.show()
|
||||
self.tos_document.clear()
|
||||
self.tos_document.connect('link_clicked', self.on_link_clicked)
|
||||
self.tos_document.open_stream("text/html")
|
||||
|
||||
self.tos_document.close_stream()
|
||||
self.tos_view.set_document(self.tos_document)
|
||||
|
||||
self.enable_proxy = self.get_widget("enable_proxy_check")
|
||||
self.enable_proxy.connect("toggled", self.on_enable_proxy_toggle)
|
||||
|
||||
self.enable_auth = self.get_widget("use_auth_check")
|
||||
self.enable_auth.connect("toggled", self.on_use_auth_toggle)
|
||||
|
||||
self.proxy_entry = self.get_widget("proxy_entry")
|
||||
self.username_entry = self.get_widget("username_entry")
|
||||
self.password_entry = self.get_widget("password_entry")
|
||||
self.username_entry_label = self.get_widget("username_entry_label")
|
||||
self.password_entry_label = self.get_widget("password_entry_label")
|
||||
|
||||
self.use_auth = 0
|
||||
self.use_proxy = 0
|
||||
|
||||
self.proxy_entry.set_text(proxy_url)
|
||||
if proxy_url:
|
||||
self.use_proxy = 1
|
||||
self.enable_proxy.set_sensitive(gtk.TRUE)
|
||||
self.enable_proxy.activate()
|
||||
|
||||
if proxy_username:
|
||||
self.use_auth = 1
|
||||
self.username_entry.set_text(proxy_username)
|
||||
self.password_entry.set_text(proxy_password)
|
||||
self.enable_auth.set_sensitive(gtk.TRUE)
|
||||
self.enable_auth.activate()
|
||||
self.window.show_all()
|
||||
|
||||
def on_link_clicked(self, html, url):
|
||||
gnome.url_show(url)
|
||||
|
||||
def on_enable_proxy_toggle(self, button):
|
||||
state = button.get_active()
|
||||
self.use_proxy = state
|
||||
|
||||
self.get_widget("proxy_entry").set_sensitive(state)
|
||||
self.enable_auth.set_sensitive(state)
|
||||
|
||||
if self.use_auth:
|
||||
self.username_entry.set_sensitive(state)
|
||||
self.username_entry_label.set_sensitive(state)
|
||||
self.password_entry.set_sensitive(state)
|
||||
self.password_entry_label.set_sensitive(state)
|
||||
|
||||
def on_use_auth_toggle(self, button):
|
||||
state = button.get_active()
|
||||
self.use_auth = state
|
||||
|
||||
self.username_entry.set_sensitive(state)
|
||||
self.username_entry_label.set_sensitive(state)
|
||||
self.password_entry.set_sensitive(state)
|
||||
self.password_entry_label.set_sensitive(state)
|
||||
|
||||
def close_dialog(self, *data, **kwarg):
|
||||
if kwarg.has_key("remove"):
|
||||
self.parent.first_time_druid_closed(kwarg["remove"])
|
||||
else:
|
||||
self.parent.first_time_druid_closed(0)
|
||||
self.window.hide()
|
||||
|
||||
def on_cancel(self, cancel_button):
|
||||
self.close_dialog(remove=0)
|
||||
|
||||
def on_remove_from_panel(self, cancel_button):
|
||||
self.close_dialog(remove=1)
|
||||
|
||||
def on_finish(self, *data):
|
||||
if self.use_proxy:
|
||||
args = [ self.proxy_entry.get_text() ]
|
||||
if self.use_auth:
|
||||
args.append(self.username_entry.get_text())
|
||||
args.append(self.password_entry.get_text())
|
||||
|
||||
apply(self.parent.set_proxy, args)
|
||||
|
||||
else:
|
||||
self.parent.set_proxy()
|
||||
|
||||
self.parent.user_consented()
|
||||
self.close_dialog()
|
||||
|
||||
class rhnAppletErrorDialog(rhnGladeWindow):
|
||||
def __init__(self, parent, error):
|
||||
self.window = gtk.MessageDialog(None, 0, gtk.MESSAGE_WARNING, gtk.BUTTONS_OK, str(error))
|
||||
self.window.set_modal(gtk.TRUE)
|
||||
self.window.connect("close", self.on_close)
|
||||
self.window.connect('response', self.on_close)
|
||||
self.parent = parent
|
||||
self.window.show()
|
||||
|
||||
def close_dialog(self, *rest):
|
||||
self.parent.error_dialog_closed()
|
||||
self.window.destroy()
|
||||
|
||||
def on_close(self, *data):
|
||||
self.close_dialog()
|
||||
|
||||
# stolen from anaconda
|
||||
def growToParent(*args):
|
||||
return
|
||||
|
||||
def addFrame(dialog, title=None):
|
||||
contents = dialog.get_children()[0]
|
||||
dialog.remove(contents)
|
||||
frame = gtk.Frame()
|
||||
frame.set_shadow_type(gtk.SHADOW_OUT)
|
||||
box = gtk.VBox()
|
||||
try:
|
||||
if title is None:
|
||||
title = dialog.get_title()
|
||||
|
||||
if title:
|
||||
data = {}
|
||||
data["state"] = 0
|
||||
data["button"] = 0
|
||||
data["deltax"] = 0
|
||||
data["deltay"] = 0
|
||||
data["window"] = dialog
|
||||
eventBox = gtk.EventBox()
|
||||
eventBox.connect("button-press-event", titleBarMousePressCB, data)
|
||||
eventBox.connect("button-release-event", titleBarMouseReleaseCB, data)
|
||||
eventBox.connect("motion-notify-event", titleBarMotionEventCB,data)
|
||||
titleBox = gtk.HBox(gtk.FALSE, 5)
|
||||
eventBox.add(titleBox)
|
||||
eventBox.modify_bg(gtk.STATE_NORMAL,
|
||||
eventBox.rc_get_style().bg[gtk.STATE_SELECTED])
|
||||
titlelbl = gtk.Label("")
|
||||
titlelbl.set_markup("<b>"+_(title)+"</b>")
|
||||
titlelbl.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse ("white"))
|
||||
titlelbl.set_property("ypad", 4)
|
||||
titleBox.pack_start(titlelbl)
|
||||
box.pack_start(eventBox, gtk.FALSE, gtk.FALSE)
|
||||
except:
|
||||
pass
|
||||
|
||||
frame2=gtk.Frame()
|
||||
frame2.set_shadow_type(gtk.SHADOW_NONE)
|
||||
frame2.set_border_width(4)
|
||||
frame2.add(contents)
|
||||
box.pack_start(frame2, gtk.TRUE, gtk.TRUE, padding=5)
|
||||
frame.add(box)
|
||||
frame.show()
|
||||
dialog.add(frame)
|
||||
|
||||
class WrappingLabel(gtk.Label):
|
||||
def __init__(self, label=""):
|
||||
gtk.Label.__init__(self, label)
|
||||
self.set_line_wrap(gtk.TRUE)
|
||||
self.ignoreEvents = 0
|
||||
self.connect("size-allocate", growToParent)
|
||||
|
||||
class rhnAppletExceptionDialog:
|
||||
def __init__ (self, parent, text):
|
||||
self.parent = parent
|
||||
win = gtk.Dialog("Exception Occured", None)
|
||||
self.window = win
|
||||
win.add_button('gtk-ok', 0)
|
||||
|
||||
buffer = gtk.TextBuffer(None)
|
||||
buffer.set_text(text)
|
||||
textbox = gtk.TextView()
|
||||
textbox.set_buffer(buffer)
|
||||
textbox.set_property("editable", gtk.FALSE)
|
||||
textbox.set_property("cursor_visible", gtk.FALSE)
|
||||
sw = gtk.ScrolledWindow ()
|
||||
sw.add (textbox)
|
||||
sw.set_policy (gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
||||
|
||||
hbox = gtk.HBox (gtk.FALSE)
|
||||
## file = pixmap_file('gnome-warning.png')
|
||||
## if file:
|
||||
## hbox.pack_start (GnomePixmap (file), gtk.FALSE)
|
||||
|
||||
info = WrappingLabel(_("An unhandled exception has occured. This "
|
||||
"is most likely a bug. Please copy the "
|
||||
"full text of this exception into an email "
|
||||
"and send it to sabayon@sabayonlinux.org. Thank you."))
|
||||
info.set_size_request (400, -1)
|
||||
|
||||
hbox.pack_start (sw, gtk.TRUE)
|
||||
win.vbox.pack_start (info, gtk.FALSE)
|
||||
win.vbox.pack_start (hbox, gtk.TRUE)
|
||||
win.set_size_request (500, 300)
|
||||
win.set_position (gtk.WIN_POS_CENTER)
|
||||
addFrame(win)
|
||||
win.show_all()
|
||||
win.connect('close', self.on_close)
|
||||
win.connect('response', self.on_close)
|
||||
|
||||
def close_dialog(self, *rest):
|
||||
self.parent.error_dialog_closed()
|
||||
self.window.destroy()
|
||||
|
||||
def on_close(self, *data):
|
||||
self.close_dialog()
|
||||