Skip to content
Permalink
Browse files

Initial import of Matthew Perry's Python plugin installer

git-svn-id: http://svn.osgeo.org/qgis/trunk@7446 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
gsherman
gsherman committed Nov 17, 2007
1 parent 34438ac commit acdc107f1acc071405f449a99b6cceeb4b438195
@@ -0,0 +1 @@
SUBDIRS(plugin_installer)
@@ -0,0 +1,10 @@
SET(INSTALLER_FILES
dialog.py
gui.py
icon.xpm
__init__.py
installer_plugin.py
qgis_plugins.py
resources.py
)
INSTALL(FILES ${INSTALLER_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/qgis/python/plugins/plugin_installer)
@@ -0,0 +1,7 @@
You must have qgis 0.9+ with python bindings in order to run this plugin. If you want to modify the UI, you'll need th qt4 devtools.

1) Edit the INST_DIR in the Makefile to match your environment
2) sudo make install
3) open qgis and turn on the Installer plugin


@@ -0,0 +1,19 @@
Copyright (c) 2007 Matthew T. Perry

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1,27 @@
INST_DIR = /usr/local/share/qgis/python/plugins/plugin_installer

PYRCC = /usr/bin/pyrcc4
PYUIC = /usr/bin/pyuic4

RC_PY_FILE = resources.py
UI_PY_FILE = gui.py

all: $(RC_PY_FILE) $(UI_PY_FILE)

install: all
mkdir -p $(INST_DIR)
cp *.py $(INST_DIR)/

clean:
rm -f $(RC_PY_FILE) $(UI_PY_FILE)
rm -f *.pyc

zip:
cd /usr/local/share/qgis/python/plugins/ && zip -r ~/Desktop/plugin_installer.zip plugin_installer

$(RC_PY_FILE): resources.qrc
$(PYRCC) -o $(RC_PY_FILE) resources.qrc

$(UI_PY_FILE): gui.ui
$(PYUIC) -o $(UI_PY_FILE) gui.ui

@@ -0,0 +1,6 @@
The installer plugin retrieves an xml description of available plugins and shows the a full listing. You can choose to install any given plugin which will download the zip file to your temp directory and extract it into your *local user's* python plugin dir (ie ~/.qgis/python/plugins NOT /usr/share/qgis/python/plugins)

This plugin itself should, however, be installed in the system plugin directory to ensure all users have access to it.

Matthew T. Perry
perrygeo at gmail.com
@@ -0,0 +1,14 @@
# load TestPlugin class from file testplugin.py
from installer_plugin import InstallerPlugin

def name():
return "Plugin installer"

def description():
return "Downloads and installs QGIS python plugins"

def version():
return "Version 0.02"

def classFactory(iface):
return InstallerPlugin(iface)
@@ -0,0 +1,26 @@
from PyQt4.QtCore import *
from PyQt4.QtGui import *

from qgis.core import QgsContextHelp

from gui import Ui_Dialog
import resources

class InstallerPluginGui(QDialog, Ui_Dialog):
def __init__(self, parent, fl):
QDialog.__init__(self, parent, fl)

self.setupUi(self)

def on_buttonBrowse_released(self):
self.emit(SIGNAL("retrieveList(QString )"),"test" )
print "browse"

def on_pbnOK_released(self):
#self.hide()
self.emit(SIGNAL("installPlugin(QString )"), self.linePlugin.text() )
return
#self.done(1)

def on_pbnCancel_clicked(self):
self.close()
@@ -0,0 +1,65 @@
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'gui.ui'
#
# Created: Sun Oct 21 17:55:51 2007
# by: PyQt4 UI code generator 4.3
#
# WARNING! All changes made in this file will be lost!

from PyQt4 import QtCore, QtGui

class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(QtCore.QSize(QtCore.QRect(0,0,937,420).size()).expandedTo(Dialog.minimumSizeHint()))

self.label = QtGui.QLabel(Dialog)
self.label.setGeometry(QtCore.QRect(10,20,501,21))
self.label.setObjectName("label")

self.label_2 = QtGui.QLabel(Dialog)
self.label_2.setGeometry(QtCore.QRect(120,320,191,21))
self.label_2.setObjectName("label_2")

self.linePlugin = QtGui.QLineEdit(Dialog)
self.linePlugin.setGeometry(QtCore.QRect(290,320,281,25))
self.linePlugin.setObjectName("linePlugin")

self.buttonBrowse = QtGui.QPushButton(Dialog)
self.buttonBrowse.setGeometry(QtCore.QRect(830,10,83,28))
self.buttonBrowse.setObjectName("buttonBrowse")

self.pbnCancel = QtGui.QPushButton(Dialog)
self.pbnCancel.setGeometry(QtCore.QRect(830,370,83,28))
self.pbnCancel.setObjectName("pbnCancel")

self.pbnOK = QtGui.QPushButton(Dialog)
self.pbnOK.setGeometry(QtCore.QRect(590,320,83,28))
self.pbnOK.setObjectName("pbnOK")

self.label_3 = QtGui.QLabel(Dialog)
self.label_3.setGeometry(QtCore.QRect(120,360,501,21))
self.label_3.setObjectName("label_3")

self.treePlugins = QtGui.QTreeWidget(Dialog)
self.treePlugins.setGeometry(QtCore.QRect(10,50,911,251))
self.treePlugins.setItemsExpandable(False)
self.treePlugins.setObjectName("treePlugins")

self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)

def retranslateUi(self, Dialog):
Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "QGIS Plugin Installer", None, QtGui.QApplication.UnicodeUTF8))
self.label.setText(QtGui.QApplication.translate("Dialog", "Retrieve the list of available plugins, select one and install it", None, QtGui.QApplication.UnicodeUTF8))
self.label_2.setText(QtGui.QApplication.translate("Dialog", "Name of plugin to install", None, QtGui.QApplication.UnicodeUTF8))
self.buttonBrowse.setText(QtGui.QApplication.translate("Dialog", "Get List", None, QtGui.QApplication.UnicodeUTF8))
self.pbnCancel.setText(QtGui.QApplication.translate("Dialog", "Done", None, QtGui.QApplication.UnicodeUTF8))
self.pbnOK.setText(QtGui.QApplication.translate("Dialog", "Install Plugin", None, QtGui.QApplication.UnicodeUTF8))
self.label_3.setText(QtGui.QApplication.translate("Dialog", "The plugin will be installed to ~/.qgis/python/plugins", None, QtGui.QApplication.UnicodeUTF8))
self.treePlugins.headerItem().setText(0,QtGui.QApplication.translate("Dialog", "Name", None, QtGui.QApplication.UnicodeUTF8))
self.treePlugins.headerItem().setText(1,QtGui.QApplication.translate("Dialog", "Version", None, QtGui.QApplication.UnicodeUTF8))
self.treePlugins.headerItem().setText(2,QtGui.QApplication.translate("Dialog", "Description", None, QtGui.QApplication.UnicodeUTF8))
self.treePlugins.headerItem().setText(3,QtGui.QApplication.translate("Dialog", "Author", None, QtGui.QApplication.UnicodeUTF8))

@@ -0,0 +1,139 @@
<ui version="4.0" >
<class>Dialog</class>
<widget class="QDialog" name="Dialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>937</width>
<height>420</height>
</rect>
</property>
<property name="windowTitle" >
<string>QGIS Plugin Installer</string>
</property>
<widget class="QLabel" name="label" >
<property name="geometry" >
<rect>
<x>10</x>
<y>20</y>
<width>501</width>
<height>21</height>
</rect>
</property>
<property name="text" >
<string>Retrieve the list of available plugins, select one and install it</string>
</property>
</widget>
<widget class="QLabel" name="label_2" >
<property name="geometry" >
<rect>
<x>120</x>
<y>320</y>
<width>191</width>
<height>21</height>
</rect>
</property>
<property name="text" >
<string>Name of plugin to install</string>
</property>
</widget>
<widget class="QLineEdit" name="linePlugin" >
<property name="geometry" >
<rect>
<x>290</x>
<y>320</y>
<width>281</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="buttonBrowse" >
<property name="geometry" >
<rect>
<x>830</x>
<y>10</y>
<width>83</width>
<height>28</height>
</rect>
</property>
<property name="text" >
<string>Get List</string>
</property>
</widget>
<widget class="QPushButton" name="pbnCancel" >
<property name="geometry" >
<rect>
<x>830</x>
<y>370</y>
<width>83</width>
<height>28</height>
</rect>
</property>
<property name="text" >
<string>Done</string>
</property>
</widget>
<widget class="QPushButton" name="pbnOK" >
<property name="geometry" >
<rect>
<x>590</x>
<y>320</y>
<width>83</width>
<height>28</height>
</rect>
</property>
<property name="text" >
<string>Install Plugin</string>
</property>
</widget>
<widget class="QLabel" name="label_3" >
<property name="geometry" >
<rect>
<x>120</x>
<y>360</y>
<width>501</width>
<height>21</height>
</rect>
</property>
<property name="text" >
<string>The plugin will be installed to ~/.qgis/python/plugins</string>
</property>
</widget>
<widget class="QTreeWidget" name="treePlugins" >
<property name="geometry" >
<rect>
<x>10</x>
<y>50</y>
<width>911</width>
<height>251</height>
</rect>
</property>
<property name="itemsExpandable" >
<bool>false</bool>
</property>
<column>
<property name="text" >
<string>Name</string>
</property>
</column>
<column>
<property name="text" >
<string>Version</string>
</property>
</column>
<column>
<property name="text" >
<string>Description</string>
</property>
</column>
<column>
<property name="text" >
<string>Author</string>
</property>
</column>
</widget>
</widget>
<resources/>
<connections/>
</ui>

0 comments on commit acdc107

Please sign in to comment.
You can’t perform that action at this time.