You are not logged in.

#1 2005-04-23 08:31:36

Cam
Member
From: Brisbane, Aus
Registered: 2004-12-21
Posts: 658
Website

pacman adesklet

Hey all,

Been playing with adesklets a bit lately, cause it's better than gDesklets (;)) and it's a good way to learn Python. Here's what I've made, one of them anyway. In the space that looks like it should have something in it, there will be a list of updated packages when they are actually there. It's a bugger but I did a pacman -Syu just before I tarred this up so there's nothing waiting. Now I will handle all these exceptions at some point, this is me new at python and all that but here goes with what it needs to run.

- libpypac - not sure if it's been fixed in the new version but in mine you can't have includes in pacman.conf, you need to point straight to the repo
- needs to be run as either root or with sudo, this is a libpypac requirement

The desklet will never try to install anything, it simply syncs with the repos and shows you a list of updates. If there are updates there, you can click the pacman icon and it'll open a terminal of your choice running pacman -Su to download and install the updates. This can all be set in the config.txt file that will appear after you run it the first time. The "pacman" icons are really little smilie faces from the popo icon pack, they just looked like pacman sort of but had super cool emotions showing I had to use them! I included some of the better ones so you can pick what you want your pacman to look like.

Anyway, feedback and suggestions are always appreciated. I'd like to continue developing this so let me know what you want and I'll give it my best. Also any python programmers out there, I've tried to make it use threads so it doesn't take so long on the startup but I can't make it work for the life of me, feel free to give me some insight on how to do this big_smile

Screenshot Download

Offline

#2 2005-04-23 14:11:14

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Re: pacman adesklet

Wow, that thing's ugly. I love it. lol

Offline

#3 2005-04-26 00:51:09

aCoder
Member
From: Medina, OH
Registered: 2004-03-07
Posts: 359
Website

Re: pacman adesklet

That looks so cool!


If you develop an ear for sounds that are musical it is like developing an ego. You begin to refuse sounds that are not musical and that way cut yourself off from a good deal of experience.
  - John Cage

Offline

#4 2005-04-26 00:59:37

Cam
Member
From: Brisbane, Aus
Registered: 2004-12-21
Posts: 658
Website

Re: pacman adesklet

libpypac: http://bbs.archlinux.org/viewtopic.php? … t=libpypac

And here is a snip with packages waiting to install. Yesmy font isn't the best to read but wxGtk is hard at the best of times, font can be changed in config.txt, replace CHERI___ with Vera to get pliain boring script.
pacman-desklet.jpg

Offline

#5 2005-04-26 04:07:54

Cam
Member
From: Brisbane, Aus
Registered: 2004-12-21
Posts: 658
Website

Re: pacman adesklet

Hmmm, I'm going to do some more work on it today so I'll have a look. Your first error looks very similar to what I get when I run it as a normal user (without sudo), whacking sudo in front cures it though for me. With the second one, I'll put a try/catch block in for that section, I added it pretty quickly before but it looks like it can't read /var/log/pacman.log or somethng along those lines, can't get the last date you ran pacman -Syu

Offline

#6 2005-04-26 04:52:14

Cam
Member
From: Brisbane, Aus
Registered: 2004-12-21
Posts: 658
Website

Re: pacman adesklet

I've just uploaded a new version, same download link but now it actually has some  error handling, I did some more checking to make sure it all works as it should and while I'm having issues with clicking the icon popping up a terminal, others aren't so I'm not concerned. if anybody has any problems with that let me know. I've also got it spitting out some  base debugging info as well, at the moment that translates to it sending to the terminal which repos it's syncing, what server it's syncing wtih and when. Nothing exciting.

All I need now is to thread it so it doesn't take the 5-10secs to show up when it's loaded. I've tried and failed miserably so if anybody with python knowledge could help me with this it'd be greatly appreciated smile

Offline

#7 2005-04-26 12:31:13

Dreameen
Member
From: Poland
Registered: 2004-09-06
Posts: 252

Re: pacman adesklet

I've tried the new version and I do have the problem when clicking on the icon to launch a terminal with 'pacman -Su'. Here's what happens:

 sudo ./pacman.py 
close failed: [Errno 10] No child processes
[DEBUG] Syncing [current] on darkstar.ist.utl.pt
[DEBUG] Syncing [extra] on darkstar.ist.utl.pt
[DEBUG] Syncing [unstable] on darkstar.ist.utl.pt
[DEBUG] Syncing [community] on darkstar.ist.utl.pt
[DEBUG] Syncing [polrepo] on archrepo.neostrada.pl
Traceback (most recent call last):
  File "./pacman.py", line 207, in ?
    Events(dirname(__file__)).pause()
  File "/usr/lib/python2.4/site-packages/adesklets/events_handler.py", line 228, in pause
    posix_signal.pause()
  File "/usr/lib/python2.4/site-packages/adesklets/events_handler.py", line 214, in _fire_event
    [x for x in
  File "./pacman.py", line 199, in button_press
    self._dPrint("Opening terminal to run pacman")
  File "./pacman.py", line 203, in _dPrint
    if (self._DEBUG):
AttributeError: Events instance has no attribute '_DEBUG'

Offline

#8 2005-04-26 12:43:34

Cam
Member
From: Brisbane, Aus
Registered: 2004-12-21
Posts: 658
Website

Re: pacman adesklet

myfilebin.com seems to be b0rked atm, will be fixed as soon as I can upload it. At any rate, it can be fixed by changing this

class Events(adesklets.Events_handler):

#change that to this

class Events(adesklets.Events_handler):
    _DEBUG  = 1 # set to 0 for no debug messages

Offline

#9 2005-04-26 14:53:25

Dreameen
Member
From: Poland
Registered: 2004-09-06
Posts: 252

Re: pacman adesklet

Thanks. Now it's fully functional smile

The changes I've made to pacman.py to adjust it to my taste:

#before
'10pt_font' : 'CHERI___/10'}
#and after
'10pt_font' : 'CHERI___/9'}

Reason:
When the font was set to 10 pt some letters(especially 's') were cut.

#before
'update_cmd' : 'urxvt -e "sudo pacman -Su"',
#after
'update_cmd' : 'xterm -e "pacman -Su&&read KEY"',

Reason:
I prefer 'xterm' to 'urxvt'. Why 'read KEY'? Because the xterm windows stays open after the update so I can read the useful hints echoed after the upgrades are done..

And a screenie:

[URL=http://img19.echo.cx/my.php?image=200504261655101024x768scrot2nr.png]200504261655101024x768scrot2nr.th.png[/URL]

Nothing to update atm, but hey...that pacman icon looks beautiful. wink

Offline

#10 2005-04-26 15:34:01

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: pacman adesklet

hmmm - any way to run this *not* as a desklet? I'd like to run it in a window or something...

Offline

#11 2005-04-26 22:03:13

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: pacman adesklet

i second phrakture here, I'm only running ion and I'm completly clueless how these things work,

but it looks really cool  8)
and syncing should work with includes also,


arch + gentoo + initng + python = enlisy

Offline

#12 2005-04-26 22:06:58

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: pacman adesklet

Yeah, I'm not looking for a seperate program or anything, just something like "adesklet --window-mode" or something... I used WMII, which would be similar to ion in the respect that I don't see much desktop... so I'd like to force it in a window (maybe an XNest or something? *shrug*)

Offline

#13 2005-04-26 22:14:31

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: pacman adesklet

also nice to see that so many archers are coding on stuff for the distro,

if Cam stabilise this little thing it will be more good pr for arch  8)


arch + gentoo + initng + python = enlisy

Offline

#14 2005-04-26 22:21:20

Cam
Member
From: Brisbane, Aus
Registered: 2004-12-21
Posts: 658
Website

Re: pacman adesklet

Yeah, I've got a couple of days off work at the moment so I'll see what I can do. Putting it in a window *should* be possible, I'll have a look and see what I can do, just using the adesklets interpreter you can create managed windows and stuff.

Thanks for the feedback so far, it's fun looking at that little icon all day lol

Offline

#15 2005-04-27 00:50:58

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: pacman adesklet

cactus fixed the .lastupdate thing so the sync function returns "0" (as string) if the repo hasn't been updated since last sync,


arch + gentoo + initng + python = enlisy

Offline

#16 2005-06-21 16:34:15

Dreameen
Member
From: Poland
Registered: 2004-09-06
Posts: 252

Re: pacman adesklet

I don't know if I'm the only one using this desklet but I really like it. smile

unfortunately sth got screwed and the desklet is not working anymore...here are the errors when running pacman.py:

Traceback (most recent call last):
  File "./pacman.py", line 3, in ?
    import adesklets, os, libpypac, re, time, decimal, sys
  File "/usr/lib/python2.4/site-packages/adesklets/__init__.py", line 36, in ?
    _init=_Initializer()
  File "/usr/lib/python2.4/site-packages/adesklets/initializer.py", line 60, in __init__
    raise ADESKLETSError(3,event)
adesklets.error_handler.ADESKLETSError: adesklets interpreter initialization error - Configuration file parsing error `syntax error', stopped at line 152.

Exception exceptions.AttributeError: <exceptions.AttributeError instance at 0x4004734c> in <bound method _Communicator.__del__ of <adesklets.communicator._Communicator instance at 0x4034974c>> ignored

@Cam: I'd be very grateful If you had a quick look into this.

Offline

#17 2005-06-22 10:43:02

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: pacman adesklet

For the record - we have this adesklet up on some of the demo computers here at LinuxTag - it was a tad wonky to install and get it working, but it looks good.

Thanks

Offline

#18 2005-06-22 21:55:07

Cam
Member
From: Brisbane, Aus
Registered: 2004-12-21
Posts: 658
Website

Re: pacman adesklet

Hey, I'll take a look today since I'm stuck at home cause the people who redid the back springs on my car managed to screw up the job so bad that I can't even drive to them and kick their heads in.... had a shitty couple of days. I'd like to make it a lot more stable and less akward but it's hard with the permissions pacman writes files with, I've filed a feature request on Flyspray, just waiting to hear back from it....

@phrak: cool!!! big_smile

Offline

#19 2005-06-23 06:06:00

Cam
Member
From: Brisbane, Aus
Registered: 2004-12-21
Posts: 658
Website

Re: pacman adesklet

@Dreameen: Okay, it looks like you have a syntax error in your ~/.adesklets file. In theory, that *should* mean that you couldn't run any other desklets either, is this the case? My  suggestion is a) delete ~/.adesklets, b) edit it and fix the errors yourself or c) post it and I'll  take a crack. All it contains is which desklets to start when you run adesklets and their positions.

If my guess is wrong and that's not the problem, let me know and I'll have to get some more info from you cause I tried breaking a few things and couldn't reproduce that error except for the erronous ~/.adesklets  file.

Offline

#20 2005-06-23 08:37:37

Dreameen
Member
From: Poland
Registered: 2004-09-06
Posts: 252

Re: pacman adesklet

You were right. For some unknown reason my .adesklets file had some weird entries from running other desklets. I just rm-ed the file and everything is back to normal. I'm sorry for the trouble this false alarm may have caused you, but I was really clueless as to what was happening with my *favourite* desklet smile Anyway, it's back on my desktop, here's a lil' screenie just to confirm it's working:

200506231034031024x768scrot5fj.th.png

Offline

#21 2005-09-04 14:16:31

Cam
Member
From: Brisbane, Aus
Registered: 2004-12-21
Posts: 658
Website

Re: pacman adesklet

Just an update. paclet (new name) has been updated. It's now threaded and works with the current libpypac-devel release and svn snapshots.

There are PKGBUILDs for libpypac here, don't forget you need the -devel one. The "stable" libpypac is unmaintained to the best of my knowledge. Remind anyone of fluxbox wink

The actual desklet is available from my site or at the adesklets site. Enjoy! Any bugs/feature requests/complaints, post here, PM me or email me or leave a comment at the site, whatever turns you on big_smile

Offline

Board footer

Powered by FluxBB