[PyQt] [SIP]MD5 openssl

2011-06-29 Thread Jarosław Białas

Hello

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

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


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


Re: [PyQt] QLineEdit vs. menu keyboard shortcuts

2011-06-29 Thread Nathan Weston

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

class Foo(QLineEdit):
 def keyPressEvent(self, event):
 print 'Foo keyPress', event.key(); sys.stdout.flush()
 QLineEdit.keyPressEvent(self, event)

app = QApplication([])
window = QMainWindow()
f = Foo()
window.setCentralWidget(f)
window.show()

def do_action():
 print 'action'; sys.stdout.flush()
action1 = QAction('Action 1', f, triggered=do_action)
action1.setShortcut(Qt.CTRL + Qt.Key_Z)
action1.setShortcutContext(Qt.WidgetShortcut)


For actions that should work all over the mainwindow, you should use
Qt.WidgetWithChildren here.



Oops, that line was an artifact of an earlier experiment. I actually 
tried every possible value for shortcutContext, none of them seem to 
make a difference.

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


Re: [PyQt] QLineEdit vs. menu keyboard shortcuts

2011-06-29 Thread Baz Walter

On 29/06/11 18:21, Nathan Weston wrote:

On 6/29/2011 1:07 PM, Baz Walter wrote:

as was suggested earlier in this thread, if the line-edit doesn't have
the keyboard focus, it can't trigger its own shortcuts. if it *does*
have the focus, but the shortcut sequence is not one it handles, the
keypress event will be re-propagated (as happens with 'Ctrl+R' in your
example).

the simplest way to control the focus is to use clearFocus() and
setFocus().


please reply to the list so that everyone can read your comments.


Unfortunately, I need the line-edit to have keyboard focus (and respond
to some keyboard shortcuts), without bashing my global menu shortcuts.
It seems like there *should* be a clean way to do this by mucking around
with the keyPressEvent, but so far nobody seems to know of one.


did you actually try what was suggested?

going back to your earlier example of dragging in the line-edit to 
change its value: all you need to do is clearFocus() when the drag 
starts and setFocus() when the drag ends. that way, whilst the drag is 
in progress, the line-edit's shortcuts won't work, but your global 
shortcuts will.


if that's not what you want, please try to make it clear what you do 
want (i.e. with a working example).


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


Re: [PyQt] QLineEdit vs. menu keyboard shortcuts

2011-06-29 Thread Nathan Weston

On 6/29/2011 1:32 PM, Baz Walter wrote:

On 29/06/11 18:21, Nathan Weston wrote:

On 6/29/2011 1:07 PM, Baz Walter wrote:

as was suggested earlier in this thread, if the line-edit doesn't have
the keyboard focus, it can't trigger its own shortcuts. if it *does*
have the focus, but the shortcut sequence is not one it handles, the
keypress event will be re-propagated (as happens with 'Ctrl+R' in your
example).

the simplest way to control the focus is to use clearFocus() and
setFocus().



Unfortunately, I need the line-edit to have keyboard focus (and respond
to some keyboard shortcuts), without bashing my global menu shortcuts.
It seems like there *should* be a clean way to do this by mucking around
with the keyPressEvent, but so far nobody seems to know of one.


did you actually try what was suggested?

going back to your earlier example of dragging in the line-edit to
change its value: all you need to do is clearFocus() when the drag
starts and setFocus() when the drag ends. that way, whilst the drag is
in progress, the line-edit's shortcuts won't work, but your global
shortcuts will.

if that's not what you want, please try to make it clear what you do
want (i.e. with a working example).



Short answer: focus tricks won't work for me. I need the widget to be 
able to accept keyboard focus and respond to some keyboard shortcuts.


Long answer:
I guess this will require a complete specification of how my widget works.

The widget appears to the user somewhat like a label displaying a 
number. If the user clicks and drags, the value will increase or 
decrease as the mouse is moved. By holding down modifier keys the user 
can adjust the speed with which the value changes.


If the user clicks (but doesn't drag), the number is highlighted and a 
text editing cursor appears. The widget at this point behaves exactly 
like a QLineEdit (with a validator to force numeric values). When the 
user presses Enter or the widget loses focus, it reverts to its default 
appearance.


If the widget has keyboard focus, but isn't in edit mode, the Up/Down 
arrow keys will nudge the value a small amount in either direction.


I am implementing this as a subclass of QLineEdit, overriding mouse and 
keyboard events and throwing in some CSS to make it look nice. When the 
widget is in edit mode it's set to editable, otherwise it's set to 
non-editable.


Now, when the widget is in its non-editable state, and the user hits 
Ctrl-Z, I want it to trigger the Undo action on the Edit menu. 
Unfortunately, QLineEdit intercepts the Ctrl-Z keystroke and does 
nothing (because it's not editable).


I can't call clearFocus() at the end of the drag, because this would 
break the Up/Down arrow shortcuts.


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


[PyQt] selecting an item in qtreeview

2011-06-29 Thread Jason Rahm
When using qtreewidget, I can use the itemClicked method to then call a def:

self.treeWidget_iRulesList.itemClicked.connect(self.displayRule)

However, I hit a wall in trying to pass data around this way, so I watched some 
tutorials on how to set up a model view and abstract the data from the GUI 
components.  This involved switching from a treeWidget to a treeView.  This 
works great in populating the tree, but now I don't know how to signal a 
clicked item and pass that item (and the tree parent it belongs to) to my 
displayRule def.  Any thoughts?
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] selecting an item in qtreeview

2011-06-29 Thread Jason Rahm
Sorry, forgot to include specs: PyQt version is 4.7, python is 2.7.1.

From: pyqt-boun...@riverbankcomputing.com 
[mailto:pyqt-boun...@riverbankcomputing.com] On Behalf Of Jason Rahm
Sent: Wednesday, June 29, 2011 3:48 PM
To: pyqt@riverbankcomputing.com
Subject: [PyQt] selecting an item in qtreeview

When using qtreewidget, I can use the itemClicked method to then call a def:

self.treeWidget_iRulesList.itemClicked.connect(self.displayRule)

However, I hit a wall in trying to pass data around this way, so I watched some 
tutorials on how to set up a model view and abstract the data from the GUI 
components.  This involved switching from a treeWidget to a treeView.  This 
works great in populating the tree, but now I don't know how to signal a 
clicked item and pass that item (and the tree parent it belongs to) to my 
displayRule def.  Any thoughts?
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] QLineEdit vs. menu keyboard shortcuts

2011-06-29 Thread Baz Walter

On 29/06/11 18:57, Nathan Weston wrote:

On 6/29/2011 1:32 PM, Baz Walter wrote:

going back to your earlier example of dragging in the line-edit to
change its value: all you need to do is clearFocus() when the drag
starts and setFocus() when the drag ends. that way, whilst the drag is
in progress, the line-edit's shortcuts won't work, but your global
shortcuts will.

if that's not what you want, please try to make it clear what you do
want (i.e. with a working example).

[snip]

Now, when the widget is in its non-editable state, and the user hits
Ctrl-Z, I want it to trigger the Undo action on the Edit menu.
Unfortunately, QLineEdit intercepts the Ctrl-Z keystroke and does
nothing (because it's not editable).


the example you posted earlier works (i.e. Ctrl+Z prints 'action') if 
the Foo widget has been set as read-only.


(nb: the setShortcutContext line also needs to be commented out)


I can't call clearFocus() at the end of the drag, because this would
break the Up/Down arrow shortcuts.


call clearFocus() at the *start* of the drag, setFocus() at the *end*.

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


Re: [PyQt] selecting an item in qtreeview

2011-06-29 Thread Paul Du Bois
I use QTreeView's selectionChanged signal.  But you should also look at
QAbstractItemView's signals; it has many for you to choose from:
activated, clicked, doubleClicked, entered, pressed, ...

 

p

 

From: pyqt-boun...@riverbankcomputing.com
[mailto:pyqt-boun...@riverbankcomputing.com] On Behalf Of Jason Rahm
Sent: Wednesday, June 29, 2011 3:03 PM
To: Jason Rahm; pyqt@riverbankcomputing.com
Subject: Re: [PyQt] selecting an item in qtreeview

 

Sorry, forgot to include specs: PyQt version is 4.7, python is 2.7.1.

 

From: pyqt-boun...@riverbankcomputing.com
[mailto:pyqt-boun...@riverbankcomputing.com] On Behalf Of Jason Rahm
Sent: Wednesday, June 29, 2011 3:48 PM
To: pyqt@riverbankcomputing.com
Subject: [PyQt] selecting an item in qtreeview

 

When using qtreewidget, I can use the itemClicked method to then call a
def:

 

self.treeWidget_iRulesList.itemClicked.connect(self.displayRule)

 

However, I hit a wall in trying to pass data around this way, so I
watched some tutorials on how to set up a model view and abstract the
data from the GUI components.  This involved switching from a treeWidget
to a treeView.  This works great in populating the tree, but now I don't
know how to signal a clicked item and pass that item (and the tree
parent it belongs to) to my displayRule def.  Any thoughts?

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