def __init__( self ): super( MainWindow, self ).__init__() from forms.viewer import Ui_MainWindow self.ui = Ui_MainWindow() self.ui.setupUi( self ) self.ui.action_Open.triggered.connect( self.__onOpen )
class MainWindow( QtGui.QMainWindow ): def __init__( self ): super( MainWindow, self ).__init__() from forms.viewer import Ui_MainWindow self.ui = Ui_MainWindow() self.ui.setupUi( self ) self.ui.action_Open.triggered.connect( self.__onOpen ) def __onOpen( self ): fileName, selectedFilter = QtGui.QFileDialog.getOpenFileName( self ) if len( fileName ) == 0: return try: self.ui.graphicsView.openDtv( fileName ) except dtv.FileCorruptedError: QtGui.QMessageBox.critical( self, u'Invalid File', u'File corrupted.' ) except Exception as e: QtGui.QMessageBox.critical( self, u'Unknown Error', e.message )