Hi!
I’m writing a python extension for Avogadro and I’ve some problem getting
running dialogs, guis etc… Some code about it
----various imports---------------------
import dialog_ui # A compiled dialog ui from QtDesigner
class Dialog(QDialog,dialog_ui):
def init(self,*a,**kw):
QDialog.init(self,*a,**kw)
self.setupUi(self)
----- class Extension definition -----
def performAction(self,action,glview):
dialog = Dialog()
dialog.show()
The problem is that the dialog isn’t showing in the application, but if I
set the glview as the parent of the dialog, it shows.
There’s another strange thing: after setting the glview as the parent of the
dialog, however if I connect a button with a callback it doesn’t work. It’s
like that the pyqt stuff doesn’t “enter” in the main loop and if set the
widget as a child of the glview(that is in the mainloop) it works.
I’m relatively new to pyqt…so it may be me.
On Sat, Mar 6, 2010 at 12:49 PM, Gabriele Lanaro
gabriele.lanaro@gmail.com wrote:
Hi!
I’m writing a python extension for Avogadro and I’ve some problem getting
running dialogs, guis etc… Some code about it
----various imports---------------------
import dialog_ui # A compiled dialog ui from QtDesigner
class Dialog(QDialog,dialog_ui):
def init(self,*a,**kw):
QDialog.init(self,*a,**kw)
self.setupUi(self)
----- class Extension definition -----
def performAction(self,action,glview):
dialog = Dialog()
dialog.show()
The problem is that the dialog isn’t showing in the application, but if I
set the glview as the parent of the dialog, it shows.
There’s another strange thing: after setting the glview as the parent of the
dialog, however if I connect a button with a callback it doesn’t work. It’s
like that the pyqt stuff doesn’t “enter” in the main loop and if set the
widget as a child of the glview(that is in the mainloop) it works.
I’m relatively new to pyqt…so it may be me.
The problem is that the dialog gets deleted as soon as you leave
scope. Setting a parent prevents this. Another option would be to keep
a reference to your dialog in the extension:
def Extension(QObject):
def init(self):
self.dialog = None
def performAction(self,action,glview):
if not dialog:
self.dialog = Dialog()
self.dialog.show()
Cheers,
Tim
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
Avogadro-Discuss mailing list
Avogadro-Discuss@lists.sourceforge.net
avogadro-discuss List Signup and Options
Hi!
… another time here, I haven’t figured out how to solve the “signal
connecting” problem, the signals I connect with python callback doesn’t
work, after opening the dialog (clicking on the menu entry) when I click the
“prova” button it doesn’t call the on_clicked method
I’ve done a simple test case:
-------------- prova_ext.py
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import Avogadro
from prova import prova
class Extension(QObject):
def actions(self):
actions =
action = QAction(self)
action.setText(“Gui Test”)
actions.append(action)
return actions
def performAction(self, action, glwidget):
self.dialog = TestDialog()
self.dialog.show()
# Clicking on the button doesn’t raise the exception
class TestDialog(QDialog):
def init(self):
QDialog.init(self)
self.ui = prova.Ui_Dialog()
self.ui.setupUi(self)
self.ui.prova.clicked.connect(self.on_clicked)
def on_clicked(self):
# Throw an exception
1/0
return
The complete test case is tarred at this link:
http://dl.dropbox.com/u/1276730/prova_ext.tar.gz
2010/3/6 Gabriele Lanaro gabriele.lanaro@gmail.com
Thank you very much for the help, this solved my problem… And sorry for
the dumb question!
2010/3/6 Tim Vandermeersch tim.vandermeersch@gmail.com
On Sat, Mar 6, 2010 at 12:49 PM, Gabriele Lanaro
gabriele.lanaro@gmail.com wrote:
Hi!
I’m writing a python extension for Avogadro and I’ve some problem
getting
running dialogs, guis etc… Some code about it
----various imports---------------------
import dialog_ui # A compiled dialog ui from QtDesigner
class Dialog(QDialog,dialog_ui):
def init(self,*a,**kw):
QDialog.init(self,*a,**kw)
self.setupUi(self)
----- class Extension definition -----
def performAction(self,action,glview):
dialog = Dialog()
dialog.show()
The problem is that the dialog isn’t showing in the application, but if
I
set the glview as the parent of the dialog, it shows.
There’s another strange thing: after setting the glview as the parent of
the
dialog, however if I connect a button with a callback it doesn’t work.
It’s
like that the pyqt stuff doesn’t “enter” in the main loop and if set the
widget as a child of the glview(that is in the mainloop) it works.
I’m relatively new to pyqt…so it may be me.
The problem is that the dialog gets deleted as soon as you leave
scope. Setting a parent prevents this. Another option would be to keep
a reference to your dialog in the extension:
def Extension(QObject):
def init(self):
self.dialog = None
def performAction(self,action,glview):
if not dialog:
self.dialog = Dialog()
self.dialog.show()
Cheers,
Tim
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
Avogadro-Discuss mailing list
Avogadro-Discuss@lists.sourceforge.net
avogadro-discuss List Signup and Options
Updates:
I’m getting aware of this:
Now it’s ok
2010/3/7 Gabriele Lanaro gabriele.lanaro@gmail.com
Hi!
… another time here, I haven’t figured out how to solve the “signal
connecting” problem, the signals I connect with python callback doesn’t
work, after opening the dialog (clicking on the menu entry) when I click the
“prova” button it doesn’t call the on_clicked method
I’ve done a simple test case:
-------------- prova_ext.py
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import Avogadro
from prova import prova
class Extension(QObject):
def actions(self):
actions =
action = QAction(self)
action.setText(“Gui Test”)
actions.append(action)
return actions
def performAction(self, action, glwidget):
self.dialog = TestDialog()
self.dialog.show()
# Clicking on the button doesn’t raise the exception
class TestDialog(QDialog):
def init(self):
QDialog.init(self)
self.ui = prova.Ui_Dialog()
self.ui.setupUi(self)
self.ui.prova.clicked.connect(self.on_clicked)
def on_clicked(self):
# Throw an exception
1/0
return
The complete test case is tarred at this link:
http://dl.dropbox.com/u/1276730/prova_ext.tar.gz
2010/3/6 Gabriele Lanaro gabriele.lanaro@gmail.com
Thank you very much for the help, this solved my problem… And sorry for
the dumb question!
2010/3/6 Tim Vandermeersch tim.vandermeersch@gmail.com
On Sat, Mar 6, 2010 at 12:49 PM, Gabriele Lanaro
gabriele.lanaro@gmail.com wrote:
Hi!
I’m writing a python extension for Avogadro and I’ve some problem
getting
running dialogs, guis etc… Some code about it
----various imports---------------------
import dialog_ui # A compiled dialog ui from QtDesigner
class Dialog(QDialog,dialog_ui):
def init(self,*a,**kw):
QDialog.init(self,*a,**kw)
self.setupUi(self)
----- class Extension definition -----
def performAction(self,action,glview):
dialog = Dialog()
dialog.show()
The problem is that the dialog isn’t showing in the application, but if
I
set the glview as the parent of the dialog, it shows.
There’s another strange thing: after setting the glview as the parent
of the
dialog, however if I connect a button with a callback it doesn’t work.
It’s
like that the pyqt stuff doesn’t “enter” in the main loop and if set
the
widget as a child of the glview(that is in the mainloop) it works.
I’m relatively new to pyqt…so it may be me.
The problem is that the dialog gets deleted as soon as you leave
scope. Setting a parent prevents this. Another option would be to keep
a reference to your dialog in the extension:
def Extension(QObject):
def init(self):
self.dialog = None
def performAction(self,action,glview):
if not dialog:
self.dialog = Dialog()
self.dialog.show()
Cheers,
Tim
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
Avogadro-Discuss mailing list
Avogadro-Discuss@lists.sourceforge.net
avogadro-discuss List Signup and Options
On Sun, Mar 7, 2010 at 6:47 PM, Gabriele Lanaro
gabriele.lanaro@gmail.com wrote:
Updates:
I’m getting aware of this:
OB, Avogadro and Molecular Modelling: Avogadro gets new python wrappers
Now it’s ok
Good. This info should be on the wiki though. I’ve added the link and
also added links to the PyQt4 documentation.
(http://avogadro.openmolecules.net/wiki/Python_PyQt4). Any help on
improving documentation is always welcome.
Cheers,
Tim
2010/3/7 Gabriele Lanaro gabriele.lanaro@gmail.com
Hi!
… another time here, I haven’t figured out how to solve the “signal
connecting” problem, the signals I connect with python callback doesn’t
work, after opening the dialog (clicking on the menu entry) when I click the
“prova” button it doesn’t call the on_clicked method
I’ve done a simple test case:
-------------- prova_ext.py
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import Avogadro
from prova import prova
class Extension(QObject):
def actions(self):
actions =
action = QAction(self)
action.setText(“Gui Test”)
actions.append(action)
return actions
def performAction(self, action, glwidget):
self.dialog = TestDialog()
self.dialog.show()
# Clicking on the button doesn’t raise the exception
class TestDialog(QDialog):
def init(self):
QDialog.init(self)
self.ui = prova.Ui_Dialog()
self.ui.setupUi(self)
self.ui.prova.clicked.connect(self.on_clicked)
def on_clicked(self):
# Throw an exception
1/0
return
The complete test case is tarred at this link:
http://dl.dropbox.com/u/1276730/prova_ext.tar.gz
2010/3/6 Gabriele Lanaro gabriele.lanaro@gmail.com
Thank you very much for the help, this solved my problem… And sorry for
the dumb question!
2010/3/6 Tim Vandermeersch tim.vandermeersch@gmail.com
On Sat, Mar 6, 2010 at 12:49 PM, Gabriele Lanaro
gabriele.lanaro@gmail.com wrote:
Hi!
I’m writing a python extension for Avogadro and I’ve some problem
getting
running dialogs, guis etc… Some code about it
----various imports---------------------
import dialog_ui # A compiled dialog ui from QtDesigner
class Dialog(QDialog,dialog_ui):
def init(self,*a,**kw):
QDialog.init(self,*a,**kw)
self.setupUi(self)
----- class Extension definition -----
def performAction(self,action,glview):
dialog = Dialog()
dialog.show()
The problem is that the dialog isn’t showing in the application, but
if I
set the glview as the parent of the dialog, it shows.
There’s another strange thing: after setting the glview as the parent
of the
dialog, however if I connect a button with a callback it doesn’t work.
It’s
like that the pyqt stuff doesn’t “enter” in the main loop and if set
the
widget as a child of the glview(that is in the mainloop) it works.
I’m relatively new to pyqt…so it may be me.
The problem is that the dialog gets deleted as soon as you leave
scope. Setting a parent prevents this. Another option would be to keep
a reference to your dialog in the extension:
def Extension(QObject):
def init(self):
self.dialog = None
def performAction(self,action,glview):
if not dialog:
self.dialog = Dialog()
self.dialog.show()
Cheers,
Tim
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
Avogadro-Discuss mailing list
Avogadro-Discuss@lists.sourceforge.net
avogadro-discuss List Signup and Options
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
Avogadro-Discuss mailing list
Avogadro-Discuss@lists.sourceforge.net
avogadro-discuss List Signup and Options
I’ve seen that threads doesn’t work well, expecially with signal dispatching
across threads… Fortunately processes works, I’ve written another section
in the wiki about this subject. Feel free to edit and correct my work
This community is really active and friendly, I’m really glad of this!
P.S. Sorry I have to set automatically to include the list in the message
reply
2010/3/7 Tim Vandermeersch tim.vandermeersch@gmail.com
On Sun, Mar 7, 2010 at 6:47 PM, Gabriele Lanaro
gabriele.lanaro@gmail.com wrote:
Updates:
I’m getting aware of this:
OB, Avogadro and Molecular Modelling: Avogadro gets new python wrappers
Now it’s ok
Good. This info should be on the wiki though. I’ve added the link and
also added links to the PyQt4 documentation.
(http://avogadro.openmolecules.net/wiki/Python_PyQt4). Any help on
improving documentation is always welcome.
Cheers,
Tim
2010/3/7 Gabriele Lanaro gabriele.lanaro@gmail.com
Hi!
… another time here, I haven’t figured out how to solve the “signal
connecting” problem, the signals I connect with python callback doesn’t
work, after opening the dialog (clicking on the menu entry) when I
click the
“prova” button it doesn’t call the on_clicked method
I’ve done a simple test case:
-------------- prova_ext.py
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import Avogadro
from prova import prova
class Extension(QObject):
def actions(self):
actions =
action = QAction(self)
action.setText(“Gui Test”)
actions.append(action)
return actions
def performAction(self, action, glwidget):
self.dialog = TestDialog()
self.dialog.show()
# Clicking on the button doesn’t raise the exception
class TestDialog(QDialog):
def init(self):
QDialog.init(self)
self.ui = prova.Ui_Dialog()
self.ui.setupUi(self)
self.ui.prova.clicked.connect(self.on_clicked)
def on_clicked(self):
# Throw an exception
1/0
return
The complete test case is tarred at this link:
http://dl.dropbox.com/u/1276730/prova_ext.tar.gz
2010/3/6 Gabriele Lanaro gabriele.lanaro@gmail.com
Thank you very much for the help, this solved my problem… And sorry
for
the dumb question!
2010/3/6 Tim Vandermeersch tim.vandermeersch@gmail.com
On Sat, Mar 6, 2010 at 12:49 PM, Gabriele Lanaro
gabriele.lanaro@gmail.com wrote:
Hi!
I’m writing a python extension for Avogadro and I’ve some problem
getting
running dialogs, guis etc… Some code about it
----various imports---------------------
import dialog_ui # A compiled dialog ui from QtDesigner
class Dialog(QDialog,dialog_ui):
def init(self,*a,**kw):
QDialog.init(self,*a,**kw)
self.setupUi(self)
----- class Extension definition -----
def performAction(self,action,glview):
dialog = Dialog()
dialog.show()
The problem is that the dialog isn’t showing in the application,
but
if I
set the glview as the parent of the dialog, it shows.
There’s another strange thing: after setting the glview as the
parent
of the
dialog, however if I connect a button with a callback it doesn’t
work.
It’s
like that the pyqt stuff doesn’t “enter” in the main loop and if
set
the
widget as a child of the glview(that is in the mainloop) it works.
I’m relatively new to pyqt…so it may be me.
The problem is that the dialog gets deleted as soon as you leave
scope. Setting a parent prevents this. Another option would be to
keep
a reference to your dialog in the extension:
def Extension(QObject):
def init(self):
self.dialog = None
def performAction(self,action,glview):
if not dialog:
self.dialog = Dialog()
self.dialog.show()
Cheers,
Tim
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
Avogadro-Discuss mailing list
Avogadro-Discuss@lists.sourceforge.net
avogadro-discuss List Signup and Options
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
Avogadro-Discuss mailing list
Avogadro-Discuss@lists.sourceforge.net
avogadro-discuss List Signup and Options