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

EditEvent callback #986

Merged
merged 1 commit into from
Apr 15, 2020
Merged

Conversation

stevenyoungs
Copy link
Contributor

In line with other editor windows, EditEvent.init accepts a callback parameter. Unlike other editor windows, EditEvent does not pass the callback parameter into EditPrimary.init, leaving self.callback=None in all cases. This PR fixes this such that self.callback = callback, as expected.

Justification
Editor window callback functions form an integral part of Form addon PR267. In PR267, the callback is used to perform additional operations, if the user OK'd the editor window.
Making the editor windows behave in a consisent way, allows consistent coding in PR267, in addition to making EditEvent behave as a casual observer would expect.
For a concrete example, look at PR267, actionutils.py, add_event and the symmmetry with commit_person that can be achieved if this PR is merged.

Note
I have not comprehensively reviewed other editor window classes for the same problem. I have observed that EditRepository has a similar problem. A fix is not included in this PR as I have no immediate need to use EditRepository. I am prepared to review all editor window classes for this problem, if felt necessary.

… to EditPrimary.__init__.

This ensures self.callback is initialised as the calling code expects
@codecov-io
Copy link

Codecov Report

Merging #986 into master will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #986      +/-   ##
==========================================
+ Coverage   41.95%   41.95%   +<.01%     
==========================================
  Files        1071     1071              
  Lines      145657   145657              
==========================================
+ Hits        61106    61110       +4     
+ Misses      84551    84547       -4
Impacted Files Coverage Δ
gramps/gui/editors/editevent.py 21.68% <ø> (ø) ⬆️
gramps/plugins/test/exports_test.py 90.52% <0%> (+1.89%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3938fac...18a59b2. Read the comment docs.

@sam-m888 sam-m888 added this to the v5.2 milestone Jan 11, 2020
@prculley prculley merged commit 490fb1e into gramps-project:master Apr 15, 2020
@stevenyoungs stevenyoungs deleted the editevent_callback branch December 6, 2024 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants