You are not logged in.

#1 2008-06-13 10:46:34

Kane
Member
Registered: 2006-10-08
Posts: 220

python xlib no text

Hi,
Im trying to create a patch for pypanel so i can set the display i want it showing on (see thread in community contributions)
I've got the separate configs working, but now im trying to use the display.Display() from python xlib to show it on a different screen to the one its running from.

In pypanel the main class is created like

PyPanel(display.Display())

However i tried changing it to

PyPanel(display.Display(':0.1'))

As a test to try and get it running on my second monitor if it was launched from the first monitor
This worked (partially)

The panel shows up on the second monitor, but has no text visible. But if i run the panel from a terminal in the second monitor it works fine.
I've attached some screenshots to show what i mean

Panel Launched from second monitor (working)
properpanel1.jpg

Panel Launched from first monitor - to run on the second monitor - (working but no text visible - i can click on it to open and close apps and that works fine)
notworkingpanel1.jpg

If i also run it from the 1st monitor like DISPLAY=:0.1 pypanel then it also works fine :S

Anyone have any idea what else i might need to change to get this working?

Thanks
Kane

Last edited by Kane (2008-06-13 12:32:19)

Offline

#2 2008-06-13 12:38:47

Kane
Member
Registered: 2006-10-08
Posts: 220

Re: python xlib no text

If i open up a task that has a tray icon, then it also shows, but still no text from other tasks sad

Offline

#3 2008-06-14 12:32:33

Kane
Member
Registered: 2006-10-08
Posts: 220

Re: python xlib no text

Wooohooooo big_smile
It was one of those head banging on desk moments.

I realised there was a ppmodule.c which also had references to the DISPLAY, so i changed this and i can now run it on my second monitor smile

Unfortunately my knowledge of C is even less than that of python, so lets hope i don't break it too much tongue

EDIT:

hmmm, now how do i get the variable of the current display e.g. ":0.1" from the python program into ppmodule.c at run time

For example:
In the ppmodule.c file there is

/*--------------------------------------------------------*/
static PyObject * _ppinit(PyObject *self, PyObject *args) { 
/*--------------------------------------------------------*/
#ifdef IMLIB2_FIX
    void *handle;
#endif
    Window panel;
    XGCValues gcv;
    char *font;
    
    
    XSetErrorHandler(pperror);
    gcv.graphics_exposures = False;
    dsp = XOpenDisplay(":0.1");

On the last line where it says ":0.1" i would like to change that so it uses a variable from the main pypanel python program

I think this is where it gets called in pypanel:

ppinit(self.window.id, FONT)

Would the FONT be part of the PyObject *args?
I know i probably sound like i dont have a clue what im talking about, and thats because i dont tongue lol

Last edited by Kane (2008-06-14 12:49:51)

Offline

#4 2008-06-15 13:38:56

Kane
Member
Registered: 2006-10-08
Posts: 220

Re: python xlib no text

AHA! found it, theres function, i think it must be part of Python.h (?) that parses the arguments.

PyArg_ParseTuple

So ive just used this and got it working perfectly big_smile
Just need to clean up the code now and then i'll have the patch ready if anyone might like it

Offline

Board footer

Powered by FluxBB