Clone wiki

TuiView / Embedding

This page describes how to embed TuiView in another PyQt4 application.

Creating TuiView windows

The recommended way to create TuiView windows in your own application is to use the GeolinkedWindows interface:

import sys
from PyQt4 import QtGui
from tuiview import geolinkedviewers

app = QtGui.QApplication(sys.argv)

glviewers = geolinkedviewers.GeolinkedViewers()
viewer = glviewers.newViewer()

app.exec_()

viewer will be an instance of ViewerWindow. Note: you can pass a filename to the glviewers.newViewer() function to start with an open file, otherwise call addRasterInternal()/addVectorInternal() on the ViewerWindow instance to add files programmatically.

Creating Tuiview widgets

You can also add the TuiView widget (the part of the window that holds the map) to your own windows and widgets:

import sys
from PyQt4 import QtGui
from tuiview import viewerwidget

app = QtGui.QApplication(sys.argv)
w = QtGui.QWidget()
layout = QtGui.QVBoxLayout()
map = viewerwidget.ViewerWidget(w)
layout.addWidget(map)
w.setLayout(layout)
w.resize(250, 150)
w.move(300, 300)
w.setWindowTitle('Simple')
w.show()

app.exec_()

Updated