Skip to content
This repository was archived by the owner on Mar 31, 2020. It is now read-only.

Joyful Jaguars #36

Open
wants to merge 96 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
82e4fa3
Initial commit.
0xf0f Feb 23, 2019
7ec8bab
- Renamed test.py to test_editor_window, and added a newline to the end.
0xf0f Feb 23, 2019
6b55f8f
Added basic functionality to the EditorWindow class, which includes:
0xf0f Feb 23, 2019
be4542d
Merge pull request #1 from LargeKnome/editor
hanyuone Feb 23, 2019
600d431
Updated EditorWindow and test_editor_window
0xf0f Feb 23, 2019
5e3e8ad
Merge pull request #3 from LargeKnome/editor
LargeKnome Feb 23, 2019
ca27a3f
Moved cut above copy in Edit menu.
0xf0f Feb 23, 2019
932f918
First commit for spell-checker
hanyuone Feb 24, 2019
668dcb2
Add Levenshtein distance-1 generator
Feb 24, 2019
0aded34
Updated EditorWindow and test_editor_window
0xf0f Feb 26, 2019
7edc9bc
Merge pull request #4 from LargeKnome/editor
LargeKnome Feb 26, 2019
b6732b2
Fixed word detection to take into account apostrophes.
0xf0f Feb 26, 2019
ae44852
Finished basic spellchecker
Feb 26, 2019
8a85e8d
Merge pull request #6 from LargeKnome/spelling
0xf0f Feb 26, 2019
1666ff1
Merge pull request #5 from LargeKnome/editor
LargeKnome Feb 26, 2019
e674b80
Create issues
LargeKnome Feb 26, 2019
d4a0f65
Updated word detection code and test_editor_window.py
0xf0f Feb 27, 2019
81dc51a
Merge remote-tracking branch 'origin/master' into editor
0xf0f Feb 27, 2019
a612ca1
Added newline to end of utility.py
0xf0f Feb 27, 2019
c2df1f9
Cleaned up test_editor_window.py
0xf0f Feb 27, 2019
fbea318
Delete issues
0xf0f Feb 27, 2019
17f7515
Merge pull request #8 from LargeKnome/editor
0xf0f Feb 28, 2019
dc780e6
Created CloppyWindow and a file for testing it.
0xf0f Mar 1, 2019
e4a6a5f
Fixed linting issues
0xf0f Mar 1, 2019
a857b7b
Finished basic spelling fudger
Mar 2, 2019
e207497
Updated CloppyWindow and EditorWindow
0xf0f Mar 2, 2019
ba49e2d
Updated CloppyWindow subclasses, .flake8
0xf0f Mar 2, 2019
bc3065c
Updated CloppyWindow and EditorWindow
0xf0f Mar 2, 2019
ced7223
Updated CloppyWindow subclasses, .flake8
0xf0f Mar 2, 2019
02c4e22
Implemented basic About dialog, updated .gitignore
0xf0f Mar 2, 2019
1e2e1e0
Removed clipboard.py object and settings_window.py
0xf0f Mar 2, 2019
9448118
Added credit for the original pairwise implementation.
0xf0f Mar 2, 2019
3a77b0d
Added/changed commentary, refactored editing events, more testing
0xf0f Mar 3, 2019
f4f778c
Merge remote-tracking branch 'origin/editor' into editor
0xf0f Mar 3, 2019
8ed033b
Fixed minor typo.
0xf0f Mar 3, 2019
cab6dad
Merge pull request #9 from LargeKnome/editor
0xf0f Mar 3, 2019
0281610
Completed spelling fudger
Mar 3, 2019
777facd
Updated cloppy, refactored events, changed resource path.
0xf0f Mar 3, 2019
1542ba9
Added the cloppy sound file.
0xf0f Mar 3, 2019
79bec1e
Minor changes
Mar 3, 2019
b9804e8
Add is_correct and basic spelling window
Mar 3, 2019
f44427f
Fix misspell.py
Mar 3, 2019
f40bfea
Added basic error handling
Mar 3, 2019
7743ef2
Remove errors
Mar 3, 2019
6bc8e7c
Merge pull request #10 from LargeKnome/spelling
hanyuone Mar 3, 2019
6fbfdad
Created initial project;
LargeKnome Feb 23, 2019
e3ac008
Added issues file for better bug tracking
LargeKnome Feb 26, 2019
7910329
Added issues file for better bug tracking
LargeKnome Feb 26, 2019
a14d91b
Added issues file for better bug tracking
LargeKnome Feb 26, 2019
1f46661
commiting unversioned files
LargeKnome Feb 26, 2019
b32d017
added punctuation to the issues list
LargeKnome Feb 26, 2019
3db2ee3
Added security function
LargeKnome Mar 3, 2019
6269c2b
Fixed word detection to take into account apostrophes.
0xf0f Feb 26, 2019
a2979f7
Create issues
LargeKnome Feb 26, 2019
d3d8549
Updated word detection code and test_editor_window.py
0xf0f Feb 27, 2019
edf16d8
Added newline to end of utility.py
0xf0f Feb 27, 2019
5c8cd23
Cleaned up test_editor_window.py
0xf0f Feb 27, 2019
65fa894
Delete issues
0xf0f Feb 27, 2019
dd39398
Created CloppyWindow and a file for testing it.
0xf0f Mar 1, 2019
20f3730
Fixed linting issues
0xf0f Mar 1, 2019
b932b98
Updated CloppyWindow and EditorWindow
0xf0f Mar 2, 2019
0bf73a8
Updated CloppyWindow subclasses, .flake8
0xf0f Mar 2, 2019
919d435
Implemented basic About dialog, updated .gitignore
0xf0f Mar 2, 2019
5555a15
Removed clipboard.py object and settings_window.py
0xf0f Mar 2, 2019
afcf992
Added credit for the original pairwise implementation.
0xf0f Mar 2, 2019
3454f5f
Added/changed commentary, refactored editing events, more testing
0xf0f Mar 3, 2019
6416bcb
Fixed minor typo.
0xf0f Mar 3, 2019
d961765
Added security function
LargeKnome Mar 3, 2019
f4a647b
Merge remote-tracking branch 'origin/master'
LargeKnome Mar 3, 2019
0b594d6
Added security function
LargeKnome Mar 3, 2019
3dc25ae
Added a list of misspellings
Mar 3, 2019
c0bf6f9
Updated CloppyWindow and EditorWindow, removed testing files
0xf0f Mar 3, 2019
cba0e0e
Merge pull request #11 from LargeKnome/editor
0xf0f Mar 3, 2019
d7aae28
Removed conflicting files.
0xf0f Mar 3, 2019
a138a33
Delete vcs.xml
0xf0f Mar 3, 2019
4286172
Delete code-jam-4.iml
0xf0f Mar 3, 2019
888749c
Delete encodings.xml
0xf0f Mar 3, 2019
8e8e475
Delete misc.xml
0xf0f Mar 3, 2019
abf9414
Delete modules.xml
0xf0f Mar 3, 2019
7958787
Merge branch 'master' into spelling
0xf0f Mar 3, 2019
845aef0
Merge remaining spelling commits before finalization.
0xf0f Mar 3, 2019
675217a
More finalization work
0xf0f Mar 3, 2019
936ae2c
Merge pull request #15 from LargeKnome/finalization
0xf0f Mar 3, 2019
ca4774d
Emergency patch
Mar 3, 2019
976dab3
Merge branch 'master' into spelling
hanyuone Mar 3, 2019
915f9c1
Merge pull request #16 from LargeKnome/spelling
0xf0f Mar 3, 2019
ead07f4
More finalization work
0xf0f Mar 3, 2019
2cb1714
Revert "Emergency patch to misspell.py"
0xf0f Mar 3, 2019
0be512c
Merge pull request #17 from LargeKnome/revert-16-spelling
0xf0f Mar 3, 2019
095d105
More finalization work
0xf0f Mar 3, 2019
e966a20
Merge pull request #18 from LargeKnome/finalization
0xf0f Mar 3, 2019
0543ce1
Update README.md
0xf0f Mar 3, 2019
b27e9cd
Update README.md
0xf0f Mar 3, 2019
bd32cdc
Added playsound to pipfile.
0xf0f Mar 3, 2019
9e3a6a4
Merge pull request #19 from LargeKnome/finalization
0xf0f Mar 3, 2019
2297334
Delete issues
0xf0f Mar 3, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .flake8
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,6 @@ venv.bak/

# mypy
.mypy_cache/

# pycharm
.idea/
5 changes: 4 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ verify_ssl = true
flake8 = "*"

[packages]
nltk = "*"
playsound = "*"

[requires]
python_version = "3.7"

[scripts]
lint = "python -m flake8"
lint = "python -m flake8"
start = "python -m project"
45 changes: 37 additions & 8 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 38 additions & 27 deletions README.md
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 added project/__init__.py
Empty file.
13 changes: 13 additions & 0 deletions project/__main__.py
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.
35 changes: 35 additions & 0 deletions project/functionality/constants.py
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')
Copy link
Member

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.


# The path to the audio of Cloppy used in CloppyWindow
cloppy_sound_path = str(
resources_path/'321947__n-audioman__horseneigh02-03.wav'
Copy link
Member

Choose a reason for hiding this comment

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

Again, could be pathlib.

Copy link

Choose a reason for hiding this comment

The 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 playsound module can only take a string as input. I switched cloppy_picture_path to a string as well for consistency.

)

# Cloppy's greeting to the user shown in CloppyWindow
cloppy_greeting = (
f"Hi, I'm Cloppy, your {program_name} personal assistant!"
)
30 changes: 30 additions & 0 deletions project/functionality/events.py
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)
24 changes: 24 additions & 0 deletions project/functionality/utility.py
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.
Binary file added project/resources/cloppy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added project/resources/cloppy.xcf
Binary file not shown.
Binary file added project/resources/cloppy_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added project/resources/cloppy_2.xcf
Binary file not shown.
Empty file added project/spelling/__init__.py
Empty file.
Loading