Graphics Reference
In-Depth Information
Tip
Note that the
mActionExplore.png
icon file is a converted copy of the
mAc-
tionIdentify.svg
image in the source code repository. We renamed the image file
to match the name of the tool in our Lex application.
Next, we need to create our
resources.qrc
file so that PyQt can use these images.
Create this file and enter the following into it:
<RCC>
<qresource prefix="/icons">
<file>mActionZoomIn.png</file>
<file>mActionZoomOut.png</file>
<file>mActionPan.png</file>
<file>mActionExplore.png</file>
</qresource>
</RCC>
You will need to compile this file using
pyrcc4
. This will give you the
re-
sources.py
module required by your user interface.
Now that we've defined our user interface, let's modify the
lex.py
module to use it. Add
the following
import
statements to the top of your module:
from ui_explorerWindow import Ui_ExplorerWindow
import resources
Next, we want to replace our dummy implementation of the
MapExplorer
window
with one that uses our new UI. This is what the
MapExplorer
class definition should
look like:
class MapExplorer(QMainWindow, Ui_ExplorerWindow):
def __init__(self):
QMainWindow.__init__(self)
self.setupUi(self)
If all goes well, our application should now run with a complete user interface—a toolbar,
menus, and room for our map canvas: