This repository was archived by the owner on Mar 31, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 15
Joyful Jaguars #36
Open
LargeKnome
wants to merge
96
commits into
python-discord:master
Choose a base branch
from
LargeKnome:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Joyful Jaguars #36
Changes from all commits
Commits
Show all changes
96 commits
Select commit
Hold shift + click to select a range
82e4fa3
Initial commit.
0xf0f 7ec8bab
- Renamed test.py to test_editor_window, and added a newline to the end.
0xf0f 6b55f8f
Added basic functionality to the EditorWindow class, which includes:
0xf0f be4542d
Merge pull request #1 from LargeKnome/editor
hanyuone 600d431
Updated EditorWindow and test_editor_window
0xf0f 5e3e8ad
Merge pull request #3 from LargeKnome/editor
LargeKnome ca27a3f
Moved cut above copy in Edit menu.
0xf0f 932f918
First commit for spell-checker
hanyuone 668dcb2
Add Levenshtein distance-1 generator
0aded34
Updated EditorWindow and test_editor_window
0xf0f 7edc9bc
Merge pull request #4 from LargeKnome/editor
LargeKnome b6732b2
Fixed word detection to take into account apostrophes.
0xf0f ae44852
Finished basic spellchecker
8a85e8d
Merge pull request #6 from LargeKnome/spelling
0xf0f 1666ff1
Merge pull request #5 from LargeKnome/editor
LargeKnome e674b80
Create issues
LargeKnome d4a0f65
Updated word detection code and test_editor_window.py
0xf0f 81dc51a
Merge remote-tracking branch 'origin/master' into editor
0xf0f a612ca1
Added newline to end of utility.py
0xf0f c2df1f9
Cleaned up test_editor_window.py
0xf0f fbea318
Delete issues
0xf0f 17f7515
Merge pull request #8 from LargeKnome/editor
0xf0f dc780e6
Created CloppyWindow and a file for testing it.
0xf0f e4a6a5f
Fixed linting issues
0xf0f a857b7b
Finished basic spelling fudger
e207497
Updated CloppyWindow and EditorWindow
0xf0f ba49e2d
Updated CloppyWindow subclasses, .flake8
0xf0f bc3065c
Updated CloppyWindow and EditorWindow
0xf0f ced7223
Updated CloppyWindow subclasses, .flake8
0xf0f 02c4e22
Implemented basic About dialog, updated .gitignore
0xf0f 1e2e1e0
Removed clipboard.py object and settings_window.py
0xf0f 9448118
Added credit for the original pairwise implementation.
0xf0f 3a77b0d
Added/changed commentary, refactored editing events, more testing
0xf0f f4f778c
Merge remote-tracking branch 'origin/editor' into editor
0xf0f 8ed033b
Fixed minor typo.
0xf0f cab6dad
Merge pull request #9 from LargeKnome/editor
0xf0f 0281610
Completed spelling fudger
777facd
Updated cloppy, refactored events, changed resource path.
0xf0f 1542ba9
Added the cloppy sound file.
0xf0f 79bec1e
Minor changes
b9804e8
Add is_correct and basic spelling window
f44427f
Fix misspell.py
f40bfea
Added basic error handling
7743ef2
Remove errors
6bc8e7c
Merge pull request #10 from LargeKnome/spelling
hanyuone 6fbfdad
Created initial project;
LargeKnome e3ac008
Added issues file for better bug tracking
LargeKnome 7910329
Added issues file for better bug tracking
LargeKnome a14d91b
Added issues file for better bug tracking
LargeKnome 1f46661
commiting unversioned files
LargeKnome b32d017
added punctuation to the issues list
LargeKnome 3db2ee3
Added security function
LargeKnome 6269c2b
Fixed word detection to take into account apostrophes.
0xf0f a2979f7
Create issues
LargeKnome d3d8549
Updated word detection code and test_editor_window.py
0xf0f edf16d8
Added newline to end of utility.py
0xf0f 5c8cd23
Cleaned up test_editor_window.py
0xf0f 65fa894
Delete issues
0xf0f dd39398
Created CloppyWindow and a file for testing it.
0xf0f 20f3730
Fixed linting issues
0xf0f b932b98
Updated CloppyWindow and EditorWindow
0xf0f 0bf73a8
Updated CloppyWindow subclasses, .flake8
0xf0f 919d435
Implemented basic About dialog, updated .gitignore
0xf0f 5555a15
Removed clipboard.py object and settings_window.py
0xf0f afcf992
Added credit for the original pairwise implementation.
0xf0f 3454f5f
Added/changed commentary, refactored editing events, more testing
0xf0f 6416bcb
Fixed minor typo.
0xf0f d961765
Added security function
LargeKnome f4a647b
Merge remote-tracking branch 'origin/master'
LargeKnome 0b594d6
Added security function
LargeKnome 3dc25ae
Added a list of misspellings
c0bf6f9
Updated CloppyWindow and EditorWindow, removed testing files
0xf0f cba0e0e
Merge pull request #11 from LargeKnome/editor
0xf0f d7aae28
Removed conflicting files.
0xf0f a138a33
Delete vcs.xml
0xf0f 4286172
Delete code-jam-4.iml
0xf0f 888749c
Delete encodings.xml
0xf0f 8e8e475
Delete misc.xml
0xf0f abf9414
Delete modules.xml
0xf0f 7958787
Merge branch 'master' into spelling
0xf0f 845aef0
Merge remaining spelling commits before finalization.
0xf0f 675217a
More finalization work
0xf0f 936ae2c
Merge pull request #15 from LargeKnome/finalization
0xf0f ca4774d
Emergency patch
976dab3
Merge branch 'master' into spelling
hanyuone 915f9c1
Merge pull request #16 from LargeKnome/spelling
0xf0f ead07f4
More finalization work
0xf0f 2cb1714
Revert "Emergency patch to misspell.py"
0xf0f 0be512c
Merge pull request #17 from LargeKnome/revert-16-spelling
0xf0f 095d105
More finalization work
0xf0f e966a20
Merge pull request #18 from LargeKnome/finalization
0xf0f 0543ce1
Update README.md
0xf0f b27e9cd
Update README.md
0xf0f bd32cdc
Added playsound to pipfile.
0xf0f 9e3a6a4
Merge pull request #19 from LargeKnome/finalization
0xf0f 2297334
Delete issues
0xf0f 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 hidden or 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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
[flake8] | ||
max-line-length=100 | ||
application_import_names=projectt | ||
application_import_names=project | ||
ignore=P102,B311,W503,E226,S311,W504,F821 | ||
exclude=__pycache__, venv, .venv, tests | ||
import-order-style=pycharm |
This file contains hidden or 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 |
---|---|---|
|
@@ -102,3 +102,6 @@ venv.bak/ | |
|
||
# mypy | ||
.mypy_cache/ | ||
|
||
# pycharm | ||
.idea/ |
This file contains hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 |
---|---|---|
@@ -1,45 +1,56 @@ | ||
# Code Jam IV: This app hates you! | ||
|
||
The theme for this code jam will be **This app hates you!**. You will be creating an application using a GUI library of your choice in Python. The application must serve a real purpose, but must also fit the theme. | ||
|
||
You can use any GUI library that you wish to use, but you have to make _a desktop app_. For example, you may use frameworks like PySide, PyQt, tkinter, or wxPython. You can even use stuff like Kivy or PyGame, although we do not recommend that you do. You may not, however, use webframeworks like Django or Flask, and you may not use anything that turns HTML and CSS into a desktop app that runs as a browser. | ||
# Project Information | ||
|
||
Here are a couple of examples of what we mean by an application that "serves a real purpose but also fits the theme": | ||
* A calculator app that calculates the right answers, but represents the answer in a way that's completely impractical. | ||
* An image resizer where you have to specify which part of the image to resize, specify how much force to apply to the resize operation in newtons, and then manually resize the image by turning a crank. | ||
* An alarm clock app that plays a very loud sound effect every 5 minutes reminding you that your alarm will ring in 6 hours. The closer it gets to the 6 hour mark, the lower the volume of the sound effect. When the time is up, the sound effect is virtually inaudible. | ||
### SMH Editor | ||
|
||
Remember that teamwork is not optional for our code jams - You must find a way to work together. For this jam, we've assigned a leader for each team based on their responses to the application form. Remember to listen to your leader, and communicate with the rest of your team! | ||
Team Members: | ||
- LargeKnome (Leader) | ||
- Hanyuone | ||
- Meta | ||
|
||
**Remember to provide instructions on how to set up and run your app at the bottom of this README**. | ||
## Description | ||
|
||
# Tips | ||
The **S**mart **M**odern **H**elpful editor delivers a text editing experience | ||
tailored to the most discerning of connoisseurs. Its distraction free, | ||
minimalistic interface was lovingly crafted to provide the ultimate in focus | ||
and comfort. There is no better way to spend time with a keyboard at your | ||
fingertips. | ||
|
||
* Please lint your code, and listen to the linter. We recommend **flake8**, and you can use `pipenv run lint` to run it. We will be evaluating your style, and unlinted code will lead to point deductions. | ||
* Remember to work closely with the rest of your team. We will deduct points for poor teamwork. | ||
* Don't overcomplicate this. It's better to write a relatively simple app that is 100% feature complete than failing to finish a more ambitious project. | ||
* For information on how the Code Jam will be judged, please see [this document](https://wiki.pythondiscord.com/wiki/jams/judging). | ||
**_Smart_** - Its highly advanced spell checker will take your mind off of the | ||
pesky pitfalls of the English language, leaving you free to focus solely on | ||
sharing the light of your creativity with the world. | ||
|
||
# Setting Up | ||
**_Modern_** - The sleek, streamlined, look is intuitive and straightforward. | ||
It evokes the editors of old, from a time when life was quieter and easier to | ||
understand. No messing around with tangly ribbons and dizzying radial menus | ||
here. | ||
|
||
You should be using [Pipenv](https://pipenv.readthedocs.io/en/latest/). Take a look | ||
[at the documentation](https://pipenv.readthedocs.io/en/latest/) if you've never used it before. In short: | ||
**_Helpful_** - The inbuilt personal assistant is always on hand to help you | ||
avoid common text editing disasters. Our highly skilled team of designers, | ||
programmers and social psychologists have laboured tirelessly to deliver you | ||
the true goldilocks zone of quality. | ||
|
||
* Setting up for development: `pipenv install --dev` | ||
* Running the application (assuming you use our project layout): `pipenv run start` | ||
## Setup & Installation | ||
|
||
# Project Information | ||
- Clone repo, open root directory. | ||
- `pipenv install` | ||
- `pipenv run start` | ||
- Wait a bit- it might take a while to start up. | ||
|
||
`# TODO` | ||
## How do I use this thing? | ||
|
||
## Description | ||
Same as you'd use any other text editor. Just open it up and type away. | ||
Let the editor guide you towards new highs of creative bliss. | ||
|
||
`# TODO` | ||
## Credits | ||
|
||
## Setup & Installation | ||
A picture used in the program is an alteration of | ||
`https://commons.wikimedia.org/wiki/File:Chestnut_horse_head,_all_excited.jpg` | ||
released under the Creative Commons Attribution-Share Alike 2.0 Generic license. | ||
|
||
`# TODO` | ||
An audio file used in the program is courtesy of | ||
`https://freesound.org/people/n_audioman/sounds/321947/` | ||
released under the Creative Commons Attribution Noncommercial License. | ||
|
||
## How do I use this thing? | ||
|
||
`# TODO` |
Empty file.
This file contains hidden or 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,13 @@ | ||
import tkinter as tk | ||
from project.windows.editor_window import EditorWindow | ||
|
||
if __name__ == '__main__': | ||
root = tk.Tk() | ||
|
||
# Hide root window. | ||
root.withdraw() | ||
|
||
# Create editor window. | ||
editor_window = EditorWindow(root) | ||
|
||
root.mainloop() |
Empty file.
This file contains hidden or 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,35 @@ | ||
from pathlib import Path | ||
|
||
|
||
class Constants: | ||
""" | ||
This class is intended to house constant values used throughout the | ||
program. | ||
""" | ||
|
||
# The path to the resources directory of the project. | ||
resources_path = Path(__file__).parents[1]/'resources' | ||
|
||
# The name of the program. | ||
program_name = 'SMH Editor' | ||
|
||
# These values are used to determine whether a key press should count as | ||
# text input or not in EditorWindow.on_key_press. They're used to check | ||
# whether Ctrl or Alt were held during the key press. | ||
forbidden_flags = ( | ||
0x04, # Ctrl | ||
0x20000 # Alt | ||
) | ||
|
||
# The path to the picture of Cloppy used in CloppyWindow | ||
cloppy_picture_path = str(resources_path/'cloppy.png') | ||
|
||
# The path to the audio of Cloppy used in CloppyWindow | ||
cloppy_sound_path = str( | ||
resources_path/'321947__n-audioman__horseneigh02-03.wav' | ||
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. Again, could be pathlib. 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. These were both originally just Path objects, but then it turned out that the |
||
) | ||
|
||
# Cloppy's greeting to the user shown in CloppyWindow | ||
cloppy_greeting = ( | ||
f"Hi, I'm Cloppy, your {program_name} personal assistant!" | ||
) |
This file contains hidden or 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,30 @@ | ||
from typing import Callable | ||
|
||
|
||
class Event: | ||
""" | ||
This class represents an event emitter to which callbacks can be assigned. | ||
|
||
Example: | ||
def test_callback(value): | ||
print(value) | ||
|
||
new_event = Event() | ||
new_event.add_callback(test_callback) | ||
new_event('test input') | ||
|
||
# This will output 'test input' | ||
""" | ||
|
||
def __init__(self): | ||
self.callbacks = set() | ||
|
||
def add_callback(self, callback: Callable): | ||
self.callbacks.add(callback) | ||
|
||
def take_callback(self, callback: Callable): | ||
self.callbacks.remove(callback) | ||
|
||
def __call__(self, *args, **kwargs): | ||
for callback in self.callbacks: | ||
callback(*args, **kwargs) |
This file contains hidden or 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,24 @@ | ||
import itertools | ||
|
||
|
||
def pairwise(iterable): | ||
""" | ||
Steps through an iterable while looking ahead | ||
one item every iteration. | ||
|
||
Modified from the implementation here: | ||
https://stackoverflow.com/a/5434936/10444096 | ||
|
||
Example: | ||
for current, next in pairwise([1,2,3,4]): | ||
print(current, next) | ||
|
||
this would output: | ||
1 2 | ||
2 3 | ||
3 4 | ||
4 None | ||
""" | ||
a, b = itertools.tee(iterable) | ||
next(b, None) | ||
return itertools.zip_longest(a, b) |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Empty file.
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.
Missed opportunity to use pathlib.