Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FilterParam should monitor the dbstate database-changed signal #39

Open
emyoulation opened this issue Aug 21, 2024 · 7 comments
Open

FilterParam should monitor the dbstate database-changed signal #39

emyoulation opened this issue Aug 21, 2024 · 7 comments
Assignees
Labels
bug Something isn't working FilterParams

Comments

@emyoulation
Copy link

When a different database is loaded after the FilterParams dialog is spawned, then changing ID type parameters with any of the Select Object dialogs causes an "sqlite3.ProgrammingError: Cannot operate on a closed database" error. FilterParams only sees the database was closed, not that a new one was loaded.

database-changed
https://www.gramps-project.org/wiki/index.php/Signals_and_Callbacks#Db_signals
https://gramps-project.org/docs/gen/gen_utils.html#module-gramps.gen.utils.callback

For full error report, see:
https://gramps.discourse.group/t/add-a-recent-sub-menu/5760/23

@kkujansuu
Copy link
Owner

Fixed by closing the FilterParam window if the database is changed. The tool uses code from gramps.gui.editors.filtereditor that can't handle a database change - so the only solution is to close the tool.

@kkujansuu kkujansuu self-assigned this Aug 23, 2024
@kkujansuu kkujansuu added FilterParams bug Something isn't working labels Aug 23, 2024
@kkujansuu
Copy link
Owner

The above fix seems to work except that now there is the console message:

Tried to close a ManagedWindow more than once.

@emyoulation
Copy link
Author

emyoulation commented Aug 23, 2024

Could you updated the FilterParams.gpr.py file?

This is the one I'm trying to use. (Not sure if the from gramps.gui import plug is needed.)

#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2021-2024      Gramps developers, Kari Kujansuu
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#

"""
Gramps registration file
"""
from gramps.gui import plug
from gramps.version import major_version, VERSION_TUPLE

plug.tool.tool_categories["Isotammi"] = ("Isotammi", _("Isotammi tools"))

#------------------------------------------------------------------------
#
# FilterParams
#
# See https://github.com/kkujansuu/gramps/edit/master/addons/FilterParams/
#
#------------------------------------------------------------------------

help_url = "Addon:Isotammi_addons#FilterParams_tool"

if VERSION_TUPLE < (5, 2, 0):
    additional_args = {}
else:
    additional_args = {
        "audience": EXPERT,
        "help_url": help_url,
    }

register(
    TOOL,
    id="FilterParams",
    name=_("FilterParams"),
    description=_("Display custom filters and allow changing their parameters"),
    version="1.1.7",
    gramps_target_version=major_version,
    status=STABLE,
    fname="FilterParams.py",
    authors=["Kari Kujansuu"],
    category="Isotammi",
    toolclass="Tool",
    optionclass="Options",
    tool_modes=[TOOL_MODE_GUI],
    **additional_args,
)

@kkujansuu
Copy link
Owner

kkujansuu commented Aug 24, 2024 via email

@emyoulation
Copy link
Author

Non-gramplet help_url pass-through to Help buttons seems a bit flakey. It seems to work better from the addons.json than from the .gpr.py files for manually installed addons. Gramps still needs some refining there. I have been unable to communicate (or test) the problems with supporting the Help/Wiki buttons when Weblate needs to localize the help_url.

You might want to try the fully qualified URL. Maybe avoiding strings that have to be compounded will sidestep the percent-encoding for the slash, colon and hashtag.

help_url = "https://gramps-project.org/wiki/index.php/Addon:Isotammi_addons#FilterParams_tool"

@emyoulation
Copy link
Author

added a 5.2 Addon Manager section to the Isotammi Installation section on the wiki.

Thought you might want to grab the screen captures for your GitHub pages:

https://blog.gramps-project.org/wiki/index.php/Addon:Isotammi_addons#Installation

@kkujansuu
Copy link
Owner

kkujansuu commented Aug 24, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working FilterParams
Projects
None yet
Development

No branches or pull requests

2 participants