Skip to content

Merge rdbende:numberentry into master to add NumberEntry widget#79

Open
rdbende wants to merge 20 commits intoTkinterEP:masterfrom
rdbende:numberentry
Open

Merge rdbende:numberentry into master to add NumberEntry widget#79
rdbende wants to merge 20 commits intoTkinterEP:masterfrom
rdbende:numberentry

Conversation

@rdbende
Copy link
Copy Markdown
Member

@rdbende rdbende commented Mar 25, 2021

PR Details:

  • Widget name: NumberEntry
  • Author: @rdbende

Description

An entry that takes only numbers, calculations, or variables, and calculates the result of the calculation

Checklist

  • Widget in a separate file in the appropriate folder
  • Widget functions properly on both Windows and Linux
  • Widget code includes docstrings with parameter descriptions
  • Included an example file in /examples
  • Widget is covered by unitttests in /tests
  • Widget includes required assets files
  • Reference to widget in AUTHORS.md
  • Entry in sphinx documentation

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 25, 2021

Codecov Report

❌ Patch coverage is 77.02703% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.40%. Comparing base (2706a43) to head (3bad128).
⚠️ Report is 21 commits behind head on master.

Files with missing lines Patch % Lines
ttkwidgets/numberentry.py 76.71% 17 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #79      +/-   ##
==========================================
- Coverage   89.63%   89.40%   -0.23%     
==========================================
  Files          43       44       +1     
  Lines        4032     4106      +74     
==========================================
+ Hits         3614     3671      +57     
- Misses        418      435      +17     
Files with missing lines Coverage Δ
ttkwidgets/__init__.py 100.00% <100.00%> (ø)
ttkwidgets/numberentry.py 76.71% <76.71%> (ø)

Continue to review full report in Codecov by Sentry.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

specified in allowed_chars (default is True)
:type variables: bool
"""
self._allowed = allowed_chars
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is a serious security threat.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It should allow numbers and operator characters only.

self.insert(0, result)
except SyntaxError:
self.delete(0, tk.END)
self.insert(0, "SyntaxError")
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is a bad idea. Why would the user care? Simply just do nothing with the expression. Or maybe set the invalid ttk state on the entry

self.insert(0, "ZeroDivisionError")
self.select_range(0, tk.END)

def _check(self, *args):
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ohh, this looks cursed. And why didn't I use an actual validator function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant