Re: [PyQt] Image doesn't show up

2011-06-24 Thread Algis Kabaila
On Sat, 25 Jun 2011 10:50:42 AM Yaşar Arabacı wrote:
> Hi,
> 
snip...
> My icon doesn't show up at the menu. And I am not getting any error
> messages from the console. My icon file is 12x12 png file. Does it
> supposed to be something else maybe?

I've copied your program to the clipboard, put it in my HOME directory.  Then 
created a subdirectory ~/icons, placed a png image of a closing door in it, 
renamed it no.png and ran the program - works fine, including the icons and the 
status bar.  A good small example.

But how to change the old style signal/slot statement to the new style?...

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

Re: [PyQt] Image doesn't show up

2011-06-24 Thread Vincent Vande Vyvre


  
  
Le 25/06/11 03:39, Albert Cervera i Areny a écrit :

  
  
  A Dissabte, 25 de juny
de 2011 02:50:42, Yaşar Arabacı va escriure:
  > Hi,
  > 
  > I am beginning to
learn PyQt, I am sorry if this is a bit newbie question
  > but I can't make
QIcon work.
  > 
  > For example in
here;
  > 
  > #!/usr/bin/python
  > 
  > # menubar.py
  > 
  > import sys
  > from PyQt4 import
QtGui, QtCore
  > 
  > class
MainWindow(QtGui.QMainWindow):
  > def __init__(self):
  >
QtGui.QMainWindow.__init__(self)
  > 
  >
self.resize(250,150)
  >
self.setWindowTitle('menubar')
  > 
  > exit =
QtGui.QAction(QtGui.QIcon('icons/no.png'),'Exit',self)
  >
exit.setShortcut('Ctrl+Q')
  >
exit.setStatusTip('Exit application')
  > 
  >
self.connect(exit,QtCore.SIGNAL('triggered()'),QtCore.SLOT('close()'))
  > 
  > 
  > self.statusBar()
  > 
  > menubar =
self.menuBar()
  > file =
menubar.addMenu('&File')
  >
file.addAction(exit)
  > 
  > app =
QtGui.QApplication(sys.argv)
  > main = MainWindow()
  > main.show()
  >
sys.exit(app.exec_())
  > 
  > My icon doesn't
show up at the menu. And I am not getting any error
  > messages from the
console. My icon file is 12x12 png file. Does it
  > supposed to be
something else maybe?
  
  
  It works for me with a
96x96 PNG file. Try to ensure that the file is really found or
try to change the image and use another icon file.
  
-- 
  Albert Cervera i Areny
  http://www.NaN-tic.com
  OpenERP
Partners
  Tel: +34 93 553 18 03
  
  
  http://twitter.com/albertnan
  
  http://www.nan-tic.com/blog
  Advertència Legal: aquest missatge i, en el
  seu cas, els fitxers adjunts poden contenir informació privada
  i/o confidencial. Si vostè no és el destinatari del missatge,
  si us plau, elimini i notifiqui'ns-ho immediatament, no el
  reenvii ni copi el seu contingut. Si us plau, avisi'ns
  d'immediat si vostè o la seva empresa no admeten la
  utilització del correu electrònic via internet per a missatges
  d'aquest tipus. NaN Projectes de Programari Lliure, S.L. no
  garanteix la confidencialitat, integritat, rapidesa o correcte
  recepció del present correu, ni es responsabilitza de
  possibles perjudicis derivats de la captura, incorporacions de
  virus o qualsevol altre manipulació efectuada per tercers. No
  s'autoritza la utilització amb finalitats comercials o per a
  la seva incorporació a fitxers automatitzats de les direccions
  de l'emissor o del destinatari.
  La informació continguda en aquest missatge
  de correu electrònic és confidencial i pot revestir el
  caràcter de reservada. Està dirigida exclusivament a la
  persona destinatària. L'accés o qualsevol us per part de
  qualsevol altra persona, no estan autoritzats i poden
  esdevenir il•legals. Si vostè no és la persona destinatària,
  li preguem que procedeixi a esborrar-lo i a no fer-ne cap us
  ni transmetre'l a tercers. Si ho considera oportú pot avisar
  al remitent que el missatge ha arribat a un destí no desitjat.
  Advertencia Legal: este mensaje y, en su
  caso, los ficheros anexos pueden contener información
  privilegiada y/o confidencial. Si usted no es el destinatario
  del mensaje, por favor, bórrelo y notifíquenoslo
  inmediatamente, no lo reenvíe ni copie su contenido. Por
  favor, avísenos de inmediato si usted o su empresa no admite
  la utilización del correo electrónico vía internet para
  mensajes de este tipo. Nan Projectes de Programari Lliure,
  S.L. no garantiza la confidencialidad, integridad, rapidez o
  correcta recepción del presente correo, ni se responsabiliza
  de posibles perjuicios derivados de la captura,
  incorporaciones de virus o cualesquiera otras manipulaciones
  efectuadas por terceros. No se autoriza la utilización con
  fines comerciales o para su incorporación a ficheros
  automatizados de las direcciones del emisor o del
  destinatario.
  La información contenida en este mensaje de
  correo electrónico es confidencial y puede revestir el
  carácter de reservada. Está dirigida exclusivamente a la
  persona destinataria. El acceso o cualquier uso por parte de
  cualquier otra persona, no están autorizados y pueden llegar a
  ser ilegales. Si usted no es la persona destinataria, le
  rogamos que proced

Re: [PyQt] Background color for cells in QTableView

2011-06-24 Thread Marc Rossi
Yes, tried without stylesheet with no luck (just tried it again to see if I
missed something).  Thought about that as it feels like that Role is
disabled somehow.

On Fri, Jun 24, 2011 at 7:26 PM, David Boddie  wrote:

> 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
>
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Image doesn't show up

2011-06-24 Thread Albert Cervera i Areny
A Dissabte, 25 de juny de 2011 02:50:42, Yaşar Arabacı va escriure:
> Hi,
> 
> I am beginning to learn PyQt, I am sorry if this is a bit newbie question
> but I can't make QIcon work.
> 
> For example in here;
> 
> #!/usr/bin/python
> 
> # menubar.py
> 
> import sys
> from PyQt4 import QtGui, QtCore
> 
> class MainWindow(QtGui.QMainWindow):
>def __init__(self):
>QtGui.QMainWindow.__init__(self)
> 
>self.resize(250,150)
>self.setWindowTitle('menubar')
> 
>exit = QtGui.QAction(QtGui.QIcon('icons/no.png'),'Exit',self)
>exit.setShortcut('Ctrl+Q')
>exit.setStatusTip('Exit application')
> 
>  self.connect(exit,QtCore.SIGNAL('triggered()'),QtCore.SLOT('close()'))
> 
> 
>self.statusBar()
> 
>menubar = self.menuBar()
>file = menubar.addMenu('&File')
>file.addAction(exit)
> 
> app = QtGui.QApplication(sys.argv)
> main = MainWindow()
> main.show()
> sys.exit(app.exec_())
> 
> My icon doesn't show up at the menu. And I am not getting any error
> messages from the console. My icon file is 12x12 png file. Does it
> supposed to be something else maybe?

It works for me with a 96x96 PNG file. Try to ensure that the file is really 
found or try to change the image and use another icon file.

-- 
Albert Cervera i Areny
http://www.NaN-tic.com
OpenERP Partners
Tel: +34 93 553 18 03

http://twitter.com/albertnan 
http://www.nan-tic.com/blog


Advertència Legal: aquest missatge i, en el seu cas, els fitxers adjunts poden 
contenir informació privada i/o confidencial. Si vostè no és el destinatari del 
missatge, si us plau, elimini i notifiqui'ns-ho immediatament, no el reenvii ni 
copi el seu contingut. Si us plau, avisi'ns d'immediat si vostè o la seva 
empresa no admeten la utilització del correu electrònic via internet per a 
missatges d'aquest tipus. NaN Projectes de Programari Lliure, S.L. no 
garanteix la confidencialitat, integritat, rapidesa o correcte recepció del 
present correu, ni es responsabilitza de possibles perjudicis derivats de la 
captura, incorporacions de virus o qualsevol altre manipulació efectuada per 
tercers. No s'autoritza la utilització amb finalitats comercials o per a la 
seva incorporació a fitxers automatitzats de les direccions de l'emissor o del 
destinatari.

La informació continguda en aquest missatge de correu electrònic és 
confidencial i pot revestir el caràcter de reservada. Està dirigida 
exclusivament a la persona destinatària. L'accés o qualsevol us per part de 
qualsevol altra persona, no estan autoritzats i poden esdevenir il•legals. Si 
vostè no és la persona destinatària, li preguem que procedeixi a esborrar-lo i 
a no fer-ne cap us ni transmetre'l a tercers. Si ho considera oportú pot 
avisar al remitent que el missatge ha arribat a un destí no desitjat.

Advertencia Legal: este mensaje y, en su caso, los ficheros anexos pueden 
contener información privilegiada y/o confidencial. Si usted no es el 
destinatario del mensaje, por favor, bórrelo y notifíquenoslo inmediatamente, 
no lo reenvíe ni copie su contenido. Por favor, avísenos de inmediato si usted 
o su empresa no admite la utilización del correo electrónico vía internet para 
mensajes de este tipo. Nan Projectes de Programari Lliure, S.L. no garantiza 
la confidencialidad, integridad, rapidez o correcta recepción del presente 
correo, ni se responsabiliza de posibles perjuicios derivados de la captura, 
incorporaciones de virus o cualesquiera otras manipulaciones efectuadas por 
terceros. No se autoriza la utilización con fines comerciales o para su 
incorporación a ficheros automatizados de las direcciones del emisor o del 
destinatario.

La información contenida en este mensaje de correo electrónico es confidencial 
y puede revestir el carácter de reservada. Está dirigida exclusivamente a la 
persona destinataria. El acceso o cualquier uso por parte de cualquier otra 
persona, no están autorizados y pueden llegar a ser ilegales. Si usted no es 
la persona destinataria, le rogamos que proceda a borrarlo y no hacer ningún 
uso de él ni transmitirlo a terceros. Si lo considera oportuno puede avisar al 
remitente que el mensaje ha llegado a un destino no deseado.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] Image doesn't show up

2011-06-24 Thread Yaşar Arabacı
Hi,

I am beginning to learn PyQt, I am sorry if this is a bit newbie question
but I can't make QIcon work.

For example in here;

#!/usr/bin/python

# menubar.py

import sys
from PyQt4 import QtGui, QtCore

class MainWindow(QtGui.QMainWindow):
   def __init__(self):
   QtGui.QMainWindow.__init__(self)

   self.resize(250,150)
   self.setWindowTitle('menubar')

   exit = QtGui.QAction(QtGui.QIcon('icons/no.png'),'Exit',self)
   exit.setShortcut('Ctrl+Q')
   exit.setStatusTip('Exit application')

 self.connect(exit,QtCore.SIGNAL('triggered()'),QtCore.SLOT('close()'))


   self.statusBar()

   menubar = self.menuBar()
   file = menubar.addMenu('&File')
   file.addAction(exit)

app = QtGui.QApplication(sys.argv)
main = MainWindow()
main.show()
sys.exit(app.exec_())

My icon doesn't show up at the menu. And I am not getting any error messages
from the console. My icon file is 12x12 png file. Does it supposed to be
something else maybe?
___
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


[PyQt] Background color for cells in QTableView

2011-06-24 Thread Marc Rossi
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.

Not a Qt expert by any means but when I call model.roleNames() and print out
the results I only see roles 0-5, no role 8 (Background).  Not sure if this
call returns all roles supported by the model or if it is just there as a
utility func.

Any help would be greatly appreciated.

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

Re: [PyQt] licensing

2011-06-24 Thread Joel B. Mohler
On Thursday, June 23, 2011 08:08:14 pm David Boddie wrote:
> 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.

No, he did not.  My source code is GPL for this very reason.  You have my 
apologies for sounding vaguely otherwise.

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


Re: [PyQt] Pylupdate4 does not parse tr(u"") ?

2011-06-24 Thread Phil Thompson
On Mon, 13 Jun 2011 14:43:05 +0200, Giuseppe Corbelli
 wrote:
> On 10/06/2011 10:52, Giuseppe Corbelli wrote:
>> So it seems that pylupdate4 does NOT parse tr(u"") stuff. Is it by
>> design?
>> Sorry but I can't dive into it at present.
> 
> Seems that I was right, rare stuff indeed.
> 
> Look into pylupdate/fetchtr.cpp, around line 380
> You will see a
> 
> case '(':
> if (yyParenDepth == 0)
>   yyParenLineNo = yyCurLineNo;
> yyParenDepth++;
> yyCh = getChar();
> return Tok_LeftParen;
> 
> 
> Replace with:
> 
> case '(':
> if (yyParenDepth == 0)
> yyParenLineNo = yyCurLineNo;
> yyParenDepth++;
> yyCh = getChar();
> //It may be a tr(u"whatever"), skip the 'u'
> if (yyCh == 'u')
> yyCh = getChar();
> return Tok_LeftParen;
> 
> It seems to work (just eats one more char). If you find it useful please
> apply
> into the main line.

This is fixed (differently) in tonight's snapshot.

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


Re: [PyQt] Bug report: multiple QApplication instances cause a segfault

2011-06-24 Thread Hans-Peter Jansen
On Friday 24 June 2011, 03:35:55 Algis Kabaila wrote:
> On Thu, 23 Jun 2011 10:08:50 PM Hans-Peter Jansen wrote:
> > Dear Al,
> >
> > On Thursday 23 June 2011, 13:26:02 Algis Kabaila wrote:
> > > On Thu, 23 Jun 2011 07:06:49 PM Hans-Peter Jansen wrote:
>
> [snip...]
> Following Pete's advise, I've installed 23 new packages that appeared
> to be dbg related (169 MiB downloaded, 802 MiB additional space of
> hdd used). The gdb was then invoked with the command, shown
> immediately after the "" marker. After that in the invoked IDLE
> Python Shell given were
>
> the following commands:
> >>> from PyQt4 import QtGui
> >>> app = QtGui.QApplication([])
> >>> app.quit()
> >>> app = QtGui.QApplication([])
> >>> app.quit()
> >>> app = QtGui.QApplication([])
>
> At that point the IDLE Shell "froze".  Typed on the CLI shell was
> *bt*. The whole dialog is shown between the "" markers.
>
> 
> ak@supremo:~$ gdb python3 -ex "set args /usr/bin/idle-python3.2 -n"
> -ex run GNU gdb (Ubuntu/Linaro 7.2-1ubuntu11) 7.2
> Copyright (C) 2010 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
>  This is free software: you are
> free to change and redistribute it. There is NO WARRANTY, to the
> extent permitted by law.  Type "show copying" and "show warranty" for
> details.
> This GDB was configured as "x86_64-linux-gnu".
> For bug reporting instructions, please see:
> ...
> Reading symbols from /usr/bin/python3...Reading symbols from
> /usr/lib/debug/usr/bin/python3.2mu...done.
> done.

Python symbols could be loaded. Fine.

> Starting program: /usr/bin/python3 /usr/bin/idle-python3.2 -n
> [Thread debugging using libthread_db enabled]
> [New Thread 0x7fffef1cd700 (LWP 2347)]
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x7fffec894b1f in ?? () from /usr/lib/libQtGui.so.4

libQtGui symbols are still missing. They should appear 
in /usr/lib/debug/usr/lib/.

> (gdb) bt
> #0  0x7fffec894b1f in ?? () from /usr/lib/libQtGui.so.4
> #1  0x7053ad3f in _XError () from
> /usr/lib/x86_64-linux-gnu/libX11.so.6 #2  0x70537fb1 in ?? ()
> from /usr/lib/x86_64-linux-gnu/libX11.so.6 #3  0x70538aa6 in
> _XReply () from /usr/lib/x86_64-linux-gnu/libX11.so.6 #4 
> 0x7052e48d in XQueryTree () from /usr/lib/x86_64-linux-
> gnu/libX11.so.6

For this case, libX11 symbols could be useful, too.

I've no idea, why these libs appear in /usr/lib/x86_64-linux-gnu? Does 
that mean, that ubuntu hosts 32bit libs in /usr/lib?

Confusing.

> #5  0x70b8a246 in Tk_HandleEvent () from
> /usr/lib/libtk8.5.so.0 #6  0x70b8a7c0 in ?? () from
> /usr/lib/libtk8.5.so.0
> #7  0x708d564f in Tcl_ServiceEvent () from
> /usr/lib/libtcl8.5.so.0 #8  0x708d58d5 in Tcl_DoOneEvent ()
> from /usr/lib/libtcl8.5.so.0 #9  0x711ba2e9 in ?? () from
> /usr/lib/python3.2/lib- dynload/_tkinter.cpython-32mu.so

> #10 0x00465d28 in call_function (f=,
> throwflag=)
> at ../Python/ceval.c:3875
> #11 PyEval_EvalFrameEx (f=, throwflag= optimised out>)
> at ../Python/ceval.c:2673
> #12 0x004675f2 in PyEval_EvalCodeEx (_co= out>, globals=,
> locals=, args=,
> argcount=1, kws=0x12a0d40, kwcount=0,
> defs=0xe76ba8, defcount=1, kwdefs=0x0, closure=0x0) at
> ../Python/ceval.c:3311

In these frames you can see the difference to missing symbols. While a 
lot of values are optimized out, you see the function arguments, the 
source code line, etc. instead of ?? ().

[...]
> 
>
> It is clear that there is segmentation fault. I do not know how to
> read the dbg output and would appreciate advice whether the output is
> useful or not.
>
> @ Pete - do you want me to do any more testing? If yes, just let me
> know. Thanks again!

The whole issue might be hunting a red herring. 

It looks like an unfortunate interaction of tcl, tk, X, Qt and python 
GC. Would you try Baz' suggestion of assigning None to app before 
creating another instance?

In my environment, I'm able to construct and quit a dozen app instances 
without segfaults (even without None assignment in between):

python: 2.6.2
sip: 4.12.3
qt4: 4.7.1
pyqt4: 4.8.4

Still 32bit. Yes, I'm backward..

Creating an QApplication object is one of the most involved Qt calls 
from an "interaction with other parts of the system" perspective, where 
the "other parts" depend on each other and even interact behind the 
scenes.

Now mix in pythons garbarge collector behavior, and you get a feeling, 
why these kind of issues are unpossible to get right in all kinds of 
possible permutations of elements.

I chimed into the discussion to show, how using gdb is able to shed some 
light on such issues.

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