Quantum GIS 1.8.0
Windows 7
Код: Выделить всё
import sys,os
import win32api
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
import ctypes
from PyQt4 import uic
class HelloWorld:
def __init__(self, iface):
self.iface = iface
self.canvas = iface.mapCanvas()
def initGui(self):
pushButton=QPushButton("pushButton")
self.action = QAction(QIcon(":/plugins/"), "&HelloWorld", self.iface.mainWindow())
self.action.setWhatsThis("Configuration for test plugin")
self.action.setStatusTip("This is status tip")
QObject.connect(self.action, SIGNAL("activated()"), self.hello_world)
QObject.connect(pushButton, SIGNAL("clicked()"),self.function)
self.iface.addPluginToMenu("HelloWorld", self.action)
def unload(self):
self.iface.removePluginMenu("HelloWorld",self.action)
self.iface.removeToolBarIcon(self.action)
def function(self):
QMessageBox.information(self.iface.mainWindow(), QCoreApplication.translate('HelloWorld', "HelloWorld"), QCoreApplication.translate('HelloWorld', "HelloWorld"))
return
def hello_world(self):
path = os.path.dirname( os.path.abspath( __file__ ) )
self.optionsDialog = uic.loadUi(os.path.join(path,"untitled.ui"))
self.optionsDialog.show()
if __name__ == "__main__":
pass