Main index > Python programming > resize window error

By cs-cam (Desklet Author), on Mon Oct 17 03:53:34 2005: resize window error.

Hey,

Working on a new desklet but it's giving me this error:

Code:


Traceback (most recent call last):
  File "deskicon.py", line 173, 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 188, in _fire_event
    self._alarm()
  File "/usr/lib/python2.4/site-packages/adesklets/events_handler.py", line 296, in _alarm
    timeout=self.alarm()
  File "deskicon.py", line 142, in alarm
    self._display()
  File "deskicon.py", line 156, in _display
    adesklets.window_resize(self.x, self.y)
  File "/usr/lib/python2.4/site-packages/adesklets/commands.py", line 1437, in window_resize
    return comm.out()
  File "/usr/lib/python2.4/site-packages/adesklets/commands_handler.py", line 103, in out
    raise ADESKLETSError(4,message)
adesklets.error_handler.ADESKLETSError: adesklets command error - did not resize window


The desklet is sort of modular, one module works fine but another doesn't, hard to explain. Each module (class) must have a dimensions() method that returns X and Y values to pass to adesklets.window_resize(). If I print these values I can't see anything wrong with them, the desklet appears but after one second it dies with that error, I'm assuming the second run of Events._display(). I'm guessing the cause of the error is somewhere in my mount_icon.update() but I can't see where it is. I stole a little bit of code from mounter, I haven't put much effort into the else at line 45 of mount_icon.py because my testing partition is mounted and I want to get it to a working stage before I fine tune it too much.

A second pair of eyes would be appreciated, I've been staring at this for ages and I can't find the problem, exec_icon works great so I don't think the problem stems from any code in deskicon.py. I've put a tarball of the code here, if somebody could take a look I'd appreciate it :)

By cs-cam (Desklet Author), on Mon Oct 17 08:02:44 2005.

Okay, I went out before and now I've had time to think, I changed with window_resize() code to this:

Code:


if (x, y) != (self.x, self.y):
                                self.x = x
                                self.y = y
                                adesklets.window_resize(self.x, self.y)


...and the problem is solved. Now it only tried to resize the window when it is needed which is probably a good thing but does adesklets not like resizing a windows to the same size?

By syfou (Core Developer & Desklet Author), on Mon Oct 17 12:19:36 2005.

Well, you are right that I could have made it a no-operation as easily (here you go) -- the fatal error is a bit uncivil, but justified by the fact that invoking this unrequired adesklets command is probably more wasteful than performing the check in the first place. Yours,


adesklets is proud to be hosted on:

SourceForge.net Logo

Back to adesklets.sf.net.