Re: [PyQt] PyKDE: problems sending singals to KPART

2008-06-05 Thread Jim Bublitz
On Wednesday 04 June 2008 23:42, Thomas Winkler wrote:
 Hello,

  Yes - short of writing some C++ DCOP would be the solution, if KPDF
  exposes a sufficient interface via DCOP, which apparently it does.

 [...]

  There is an example (example_dcopext.py) in PyKDE/examples.

 I had a look at the example. My feeling however is that it is not an option
 for me since, contrary to the example, I want to embed the kpart in my
 application instead a launching a separate process. For DCOP control as
 shown in the example I need the $PROCNAME-$PID id string which I
 obviously do not have.
 While writing the above the idea came to my mind that I could simply use
 the the name and pid of my own app which embeds the kpdf part and send dcop
 messages to my own app to control the kpdf part. So far so good.
 My app is planned to embed more than just one kpdf kpart but when
 inspecting my app with kdcop I only could see one single kpdf component
 (eben though my app has two of them). Using kdcop I can send messaes to the
 kpdf part. They are executed for the kpdf kpart that was last instantiated.
 I could not find a way to control the other kpdf kpart as it does not show
 up in kdcop. What is the reason for that?

You could fork each of the KPDF processes, and they'd have unique PIDs then. 
Another possibility is QXEmbed (should be an example for that in PyKDE too), 
however that can be somewhat unreliable in my experience with it.

You could also use KHTMLPart for the GUI and have that launch KPDF instances, 
although I don't know if that buys you any more control in your application.

 Coming back to the idea of writing some own c++ code: What exactly would I
 have to write?

You would need  a wrapper which 1) loads (or links to) the .so lib KPDF is 
based on (and since it's a KPart, it has a .so lib) and 2) makes the KPDF 
methods you want to use available in Python.

If you only want a method or two, you could look at the Python/C API to 
accomplish both of those. Most good books on Python usually include something 
about writing C modules to interface to Python. Otherwise, you can write a 
C++ wrapper that exposes the classes/methods you need and do bindings for it 
using sip.

Jim

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] How to get an event after an Enter key is pressed?

2008-06-05 Thread IloChab
I wrote an application where I display sql data on a
QTableView+QSqlQueryModel read only table.

The current version allows you to select via mouse a record on that table
and then add it to an other one, pressing an add-button.

I'd like to give an alternate way to do this: after record line is selected
on the table I'd like to be called on the pression of enter's key and react
to it just like if the add button was pressed.

If is possible to obtain this behaviour I'd like to trap an other button
too:
I'd like to be called when delete's key is pressed while the record line is
selected.

Thanks in advance for your help.
Ciao
Licia
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt