Main index > About new desklets > A new SystemMonitor

By Jedidiah (Desklet Author), on Fri Dec 16 23:16:20 2005: A new SystemMonitor.

Having found a little spare time I've attempted to use what I learned writing the original SystemMonitor, combined with the various requests for extensibility etc. and tried to design something new with much improved flexibility allowing for a much broader range of possibilities for what gets stacked up in a given Monitor desklet. I have managed to produce a provisional design that fulfills a lot of what I'm looking for: It should be trivial to build far more than basic meters (like a weather display, a clock, mailbox status, hostname readout... whatever you want really), and more flexibility in meters themselves. Adding new widgets to be available to stack up is as simple as dropping an appropriate script in a "plugins" directory. The downside is that, as one might expect as the price for flexibility, the result is significantly more resource hungry.

I was hoping to gather opinions as to whether this is going to be a fruitful path to pursue, and possibly some help trying to squeeze some optimizations out (there is likely a bit of space right now, it's a provisional design - just enough to prove the concept). Any thought or ideas would be appreciated.

provisional proof of concept code can be found at
http://jedidiah.stuff.gen.nz/NewSystemMonitor.tar.bz2
Please excuse a few of the hackier parts at the top level - I just wanted to quickly get enough of a frontend built to try out the core underlying work.

By Jedidiah (Desklet Author), on Sat Dec 17 17:57:23 2005.

For anyone who might have downloaded the test code already, I've done a little more work (mostly fixing how the packing should actually work so it's properly dynamic) and that included some fixes that cut resource requirements in half - so pick up the new copy (same place, same filename) and try that.

There are still some catches with fully dynamic packing (to do with drawing order and when things get erased) but that only really matters if a whole VBox or HBox is changing significantly and all it's subobjects are getting repositioned - that is, it's fine for most uses. Suggestions for an efficient way to clear up the redrawing would be nice though.

By Jedidiah (Desklet Author), on Sun Jan 8 22:27:04 2006.

A provisional test for a new SystemMonitor desklet is available at:
http://jedidiah.stuff.gen.nz/NewSystemMonitor.tar.bz2

This desklet provides a modular configurable vertical stack of "Monitors". Each monitor type is provided as a script in the plugins directory and has its own conifg file which keeps track of multiple monitor instances within the desklet. So, for example, to configure the MailMonitor check the MailMonitor.config.txt which supports multiple mailmonitors (for different mailoxes for instance) just as adesklets does. Monitors provided for demonstration include Clock, Weather, CPU, Memory, Swap, DiskIO, NetworkIO, and Mail.

Building new monitors is relatively straightforward with all the complex positioning and rendering code farmed out to VBox and HBox widget packing containers (think Tk).

Widget packing etc. is fairly flexible, and entirely dynamic. To see this in action, go to the CPUMonitor.py plugin and uncomment the line in the "update" function. The desklet and all the monitors should now resize and reposition themselves dynamically - note that centered and right justified text behaves accordingly as well.

In terms or resource use this system is currently still more expensive than the old SystemMonitor, but I'm hoping further optimizations can be made. Dynamic resizing is quite expensive, so it's only really acceptable as something that happens occasionally (the variable sized CPUMeter icon being simply a demonstration), but should be fine in such cases. I'm still not happy with the actual resizing (is there a way to resize the buffer image? Does "resize_window" do that if I set the image context properly?) which is currently a bit of a memory grabbing kludge to escape the image id problem when freeing images. Suggestions are more than welcome.

I would appreciate any testing people can provide, and some advice on whether this project should become the new SystemMonitor, or a different desklet in its own right. In favour of the former is that it currently replicates most of the functionality of SystemMonitor. In favour of the latter is that it may gain other more interesting plugins, and the fact that I expect it will always be more resource intensive: it would be nice to keep the existing SystemMonitor as an inflexible but efficient desklet. Any advice, suggestions, or plugins people would care to provide are more than welcome.

Hopefully I can do code cleanups and begin the task of decently documenting soon.

By dessaya (Desklet Author), on Mon Jan 9 08:47:35 2006.

Jedidiah wrote:

A provisional test for a new SystemMonitor desklet is available at:
http://jedidiah.stuff.gen.nz/NewSystemMonitor.tar.bz2

Excellent, I'll have a look at it as soon as I get some spare time.

I think that what you intend to do has some points in common with doityourself, and you may find the solution for some of your problems in its source (at least, I know I implemented some workaround for the images id problem). So, feel free to grab ideas from doityourself.

Regards,
Diego

By Jedidiah (Desklet Author), on Mon Jan 9 17:31:45 2006.

dessaya wrote:


Excellent, I'll have a look at it as soon as I get some spare time.


Thank you, any suggestions would be appreciated.

dessaya wrote:


I think that what you intend to do has some points in common with doityourself, and you may find the solution for some of your problems in its source (at least, I know I implemented some workaround for the images id problem). So, feel free to grab ideas from doityourself.


I must admit I hadn't looked at doityourself, and looking at it now perhaps I should have. A lot of what I've done is similar to your work in many ways. There are some differences due to slightly different goals in terms of how we wanted things to behave, but alos much commonality, and some interesting ideas that I may well exploit.

Perhaps we should try and put together a standardised widget library for adesklets in general to save people this sort of hassle in the future. Yours is obviously more developed than mine currently, so that's probably the way to go.

Hopefully Sylvain can provide some feedback when he gets back.

By syfou (Core Developer & Desklet Author), on Wed Jan 18 15:11:15 2006.

Jedidiah wrote:


Hopefully Sylvain can provide some feedback when he gets back.

So I am back. ;-) First, I must say I am impressed by Leland's extensive re-factoring and expansion of SystemMonitor (2109 lines of Python -- mostly his, really makes a lot of Python!). Furthermore, the new code is very clean and easy to follow, even with sparse documentation. I only have a couple comments and questions:

Jedidiah wrote:


Perhaps we should try and put together a standardised widget library for adesklets in general to save people this sort of hassle in the future. Yours is obviously more developed than mine currently, so that's probably the way to go.

Provided you and / or Diego have the time to do this properly (i.e with correct documentation and some redistributable examples), I would be delighted to distribute a widgets library along adesklets; it certainly would make possible to far more people to write good desklets, and most desklets could be written with far less code.

By Jedidiah (Desklet Author), on Sat Jan 21 00:48:10 2006.

syfou wrote:


So I am back. ;-)


It's good to have you back. I hope the trip was enjoyable.

syfou wrote:

First, I must say I am impressed by Leland's extensive re-factoring and expansion of SystemMonitor (2109 lines of Python -- mostly his, really makes a lot of Python!).


Thank you!

syfou wrote:


I noticed there were no overall (it would probably at aWidgets.Module level?) size check: the layouting just crashes without warning if the screen is not large enough.


To be honest such a situation simply hadn't occurred to me, but yes, I should be checking available screen dimensions. Luckily that's easy enough to fix.

syfou wrote:


The code use a hierarchy of container widgets to control the layout, very similar to dys/widgets/group.py from Diego's doityourself 0.4.0; clever and systematic use of macros at "lower-level" widgets makes the render() operation remarkably light, but what about packing / repacking ? I suspect the speed could be damped by not using a generic geometry engine instead... It is just my instinct, so I could be completely wrong, though.


You're right that packing and repacking are the expensive operations now (though the redraws are also more expensive as they have to be separated into clearing and rendering macros). I do have an older less ambitious version of awidgets kept aside that has much stricter geometry requirements, and it does indeed run much lighter (in a large part due to the ability to combine clearing and rendering) , but has issues of it's own (various things I would like to be able to do but haven't fully implemented yet will be impossible). If the generic version proves to be too expensive in the long run I may go back to the other code and try and bring it up to shape. I'd prefer to try and make the generic version work though, as it really is a better system all around.

syfou wrote:

Provided you and / or Diego have the time to do this properly (i.e with correct documentation and some redistributable examples), I would be delighted to distribute a widgets library along adesklets;


Well I'm certainly willing to bring what I have up to standard for redistibutability - there are a few more features to be added (mouse click actions and "show/hide" functionality) for the widgets library, but mostly what it needs is vast amounts of documentation - which was on the books anyway.

The problem is that with the break over I have considerably less time now, so development has gone from fast paced to absolutely crawling. I'll work toward a solid documented version, but I can't promise any time frame on that. If Diego is interested in doing something I expect he could get there faster - though I don't know what his time is like currently.

For now put it in the "I intend to do so, but don't know when it will be done", and if Diego manages something before me all the better for having a widget library available faster.

By dessaya (Desklet Author), on Sat Jan 21 13:26:17 2006.

Jedidiah wrote:

syfou wrote:

So I am back. ;-)
It's good to have you back. I hope the trip was enjoyable.

Yeah, welcome back Sylvain :D

Quote:

The problem is that with the break over I have considerably less time now, so development has gone from fast paced to absolutely crawling. I'll work toward a solid documented version, but I can't promise any time frame on that. If Diego is interested in doing something I expect he could get there faster - though I don't know what his time is like currently.

For now put it in the "I intend to do so, but don't know when it will be done", and if Diego manages something before me all the better for having a widget library available faster.

I'm really sorry, but currently I'm studying for my final college exams, and I have little to no spare time :( There are several projects I would like to work on, and this is one of them, but I just can't right now.

By syfou (Core Developer & Desklet Author), on Sat Jan 21 20:33:30 2006.

Jedidiah wrote:


It's good to have you back. I hope the trip was enjoyable.

It certainly was: it's always nice to take a break from the continental winter.

Jedidiah wrote:


If the generic version proves to be too expensive in the long run I may go back to the other code and try and bring it up to shape. I'd prefer to try and make the generic version work though, as it really is a better system all around.


As you know, the trouble with adesklets is that you really cannot expect a higher-level interface based on the Python package to be very responsive, since the processor resources used increase very fast with the number of emitted commands, and such interfaces typically do need to emit quite a few in more dynamic cases.

This said, I would definitively prefer something generic too... As for switching back later on, I would appreciate if we could avoid it -- one of the reason I wrote adesklets in the first place was because I was tired of unstable APIs in similar softwares.

Jedidiah wrote:


Well I'm certainly willing to bring what I have up to standard for redistibutability - there are a few more features to be added (mouse click actions and "show/hide" functionality) for the widgets library,


...A multi-lines text widget would be nice too. ;-)

Jedidiah wrote:


but mostly what it needs is vast amounts of documentation - which was on the books anyway.


I depends what you see as vast amounts of documentation - personally, I think a single new chapter in adesklets manual plus one or two code samples under test/ would do just fine.

Jedidiah wrote:


For now put it in the "I intend to do so, but don't know when it will be done", and if Diego manages something before me all the better for having a widget library available faster.

Dessaya wrote:


I'm really sorry, but currently I'm studying for my final college exams, and I have little to no spare time Sad There are several projects I would like to work on, and this is one of them, but I just can't right now.

I appreciate that -- we all have our contingencies. Good luck to both of you with your school work. Just let me know by email should you need anything or should you have some content ready for provisional inclusion. Regards,

By Jedidiah (Desklet Author), on Wed Jan 25 21:24:02 2006.

syfou wrote:

...A multi-lines text widget would be nice too.


I'm curious as to what you actually mean by this - do you want text that wraps within a fixed size box (hard), or simply multiple lines of text? If the latter, is there a problem with a vbox containing text objects? Did you just want a wrapper class for such a thing? I'm probably missing something fundamental here.

By syfou (Core Developer & Desklet Author), on Wed Jan 25 21:43:43 2006.

I was thinking of the first alternative (text that wraps within a fixed size box)... I know it is somewhat harder if you consider glyphs with variable kerning, but it seems to me it can be optimized relatively easily if you just fix an upper bound for per-character width and that you rely on the textwrap module internally.

This said. since you mentioned it, a special textbox widget built around your vbox that would automatically instantiate single-line text widgets from some sequence of strings would also be nice. ;-)

By Jedidiah (Desklet Author), on Mon Sep 25 01:36:12 2006.

I finally got a little time and set to work fixing what I had. All the basic functionality is now there and working properly, and the code has been tidied up and properly documented. While doing that I also managed to make the packing/repacking more efficient (and done less often), and rewrite the entire rendering system so that any size block/box, from individual elements up to the entire desklet, can be cleared and redrawn with just two macros - this significantly improves the cost of rendering. Overall it is still expensive compared to dedicated systems (like the original SystemMonitor), but is very cheap for what it does, and has quite tolerable CPU usage (for me).

Because the new system is more expensive CPU wise than the original I've decided to keep it as a separate project, SystemMonitor2, and leave the original as it is. While it does include a documented aWidgets library, I'm sorry to say it doesn't have any multiline or wrapped text widgets. Perhaps those can be added at some later date. I'll try and upload the desklet sometime in the next week.


adesklets is proud to be hosted on:

SourceForge.net Logo

Back to adesklets.sf.net.