|
Page 15 of 47 |
|
Prev |
5 13 14 15
16 17 25
|
Next
| Last
Re: [Announce] Advanced Clock Plugin
skykooler, I'm either almost at the point where I can present you (and everyone else, really) with a working model of processor and memory usage monitoring in the clock style, OR I'm almost at the point where I throw my hands up in the air in frustration and go with your sleeps using thing. Memory was easy as hell, but this processor thing has hit a little snag.
I figured out a method that doesn't use sleeps, but as a result, the intervals between measuring /proc/stat values are so small, that it almost always gives 1 or 0 as the value to the equation of time CPU spent in non-idle processes, vs. time spent in total (or anything at all. If you do the cpumem applet route and compare ONLY idle, it never reports anything but 0, because there's no idle time in the time spent processing the script, I suspect, during the two moments it fetches info from /proc/stat. (I am pretty sure it's not a math screw up, because other than the idle times, all the others do have time to change, and under the right circumstances, 2, 3, and even up to 6 has shown up [when comparing differences between different moments of the first three numbers of /proc/stat together. Division of that difference by the difference in 'total' time also yields either 1, 0, or [until I figured out to account for possible zeroes in the 'total' time, which is the denominator] errors.) Mathematically all of this basically comes down to exactly that: I can't make python wait long enough between checks for the stats in procs to accumulate enough 'Jiffies'/USER_HZ to change significantly. The only reason I got any changes at all was by placing one /proc/stat opening and closing before the opening and closing of /proc/meminfo, then calculating the mem part of the script, then fetching the second instance of /proc/stat. The main thing tripping this up is needing to declare a variable in python before you can use it (it's probably not a problem in all of python, but I couldn't figure out how to do it within a clock-style once, without that first declaration either crashing the clock style, or being run every new iteration of the clock - you can put that down to lack of Python knowledge or some unintended behavior, I don't know. But right now, this is what I was trying to do for about two days straight, before stumbling upon the above, which still isn't actually a practical solution (if you pad it with enough code between the two accessings of /proc/stat, it either just ends up wasting more processing power on running the padding, and it becomes more efficient to use your sleep approach. Wonko: Am I missing something here? Is there a way I can set a variable from within the clock style once, just so that it's initialized, and then have later looping parts of the draw clock code use it? To be clear, I'm going for something like this: cpuprevious = 0 [or NoneType, doesn't matter] [blah blah blah various code] cpulist = file("/proc/stat", 'r') [more code] cpucurrent = [stuff taken from cpulist.readline().whatever] cpu = cpucurrent - cpuprevious cpuprevious = cpucurrent The point being, I want the initializing cpuprevious = 0 code to just run once, and I want cpuprevious = cpucurrent to run every execution. That way the last run's current /proc/stat gets uses as the previous value for the next run, etc. The very first initial calculation ends up off, but you only see it during boot/restart of hildon-status-menu, and then processor load would be on-off anyway. I have tried putting "cpuprevious = 0" [my variable names are a bit different, but for example's sake, we're going with "cpuprevious"], in various places in the code. It always has to run before the cpuprevious = cpucurrent, because if it doesn't, Python will throw a fit about cpuprevious not being defined when it hits "cpu = cpucurrent - cpuprevious". Naturally making them equal each other before you run that "cpu =" is counter productive, because then it'll just make cpu = 0 the entire time, so again, you have to define cpuprevious before you run "cpu =", but the only places I've been able to put it within the clock style without crashing the clock causes that line to be run on every clock-refresh, thus wiping whatever the 'last' value may have been. I also tried using "try cpuprevious/except NameError/else/finally" combinations, but so far, they seem to get stuck on the one choice they're given. So, the clock style initializes, it hits the "try", hits the exception, and then runs the exception (defining the variable as whatever). Then it does the rest (cpuprevious = cpucurrent at the end), and I thought that from there, when it hits the next loop, it will have a defined cpuprevious, so the try/except thing won't get a name error, and would move on. But, apparently, it gets stuck running whatever the exception suite was, even when the exception is no longer valid. I also tried some stuff with while loops, but failed at that too, since I couldn't find anything in the last few days of non-stop working (literally, this has become addictive, most of my day is doing this) that would check for the variable not existing. I tried "while cpuprevious not in locals()" and "while cpuprevious not in globals()", but near as I could tell, that doesn't do it either. I mean, I haven't literally done every conceivable combination of code possible, but pretty close, and I haven't found it to be doable within the clock style with my limited skills. Oh, also, "from __future__ import division" didn't work from within my clock style. Anything I'm missing about python on the N900, that could explain why this didn't work for me? (Of course, I also manage to have a bunch of other stuff I thought I imitated just fine from other example python code just not work... so I'm sure there's something really important I just don't know about importing.) - While I wrote this, Wonko posted about the new update - Wonko, I'll tell you if I get any bugs tomorrow. I just spend an all-nighter again working on the above problem (this is day 4 or 5 I did that in a row now... lol), so I want to sleep. |
Re: [Announce] Advanced Clock Plugin
Quote:
There you can initialize member variables like this: Code:
class DecimalClock(clock.Clock):P.S.: I didn't read your complete post yet, just wanted to give you a quick feedback. ;) By the way, I seem to have missed what you're up to. What exactly are you trying to do? Edit: By the way, if you have the "Show Seconds" option disabled the clock is only updated once per minute. Consequently, the draw_clock method is also only called once per minute. |
Re: [Announce] Advanced Clock Plugin
Just upgraded from the old 0.3 to 0.9.2-1
and I seem to have lost the fonts somewhere, as the binary clocks all work but the character-based clocks are just blank. This is on my stock-version unit (my test unit which I normally use to check things out on is still not working) so it has no special things going on aside from PR 1.3 and the usual stuff. I see a very involved list of fonts to choose from but none seem to show up in the clock - just a black blank. I changed the color settings to make sure it was not doing something silly like printing black on black but again no joy. I tried just using sans and nokia sans and a few others from the list but the results are always just a blank. The binary and bcd and analog clocks are all ok, only the clocks needing text are affected. I am still looking for where this went off the rails, uninstalling and rebooting had no effect, so I am guessing I have a misconfigured gconf setting maybe? Found it - I was doing something silly like using the default text scaling setting of 1. This might be better set to some nominal scale, perhaps? I notice it always resets to 1 each time I open the dialogue, which may be a problem for some users. Anwhay - it works even better now thanks:D:D:D:D:D |
Re: [Announce] Advanced Clock Plugin
Weird - I just set text scaling to 80 or 90 and it jumps to 100.
Not a real problem but wondering what the mechanism for that is... Also notice that when I add a personal clock it immediately to /usr/lib/advanced... it immediately becomes available for selection but it does not run when selected, the previous selection runs. I am guessing this is because only clocks found at boot are available perhaps? Rebooted and no clock now, will try uninstall and re-install and see where I broke it hildon-status-menu mantra - (this helps): Code:
pkill -f /usr/bin/hildon-status-menu |
Re: [Announce] Advanced Clock Plugin
Great app! I'm interested in seeing the DateTime clock and the Decimal clock be configurable such that I could put an arbitrary strftime-compatible string in to get whatever date/time formats I want. Also, I would really like to see support for fractional days (probably I would pre-process %J into millidays so that it remains compatible with normal strftime syntax).
I am willing to write the code for this. Is a patch to this effect likely to get accepted? Is there a public source repository or other good thing or are hackers just extracting python from the .deb and using diff? |
Re: [Announce] Advanced Clock Plugin
Quote:
Hope this helps! |
Re: [Announce] Advanced Clock Plugin
Quote:
|
Re: [Announce] Advanced Clock Plugin
I just uploaded version 0.10.0.
This version adds a simple "world clock" and an option for selecting the displayed time zone. Also, this version hopefully fixes some issues which were mentioned here. Quote:
Was reading an integer from gconf whereas it should have been float. Quote:
https://garage.maemo.org/projects/advclockplugin Patches are also welcome (as long as they don't break any existing logic). ;) Or you could write your own addition as skykooler mentioned. Advanced Clock Plugin is intended to be open for extension by others via custom "clock styles". Quote:
A good start would probably be to copy the existing DecimalClock. Of course you would need some String input field in the configuration plugin and a method for adding that string to the clocks. I could add a free text field and set it in a way such that the text is available when inheriting from the Clock base class. This would others also to use that free text probably for even completely different purposes. Currently, all options that can be set via the options frontend are accessible when inheriting from the Clock base class. So anyone writing a custom clock can access these fields. Have a look in clock.py to see what is currently available. |
Re: [Announce] Advanced Clock Plugin
While I was at it I just uploaded version 0.11.0 to extras devel.
Firstly, this version fixes a bug with respect to dependencies. Secondly, this version adds a "Custom Format" setting which can be used for basically anything you are up to. ;) In clocks inheriting from Clock (in clock.py) the content of this field can be accessed via "self.custom_format". |
Re: [Announce] Advanced Clock Plugin
Quote:
can i give you a few idea to makes this plugin even better??? i only suggest two thing to adds for this plugins.... 1.change the analog clock = i was hopping you can change the circle analog clock to square analog clock & makes the clock use all the space in the status bar so the square clock can looks bigger... 2.hide the clock = after every upgrading to any version you can see the clock disappear from the status bar (really looks nice) & will re-appear after you have reboot it....i hoping you can adds hide the clock function on this plugins.... hopes you can takes my idea as a considerations for the latest version next.... |
| All times are GMT. The time now is 21:28. |
Page 15 of 47 |
|
Prev |
5 13 14 15
16 17 25
|
Next
| Last
vBulletin® Version 3.8.8