SlideShare a Scribd company logo
1 of 15
Blinging QGIS plugins
(Introduction to PyQt)
By Matthew Walsh
Installing Qt Creator/Designer
• Creator is the full Qt IDE, we only need designer
(GUI Designer tools).
• OSGeo4W install of QGIS ships with its own Qt
Designer, Check “C:OSGeo4Wbindesigner.exe”.
• Download Qt Creator: Qt Creator 3.4.0 for Windows
(71 MB).
• Ubuntu/Linux: along the lines of: “sudo apt-get
install qt4-designer”.
• .exe on USB Sticks…
What is Qt?
• Qt is a cross platform Application framework.
• Developed by Nokia for the phone market
• Open source
• QGIS is built with Qt in C++.
• All user interface aspects of QGIS use Qt.
• i.e. Buttons, Menus, Attribute tables, Plugins!
PyQt
• Python bindings to Qt
• Allows us to write Python plugins for QGIS.
• PyQt + PyQGIS = QGIS plugin
• QGIS 2.8 uses PyQt4
• Moving to PyQt5/Python3 in the near future???
Why learn PyQt?
• Enhance the default plugin dialog created by
the ‘plugin builder’ plugin.
• Do more with your plugin.
Workshop covers…
• Install a plugin
• Modify user interface plugin.
• Compile to ‘.py’ with ‘pyuic4’ command line tool
• Connect a button.
• Populate our own table with attributes from
layer.
• Search layer based on attribute values
Install the plugin
• Download and unzip the plugin.
• Copy into location where QGIS searches for
plugins.
• Recommended:
“C:Usersmatthew.walsh.qgis2pythonplugins”
• Alternative:
“C:OSGeo4Wappsqgispythonplugins”
• Install ‘plugin reloader’ plugin.
Compiling at runtime
1. Open the ‘.ui’ file with Qt Creator/Designer.
2. Make a change. i.e. Move buttons or change
text of ‘windowTitle’ property.
3. Save changes (but don’t close Qt Creator).
4. Reload the plugin in QGIS using the ‘plugin
reloader’.
5. See the change in QGIS.
Precompile using pyuic4
• Pyuic4 – Command line interface to UIC (the
module we used in our code to compile at
runtime).
• Located in the QGIS ‘bin’ folder.
1. Make another visible change to the ‘.ui’ file
2. Compile with pyuic4.
3. View changes in QGIS.
Runtime vs Pre-compiled
• Compiling at runtime makes for easy
development with changes reflected quickly.
• Slower than pre-compiled (.ui file is read on
QGIS startup). Could be noticeably slow for
large projects.
• Pre-compiled allows you to see and change
the code. Useful for complex
custom/behaviour.
Edit the plugin ui
• Add LineEdit (input widgets) and change
objectName to ‘searchLineEdit’.
• Add button, change objectName to
‘searchPushButton’ and change display text on
the button.
• Add Table View and change objectName to
‘attributeTableView’.
• Add a label and remove display text and
change objectName to ‘searchLabel’.
Layouts and Spacers
1. Add some horizontal spacers to control the
relative position of the button and line edit.
2. Ensure the tableview sizePolicy is
‘Expanding’.
3. Right click on dlg > ‘Lay out’ > ‘Lay out in a
grid’.
4. Drag items around and change spacers until
you are happy with the layout.
• Multiple layouts can be added to one form.
Tableview Demo
• Uncomment code to populate the tableview
using the model/view based approach.
• Uncomment code to enable incremental
search/filter.
Links
• PyQt Docs
• Qt Docs
• PySlide Docs
• OSM Data from Mapzen
thinkWhere
Glendevon House
Castle Business Park
Stirling
FK9 4TZ
t: 01786 476060
f: 01786 476099
e: info@thinkwhere.com

More Related Content

What's hot

How we use Bitbucket to build Bitbucket
How we use Bitbucket to build BitbucketHow we use Bitbucket to build Bitbucket
How we use Bitbucket to build BitbucketShunsuke (Sean) Osawa
 
Building a dev pipeline using GitHub Actions, Node.js, and AWS ECS Fargate
Building a dev pipeline using GitHub Actions, Node.js, and AWS ECS FargateBuilding a dev pipeline using GitHub Actions, Node.js, and AWS ECS Fargate
Building a dev pipeline using GitHub Actions, Node.js, and AWS ECS Fargatedatree
 
Docker In 10 Minutes or 10 Slides
Docker In 10 Minutes or 10 SlidesDocker In 10 Minutes or 10 Slides
Docker In 10 Minutes or 10 SlidesMathias Renner
 
Git & GitHub
Git & GitHubGit & GitHub
Git & GitHubCuong Ngo
 
Introducing Ubuntu SDK
Introducing Ubuntu SDKIntroducing Ubuntu SDK
Introducing Ubuntu SDKShuduo Sang
 
Docker Barcelona Meetup - An Introduction to BuildKit
Docker Barcelona Meetup - An Introduction to BuildKitDocker Barcelona Meetup - An Introduction to BuildKit
Docker Barcelona Meetup - An Introduction to BuildKitArnaud Porterie
 
QtDD13 - Qt Creator plugins - Tobias Hunger
QtDD13 - Qt Creator plugins - Tobias Hunger QtDD13 - Qt Creator plugins - Tobias Hunger
QtDD13 - Qt Creator plugins - Tobias Hunger Robert-Emmanuel Mayssat
 
The State of CI/CD Tooling in 2019
The State of CI/CD Tooling in 2019The State of CI/CD Tooling in 2019
The State of CI/CD Tooling in 2019CloudOps2005
 
Using GIT for Everyone
Using GIT for EveryoneUsing GIT for Everyone
Using GIT for EveryoneGLC Networks
 
Running a Docker based Backend in the Cloud
Running a Docker based Backend in the CloudRunning a Docker based Backend in the Cloud
Running a Docker based Backend in the CloudFlorian Feigenbutz
 
Whats new in VSTS and TFS 2018 Build and release
Whats new in VSTS and TFS 2018 Build and releaseWhats new in VSTS and TFS 2018 Build and release
Whats new in VSTS and TFS 2018 Build and releaseJeff Przylucki
 
Introducing GitLab (June 2018)
Introducing GitLab (June 2018)Introducing GitLab (June 2018)
Introducing GitLab (June 2018)Noa Harel
 
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, TrivandrumIntroduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, TrivandrumAbhijitNarayan2
 

What's hot (20)

BitBucket presentation
BitBucket presentationBitBucket presentation
BitBucket presentation
 
Git with bitbucket
Git with bitbucketGit with bitbucket
Git with bitbucket
 
How we use Bitbucket to build Bitbucket
How we use Bitbucket to build BitbucketHow we use Bitbucket to build Bitbucket
How we use Bitbucket to build Bitbucket
 
1 git-overview
1 git-overview1 git-overview
1 git-overview
 
Git n git hub
Git n git hubGit n git hub
Git n git hub
 
Github
GithubGithub
Github
 
Building a dev pipeline using GitHub Actions, Node.js, and AWS ECS Fargate
Building a dev pipeline using GitHub Actions, Node.js, and AWS ECS FargateBuilding a dev pipeline using GitHub Actions, Node.js, and AWS ECS Fargate
Building a dev pipeline using GitHub Actions, Node.js, and AWS ECS Fargate
 
Docker In 10 Minutes or 10 Slides
Docker In 10 Minutes or 10 SlidesDocker In 10 Minutes or 10 Slides
Docker In 10 Minutes or 10 Slides
 
Git & GitHub
Git & GitHubGit & GitHub
Git & GitHub
 
Intro to Git, GitHub, and BitBucket
Intro to Git, GitHub, and BitBucketIntro to Git, GitHub, and BitBucket
Intro to Git, GitHub, and BitBucket
 
Introducing Ubuntu SDK
Introducing Ubuntu SDKIntroducing Ubuntu SDK
Introducing Ubuntu SDK
 
Docker Barcelona Meetup - An Introduction to BuildKit
Docker Barcelona Meetup - An Introduction to BuildKitDocker Barcelona Meetup - An Introduction to BuildKit
Docker Barcelona Meetup - An Introduction to BuildKit
 
QtDD13 - Qt Creator plugins - Tobias Hunger
QtDD13 - Qt Creator plugins - Tobias Hunger QtDD13 - Qt Creator plugins - Tobias Hunger
QtDD13 - Qt Creator plugins - Tobias Hunger
 
The State of CI/CD Tooling in 2019
The State of CI/CD Tooling in 2019The State of CI/CD Tooling in 2019
The State of CI/CD Tooling in 2019
 
Using GIT for Everyone
Using GIT for EveryoneUsing GIT for Everyone
Using GIT for Everyone
 
Running a Docker based Backend in the Cloud
Running a Docker based Backend in the CloudRunning a Docker based Backend in the Cloud
Running a Docker based Backend in the Cloud
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Whats new in VSTS and TFS 2018 Build and release
Whats new in VSTS and TFS 2018 Build and releaseWhats new in VSTS and TFS 2018 Build and release
Whats new in VSTS and TFS 2018 Build and release
 
Introducing GitLab (June 2018)
Introducing GitLab (June 2018)Introducing GitLab (June 2018)
Introducing GitLab (June 2018)
 
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, TrivandrumIntroduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
 

Similar to Matt Walsh thinkWhere_QGIS_usergroup_pyqt

Git extension-training
Git extension-trainingGit extension-training
Git extension-trainingEric Guo
 
Building and testing a desktop application written in Python
Building and testing a desktop application written in PythonBuilding and testing a desktop application written in Python
Building and testing a desktop application written in PythonNuxeo
 
Deploying Mule Applications with Jenkins, Azure and BitBucket (1).pptx
Deploying Mule Applications with Jenkins, Azure and BitBucket (1).pptxDeploying Mule Applications with Jenkins, Azure and BitBucket (1).pptx
Deploying Mule Applications with Jenkins, Azure and BitBucket (1).pptxPankaj Goyal
 
GitOps: Git come unica fonte di verità per applicazioni e infrastruttura
GitOps: Git come unica fonte di verità per applicazioni e infrastrutturaGitOps: Git come unica fonte di verità per applicazioni e infrastruttura
GitOps: Git come unica fonte di verità per applicazioni e infrastrutturasparkfabrik
 
Using Git to Organize Your Project
Using Git to Organize Your ProjectUsing Git to Organize Your Project
Using Git to Organize Your ProjectManish Suwal 'Enwil'
 
Beginner Workshop for Student Developers - Tratech-presentation.pdf
Beginner Workshop for Student Developers - Tratech-presentation.pdfBeginner Workshop for Student Developers - Tratech-presentation.pdf
Beginner Workshop for Student Developers - Tratech-presentation.pdfGDSCKNUST
 
habitat at docker bud
habitat at docker budhabitat at docker bud
habitat at docker budMandi Walls
 
Weave GitOps - continuous delivery for any Kubernetes
Weave GitOps - continuous delivery for any KubernetesWeave GitOps - continuous delivery for any Kubernetes
Weave GitOps - continuous delivery for any KubernetesWeaveworks
 
gitopsthekubernetesway-201026090439.pdf
gitopsthekubernetesway-201026090439.pdfgitopsthekubernetesway-201026090439.pdf
gitopsthekubernetesway-201026090439.pdfsaraichiba2
 
Gitops: the kubernetes way
Gitops: the kubernetes wayGitops: the kubernetes way
Gitops: the kubernetes waysparkfabrik
 
ePOM - Fundamentals of Research Software Development - Code Version Control
ePOM - Fundamentals of Research Software Development - Code Version ControlePOM - Fundamentals of Research Software Development - Code Version Control
ePOM - Fundamentals of Research Software Development - Code Version ControlGiuseppe Masetti
 
Davinci git brown_bag
Davinci git brown_bagDavinci git brown_bag
Davinci git brown_bagJason Noble
 
Continuous Integration with Cloud Foundry Concourse and Docker on OpenPOWER
Continuous Integration with Cloud Foundry Concourse and Docker on OpenPOWERContinuous Integration with Cloud Foundry Concourse and Docker on OpenPOWER
Continuous Integration with Cloud Foundry Concourse and Docker on OpenPOWERIndrajit Poddar
 
Continuous Integration using Jenkins with Python
Continuous Integration using Jenkins with PythonContinuous Integration using Jenkins with Python
Continuous Integration using Jenkins with PythonInexture Solutions
 
Intro to Git for Drupal 7
Intro to Git for Drupal 7Intro to Git for Drupal 7
Intro to Git for Drupal 7Chris Caple
 

Similar to Matt Walsh thinkWhere_QGIS_usergroup_pyqt (20)

Kivy report
Kivy reportKivy report
Kivy report
 
Git extension-training
Git extension-trainingGit extension-training
Git extension-training
 
Building and testing a desktop application written in Python
Building and testing a desktop application written in PythonBuilding and testing a desktop application written in Python
Building and testing a desktop application written in Python
 
Deploying Mule Applications with Jenkins, Azure and BitBucket (1).pptx
Deploying Mule Applications with Jenkins, Azure and BitBucket (1).pptxDeploying Mule Applications with Jenkins, Azure and BitBucket (1).pptx
Deploying Mule Applications with Jenkins, Azure and BitBucket (1).pptx
 
GitOps: Git come unica fonte di verità per applicazioni e infrastruttura
GitOps: Git come unica fonte di verità per applicazioni e infrastrutturaGitOps: Git come unica fonte di verità per applicazioni e infrastruttura
GitOps: Git come unica fonte di verità per applicazioni e infrastruttura
 
Using Git to Organize Your Project
Using Git to Organize Your ProjectUsing Git to Organize Your Project
Using Git to Organize Your Project
 
Beginner Workshop for Student Developers - Tratech-presentation.pdf
Beginner Workshop for Student Developers - Tratech-presentation.pdfBeginner Workshop for Student Developers - Tratech-presentation.pdf
Beginner Workshop for Student Developers - Tratech-presentation.pdf
 
CI/CD with Github Actions
CI/CD with Github ActionsCI/CD with Github Actions
CI/CD with Github Actions
 
habitat at docker bud
habitat at docker budhabitat at docker bud
habitat at docker bud
 
Building gRPC services
Building gRPC servicesBuilding gRPC services
Building gRPC services
 
Weave GitOps - continuous delivery for any Kubernetes
Weave GitOps - continuous delivery for any KubernetesWeave GitOps - continuous delivery for any Kubernetes
Weave GitOps - continuous delivery for any Kubernetes
 
gitopsthekubernetesway-201026090439.pdf
gitopsthekubernetesway-201026090439.pdfgitopsthekubernetesway-201026090439.pdf
gitopsthekubernetesway-201026090439.pdf
 
Gitops: the kubernetes way
Gitops: the kubernetes wayGitops: the kubernetes way
Gitops: the kubernetes way
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
Makefile+VersionControl
Makefile+VersionControlMakefile+VersionControl
Makefile+VersionControl
 
ePOM - Fundamentals of Research Software Development - Code Version Control
ePOM - Fundamentals of Research Software Development - Code Version ControlePOM - Fundamentals of Research Software Development - Code Version Control
ePOM - Fundamentals of Research Software Development - Code Version Control
 
Davinci git brown_bag
Davinci git brown_bagDavinci git brown_bag
Davinci git brown_bag
 
Continuous Integration with Cloud Foundry Concourse and Docker on OpenPOWER
Continuous Integration with Cloud Foundry Concourse and Docker on OpenPOWERContinuous Integration with Cloud Foundry Concourse and Docker on OpenPOWER
Continuous Integration with Cloud Foundry Concourse and Docker on OpenPOWER
 
Continuous Integration using Jenkins with Python
Continuous Integration using Jenkins with PythonContinuous Integration using Jenkins with Python
Continuous Integration using Jenkins with Python
 
Intro to Git for Drupal 7
Intro to Git for Drupal 7Intro to Git for Drupal 7
Intro to Git for Drupal 7
 

More from Ross McDonald

Visualising school catchment areas - FOSS4GUK 2018
Visualising school catchment areas - FOSS4GUK 2018Visualising school catchment areas - FOSS4GUK 2018
Visualising school catchment areas - FOSS4GUK 2018Ross McDonald
 
Using QGIS to create 3D indoor maps
Using QGIS to create 3D indoor mapsUsing QGIS to create 3D indoor maps
Using QGIS to create 3D indoor mapsRoss McDonald
 
Creating and indoor routable network with QGIS and pgRouting
Creating and indoor routable network with QGIS and pgRoutingCreating and indoor routable network with QGIS and pgRouting
Creating and indoor routable network with QGIS and pgRoutingRoss McDonald
 
Viewsheds and Advanced Calculations
Viewsheds and Advanced CalculationsViewsheds and Advanced Calculations
Viewsheds and Advanced CalculationsRoss McDonald
 
Using QGIS for ecological surveying
Using QGIS for ecological surveyingUsing QGIS for ecological surveying
Using QGIS for ecological surveyingRoss McDonald
 
Welcome to the 6th Scottish QGIS UK meeting
Welcome to the 6th Scottish QGIS UK meetingWelcome to the 6th Scottish QGIS UK meeting
Welcome to the 6th Scottish QGIS UK meetingRoss McDonald
 
How deep is your loch?
How deep is your loch?How deep is your loch?
How deep is your loch?Ross McDonald
 
Data capture with Leaflet and OpenStreetMap
Data capture with Leaflet and OpenStreetMapData capture with Leaflet and OpenStreetMap
Data capture with Leaflet and OpenStreetMapRoss McDonald
 
Them thar hills: shadin', texturin', blendin'
Them thar hills: shadin', texturin', blendin'Them thar hills: shadin', texturin', blendin'
Them thar hills: shadin', texturin', blendin'Ross McDonald
 
QGIS plugin for parallel processing in terrain analysis
QGIS plugin for parallel processing in terrain analysisQGIS plugin for parallel processing in terrain analysis
QGIS plugin for parallel processing in terrain analysisRoss McDonald
 
Mapping narrative: QGIS in the humanities classrom
Mapping narrative: QGIS in the humanities classromMapping narrative: QGIS in the humanities classrom
Mapping narrative: QGIS in the humanities classromRoss McDonald
 
QGIS server: the good, the not-so-good and the ugly
QGIS server: the good, the not-so-good and the uglyQGIS server: the good, the not-so-good and the ugly
QGIS server: the good, the not-so-good and the uglyRoss McDonald
 
QGIS UK Thank you for coming
QGIS UK Thank you for comingQGIS UK Thank you for coming
QGIS UK Thank you for comingRoss McDonald
 
Decision support tools for forestry using open source software
Decision support tools for forestry using open source softwareDecision support tools for forestry using open source software
Decision support tools for forestry using open source softwareRoss McDonald
 
Installing QGIS on a network
Installing QGIS on a networkInstalling QGIS on a network
Installing QGIS on a networkRoss McDonald
 
Pgrouting_foss4guk_ross_mcdonald
Pgrouting_foss4guk_ross_mcdonaldPgrouting_foss4guk_ross_mcdonald
Pgrouting_foss4guk_ross_mcdonaldRoss McDonald
 
Liam Mason QGIS Geoserver SLD
Liam Mason QGIS Geoserver SLDLiam Mason QGIS Geoserver SLD
Liam Mason QGIS Geoserver SLDRoss McDonald
 
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPythonPhil Bartie QGIS PLPython
Phil Bartie QGIS PLPythonRoss McDonald
 
John Stevenson Volcanoes and FOSS4G Edinburgh
John Stevenson Volcanoes and FOSS4G EdinburghJohn Stevenson Volcanoes and FOSS4G Edinburgh
John Stevenson Volcanoes and FOSS4G EdinburghRoss McDonald
 
Roger Garbett - QGIS Print Composer
Roger Garbett - QGIS Print ComposerRoger Garbett - QGIS Print Composer
Roger Garbett - QGIS Print ComposerRoss McDonald
 

More from Ross McDonald (20)

Visualising school catchment areas - FOSS4GUK 2018
Visualising school catchment areas - FOSS4GUK 2018Visualising school catchment areas - FOSS4GUK 2018
Visualising school catchment areas - FOSS4GUK 2018
 
Using QGIS to create 3D indoor maps
Using QGIS to create 3D indoor mapsUsing QGIS to create 3D indoor maps
Using QGIS to create 3D indoor maps
 
Creating and indoor routable network with QGIS and pgRouting
Creating and indoor routable network with QGIS and pgRoutingCreating and indoor routable network with QGIS and pgRouting
Creating and indoor routable network with QGIS and pgRouting
 
Viewsheds and Advanced Calculations
Viewsheds and Advanced CalculationsViewsheds and Advanced Calculations
Viewsheds and Advanced Calculations
 
Using QGIS for ecological surveying
Using QGIS for ecological surveyingUsing QGIS for ecological surveying
Using QGIS for ecological surveying
 
Welcome to the 6th Scottish QGIS UK meeting
Welcome to the 6th Scottish QGIS UK meetingWelcome to the 6th Scottish QGIS UK meeting
Welcome to the 6th Scottish QGIS UK meeting
 
How deep is your loch?
How deep is your loch?How deep is your loch?
How deep is your loch?
 
Data capture with Leaflet and OpenStreetMap
Data capture with Leaflet and OpenStreetMapData capture with Leaflet and OpenStreetMap
Data capture with Leaflet and OpenStreetMap
 
Them thar hills: shadin', texturin', blendin'
Them thar hills: shadin', texturin', blendin'Them thar hills: shadin', texturin', blendin'
Them thar hills: shadin', texturin', blendin'
 
QGIS plugin for parallel processing in terrain analysis
QGIS plugin for parallel processing in terrain analysisQGIS plugin for parallel processing in terrain analysis
QGIS plugin for parallel processing in terrain analysis
 
Mapping narrative: QGIS in the humanities classrom
Mapping narrative: QGIS in the humanities classromMapping narrative: QGIS in the humanities classrom
Mapping narrative: QGIS in the humanities classrom
 
QGIS server: the good, the not-so-good and the ugly
QGIS server: the good, the not-so-good and the uglyQGIS server: the good, the not-so-good and the ugly
QGIS server: the good, the not-so-good and the ugly
 
QGIS UK Thank you for coming
QGIS UK Thank you for comingQGIS UK Thank you for coming
QGIS UK Thank you for coming
 
Decision support tools for forestry using open source software
Decision support tools for forestry using open source softwareDecision support tools for forestry using open source software
Decision support tools for forestry using open source software
 
Installing QGIS on a network
Installing QGIS on a networkInstalling QGIS on a network
Installing QGIS on a network
 
Pgrouting_foss4guk_ross_mcdonald
Pgrouting_foss4guk_ross_mcdonaldPgrouting_foss4guk_ross_mcdonald
Pgrouting_foss4guk_ross_mcdonald
 
Liam Mason QGIS Geoserver SLD
Liam Mason QGIS Geoserver SLDLiam Mason QGIS Geoserver SLD
Liam Mason QGIS Geoserver SLD
 
Phil Bartie QGIS PLPython
Phil Bartie QGIS PLPythonPhil Bartie QGIS PLPython
Phil Bartie QGIS PLPython
 
John Stevenson Volcanoes and FOSS4G Edinburgh
John Stevenson Volcanoes and FOSS4G EdinburghJohn Stevenson Volcanoes and FOSS4G Edinburgh
John Stevenson Volcanoes and FOSS4G Edinburgh
 
Roger Garbett - QGIS Print Composer
Roger Garbett - QGIS Print ComposerRoger Garbett - QGIS Print Composer
Roger Garbett - QGIS Print Composer
 

Recently uploaded

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 

Recently uploaded (20)

E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 

Matt Walsh thinkWhere_QGIS_usergroup_pyqt

  • 1. Blinging QGIS plugins (Introduction to PyQt) By Matthew Walsh
  • 2. Installing Qt Creator/Designer • Creator is the full Qt IDE, we only need designer (GUI Designer tools). • OSGeo4W install of QGIS ships with its own Qt Designer, Check “C:OSGeo4Wbindesigner.exe”. • Download Qt Creator: Qt Creator 3.4.0 for Windows (71 MB). • Ubuntu/Linux: along the lines of: “sudo apt-get install qt4-designer”. • .exe on USB Sticks…
  • 3. What is Qt? • Qt is a cross platform Application framework. • Developed by Nokia for the phone market • Open source • QGIS is built with Qt in C++. • All user interface aspects of QGIS use Qt. • i.e. Buttons, Menus, Attribute tables, Plugins!
  • 4. PyQt • Python bindings to Qt • Allows us to write Python plugins for QGIS. • PyQt + PyQGIS = QGIS plugin • QGIS 2.8 uses PyQt4 • Moving to PyQt5/Python3 in the near future???
  • 5. Why learn PyQt? • Enhance the default plugin dialog created by the ‘plugin builder’ plugin. • Do more with your plugin.
  • 6. Workshop covers… • Install a plugin • Modify user interface plugin. • Compile to ‘.py’ with ‘pyuic4’ command line tool • Connect a button. • Populate our own table with attributes from layer. • Search layer based on attribute values
  • 7. Install the plugin • Download and unzip the plugin. • Copy into location where QGIS searches for plugins. • Recommended: “C:Usersmatthew.walsh.qgis2pythonplugins” • Alternative: “C:OSGeo4Wappsqgispythonplugins” • Install ‘plugin reloader’ plugin.
  • 8. Compiling at runtime 1. Open the ‘.ui’ file with Qt Creator/Designer. 2. Make a change. i.e. Move buttons or change text of ‘windowTitle’ property. 3. Save changes (but don’t close Qt Creator). 4. Reload the plugin in QGIS using the ‘plugin reloader’. 5. See the change in QGIS.
  • 9. Precompile using pyuic4 • Pyuic4 – Command line interface to UIC (the module we used in our code to compile at runtime). • Located in the QGIS ‘bin’ folder. 1. Make another visible change to the ‘.ui’ file 2. Compile with pyuic4. 3. View changes in QGIS.
  • 10. Runtime vs Pre-compiled • Compiling at runtime makes for easy development with changes reflected quickly. • Slower than pre-compiled (.ui file is read on QGIS startup). Could be noticeably slow for large projects. • Pre-compiled allows you to see and change the code. Useful for complex custom/behaviour.
  • 11. Edit the plugin ui • Add LineEdit (input widgets) and change objectName to ‘searchLineEdit’. • Add button, change objectName to ‘searchPushButton’ and change display text on the button. • Add Table View and change objectName to ‘attributeTableView’. • Add a label and remove display text and change objectName to ‘searchLabel’.
  • 12. Layouts and Spacers 1. Add some horizontal spacers to control the relative position of the button and line edit. 2. Ensure the tableview sizePolicy is ‘Expanding’. 3. Right click on dlg > ‘Lay out’ > ‘Lay out in a grid’. 4. Drag items around and change spacers until you are happy with the layout. • Multiple layouts can be added to one form.
  • 13. Tableview Demo • Uncomment code to populate the tableview using the model/view based approach. • Uncomment code to enable incremental search/filter.
  • 14. Links • PyQt Docs • Qt Docs • PySlide Docs • OSM Data from Mapzen
  • 15. thinkWhere Glendevon House Castle Business Park Stirling FK9 4TZ t: 01786 476060 f: 01786 476099 e: info@thinkwhere.com

Editor's Notes

  1. Pre-requisites are QGIS, Text Editor/Python IDE (pycharm/Pyscripter)
  2. Qt or ‘Cute’ Purchased by Nokia from Trolltec in 2009 Building blocks of the QGIS GUI
  3. Currently Qt4 could soon be Qt5 which is Python 3, maybe at QGIS 3?
  4. Demo default dialog in QGIS. Do more with plugins, e.g. multiple dialogs, tables, etc
  5. If in ‘users’ folder then all versions/instances of QGIS will pickup plugin. Also different location for standalone install. DEMO installing the plugin Check everyone's plugin is working
  6. Explain compiling Explain/demo code
  7. Demo – Look at compiled py file with definition of dialog.
  8. Generally recommend runtime compiling as this is just more practical for development Could compile to when going to production