Re: [PyQt] Fwd: Re: c++ app integrate PyQt

2013-10-01 Thread David Boddie
On Tue Oct 1 03:05:55 BST 2013, John Fabiani wrote:

 Sorry if I mis-led you somewhere.  The C++ app has been around for many 
 years and is NOT going to be rewritten anytime soon.  I want to 
 integrate a python solution that will allow me to create new content 
 using python all running within the C++ app loop.  I'm hoping I can do 
 it with PyQt.  Creating the library would work - it would allow me to 
 test and work in python.  There are only a few things I need the python 
 to know about from the C++ side - the login data, a couple of pieces of 
 data, and one Class.  After those minor things I don't need a thing.   
 That said, it would be nice if the python side could call up some of the 
 C++ forms.

I've done things with embedding in the past and never really liked the
process of starting up a Python interpreter from within a C++ application.

For something I'm currently working on, I decided to do what Matt suggests,
which is to build the application as a library - for a qmake-based build
system, this basically means changing the TEMPLATE line in its .pro file to

  TEMPLATE = lib

Then you create wrappers for the classes you need. If your application's
main() function is simple - creates an application, creates a window, opens
it - then you can start by creating a wrapper for the window class and
writing an equivalent Python script to start the application.

I would put some examples on the (unofficial) PyQt Wiki but it appears to
have disappeared again.

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


Re: [PyQt] Custom C++ types as signal arguments

2013-10-01 Thread David Boddie
On 28 September 2013 15:31:41, I wrote:

 Thanks for the correction - it works! In fact, removing the StringList
 type altogether appears to work, which puts me back in the position I
 started in, but with working code. The typedef was originally put in as
 a workaround for the crash and because I had noticed that the emitStrings
 signal was defined in the generated C++ code with unknown-type:

[...]

 I'll try this out again on Monday and see what, if anything, I've been
 doing differently.

Well, the test wrapper worked after the suggested modifications but the
actual code I'm working on failed. I tried later versions of sip (4.15.2)
and PyQt (4.10.3), and this time got a warning along the lines of

  AttributeError: signal was not defined in the first super-class of class 
'TestDialog'

It turned out to be a fairly mundane problem with not specifying exactly
the same signals and slots in the C++ code and sip definitions; something
I'm usually fairly careful with. It's useful to get this warning, however,
as it means that you can start running through the checklist of things to
check for errors.

After some refactoring of C++ code, things work as expected. :-)

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


Re: [PyQt] Fwd: Re: c++ app integrate PyQt

2013-10-01 Thread David Boddie
On Tue Oct 1 15:16:58 BST 2013, John Fabiani wrote:

 If you would forward an example to me it would very helpful.

I'll try to dig something out. I sent a broken example to the mailing
list a few days ago, but I'm sure I could put something else together.

 I think 
 both of you are suggesting that I wrap the C++ (BTW a very large app) 
 and then write the entire program using PyQt. Is that correct.  You also 
 suggest you succeeded integrating PyQt into a C++ but were disappointed 
 with the results?  Could you explain beyond -you didn't like loading a 
 python interpreter.  What was the down side.  Load time seems very fast 
 with PythonQt.  I don't know what the load time of PyQt would be - but 
 if it was under 10 seconds - that would be ok.

You don't have to wrap the entire API or rewrite the whole application.
You just need to identify which classes need to be exposed to Python and
wrap those.

In terms of embedding Python into a C++ application (or framework), I was
never very happy about whether or not I'd got the reference counting
correct.

 I may have to move to QML and javascript (a terrible language) - short 
 of wrapping everything and or rewriting the entire program.

I'd advise against doing that unless there are strong reasons for using
either of those languages.

 BTW thanks guys for helping me.

No problem. That's what the mailing list is for.

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


Re: [PyQt] Fwd: Re: c++ app integrate PyQt

2013-10-01 Thread David Boddie
On Tue Oct 1 16:08:23 BST 2013, John Fabiani wrote:

 On 10/01/2013 08:00 AM, David Boddie wrote:

[...]

  You don't have to wrap the entire API or rewrite the whole application.
  You just need to identify which classes need to be exposed to Python and
  wrap those.

[...]

 I'm so sorry David - I must be dumber that normal today because I'm now 
 confused.  I think I'll wait for the small example.  I at first I 
 thought all I needed to do was wrap the login, and one class that the 
 python side would need.  But then I read your posting and came away with 
 the idea that I needed to make everything a 'lib'.

It should just be a simple change to the build, but perhaps I'm making things
too complicated. First things first: can you say how you plan to call the
Python objects from C++? PythonQt is designed for that kind of thing, if I
remember correctly, but I would find it daunting to do the same thing with
sip, although I know there is an API for it.

What I'm doing with the C++ application I'm working with is to create objects
I need in Python, then I pass them to the C++ part of the application where
they can be used. It might not be appropriate for what you want to do, but
we'll see.

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


Re: [PyQt] Custom C++ types as signal arguments

2013-09-28 Thread David Boddie
On 28 September 2013 14:29:03, Phil Thompson wrote:

 On Tue, 24 Sep 2013 13:24:05 + (UTC), David Boddie davidb at met.no
 wrote:

  My sip wrapper starts with a typedef for the StringList type and
  %MappedType
  implementations for std::string and StringList:
 
 Remove this typedef...
 
typedef std::vectorstd::string StringList;

[...]

 SIP should probably complain about the typedef as you are effectively
 providing two definitions for StringList.
 
 Also in the current snapshot at least, you get a sensible exception.

Thanks for the correction - it works! In fact, removing the StringList
type altogether appears to work, which puts me back in the position I
started in, but with working code. The typedef was originally put in as
a workaround for the crash and because I had noticed that the emitStrings
signal was defined in the generated C++ code with unknown-type:

  /* Define this type's PyQt4 signals. */
  static const pyqt4QtSignal pyqt4_signals_Emitter[] = {
  {emitQString(QString), \1Emitter.emitQString[QString], 0},
  {emitStr(std::string,std::string), \1Emitter.emitStr[string, string], 
0},
  {emitStrings(std::vectorstd::string), 
\1Emitter.emitStrings[unknown-type], 0},
  {0, 0, 0}
  };

I'll try this out again on Monday and see what, if anything, I've been
doing differently.

Thanks again for the help.

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


Re: [PyQt] Probably a really simple Phonon question with gstreamer backend and kmix volume control

2013-09-16 Thread David Boddie
On Tuesday, September 10, 2013 10:02:02 PM Michael Staggs wrote:

 The actual code snippet is:
 
 @pyqtSlot()
 def item_clicked(self):
 row = self.listWidget.currentRow()
 song = musiclist[row]
 self.mediaObject = Phonon.createPlayer(Phonon.MusicCategory)
 self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
 Phonon.createPath(self.mediaObject, self.audioOutput)
 self.volumeSlider.setAudioOutput(self.audioOutput)
 self.mediaObject.setCurrentSource(Phonon.MediaSource(song))
 self.mediaObject.play()

Just bringing back the code from a previous message (found in bin/kmp) with
a thought about a possible issue. Have you checked to see if this is being
called twice? I can't imagine it could cause the problem you're seeing but
I'm not familiar with the peculiarities of Phonon.

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


Re: [PyQt] Probably a really simple Phonon question with gstreamer backend and kmix volume control

2013-09-15 Thread David Boddie
On Sat, 14 Sep 2013 21:14:08 -0500, Michael Staggs wrote:

 No ideas?

I failed to reproduce the problem on Debian, but there are other issues that
may be causing that. See below.

 On Tuesday, September 10, 2013 10:02:02 PM Michael Staggs wrote:
  This is a screenshot of my program I've written and KMIX:
  http://imgur.com/COu7coD
 
  
 
  As you can see, it's a pretty nice pyqt program and everything works very
  well in opensuse. However, when I switch into kubuntu I run into a
  problem that you can see: in kmix, it shows TWO audio outputs for my
  program. The slider works the second onewhich means it has very
  little control over the actual volume.

[...]

How did you get kmix to show the application's audio output? It doesn't show
any application-specific sliders in the version I'm using.

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


Re: [PyQt] PyQt4 question about type-to-select in numeric drop-down lists

2013-08-27 Thread David Boddie
On Tue Aug 27 15:53:59 BST 2013, Sarah Mount wrote:

 sorry if this is a bit of a n00b question, but hopefully someone can
 clarify a misunderstanding for me. I am working with some colleagues on a
 Python2.x PyQt4 project and the GUI for this software has several drop-down
 lists where each entry in the list is an integer, in numerical order. We
 have had a (reproducible) bug report about these.

No problem. Sometimes what seems to be the simplest things can have
surprising behaviour.

 When a user clicks on the drop-down and types a number, the drop-down
 scrolls to select that number. So, [contrived example] if the drop-down
 contains entries 0-1000 and the user types 23, the drop-down scrolls to
 reveal 23 (if necessary) and selects that entry on the list. So far, so
 standard.
 
 If the user selects a number with repeated digits, i.e. any multiple of 11
 (in reality only tested on numbers 100) the wrong number is selected. For
 example, if I open a drop-down and type 77 70 gets selected. Is this
 some obvious bug in the way we have configured our GUI or have I
 misunderstood something really basic?

No, I think it's a bug in Qt, and probably in QAbstractItemView because
that's what is providing the underlying list logic in the drop-down menu.
The behaviour seems to be that the string used to search the data is checked
to see if it is simply the same first character repeated throughout the
string (e.g., aaa or 333) and handled specially. This seems to completely
break the regular behaviour: if you try 77, it won't work, but 776 will
cause it to navigate to the correct item.

If anyone wants to sanity check my reasoning, I think the problem is in
QAbstractItemView::keyboardSearch().

I can't immediately suggest a workaround. My instinct would be to use a
completer to influence the way QComboBox finds items but I don't know if
that will help, especially when the drop-down is open.

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


Re: [PyQt] help a noob, Im a noob

2013-07-11 Thread David Boddie
On Tue, 9 Jul 2013 15:00:25 -0600 (MDT), Brian McDonald wrote:

 Just getting into programming in general. Loving python so far. I am
 working on an application that will display database information on
 screen. The idea is that some rows of database information will appear on
 screen for 30 seconds, and then the next rows will appear. I think I have
 made some pretty good headway getting the database connected and even
 displaying data, but I am having a hell of a time getting the data to
 refresh to a new query after 30 seconds. I feel like I must just be
 calling the qtimer at the wrong point in the program. Or, perhaps I should
 be using a while loop of some kind. Anyway, here is my code. Any help
 would be sooo appreciated.

Just quickly glancing at the code, I notice that you start the timer after
the application has run. Have you tried starting the timer in your run()
method?

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


Re: [PyQt] Kled module

2013-06-26 Thread David Boddie
On Tue Jun 25 23:55:53 BST 2013, Phil wrote:

 On 25/06/13 22:34, Robert Kent wrote:
  Hi Phil,
 
  I don't know about using Kled, but I have an LED widget written in pure
  python/PyQt4 which may suit your needs. You can download it from my
  google code page here:
 
  https://code.google.com/p/gulon-soft/downloads/list
 
 Thank you Robert, Oliver and Detlev.
 
 I'm keen to have a look at your LED project Robert and I'll see if I can 
 find the LED project suggested by Detlev.
 
 I briefly played with PyKDE module Oliver but I couldn't relate the 
 PyKDE code with either PyQt or PySide.

Just out of interest, was the problem to do with getting PyQt and PyKDE to
work together? This example shows how PyKDE widgets, like KLed, and
PyQt widgets, like QWidget, can be mixed in an application:

  #!/usr/bin/env python

  import sys

  from PyQt4.QtGui import QVBoxLayout, QWidget
  from PyKDE4.kdecore import ki18n, KAboutData, KCmdLineArgs
  from PyKDE4.kdeui import KApplication, KLed

  if __name__ == __main__:

  about = KAboutData(LED, , ki18n(LED), 1.0, ki18n(LED example))
  args = KCmdLineArgs.init(sys.argv, about)
  app = KApplication()

  led = KLed()
  w = QWidget()
  l = QVBoxLayout(w)
  l.addWidget(led)
  w.show()

  sys.exit(app.exec_())

Note that the KLed class appears to cause a crash when the application
exits if it hasn't been placed in another widget; in this case, we use a
QWidget.

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


Re: [PyQt] graphical file tail

2013-06-25 Thread David Boddie
On Mon Jun 24 20:24:25 BST 2013, Eric Frederich wrote:

 I'm trying to tail several files graphically.
 I have been trying to find a way to tail several files in a GUI
 without much luck at all.

[...]

 Basically, I want to graphically tail files and when the GUI closes
 the tail subprocesses are killed.
 Seems like a simple request, but I can't get it right.

I notice that other messages have been talking about solving problems in
your original implementation, but how about trying a different approach?

The simple example below uses QProcess to show the output from a
command. In this case, tail -f file. It will stop the process when the
window is closed, but not the process creating the file, of course.

David


#!/usr/bin/env python

import sys

from PyQt4.QtCore import *
from PyQt4.QtGui import *

class TailWidget(QTextBrowser):

def __init__(self, parent = None):
QTextBrowser.__init__(self, parent)
self.process = QProcess()
self.process.readyReadStandardOutput.connect(self.addStdout)
self.process.readyReadStandardError.connect(self.addStderr)
self.process.finished.connect(self.stop)
self.running = False

def start(self, command, arguments):
if self.running:
return

self.running = True
self.process.start(command, arguments)

def stop(self):
self.running = False

def addStdout(self):
self.append(QString.fromLocal8Bit(self.process.readAllStandardOutput()))

def addStderr(self):
self.append(QString.fromLocal8Bit(self.process.readAllStandardError()))

def closeEvent(self, event):
if self.running:
self.process.terminate()
self.process.waitForFinished(1000)

event.accept()

if __name__ == __main__:

app = QApplication(sys.argv)

if len(app.arguments()) != 2:
sys.stderr.write(Usage: %s file\n % app.arguments()[0])
sys.exit(1)

w = TailWidget()
w.start(tail, [-f, app.arguments()[1]])
w.show()
sys.exit(app.exec_())

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


Re: [PyQt] Using Web2Py's gluon DAL with QTableView?

2013-06-18 Thread David Boddie
On Mon, 17 Jun 2013 16:33:22 +0100, Simon Carr wrote:

 Hi, Has anyone had experience using Web2Py's DAL (gluon) with PyQt.
 
 I am using gluon with a project I am currently working on and am starting
 to make use of some large data sets that I would like users to view /
 manipulate in QTableView.
 
 I want to know if the default object returned by gluon (a set of dicts) can
 be used to populate a model and how to go about it.

It may be the case that someone has written a generic model for Python data
structures, but I'm not aware of it. It may be the case that some of the
scientific or data processing frameworks include Qt models that could be used
as a starting point for the data sets that you have.

Can you say anything about the structure of the data sets, or are you looking
for a generic model? Looking at the dal.py code, isn't it mostly used for
accessing SQL databases?

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


Re: [PyQt] regarding report generation

2013-06-15 Thread David Boddie
On Thu, 13 Jun 2013 17:05:53 +0530, mohit sarla wrote:

  I have written code for generate report(.pdf) in PyQt4 in linux
 plateform, report is generated. But the same code is not working on
 windows, what is the problem and what is the solution for that?? please
 reply

You need to provide more details about your code, any errors or warnings
that occur, and how you tried to diagnose the problem. Otherwise, there's
very little anyone can do to help you.

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


Re: [PyQt] Tableview to PDF

2013-06-06 Thread David Boddie
On Thu, 6 Jun 2013 10:55:33 +0100, Cristobal Infante wrote:

 I am wondering if anyone has a working example of how to export a tableview
 to a pdf Doc.
 
 I've been able to some sort of pdf exports, but they always come out
 trimmed by the current viewing area. I need it to export to whole tableview
 even if it's not visible at that point.
 
 I have some thumbnails in this tableview, so I guess it would be something
 that captures the visible images.

One way would be to create a QTextDocument from the table contents and export
that as a PDF. I thought that there was an example that showed how to do this
but I haven't found it. In principle, it should be straightforward to do, but
might get complicated if you do fancy formatting in your table.

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


Re: [PyQt] PyQt Learning Sources for MVC Pattern and Why Does QT

2013-05-30 Thread David Boddie
On Thu May 30 00:02:34 BST 2013, I wrote:
 
 On Wednesday 29 May 2013, d hee wrote:
  Thanks, I am thinking about buying the book Rapid GUI Programming with
  Python and Qt by mark summerfield which was published in 2007. Would 2007
  be up to date enough to use the mapper class? And would it also explain
  delegates? It's pretty pricey so I wanted to make sure before I buy it.
 
 It should explain delegates, though I don't remember to what degree it does
 so. I imagine it also covers the QDataWidgetMapper class, at least as part
 of its coverage of databases, but I would have to check. I'll try and look
 at it tomorrow (Thursday) and let you know.

It seems to contain custom delegates up to a point - it doesn't mention
QStyledItemDelegate, but you would use that in the same way as QItemDelegate,
which is covered.

QDataWidgetMapper is also covered. The InformIT page has a number of
links in the Sample Content tab, including one to a PDF of the index. This
is useful to see which classes are covered in the book.

I seem to remember a discussion about the price of the book on this mailing
list a long time ago in which there were references to online retailers that
offered discounts on the official price. These days, it seems that the choice
of retailers is more limited than before.

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


Re: [PyQt] PyQt Learning Sources for MVC Pattern and Why Does QT

2013-05-30 Thread David Boddie
On Thu May 30 10:34:27 BST 2013, Simon Carr wrote:

 There are a number of videos on youtube that cover the mvc pattern. There
 is one series which seems to have an extensive number of videos.

Do you mean these?

  http://www.yasinuludag.com/blog/?p=98

There certainly seems to be a lot of content there. It looks like a great
resource for anyone interested in using model/view from Python.

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


Re: [PyQt] PyQt Learning Sources for MVC Pattern and Why Does QT

2013-05-29 Thread David Boddie
On Wednesday 29 May 2013, d hee wrote:
 Thanks, I am thinking about buying the book Rapid GUI Programming with
 Python and Qt by mark summerfield which was published in 2007. Would 2007
 be up to date enough to use the mapper class? And would it also explain
 delegates? It's pretty pricey so I wanted to make sure before I buy it.

It should explain delegates, though I don't remember to what degree it does
so. I imagine it also covers the QDataWidgetMapper class, at least as part
of its coverage of databases, but I would have to check. I'll try and look at
it tomorrow (Thursday) and let you know.

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


Re: [PyQt] PyQt Learning Sources for MVC Pattern and Why Does QT

2013-05-28 Thread David Boddie
On Sun, 26 May 2013 05:04:22 -0700 (PDT), d hee wrote:

 I am trying to learn how to write pyQt specifically in the MVC model. I
 know some bare fundamentals for making buttons, signals, etc. But what I
 don't know is how to write pyQt in a MVC model with classes and methods
 made for this. I have scourged the internet and I have not found any
 tutorials specifically for pyQt and the MVC model.?
 
 1) Can anyone please suggest some good resources to learn to write pyQt in
 the MVC model? I would be willing to buy a book(has to show MVC and pyQt)
 if it was up reasonably up to date.?

I think the PyQt book is probably still relevant for this:

  http://qtrac.eu/pyqtbook.html

The Model/View components haven't really changed in the last few releases.

I'm sure that there are other tutorials online. I will keep referring
people to this page until someone updates it or tells me to stop:

  http://www.diotavelli.net/PyQtWiki/Tutorials

;-)

 2)Also, on the Qt site it gives tutorials in C++ on the MVC model(I do not
 know C++). Why do the C++ QT tutorials ?leave out the controller for their
 MVC models?

Because there is no separate controller in Qt's Model/View framework.

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


Re: [PyQt] Paste entire column into QTableView from Excel

2013-05-14 Thread David Boddie
On Mon 13 May 2013 15:12:41 -0400, Mark Mordeca wrote:

 I am having an issue pasting into a QTableView from Excel when the user has
 copied by selecting an entire column in Excel, essentially putting every
 single row in the selected column, for the entire excel sheet, on the
 clipboard. The following is my paste code for QTableView:

[...]

 This all works fine when a user has selected just a bunch of cells in Excel
 and copied those. It breaks down when they select an entire column because
 pasteString then becomes upwards of 1048576 characters long (this value is
 found by printing pasteString.size() when highlighting a completely empty
 Excel column by selecting its header and copying).  It completely kills the
 program.

Does it crash or just become unresponsive?

Is there a limit on the amount of data that can be stored in the clipboard
on Windows? Maybe that could be a factor. Can you paste the whole column into
another application successfully?

 Is there any way to get the copied column from the clipboard more
 efficiently than tab delimited text or something? Or should I just throw up
 an error when the size of the string on the clipboard is some arbitrarily
 large length?  Any help would be appreciated.

You need to check what sort of MIME data is contained in the clipboard. The
QClipboard documentation should have example code for this.

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


Re: [PyQt] Designer Customer Widget

2013-05-10 Thread David Boddie
On Wed, 08 May 2013 15:20:26 -0500, Stephen Funkhouser wrote:

[...]

 Is it possible to get Qt Designer to save custom properties of the 
 inherited QTreeWidgetItems objects?

I guess it's more of a Qt Designer question than a PyQt question but you
would need to find out if a C++ custom widget suffers from the same
problem to be sure.

It's been a long time since I looked at Designer. It may be that it only
only saves certain properties out to .ui files, but there may also be a
problem with how it examines custom properties and how those are registered
using PyQt. The only vague recollection I have, apart from realising that
Qt relies on information that is usually provided by plugins at compile time,
is the thought that custom property types seemed difficult to do with PyQt.
Custom properties themselves should be OK - I think.

It might be a long shot, but have you looked at the PyQt examples to see if
any do something similar to what you are doing?

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


Re: [PyQt] PyQt IRC website link broken

2013-04-18 Thread David Boddie
On Thu Apr 18 19:53:01 BST 2013, Mike Driscoll wrote:

 I don't know who to report this to, but the link that's at the top of the
 IRC channel for PyQt is broken:
 
 http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/classes.html
 
 If you go to that page, you get a 404. One of the other guys on the channel
 said it is supposed to redirect to
 http://pyqt.sourceforge.net/Docs/PyQt4/classes.html

When I join the channel it says:

22:48 -!- Topic set by patx [~patx@freecode-project/developer/patx] [Sun Jun 19 
  23:21:52 2011]

I tried and failed to reach him at some point. If you can't get in touch with
him, let me know and I'll try and see if I can find someone else with operator
privileges.

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


Re: [PyQt] PyQT4 and Qt Embedded 4.8.4

2013-02-01 Thread David Boddie
On Fri, 01 Feb 2013 09:15:29 +, Phil Thompson wrote:
 On Fri, 1 Feb 2013 17:01:53 +0900, IhatemyISP ihatemy...@gmail.com
 wrote:

  PyQT - 4.9.6
  Qt - 4.9.6
  Python - 2.7.2+
  
  I'm doing this on a Beaglebone, hence the desire to use Qt/E.
  
  Any advice you can give will be appreciated.

[...]

 You probably need to update the .sip files to define a new platform. Then
 include the correct definitions (eg for Qt::HANDLE) for that platform.
 
 I'm in the process of adding support for cross-compilation to the build
 system but that is a few weeks away yet.

If there's anything you need from my repository that could help with that,
feel free to reuse it:

https://bitbucket.org/dboddie/pyqt4-for-embedded-linux

It's not very up-to-date, but I did manage a not-very-stripped-down build of
PyQt 4.9.4 against Qt 4.8.3 and Python 2.7.3, though that wasn't done using
a cross compiler.

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


Re: [PyQt] newbie installing under OpenBSD

2012-12-22 Thread David Boddie
On Date: Sat, 22 Dec 2012 00:26:53 -0500, Alan Corey wrote:

 Following the directions in the README, when I do:
 python2.7 configure.py --verbose
 where I extracted in /usr/src/misc/pyqt4/PyQt-x11-gpl-4.9.6
 I get messages like:
 qtdirs.cpp:1:28: error: QCoreApplication: No such file or directory
 qtdirs.cpp:2:17: error: QFile: No such file or directory
 qtdirs.cpp:3:24: error: QLibraryInfo: No such file or directory
 qtdirs.cpp:4:23: error: QTextStream: No such file or directory
 qtdirs.cpp: In function 'int main(int, char**)':
 qtdirs.cpp:16: error: 'QCoreApplication' was not declared in this scope

You might find that you need to pass the -q option to the configure.py
script with the path to the qmake executable on your system. Perhaps that
will help to locate the header files.

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


Re: [PyQt] dense about qvariant and dict

2012-12-07 Thread David Boddie
On Sat Dec 8 00:06:28 GMT 2012, David Cortesi wrote:

 dict(qv) doesn't do it. qv.toHash produces an empty dict.
 qv.toMap produces a QMap with the original keys as QStrings and
 the original data as QVariants. OK, but I'd rather have the python
 dict -- is there a way to get it, or do I have to work with the QMap form?

What does qv.toPyObject() give you?

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


Re: [PyQt] TableView Cell Delegates

2012-10-29 Thread David Boddie
On Mon, 29 Oct 2012 11:09:25 +, Cristobal Infante wrote:

 What I want is to change the background of a tableview cell, from what I
 understand
 I should be looking at the Qt.BackgroundRole. So far I havent bee able to
 get it working.

You need to make sure that the model supplies data for the BackgroundRole
of each item as well as for the standard DisplayRole. The standard styled
delegate will then make sure that the cell uses that background colour.

 What I have so far, is a delegate that fills the cell with a color, but it
 seems to be going
 on top of the text:

 class CellBackgroundColor(QtGui.QStyledItemDelegate):

     def __init__(self, parent = None):
         QtGui.QStyledItemDelegate.__init__(self, parent)

     def paint(self, painter, option, index):

         path = index.model().data(index,  QtCore.Qt.DisplayRole).toString()
         painter.fillRect(option.rect, QtGui.QColor(path))

 Any ideas on how to implement this Qt.BackgroundRole in a tableview
 delegate?

If the model does not supply data for the BackgroundRole, you can use a
custom delegate to paint the background in the way you have shown, but you
then need to call the base class's implementation of paint().

def paint(self, painter, option, index):

path = index.model().data(index,  QtCore.Qt.DisplayRole).toString()
painter.fillRect(option.rect, QtGui.QColor(path))
QStyledItemDelegate.paint(self, painter, option, index)

Good luck!

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


Re: [PyQt] QImage in BI24 format

2012-09-19 Thread David Boddie
On Wed, 19 Sep 2012 09:31:55 -0700, Matt Newell wrote:

 On Wednesday, September 19, 2012 12:19:31 AM Gelonida N wrote:
  On 09/18/2012 08:13 PM, Gelonida N wrote:

   I tried to set the pixel format to QImage.Format_RGB888
   and I can see the image.
   However the red and blue colors are inversed.
[...]

 Any conversion is going to need to be implemented in C++ for best speed.

Possibly, though it might be possible in the general case to use the Python
Imaging Library to manipulate channels in an image.

The simplest solution might be to call the rgbSwapped() method on the QImage
holding the data to obtain an image with the red and blue channels swapped.
This is, of course, done in C++ by the Qt library itself.

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


Re: [PyQt] PyQt on BeagleBone

2012-07-28 Thread David Boddie
On Wed, 25 Jul 2012 17:46:11 -0500, Mark wrote:

 I'm developing a commercial project using a BeagleBone system-on-module.
 This runs Angstrom Linux:

 Angstrom v2012.05 (Core edition)

 Target system: arm-angstrom-linux-gnueabi

 I'd very much prefer to use PyQt for the GUI development for this project.
 I'd like to buy a commercial license for it right away, from Riverbank.
 Sadly it's out of the question thus far, because the latest PyQt package
 for Angstrom is based on Angstrom distro 2011.03.  As far as I can tell,
 images of that Angstrom version are no longer available.  Else I'd just
 roll the system back to that version in order to install and use PyQt.

I haven't really looked at Angstrom for a while. The Gumstix board I was
using came with a version of the distribution, but I didn't get into using
it. Instead, I was building a distribution from scratch.

 I've tried forcing the older (2011.03) packages of PyQt and SIP to install
 on the 2012.05 Angstrom.  I ran down the dependencies and verified their
 presence myself.  Even with workarounds for the problems that causes, I
 still get error messages in Python which I suspect are caused by missing
 libraries (of C).  Naturally I first made a backup of the system's SD card
 (its entire boot  root media) so I can start fresh if needed.

Can you post the error messages? It might help to diagnose the problem.

 I've read every scrap of info I could find on the web for this situation.
 All day.  Tried several avenues to proceed.  I've already canvassed the
 Angstrom site, the Qt site, the BeagleBone site, the Python site, and
 everything else on the first several pages of a dozen Google searches.  All
 dead ends.

Can you say some more about what exactly you want? For example, which
version of PyQt/Qt you need. Additionally, the package for python-pyqt-dev
is using an X11 version of Qt. Is that what you want, or are you going to
be using Qt/Embedded?

  http://www.angstrom-distribution.org/repo/?pkgname=python-pyqt-dev

I noticed that there's an online rootfs builder for the distribution. Does
that help at all?

  http://narcissus.angstrom-distribution.org/

 Is there someone I can pay $$$ to resolve this problem within a few days?
 For example by compiling PyQt from source code for this environment?  I'm
 an accomplished desktop and embedded programmer, though I have very bad
 luck compiling other people's C code in situations like this.  But I do
 have access to some money for the person who can do it.  I also have a
 BeagleBone to use for this purpose if it helps.  And a PC that can be used
 remotely to accomplish this.

I would like to help you, though I can't accept payment for it - I don't
think my employer would approve. :-) However, I'm not going to be able to
give you advice until mid-August, so I think you'll need to find someone
else. There should be people reading this list with embedded hardware
experience, so someone may come forward.

Just in case it is useful to someone, I should mention that there's a
repository with some scripts to help build Python/Qt/PyQt for non-X11-based
devices here:

  https://bitbucket.org/dboddie/pyqt4-for-embedded-linux

It's a bit out of date now because I haven't updated the patches for recent
versions of PyQt. Maybe someone will be able to update them to current
releases.

I tried to help someone using a Freescale i.MX board a while ago and put
some pre-built libraries in an archive. It's probably not that useful for
many people, but you never know:

  https://bitbucket.org/dboddie/pyqt4-for-embedded-linux/downloads

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


Re: [PyQt] recommendations for automatic testing of pyqt applications

2012-07-28 Thread David Boddie
On Tue, 24 Jul 2012 23:03:53 +0200, Gelonida N wrote:

 Im having a self written pyQT applciation.

 Now I wondered how I could easiest apply automated test.

[...]

 Is there any existing testing framwork for such tasks or would I have to
 start from scrratch.

Some of the frameworks described on this page may help you with what you
want to do:

  http://www.diotavelli.net/PyQtWiki/GUI_Testing

It would be interesting to hear about any experiences with them.

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


Re: [PyQt] Phonon-VLC and PyQT

2012-07-18 Thread David Boddie
On Mon, 16 Jul 2012 10:09:44 -0400, Yves Perron wrote:

 I'm guessing Phonon-VLC combined with PyQT is not that popular but
 still, it would be very helpful if anyone would share thoughts on the
 subject.

 Still digging,

 On 7/10/2012 4:56 PM, Yves Perron wrote:
  Greetings,
 
  For simplicity sake, I'm wondering if there is any step by step on
  using Phonon-VLC with PyQT on windows 7, if it is even possible?

It's really a Qt question rather than a PyQt-specific problem. If you can
get Phonon-VLC working with Qt, it should just work with PyQt, as I
understand it.

I don't use Windows, so I don't know if this means building everything from
source, or if you can just get away with compiling Phonon-VLC as a plugin
in a way that is compatible with your Qt installation.

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


Re: [PyQt] Problem with icons

2012-07-14 Thread David Boddie
On Thu, 12 Jul 2012 16:23:17 +0200, Szabo, Patrick (LNG-VIE) wrote:

 I'm using Python 3 and Qt 4.8.2
 The icons I'm setting and images in general work fine on my development
 machine but on any other machine they are not showing up.
 I've tried absolute and relative paths and now even with the
 resource-system but they just won't show up.

[ICO and GIF file loading...]

 I compiled the resource-file into a py with pyrcc4 and just importet it
 like this:

 import meta_ress

 The compiled file is obviously named meta_ress.py.

I assume that you don't get an ImportError at this point.

 The systems that run the app are using a python install folder from a
 network drive and do not have python or pyqt installed locally.

 Any ideas ?

Could it be that the Qt installation for the production machines does not
include plugins or support for the image file formats that you use?

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


Re: [PyQt] Possible Issue with PyQt on Amazon EC2 Instance

2012-07-07 Thread David Boddie
On Thu, 05 Jul 2012 22:24:08 +0100, Phil Thompson wrote:

 On Thu, 5 Jul 2012 17:17:22 -0400, Kevin Hu k...@mit.edu wrote:
[...]
  When I kill process Xvfb :99, and try again, I receive the error:
 
  ghost: cannot connect to X server :99
  _XSERVTransmkdir: Owner of /tmp/.X11-unix should be set to root
  [echonest@ip-10-4-85-75 ~]$ expected keysym, got XF86TouchpadOn: line
[...]
  Would you say this is an issue with PyQt? How would you recommend I
  proceed?

 There is nothing in the above than would suggest a PyQt problem.

Agreed. It sounds like Xvfb needs to be running. Perhaps starting a new
instance of it before running Ghost.py would be enough to make it work.

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


Re: [PyQt] Custom Timeline widget with (Py)Qt

2012-07-01 Thread David Boddie
On Sat, 30 Jun 2012 19:14:04 -0600, Jorge Araya Navarro wrote:

 Some people got answers like you should choose between QML, QGraphic
 framework(?) or flat widgets from questions like this one. So, instead
 of writing what I need for my custom Timeline widget, I did a very
 explicit mock up with Inkscape, please see it here[3], is a very
 important part of my question...

Just a quick note: you might want to see if there's anything you can
reuse from Auteur, since that's written in Python.

  http://auteur-editor.info
  http://gitorious.org/auteur

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


Re: [PyQt] QTabWidget tab width change

2012-06-12 Thread David Boddie
On Tue Jun 12 17:48:06 BST 2012, David Cortesi wrote:

1. QTabWidget tab width change (Ganesh Kumar)
 
  I have try with pyqt, with QTabWidget I want increase tab width my
  application. How to achieve tab width. please guide me.

[...]

 If you insist, you could use the setTabBar() method to replace the default
 QTabBar with one you have created. In your customized QTabBar, you would
 implement your own tabSizeHint() method to tell Qt what size to make the
 tab at a given index. Good luck with that.

Certainly, it can be done, but there are no guarantees as to whether it will
always work, or even if the desired behaviour can be obtained at all:

  http://www.diotavelli.net/PyQtWiki/Customising_tab_bars

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


Re: [PyQt] PyQt4 window not properly closing with signals From.close

2012-06-11 Thread David Boddie
On Mon, 11 Jun 2012 15:45:53 +0530, Ganesh Kumar wrote:

 I am new to pyqt, I try two qt designer files one is main window
 second sub window,
 Load main window click button open new window allow things to happen
 user clicks exit on that window close sub window return to main window
 I am tried with Form.close , window.deletelater Not working for me. I
 have attached my code please guide me guys.

 http://pastebin.com/UnHS0NRn

In the sub_window.dosumfunction() method, you cannot easily get access to the
widget itself.

Really, you should avoid modifying the code generated by pyuic4 and instead
create new widget classes where you define new methods. This approach allows
you to change the UI in Designer and regenerate the code without having to
edit the file again.

There seems to be many assignments to self and Form, and it isn't clear to me
what you wrote and what pyuic4 wrote. Anyway, I modified the code a little so
that it works, but the code could be improved:

  http://pastebin.com/uLz1NRh1

It might be useful for you to look at some tutorials for Designer and pyuic4.
One can be found here:

  http://www.rkblog.rk.edu.pl/w/p/introduction-pyqt4/

A list of other tutorials can be found on this page:

  http://www.diotavelli.net/PyQtWiki/Tutorials

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


Re: [PyQt] what is pyqtSignature( )

2012-05-20 Thread David Boddie
On Sat, 19 May 2012 19:50:49 +0530, Ganesh Kumar wrote:

 I very new to pyqt, I am still learning face, I have seen the example
 program, @pyqtSignature(QString). It's a decorator function, But I can't
 seen the function not available to my source file,
 please guide me.

 @pyqtSignature(double)
 @pyqtSignature(int)

See this link in the PyQt reference documentation:

http://www.riverbankcomputing.com/static/Docs/PyQt4/html/old_style_signals_slots.html#the-qtcore-pyqtsignature-decorator

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


Re: [PyQt] Time auto update to my widget

2012-05-18 Thread David Boddie
On Thu, 17 May 2012 17:43:08 +0530, Ganesh Kumar wrote:

 I am new to pyqt, I have create one small application, my application
 starts time , will updates continuously, like analog clock How to do
 this, please guide me guys,

Take a look at the widgets/analogclock example in the PyQt archive.
This uses a timer to update the widget once every second.

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


Re: [PyQt] Stick a frameless window to the desktop

2012-05-13 Thread David Boddie
On Sat, 12 May 2012 20:03:43 +0530, Bhuvan Krishna wrote:

 Hope you all know how google desktop used to stick to the desktop. even
 when the user opens a new window the window will resize itself keeping
 the google desktop on the right intact not going behind the newly opened
 window. I am working on a similar right widget bar. I achieved
 frame-less window ( which was easy) but I don't know how to stick the
 window onto the desktop and let the other windows that open resize
 according to this window. the width of this window is 300 pixels and it
 will take the complete height of the desktop. I also used
 TranslucentBackground which gave me nice transparency but the edges
 don't fill. I am giving a link to the image file of the window.

I think the functionality you want is provided by the window system, not Qt.
It sounds like you want to create something with the properties of a panel or
dock, even if it will be used for a different purpose.

KDE, for example, used to expose this aspect of window management via its
API. If you are using only X11 platforms, you might also be able to use a
Python wrapper around Xlib to give your widget the correct properties.

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


Re: [PyQt] Disable QSpinBox in QTableView

2012-04-21 Thread David Boddie
On Sat, 21 Apr 2012 09:10:05 +0300, Vadym wrote:

 I built QTableView table with proxy, delegates and everything works
 fine. When I try to edit cells with digits or double data appears
 QSpinBox as editor and it's my problem. I don't want and didn't create
 QSpinBox as delegate at all and any other delegates for these columns.
 So, I dont understand is it feature and right behaviour or my mistake?
 In any case I like to disable this editor or, at least, find how it
 can be modified? Couple hours with google didn't give me any result...

One quick thing to try would be to set the data as strings in the model.
An alternative to this would be creating your own custom delegate that
overrides the default editor for numbers, but that is more work.

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


Re: [PyQt] Next window show

2012-03-30 Thread David Boddie
On Fri Mar 30 15:42:10 BST 2012, Ganesh Kumar wrote:

 I am new to pyqt. in my window having next (push-button) when user
 clicks and next window will see.
 please guide me.

Have you looked at QWizard?

  http://doc.qt.nokia.com/4.7/qwizard.html

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


Re: [PyQt] QtNetwork newbie question

2012-03-19 Thread David Boddie
On Mon Mar 19 19:22:09 GMT 2012, John Stewart wrote:

 So my first thought was to try not binding the nextPendingConnection()
 which looks like this:

 self.connect(self.tcpServer.nextPendingConnection(),
 QtCore.SIGNAL(readyRead()), self.tcpSocketReadyReadEmitted)

OK, this looks fine, I think.

 But then how do access the readAll() for the data thats being sent?  Doing
 the same bit on the tcpSocketReadyReadEmitted function throws an
 AttributeError.

 def tcpSocketReadyReadEmitted(self):
 data = str( self.tcpServer.nextPendingConnection().readAll() )
 print data

 returns

 AttributeError: 'NoneType' objet has no attribute 'readAll'

In the tcpSocketReadyReadEmitted() method, you need to call self.sender() to
get the socket object that emitted the signal. If you call the
nextPendingConnection() method again, you may get a different socket object
or None.

It seems that the library removes connections from an internal queue when
you call nextPendingConnection(), so don't call it again until you have
handled the existing connection.

 Again, total beginner at this so sorry if the answer is glaring.

No problem. It's better to ask questions when you're still a beginner!

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


Re: [PyQt] Extending Built-In Styles

2012-03-18 Thread David Boddie
On Mon, 12 Mar 2012 09:39:31 -0700, Rapczak, Jesse wrote:

 Is it possible to somehow extend or export a text stylesheet from
 Designer's Preview In... menu of styles? I'm looking for a way to just
 change a few colors without having to completely define everything.

If you mean styles like Plastique and Cleanlooks then, unfortunately, the
answer is no. These are built-in widget styles, defined in C++ and not using
the Qt style sheets.

Can you explain a bit more what you want?

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


Re: [PyQt] New member (Drag and Drop)

2012-03-08 Thread David Boddie
On Thu Mar 8 15:59:20 GMT 2012, Shoemaker, Ronnie A wrote:

 Okay, I will narrow the scope of this question for now.

 I am playing with the draggablewidgets demo in PyQt4. What is the secret to
 getting different images into that app or how do I create a PNG image that
 it will load?

First, make sure that the images can be loaded by PyQt4 by trying to load
them into the imageviewer.py example.

If that works, modify the draggableicons.qrc file to refer to your new
images and run the pyrcc4 tool to create a draggableicons_rc.py file.
The pyrcc4 tool basically converts the image data into a textual format that
can be stored in that Python module.

The example imports the module, causing the images to be registered as
resources - the ':/images/boat.png' string you can see in the
draggableicons.py example is a reference to the image in a kind of resource
file system. You need to update these strings to refer to your images.

Good luck!

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


Re: [PyQt] Importing marble fails

2012-01-28 Thread David Boddie
On Sat, 28 Jan 2012 02:12:19 -0600, heathmatlock wrote:

 I compiled one of the newer marble commits,
 10c910a9cae3c4e8eb9be442d80125b7e7338e67, and copied the marble.so
 into  /usr/lib/python2.7/dist-packages/PyKDE4 and when I go to import
 marble within a python interpreter, this error is
 given:http://paste.kde.org/194432/

Are you sure that the module.so file contains the Python bindings for Marble?
If you try to import a regular C/C++ library into Python, you will get the
same error.

How did you configure the Marble build?

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


Re: [PyQt] Qtablewidget

2012-01-20 Thread David Boddie
On Fri, 20 Jan 2012 08:09:09 +0700, Dodi Ara wrote:

 for example, i have one file

 $ cat a
 tes
 $

 so, the test fill in the one or more row or columns

 thanks, any help will be appreciate

 On 1/20/12, Dodi Ara dodi@gmail.com wrote:
  i wondering, how can i add from my files to table widget?

You may need to be more specific with your questions. It sounds like you
just need to open the file, call readline() on the file object to get the
string, create a QTreeWidgetItem with this text, and add it to a
QTreeWidget, but it sounds like you expect more than that.

You might help to look at some PyQt tutorials. You can find a list of these
on the PyQt Wiki:

  http://www.diotavelli.net/PyQtWiki/Tutorials

It might also be useful to look at the examples supplied with PyQt,
particularly those in the itemviews directory.

Good luck!

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


Re: [PyQt] Help needed to find a system/graphics related bug in my Music Notation Editor. (Little time and effort for you)

2012-01-19 Thread David Boddie
On Thu Jan 19 18:20:39 GMT 2012, Nils wrote:

 Everything display related helps: I believe closed nvidia drivers
 will shift the symbol. I tested it myself on ati and intel graphics, both
 32 and 64 bit and it looked good, both on Linux and Windows. Other users
 with ati and intel GPU's had no problem. But two persons with an nvidia
 card had the wrong display.

You could try asking them to run the application with the
-graphicssystem raster option, or update the shell script to use that
option, and see if the problem goes away. It's only a workaround, but it
could be useful to have that until you figure what's causing the problem.

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


Re: [PyQt]  QComboBox: display text but pass on Unique Id (MySql)

2011-11-08 Thread David Boddie
On Fri, 4 Nov 2011 13:51:45 +, Cristobal Infante wrote:

 My first post in this list, a big hello to everyone :D

Welcome!

 I am just starting with Pyqt but have enough experience with python.

 I am connecting a Mysql Databse nicely, being able to retrieve the complete
 table and
 get it as a model. I've then been able to display in a combobox a Name
 column
 just by using 'setcolumn(1).

OK. So far so good.

 Until here is all good, but is passing the Id from that record that's
 proven hard to crack for me.
 I've been looking around in the net, but havent been able to find an
 example using a database.
 So display Jane put pass on the unique ID of that record.

Just an idea: is the record() method of the model what you want? The model
should inherit this from QSqlQueryModel.record().

 I have an 'activated' function that is being executed everytime the combo
 changes, but at the moment it's only retrieving
 info from that column that's displayed in the combobox.

You can get the corresponding row of the item displayed in the combo box
by calling the QComboBox.currentIndex() method. This is effectively the
same as the row in the model, anyway. Then pass it to the model's record()
method and see what you get.

Does that work?

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


Re: [PyQt] Errors while rendering to multiple QGLWidgets in a multi-threaded app

2011-11-07 Thread David Boddie
On Sat, 5 Nov 2011 17:57:04 -0700, Michael Broxton wrote:

 I wanted to send another quick request for help in case any PyQt devs or
 users can help me with the QGLWidget multi-threaded rendering bug I posted
 about below... I've done a little more testing this week and found that
 this issue occurs on Linux as well, so the problem does appear to be truly
 cross-platform (confirmed on Mac/Win/Linux).

The code you posted earlier crashed for me using both the Python threading
module and QThread. The OpenGL context also caused the GUI to block, so
perhaps that's a clue you can follow.

 Once again, I have a C++ 
 implementation of the test program in pure Qt that does not crash when
 rendering multiple QGLWidgets from multiple threads, so I don't think that
 my approach is fundamentally flawed.  However, the PyQt test program
 (https://gist.github.com/1318290) does crash shortly after multiple render
 threads are up and running.  Any clues as to why this is happening in PyQt
 but not pure Qt would be greatly appreciated.

I wonder if there's a race condition somewhere that lets you get away with
it in C++ but not in Python. In any case, I'd be concerned that there's some
interaction with the main thread that you're not aware of.

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


Re: [PyQt] IPC in PyQt4

2011-10-24 Thread David Boddie
On Sat, 22 Oct 2011 10:00:43 +0800, zw g wrote:

 Could someone tell me that what is the best or recommended approach to do
 the IPC(Inter-Process Communication) thing?

 QProcess?
 QSharedMemory?
 Or just socket?

It depends on how your application works, whether or not you want a
cross-platform solution, and what other applications you will be
communicating with.

If you control both ends of the communication, all of the above will work.
There are Qt examples for these, and some of these may have been ported to
Python.

There is also D-Bus for Unix/Linux applications.

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


Re: [PyQt] Determine size of a button

2011-10-16 Thread David Boddie
On Fri, 14 Oct 2011 02:39:49 -0700 (PDT), Joe M wrote:

 The question is: is there a way in which I can tell how big the buttons
 will be without having to create them in the first place? Or any other
 hints?

You can make estimates based on the application's font size. However, there
are other factors you need to take into consideration, like the widget style.
In the end, it's probably just easier to create the button without showing
it and only put it in the layout if you need to use it.

The trick is to get the button to calculate its size without showing it
first. One thing I tried was to call its adjustSize() method. This seems
to work if it isn't in a layout, but you might want to see if it works for
your buttons.

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


Re: [PyQt] Foreground and Background Color QToolButton

2011-08-18 Thread David Boddie
On Thu, 18 Aug 2011 06:16:22 +0500, uahmed wrote:

 I want to change the foreground and bankground color of QToolButton , I
 know this can be done using .setStyleSheet  but i want to use other way
 to do that can it be done through QPlatter i search it on net i do find
 examples of .setStyleSheet but not through any other way .

You need to try using QPalette to change the palette of the button.
This example isn't exactly what you need - you should use a QColor instead
of a QLinearGradient - but maybe it will help you to get started:

  http://www.diotavelli.net/PyQtWiki/Windows_with_gradient_backgrounds

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


Re: [PyQt] Please tell me if I have this straight...

2011-08-05 Thread David Boddie
On Fri Aug 5 19:27:51 BST 2011, David Cortesi wrote:

 I present a document to a user in a QPlainTextEdit widget. The widget
 nicely handles most editing functions, but there is a unique operation
 I want to provide. When the user selects Edit  BLEEP, the app is
 supposed to BLEEP the document.

I presume that by BLEEP you do not mean beep, otherwise you could use this:

http://doc.qt.nokia.com/4.7/qapplication.html#beep

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


Re: [PyQt] Snippet to embed a widget in an editor.

2011-07-22 Thread David Boddie
On Sun Jul 17 04:57:00 BST 2011, Phlip wrote:

 Hi, group. I'm trying to embed an object into a QTextEdit which is NOT
 (shocked gasp!) an SVG image.

 Foundational for embedding a panel, I'm trying to embed a widget. But
 I can't seem to get the size right. Here's the sauce:

[...]

 If you ran that, you'd get:

previously
subsequently
[I am here!]

 Presumably if the size were set right, the editor would push down the
 subsequently.

The size is a null size, so I'm guessing the text engine just ignores it.

I changed the code for the text object to use the widget's size hint.

  class _TextObject(QtGui.QPyTextObject):

  def intrinsicSize(self, doc, posInDocument, format):

  size = widget.sizeHint()
  return QtCore.QSizeF(size)

  def drawObject(self, painter, rect, doc, posInDocument, format):
  widget.resize(widget.sizeHint())
  widget.render(painter, QtCore.QPoint(int(rect.x()), int(rect.y(

I also made the widget resize itself to its size hint before rendering it.
I'm not sure why that is necessary.

 Contrarily, maybe I'm setting the size correctly, but then screwing
 something up with the cursors.

No, I think it's the size. The above code should at least get you started.

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


Re: [PyQt] [SIP]MD5 openssl

2011-07-01 Thread David Boddie
On Wed Jun 29 10:38:07 BST 2011, Jarosław Białas wrote:

 Recently I tried to use my c++ library in Python using SIP.
 In SIP configuration file I added some extra libraries like QtGui,fftw3
 and ssl.
 Compilation and linking pass without any warnings or errors:

 g++ -c -pipe -fPIC -O2 -Wall -W -DNDEBUG -I. -I/usr/include/python2.7 -o
 sipmd5testcmodule.o sipmd5testcmodule.cpp
 g++ -c -pipe -fPIC -O2 -Wall -W -DNDEBUG -I. -I/usr/include/python2.7 -o
 sipmd5testmd5test.o sipmd5testmd5test.cpp
 g++ -c -pipe -fPIC -O2 -Wall -W -DNDEBUG -I. -I/usr/include/python2.7 -o
 md5test.o md5test.cpp
 g++ -Wl,--hash-style=gnu -Wl,--as-needed -shared
 -Wl,--version-script=md5test.exp -o md5test.so sipmd5testcmodule.o
 sipmd5testmd5test.o md5test.o -lssl

 But when I try to import library:
 ImportError: ./md5test.so: undefined symbol: MD5

It seems to me that your use of the MD5 function isn't resolved at run-time.
Since you're building a library, the linker doesn't care because it expects
that it will find that symbol later.

 When I compiled my code and included it in c++ all worked fine.

When you run ldd on the md5test.so file, what do you get as output? I get
this:

$ ldd md5test.so
libssl.so.0.9.8 = /usr/lib/i686/cmov/libssl.so.0.9.8 (0xb776f000)
libstdc++.so.6 = /usr/local/lib/libstdc++.so.6 (0xb7684000)
libm.so.6 = /lib/tls/i686/cmov/libm.so.6 (0xb765e000)
libgcc_s.so.1 = /usr/local/lib/libgcc_s.so.1 (0xb764)
libc.so.6 = /lib/tls/i686/cmov/libc.so.6 (0xb74f1000)
libcrypto.so.0.9.8 = /usr/lib/i686/cmov/libcrypto.so.0.9.8 
(0xb73af000)
libdl.so.2 = /lib/tls/i686/cmov/libdl.so.2 (0xb73ab000)
libz.so.1 = /usr/lib/libz.so.1 (0xb7396000)
/lib/ld-linux.so.2 (0xb77d2000)

If the first line in your output indicates that libssl.so cannot be found
then you may need to update your build file to add a suitable library path
for that library.

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

Re: [PyQt] Designer issues, WYS-is not-WYG

2011-06-28 Thread David Boddie
On Tue, 28 Jun 2011 08:06:44 +0200, Hans-Peter Jansen wrote:

 On Tuesday 28 June 2011, 01:08:38 James Polk wrote:
  I often get positon offset weirdness using QFrames,
  QGroupBoxes,etc... They look good in Designer, then off in main
  program, so I have to make them look off in Designer, so they'll
  end up in the right place when they're used.

 This all sounds like you're using fixed geometries and no layouts.

 I cannot recommend doing this in any sane project.

 The ability of combining different layouts in a top level container
 constitutes one of Qt's strength, resulting in resolution independent
 user interfaces.

It might be worth mentioning the tutorials at this point:

  http://www.diotavelli.net/PyQtWiki/Tutorials

This one in particular might be useful:

  http://gumuz.nl/weblog/qt-designer-video-tutorial/

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


Re: [PyQt] Background color for cells in QTableView

2011-06-24 Thread David Boddie
On Fri Jun 24 20:30:32 BST 2011, Marc Rossi wrote:

 I have a model/view app with a QTableView that I would like to have columns
 2, 3  4 shaded a different color than the rest.  My model sub-classes
 QAbstractTableModel and I also use a QSortFilterProxyModel.   I assumed I
 could just override the data() method in my QAbstractTableModel derived
 class, returning the correct QBrush when called with role =
 Qt.BackgroundRole, but my data method NEVER gets called with this role.
 I currently use a stylesheet to set the entire background of the
 QTableView.

Just a thought: have you tried it without the stylesheet?

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


Re: [PyQt] licensing

2011-06-23 Thread David Boddie
On Thu Jun 23 21:32:47 BST 2011, Joel B. Mohler wrote:
 On Thursday, June 23, 2011 04:33:20 am Phil Thompson wrote:

  You haven't said what license you want to use for your code. If you use
  the GPL version of PyQt then your license must be compatible with the
  GPL.

 Sure, that's true *while* the application uses PyQt, but what about *after*
 PyQt is replaced with PySide?  I suppose one could argue that there is some
 ethical commitment due to the history, but I'm not seeing any commitment in
 a legal technical sense.  I think that after all technical reliance from
 PyQt is replaced by technical reliance on PySide, the project is free to
 relicense is it wishes in compliance with the reliance on PySide.

I don't think Phil said anything different to that.

 Or think about it this way:  I write a large project using a GPL library. 
 I wish to have more control so I clean-room re-implement the GPL library. 
 I'm now the sole author of the entire relevant software stack and I believe
 I'm free of the GPL.  I don't see how the fact that Nokia (in the case of
 PySide/PyQt) is the one bank-rolling the clean-room reimplementation
 changes this.

If the entity funding the effort doesn't have a bearing on the use of the
library then why bring them into the argument?

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


Re: [PyQt] Passing image using SIP

2011-06-21 Thread David Boddie
On Mon Jun 20 23:46:27 BST 2011, Jarosław Białas wrote:

 I wanted to create code fragment that will pass an object containg image
 or pointer to this object from Python to C++ function.
 I tried to create function:
 void loadImage(QImage* image);
 Then I created sip file, and after compiling and linking everything 
 looks fine until I tried to import shared library in python:
 ImportError: ./test.so: undefined symbol: _ZTI6QImage

It looks like QtGui wasn't linked in when your shared library was created.
How was the linker run? What command line options and arguments were passed
to it?

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

Re: [PyQt] Screenshot with no show

2011-06-21 Thread David Boddie
On Tue Jun 21 10:40:56 BST 2011, Mads Ipsen wrote:

 I have a GLWidget (OpenGL) based window which is used for displaying
 chemical structures. I would like to use this window to generate
 thumbnails used as icons for the files containing the chemical structures.

 I would like to hide this process of icon generation from the user, so
 is there any way that you can

 * Show/display a GLWidget/QWidget in some sort of virtual frame
   buffer, in such a way that is does NOT appear visual to the user.
 * Dump the contents of the invisible window into a pixmap.

You probably want to look at the QGLPixelBuffer class and the associated
example (which is only available in C++...) for inspiration:

  http://doc.qt.nokia.com/4.7/qglpixelbuffer.html

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


Re: [PyQt] Qt Contributors Summit

2011-06-13 Thread David Boddie
On Wed, 08 Jun 2011 10:25:13 +0100, Phil Thompson wrote:

 I will be attending the Qt Contributors Summit next week. The primary
 purpose (as I understand it) is to discuss the plans for Qt5. See...

 http://labs.qt.nokia.com/2011/05/09/thoughts-about-qt-5/
 http://labs.qt.nokia.com/2011/05/11/responses-to-qt-5/
 http://lists.qt.nokia.com/mailman/listinfo/qt5-feedback

 I'm guessing that the non-C++ community won't be well represented, so feel
 free to give me feedback on the plans as described so far so that I can
 pass them on.

Incidentally, I found a list of attendees on the Qt Developer Network Wiki:

http://developer.qt.nokia.com/groups/qt_contributors_summit/wiki/Attendees

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


Re: [PyQt] Getting image filename in QLabel-pixmap

2011-06-04 Thread David Boddie
On Fri, 3 Jun 2011 18:12:49 -0700 (PDT), James Polk wrote:

 Let's say you create a QLabel and make it an icon, by associating an image
 file to it,.. like..

 ? thisPixmap? = QtGui.QPixmap('server:/images/airplane.jpg') )

 ? thisIcon = QtGui.QLabel(self)
 ? thisIcon.setPixmap(thisPixmap)

 Now let's say that later, in another function...you need to query
 thisIcon to obtain the name of the image file associated with it
 (airplane.png). How can one do this?? I can't find any function in either
 the QLabel nor the QPixmap class that has a way to return the underlying
 image filename.

QPixmap just represents the image data. It only records the data, not the
name of the file it came from. It's a similar situation with QIcon. You
need to store the name somewhere yourself.

If you keep a reference to the label, one way to record the file name might
be to store it as an attribute of the label.

  thisPixmap = QtGui.QPixmap('server:/images/airplane.jpg')
  self.thisIcon = QtGui.QLabel(self)
  self.thisIcon.setPixmap(thisPixmap)
  self.thisIcon.fileName = 'server:/images/airplane.jpg'

Or you could keep a dictionary that maps labels to file names. It depends
on how you are organising your application.

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


Re: [PyQt] Where to start

2011-06-03 Thread David Boddie
On Fri Jun 3 15:24:55 BST 2011, diego wrote:

 [...]
 def mouseMoveEvent(self, event):

  if event.button() == Qt.LeftButton:
 [...]

 you check if the value retured by QMouseEvent.button() is Qt.LeftButton
 but in
 http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qmouseevent.html
#buttoon states that the returned value is always Qt.NoButton for mouse
 move events.; the code in mouseMoveEvent will never be executed and the
 rubber band will not work.

I added that check at the last minute after seeing some issues, but I guess
I should have tested it a bit more. You should be able to remove that check.
I'll verify this a bit later.

David
-- 
David Boddie
Senior Technical Writer
Nokia, Qt
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] QTreeView with blue line cursor at init

2011-06-02 Thread David Boddie
On Wed, 1 Jun 2011 10:46:42 -0700, emmanuel_mayssat wrote:

 I have an application that run a sequence of tasks listed in a treeview.
 There is a run button.
 When the run button is pressed, it executes all the task in the subtree.

 Now, when the application open, it is not really clear what the run button
 would execute, because the line cursor in the qtreeview is not dispalyed.
 Is there a way to show it by default?
 (The only way I am found after startup of the application is to select a
 node in the tree. but this is one click too many !)

You need to set the current item in the treeview. If you are using
QTreeWidget, you can use its setCurrentItem() method.

If you are using QTreeView, you need to access its selection model via its
selectionModel() method and call the model's setCurrentIndex() method with
a model index.

I think that should do what you want. If it doesn't, please let us know.

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


Re: [PyQt] Drag-and-drop editing in QListWidget or QListView

2011-06-02 Thread David Boddie
On Thu Jun 2 14:05:41 BST 2011, Nathan Weston wrote:

 I have a QListWidget with dragDropMode set to InternalMove, and I can
 move rows around by dragging as expected. But I also want to know when
 items are moved so I can update other data in my application, and I
 can't find any way to do this.

I don't think there's any way to get notified of moves when InternalMove
is used.

 Would it help if I switched to QListView and implemented a model? I
 looked into this a bit but couldn't figure out how to do what I want.

You can stay with a QListWidget if you want, but the mechanisms used to
handle dragging and dropping will be a bit different to those you would
use with QListView (where you would delegate most of this to the model).

The draganddrop/puzzle example provided with PyQt uses a QListWidget to
display a collection of puzzle pieces that can be dropped inside or outside
the list, though it's not exactly the most user friendly interface you
could imagine.

The itemviews/puzzle example is more or less the same, but uses QListView
instead of QListWidget. It implements support for drag and drop in a
custom model, which is based on QAbstractListModel to make it as simple as
possible. Strangely, the piece movement is quite a bit more intuitive than
in the other example.

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


Re: [PyQt] Where to start

2011-06-02 Thread David Boddie
On Thu Jun 2 23:07:12 BST 2011, Brickle Macho wrote:

 I am trying to do is display an image, and then using drag-selection to
 select a sub-image for later processing.   Eventually I want to be able
 to select multiple regions and tag each region for appropruate back end
 processing, but for now just being able to select one sub-image would be
 good.  I can display an image, but don't know how to implement
 drag-selection (think it is also know as rubber band selection).  I am
 assuming I will need to write some mouse-callbacks or something.  My
 search-fu has failed me and I haven't been able to find any examples to
 study.Can someone give me any pointers to which widgets I should be
 using and perhaps where to find a sample program I can study.

There didn't seem to be much in the PyQt examples to show this - the
itemviews/chart example does use QRubberBand to allow the user to select
data, but that's not the best example to learn this technique from.

I quickly wrote an example that does part of what you want:

http://www.diotavelli.net/PyQtWiki/Selecting_a_region_of_a_widget

Hope this helps,

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


Re: [PyQt] Basic 3D Viewer

2011-05-30 Thread David Boddie
On Mon May 30 20:04:16 BST 2011, Knacktus wrote:

 I need to evaluate the options for building a basic 3D viewer with PyQt.
 The scenes are static, but quite large (some hundreds medium complex
 (~500 triangles) objects). Show/Hide objects, rotate, drag, zoom, change
 colors and some other basic operations need to be available.

 Currently, I've got some very coarse understanding of OpenGL and
 scenegraphs, but cannot really grasp the complexitiy of the topic.

It might be worth experimenting with the PyQt OpenGL examples to get a feel
for the subject, but it will be a steep learning curve to go from there to
writing a 3D editor, I think.

 Can anyone comment on the complexity of building it from scratch? I'm
 looking for some directions, best practices. E.g., do PyOpenGL and PyQt
 play together?

Yes, you need to create the rendering context using PyQt then use PyOpenGL
for the rendering. There are examples supplied with PyQt that do this.

 Also, are there some higher level scenegraph libs (or bindings) or 3D
 engines (CAD engine) compatible with PyQt that could be usefull?

Take a look at this page for suggestions:

  http://www.diotavelli.net/PyQtWiki/Third_Party_Packages_and_Modules

Building on top of Coin3D is an option you might want to explore. There are
probably other solutions out there as well.

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


Re: [PyQt] FW: cascadeSubWindows oversized--Conclusion

2011-05-24 Thread David Boddie
On Tuesday 24 May 2011, Pietro Moras wrote:

 Therefore my Operative conclusion is:
 O1) To rely upon the “RiverbankComputing.com PyQt Mailing List”, as in this
 actual “cascade” case.
 O2) To share in that List my possibly useful s/w fragments as a reward and
 to the benefit of other fellow colleagues.

You can also look at the PyQt and PyKDE Wiki for code samples:

  http://www.diotavelli.net/PyQtWiki/

Really, I should have added the example I wrote to the SampleCode page on
that Wiki, but I didn't really consider it to be complete enough for that.

  http://www.diotavelli.net/PyQtWiki/SampleCode

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

Re: [PyQt] FW: cascadeSubWindows oversized

2011-05-23 Thread David Boddie
On Mon May 23 14:26:27 BST 2011, Pietro Moras wrote:

It wouldn't do, in the sense that: 
 -- “.tileSubWindows” method works fine, whereas 
 -- “.cascadeSubWindows” doesn't, on exactly the very same situation. 
 And that is the problem.

OK, so you really need a way to cascade all the windows across the MDI area,
but it resizes them so that they are too big?

Can you describe more accurately what you want to see?

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

Re: [PyQt] FW: cascadeSubWindows oversized

2011-05-23 Thread David Boddie
On Monday 23 May 2011, Pietro Moras wrote:
  Can you describe more accurately what you want to see?
  David

 Simply that all “cascaded” child windows be within the Upper Left – Lower
 Right corners of the host MDI Window, with no scroll bar on. - P.M.

I think you will need to write a function to do this, using the QMdiArea's
subWindowList() method to get the subwindows.

There are lots of constraints you could apply to the way windows are
positioned and resized. This cascade() method might do something similar to
what you want, but it's difficult to get the details right without more
information:

class MdiArea(QMdiArea):

def cascade(self):

if len(self.subWindowList())  2:
return

windows = []
for window in self.subWindowList():
windows.append((window.width(), window.height(), window))

windows.sort()

x = 0
y = 0
endX = self.width() - min(windows[-1][0], self.width())
endY = self.height() - min(windows[-1][1], self.height())

for i in range(len(windows)):

x = i * endX/(len(windows) - 1)
y = i * endY/(len(windows) - 1)

width, height, window = windows[i]
window.move(x, y)
window.resize(min(width, self.width() - x),
  min(height, self.height() - y))
window.raise_()

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

Re: [PyQt] FW: cascadeSubWindows oversized

2011-05-22 Thread David Boddie
On Sat, 21 May 2011 11:41:43 +, Pietro Moras wrote:

 Let me ask this same question this other way:
    Is there a method to reset the size of all MDI SubWindows so that to fit
 them at once exactly on the space available on the host MDI window? Thanks!

Would tileSubWindows() do what you want?

http://www.riverbankcomputing.com/static/Docs/PyQt4/html/qmdiarea.html#tileSubWindows

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


Re: [PyQt] Links in QMessageBox.about() not working

2011-05-17 Thread David Boddie
On Tue May 17 10:21:04 BST 2011, Hans-Peter Jansen wrote:
 On Monday 16 May 2011, 14:28:00 Anoop Panavalappil wrote:

  I am developing a simple cross platform GUI using PyQt. I have tried
  to show the about dialog using QMessageBox.about() with richtext
  formatting with html tags (b, br, and a). The dialog correctly
  renders the HTML but the links are not working.
 
  Interestingly, when I tried the QMessageBox.aboutQt() to show the
  About Qt dialog, the links in that dialog doesn't work either. Same
  with the About Qt dialog form the help menu of Qt Designer also.
 
  Is there any workaround for the issue? Or is it a reported bug?

 Works for me. Since you didn't told us your OS/versions, I will leave it
 up to you to find out mine. Hehe.

Anoop and I discussed the problem on IRC. We're both using Qt 4.7.2. The
problem occurs with KDE 4 on Kubuntu (10.10, if I remember correctly).
On the other hand, on KDE 3 and Windows, it apparently works fine.

It might be worth asking about the issue on a KDE or Kubuntu mailing list.

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


Re: [PyQt] QSqlDatabase connect MsSQL2008 in Linux

2011-05-14 Thread David Boddie
On Mon May 9 01:57:17 BST 2011, Luan Mai wrote:

 I am having issue with PyQt connecting to MsSQL database. I am able to run
 update query, but not able to select query. When ever I run select, it
 always return empty list. I am using the same code but connect to MySQL or
 Sqlite, they are all ok. Does anyone have same issue?

 (I am using PyQt-4.8.1, running on slackware linux. )

Which SQL driver are you using to access the database? QODBC? It might
be worth looking at this documentation, though I'm not sure if it will
explain the behaviour you are seeing:

  http://doc.qt.nokia.com/4.7/sql-driver.html#qodbc

It might be worth checking that you can access the database using another
Python module. This module looks like it might be helpful:

  http://code.google.com/p/pymssql/

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


Re: [PyQt] Monkeypatching QWebPage.userAgentForUrl

2011-05-13 Thread David Boddie
On Wed May 11 22:41:13 BST 2011, Gelonida G wrote:

 def patch_agent():
 old_userAgentForUrl =  QWebPage.userAgentForUrl
 def new_userAgentForUrl(self, url):
  for demo purposes I just added logging 
 rslt = old_userAgentForUrl(self, url)
 print agent is %s % rslt
 return rslt
 QWebPage.userAgentForUrl = new_userAgentForUrl

[...]

 app = PyQt4.QtGui.QApplication(sys.argv)
 webview = QWebView()
 webview.setHtml(a href=http://www.google.com;Search/a)
 webview.show()
 sys.exit(app.exec_())

 Somehow it seems, that the my patched method is never called.

 What could be the reason?

My intuition is that the monkey-patching will only work for QWebPage
instances created by PyQt. Since the QWebPage instance shown in the QWebView 
is created by Qt, you get a regular, unpatched instance instead.

If you want to use your patched QWebPage, call QWebView's setPage() method
with one of your patched instances.

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


Re: [PyQt] Monkeypatching QWebPage.userAgentForUrl

2011-05-13 Thread David Boddie
On Fri May 13 02:23:30 BST 2011, Kay Hayen wrote:

  thanks in advance for any explanations or suggestions how to change the
  user agent 'globally'
 
  Why do you try to monkeypatch it? Subclassing QWebView and implementing
  just the overridden method is much cleaner and doesn't look like a hack.

 Also if you my message about the SIP issue, it appears that the PyQt
 core will not consider any overload it doesn't detect as being such at
 class creation time.

I think this QWebPage issue is just a misunderstanding about what kind of
objects are being passed around. The objects people create from within
Python are subclasses of Qt widgets with extra hooks to enable method
reimplementation from within Python, and this includes support for
monkey-patching of both classes and instances.

 I almost clearly doubt, that attribute assignment will modify the class
 later on.

Here's a working example:

from PyQt4.QtGui import *

app = QApplication([])

def paintEvent(self, event):
  painter = QPainter()
  painter.begin(self)
  painter.fillRect(event.rect(), QBrush(QColor(255,0,0)))
  painter.end()

QWidget.paintEvent = paintEvent

w = QWidget()
w.show()
app.exec_()

 In general, it appears, that to overload you must use a class and for me
 unfortunately, it must be a pure Python function or method object at
 that point.

I haven't looked at this in any detail, but you may be correct in saying that
the hooks that allow method overriding are specifically looking for certain
kinds of objects; in this case, Python callables.

 Enhancing sip to be able to track at run time the changes to the class
 appears possible. For consistency with Python it should be done, but the
 benefit, other than consistency with every other Python class, I admit,
 is dubious.

I haven't looked at this, either. I think sip already does part of what you
want. I'll re-read your earlier message and try to understand what you were
looking at.

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


Re: [PyQt] Absolute size on screen

2011-05-07 Thread David Boddie
On Fri, 6 May 2011 11:38:49 +, Pietro Moras wrote:

  In need to ?break the ice? with PyQt4, so I dare to ask you where I could
 look for such basic a task as to express a length in absolute pixel size on
 screen, so to draw a square not subject to re-sizing and zooming. Thanks!

Take a look at the logicalDpiX() and logicalDpiY() methods of QWidget to get
a pair of coefficients. You can use these to calculate the number of pixels
needed to draw a square with dimensions defined in real-world units (like
inches or millimetres).

import sys
from PyQt4.QtGui import *

class Widget(QWidget):
def paintEvent(self, event):
p = QPainter()
p.begin(self)

# Draw a 2cm x 2cm square.
width = self.logicalDpiX() * 2 / 2.54
height = self.logicalDpiY() * 2 / 2.54
p.drawRect(10, 10, width, height)

p.end()

app = QApplication(sys.argv)
w = Widget()
w.show()
sys.exit(app.exec_())

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


Re: [PyQt] qstate transitions() method

2011-05-04 Thread David Boddie
On Tue, 3 May 2011 17:43:58 -0700, emmanuel_mays...@lynceantech.com wrote:

 qstate.transition() is available in qt4.7
 I am using 4.6

Although it's probably an implementation detail, you could call

  state.findChildren(QAbstractTransition)

to get a list of transitions.

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


Re: [PyQt] selecting an item in qtreewidget

2011-05-03 Thread David Boddie
On Tue, 3 May 2011 22:19:27 +, Jason Rahm wrote:

 One more thing, how do I pass the value of the clicked item to the
 displayRule def?  Printing test gets the GUI components figured out, but
 not functional.  Thanks in advance.

The itemClicked signal passes two parameters which you can receive in the
method you connect the signal to.

def __init__(self):
  self.treeWidget_iRulesList.itemClicked.connect(self.displayRule)
def displayRule(self, item, column):
  self.textEdit_ScriptCanvas.clear()
  self.textEdit_ScriptCanvas.setText('test ' + item.text() + ' column ' + 
str(column))

 Still not sure about auto-selecting the last item added to the tree.
 Any thoughts would be appreciated.

You could call the tree widget's setCurrentItem() method, passing the last
item. Whether the item will be selected, as well as made the current item,
depends on what the selection mode is. You can change that by calling
setSelectionMode() with the required value:

http://doc.qt.nokia.com/4.6/qabstractitemview.html#SelectionMode-enum

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


Re: [PyQt] Newbie resizing dock widgets question

2011-04-26 Thread David Boddie
On Mon Apr 25 21:50:43 BST 2011, Sarah Mount wrote:

 In designer-qt4 the object inspector, widget box and so on seem to be
 QDockWidgets. I'm making a GUI in Designer that I want to be similarly
 structured. In designer the edge of each QDockWidget can be grabbed
 with the mouse and resized, but in my GUI this isn't possible. I
 *think* I've set all of the dockWidget properties and the widgets can
 be closed and floated, but not resized. Have I misunderstood this? Is
 there some sort of splitter object that needs to be placed between the
 dockWidgets? Or some property set in the layout managers?

Which version of Qt Designer are you using? Did you manually place the
dock widget into a layout?

In older versions of Qt Designer, dropping a dock widget onto a main window
form simply left it floating, unmanaged, unless the central area was
managed by a layout. In newer versions, the dock window is automatically
docked by default - at least, it seems that way.

If you have a dock window embedded in a main window, and you can't move it
when you preview the form, try breaking the layout of the window, selecting
the dock widget, and setting its docked property to true. It should appear
in one of the dock areas around the sides of the window and be handled
separately to the widgets in the main window itself.

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


Re: [PyQt] Newbie resizing dock widgets question

2011-04-26 Thread David Boddie
On Wednesday 27 April 2011, Sarah Mount wrote:
 On Tue, Apr 26, 2011 at 21:45, David Boddie da...@boddie.org.uk wrote:
 
  Which version of Qt Designer are you using? Did you manually place the
  dock widget into a layout?

 This is Designer 4.7.2 on Ubuntu Natty and the docks are going inside
 a Main Window widget, with a grid layout applied to them.

OK. You should try to avoid using layouts to arrange the dock widgets
themselves. It's fine to arrange the contents of the dock widgets using
layouts, of course.

  If you have a dock window embedded in a main window, and you can't move
  it when you preview the form, try breaking the layout of the window,
  selecting the dock widget, and setting its docked property to true. It
  should appear in one of the dock areas around the sides of the window and
  be handled separately to the widgets in the main window itself.

 This seems to be the problem, and like you say, if I break the layout
 and set the widgets to docked they become resizable, oddly.

Yes, this sounds like they were placed in the central area of the main
window and arranged using a layout.

 However, I have three QDockWidgets, one that is intended to stretch
 over the bottom of the main window, and the other two above it side by
 side, like this:

 [][]
 [  ]

OK, it sounds like you need to tell the top two dock widgets to occupy
the top area - set their dockWidgetArea properties to TopDockWidgetArea
in the property editor and check their docked properties. The other dock
widget should be placed in the BottomDockWidgetArea.

 I've set all of the sizePolicy properties to Expanding; the lower
 dockWidget expands correctly both horizontally and vertically. The top
 two widgets will expand vertically but leave a large gap in the centre
 of the main window when resizing the main window horizontally. This
 worked just fine when I was applying a grid layout to the
 centralWidget. Any ideas?

Using the instructions above, you should now be able to resize them to fill
the window in the way you want, but I'm not sure if it's possible to get
them to expand in the way you describe. It depends on what they contain.

 It all seems a bit counter-intuitive to me! 

Maybe the diagram on this page will help to explain things:

  http://doc.qt.nokia.com/4.7/mainwindow.html

The center widget or central area in the main window is a normal widget
that you can place any other widgets in. This includes dock widgets, but
they aren't designed to be used like that. They are supposed to be managed
separately by the main window, outside the central area. Qt Designer does
a reasonable job of letting you configure this, but it is constrained by its
widgets-on-a-form approach to UI design.

If it turns out that you aren't using all the features of dock widgets in
your application, you can design the kind of UI you describe using splitters
instead. If you want to do that, just ask and I can give more details.

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


Re: [PyQt] Error while installing PyQtMobility 1.0 on Ubuntu 10.10

2011-04-19 Thread David Boddie
On Tue Apr 19 08:06:05 BST 2011, Phil Thompson wrote:

 Can you try with the current SIP snapshot.

OK, the code generation appears to work with the latest SIP snapshot and
PyQtMobility 1.0, building against Qt Mobility 1.1.1. However, I encounter
the following error when building the QtLocation module:

make[1]: Entering directory 
`/home/dboddie/Software/PyQtMobility-gpl-1.0/QtLocation'
g++ -c -pipe -fPIC -O2 -Wall -W -D_REENTRANT -DNDEBUG -DSIP_PROTECTED_IS_PUBLIC 
-Dprotected=public -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_GUI_LIB -I. 
-I/usr/local/Trolltech/Qt-4.7.2/include/QtMobility 
-I/usr/local/Trolltech/Qt-4.7.2/include/QtLocation 
-I/usr/local/Trolltech/Qt-4.7.2/include/python2.7 
-I/usr/local/Trolltech/Qt-4.7.2/mkspecs/default 
-I/usr/local/Trolltech/Qt-4.7.2/include/QtCore 
-I/usr/local/Trolltech/Qt-4.7.2/include/QtGui 
-I/usr/local/Trolltech/Qt-4.7.2/include -I/usr/X11R6/include -o 
sipQtLocationQList0100QGeoRouteRequestFeatureType.o 
sipQtLocationQList0100QGeoRouteRequestFeatureType.cpp
In file included 
from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qmetatype.h:45,
 
from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/QMetaType:1,
 from sipAPIQtLocation.h:27,
 from 
sipQtLocationQList0100QGeoRouteRequestFeatureType.cpp:21:
/usr/local/Trolltech/Qt-4.7.2/include/QtCore/qglobal.h: In instantiation 
of ‘QTypeInfoQtMobility::QGeoCoordinate’:
/usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:417:   instantiated 
from ‘void QListT::node_destruct(QListT::Node*, QListT::Node*) [with T 
= QtMobility::QGeoCoordinate]’
/usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:742:   instantiated 
from ‘void QListT::free(QListData::Data*) [with T = 
QtMobility::QGeoCoordinate]’
/usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:717:   instantiated 
from ‘QListT::~QList() [with T = QtMobility::QGeoCoordinate]’
/usr/local/Trolltech/Qt-4.7.2/include/QtLocation/qgeorouterequest.h:113:   
instantiated from here
/usr/local/Trolltech/Qt-4.7.2/include/QtCore/qglobal.h:1986: error: invalid 
application of ‘sizeof’ to incomplete type ‘QtMobility::QGeoCoordinate’ 
In file included 
from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qobject.h:50,
 
from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qiodevice.h:46,
 
from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qdatastream.h:46,
 
from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qmetatype.h:49,
 
from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/QMetaType:1,
 from sipAPIQtLocation.h:27,
 from 
sipQtLocationQList0100QGeoRouteRequestFeatureType.cpp:21:
/usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h: In member function ‘void 
QListT::node_destruct(QListT::Node*, QListT::Node*) [with T = 
QtMobility::QGeoCoordinate]’:
/usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:742:   instantiated 
from ‘void QListT::free(QListData::Data*) [with T = 
QtMobility::QGeoCoordinate]’
/usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:717:   instantiated 
from ‘QListT::~QList() [with T = QtMobility::QGeoCoordinate]’
/usr/local/Trolltech/Qt-4.7.2/include/QtLocation/qgeorouterequest.h:113:   
instantiated from here
/usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:418: warning: possible 
problem detected in invocation of delete operator:
/usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:418: warning: invalid use 
of incomplete type ‘struct QtMobility::QGeoCoordinate’
/usr/local/Trolltech/Qt-4.7.2/include/QtLocation/qgeorouterequest.h:55: 
warning: forward declaration of ‘struct QtMobility::QGeoCoordinate’
/usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:418: note: neither the 
destructor nor the class-specific operator delete will be called, even if 
they are declared when the class is defined.
/usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:420: error: invalid use 
of incomplete type ‘struct QtMobility::QGeoCoordinate’
/usr/local/Trolltech/Qt-4.7.2/include/QtLocation/qgeorouterequest.h:55: error: 
forward declaration of ‘struct QtMobility::QGeoCoordinate’
make[1]: *** [sipQtLocationQList0100QGeoRouteRequestFeatureType.o] Error 1
make[1]: Leaving directory 
`/home/dboddie/Software/PyQtMobility-gpl-1.0/QtLocation'
make: *** [all] Error 2

Previously, I've worked around this by fixing the qgeorouterequest.h
header file, but one of the Qt Mobility developers suggested that the failure
wasn't a Qt Mobility issue.

David
-- 
David Boddie
Senior Technical Writer
Nokia, Qt
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Error while installing PyQtMobility 1.0 on Ubuntu 10.10

2011-04-18 Thread David Boddie
On Mon, 18 Apr 2011 11:24:13 +0100, Phil Thompson wrote:
 On Mon, 18 Apr 2011 18:13:17 +0800, chinakr chin...@gmail.com wrote:

[...]

  Generating the C++ source for the QtContacts module...
  sip:

 /home/chinakr/src/PyQtMobility-gpl-1.0/sip/QtContacts/qcontactaddress.sip:37:
  Cannot mix %AccessCode and %GetCode or %SetCode
  Error: Unable to create the C++ code.
 
  I tried to google with 'Error: Unable to create the C++ code', but
  found nothing.
  What should I do now? Any suggestion?

 I can't reproduce this. Can you try with the current SIP snapshot?

I encountered this on two, possibly three different systems, so I'll try to
reproduce the problem and post more details.

Since I was building everything from source, my workaround was to build PyQt
then hack SIP to get PyQtMobility to build.

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


Re: [PyQt] Help with Design of Dialog interface

2011-04-18 Thread David Boddie
On Sun, 17 Apr 2011 19:43:17 +0100, alsaf wrote:

 I am currently writing a project which takes vocabulary words from a XML
 file which is created through the KDE application Parley and generates
 sentences based on them. The project page is here:

 https://sourceforge.net/projects/languagesentenc/

[...]

 The part I am stuck at is the maintenance of the sentence templates.
 This part of the GUI will extract all the word types from the XML file
 which will used to validate the input the user enters when creating the
 sentence template.  The only way I think I can do this is to create a
 widget that contains a drop down list and a button. The user selects the
 word type from the list and when the button is pressed the contents of
 the drop down list is then appended to the sentence template. This
 sounds a bit clunky and cumbersome to do. Is there any easier way like a
 line edit button which has an auto-complete option or some other method
 is input that I can use?

There is a recipe for an auto-completing line edit in the Wiki:

  http://www.diotavelli.net/PyQtWiki/Adding_auto-completion_to_a_QLineEdit

Another possibility is to present a menu when the user presses a certain
key. The following recipe uses the Tab key for this:

  http://www.diotavelli.net/PyQtWiki/Adding_tab-completion_to_a_QLineEdit

As the page says, it would probably be best to use a QCompleter instead of
a list, so perhaps you could try taking the best parts from each of these
examples.

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


Re: [PyQt] Styling an QMdiArea widget

2011-04-17 Thread David Boddie
On Sun Apr 17 15:36:11 BST 2011, Sarah Mount wrote:
 On Sun, Apr 17, 2011 at 15:28, Vincent Vande Vyvre

 vincent.vandevyvre at swing.be wrote:
  You can use setBackground()
 
  self.brush = QtGui.QBrush(QtGui.QPixmap(view.jpg))
  self.mdi.setBackground(self.brush)
 
  but reimplement sizeEvent() for rescale the pixmap

 Thanks, tried that code and the image doesn't appear :( There's no
 traceback so it's difficult to figure out why...

If a pixmap fails to load a file, it will fail silently rather than raising
an exception. Try creating the pixmap in a separate step then inspecting it,
like this:

  pixmap = QtGui.QPixmap(view.jpg)
  print pixmap.isNull()

There are two main reasons why this may fail (returning True):

 1. view.jpg is not in the current working directory. You can specify a
more complete path to it, or create a resource file to bundle the
image as part of a Python module that you can simply import.

 2. JPEG support is not built-in to your version of Qt. If you can load
other JPEGs using the widgets/imageviewer.py example supplied with
PyQt then this probably isn't the reason why you are experiencing
problems, though people sometimes have problems when using deployment
tools with versions of Qt that come with plugins for decoding JPEG and
other image formats.

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


Re: [PyQt] Styling an QMdiArea widget

2011-04-17 Thread David Boddie
On Sun Apr 17 19:48:16 BST 2011, Sarah Mount wrote:

 Thanks, you and David were both right, the error was an incorrect path
 for the JPG. However, what I was after was to have one image appear in
 the background, and not to have the image tiled. This is possible
 using a style sheet, but I'm not sure a) if it's possible using a
 brush (your code comes out with the image tiled) or b) whether it's
 possible to use a style sheet, as my code for that didn't work!

I think the answers are:

 a) You can't really use a brush for this because it only supports
tiled textures.
 b) QMdiArea doesn't support style sheets:
http://doc.qt.nokia.com/4.7/stylesheet-reference.html

However, I looked at qtconfig, one of the tools shipped with Qt, and it
seems that there's a trick you can use if you are able to create a QMdiArea
subclass and use that instead of a regular QMdiArea widget:

http://www.diotavelli.net/PyQtWiki/Adding_a_background_image_to_an_MDI_area

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


Re: [PyQt] Use QWebview with Flash plugin

2011-04-17 Thread David Boddie
On Sat, 16 Apr 2011 18:55:43 +0200, Gelonida Gmail wrote:

 I'd like to have a small QWebview window in our application, which could
 display the contents of a web page requiring Flash.


 Is this possible with PyQT?

 If yes, is it possible
 - on a Windows platform
 - on a linux platform

Yes, on both, but much depends on the versions of the Flash plugin and the
WebKit library being used. It's probably best to ask people which versions
of Qt they are using successfully together with Flash then test those
combinations.

 which version of Flash would be supported and what would be the procedure:
 - to install the flash plugin

This would be the place used by Firefox.

 - tell pyqt where the plugins are located

The Qt 4.5 documentation had a section about this:

  http://doc.qt.nokia.com/4.5/qtwebkit.html#netscape-plugin-support

In other words, it shouldn't be necessary to do anything.

 - activate the plugin for a given QWebview window

I don't think you can enable/disable plugins on a per-window basis. I could
be wrong, however, and I'm sure that there are people reading this that do
a lot more with WebKit than I do.

 What versions would be supported.

I'm not sure about this. Searching this mailing list's archives and those
for qt-interest might reveal some data.

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


Re: [PyQt] Help with QStateMachine and animations

2011-04-05 Thread David Boddie
On Tue, 5 Apr 2011 00:05:44 +, Demetrius Cassidy wrote:

 I am trying to animate a QTableView moving off-screen from center (0,0),
 which is replaced by a QGroupBox which slides to 0,0 from off-screen inside
 my QStackedWidget.

 I am using a QStateMachine which contains two states, and basically when
 the state 'stateProceeding' is entered, only the QGroupBox is animated -
 the QTableView just seems to flash once, then the QStackedWidget index is
 changed and QGroupBox is animated. Similarly, when it enters the
 stateReleased state, the opposite happens - QTableView is animated, but not
 the QGroupBox.

[...]

 self._stateMachine.addDefaultAnimation(self._queueAnimation)
 self._stateMachine.addDefaultAnimation(self._rtpAnimation)

Have you tried setting the animations on the transitions themselves instead
of using default animations? Did this make a difference?

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


Re: [PyQt] SIP Problem dynamic loading in wrapped library

2011-03-30 Thread David Boddie
On Wed, 30 Mar 2011 23:07:07 +0200, Jens Thoms Toerring wrote:

 Since with the QLibrary class there doesn't seem to be a
 possibility to get at the error messages from the dynamic linker
 I replaced the QLibrary load() method calls with a dlopen() call.
 This also fails and dlerror() tells me that when loading the
 plugin some symbols are undefined. This seems strange because
 it works in the case of a C++ program linked against the library
 and, as checks with tools like 'nm' show, those symbols are
 definitely defined in the wrapped C++ library (i.e. the one that
 tries to load the plugin).

 I have no good idea at the moment about the reasons for this
 problem. Has anybody experienced a similar situation and per-
 haps has found a work-around (or at least an explanation for
 what is happening)?

Just a suggestion: you might want to set the ExportExternalSymbolsHint
load hint using the setLoadHints() method of your QLibrary instance.

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


Re: [PyQt] distinguish / enable / disable multiple pointer devices

2011-03-24 Thread David Boddie
On Friday 25 March 2011 00:10:21 +0100, Gelonida wrote:

 I have a PC (Windows) with a mouse, a touch screen and a graphics tablet.

 Is there any way to know with which device a widget was clicked?

If the widget interprets a mouse click, screen touch or a press on the
tablet as mouse events then there may not be a way to distinguish between
them. In other words, if Windows converts events to mouse clicks and sends
them to Qt then there wouldn't be a way to tell.

 Is there any way to disable for example the touch screen events for one
 widget and the mouse events for another?

If you are receiving different kinds of events for the mouse, screen and
tablet then you could install event filters to stop certain kinds of events
from being delivered to each widget. Qt has classes to represent these
kinds of events:

  QMouseEvent: http://doc.qt.nokia.com/4.7/qmouseevent.html
  QTabletEvent: http://doc.qt.nokia.com/4.7/qtabletevent.html
  QTouchEvent: http://doc.qt.nokia.com/4.7/qtouchevent.html

So, in theory, it should be possible.

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


Re: [PyQt] include text in FigureCanvas

2011-03-24 Thread David Boddie
On Thu Mar 24 03:35:58 GMT 2011, nimi pillai wrote:
 
 Can someone please tell me how to include some texts in FigureCanvas
 3Dplot.

Can you tell us what FigureCanvas is and how you are using it with PyQt?

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


Re: [PyQt] Plugin widget for designer

2011-03-24 Thread David Boddie
On Thu Mar 17 16:47:27 GMT 2011, Entity Reborn wrote:

 I have successfully managed to get my widget to show up in the
 designer. Unfortunately when I insert it into the form, there is no
 content. All that Is seen is the bounding box. My widget inherits
 qTreeView. Any ideas?

Maybe you have already fixed this by now, but it sounds like some meta-data
is missing and you only get a QWidget inserted into the form.

You need to post some code - ideally a minimal running example - showing
what you have done so that we can try to diagnose the problem.

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


Re: [PyQt] multiple languages within the same application

2011-03-14 Thread David Boddie
On Mon Mar 14 17:34:19 GMT 2011, Samuele Carcagno wrote:

 is it possible to have different parts of an application translated into
 different languages? For example  say that an application has two buttons,
 would it be possible to have the label of button1 translated in Italian and
 the label of button2 translated in French?

Yes, it's possible.

 If it is possible, how would I go about it? The
 QApplication.installTranslator() function seems to affect the application
 globally, and I don't see an easy way to select a particular translator for
 a specific widget or group of widgets.

You might find it interesting to look at the i18n example supplied with PyQt.
It is located in the examples/tools/i18n directory.

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


[PyQt] [PyQtMobility] QGeoServiceProvider factory methods

2011-03-11 Thread David Boddie
I've been looking at using Qt Mobility 1.1 (or thereabouts) with PyQtMobility
0.2 and I encountered an issue with the QGeoServiceProvider.mappingManager()
factory method. It seems that the documented behaviour of the method
conflicts with the bindings for that class in which the method is annotated
with the /Factory/ annotation.

The documentation says this:

  This function will attempt to construct a QGeoMappingManager instance
  when it is called for the first time.  If the attempt is successful the
  QGeoMappingManager will be cached, otherwise each call of this function
  will attempt to construct a QGeoMappingManager instance until the
  construction is successful.

The result is that, if I call this method to obtain a QGeoMappingManager,
Python gets ownership of it. So, if I let it go out of scope, the underlying
object is destroyed, and calling the method again will result in a segfault.

I imagine the problem also exists for the routingManager() and
searchManager() methods.

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


Re: [PyQt] File Filtering using QFileSystemModel QTreeView

2011-03-04 Thread David Boddie
On Tue Mar 1 23:28:01 GMT 2011, James Polk wrote:

 I've read all the documentation and for the life of me, I can't find
 the solution to initiate simple file filtering (by extension) in
 QFileSystemModel, and/or using QDirModel / QDir...

 I just want a Treeview of files and directory, but excluding certain files
 by their extensionseems pretty simple, right?sigh...

[...]

This is where the problem lies:

filter = (JPG (*.jpg));

You really need something like this:

filter = [*.jpg]

David
-- 
David Boddie
Senior Technical Writer
Nokia, Qt
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Two QWebView == Segfault?

2011-02-27 Thread David Boddie
On Sun Feb 27 19:53:16 GMT 2011, Robert Siemer wrote: 

 What am I doing wrong? – The segmentation fault does not come
 immediately. I have to type something (above I typed “j”).

Which versions of Qt, SIP and PyQt are you using?

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

Re: [PyQt] Problem with colored rectangles

2011-02-19 Thread David Boddie
On Sat Feb 19 22:22:10 GMT 2011, shi dingan wrote:

 I have a problem with my code when I try to draw two rectangles with
 overlap.
 I draw a red one, then a green with a small part of it overlapping the red
 rectangle.
 But when I refresh the scene, I have a random behavior, that is, sometimes
 only the red rectangle appears and sometimes both rectangle appear.
 Is it a normal behavior?

Really, both should appear. I think the confusion arises because the green
one lies within the space occupied by the red one.

 I was expecting to see always both rectangle since the
 red one is always the first one added to the scene...

Sometimes the red one appears on top of the green one. Because it covers
the same area as the green rectangle, it looks like only the red rectangle
is added to the scene. To make the green rectangle appear on top, set a
Z value for each of them, but make sure the green rectangle has a higher
value than the red, like this:

  zone1.setZValue(0)
  zone2.setZValue(1)

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


Re: [PyQt] Newbie for newbies PyQt4 tutorial.

2010-11-20 Thread David Boddie
On Sat Nov 20 07:18:02 GMT 2010, Algis Kabaila wrote:

 Thank you for your valuable advice and encouragement to write a
 tutorial.  The tutorial presents a simple plain text editor in stages
 of development and is now in the PyQt wiki as follows:
 A list of Stages at

 http://diotavelli.net/PyQtWiki/simple

It looks good. One thing I noticed was that you want the toolbar to be
on the right hand side of the window by default. Have you tried passing
the toolbar area as the first argument of QMainWindow.addToolBar()?

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


Re: [PyQt] zsi soap and pyQTmobility

2010-10-28 Thread David Boddie
On Thu, 28 Oct 2010 13:40:00 +0530, Anup Joshi wrote:

 I am a newbie to mobile computing. I am thinking of implementing the
 following architecture.
 I would like to know if it is feasible.

 [1] pyQTMobility= [2] zsi (soap) client == [3] zsi soap server = [4]
 business logic = [5] database

 Where [1] and [2]  reside on a mobile phone and [3],[4] and [5] is a server
 machine connected to the internet

 zsi is a SOAP service. (http://pywebsvcs.sourceforge.net/zsi.html)

It sounds feasible, though it depends on what kind of mobile phone you have.
If PyQt runs on the phone then you might not need PyQtMobility, just the
standard network classes.

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


Re: [PyQt] Python Commander in PyQt?

2010-10-14 Thread David Boddie
On Thu Oct 14 00:59:11 BST 2010, Glenn Linderman wrote:

 So then I started looking for front ends that I could tweak to speak HTTP
 to a custom CGI script.  That's where I started this thread, and why I
 picked this group to ask in, because I'd find it useful and interesting
 educationally to tweak a PyQt front end, instead of one written in some
 other environment.

If I understood you correctly, you're looking for a file browser, in which
case it might be worth looking at these pages for inspiration:

  http://lateral.netmanagers.com.ar/stories/29.html
  http://code.google.com/p/pydingo/

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


Re: [PyQt] PyQt support for Qt 4.7

2010-10-06 Thread David Boddie
On Tue Oct 5 09:36:49 BST 2010, Phil Thompson wrote:

 The minehunt example only seems to need support for lists of QObjects. Are
 there any other examples anywhere that have different use cases?

I guess that's more or less what it is, though it needs something extra to
make the QML engine aware of the new TileData type, used as a property type
in the MinehuntGame class, and used as the model that holds the tile data in
the game. If you can figure out a way to expose homogeneous Python lists as
QDeclarativeListProperty containers then that would be cool.

Looking through the examples, there are places where qmlRegisterType is used
to add C++ classes to QML as new item types. The Writing QML extensions with
C++ tutorial in examples/declarative/tutorials/extending is one of these.

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


Re: [PyQt] Sending Instant Message on N900 through PyQt (using PySide QtMobility)

2010-10-06 Thread David Boddie
On Tue Oct 5 04:27:05 BST 2010, praveen koduru wrote:
 
 I want to send IM(Instant Message) from GTalk of N900 using PyQt. I have
 found sending sms  PyQt script here
 http://wiki.maemo.org/Phone_control#Send_SMS. and tried to modify for
 Instant Messaging. But I am getting send failed error. I am new to PyQt.

 I have logged in to gtalk before running the script  then started the
 script.
 the following is the code I have modified.

Looking at the code you posted, it seems that PyQt is only used to process
strings, and that the rest is done using PySide and the PySide Mobility
bindings. Two suggestions come to mind:

 1. Have you considered using the PyQtMobility package with PyQt?
    http://www.riverbankcomputing.com/software/pyqtmobility/intro

 2. Whatever you're using, you probably need to start the event loop for the
    SMS to be sent. You should call app.exec_() to do this.

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


Re: [PyQt] PyQt support for Qt 4.7

2010-10-04 Thread David Boddie
On Mon Oct 4 14:07:52 BST 2010, Phil Thompson wrote:

 Current PyQt snapshots have full support for the Qt v4.7 API.

 The only thing left to do is full QML support (aka a working port of the
 minehunt demo) where you can use QML for the GUI and Python for the
 application logic.

I briefly looked into qmlRegisterType() and thought about what would be
required to allow new QML types to be implemented in Python.

I was thinking that it would also be useful to be able to register other
custom types with the meta-object system, using qRegisterMetaType(), beyond
the general PyQt_PyObject type, but perhaps an initial solution for QML
wouldn't need to be that generic.

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


  1   2   3   4   5   6   7   >