[PyQt] Drag and Drops on Mac OS X

2009-11-04 Thread Greg Smith
Hey everyone, I seem to be having difficulty getting drag and drops
working on a tool I am porting over from Windows to OS X. The short and
skinny is that I want to be able to drag a file from a finder into a
model based list view and the file name show up in the list view. I get
the cursor icon to show that it will accept a drop but when I release
click nothing happens.  On my custom dragEnterEvent, dragMoveEvent and
dropEvent methods I put simple print statements to signify in the
terminal that the method is being executed, but no dice.

 

 

I have a feeling that the approach to OSX must be slightly different
than Windows so here's an abridged version of what I am doing and maybe
someone can tell me what I might be doing wrong

This simple example works fine on windows xp using PyQt 4.4.3 for python
2.5.1 but I can't seem to get it to work for PyQt 4.6 for python 2.5.4
on OS X. Any Ideas?

 

import os, sys

from PyQt4 import QtGui, uic, QtCore

 

class myPyQt_tool(QtGui.QDialog):

def __init__(self):

QtGui.QDialog.__init__(self)

self.rootDir = os.path.dirname(sys.argv[0])

print self.rootDir

self.ui = uic.loadUi('%s/my_ui_file.ui' % self.rootDir)

self.listview_model = QtGui.QStandardItemModel()

self.ui.my_listview.setModel(self.listview_model)

self.ui.my_listview.setAcceptDrops(True)

self.ui.my_listview.setDragEnabled(True)

self.current_file = ''



self.ui.my_listview.__class__.dragEnterEvent =
self.custom_dragEnterEvent

self.ui.my_listview.__class__.dragMoveEvent =
self.custom_dragEnterEvent

self.ui.my_listview.__class__.dropEvent = self.custom_dropEvent



def custom_dragEnterEvent(self, event):

print 'drag enter event'

testEvent = event.mimeData().urls()[0].toLocalFile()

if testEvent:

event.accept()

else:

event.ignore()

 

def custom_dropEvent(self, event):

print 'drop event'

self.current_file =
str(event.mimeData().urls()[0].toLocalFile())

if self.current_file:

item_name = os.path.basename(self.current_file)

list_item = QtGui.QStandardItem(item_name)

self.listview_model.appendRow([list_item])

event.accept()

else:

event.ignore()

 

app = QtGui.QApplication(sys.argv)

dialog = myPyQt_tool()

dialog.ui.show()

app.exec_()

 

 

and if the attachment doesn't come through here is my_ui_file.ui





 Dialog

 

  

   

0

0

310

435

   

  

  

   Dialog

  

  

   



 20

 10

 256

 371



   

   

Qt::StrongFocus

   

   

true

   

   

true

   

   

QAbstractItemView::NoDragDrop

   

   

QAbstractItemView::ExtendedSelection

   

  

 

 

 



 





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

RE: [PyQt] Using a QCompleter with a QLineEdit

2009-06-25 Thread Greg Smith
Awesome! Merci beaucoup. That did the trick!

Greg

-Original Message-
From: projetmbc [mailto:projet...@club-internet.fr] 
Sent: Thursday, June 25, 2009 3:56 AM
To: projetmbc
Cc: Greg Smith; PyQt
Subject: Re: [PyQt] Using a QCompleter with a QLineEdit

projetmbc a écrit :
> Try to do the following change :
>   OLD  
> lineEditCompleter = QtGui.QCompleter(completerList)
>   NEW  
> lineEditCompleter = QtGui.QCompleter(completerList)
>   END  

Sorry, I've forgot to do the changes. Here there are.

  OLD  
lineEditCompleter = QtGui.QCompleter(completerList)
  NEW  
lineEditCompleter = QtGui.QCompleter(completerList, self)
  END  




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


[PyQt] uic.loadUi() and custom widgets

2009-06-24 Thread Greg Smith
I was curious if there was a way for a tool to have its Ui generated
from a .ui file but still use custom widgets?

I have a widget I wrote that inherits the QLineEdit widget in which I
needed to modify the event() method so that a custom property will be
modified if the backspace key was pressed

I was able to get everything to work properly, in a simple dialog where
I defined the layout within the __init__() method, however for more
complex dialog windows I'd like to keep the ability to modify the layout
within the designer and just swap out the which ever widget is supposed
to be the custom one, that way the __init__() method remains tidy and
less lines of code.

 

Is there any straight forward ways to do this? 

 

Greg

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

RE: FW: [PyQt] Using a QCompleter with a QLineEdit

2009-06-24 Thread Greg Smith
Sorry 4.4.3 for Python 2.5

-Original Message-
From: Phil Thompson [mailto:p...@riverbankcomputing.com] 
Sent: Wednesday, June 24, 2009 5:45 PM
To: Greg Smith
Cc: pyqt@riverbankcomputing.com
Subject: Re: FW: [PyQt] Using a QCompleter with a QLineEdit

On Wed, 24 Jun 2009 13:44:30 -0500, "Greg Smith"
 wrote:
> Here is a very simple test.
> Just run it in a command shell, and be sure the .ui file lives in the
same
> directory as the .py file.

You don't say what version you are using.

As Pete said it's probably because you aren't keeping a reference to the
QCompleter.  The current version of PyQt will do this for you.

Phil



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


FW: [PyQt] Using a QCompleter with a QLineEdit

2009-06-24 Thread Greg Smith
Here is a very simple test.
Just run it in a command shell, and be sure the .ui file lives in the same 
directory as the .py file.

Greg

-Original Message-
From: projetmbc [mailto:projet...@club-internet.fr] 
Sent: Wednesday, June 24, 2009 11:00 AM
To: Greg Smith
Cc: pyqt@riverbankcomputing.com
Subject: Re: [PyQt] Using a QCompleter with a QLineEdit

Hello,
can you give a LFE aka a little functiunal example ?

C.


Greg Smith a écrit :
>
> Hey Everyone,
>
> I'm trying to get a LineEdit I have in a tool I am writing to have the 
> ability to auto complete the user's entry based on what they have 
> typed. From the sounds of it, QCompleter is exactly what I am after 
> and they work on QLineEdit widgets. However I am having difficulty 
> getting it to work, so I was wondering if I could share what I am 
> trying to do and see if I am doing anything wrong or not doing 
> something that I should be in order to get it to work.
>
> So here's an abridged example of what I am doing.
>
> 
>
> From PyQt4 import QtCore, QtGui, uic
>
> defaultList = ['foo', 'bar', 'alpha', 'beta', 'ceti', 'delta']
>
> completerList = QtCore.QStringList()
>
> for i in defaultList:
>
> completerList.append(QtCore.QString(i))
>
> #defining my QDialog
>
> class MyPyQtTool(QtGui.QDialog):
>
> def __init__(self):
>
> QtGui.QDialog.__init__(self)
>
> self.ui = uic.loadUi ('C:\\myUiFile.ui')
>
> lineEditCompleter = QtGui.QCompleter(completerList)
>
> lineEditCompleter.setCompletionMode(QtGui.QCompleter.InlineCompletion)
>
> lineEditCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
>
> self.ui.myLineEdit_widget.setCompleter(lineEditCompleter)
>
> #... defining other tool logic
>
> # I also have the list being modified in another method based off of 
> user's selection.
>
> def onMyComboBoxActivated(self)
>
> # code here where a string list is created from a mysql db query based 
> on combo box selection.
>
> for i in dbQryList:
>
> completerList.append(QtCore.QString(i))
>
> lineEditCompleter = QtGui.QCompleter(completerList)
>
> lineEditCompleter.setCompletionMode(QtGui.QCompleter.InlineCompletion)
>
> lineEditCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
>
> self.ui.myLineEdit_widget.setCompleter(lineEditCompleter)
>
> app = QtGui.QApplication(sys.argv)
>
> dialog = MyPyQtTool()
>
> dialog.ui.show()
>
> app.exec_()
>
> ---
>
> This may not be the cleanest way of doing what I want but from the 
> example shown in the class reference web page, this should be sound.
>
> However when I try to test it, I get no completion what so ever. No 
> errors are thrown so I am not exactly sure what I am doing wrong.
>
> Is there another method that needs to be executed before it should work?
>
> Any help would be truly appreciated!
>
> Thanks,
>
> Greg
>






simpleTest.py
Description: simpleTest.py


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

[PyQt] Using a QCompleter with a QLineEdit

2009-06-24 Thread Greg Smith
Hey Everyone, 

 

I'm trying to get a LineEdit I have in a tool I am writing to have the
ability to auto complete the user's entry based on what they have typed.
>From the sounds of it, QCompleter is exactly what I am after and they
work on QLineEdit widgets. However I am having difficulty getting it to
work, so I was wondering if I could share what I am trying to do and see
if I am doing anything wrong or not doing something that I should be in
order to get it to work.

 

So here's an abridged example of what I am doing.




>From PyQt4 import QtCore, QtGui, uic

 

defaultList = ['foo', 'bar', 'alpha', 'beta', 'ceti', 'delta']

completerList = QtCore.QStringList()

 

for i in defaultList:

completerList.append(QtCore.QString(i))

 

#defining my QDialog

class MyPyQtTool(QtGui.QDialog):

def __init__(self):

QtGui.QDialog.__init__(self)

self.ui = uic.loadUi ('C:\\myUiFile.ui')

lineEditCompleter = QtGui.QCompleter(completerList)

 
lineEditCompleter.setCompletionMode(QtGui.QCompleter.InlineCompletion)

lineEditCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive)

self.ui.myLineEdit_widget.setCompleter(lineEditCompleter)

#... defining other tool logic

 

# I also have the list being modified in another method based off of
user's selection.

def onMyComboBoxActivated(self)

# code here where a string list is created from a mysql db query
based on combo box selection.

for i in dbQryList:

completerList.append(QtCore.QString(i))

lineEditCompleter = QtGui.QCompleter(completerList)

 
lineEditCompleter.setCompletionMode(QtGui.QCompleter.InlineCompletion)

 
lineEditCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive)

self.ui.myLineEdit_widget.setCompleter(lineEditCompleter)

 

app = QtGui.QApplication(sys.argv)

dialog = MyPyQtTool()

dialog.ui.show()

app.exec_()


---

This may not be the cleanest way of doing what I want but from the
example shown in the class reference web page, this should be sound.

However when I try to test it, I get no completion what so ever. No
errors are thrown so I am not exactly sure what I am doing wrong.

Is there another method that needs to be executed before it should work?


 

Any help would be truly appreciated!

 

Thanks, 

Greg 

 

 

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

RE: [PyQt] trivial question regarding standarditemmodels

2009-06-12 Thread Greg Smith
Nevermind figured out what my problem was, it was unrelated to PyQt and
a threading issue.

 



From: pyqt-boun...@riverbankcomputing.com
[mailto:pyqt-boun...@riverbankcomputing.com] On Behalf Of Greg Smith
Sent: Friday, June 12, 2009 9:36 AM
To: pyqt
Subject: RE: [PyQt] trivial question regarding standarditemmodels

 

Okay tell me if I'm doing something wrong, I am doing some basic test
executions on button logic

Here is what I got so far 

 

Button_pressed(self):

sel_idxs = self.ui.myListView.selectedIndexes()

for i in sel_idxs:

msg = 'row: %s, col: %s' % (i.row(), i.column())

print msg

 

so in my listview I have 4 items, I select the first and third item
which should give me row indexes 0 and 2, what gets printed is this:

row: 2, col:0

row: 2, col:0

 

...umm that's not right. I try other selection combinations, and it
seems that only the last item that was selected, that row index gets
returned

Only time it really works is if I make single selections. But I want the
user to be able to select which ever and the appropriate list of indexes
is returned.

I'm at a loss on this one, I thought I had my problem pegged until I did
this test.

 

Any clues? This is beginning to drive me nuts!

 

Greg

 

 



From: pyqt-boun...@riverbankcomputing.com
[mailto:pyqt-boun...@riverbankcomputing.com] On Behalf Of Greg Smith
Sent: Thursday, June 11, 2009 6:12 PM
To: pyqt
Subject: [PyQt] trivial question regarding standarditemmodels

 

Hey everyone. I have a QListView widget that is populated by a
QStandardItemModel, which I populated using the appendRow method with a
list containing QStandardItems. 

My question is that I am creating a gui to where the user can select
multiple Items in the listview and press a button to remove those items
from the list. 

 

Now for the most part, I figured the logic theory out in my head on how
to do this, where I am stuck is executing the logic within the context
of an ItemModel. Up to this point 

I've learned enough about ItemModels to get me in trouble, but not
enough to have a complete understanding of whats actually happening.
Plus all the lists I made previously only used 

Single selection and I was able to get the selection I needed from a
selectionChanged method. I also figured out how to set the selection of
a ListView  programmatically with not too much trouble. However where I
am stuck, is trying to figure out how to access what row information
based off of whats selected or not selected in its related listview
object. 

 

Here is what I plan on doing in my button logic

 

1. newItemModel = existingItemModel()

2. for rowInt in  range(existingModel.rowCount):

3. rowIndex = existingModel.index(rowInt, 0)

4. if  rowIndex not in listView.selectedIndexes():

5. newItemModel.addRow(existingItemModel.takeRow(rowInt)

6.  listView.setModel(newItemModel)

 

Where I think I am getting hung up is on row 3 or 4, because I don't'
know if that maintains a 1 to 1 relation ship between the QModelIndex
item created by the index() method and the QModelIndex item that is
created from the selectedIndex() method.  Again, like I said, I know
enough to get in trouble. This could be an entirely wrong approach.

 

So not sure what to do actually, so any advice on the matter would be
truly appreciated.

 

Greg

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

RE: [PyQt] trivial question regarding standarditemmodels

2009-06-12 Thread Greg Smith
Okay tell me if I'm doing something wrong, I am doing some basic test
executions on button logic

Here is what I got so far 

 

Button_pressed(self):

sel_idxs = self.ui.myListView.selectedIndexes()

for i in sel_idxs:

msg = 'row: %s, col: %s' % (i.row(), i.column())

print msg

 

so in my listview I have 4 items, I select the first and third item
which should give me row indexes 0 and 2, what gets printed is this:

row: 2, col:0

row: 2, col:0

 

...umm that's not right. I try other selection combinations, and it
seems that only the last item that was selected, that row index gets
returned

Only time it really works is if I make single selections. But I want the
user to be able to select which ever and the appropriate list of indexes
is returned.

I'm at a loss on this one, I thought I had my problem pegged until I did
this test.

 

Any clues? This is beginning to drive me nuts!

 

Greg

 

 



From: pyqt-boun...@riverbankcomputing.com
[mailto:pyqt-boun...@riverbankcomputing.com] On Behalf Of Greg Smith
Sent: Thursday, June 11, 2009 6:12 PM
To: pyqt
Subject: [PyQt] trivial question regarding standarditemmodels

 

Hey everyone. I have a QListView widget that is populated by a
QStandardItemModel, which I populated using the appendRow method with a
list containing QStandardItems. 

My question is that I am creating a gui to where the user can select
multiple Items in the listview and press a button to remove those items
from the list. 

 

Now for the most part, I figured the logic theory out in my head on how
to do this, where I am stuck is executing the logic within the context
of an ItemModel. Up to this point 

I've learned enough about ItemModels to get me in trouble, but not
enough to have a complete understanding of whats actually happening.
Plus all the lists I made previously only used 

Single selection and I was able to get the selection I needed from a
selectionChanged method. I also figured out how to set the selection of
a ListView  programmatically with not too much trouble. However where I
am stuck, is trying to figure out how to access what row information
based off of whats selected or not selected in its related listview
object. 

 

Here is what I plan on doing in my button logic

 

1. newItemModel = existingItemModel()

2. for rowInt in  range(existingModel.rowCount):

3. rowIndex = existingModel.index(rowInt, 0)

4. if  rowIndex not in listView.selectedIndexes():

5. newItemModel.addRow(existingItemModel.takeRow(rowInt)

6.  listView.setModel(newItemModel)

 

Where I think I am getting hung up is on row 3 or 4, because I don't'
know if that maintains a 1 to 1 relation ship between the QModelIndex
item created by the index() method and the QModelIndex item that is
created from the selectedIndex() method.  Again, like I said, I know
enough to get in trouble. This could be an entirely wrong approach.

 

So not sure what to do actually, so any advice on the matter would be
truly appreciated.

 

Greg

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

[PyQt] trivial question regarding standarditemmodels

2009-06-11 Thread Greg Smith
Hey everyone. I have a QListView widget that is populated by a
QStandardItemModel, which I populated using the appendRow method with a
list containing QStandardItems. 

My question is that I am creating a gui to where the user can select
multiple Items in the listview and press a button to remove those items
from the list. 

 

Now for the most part, I figured the logic theory out in my head on how
to do this, where I am stuck is executing the logic within the context
of an ItemModel. Up to this point 

I've learned enough about ItemModels to get me in trouble, but not
enough to have a complete understanding of whats actually happening.
Plus all the lists I made previously only used 

Single selection and I was able to get the selection I needed from a
selectionChanged method. I also figured out how to set the selection of
a ListView  programmatically with not too much trouble. However where I
am stuck, is trying to figure out how to access what row information
based off of whats selected or not selected in its related listview
object. 

 

Here is what I plan on doing in my button logic

 

1. newItemModel = existingItemModel()

2. for rowInt in  range(existingModel.rowCount):

3. rowIndex = existingModel.index(rowInt, 0)

4. if  rowIndex not in listView.selectedIndexes():

5. newItemModel.addRow(existingItemModel.takeRow(rowInt)

6.  listView.setModel(newItemModel)

 

Where I think I am getting hung up is on row 3 or 4, because I don't'
know if that maintains a 1 to 1 relation ship between the QModelIndex
item created by the index() method and the QModelIndex item that is
created from the selectedIndex() method.  Again, like I said, I know
enough to get in trouble. This could be an entirely wrong approach.

 

So not sure what to do actually, so any advice on the matter would be
truly appreciated.

 

Greg

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

RE: [PyQt] images in PyQt QTextEdit widgets

2009-06-11 Thread Greg Smith
"""
One thing to try is to enter the following lines in an interactive
Python
session and see which formats are supported:

  from PyQt4.QtGui import *
  app = QApplication([])
  QImageReader.supportedImageFormats()
"""
That looks like it was the case! I ran this in a python shell and low
and behold no jpg. I've must have not included support for it when I did
the build, I swear I did. 

Greg



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


RE: [PyQt] images in PyQt QTextEdit widgets

2009-06-11 Thread Greg Smith
I've been trying to find examples or reference on how to take a QImage
object and embed the results into the rich text source of my QTextEdit
or 
QTextBrowser object.

The only example I found in the Rapid Gui book regarding embedded images
in the html rich text was an example of a image located in a resource
file:
""
However I don't want to use a resource file because the thumbnail image
changes based on user's selection and new images are constantly being
added to a pool of thousands of thumbnails we already have.

I did figure out how to get it to work, and that was to use a .png file
as opposed to a .jpg, which mystifies me to no extent. I thought that
PyQt could read jpg just as easily as png files, but I guess not. 

For now I guess this will be my solution. I was hoping I didn't have to
do a conversion of thumbnails that already exist, but if I have to do
so, than so be it.

Greg

-Original Message-
From: pyqt-boun...@riverbankcomputing.com
[mailto:pyqt-boun...@riverbankcomputing.com] On Behalf Of Hans-Peter
Jansen
Sent: Thursday, June 11, 2009 7:29 AM
To: pyqt@riverbankcomputing.com
Subject: Re: [PyQt] images in PyQt QTextEdit widgets

Am Donnerstag, 11. Juni 2009 schrieb Greg Smith:
> Hey everyone, I am having a bit of a problem when trying to display a
> jpg thumbnail image in a QTextEdit widget. I have a function that
builds
> an html string that has includes the image as well as some properties
> regarding the image sequence that the thumbnail represents. Once the
> string has been created I use the setHtml() method to set the string
as
> the contents of the QTextEdit. When I run my tool, I get all the text
> information, but a broken image icon is displayed instead.
>
>
>
> The part that mystifies me is that the html string I created is based
> off of what worked in the Qt Designer when I made the ui, once I got a
> stand in to look right I simply copied the source html and used it as
> the foundation of my method.
>
>
>
> The image or images in question are located on our file server which
is
> accessed in a typical UNC fashion, OS is WinXp x64.
>
> The example source code that worked looked a bit like
> so:"/bright1/shows/stu... ../myImage.jpg".  Which I tried in my
> code, but no workie. I've tried "//bright1/shows",
> "file:/bright1/shows..",  even "/bright1/shows", but it seams
> that no matter what I try the image won't show. So I am kind puzzled
to
> why I can get a picture to work in Designer, but when I try to get it
to
> work at runtime of my tool. It doesn't.
>

How about starting with trying to access your image with QFile or
QImage.
Once, you get that part working, the rest will be easy.

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



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


[PyQt] images in PyQt QTextEdit widgets

2009-06-10 Thread Greg Smith
Hey everyone, I am having a bit of a problem when trying to display a
jpg thumbnail image in a QTextEdit widget. I have a function that builds
an html string that has includes the image as well as some properties
regarding the image sequence that the thumbnail represents. Once the
string has been created I use the setHtml() method to set the string as
the contents of the QTextEdit. When I run my tool, I get all the text
information, but a broken image icon is displayed instead. 

 

The part that mystifies me is that the html string I created is based
off of what worked in the Qt Designer when I made the ui, once I got a
stand in to look right I simply copied the source html and used it as
the foundation of my method. 

 

The image or images in question are located on our file server which is
accessed in a typical UNC fashion, OS is WinXp x64. 

The example source code that worked looked a bit like
so:"/bright1/shows/stu... ../myImage.jpg".  Which I tried in my
code, but no workie. I've tried "//bright1/shows",
"file:/bright1/shows..",  even "/bright1/shows", but it seams
that no matter what I try the image won't show. So I am kind puzzled to
why I can get a picture to work in Designer, but when I try to get it to
work at runtime of my tool. It doesn't.

 

Anyone have any ideas?

 

Greg

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

[PyQt] compiling pyqt4 64-bit for local distribution

2009-05-06 Thread Greg Smith
Hi All, 
I was able to successfully compile Qt 4.5, SIP and PyQt4 on my dev
machine using MSVC2005 (using 2005 because I am compiling against Python
2.5.1)

I was successful in building everything and PyQt works on the dev
machine. However I was curious on how I would be able to distribute PyQt
to other machines at work? I'm fairly new with the world of compiling so
I am not exactly sure what the process is to achieve what I am after. 

Thanks,

Greg Smith
Troublemaker Studios


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


RE: [PyQt] PyQT64 for Windows

2009-05-04 Thread Greg Smith
I've been curious about that myself, I've scoured the internet and came
to the conclusion that I need to compile one myself, which I am not
looking forward to due to recent experiences.

 

Greg

 



From: pyqt-boun...@riverbankcomputing.com
[mailto:pyqt-boun...@riverbankcomputing.com] On Behalf Of Martin K
Sent: Sunday, May 03, 2009 12:02 AM
To: pyqt@riverbankcomputing.com
Subject: [PyQt] PyQT64 for Windows

 

Hi,

 

Just wondering if there are any PyQT installers available for 64bit
Python on Windows.

 

Thanks,

 

MK

 

 



The new Internet Explorer(r) 8 - Faster, safer, easier. Optimized for
Yahoo! Get it Now for Free!
 

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

[PyQt] QMessagebox audible alert question

2009-04-30 Thread Greg Smith
Just curious, if there was a way to silence the audible alert that
occurs when a QMessageBox is invoked?  I looked through the
documentation briefly but didn't see any mention of such a procedure.

 

Thanks,

Greg Smith

Troublemaker Studios

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

RE: [PyQt] QLineEdit and focusOutEvent problem

2009-04-21 Thread Greg Smith
Well I found the solution, and it was simple enough to uses the
editingFinished() signal, as this was exactly what I was looking for.

 

Greg

 



From: pyqt-boun...@riverbankcomputing.com
[mailto:pyqt-boun...@riverbankcomputing.com] On Behalf Of Greg Smith
Sent: Monday, April 20, 2009 7:55 PM
To: pyqt@riverbankcomputing.com
Subject: [PyQt] QLineEdit and focusOutEvent problem

 

Hello there, I'm new to the mailing list as well as PyQt in general, so
please bare with me, and I apologize ahead of time for questions that
may be trivial. So far I dig PyQt, I've been very pleased with
everything, that is until I had my encounter with events. Maybe its lack
of knowledge when it comes to event handling paradigm, but it just seems
like plain voodoo to me. 

 

The current tool I am working on uses a QDialog as the main widget. Its
being called as a dialog box for a custom plugin I have written for Nuke
(compositing software). One of the behaviors I am trying to incorporate
in several QLineEdit widgets is to execute the same method used on a
returnPressed() Signal, or execute the signal itself. But I am getting
ahead of myself here, executing logic is not the problem, its residue
behavior that occurs when I either try to override a widgets
focusOutEvent() or define an eventFilter for my object. 

 

I first used an event filter; this seemed like the most logical solution
for what I needed, However when I setup the event trigger, it looked
like the widget not losing focus properly. After I focused out by
clicking on another widget, a text cursor would remain flashing in the
widget. Also it didn't seem to update the stylesheet settings either. I
have a my stylesheet assigning a different color border for whichever
widget has focus. With the event filter, when a widget loses focus, the
border remains highlighted unless I mouse over it.

 

...in the __init__() method

self.ui.pth_ln.installEventFilter(self)

self.ui.desc_ln.installEventFilter(self)

self.ui.vrsn_ln.installEventFilter(self)

 

def eventFilter(self, o, e):

if o == self.ui.pth_ln:

if e.type() == QtCore.QEvent.FocusOut:

utils.executeInMainThread(nuke.tprint, ('path out
focus',))

self.ui.pth_ln.clearFocus()

return True

else:

return False

if o == self.ui.desc_ln:

if e.type() == QtCore.QEvent.FocusOut:

utils.executeInMainThread(nuke.tprint, ('description
out focus',))

self.ui.desc_ln.clearFocus()

return True

else:

return False

if o == self.ui.vrsn_ln:

if e.type() == QtCore.QEvent.FocusOut:

utils.executeInMainThread(nuke.tprint, ('version out
focus',))

self.ui.vrsn_ln.clearFocus()

return True

else:

return False

#else:

return self.eventFilter(o,e)

 

In place of the methods I want to execute I used nukes terminal print
method.

 

My second try was to override the widget's focusOutEvent. Here is what I
did 

 

In my __init__() method, I have:

self.ui.pth_ln.focusOutEvent = self.path_focusOutEvent

self.ui.desc_ln.focusOutEvent = self.desc_focusOutEvent

self.ui.vrsn_ln.focusOutEvent = self.vrsn_focusOutEvent

 

and the corresponding methods:

def pth_FocusOutEvent(self, event):

utils.executeInMainThread(nuke.tprint, ('path off focus',))

self.ui.pth_ln.clearFocus()

event.accept()

 

def desc_FocusOutEvent(self, event):

utils.executeInMainThread(nuke.tprint, ('description off
focus',))

self.ui.desc_ln.clearFocus()

event.accept()

 

def vrsn_FocusOutEvent(self, event):

utils.executeInMainThread(nuke.tprint, ('version off
focus',))

self.ui.vrsn_ln.clearFocus()

event.accept()

 

Again, same behavior as found in the event filters. So it seems like
when the default event is getting overridden, I am not introducing back
code that enables the behavior I am after, As if the widget is not being
fully released, that still thinks has focus even though the keyboard has
been released from the widget. So, I don't know. I am hoping someone can
enlighten me on how to get it to work, or maybe even suggest a work
around that doesn't use events but signals instead, I seem to have
better luck with those.

 

Thanks, 

 

Greg

 

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

[PyQt] QLineEdit and focusOutEvent problem

2009-04-20 Thread Greg Smith
Hello there, I'm new to the mailing list as well as PyQt in general, so
please bare with me, and I apologize ahead of time for questions that
may be trivial. So far I dig PyQt, I've been very pleased with
everything, that is until I had my encounter with events. Maybe its lack
of knowledge when it comes to event handling paradigm, but it just seems
like plain voodoo to me. 

 

The current tool I am working on uses a QDialog as the main widget. Its
being called as a dialog box for a custom plugin I have written for Nuke
(compositing software). One of the behaviors I am trying to incorporate
in several QLineEdit widgets is to execute the same method used on a
returnPressed() Signal, or execute the signal itself. But I am getting
ahead of myself here, executing logic is not the problem, its residue
behavior that occurs when I either try to override a widgets
focusOutEvent() or define an eventFilter for my object. 

 

I first used an event filter; this seemed like the most logical solution
for what I needed, However when I setup the event trigger, it looked
like the widget not losing focus properly. After I focused out by
clicking on another widget, a text cursor would remain flashing in the
widget. Also it didn't seem to update the stylesheet settings either. I
have a my stylesheet assigning a different color border for whichever
widget has focus. With the event filter, when a widget loses focus, the
border remains highlighted unless I mouse over it.

 

...in the __init__() method

self.ui.pth_ln.installEventFilter(self)

self.ui.desc_ln.installEventFilter(self)

self.ui.vrsn_ln.installEventFilter(self)

 

def eventFilter(self, o, e):

if o == self.ui.pth_ln:

if e.type() == QtCore.QEvent.FocusOut:

utils.executeInMainThread(nuke.tprint, ('path out
focus',))

self.ui.pth_ln.clearFocus()

return True

else:

return False

if o == self.ui.desc_ln:

if e.type() == QtCore.QEvent.FocusOut:

utils.executeInMainThread(nuke.tprint, ('description
out focus',))

self.ui.desc_ln.clearFocus()

return True

else:

return False

if o == self.ui.vrsn_ln:

if e.type() == QtCore.QEvent.FocusOut:

utils.executeInMainThread(nuke.tprint, ('version out
focus',))

self.ui.vrsn_ln.clearFocus()

return True

else:

return False

#else:

return self.eventFilter(o,e)

 

In place of the methods I want to execute I used nukes terminal print
method.

 

My second try was to override the widget's focusOutEvent. Here is what I
did 

 

In my __init__() method, I have:

self.ui.pth_ln.focusOutEvent = self.path_focusOutEvent

self.ui.desc_ln.focusOutEvent = self.desc_focusOutEvent

self.ui.vrsn_ln.focusOutEvent = self.vrsn_focusOutEvent

 

and the corresponding methods:

def pth_FocusOutEvent(self, event):

utils.executeInMainThread(nuke.tprint, ('path off focus',))

self.ui.pth_ln.clearFocus()

event.accept()

 

def desc_FocusOutEvent(self, event):

utils.executeInMainThread(nuke.tprint, ('description off
focus',))

self.ui.desc_ln.clearFocus()

event.accept()

 

def vrsn_FocusOutEvent(self, event):

utils.executeInMainThread(nuke.tprint, ('version off
focus',))

self.ui.vrsn_ln.clearFocus()

event.accept()

 

Again, same behavior as found in the event filters. So it seems like
when the default event is getting overridden, I am not introducing back
code that enables the behavior I am after, As if the widget is not being
fully released, that still thinks has focus even though the keyboard has
been released from the widget. So, I don't know. I am hoping someone can
enlighten me on how to get it to work, or maybe even suggest a work
around that doesn't use events but signals instead, I seem to have
better luck with those.

 

Thanks, 

 

Greg

 

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