Hi:

I am creating an app which customizes QtGui.QMainWindow. I am using 
splitters to split my screen into four areas and have the following code in 
my __init__ definition to create tabs in one of the areas:

----- start code

# Create TabWidget
self.viewArea = QtGui.QTabWidget()
# Add tabs
self.modelTab = modelview.ModelView(self)
self.reportTab = QtGui.QTextBrowser()
self.viewArea.addTab(self.modelTab, "Model")
self.viewArea.addTab(self.reportTab, "Report")
self.modelTab.InitDriver()

------ end code

The modelview module contains the code provided below but it does not work 
for me. It produces the following messages and dies with a "Segmentation 
fault".

###### 3D rendering pipe initialisation #####
Display3d class initialization starting ...
Graphic device created.

I would like to load the OCCViewer in the modelTab so that I can use 
pythonOCC in that tab.

Any help will be sincerely appreciated. Thanks.

----- start modelview module code

from PyQt4 import QtGui
import OCCViewer


class qtBaseViewer(QtGui.QWidget):
    ''' The base Qt Widget for an OCC viewer
    '''
    def __init__(self, parent=None):
        super(qtBaseViewer, self).__init__(parent)
        self._display = None
        self._inited = False
        self.setMouseTracking(True)  # enable Mouse Tracking
        self.setFocusPolicy(QtCore.Qt.WheelFocus)  # Strong focus
        self.setAttribute(QtCore.Qt.WA_PaintOnScreen)
        self.setAttribute(QtCore.Qt.WA_NoSystemBackground)

    def GetHandle(self):
        return int(self.winId())

    def resizeEvent(self, event):
        if self._inited:
            self._display.OnResize()


class ModelView(qtBaseViewer):
    def __init__(self, *kargs):
        super(ModelView, self).__init__(*kargs)
        self._drawbox = False
        self._zoom_area = False
        self._select_area = False
        self._inited = False
        self._leftisdown = False
        self._middleisdown = False
        self._rightisdown = False
        self._selection = None

    def InitDriver(self):
        self._display = OCCViewer.Viewer3d(self.GetHandle())
        self._display.Create()
        self._display.DisplayTriedron()
        self._display.SetModeShaded()
        self._inited = True
        print "Inited!!"

----- end modelview module code


-- 

Kene
::::::::::::::::::
kemen...@gmail.com


_______________________________________________
Pythonocc-users mailing list
Pythonocc-users@gna.org
https://mail.gna.org/listinfo/pythonocc-users

Reply via email to