Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 14
Joyful Jaguars#36
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
Joyful Jaguars #36
Changes from all commits
82e4fa37ec8bab6b55f8fbe4542d600d4315e3e8adca27a3f932f918668dcb20aded347edc9bcb6732b2ae448528a85e8d1666ff1e674b80d4a0f6581dc51aa612ca1c2df1f9fbea31817f7515dc780e6e4a6a5fa857b7be207497ba49e2dbc3065cced722302c4e221e2e1e094481183a77b0df4f778c8ed033bcab6dad0281610777facd1542ba979bec1eb9804e8f44427ff40bfea7743ef26bc8e7c6fbfdade3ac0087910329a14d91b1f46661b32d0173db2ee36269c2ba2979f7d3d8549edf16d85c8cd2365fa894dd3939820f3730b932b980bf73a8919d4355555a15afcf9923454f5f6416bcbd961765f4a647b0b594d63dc25aec0bf6f9cba0e0ed7aae28a138a334286172888749c8e8e475abf94147958787845aef0675217a936ae2cca4774d976dab3915f9c1ead07f42cb17140be512c095d105e966a200543ce1b27e9cdbd32cdc9e3a6a42297334File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| 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 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -102,3 +102,6 @@ venv.bak/ | ||
| # mypy | ||
| .mypy_cache/ | ||
| # pycharm | ||
| .idea/ | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
| 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` |
| 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() |
| 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' | ||
Member 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!" | ||
| ) | ||
| 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) |
| 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) |
Uh oh!
There was an error while loading. Please reload this page.
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.