Re: [PyQt] desktop workspace

2011-08-06 Thread Arnold Krille
On Saturday 06 August 2011 01:35:55 emmanuel_mays...@lynceantech.com wrote:
> I am trying to save the geometry and and the workspace where the
> application has been closed. Is there a way with Python/Qt to get the info
> on the workspace number!?

Why? Its either the window-managers task to restore that exact position as 
before, or its the winow-managers task to place your windows where they fit. 
And its the users task to decide what the window-manager should do. Your app 
shouldn't worry about that.
And it will be _very_ surprising (if not misleading and disturbing) when your 
app re-appears on the desktop it previously was while the user starting your 
app is on a different desktop altogether and expects a window coming up.

So in short: Don't worry about it, thats the window-managers task, focus on 
the tasks of your app.

Have fun,

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Displaying . in a tableitem

2011-07-30 Thread Arnold Krille
On Friday 29 July 2011 21:24:44 Protopia wrote:
> Thanks. I tried looking up ellipsis on the internet and came up with the \U
> equivalent of the \N below which worked.
> 
> I had the ellipsis copied and pasted from Microsoft word into a "" string
> and that seemed to be the problem.

If you were on a system that does utf-8 in editor and python-source files, and 
maybe even on a modern days linux with a german keyboard and layout, getting 
the ellipsis is as easy as hitting AltGr+. …
But we crazy germans also have typographic „“ on our keyboard…

Have fun,

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Inter-office distribution/installation of packages/modules

2011-06-16 Thread Arnold Krille
On Thursday 16 June 2011 19:13:10 James Polk wrote:
> Apologies if this is too off-topic,but I'd like to propose a discussion
> of how-to's and where-fore's regarding distributing python modules to a
> user-base.
> 
> Recently, I've been using Mark Hammond's excellent pywin32 packages,
> along with NumPy and PyOpenGL,etc.  I have a user-base of approx 40 or so,
> who will need these packages added to their base Python install.
> 
> Rather than visit 40 separate desktops, I used "pip"  (pip freeze) to get a
> short list of packages outside the base install, and wrote an app that each
> user can run to find what's missing, and initiate the appropriate
> install,etc. Then I realized that "pip" itself was a 3rd party
> package!..DOh!
> 
> I can fall back and use "help('modules')" to generate a new list, but it
> lists *everything* in the install,...usable but not as succinct, for
> pywin32 for example, it lists about a dozen things with a form of "win32"
> in them,...and doesn't appear to return the real package name that is
> associated with the binary installation file.
> 
> Surely these issues are fairly common phenomena in many workplaces,etc...
> I'm wondering if anybody out there has any knowledge, tips, or experiences
> regarding this issue that they can share.
> 
> I've found "moduleFinder", and various ideas about searching "sys.path",
> pkgutils, but nothing else that seems like a long term viable and/or
> elegant solution.

I don't really get your question? Why are you so serious about third-party 
applications/modules? Do you suspect licensing problems?
If that is the case: As long as the app/modules you develop stays within the 
company that pays you generally, its not "publishing" the stuff. So when you 
wrote that app during your day-job for your employer and want to distribute it 
to all the other employers, neither are you affected by the licenses of the 
third-party modules, nor do you have to use a certain license for your code. 
Which actually belongs to your employer, thats why using it inside the firm is 
no publication...

Disclaimer: I am not a lawyer.

Have fun,

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Multiple Inheritance

2011-04-20 Thread Arnold Krille
On Wednesday 20 April 2011 13:01:57 Zoltan Szalai wrote:
> Hi All,
> 
> The PyQt Reference Guide says:
> "It is not possible to define a new Python class that sub-classes from
> more than one Qt class."
> [
> http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/gotchas.html#mul
> tiple-inheritance ]
> 
> The code attached works here until you remove the comment before the
> last line. Then it raises a TypeError.
> I should really use something like this in a PyQt app (if it's not a
> very bad idea anyway) and I wonder what are the limitations here or what
> are the best practices to solve this kind of problem (if there are any).

(I haven't looked at your code.)

The limitation doesn't come from python or PyQt. Its purely because of Qt and 
means that you can not inherit from multiple classes that are or inherit from 
QObject. And its the same for all class-trees I believe. Unless you use 
virtual inheritance in C++, but last time I tried (some years back) that led 
to strange errors and was neither encouraged nor supported in any point in Qt.

Have fun,

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] PyQt logger

2011-03-09 Thread Arnold Krille
On Wednesday 09 March 2011 12:19:37 Adrian Casey wrote:
> I plan to share as much code as possible to the point where the
> command-line interface will  actually invoke the GUI but the GUI will be
> hidden and the command-line options will simply be passed to widgets in
> the GUI.

This makes now sense. A commandline-app should be able to run without a gui, 
that means it should be able to run without any X-session. The first you are 
planning to do, the second you will not fulfill. Invoking the gui but hiding it 
will still require a graphical display. Even using QApplication will require 
graphics.

You have to use different classes where the parent class does what you want in 
an abstract way and then you create one descending class that does it the cli-
way and one that does it the gui-way. And the you invoke these classes (and 
QCoreApplication/QApplication) depending on whether you want the gui or not.

Have fun,

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Complex header of QTableView

2010-11-23 Thread Arnold Krille
On Tuesday 23 November 2010 15:36:18 Vadym wrote:
> I created enought complex table based on QTableView (with models,
> proxy, interconnections, etc) but now my task is similar complex
> header for this table with miltiple rows, columns span and so on. As
> far I know seems it's not trivial problem in Qt at all but perhaps I
> wrong or exists roundabout ways, could you please share your recipes?

If you want your address in peoples kill-file / ignore-list, go on, post the 
same question another three times within the next 24 hours.

If you want help, wait at least 24 hours on weekdays or until the next 
workingday before re-posting the question. If no one has an answer by then, 
_improve_ your question by adding more information and maybe even list the 
ideas you tried in the meantime. (*)

Have fun,

Arnold

(*) I didn't list "search the internet" and "read as much as you can about the 
topic" because that is obligatory.


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] ANN: PyQt v4.8.1 Released

2010-11-08 Thread Arnold Krille
On Monday 08 November 2010 17:40:02 Phil Thompson wrote:
> On Mon, 08 Nov 2010 08:11:07 -0500, John Posner 
> 
> wrote:
> > On 10/30/2010 7:47 AM, Phil Thompson wrote:
> >> PyQt v4.8.1 has been released and is available from the usual place.
> > 
> > Over the past year, downloads from
> > http://www.riverbankcomputing.co.uk/software/pyqt/download have been
> > impossible for me. More precisely, the download speed starts at about
> > 0.6KB/sec, and degrades from there. After a minute or so, I put the
> > download out of its misery. Does anyone else experience this behavior?
> 
> Out of curiosity, what are you using (ie. which browser) to download?

We used Firefox on windows and chromium on Linux both with the same (slow) 
result. We are in Germany, other sites work as well as they should with our 
universities connection (that is a lot faster then downloads from 
riverbankcomputing...).

Have fun,

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] ANN: PyQt v4.8.1 Released

2010-11-08 Thread Arnold Krille
On Monday 08 November 2010 14:11:07 John Posner wrote:
> On 10/30/2010 7:47 AM, Phil Thompson wrote:
> > PyQt v4.8.1 has been released and is available from the usual place.
> 
> Over the past year, downloads from
> http://www.riverbankcomputing.co.uk/software/pyqt/download have been
> impossible for me. More precisely, the download speed starts at about
> 0.6KB/sec, and degrades from there. After a minute or so, I put the
> download out of its misery. Does anyone else experience this behavior?

We also encountered this some weeks ago when downloading the windows binaries. 
Didn't matter which machine (in our university network), slooow download.
I only succeeded because I did let it load these 12 or something MB for 
several hours...

Have fun,

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] PyQt and MPI

2010-10-29 Thread Arnold Krille
On Friday 29 October 2010 18:37:44 dizou wrote:
> I have some code that uses Open MPI to do some pretty intense calculations
> (KDEs). I made a GUI to set some parameters for the calculations. Is there
> any way to integrate these two applications?
> So what I would like to have is my GUI to my on one processor, and then
> when I click a button to do the calculations, the MPI stuff starts.

What is your question?

Its possible. Just do it:-)

As I understand it your calculations are based on some C++ classes. Export 
these interfaces to python via sip/ctypes/whatever and you are set.

You won't be able to tell the os which core to use for which process, but that 
would be brain-dead anyway...

Have fun,

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] API 2 and Qt Designer

2010-09-28 Thread Arnold Krille
On Tuesday 28 September 2010 18:44:17 Baz Walter wrote:
> On 28/09/10 11:11, Sybren A. Stüvel wrote:
> > PS: Please reply to just the list, there is no need to do reply-all,
> > I'm on the list too. With a reply-all I get your mail twice.
> 
> there is a mailman option to prevent this.
> 
> go here: http://www.riverbankcomputing.com/mailman/options/pyqt
> 
> and look for the option "Avoid duplicate copies of messages?" (should be
> last in the list).
> 
> note that the option can be set globally.

Note that this seriously messes up any filter that filters on the mailinglist-
id...

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] How is thousands separator displayed in QDoubleSpinBox?

2010-07-05 Thread Arnold Krille
On Monday 05 July 2010 15:15:32 bluekyu wrote:
> Hello, I want to display thousands separator in QDoubleSpinBox.
> (For example, I may click upward button at 999 and it dispaly 1,000)
> I tried to find this in google and doc.
> But I don't know how to do this. Can I do this?
> My environment is python3.1, pyqt 4.7.3, kubuntu 10.04 and
> QWidget.locale().groupSeparator() is ','

I haven't checked this explicitly but I believe the thousand-separator as well 
as the decimal-separator depend heavily on the locale. That is on a German 
system it will use ' ' as thousand separator and ',' as decimal-separator in 
contrast to English systems where its ',' and '.'...

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Forum

2010-04-08 Thread Arnold Krille
On Thursday 08 April 2010 14:04:20 Francesco Biccari wrote:
> I have been in this mailing list for few days, however I noticed that
> a mailing list
> is very inefficient.
> I think that a forum is the rigth answer.

I think you are younger than 20 years.(*)

A forum is nice. But try following twenty forums all with their topics and 
threads every day for more then one month (of holiday).
Following mailinglists trough your mail-client is much better. No 
advertisement forced on you by the forum-owner, no needless stuff like blicking 
pics, much better thread support (depends on the client of course). And all in 
one view, not in twenty browser windows/tabs.
You can keep your own archive, you can use the lists archive, you can use the 
archives of google and friends to search the topics...

(*) I found people below a certain age, don't pin me on the 20, to be more 
used to forums (with proprietary private messages) then to email where'd get 
much more for free. Interesting. And this changes after some time and some 
experience. Sometimes it also the beginners liking forums more. But my 
experience is that they either find a mailinglist-to-forum gateway or soon 
realize the advantages of mailing-lists...


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Qt4.6 released... When will PyQt Support it?

2009-12-01 Thread Arnold Krille
On Tuesday 01 December 2009 15:47:21 Jason H wrote:
> Well the announcement has come! I've been looking forward to 4.6 forever!
>  So my question is naturally, when will I be able to use PyQt with it?

As Qt tends to be binary compatible and PyQt isn't linked statically afaik, 
the answer would be: now!

Only the new features (not the bug-fixes!) would need new work in PyQt...

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: uic.load (was: [PyQt] Re: Problem with latest PyQt4 snapshot)

2009-09-22 Thread Arnold Krille
On Tuesday 22 September 2009 19:57:46 Phil Thompson wrote:
> On Tue, 22 Sep 2009 19:42:27 +0200, Arnold Krille 
> > on a side note: Is it possible to have uic.load() respect the
> > python-library
> > dirs?
> I'm not convinced it's a good idea...

Security issues?

I think it would be quite cool if

 uic.load( ffado.widgets.mixer, self )

loaded the ffado/widgets.mixer.ui the same as

 import ffado.widgets.mixer

imports ffado/widgets/mixer.py(c), regardless whether its local (ie. relative) 
found or "only" system-wide.

> It's easy enough to implement something yourself using __file__.

Currently I created an own function which knows about the install path (which 
is inside the standard python library paths. Well, to be exact, my function 
first checks if the desired ui-file is reachable via relative paths when a 
developer is testing ffado-mixer without installing it. Only if that doesn't 
work, the absolute installation path is used.

Have fun,

Arnold

PS: No need to CC me, I am subscribed;-)


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

uic.load (was: [PyQt] Re: Problem with latest PyQt4 snapshot)

2009-09-22 Thread Arnold Krille
Hi,

On Tuesday 22 September 2009 19:04:16 Phil Thompson wrote:
> On Tue, 22 Sep 2009 18:42:47 +0200, Detlev Offenbach
>  wrote:
> > On Dienstag, 22. September 2009, Phil Thompson wrote:
> >> If you don't have control over the version of PyQt your users are using
> >> then you should run pyuic as part of your installation process (or
> >> dynamically load the .ui files).
> > That is too bad and pyuic didn't do that in the past.
> Yes it did, it just doesn't happen very often and only when necessary. uic
> is the same.

on a side note: Is it possible to have uic.load() respect the python-library 
dirs? So one can put the ui-files next to the py-files and not worry about 
paths?

Or is that already implemented? (If yes, it didn't seem to work for ffado-mixer 
when I tried first...)

Have fun,

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Calling slots in a QThread?

2009-08-13 Thread Arnold Krille
Hi,

On Thursday 13 August 2009 00:15:13 Lukas Hetzenecker wrote:
> But If I call long-running funtions in a run() method everything works as
> expected.

Are these long-running functions implemented in python? Otherwise they will 
release the GIL and your gui becomes snappy again.

> > 2) Use processes instead of threads. Then you can run several instances
> > of the python interpreter at the same time.
> This seems too complicated for this simple task.

A "simple" task that really needs threads?

Looking at my students learning python/programming, I would say using threads 
is already pretty complicated and not needed for a simple task.
(Of course if you get to know them, it becomes easier. But then you also know 
about starting processes and communicate via shared-memory/named-pipes/etc.)

Have fun,

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Calling slots in a QThread?

2009-08-12 Thread Arnold Krille
Hi,

On Wednesday 12 August 2009 19:04:46 Lukas Hetzenecker wrote:
> is it possible to connect signals from a Widget to a slot in a QThread and
> ensure that the Widget responds to keypress and mouse events?
> I attached my first try, but it doesn't work, the UI blocks until the
> execution of the function is finished.

Without looking at the code: This is not a problem with Qt but with python. 
The keyword is GIL, the global interpreter lock which ensures that only one 
thread is executing python in this runtime instance.

There are two ways to have "true" threads:
1) Implement the thread in C++ and bridge it to python with SIP the same way 
Qt is bridged to python.
2) Use processes instead of threads. Then you can run several instances of the 
python interpreter at the same time.

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Multi-tasking and GIL

2009-08-04 Thread Arnold Krille
Hi,

On Tuesday 04 August 2009 11:45:49 NARCISO, Rui wrote:
> I have a quad-core linux machine and I would like to take advantage of all
> these extra cores to perform multiple heavy tasks simultaneously.
> If i understood it correctly, the GIL will prevent me from multi-threading
> this heavy tasks in order to make them run in parallel.
> My question is then, how to do this? Will QProcess be the solution? (the
> heavy tasks can either be ran by direct python acess through a run()
> function or in stand-alone when launched from the command line)

There are at least two solutions:

1) If the work-threads need to use python, run them as independant processes 
(via QProcess or process-module). Communication can then go via std-io, named 
pipes, sockets or if you don't want to invent everything from scratch, via 
dbus or similar protocols.
2) If the heavy work heavy enough to allow writing it in C++, create all the 
work-stuff as C++ classes and use them in python via SIP. That way the real 
running of the C++-code should unlock the GIL.

> The information in this e-mail is confidential. The contents may not be
> disclosed or used by anyone other then the addressee. Access to this e-mail
> by anyone else is unauthorised. If you are not the intended recipient,
> please notify Airbus immediately and delete this e-mail. Airbus cannot
> accept any responsibility for the accuracy or completeness of this e-mail
> as it has been sent over public networks. If you have any concerns over the
> content of this message or its Accuracy or Integrity, please contact Airbus
> immediately. All outgoing e-mails from Airbus are checked using regularly
> updated virus scanning software but you should take whatever measures you
> deem to be appropriate to ensure that this message and any attachments are
> virus free.

I know some companies lawyers think these disclaimers are actually useful and 
needed. But could you separate them with a signature-mark ("-- " in one line)?
That way people answering wouldn't have to delete that part by hand.

Have fun,

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Small paid development task

2009-07-17 Thread Arnold Krille
On Wednesday 15 July 2009 23:27:45 Jason H wrote:
> Well no one jumped at my offer. I am curious, what would it take?

I am meaning to look at sip for quite some time. This would be a wonderfull 
opportunity. And a bounty would be fun.
But I haven't done anything with Kinetic. And unfortunately I am in the middle 
of moving houses, which decreases time for such projects to a small to the 
hours when its dark and when I am tired (to tired for real programming). :-(

Maybe it changes when the flat is set up...

Have fun,

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Question about QMenu's triggered action

2009-06-01 Thread Arnold Krille
On Sunday 31 May 2009 22:33:51 Tony Willis wrote:
> According to the Qt4 docs, a QMenu is supposed to be capable of emitting a
> `triggered' event which contains the action which was triggered. (I realize
> that its a better coding practice to connect the `triggered' event
> associated with individual QActions to their own separate callbacks, but
> I'm porting an application from Qt3 to Qt4 and I'd prefer not to
> have to write a whole bunch (~50) of new callbacks.) So I'd like to get the
> more global QMenu triggered event to work. Unfortunately, with PyQt, I
> can't seem to see or catch the QMenu's triggered event. The attached PyQt
> demo script illustrates the problem. Can someone point out what I'm doing
> wrong?

I believe you have to decorate the python slot so the connect knows which 
arguments it has. Something like @pyqtdecorator( "QAction" )...

And I really don't think its good coding practice to have one connection and 
do the split yourself. Cause actually the signals are send individually, then 
combined by qmenu, send as one and decomposed into a big select-statement by 
you again.
Why not just connect the individual signals?
And connecting to the actions directly has another advantage: Plug them into a 
toolbar (additionally to your menu) and you get the same signal (because its 
the same action). Or use them in multiple menus (like in the menubar and in 
the context menu) and still deal with only one signal. And deal with only one 
action to activate/deactivate if needed...

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Inverse setModel

2009-04-17 Thread Arnold Krille
Hi,

On Friday 17 April 2009 21:15:44 F.A. Pinkse wrote:
> Yes I know it is probably the wrong group, but
> Am I missing the reverse of QAbstractItemModel.setModel...getModel or
> has it a different name?

I think you mean QAbstractItemView as there is no actual reason to ask for the 
model of the model (unless you want it to return self/this:).

And then: The Qt-way of these functions is setX(...)/x(), not 
getX()/setX(...).
QAbstractItemView::model() / QAbstractItemView.model() returns the model the 
view is connected to.

Have fun,

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] segfault when using a proxy and SIGNAL( "clicked(QModelIndex)" )

2009-04-13 Thread Arnold Krille
Hi,

On Thursday 09 April 2009 19:35:32 TP wrote:
> Here are the most important lines:
> self.view = QTreeView( parent )
> self.connect( self.view, SIGNAL( "clicked(QModelIndex)" )
> , self.cellClicked )
> def cellClicked( self, qmodelindex ):
> if qmodelindex.isValid():
> print qmodelindex.internalPointer()
> The problem seems to be related to qmodelindex, the segfault appears when
> taking internalPointer method.

I think there is a very good reason internalPointer has the name it has. It is 
a pointer for internal purposes, that is internal for the model so it can map 
indexes to the internal data structures. (And yes, that is needed for anything 
except simple list or table models.:)

You shouldn't really access it from a view (or from a proxy-model). Actually 
the reason for the model-view-pattern is that you don't have to access the 
internal structures of the model from the view...

And here is another reason this crashes: Not only don't you know which type 
(if any) the object pointed to is, you also don't know whether python knows 
about that data type (python doesn't really know about pointers).

Have fun,

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Global Interpreter Lock

2009-04-10 Thread Arnold Krille
Hi,

On Friday 10 April 2009 20:26:37 Jason Voegele wrote:
> I am a relative newcomer to Python and I don't know much about the Global
> Interpreter Lock (GIL) in general.  However, I am developing a PyQt
> application that makes fairly heavy use of QThread to perform multiple
> tasks concurrently.  I've heard some vague statements that PyQt manages the
> GIL automatically, but can someone give a more precise statement about how
> the GIL works for PyQt applications, especially when QThread is involved? 
> Are there any gotchas that I need to look out for?

Are your QThread-derived threads written in python or in C++? If they are 
python, you hit the same limitation the threading-derived threads hit: Only 
one thread can be executed in the python-interpreter at a time. And even if 
PyQt releases the GIL automaticly, it can't release it if you are executing 
python-code.
If your threads are C++ classes I think SIP/PyQt will release the GIL so your 
threads will truly run in parallel (assuming you have more then one 
processor).

Have fun,

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] will pyqt follow qt license model?

2009-04-10 Thread Arnold Krille
On Friday 10 April 2009 11:07:38 bobbyrw...@gmail.com wrote:
> Because if they don't an open source alternative will come out making them
> irrelevant? Sent from my Verizon Wireless BlackBerry

The same was probably said when Qt came into business. And see how long they 
live already.

If you think you can easily start something similar to PyQt but is "truely 
free[TM]" be my guest...

And actually there is an open source alternative. Its called PyQt and is 
usable by open source projects for non-profit (aka free) software.

Arnold

PS: Discussing about free software and then sending from Verizon is kind of 
strange...


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] will pyqt follow qt license model?

2009-04-10 Thread Arnold Krille
On Thursday 09 April 2009 13:41:28 jelle feringa wrote:
> I've searched this mailing list and although the QT lgpl news was discussed
> at length, but I couldnt distill from this list whether pyqt will follow
> qt's licensing model. Has this been decided yet?

I think one of the main reasons Qt was released under LGPL was that Nokia 
isn't as dependent on the paid licenses as trolltech was. Which leads to: As 
soon as riverbankcomputing gets bought by a big company or becomes a big 
company itself, they will have an easier decision about LGPL.

But when you are making money with your (presumable) closed-source pyqt app, 
why should the makers of pyqt go for free???

Have fun,

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] thread in pyqt ... simple example needed

2009-04-05 Thread Arnold Krille
On Sunday 05 April 2009 21:29:44 Hazen Babcock wrote:
> I'd suggest expanding your MyThread class to something like this:
> class MyThread(QtCore.QThread):
>  def __init__(self, parent = None):
>  QtCore.QThread.__init__(self, parent)
>  self.running = 1
>   def run(self):
>   n = 0
>   step = 1
>   while self.running:
>   n += step
>   print n
>   self.msleep(100)
>  def stop(self):
>self.running = 0
> You should also look at the QtCore.QMutex() class, which provides a way
> to synchronize (via locking) between the thread process and other
> processes.

Another reason while this will not work as expected is the Big Intepreter 
Lock. Unless QThread releases the BIL in its *sleep-functions, the thread will 
block the execution of the main-thread...

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] thread in pyqt ... simple example needed

2009-04-05 Thread Arnold Krille
On Sunday 05 April 2009 19:56:59 massimo di stefano wrote:
> Hi All,
> i'm doing my first experience using pyqt and tring to learn more about
> it
> unlucky i'm not able to solve some problems by myself :-(
> i tried to resume my problem in a sample script, that is :
> class Gui(QtGui.QWidget):
>   def __init__(self, parent=None):
>   QtGui.QGroupBox.__init__(self, parent)
>   self.gcenter = QtGui.QPushButton("X", self)
>   self.gcenter.setAutoRepeat(True)
>   self.connect(self.gcenter, 
> QtCore.SIGNAL("clicked()"),self.count)
>   guiLayout = QtGui.QGridLayout()
>   guiLayout.addWidget(self.gcenter,1,0)
>   self.setLayout(guiLayout)
>   def count(self):
>   n = 0
>   step = 1
>   while True:
>   n += step
>   print n
>   time.sleep(0.5)

This is a so called "busy-loop", a programming technic back from the days of 
DOS (the operating system). Don't use it. While the sleep-statement actually 
makes your app sleep for a certain time (so its not really a busy-loop), it 
still stops your app from execution during that time. Which means there are no 
repaints, button-clicks or anything else possible. You encounter that as "my 
app freezes".

The correct Qt-like way for such a loop is:
 - Either execute QCoreApplication.processEvents() inside the loop.
 - Or make your "heavy work" a slot that does just a little of the stuff in one 
step and then re-schedules itself either by QTimer.singleShot(...) or by 
adding a QTimer to your object and let it run continuously and connecting the 
timeout signal to your slot.


> as you can see the gui do not exit from the "while" statment
> and it freeze ...
> i know, i need to learn more about QTrhead usage...

No, if your level of experience is anywhere near the level I think it is, you 
will want to postpone any threads to a later day. There are actually very few 
problems that definitely need threads, Qt's slots combined with Qt's eventloop 
(automaticly used by the slots in my examples above) do a pretty good job for 
that.

Have fun,

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Filter mouse move event

2009-04-04 Thread Arnold Krille
On Saturday 04 April 2009 20:07:35 Luca Fasano wrote:
> Hi list,
> I need to filter mouse moving event on a QGraphicsView. I created a
> filter and install it to a QGraphicsView instance, but desired event
> seems not to be captured.
> Filter definition is:
> class Filter(QtCore.QObject):
>   def eventFilter(self, obj, event):
>   print event.type()
>   return False

Is the indentation in your source-file correct? Because here it looks as if the 
def-line and the print-line are the same indentation level, which would make 
the eventFilter-function an empty function.

> then I have installed an instance of this filter to graphicsview as
> following:
>   self.graphicsview = QtGui.QGraphicsView(self.scene, self)
>   self.graphicsview.setMouseTracking(True)
>   self.filter = Filter(self.graphicsview)
>   self.graphicsview.installEventFilter(self.filter)
>   self.setCentralWidget(self.graphicsview)
> ...but event seems not to be captured! Where I'm wrong??

While your Filter-class subclasses QObject, are you calling QObjects 
constructor from your constructor? As far as I know the constructors of parent 
classes aren't called automaticly in python...

Have fun,

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] CloudKnowledge 0.1 released

2009-03-31 Thread Arnold Krille
Hi,

I don't know if its a good place here, but in a transparent attempt to raise 
the traffic on my website I hereby announce the first release of CloudKnowledge.

http://www.arnoldarts.de/drupal/?q=CloudKnowledge

 What is it?

It is my 12 hours of programming result of thinking about storing small bits 
of data "in the network". It is a very simple kind of database that just 
stores key/value pairs. Apart from installation and running the server apps, 
its completely self-configuring and self-synchronizing. Start it on as many 
machines as you like, use it to store and query data and no matter how many 
machines go down in between, as long as some or at least one machine is 
running, the data isn't lost. (Persistence over shutdown is planned for next 
versions...)

 Why?

It results from some of my thoughts about a self-configuring distributed 
mirrored network filesystem which is likely to not ever get started. But maybe 
I or someone else is interested in this little tool. And at least I learned 
how to ship modules and scripts with the python setuptools...

I know my mail is only half on-topic as I don't use PyQt in that project 
(yet), but I am not subscribed to any other python mailing lists so I don't 
know where to announce things like this best.

Have a nice day/night,

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Type casting

2009-03-31 Thread Arnold Krille
On Tuesday 31 March 2009 16:49:00 Rendezvous wrote:
> How does one type cast in PyQt4? For example, a QObject to a QAction?

For what do you need type-casting in python? To check whether the argument is 
of the right type? Take a look at isinstance().
Otherwise just call the QAction-functions you want, if it is a QAction all is 
fine, if it isn't, you get an error. Either this is a real error because the 
object should always be a QAction, or you have to do input-checking with 
isinstance() before doing the real work in your function...

Have fun,

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] question about cyclic references with QThread

2009-03-27 Thread Arnold Krille
Hi,

On Friday 27 March 2009 15:14:07 Darren Dale wrote:
> I have a simple question about QThread. The attached simple example
> illustrates a case where I have a widget that creates and holds a reference
> to a thread, setting itself as the parent. I need the parent to hold a
> reference to the thread, so I can interrupt its execution for example. I
> want to delete the thread when it finishes executing.
> What the script demonstrates is that when the widget catches the thread's
> finished signal and deletes its reference to the thread, the thread
> continues to persist until the widget itself goes out of scope. Is this due
> to a cyclic reference? Can anyone suggest what I have done wrong, how I can
> improve it?

Its not a cyclic reference, just a double reference. While you set your home-
made reference self.thread to be None, each QObject has a refernce to all its 
childs. So you would have to "reparent" the thread to have 0 (or None) as the 
parent to be able to garbage-collect it. Or initialize your MyThread with None 
as parent instead of self.

BTW: I think (I haven't actually used threads in python yet), that if your 
custom thread only runs python, you would be better of to use pythons own 
threading classes. Or run the "heavy-work" in a slot that keeps scheduling 
itself via QTimer::singleShot until everything is done. The reason: Python has 
a big lock (at least up to 2.6) so only one thread runs python code at a time. 
Which in your example means that either your thread is running or the main-
part, but not both in parallel (which you probably intended). To make use of 
multiple cores, you would have to do the heavy work either in an own process 
(which can run its own python interpreter) or implement it as a native C++ 
QThread and import it via sip...

Have fun,

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Re: seeking advice on why this script segfaults

2009-03-12 Thread Arnold Krille
On Thursday 12 March 2009 17:31:40 Darren Dale wrote:
> If anybody has some example of a working QAbstractItemModel/QTreeView for
> dynamic data, would you please consider posting it (if its short) or
> sending it to me off list? I've been working on this problem for days now
> and I'm not getting anywhere.

I don't know what you mean with dynamic data, but I have trees that fill 
themselves at runtime upon user interaction. And have children of different 
kinds...

(I am sorry to link you to the trac, the source tarball of the new 0.5 version 
isn't ready yet as 0.5 isn't ready yet.)

At https://svn.fzd.de/trac/epos/browser/trunk/epos/libcore you can find 
qtreeitem.* which is the abstract tree base-class I use for the C++ tree, 
qtreeitemmodel.* is the model to display tree of this type. (For the full 
functionality of the qtreeitem you need the delegate from our libgui.)

And at https://svn.fzd.de/trac/epos/browser/trunk/sqeconv in the 
abstractconvertermodel.py there is a proxymodel that has parameters. And these 
are displayed by ConverterActionsModel in sqeconv itself.

Maybe that helps you,

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] default to list?

2009-03-12 Thread Arnold Krille
Hi,

On Thursday 12 March 2009 07:59:10 Damien Elmes wrote:
> Currently the list defaults to the original author when replying. What
> do you think about changing it to default to replying to the whole
> list instead?  As it stands, people have to go out of their way to
> make their replies and advice public.

You mean mangling the reply-to: -header?

There is always great discussions on all the mailinglists where this is 
changed (either from or to mangling...)
The objective results of these discussions I know so far:
1) Mangling the reply-to: -header is not rfc conformant.
2) Getting good mail-client helps because it recognizes the mailinglist-
headers and automaticly replies to the list.
At least kmail here does, I didn't have to fuzz with the receivers address to 
answer in public...

But whether or not this is changed, some people will always complain and some 
people will always answer to private when they should have answered in public.

Have fun,

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] creating a QgraphicsView in MainWindow

2009-02-26 Thread Arnold Krille
Hi,

On Thursday 26 February 2009 11:25:25 Phil Thompson wrote:
> On Thu, 26 Feb 2009 02:16:41 -0800 (PST), Mads Kofod Hansen
>  wrote:
> > I have a QMainWindow with a menu bar and I want to create a QGraphicsView
> > below the menu bar.
> > But this only displays the MainWindow with a menubar. How do I create the
> > GraphicsView in the MainWindow?
> You aren't keeping references to your view or scene so they are being
> garbage collected.

And the easiest way to do so (if you don't need a reference for your own 
purpose) is to add the graphicsview to the mainwindow as the central widget 
done via setCentralWidget. Which has the advantage that it automaticly adds 
your graphicsview as the central widget in the mainwindow so it gets sized to 
fill all available space and get resized when the mainwindow is resized...

Have fun,

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] (no subject)

2009-02-17 Thread Arnold Krille
On Tuesday 17 February 2009 10:18:13 projet...@club-internet.fr wrote:
> Thanks but then I have a problem.
> How can I know that the mouse is over the TreeView ?

Because the contextMenuEvent of the TreeView is only triggered when the mouse 
is over the treeview.
And you can always check whether the mouse-coordinates given in the event are 
inside your widget.

Arnold


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt