-
Notifications
You must be signed in to change notification settings - Fork 114
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
Codebase Refactor ⭐ #663
Closed
Closed
Codebase Refactor ⭐ #663
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -40,8 +40,8 @@ xgettext --output=rednotebook.pot \ | |||||
--files-from=sourcefiles.txt \ | ||||||
tmp/main_window.glade.h | ||||||
|
||||||
for file in `ls *.po`; do | ||||||
msgmerge --previous --update ${file} rednotebook.pot | ||||||
for file in $(ls *.po); do | ||||||
msgmerge --previous --update "${file}" rednotebook.pot | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Apostrophes are redundant when using ${}. |
||||||
done | ||||||
|
||||||
rm sourcefiles.txt | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Metadata-Version: 2.1 | ||
Name: rednotebook | ||
Version: 2.29 | ||
Summary: Graphical daily journal with calendar, templates and keyword searching | ||
Home-page: https://rednotebook.app | ||
Author: Jendrik Seipp | ||
Author-email: jendrikseipp@gmail.com | ||
Maintainer: Jendrik Seipp | ||
Maintainer-email: jendrikseipp@gmail.com | ||
License: GPL | ||
Keywords: journal,diary | ||
Provides-Extra: dev_style | ||
License-File: LICENSE | ||
|
||
RedNotebook is a modern desktop journal. It lets you format, tag and | ||
search your entries. You can also add pictures, links and customizable | ||
templates, spell check your notes, and export to plain text, HTML or | ||
Latex. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
CHANGELOG.md | ||
LICENSE | ||
MANIFEST.in | ||
README.md | ||
TODO.md | ||
pyproject.toml | ||
run | ||
setup.py | ||
data/rednotebook.appdata.xml | ||
data/rednotebook.desktop | ||
dev/build_translations.py | ||
po/ar.po | ||
po/ast.po | ||
po/be.po | ||
po/bg.po | ||
po/bs.po | ||
po/ca.po | ||
po/cs.po | ||
po/cy.po | ||
po/da.po | ||
po/de.po | ||
po/el.po | ||
po/en_GB.po | ||
po/eo.po | ||
po/es.po | ||
po/eu.po | ||
po/fi.po | ||
po/fo.po | ||
po/fr.po | ||
po/ga.po | ||
po/gl.po | ||
po/he.po | ||
po/hi.po | ||
po/hr.po | ||
po/hu.po | ||
po/hy.po | ||
po/id.po | ||
po/ie.po | ||
po/it.po | ||
po/ja.po | ||
po/ka.po | ||
po/kk.po | ||
po/ko.po | ||
po/ky.po | ||
po/lt.po | ||
po/ml.po | ||
po/mn.po | ||
po/ms.po | ||
po/my.po | ||
po/nb.po | ||
po/nds.po | ||
po/nl.po | ||
po/nn.po | ||
po/oc.po | ||
po/pl.po | ||
po/pt.po | ||
po/pt_BR.po | ||
po/rednotebook.pot | ||
po/ro.po | ||
po/ru.po | ||
po/si.po | ||
po/sk.po | ||
po/sl.po | ||
po/sr.po | ||
po/sv.po | ||
po/ta.po | ||
po/te.po | ||
po/tl.po | ||
po/tr.po | ||
po/ug.po | ||
po/uk.po | ||
po/uz.po | ||
po/vi.po | ||
po/wae.po | ||
po/xh.po | ||
po/zh_CN.po | ||
po/zh_HK.po | ||
po/zh_TW.po | ||
rednotebook/__init__.py | ||
rednotebook/backup.py | ||
rednotebook/configuration.py | ||
rednotebook/data.py | ||
rednotebook/help.py | ||
rednotebook/info.py | ||
rednotebook/journal.py | ||
rednotebook/rednotebook | ||
rednotebook/storage.py | ||
rednotebook/templates.py | ||
rednotebook.egg-info/PKG-INFO | ||
rednotebook.egg-info/SOURCES.txt | ||
rednotebook.egg-info/dependency_links.txt | ||
rednotebook.egg-info/requires.txt | ||
rednotebook.egg-info/top_level.txt | ||
rednotebook/external/__init__.py | ||
rednotebook/external/elibintl.py | ||
rednotebook/external/msgfmt.py | ||
rednotebook/external/spellcheck.py | ||
rednotebook/external/txt2tags.py | ||
rednotebook/files/default.cfg | ||
rednotebook/files/main_window.glade | ||
rednotebook/files/rednotebook-highlight-style.xml | ||
rednotebook/files/t2t.lang | ||
rednotebook/gui/__init__.py | ||
rednotebook/gui/browser.py | ||
rednotebook/gui/browser_cef.py | ||
rednotebook/gui/categories.py | ||
rednotebook/gui/clouds.py | ||
rednotebook/gui/customwidgets.py | ||
rednotebook/gui/editor.py | ||
rednotebook/gui/exports.py | ||
rednotebook/gui/format_menu.py | ||
rednotebook/gui/insert_menu.py | ||
rednotebook/gui/main_window.py | ||
rednotebook/gui/menu.py | ||
rednotebook/gui/options.py | ||
rednotebook/gui/search.py | ||
rednotebook/images/bulletlist.png | ||
rednotebook/images/date.png | ||
rednotebook/images/formula.png | ||
rednotebook/images/insert-image-16.png | ||
rednotebook/images/insert-image-22.png | ||
rednotebook/images/line.png | ||
rednotebook/images/linebreak.png | ||
rednotebook/images/link.png | ||
rednotebook/images/numberedlist.png | ||
rednotebook/images/picture.png | ||
rednotebook/images/table.png | ||
rednotebook/images/title.png | ||
rednotebook/images/rednotebook-icon/rednotebook.svg | ||
rednotebook/images/rednotebook-icon/rn-128.png | ||
rednotebook/images/rednotebook-icon/rn-14.png | ||
rednotebook/images/rednotebook-icon/rn-16.png | ||
rednotebook/images/rednotebook-icon/rn-192.png | ||
rednotebook/images/rednotebook-icon/rn-22.png | ||
rednotebook/images/rednotebook-icon/rn-256.png | ||
rednotebook/images/rednotebook-icon/rn-32.png | ||
rednotebook/images/rednotebook-icon/rn-48.png | ||
rednotebook/images/rednotebook-icon/rn-64.png | ||
rednotebook/util/__init__.py | ||
rednotebook/util/dates.py | ||
rednotebook/util/filesystem.py | ||
rednotebook/util/markup.py | ||
rednotebook/util/pango_markup.py | ||
rednotebook/util/statistics.py | ||
rednotebook/util/urls.py | ||
rednotebook/util/utils.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
[dev_style] | ||
black==22.3.0 | ||
flake8==4.0.1 | ||
flake8-2020==1.6.0 | ||
flake8-bugbear==21.11.28 | ||
flake8-comprehensions==3.7.0 | ||
flake8-executable==2.1.1 | ||
isort==5.10.1 | ||
pyupgrade==2.32.0 | ||
vulture==1.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rednotebook | ||
jendrikseipp marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,7 +78,7 @@ def get_text_with_dots(text, start, end, found_text=None): | |
res = res.replace("\n", " ") | ||
if found_text: | ||
# Make the searched_text bold | ||
res = res.replace(found_text, "STARTBOLD%sENDBOLD" % found_text) | ||
res = res.replace(found_text, f"STARTBOLD{found_text}ENDBOLD") | ||
|
||
return res | ||
|
||
|
@@ -165,7 +165,7 @@ def get_words(self, with_special_chars=False): | |
for category, content in self.get_category_content_pairs().items() | ||
) | ||
|
||
all_text = self.text + " " + categories_text | ||
all_text = f"{self.text} {categories_text}" | ||
words = all_text.split() | ||
|
||
if with_special_chars: | ||
|
@@ -204,8 +204,7 @@ def search(self, text, tags): | |
# Date contains searched text. | ||
results.append(get_text_with_dots(self.text, 0, TEXT_RESULT_LENGTH)) | ||
else: | ||
text_result = self.search_in_text(text) | ||
if text_result: | ||
if text_result := self.search_in_text(text): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'll need to bump the minimum Python version to 3.8 for the walrus operator, but I think that's fine. |
||
results.append(text_result) | ||
results.extend(self.search_in_categories(text)) | ||
return str(self), results | ||
|
@@ -218,10 +217,9 @@ def search_in_text(self, search_text): | |
return None | ||
|
||
found_text = self.text[occurrence : occurrence + len(search_text)] | ||
result_text = get_text_with_dots( | ||
return get_text_with_dots( | ||
self.text, occurrence, occurrence + len(search_text), found_text | ||
) | ||
return result_text | ||
|
||
def search_in_categories(self, text): | ||
results = [] | ||
|
@@ -261,8 +259,9 @@ def get_day(self, day_number): | |
|
||
def __str__(self): | ||
lines = [f"Month {self.year_number} {self.month_number}"] | ||
for day_number, day in self.days.items(): | ||
lines.append(f"{day_number}: {day.text}") | ||
lines.extend( | ||
f"{day_number}: {day.text}" for day_number, day in self.days.items() | ||
) | ||
return "\n".join(lines) | ||
|
||
@property | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the added newlines are helpful. And the final newline should be brought back. I think you can simply revert all changes to this file.