Spritz:
- started (treeview not working yet) to import the Entropy Packages Notification Applet to trunk it needs notify-python (or python-notify) a further commit will be made to complete the job (eheh) git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@1413 cd1c1023-2f26-0410-ae45-c471fc1f0318
@@ -1,4 +1,4 @@
|
||||
SUBDIRS = src po src/etpgui
|
||||
SUBDIRS = src po src/etpgui src/applet
|
||||
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 po src/yumgui gfx misc tools
|
||||
ALLDIRS=src po src/etpgui gfx misc tools src/applet
|
||||
|
||||
all: subdirs
|
||||
|
||||
@@ -20,17 +20,22 @@ 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/bin
|
||||
mkdir -p $(DESTDIR)/etc
|
||||
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
|
||||
chmod +x $(DESTDIR)/usr/bin/spritz
|
||||
install -m644 $(MISCDIR)/spritz.desktop $(DESTDIR)/usr/share/applications/.
|
||||
chmod +x $(DESTDIR)/usr/bin/etp-applet-gui
|
||||
install -m644 $(MISCDIR)/*.desktop $(DESTDIR)/usr/share/applications/.
|
||||
for d in $(SUBDIRS); do make DESTDIR=`cd $(DESTDIR); pwd` -C $$d install; [ $$? = 0 ] || exit 1; done
|
||||
|
||||
|
||||
|
||||
BIN
spritz/gfx/applet/applet-about.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
spritz/gfx/applet/applet-busy.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
spritz/gfx/applet/applet-configuration.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
spritz/gfx/applet/applet-critical-blank.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
spritz/gfx/applet/applet-critical.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
spritz/gfx/applet/applet-disconnect.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
spritz/gfx/applet/applet-druid-watermark.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
spritz/gfx/applet/applet-error.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
spritz/gfx/applet/applet-okay.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
spritz/gfx/applet/applet-web.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
spritz/gfx/applet/spritz.png
Normal file
|
After Width: | Height: | Size: 916 B |
BIN
spritz/gfx/entropy-applet.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
2
spritz/misc/etp-applet-gui
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
python /usr/lib/entropy/spritz/applet/applet.py "$@"
|
||||
9
spritz/misc/etp-applet.desktop
Normal file
@@ -0,0 +1,9 @@
|
||||
[Desktop Entry]
|
||||
_Name=Entropy Alert Icon
|
||||
_Comment=Panel icon for indication that newer Entropy packages are available
|
||||
Icon=entropy-applet.png
|
||||
Exec=entropy-applet-gui
|
||||
Type=Application
|
||||
Terminal=false
|
||||
Encoding=UTF-8
|
||||
Categories=System;Application;
|
||||
@@ -12,8 +12,8 @@ NLSPACKAGE = spritz
|
||||
CATALOGS = $(shell ls *.po)
|
||||
FMTCATALOGS = $(patsubst %.po,%.mo,$(CATALOGS))
|
||||
|
||||
PYFILES = $(wildcard ../src/*.py) $(wildcard ../src/spritz/*.py) $(wildcard ../src/etpgui/*.py)
|
||||
GLADEFILES = $(wildcard ../src/*.glade)
|
||||
PYFILES = $(wildcard ../src/*.py) $(wildcard ../src/spritz/*.py) $(wildcard ../src/etpgui/*.py) $(wildcard ../src/applet/*.py)
|
||||
GLADEFILES = $(wildcard ../src/*.glade) $(wildcard ../src/applet/*.glade)
|
||||
POTFILES = $(PYFILES) $(GLADEFILES)
|
||||
|
||||
all: $(NLSPACKAGE).pot $(FMTCATALOGS)
|
||||
|
||||
@@ -12,4 +12,11 @@ src/etpgui/callbacks.py
|
||||
src/etpgui/__init__.py
|
||||
src/etpgui/packages.py
|
||||
src/etpgui/widgets.py
|
||||
src/applet/etp_applet_animation.py
|
||||
src/applet/etp_applet_config.py
|
||||
src/applet/etp_applet_dialogs.py
|
||||
src/applet/etp_applet.py
|
||||
src/applet/applet.py
|
||||
src/applet/etp_applet.glade
|
||||
src/spritz.glade
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-02-28 16:01+0100\n"
|
||||
"POT-Creation-Date: 2008-03-05 21:06+0100\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@@ -84,152 +84,140 @@ msgstr ""
|
||||
msgid "---> Downloading header for %s to pack into transaction set."
|
||||
msgstr ""
|
||||
|
||||
#: ../src/dialogs.py:55
|
||||
#: ../src/dialogs.py:56
|
||||
msgid "Please confirm the actions above"
|
||||
msgstr ""
|
||||
|
||||
#. self.create_text_column( _( "Package" ), 'name' , size=300)
|
||||
#: ../src/dialogs.py:89 ../src/dialogs.py:96 ../src/views.py:418
|
||||
#: ../src/dialogs.py:93 ../src/dialogs.py:100 ../src/views.py:418
|
||||
msgid "Package"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/dialogs.py:90 ../src/views.py:560 ../src/views.py:893
|
||||
#: ../src/dialogs.py:94 ../src/views.py:560 ../src/views.py:893
|
||||
#: ../src/spritz.glade.h:68
|
||||
msgid "Description"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/dialogs.py:122
|
||||
#: ../src/dialogs.py:117 ../src/dialogs.py:158
|
||||
msgid "To be reinstalled"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/dialogs.py:127
|
||||
#: ../src/dialogs.py:123 ../src/dialogs.py:163
|
||||
msgid "To be installed"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/dialogs.py:132
|
||||
msgid "No description"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/dialogs.py:135
|
||||
#: ../src/dialogs.py:129 ../src/dialogs.py:171
|
||||
msgid "To be updated"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/dialogs.py:140
|
||||
#: ../src/dialogs.py:135
|
||||
msgid "To be downgraded"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/dialogs.py:141 ../src/dialogs.py:176
|
||||
msgid "To be removed"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/dialogs.py:251
|
||||
#: ../src/dialogs.py:168
|
||||
msgid "No description"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/dialogs.py:290
|
||||
#, python-format
|
||||
msgid "About %s"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/dialogs.py:344
|
||||
#: ../src/dialogs.py:383
|
||||
msgid "Hey!"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/dialogs.py:348
|
||||
#: ../src/dialogs.py:387
|
||||
msgid "Spritz Question"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/dialogs.py:362 ../src/misc.py:185 ../src/misc.py:240
|
||||
#: ../src/dialogs.py:401 ../src/misc.py:89 ../src/misc.py:144
|
||||
msgid "Attention"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/dialogs.py:415
|
||||
#: ../src/dialogs.py:454
|
||||
msgid "License"
|
||||
msgstr ""
|
||||
|
||||
#. new
|
||||
#: ../src/dialogs.py:418
|
||||
#: ../src/dialogs.py:457
|
||||
msgid "Accepted"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/gui.py:254
|
||||
#: ../src/gui.py:255
|
||||
msgid "Show Package Updates"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/gui.py:255
|
||||
#: ../src/gui.py:256
|
||||
msgid "Show available Packages"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/gui.py:256
|
||||
#: ../src/gui.py:257
|
||||
msgid "Show Installed Packages"
|
||||
msgstr ""
|
||||
|
||||
#. Setup Vertical Toolbar
|
||||
#: ../src/gui.py:277 ../src/views.py:555
|
||||
#: ../src/gui.py:278 ../src/views.py:555
|
||||
msgid "Packages"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/gui.py:278
|
||||
#: ../src/gui.py:279
|
||||
msgid "Package Categories"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/gui.py:279
|
||||
#: ../src/gui.py:280
|
||||
msgid "Package Queue"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/gui.py:280
|
||||
#: ../src/gui.py:281
|
||||
msgid "Repository Selection"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/gui.py:281
|
||||
#: ../src/gui.py:282
|
||||
msgid "Configuration Files"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/gui.py:282
|
||||
#: ../src/gui.py:283
|
||||
msgid "Output"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/misc.py:84
|
||||
msgid "Programming:"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/misc.py:87
|
||||
msgid "Yum Extender Programmers:"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/misc.py:90
|
||||
msgid "Translation:"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/misc.py:111
|
||||
msgid "Dedicated to:"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/misc.py:186
|
||||
msgid ""
|
||||
"There are packages that can't be installed at the same time, thus are "
|
||||
"blocking your request:"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/misc.py:241
|
||||
#: ../src/misc.py:145
|
||||
msgid ""
|
||||
"Some dependencies couldn't be found. It can either be because they are "
|
||||
"masked or because they aren't in any active repository."
|
||||
msgstr ""
|
||||
|
||||
#: ../src/misc.py:284
|
||||
#: ../src/misc.py:188
|
||||
msgid "Needed disk space"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/misc.py:287
|
||||
#: ../src/misc.py:191
|
||||
msgid "Freed disk space"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/misc.py:291
|
||||
#: ../src/misc.py:195
|
||||
msgid "These are the packages that would be installed/updated"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/misc.py:334
|
||||
#: ../src/misc.py:238
|
||||
msgid "Freed space"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/misc.py:337
|
||||
#: ../src/misc.py:241
|
||||
msgid "Needed space"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/misc.py:341
|
||||
#: ../src/misc.py:245
|
||||
msgid "These are the packages that would be removed"
|
||||
msgstr ""
|
||||
|
||||
@@ -483,7 +471,7 @@ msgstr ""
|
||||
msgid "You must run this application as root"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/spritz.py:1051
|
||||
#: ../src/spritz.py:1051 ../src/applet/etp_applet.py:536
|
||||
#, python-format
|
||||
msgid "No repositories specified in %s"
|
||||
msgstr ""
|
||||
@@ -492,7 +480,7 @@ msgstr ""
|
||||
msgid "You are not connected to the Internet. You should."
|
||||
msgstr ""
|
||||
|
||||
#: ../src/spritz.py:1057
|
||||
#: ../src/spritz.py:1057 ../src/applet/etp_applet.py:544
|
||||
#, python-format
|
||||
msgid "Unhandled exception: %s"
|
||||
msgstr ""
|
||||
@@ -628,6 +616,223 @@ msgstr ""
|
||||
msgid "No header - huh?"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet_dialogs.py:39
|
||||
msgid "Package Name"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet_dialogs.py:40
|
||||
msgid "Version Installed"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet_dialogs.py:41 ../src/spritz.glade.h:62
|
||||
msgid "Available"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet_dialogs.py:45 ../src/applet/etp_applet.glade.h:5
|
||||
msgid "Ignored Packages"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet_dialogs.py:50 ../src/applet/etp_applet.glade.h:3
|
||||
msgid "Available Updates"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet_dialogs.py:108
|
||||
msgid "Critical Information"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet_dialogs.py:261
|
||||
msgid ""
|
||||
"Red Hat Network provides an intelligent, proactive management service for "
|
||||
"your Red Hat Linux-based system. Red Hat Network has the latest Red Hat "
|
||||
"information, updates, and services to make your systems more secure and "
|
||||
"reliable. This application is designed to inform you when updates are "
|
||||
"available for your system, but does not save any personally identifiable "
|
||||
"information about you or your system to the Red Hat Network unless you "
|
||||
"choose to subscribe to Red Hat Network. Use of this applet by itself does "
|
||||
"not imply any agreement with Red Hat Network."
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet_dialogs.py:262
|
||||
msgid ""
|
||||
"Use of the up2date service, or use of this applet in conjunction with the "
|
||||
"up2date service, is governed by the Red Hat Network Services Use and "
|
||||
"Subscription Agreement, which may be reviewed at "
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet_dialogs.py:264
|
||||
msgid "Red Hat Network's privacy policy may be reviewed at "
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet_dialogs.py:266
|
||||
msgid ""
|
||||
"If you do not wish to have this application appear on your panel, click the "
|
||||
"'Remove From Panel' button below. Once removed, you can return it to your "
|
||||
"panel at any time by clicking on the Red Fedora in the bottom left of the "
|
||||
"desktop, choosing 'System Tools' and then choosing 'Red Hat Network Alert "
|
||||
"Icon.'\n"
|
||||
" "
|
||||
msgstr ""
|
||||
|
||||
#. # file = pixmap_file('gnome-warning.png')
|
||||
#. # if file:
|
||||
#. # hbox.pack_start (GnomePixmap (file), gtk.FALSE)
|
||||
#: ../src/applet/etp_applet_dialogs.py:446
|
||||
msgid ""
|
||||
"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 applet@rhn."
|
||||
"redhat.com. Thank you."
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:62
|
||||
msgid "Updates Notification"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:208
|
||||
msgid "_Check for updates"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:208
|
||||
msgid "Check for updates"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:209
|
||||
msgid "_Launch Package Manager"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:209
|
||||
msgid "Launch Package Manager"
|
||||
msgstr ""
|
||||
|
||||
#. ("configure_applet", _("C_onfiguration"), _("Configuration"), self.run_first_time_druid),
|
||||
#: ../src/applet/etp_applet.py:211
|
||||
msgid "_Packages Website"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:211
|
||||
msgid "Use Packages web interface"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:212
|
||||
msgid "_Sabayon Linux Website"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:212
|
||||
msgid "Launch Sabayon Linux Website"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:214
|
||||
msgid "_About"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:214
|
||||
msgid "About..."
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:215
|
||||
msgid "_Exit"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:215
|
||||
msgid "Exit"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:273
|
||||
msgid "Waiting until first checkin..."
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:464
|
||||
msgid "execv didn't execv?"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:520
|
||||
msgid "Checking for updates..."
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:539
|
||||
msgid "Repository Network Error"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:555
|
||||
msgid "No repositories specified. Cannot check for package updates."
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:556
|
||||
msgid "Updates: attention"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:560
|
||||
msgid ""
|
||||
"Cannot connect to the Updates Service, you're probably not connected to the "
|
||||
"world."
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:561 ../src/applet/etp_applet.py:586
|
||||
msgid "Updates: connection issues"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:565
|
||||
msgid "Not all the repositories have been fetched for checking"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:566 ../src/applet/etp_applet.py:571
|
||||
msgid "Updates: repository issues"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:570
|
||||
msgid "No repositories found online"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:575
|
||||
msgid "Synchronization errors. Cannot update repositories. Check logs."
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:576
|
||||
msgid "Updates: sync issues"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:580
|
||||
msgid "Updates: unhandled error"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:598
|
||||
#, python-format
|
||||
msgid "Updates: exception %s"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:605
|
||||
#, python-format
|
||||
msgid "Updates: issue: %s"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:619
|
||||
#, python-format
|
||||
msgid "There are %d updates available."
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:625
|
||||
msgid "So far, so good. w00t!"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.py:715
|
||||
msgid "Waiting before checkin..."
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.glade.h:1
|
||||
msgid "< <"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.glade.h:2
|
||||
msgid "> >"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.glade.h:4
|
||||
msgid "GYUM Alert Notification Tool"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/applet/etp_applet.glade.h:6
|
||||
msgid "Launch GYUM..."
|
||||
msgstr ""
|
||||
|
||||
#: ../src/spritz.glade.h:1
|
||||
msgid " "
|
||||
msgstr ""
|
||||
@@ -862,10 +1067,6 @@ msgstr ""
|
||||
msgid "Adding a <b>new repository</b> lets you access <b>extra software</b>"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/spritz.glade.h:62
|
||||
msgid "Available"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/spritz.glade.h:63
|
||||
msgid "C_hanges"
|
||||
msgstr ""
|
||||
|
||||
@@ -5,8 +5,8 @@ all:
|
||||
|
||||
clean:
|
||||
rm -fv *.pyc *.pyo *~ *.bak *.gladep
|
||||
rm -fv yumex/*.pyc yumex/*.pyo etpgui/*~
|
||||
rm -fv etpgui/*.pyc etpgui/*.pyo etpgui/*~
|
||||
rm -fv applet/*.pyc etpgui/*.pyo applet/*~
|
||||
|
||||
install:
|
||||
mkdir -p $(DESTDIR)/usr/lib/entropy/spritz
|
||||
|
||||
18
spritz/src/applet/Makefile
Normal file
@@ -0,0 +1,18 @@
|
||||
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)"
|
||||
46
spritz/src/applet/applet.py
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/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,'../')
|
||||
|
||||
|
||||
try:
|
||||
os.nice(10)
|
||||
except:
|
||||
pass
|
||||
|
||||
args = filter(lambda s: s != "-d", sys.argv)
|
||||
if args != sys.argv:
|
||||
sys.argv = args
|
||||
|
||||
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()
|
||||
|
||||
341
spritz/src/applet/etp_applet.glade
Normal file
@@ -0,0 +1,341 @@
|
||||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
||||
|
||||
<glade-interface>
|
||||
<requires lib="gnome"/>
|
||||
|
||||
<widget class="GtkDialog" id="notice_window_2">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">GYUM Alert Notification Tool</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_CENTER</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="default_width">600</property>
|
||||
<property name="default_height">300</property>
|
||||
<property name="resizable">True</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="decorated">True</property>
|
||||
<property name="skip_taskbar_hint">False</property>
|
||||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
<property name="focus_on_map">True</property>
|
||||
<property name="urgency_hint">False</property>
|
||||
<property name="has_separator">True</property>
|
||||
|
||||
<child internal-child="vbox">
|
||||
<widget class="GtkVBox" id="dialog-vbox3">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">8</property>
|
||||
|
||||
<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_default">True</property>
|
||||
<property name="has_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Launch GYUM...</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="response_id">0</property>
|
||||
<signal name="clicked" handler="on_launch_up2date_clicked"/>
|
||||
</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="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="response_id">0</property>
|
||||
<signal name="clicked" handler="on_close_clicked"/>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">GTK_PACK_END</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkNotebook" id="notice_notebook">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="show_tabs">True</property>
|
||||
<property name="show_border">True</property>
|
||||
<property name="tab_pos">GTK_POS_TOP</property>
|
||||
<property name="scrollable">True</property>
|
||||
<property name="enable_popup">False</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="checklist_window">
|
||||
<property name="visible">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
|
||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="update_clist">
|
||||
<property name="visible">True</property>
|
||||
<property name="headers_visible">True</property>
|
||||
<property name="rules_hint">False</property>
|
||||
<property name="reorderable">False</property>
|
||||
<property name="enable_search">True</property>
|
||||
<property name="fixed_height_mode">False</property>
|
||||
<property name="hover_selection">False</property>
|
||||
<property name="hover_expand">False</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="tab_expand">False</property>
|
||||
<property name="tab_fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label7">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Available Updates</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">tab</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox4">
|
||||
<property name="border_width">2</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox4">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow3">
|
||||
<property name="visible">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
|
||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="available_clist">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="headers_visible">True</property>
|
||||
<property name="rules_hint">False</property>
|
||||
<property name="reorderable">False</property>
|
||||
<property name="enable_search">True</property>
|
||||
<property name="fixed_height_mode">False</property>
|
||||
<property name="hover_selection">False</property>
|
||||
<property name="hover_expand">False</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox3">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">True</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="button12">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">> ></property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="on_ignore_clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox6">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="button11">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">< <</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="on_unignore_clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="list4">
|
||||
<property name="visible">True</property>
|
||||
<property name="headers_visible">True</property>
|
||||
<property name="rules_hint">False</property>
|
||||
<property name="reorderable">False</property>
|
||||
<property name="enable_search">True</property>
|
||||
<property name="fixed_height_mode">False</property>
|
||||
<property name="hover_selection">False</property>
|
||||
<property name="hover_expand">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">10</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow4">
|
||||
<property name="visible">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
|
||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="ignore_clist">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="headers_visible">True</property>
|
||||
<property name="rules_hint">False</property>
|
||||
<property name="reorderable">False</property>
|
||||
<property name="enable_search">True</property>
|
||||
<property name="fixed_height_mode">False</property>
|
||||
<property name="hover_selection">False</property>
|
||||
<property name="hover_expand">False</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="tab_expand">False</property>
|
||||
<property name="tab_fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label8">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Ignored Packages</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">tab</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
</glade-interface>
|
||||
834
spritz/src/applet/etp_applet.py
Normal file
@@ -0,0 +1,834 @@
|
||||
# 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 i18n import _
|
||||
|
||||
# Entropy imports
|
||||
from entropyConstants import *
|
||||
import exceptionTools
|
||||
from entropy import EquoInterface,RepoInterface,urlFetcher
|
||||
|
||||
class Entropy(EquoInterface):
|
||||
|
||||
def __init__(self):
|
||||
EquoInterface.__init__(self, noclientdb = True, indexing = False, user_xcache = True) #, xcache = False)
|
||||
self.xcache = True
|
||||
self.clientDbconn.xcache = True
|
||||
self.nocolor()
|
||||
|
||||
def connect_progress_objects(self, tooltip_widget, tooltip_function):
|
||||
self.progress_tooltip = tooltip_function
|
||||
self.progress_widget = tooltip_widget
|
||||
self.updateProgress = self.appletUpdateProgress
|
||||
self.progress_tooltip_message_title = _("Updates Notification")
|
||||
self.appletCreateNotification()
|
||||
self.progress_tooltip_notification_timer = None
|
||||
self.applet_notification_active = 0
|
||||
gobject.timeout_add(5000, self.appletRemoveNotification)
|
||||
self.urlFetcher = GuiUrlFetcher
|
||||
self.progress = self.appletPrintText # for the GuiUrlFetcher
|
||||
|
||||
def appletCreateNotification(self):
|
||||
pynotify.init("Message Replace")
|
||||
self.progress_tooltip_notification = pynotify.Notification(self.progress_tooltip_message_title,"Hello world")
|
||||
self.progress_tooltip_notification.set_timeout(0)
|
||||
|
||||
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)
|
||||
self.appletPrintText(message)
|
||||
|
||||
def appletPrintText(self, message):
|
||||
self.progress_tooltip_notification.update(self.progress_tooltip_message_title,message)
|
||||
self.progress_tooltip_notification.show()
|
||||
self.applet_notification_active = 2
|
||||
|
||||
def appletRemoveNotification(self):
|
||||
#self.appletInitTimer()
|
||||
if self.applet_notification_active == 0:
|
||||
return
|
||||
elif self.applet_notification_active == 2:
|
||||
self.applet_notification_active = 1
|
||||
return
|
||||
|
||||
self.progress_tooltip_notification.set_timeout(1)
|
||||
time.sleep(1.5)
|
||||
self.applet_notification_active = 0
|
||||
self.appletCreateNotification()
|
||||
|
||||
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 "Error: invalid state %s" % new_state
|
||||
|
||||
if self.current_state and not new_state in etp_applet_config.APPLET_STATE_CHANGES[self.current_state]:
|
||||
raise "Error: can't change from state %s to state %s" % (self.current_state, new_state)
|
||||
|
||||
if self.refresh_timeout_tag and new_state not in [ "OKAY", "CRITICAL" ]:
|
||||
raise "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.Entropy = Entropy()
|
||||
self.move_to_user_directory()
|
||||
self.Entropy.validate_repositories_cache()
|
||||
|
||||
self.destroyed = 0
|
||||
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)
|
||||
self.Entropy.connect_progress_objects(self.tooltip, self.update_tooltip)
|
||||
|
||||
#
|
||||
# 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.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 = (
|
||||
("check_now", _("_Check for updates"), _("Check for updates"), self.update_from_server),
|
||||
("update_now", _("_Launch Package Manager"), _("Launch Package Manager"), self.launch_package_manager),
|
||||
#("configure_applet", _("C_onfiguration"), _("Configuration"), self.run_first_time_druid),
|
||||
("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.proxy = {}
|
||||
self.proxy_username = {}
|
||||
self.proxy_password = {}
|
||||
|
||||
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
|
||||
|
||||
# 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.update_tooltip(_("Waiting until first checkin..."))
|
||||
self.enable_refresh_timer(60000)
|
||||
|
||||
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)
|
||||
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" ]:
|
||||
raise "Can't enable timer unless in OKAY or CRITICAL state"
|
||||
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 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 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(_("execv didn't execv?"))
|
||||
else:
|
||||
os._exit(-1)
|
||||
|
||||
def show_alert(self, title, text):
|
||||
pynotify.init("XY")
|
||||
n = pynotify.Notification(title, text)
|
||||
x,y = self.get_tray_coordinates()
|
||||
n.set_hint("x", x+11)
|
||||
n.set_hint("y", y+5)
|
||||
n.show()
|
||||
|
||||
def move_to_user_directory(self):
|
||||
etpConst['dumpstoragedir'] = etp_applet_config.settings['CACHES_DIR']
|
||||
for repoid in etpRepositories:
|
||||
etpRepositories[repoid]['dbpath'] = etp_applet_config.settings['REPOS_DIR'] + "/" + repoid+ "/" + etpConst['product'] + "/" + etpConst['currentarch']
|
||||
if not os.path.isdir(etpRepositories[repoid]['dbpath']):
|
||||
os.makedirs(etpRepositories[repoid]['dbpath'])
|
||||
self.Entropy.update_repository_revision(repoid)
|
||||
|
||||
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):
|
||||
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):
|
||||
|
||||
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
|
||||
|
||||
# compare repos
|
||||
repositories_to_update, rc = self.compare_repositories_status()
|
||||
if repositories_to_update and rc == 0:
|
||||
repos = repositories_to_update.keys()
|
||||
|
||||
oldxcache = self.Entropy.xcache
|
||||
self.Entropy.xcache = False # to disable cache generation by RepoInterface
|
||||
try:
|
||||
repoConn = self.Entropy.Repositories(repos, fetchSecurity = False, noEquoCheck = True)
|
||||
except exceptionTools.MissingParameter:
|
||||
self.last_error = _("No repositories specified in %s") % (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 = _("Unhandled exception: %s" % (str(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
|
||||
print "RETURNED",rc
|
||||
self.Entropy.xcache = oldxcache
|
||||
|
||||
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()
|
||||
return False
|
||||
|
||||
|
||||
print "NOW I SHOULD CHECK"
|
||||
try:
|
||||
update, remove, fine = self.Entropy.calculate_world_updates()
|
||||
del fine, remove
|
||||
except Exception, e:
|
||||
self.show_alert( _("Updates: exception %s") % (str(Exception),), str(e) )
|
||||
self.error_threshold += 1
|
||||
self.last_error_is_exception = 1
|
||||
self.last_error = str(e)
|
||||
|
||||
if self.last_error:
|
||||
self.disable_refresh_timer()
|
||||
self.update_tooltip(_("Updates: issue: %s") % (str(self.last_error),))
|
||||
self.set_state("ERROR")
|
||||
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:
|
||||
return False
|
||||
|
||||
if update:
|
||||
self.set_state("CRITICAL")
|
||||
self.update_tooltip(_("There are %d updates available.") % (len(update),))
|
||||
if self.notice_window:
|
||||
self.refresh_notice_window(update)
|
||||
|
||||
else:
|
||||
self.set_state(old_state)
|
||||
self.update_tooltip(_("So far, so good. w00t!"))
|
||||
|
||||
self.disable_refresh_timer()
|
||||
self.enable_refresh_timer()
|
||||
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.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(*args):
|
||||
gtk.main_quit()
|
||||
return
|
||||
|
||||
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, needed_packages = None):
|
||||
self.notice_window.clear_window()
|
||||
|
||||
if not needed_package:
|
||||
print "no updates to show"
|
||||
return
|
||||
|
||||
print "refresh notice window"
|
||||
return
|
||||
|
||||
names = {}
|
||||
for pkg in needed_packages:
|
||||
if not names.has_key(pkg["name"]):
|
||||
names[pkg["name"]] = []
|
||||
|
||||
names[pkg["name"]].append(pkg)
|
||||
|
||||
ordered_names = names.keys()
|
||||
ordered_names.sort();
|
||||
|
||||
for name in ordered_names:
|
||||
|
||||
available = ', '.join(map(lambda p: p["nevr"], names[name]))
|
||||
# drop the ending ':' if there is no epoch
|
||||
if len(available) >= 1 and available[-1] == ":":
|
||||
available = available[:-1]
|
||||
|
||||
|
||||
#installed = self.model.installed_package(name)
|
||||
installed['name'] = "asdads"
|
||||
installed['version'] = "1.2.3"
|
||||
installed['release'] = "0"
|
||||
self.notice_window.add_package(name,
|
||||
"-".join((installed["name"],
|
||||
installed["version"],
|
||||
installed["release"])),
|
||||
available)
|
||||
|
||||
critical_text = []
|
||||
|
||||
# XXX show equo updates
|
||||
'''
|
||||
for a in self.model.alerts():
|
||||
if a.is_up2date_alert():
|
||||
current, latest = a.alert_data()
|
||||
critical_text.append(_("""
|
||||
Your system currently has <b>%s</b> installed, but the latest
|
||||
available version is <b>%s</b>. It is recommended that you <b>upgrade
|
||||
to the latest up2date</b> before updating any other packages.
|
||||
""") % (self.model.pkg_as_nvr(current), self.model.pkg_as_nvr(latest)))
|
||||
'''
|
||||
|
||||
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()
|
||||
|
||||
self.notice_window.redraw_lists()
|
||||
|
||||
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()
|
||||
111
spritz/src/applet/etp_applet_animation.py
Normal file
@@ -0,0 +1,111 @@
|
||||
# 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
|
||||
79
spritz/src/applet/etp_applet_config.py
Normal file
@@ -0,0 +1,79 @@
|
||||
# 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_STATE_CHANGES = {
|
||||
"STARTUP" : [ "OKAY", "NOCONSENT" ],
|
||||
"NOCONSENT" : [ "CONFIGURING" ],
|
||||
"CONFIGURING" : [ "NOCONSENT", "BUSY", "OKAY", "DISCONNECTED" ],
|
||||
"OKAY" : [ "BUSY", "CONFIGURING", "CRITICAL", "DISCONNECTED" ],
|
||||
"CRITICAL" : [ "OKAY", "BUSY", "CRITICAL", "CONFIGURING", "DISCONNECTED" ],
|
||||
"BUSY" : [ "OKAY", "CRITICAL", "ERROR", "DISCONNECTED" ],
|
||||
"ERROR" : [ "OKAY", "BUSY" ],
|
||||
"DISCONNECTED": [ "OKAY", "BUSY", "CONFIGURING", "CRITICAL", "ERROR"],
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
ANIMATION_TOTAL_TIME = 0.75
|
||||
|
||||
home = os.getenv("HOME")
|
||||
if not home:
|
||||
home = "/tmp"
|
||||
SETTINGS_FILE = os.path.join(home, ".config/entropy/settings")
|
||||
REPOS_DIR = os.path.join(home, ".config/entropy/repos")
|
||||
CACHES_DIR = os.path.join(home, ".config/entropy/caches")
|
||||
|
||||
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],
|
||||
['REPOS_DIR',basestring],
|
||||
['CACHES_DIR',basestring]
|
||||
]
|
||||
|
||||
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)
|
||||
467
spritz/src/applet/etp_applet_dialogs.py
Normal file
@@ -0,0 +1,467 @@
|
||||
# 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 i18n import _
|
||||
import gnome
|
||||
import gnome.ui
|
||||
import gobject
|
||||
import gtk.glade
|
||||
gtk.glade.bindtextdomain('spritz', "/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/share/entropy/spritz/applet/%s" % (filename,)
|
||||
self.xml = gtk.glade.XML(self.filename, window_name, domain="spritz")
|
||||
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.ignore_list = self.get_widget('ignore_clist')
|
||||
self.ignore_list.append_column(gtk.TreeViewColumn(_("Ignored Packages"), gtk.CellRendererText(), text=0))
|
||||
self.ignore_list.get_selection().set_mode(gtk.SELECTION_SINGLE)
|
||||
self.ignore_list_contents = []
|
||||
|
||||
self.available_list = self.get_widget('available_clist')
|
||||
self.available_list.append_column(gtk.TreeViewColumn(_("Available Updates"), gtk.CellRendererText(), text=0))
|
||||
self.available_list.get_selection().set_mode(gtk.SELECTION_SINGLE)
|
||||
self.available_list_contents = []
|
||||
|
||||
self.notebook = self.get_widget('notice_notebook')
|
||||
self.critical_tab = None
|
||||
self.critical_tab_contents = None
|
||||
|
||||
self.available_model = gtk.ListStore(gobject.TYPE_STRING)
|
||||
self.available_list.set_model(self.available_model)
|
||||
|
||||
self.ignore_list_model = gtk.ListStore(gobject.TYPE_STRING)
|
||||
self.ignore_list.set_model(self.ignore_list_model)
|
||||
|
||||
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_up2date_clicked" : self.on_up2date,
|
||||
"on_ignore_clicked" : self.on_ignore_clicked,
|
||||
"on_unignore_clicked" : self.on_unignore_clicked,
|
||||
"on_close_clicked" : self.on_close,
|
||||
})
|
||||
|
||||
def on_up2date(self, button):
|
||||
self.parent.launch_up2date()
|
||||
|
||||
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.available_model.clear()
|
||||
self.available_list_contents = []
|
||||
|
||||
self.ignore_list_model.clear()
|
||||
self.package_list_model.clear()
|
||||
self.ignore_list_contents = []
|
||||
|
||||
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):
|
||||
if self.parent.model.is_package_ignored(name):
|
||||
self.ignore_list_contents.append(name)
|
||||
else:
|
||||
self.available_list_contents.append(name)
|
||||
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)
|
||||
|
||||
def redraw_lists(self):
|
||||
self.available_model.clear()
|
||||
|
||||
self.available_list_contents.sort()
|
||||
for i in self.available_list_contents:
|
||||
iter = self.available_model.append()
|
||||
self.available_model.set_value(iter, 0, i)
|
||||
|
||||
self.ignore_list_model.clear()
|
||||
|
||||
self.ignore_list_contents.sort()
|
||||
for i in self.ignore_list_contents:
|
||||
iter = self.ignore_list_model.append()
|
||||
self.ignore_list_model.set_value(iter, 0, i)
|
||||
|
||||
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")
|
||||
|
||||
# messy wordwrapping; helps i18n people though
|
||||
self.tos_document.write_stream(
|
||||
'<meta http-equiv="Content-Type" content="text/html; charset=utf-8">' +
|
||||
_("""Red Hat Network provides an intelligent, proactive management service for your Red Hat Linux-based system. Red Hat Network has the latest Red Hat information, updates, and services to make your systems more secure and reliable. This application is designed to inform you when updates are available for your system, but does not save any personally identifiable information about you or your system to the Red Hat Network unless you choose to subscribe to Red Hat Network. Use of this applet by itself does not imply any agreement with Red Hat Network.""") + "<br><br>" +
|
||||
_("""Use of the up2date service, or use of this applet in conjunction with the up2date service, is governed by the Red Hat Network Services Use and Subscription Agreement, which may be reviewed at """) +
|
||||
"""<a href="https://rhn.redhat.com/help/terms.pxt">https://rhn.redhat.com/help/terms.pxt</a>.<br><br>""" +
|
||||
_("""Red Hat Network's privacy policy may be reviewed at """) +
|
||||
"""<a href="https://rhn.redhat.com/help/security.pxt">https://rhn.redhat.com/help/security.pxt</a>.<br><br>""" +
|
||||
_("""If you do not wish to have this application appear on your panel, click the 'Remove From Panel' button below. Once removed, you can return it to your panel at any time by clicking on the Red Fedora in the bottom left of the desktop, choosing 'System Tools' and then choosing 'Red Hat Network Alert Icon.'
|
||||
"""))
|
||||
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 applet@rhn.redhat.com. 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()
|
||||