BergWerkGIS / QGIS-CKAN-Browser

Download and display Open Data from CKAN Metadata Servers
MIT License
34 stars 14 forks source link

Inconsistent missing EDIT button on Authentication Settings #29

Open larka2006 opened 3 years ago

larka2006 commented 3 years ago

Environment

PlugIn version: 0.4.0

PlugIn installed from:

OS:

Expected behavior

after installation of CKAN-Browser in QGIS 3.16.(1-6) In settings there should be an Edit button to setup Authentication Settings.

Actual behavior

works as intended on corporate Mac, personal Windows, but not on corporate (same account as mac with Azure Ad auth) after multiple installs/reinstalls - the Edit and Clear buttons are missing.

Steps to reproduce the behavior

?

wilhelmberg commented 3 years ago

@larka2006 as far as I can tell this behavior is expected.

There is code that hides those buttons on purpose:

https://github.com/BergWerkGIS/QGIS-CKAN-Browser/blob/2ff80291eee9cf2ee7ea5dfec4c60f62703bbae6/CKAN-Browser/ckan_browser_dialog_settings.py#L33-L36

https://github.com/BergWerkGIS/QGIS-CKAN-Browser/blob/2ff80291eee9cf2ee7ea5dfec4c60f62703bbae6/CKAN-Browser/ckan_browser_dialog_settings.py#L61-L66

However, I cannot reproduce as I don't have access to a service that needs authentication and I'm not familiar with the associated QgsAuthConfigSelect widget and why it could fail to import.

At least I couldn't any hints in the docs (https://qgis.org/pyqgis/3.16/gui/QgsAuthConfigSelect.html).

Furthermore, the Authentication Settings option was a contribution by @elpaso.

@elpaso any ideas why QgsAuthConfigSelect is not available on @larka2006's corporate Windows machine?

elpaso commented 3 years ago

Sorry, no idea. The QGIS API has not changed. Also, I am not involved in that development anymore.

wilhelmberg commented 3 years ago

@elpaso thanks for your speedy response.


@larka2006 it seems that somehow your machine does not fulfill the requirements to use the QgsAuthConfigSelect widget.

Why this is the case I cannot tell.

But other plugins using QgsAuthConfigSelect implement it based on its availability as well: https://github.com/norBIT/alkisplugin/blob/c96912c9eca7fe789f7ce02df5b07305f16ef64b/qgisclasses.py#L91

larka2006 commented 3 years ago

@BergWerkGIS and @elpaso thank you very much for the explanations, I will dig deeper into this issue, your links give me the starting points! Much appreciated!

larka2006 commented 3 years ago

@BergWerkGIS sorry to bother you again, but how can I create a new CKANBrowser plugin (zip file) from this repo? I was thinking of just comment out those lines

 self.IDC_bAuthCfgClear.hide() 
     self.IDC_bAuthCfgEdit.hide() 

and create a new version to test on my Windows (I started to do that on Mac OS, but could not succeed even with original code) - last step

wilhelmberg commented 3 years ago

@larka2006 I've created a version for you with the QgsAuthConfigSelect check removed: https://www.dropbox.com/s/lfp8azabfewj5oo/CKANBrowser.zip?dl=1

However, I think it's not likely it will work properly.

As mentioned above the buttons are hidden, because the plugin cannot import the QgsAuthConfigSelect widget:

https://github.com/BergWerkGIS/QGIS-CKAN-Browser/blob/2ff80291eee9cf2ee7ea5dfec4c60f62703bbae6/CKAN-Browser/ckan_browser_dialog_settings.py#L33-L36

I suppose you'll get an ImportError exception as soon as you try to open the settings dialog.

larka2006 commented 3 years ago

@BergWerkGIS thank you for creating this version! As you said, it did not work, still not showing buttons, there are no ImportError messages. I am trying to figure out how to make QgsAuthConfigSelect widget to assume correct identity on our corp environment.

wilhelmberg commented 3 years ago

@larka2006 please double check that you've installed the version from this link: https://www.dropbox.com/s/lfp8azabfewj5oo/CKANBrowser.zip?dl=1

As you can see here, I've completely removed the code that hides the buttons, they should be there: https://github.com/BergWerkGIS/QGIS-CKAN-Browser/compare/no-authconfig-select-check


  • make deploy returns:
    pyrcc5 -o resources_rc.py  resources.qrc
    make: pyrcc5: No such file or directory
    make: *** [resources_rc.py] Error 1

This means the resources cannot be compiled because pyrcc5 is not installed.

If you want to dive into debugging yourself please consult some tutorials about plugin development as this is out of the scope of this ticket. eg https://docs.qgis.org/3.16/en/docs/pyqgis_developer_cookbook/plugins/index.html#developing-python-plugins https://www.qgistutorials.com/en/docs/3/building_a_python_plugin.html

You could also look at these place to find out if there are any suspicious error messages which might hint why it doesn't work yon your machine:

larka2006 commented 3 years ago

@BergWerkGIS Thank you so much for the details and links to tutorials. I am studying them. I double-checked - reinstalled CKANBrowser plugin again and enabled log messages. Still no buttons, but here is the full Warning message. Something about PyQt5. checking on it...


2021-05-10T14:31:15     WARNING    warning:C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages\PyQt5\uic\objcreator.py:152: DeprecationWarning: 'U' mode is deprecated
              plugin = open(filename, 'rU')

             traceback: File "", line 1, in 
              File "C:/PROGRA~1/QGIS3~1.16/apps/qgis-ltr/./python\pyplugin_installer\installer.py", line 276, in showPluginManagerWhenReady
              iface.pluginManagerInterface().showPluginManager(tabIndex)
              File "", line 1, in 
              File "C:/PROGRA~1/QGIS3~1.16/apps/qgis-ltr/./python\pyplugin_installer\installer.py", line 655, in installFromZipFile
              startPlugin(pluginName)
              File "C:/PROGRA~1/QGIS3~1.16/apps/qgis-ltr/./python\qgis\utils.py", line 354, in startPlugin
              if not _startPlugin(packageName):
              File "C:/PROGRA~1/QGIS3~1.16/apps/qgis-ltr/./python\qgis\utils.py", line 334, in _startPlugin
              plugins[packageName] = package.classFactory(iface)
              File "C:/Users/ekzuf/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\CKANBrowser\__init__.py", line 33, in classFactory
              from .ckan_browser import CKANBrowser
              File "C:/PROGRA~1/QGIS3~1.16/apps/qgis-ltr/./python\qgis\utils.py", line 793, in _import
              mod = _builtin_import(name, globals, locals, fromlist, level)
              File "", line 983, in _find_and_load
              File "", line 967, in _find_and_load_unlocked
              File "", line 677, in _load_unlocked
              File "", line 728, in exec_module
              File "", line 219, in _call_with_frames_removed
              File "C:/Users/ekzuf/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\CKANBrowser\ckan_browser.py", line 27, in 
              from .ckan_browser_dialog import CKANBrowserDialog
              File "C:/PROGRA~1/QGIS3~1.16/apps/qgis-ltr/./python\qgis\utils.py", line 793, in _import
              mod = _builtin_import(name, globals, locals, fromlist, level)
              File "", line 983, in _find_and_load
              File "", line 967, in _find_and_load_unlocked
              File "", line 677, in _load_unlocked
              File "", line 728, in exec_module
              File "", line 219, in _call_with_frames_removed
              File "C:/Users/ekzuf/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\CKANBrowser\ckan_browser_dialog.py", line 30, in 
              from .ckan_browser_dialog_disclaimer import CKANBrowserDialogDisclaimer
              File "C:/PROGRA~1/QGIS3~1.16/apps/qgis-ltr/./python\qgis\utils.py", line 793, in _import
              mod = _builtin_import(name, globals, locals, fromlist, level)
              File "", line 983, in _find_and_load
              File "", line 967, in _find_and_load_unlocked
              File "", line 677, in _load_unlocked
              File "", line 728, in exec_module
              File "", line 219, in _call_with_frames_removed
              File "C:/Users/ekzuf/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\CKANBrowser\ckan_browser_dialog_disclaimer.py", line 33, in 
              'ckan_browser_dialog_disclaimer.ui'
              File "C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages\PyQt5\uic\__init__.py", line 198, in loadUiType
              winfo = compiler.UICompiler().compileUi(uifile, code_string, from_imports, resource_suffix, import_from)
              File "C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages\PyQt5\uic\Compiler\compiler.py", line 53, in __init__
              qtproxies.QtWidgets, CompilerCreatorPolicy())
              File "C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages\PyQt5\uic\uiparser.py", line 177, in __init__
              self.factory = QObjectCreator(creatorPolicy)
              File "C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages\PyQt5\uic\objcreator.py", line 85, in __init__
              if self.load_plugin(filename, plugin_globals, plugin_locals):
              File "C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages\PyQt5\uic\objcreator.py", line 152, in load_plugin
              plugin = open(filename, 'rU')