>>>>> "Paolo" == Paolo Franzetti <[EMAIL PROTECTED]> writes:


    Paolo> How can I do this job without blocking the main window ?

Maybe just studying a bit more of python before writing apps?:)
Some points:

- just one app object for process!!

- if your object must survive the end of the method (e.g. the viewer),
  attach it to something that will survive the method or make it
  global;

- what's the clue on making a main window modal?

Have a look at the demos on the best practices about qt programming,
and also learn about python's nested scopes!

Attached you find a path that will make your code work... 

cheers

diff -ubB -r orig/main.py working/main.py
--- orig/main.py	2008-06-06 18:13:12.039737250 +0200
+++ working/main.py	2008-06-06 17:24:34.873497537 +0200
@@ -12,7 +12,6 @@
 class Ui_MainWindow(object):
     def setupUi(self, MainWindow):
         MainWindow.setObjectName("MainWindow")
-        MainWindow.setWindowModality(QtCore.Qt.WindowModal)
         MainWindow.resize(290,587)
         self.centralwidget = QtGui.QWidget(MainWindow)
         self.centralwidget.setGeometry(QtCore.QRect(0,29,290,536))
diff -ubB -r orig/program.py working/program.py
--- orig/program.py	2008-06-06 18:12:51.038540584 +0200
+++ working/program.py	2008-06-06 18:22:55.572990964 +0200
@@ -13,31 +13,23 @@
 
 	def __init__(self):
 	
-	
-		app = QtGui.QApplication(sys.argv)
 		MainWindow = QtGui.QMainWindow()
 		self.gui = Ui_MainWindow()
 		self.gui.setupUi(MainWindow)
 		MainWindow.show()
-    
 		QtCore.QObject.connect(self.gui.viewDataBtn,QtCore.SIGNAL("clicked()"), self.view_data)
-
 		sys.exit(app.exec_())
 		
-			
-
 	def view_data(self):
 		
 		# create the viewer	
-		app = QtGui.QApplication(sys.argv)
 		viewer = QtGui.QDialog()
 		self.vgui = Ui_Viewer()
 		self.vgui.setupUi(viewer)
-		
+		self.viewer = viewer
 		viewer.show()
 		
 		
 	
-		
+app = QtGui.QApplication(sys.argv)
 Main()
-
diff -ubB -r orig/viewer.py working/viewer.py
--- orig/viewer.py	2008-06-06 18:12:57.038882524 +0200
+++ working/viewer.py	2008-06-06 18:10:17.529792640 +0200
@@ -12,7 +12,6 @@
 class Ui_Viewer(object):
     def setupUi(self, Viewer):
         Viewer.setObjectName("Viewer")
-        Viewer.setWindowModality(QtCore.Qt.NonModal)
         Viewer.setEnabled(True)
         Viewer.resize(539,508)
         self.DataViewer = QtGui.QTableWidget(Viewer)
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to