Add Help Menu entry in QGIS 3 from `startup.py`QGIS 3 startup script is not executedQGIS 3.6 startup.py not executedQGIS “Raster->Georeference” menu item not showing upQGIS 3.0 (from OSGeo4W Installer) unusable on HiRes Displays?Finding help for QGIS 3.0?Writing pyQGIS 3 script to modify layer (add field and feel it) inside QGIS?How to add a rownumber in QGIS 3 using PythonHow to add an existing QGSVectorLayer to QGIS project?Reading default qgis-auth.db from a script
Planar regular languages
Can a character with good/neutral alignment attune to a sentient magic item with evil alignment?
Bash awk command with quotes
How would you control supersoldiers in a late iron-age society?
Can a business put whatever they want into a contract?
Calculate the limit without l'Hopital rule
Python web-scraper to download table of transistor counts from Wikipedia
hyperref warns when using cleveref in section
How clean are pets?
What 68-pin connector is this on my 2.5" solid state drive?
What is the source of "You can achieve a lot with hate, but even more with love" (Shakespeare?)
How to make classical firearms effective on space habitats despite the coriolis effect?
Does the deductible apply to each doctor's visit separately or are the costs cumulative over the year?
Make 2019 with single digits
Meaning of Swimming their horses
Pronunciation of "солнце"
Are there any “Third Order” acronyms used in space exploration?
2000s space film where an alien species has almost wiped out the human race in a war
Statistical tests for benchmark comparison
Is there any reason to concentrate on the Thunderous Smite spell after using its effects?
A command to output each line forward then backwards
Can I travel to European countries with the Irish passport and without destination Visa?
Finding partition with maximum number of edges between sets
Can derivatives be defined as anti-integrals?
Add Help Menu entry in QGIS 3 from `startup.py`
QGIS 3 startup script is not executedQGIS 3.6 startup.py not executedQGIS “Raster->Georeference” menu item not showing upQGIS 3.0 (from OSGeo4W Installer) unusable on HiRes Displays?Finding help for QGIS 3.0?Writing pyQGIS 3 script to modify layer (add field and feel it) inside QGIS?How to add a rownumber in QGIS 3 using PythonHow to add an existing QGSVectorLayer to QGIS project?Reading default qgis-auth.db from a script
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I would like to add a menu entry in the Help menu pointing to some web ressource, say https://gis.stackexchange.com. The following code executed from the python console works perfect:
from qgis.utils import iface
import webbrowser
def open_gis_se():
webbrowser.open('https://gis.stackexchange.com')
iface.helpMenu().addSeparator()
gis_se_action = QAction('Go to gis.stackexchange')
iface.helpMenu().addAction(gis_se_action)
gis_se_action.triggered.connect(open_gis_se)
Result when typed in the python console:
... but putting it into my startup.py
has no effect (Help menu remains 'as it is').
In QGIS 2, the above code put in the startup.py
adds the desired menu entry as expected.
Why?
qgis-3 pyqgis-3 gui
add a comment
|
I would like to add a menu entry in the Help menu pointing to some web ressource, say https://gis.stackexchange.com. The following code executed from the python console works perfect:
from qgis.utils import iface
import webbrowser
def open_gis_se():
webbrowser.open('https://gis.stackexchange.com')
iface.helpMenu().addSeparator()
gis_se_action = QAction('Go to gis.stackexchange')
iface.helpMenu().addAction(gis_se_action)
gis_se_action.triggered.connect(open_gis_se)
Result when typed in the python console:
... but putting it into my startup.py
has no effect (Help menu remains 'as it is').
In QGIS 2, the above code put in the startup.py
adds the desired menu entry as expected.
Why?
qgis-3 pyqgis-3 gui
2
Where did you place the startup.py file? It should be placed inC:UsersusernameAppDataRoamingQGISQGIS3
as described in this post. Your code should have produced an error aboutQAction
not being defined which can be rectified by addingfrom PyQt5.QtWidgets import QAction
.
– Joseph
Apr 15 at 10:17
1
Ooops!I had not seen your comment @joseph,sorry
– Fran Raga
Apr 15 at 10:34
1
@FranRaga - Don't be! I had a feeling the problem OP had was similar to mine so glad you answered this one too :)
– Joseph
Apr 15 at 10:36
add a comment
|
I would like to add a menu entry in the Help menu pointing to some web ressource, say https://gis.stackexchange.com. The following code executed from the python console works perfect:
from qgis.utils import iface
import webbrowser
def open_gis_se():
webbrowser.open('https://gis.stackexchange.com')
iface.helpMenu().addSeparator()
gis_se_action = QAction('Go to gis.stackexchange')
iface.helpMenu().addAction(gis_se_action)
gis_se_action.triggered.connect(open_gis_se)
Result when typed in the python console:
... but putting it into my startup.py
has no effect (Help menu remains 'as it is').
In QGIS 2, the above code put in the startup.py
adds the desired menu entry as expected.
Why?
qgis-3 pyqgis-3 gui
I would like to add a menu entry in the Help menu pointing to some web ressource, say https://gis.stackexchange.com. The following code executed from the python console works perfect:
from qgis.utils import iface
import webbrowser
def open_gis_se():
webbrowser.open('https://gis.stackexchange.com')
iface.helpMenu().addSeparator()
gis_se_action = QAction('Go to gis.stackexchange')
iface.helpMenu().addAction(gis_se_action)
gis_se_action.triggered.connect(open_gis_se)
Result when typed in the python console:
... but putting it into my startup.py
has no effect (Help menu remains 'as it is').
In QGIS 2, the above code put in the startup.py
adds the desired menu entry as expected.
Why?
qgis-3 pyqgis-3 gui
qgis-3 pyqgis-3 gui
asked Apr 15 at 10:09
Jochen SchwarzeJochen Schwarze
7,0605 gold badges22 silver badges67 bronze badges
7,0605 gold badges22 silver badges67 bronze badges
2
Where did you place the startup.py file? It should be placed inC:UsersusernameAppDataRoamingQGISQGIS3
as described in this post. Your code should have produced an error aboutQAction
not being defined which can be rectified by addingfrom PyQt5.QtWidgets import QAction
.
– Joseph
Apr 15 at 10:17
1
Ooops!I had not seen your comment @joseph,sorry
– Fran Raga
Apr 15 at 10:34
1
@FranRaga - Don't be! I had a feeling the problem OP had was similar to mine so glad you answered this one too :)
– Joseph
Apr 15 at 10:36
add a comment
|
2
Where did you place the startup.py file? It should be placed inC:UsersusernameAppDataRoamingQGISQGIS3
as described in this post. Your code should have produced an error aboutQAction
not being defined which can be rectified by addingfrom PyQt5.QtWidgets import QAction
.
– Joseph
Apr 15 at 10:17
1
Ooops!I had not seen your comment @joseph,sorry
– Fran Raga
Apr 15 at 10:34
1
@FranRaga - Don't be! I had a feeling the problem OP had was similar to mine so glad you answered this one too :)
– Joseph
Apr 15 at 10:36
2
2
Where did you place the startup.py file? It should be placed in
C:UsersusernameAppDataRoamingQGISQGIS3
as described in this post. Your code should have produced an error about QAction
not being defined which can be rectified by adding from PyQt5.QtWidgets import QAction
.– Joseph
Apr 15 at 10:17
Where did you place the startup.py file? It should be placed in
C:UsersusernameAppDataRoamingQGISQGIS3
as described in this post. Your code should have produced an error about QAction
not being defined which can be rectified by adding from PyQt5.QtWidgets import QAction
.– Joseph
Apr 15 at 10:17
1
1
Ooops!I had not seen your comment @joseph,sorry
– Fran Raga
Apr 15 at 10:34
Ooops!I had not seen your comment @joseph,sorry
– Fran Raga
Apr 15 at 10:34
1
1
@FranRaga - Don't be! I had a feeling the problem OP had was similar to mine so glad you answered this one too :)
– Joseph
Apr 15 at 10:36
@FranRaga - Don't be! I had a feeling the problem OP had was similar to mine so glad you answered this one too :)
– Joseph
Apr 15 at 10:36
add a comment
|
1 Answer
1
active
oldest
votes
Great idea
you need place startup.py in C:Users<username>AppDataRoamingQGISQGIS3
and add missing import ,and voilá
from qgis.utils import iface
from PyQt5.QtWidgets import QAction
import webbrowser
def open_gis_se():
webbrowser.open('https://gis.stackexchange.com')
iface.helpMenu().addSeparator()
gis_se_action = QAction('Go to gis.stackexchange')
iface.helpMenu().addAction(gis_se_action)
gis_se_action.triggered.connect(open_gis_se)
add a comment
|
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "79"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f318816%2fadd-help-menu-entry-in-qgis-3-from-startup-py%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Great idea
you need place startup.py in C:Users<username>AppDataRoamingQGISQGIS3
and add missing import ,and voilá
from qgis.utils import iface
from PyQt5.QtWidgets import QAction
import webbrowser
def open_gis_se():
webbrowser.open('https://gis.stackexchange.com')
iface.helpMenu().addSeparator()
gis_se_action = QAction('Go to gis.stackexchange')
iface.helpMenu().addAction(gis_se_action)
gis_se_action.triggered.connect(open_gis_se)
add a comment
|
Great idea
you need place startup.py in C:Users<username>AppDataRoamingQGISQGIS3
and add missing import ,and voilá
from qgis.utils import iface
from PyQt5.QtWidgets import QAction
import webbrowser
def open_gis_se():
webbrowser.open('https://gis.stackexchange.com')
iface.helpMenu().addSeparator()
gis_se_action = QAction('Go to gis.stackexchange')
iface.helpMenu().addAction(gis_se_action)
gis_se_action.triggered.connect(open_gis_se)
add a comment
|
Great idea
you need place startup.py in C:Users<username>AppDataRoamingQGISQGIS3
and add missing import ,and voilá
from qgis.utils import iface
from PyQt5.QtWidgets import QAction
import webbrowser
def open_gis_se():
webbrowser.open('https://gis.stackexchange.com')
iface.helpMenu().addSeparator()
gis_se_action = QAction('Go to gis.stackexchange')
iface.helpMenu().addAction(gis_se_action)
gis_se_action.triggered.connect(open_gis_se)
Great idea
you need place startup.py in C:Users<username>AppDataRoamingQGISQGIS3
and add missing import ,and voilá
from qgis.utils import iface
from PyQt5.QtWidgets import QAction
import webbrowser
def open_gis_se():
webbrowser.open('https://gis.stackexchange.com')
iface.helpMenu().addSeparator()
gis_se_action = QAction('Go to gis.stackexchange')
iface.helpMenu().addAction(gis_se_action)
gis_se_action.triggered.connect(open_gis_se)
answered Apr 15 at 10:20
Fran RagaFran Raga
5,0763 gold badges14 silver badges27 bronze badges
5,0763 gold badges14 silver badges27 bronze badges
add a comment
|
add a comment
|
Thanks for contributing an answer to Geographic Information Systems Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f318816%2fadd-help-menu-entry-in-qgis-3-from-startup-py%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
Where did you place the startup.py file? It should be placed in
C:UsersusernameAppDataRoamingQGISQGIS3
as described in this post. Your code should have produced an error aboutQAction
not being defined which can be rectified by addingfrom PyQt5.QtWidgets import QAction
.– Joseph
Apr 15 at 10:17
1
Ooops!I had not seen your comment @joseph,sorry
– Fran Raga
Apr 15 at 10:34
1
@FranRaga - Don't be! I had a feeling the problem OP had was similar to mine so glad you answered this one too :)
– Joseph
Apr 15 at 10:36