OptionParser: options and args passed to PyQT app

P

pierreroth64

Hi,

New with python, I've developped a small cmd line script parsing opts
and args with an OptionParser:

in myApp.py:

....blablabla...
parser.add_option(...)
parser.add_option(...)
(options, args) = parser.parse_args()
doCheckParams(parser, options, args)
....blablabla...

I'm trying now to integrate it into a PyQt GUI app: Then options and
args are coming from my app fields.

here's my app:

from PyQt4 import QtCore, QtGui
from gui import Ui_my_app_gui
import myApp

class MyAppDialog(QtGui.QDialog):
def __init__(self):
QtGui.QDialog.__init__(self)
self.ui = Ui_my_app_gui()
self.ui.setupUi(self)

self.connect(self.ui.launch_button, QtCore.SIGNAL("clicked()"),
self._run)

def _run(self):

options = {}
options['opt1'] = self.ui.opt1_value.text
options['opt2'] = self.ui.opt2_value.text

args = str(self.ui.arg1_value.text)

try:
myApp.doCheckParams(parser=None, options=options, args=args)
# code does not reach this line!
myApp.run()
except Exception, message:
self.ui.output_value.setEnabled(True)
self.ui.output_value.text = message


if __name__=="__main__":
app = QtGui.QApplication(sys.argv)
dialog = MyAppDialog()
dialog.show()
app.exec_()

When clicking on my launch_button button, I can see that some code is
executed but my code never reaches the "# code does not reach this
line!" line....

Thanks a lot for your precious help!

Pierre
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top