[PyKDE] Some questions
David Boddie
david at boddie.org.uk
Thu Oct 26 12:47:48 BST 2006
On Wed, 25 Oct 2006 20:46:13 -0700 (PDT), Reza Salari wrote:
> 1- I use Qt Designer for my ui files and after using pyuic it creates PyQt
> classes. Fairly simple. I know designer3 has some kde widgets but it seems
> that designer4 does`t have plugins for kde widgets. Am I right? If so, how
> can I use designer4 for visual creation of kde widgets (for example a KPart
> container)?
You can't do it directly. You might be able to use placeholder widgets to
represent KDE widgets, using Designer's custom widget promotion feature,
but you may need to be careful with the .ui files it generates. I'm not
sure if pyuic can handle Qt 4 .ui files. (Of course, pyuic4 can handle them,
but you would use that with PyQt4 rather than PyQt or PyKDE.)
> 2- I think Qt4 meets my needs better, because it has QX11EmbedContainer
> (which seems to be supported in the next stable release of PyQt, too). The
> problem is if I embed that scientific console to my application, can I send
> some commands (not only SIGNALs but also scripts) from main window to the
> embedded widget?
If the scientific console is shown in an XEmbed client widget, things like
focus handling and keyboard input _should_ work normally, as far as I can
tell. However, if you want to automate input, you may need to use other
methods to get data in and out of the embedded console.
> Is QProcess capable to do that? or if it needs some API like solution and
> if that console doesn't provide an API, is there a way to solve this
> problem? Any comment or link for a starting point is highly appreciated.
> ( I don't know to search about what).
If you don't actually need to show a console then it might be possible to
just use QProcess to send data to the application and read the output it
produces. I think you should be able to do that with most well-behaved
console applications. It's something that we discussed on this list a
while ago:
http://www.diotavelli.net/PyQtWiki/Capturing_Output_from_a_Process
> 3- Another thing that I want to embed is a konsole. It seems that it sould
> be simple to embed konsole from KParts but there is not an example (I know
> there is a KHTM example). There are so many questions about implementing a
> konsole in PyKDE in the net but all with no success in getting a reply.
Although there's the konsolepart in PyKDE, it may also be worthwhile looking
at alternatives if you are thinking of using PyQt4:
http://lists.trolltech.com/qt-interest/2006-08/thread00741-0.html
Having said that, solutions like pyqonsole are written for PyQt not PyQt4.
I see that eric4 has a nice console/shell, though it seems to depend on other
components, like QScintilla and other parts of eric's infrastructure.
> Does any one decide to write a sample code? I really need a starting
> point... .I know also C++ but at beginner level and can understand not
> heavy C++ sources. So a useful simple C++ code will be useful too; I found
> some,but finally confused with their cross-references. (better to be in
> python).
If you can give us a bit more information about the application you want to
embed into your application, we might be able to come up with some more
suggestions for ways to do this.
David
More information about the PyQt
mailing list