#-------------------------------------------------------------------------- #-------------------------------------------------------------------------- # # QGISLite - An Open Source GIS tool based on the QGIS core libraries # and written in Python # # Copyright (C) 2008 Aaron Racicot, Z-Pulley Inc. # # EMAIL: aaronr (at) z-pulley.com # WEB : http://www.reprojected.com # TRAC : http://trac.reprojected.com/qgislite # SVN : http://svn.reprojected.com/qgislite # #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- # # licensed under the terms of GNU GPL 2 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # #-------------------------------------------------------------------------- # PyQt4 includes for python bindings to QT from PyQt4.QtCore import QString,QObject,SIGNAL,Qt from PyQt4.QtGui import QMainWindow,QColor,QVBoxLayout,QPixmap,QSplashScreen # QGIS bindings for mapping functions try: # QGIS bindings for mapping functions from qgis.gui import QgsMapCanvas except ImportError: print "Unable to import QGIS" from qgislite_ui import Ui_MainWindow from qgisliteabout import QgisliteAboutGui from tools.basicmap.mapcoords import MapCoords from tools.basicmap.maptools import BasicMapTools from tools.console.qgislitepy import QGISLitePythonInterpGui # General system includes import sys,string,time # QGISLite Main window used for houseing the canvas, toolbars, and dialogs class QGISLiteGui(QMainWindow, Ui_MainWindow): def __init__(self): QMainWindow.__init__(self) # required by Qt4 to initialize the UI self.setupUi(self) self.splashPix = QPixmap(QString("core/images/qgis_lite_332x345.jpg")) self.splashPixScaled = self.splashPix.scaled(332,345,Qt.KeepAspectRatio) self.splash = QSplashScreen(self.splashPixScaled) self.splash.show() # Exit QObject.connect(self.actionExit, SIGNAL("triggered()"), self.exit) # About QObject.connect(self.actionAbout, SIGNAL("triggered()"), self.about) # Python Console QObject.connect(self.actionPython_Console, SIGNAL("triggered()"), self.pythonConsole) # create map canvas self.canvas = QgsMapCanvas(self) self.canvas.setCanvasColor(QColor(255,255,255)) self.canvas.enableAntiAliasing(True) self.canvas.useImageToRender(False) self.canvas.show() self.canvas.parentWin = self self.srs = None self.layers = [] # lay our widgets out in the main window self.layout = QVBoxLayout(self.frameMap) self.layout.addWidget(self.canvas) # We need to initialize the window sizes self.splitter.setSizes([175,800]) self.basicMapTools = BasicMapTools(self) self.mapCoords = MapCoords(self) time.sleep(2) self.splash.hide() def exit(self): self.close() def about(self): flags = Qt.WindowTitleHint | Qt.WindowSystemMenuHint | \ Qt.WindowMaximizeButtonHint wnd = QgisliteAboutGui(self,flags) wnd.show() def pythonConsole(self): flags = Qt.WindowTitleHint | Qt.WindowSystemMenuHint | \ Qt.WindowMaximizeButtonHint wnd = QGISLitePythonInterpGui(self,flags) wnd.show()