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;








4















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:



enter image description here



... 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?










share|improve this question



















  • 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







  • 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

















4















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:



enter image description here



... 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?










share|improve this question



















  • 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







  • 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













4












4








4


1






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:



enter image description here



... 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?










share|improve this question














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:



enter image description here



... 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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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 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





    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





    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





    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










1 Answer
1






active

oldest

votes


















4
















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)


enter image description here






share|improve this answer



























    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
    );



    );














    draft saved

    draft discarded
















    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









    4
















    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)


    enter image description here






    share|improve this answer





























      4
















      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)


      enter image description here






      share|improve this answer



























        4














        4










        4









        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)


        enter image description here






        share|improve this answer













        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)


        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        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































            draft saved

            draft discarded















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Tamil (spriik) Luke uk diar | Nawigatjuun

            Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

            Training a classifier when some of the features are unknownWhy does Gradient Boosting regression predict negative values when there are no negative y-values in my training set?How to improve an existing (trained) classifier?What is effect when I set up some self defined predisctor variables?Why Matlab neural network classification returns decimal values on prediction dataset?Fitting and transforming text data in training, testing, and validation setsHow to quantify the performance of the classifier (multi-class SVM) using the test data?How do I control for some patients providing multiple samples in my training data?Training and Test setTraining a convolutional neural network for image denoising in MatlabShouldn't an autoencoder with #(neurons in hidden layer) = #(neurons in input layer) be “perfect”?