Skip to content
This repository has been archived by the owner on Dec 1, 2020. It is now read-only.

Feature/pm 140 edit log entries #72

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

JeffreyBouman
Copy link

Closes PM-140

Description

Added the option of editing existing entries in the log.

WARNING: When the logger is in autosave mode, the edits do take place. However the entries will get out of order (date and time do not change), since the edit will remove the "old" entry and add a new one at the back of the text file. Maybe a new Issue is in place.

Changes

In "entry.py":

  • Add edit_content function

In "entry_model.py":

  • Ability to retrieve entry from data function
  • Adapted insert_row to actually insert row instead of just appending

In "notes_widget.py":

  • Make row double clickable
  • Ability to edit entry when double clicked by opening a pop-up window

Testing

None

@JeffreyBouman JeffreyBouman requested a review from a team as a code owner August 27, 2020 18:45
@JeffreyBouman JeffreyBouman requested review from Roelemans and RutgerVanBeek and removed request for a team August 27, 2020 18:45
@codecov
Copy link

codecov bot commented Aug 27, 2020

Codecov Report

Merging #72 into develop will decrease coverage by 2.62%.
The diff coverage is 28.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop      #72      +/-   ##
===========================================
- Coverage    68.36%   65.74%   -2.63%     
===========================================
  Files            9        9              
  Lines          411      432      +21     
  Branches        50       56       +6     
===========================================
+ Hits           281      284       +3     
- Misses         123      140      +17     
- Partials         7        8       +1     
Flag Coverage Δ
#production 43.65% <28.00%> (-2.67%) ⬇️
#test 96.66% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ote_taker/src/march_rqt_note_taker/notes_widget.py 17.74% <12.50%> (-1.53%) ⬇️
...h_rqt_note_taker/src/march_rqt_note_taker/entry.py 94.11% <50.00%> (-5.89%) ⬇️
...note_taker/src/march_rqt_note_taker/entry_model.py 76.47% <57.14%> (-4.39%) ⬇️

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 7db9482...f3ce1cb. Read the comment docs.

Copy link
Contributor

@Roelemans Roelemans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is something wrong with the time of edited entries. It resetted to 01:00:00 :s

Also, more design choices, you might want to

  1. Not allow the editing of automatic entries, as that would allow (accidentally) falsifying data which could give a very wrong impression of what happened later.
  2. I think you already looked at this, but it would probably be more intuitive if double click would allow you to type inside the entry. One way of achieving this might be by replacing the entry with a editable textbox.

entry_content, ok = QInputDialog().getText(self, 'Edit Entry', 'Entry:',
QLineEdit.Normal, entry.content)
if ok and entry_content:
entry.edit_content(entry_content)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
entry.edit_content(entry_content)
entry.content = entry_content

The pythonic way is to just directly edit the parameter. Parameters that you want to be "private" should be marked by a leading _, If you need "getters/setters" for these variables, you can use @Property to keep the syntax pythonic.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants