-
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/snappy' into develop
- Loading branch information
Showing
123 changed files
with
5,336 additions
and
4,353 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# name: Pyinstaller Binary Run | ||
# | ||
# on: [push, pull_request, workflow_dispatch] | ||
# | ||
# jobs: | ||
# lint: | ||
# runs-on: ubuntu-latest | ||
# strategy: | ||
# matrix: | ||
# python-version: ["3.11"] | ||
# steps: | ||
# - uses: actions/checkout@v3 | ||
# - name: Set up Python ${{ matrix.python-version }} | ||
# uses: actions/setup-python@v2 | ||
# with: | ||
# python-version: ${{ matrix.python-version }} | ||
# - name: Install dependencies | ||
# run: | | ||
# python -m pip install --upgrade pip | ||
# pip install . | ||
# pip install ruff | ||
# pip install pyinstaller | ||
# | ||
# - name: Package app with pyinstaller | ||
# run: | | ||
# python -c "with open('dooit.py', 'w') as f: f.write('from dooit.__main__ import main\nmain()\n')" | ||
# pyinstaller --clean -F dooit.py --add-data="dooit/utils/default_config.py:dooit/utils/" --add-data="dooit/ui/styles.tcss:dooit/ui/" | ||
# - name: Check by running | ||
# run: | | ||
# chmod +x ./dist/dooit | ||
# ./dist/dooit |
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
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
hide: | ||
- toc | ||
- navigation | ||
--- | ||
|
||
# Welcome |
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 |
---|---|---|
@@ -1,6 +1,15 @@ | ||
from .model import Model | ||
from .manager import Manager, manager | ||
from .model import DooitModel, BaseModel | ||
from .todo import Todo | ||
from .workspace import Workspace | ||
from .manager import manager | ||
from .hooks import fix_hooks, validation_hooks | ||
|
||
__all__ = ["Model", "Manager", "Todo", "Workspace", "manager"] | ||
__all__ = [ | ||
"BaseModel", | ||
"DooitModel", | ||
"Todo", | ||
"Workspace", | ||
"manager", | ||
"fix_hooks", | ||
"validation_hooks", | ||
] |
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,6 @@ | ||
from pathlib import Path | ||
from platformdirs import user_data_dir | ||
|
||
ROOT_FOLDER = Path(user_data_dir("dooit")) | ||
DATABASE_FILE = ROOT_FOLDER / "dooit.db" | ||
DATABASE_CONN_STRING = f"sqlite:////{DATABASE_FILE}" |
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,34 @@ | ||
class DooitError(Exception): | ||
""" | ||
Base class for all exceptions raised by the API. | ||
""" | ||
|
||
|
||
class NoParentError(DooitError): | ||
""" | ||
Raised when user tries to add a Todo object without a parent | ||
""" | ||
|
||
|
||
class MultipleParentError(DooitError): | ||
""" | ||
Raised when user tries to add a Todo object with both a workspace and a todo parent | ||
""" | ||
|
||
|
||
class SiblingAdditionError(DooitError): | ||
""" | ||
Raised when user tries to add a sibling to a non-parented node (i.e Manager Object) | ||
""" | ||
|
||
|
||
class WorkspaceAdditionError(DooitError): | ||
""" | ||
Raised when user tries to add a workspace to a todo object | ||
""" | ||
|
||
|
||
class TodoAdditionError(DooitError): | ||
""" | ||
Raised when user tries to add a todo to manager class | ||
""" |
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,26 @@ | ||
from sqlalchemy import event | ||
from ..workspace import Workspace | ||
from ..todo import Todo | ||
|
||
|
||
@event.listens_for(Workspace, "before_update") | ||
@event.listens_for(Workspace, "before_insert") | ||
def fix_order_id_workspace(mapper, connection, target: Workspace): | ||
if target.is_root: | ||
return | ||
|
||
if target.order_index is None or target.order_index == -1: | ||
target.order_index = len(target.siblings) - 1 | ||
|
||
|
||
@event.listens_for(Todo, "before_insert") | ||
@event.listens_for(Todo, "before_update") | ||
def fix_order_id_todo(mapper, connection, target: Todo): | ||
if target.order_index is None or target.order_index == -1: | ||
target.order_index = len(target.siblings) - 1 | ||
|
||
|
||
# | ||
# @event.listens_for(Workspace.__table__, "after_create") | ||
# def create_root(target: Table, connection: Connection, **kw): | ||
# connection.execute(target.insert(), {"is_root": True}) |
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,13 @@ | ||
from sqlalchemy import event | ||
from ..exceptions import NoParentError, MultipleParentError | ||
from ..todo import Todo | ||
|
||
|
||
@event.listens_for(Todo, "before_insert") | ||
@event.listens_for(Todo, "before_update") | ||
def validate_parent_todo(mapper, connection, target: Todo): | ||
if target.parent_workspace is None and target.parent_todo is None: | ||
raise NoParentError("Todo must have a parent workspace or todo") | ||
|
||
if target.parent_workspace is not None and target.parent_todo is not None: | ||
raise MultipleParentError("Todo cannot have both a parent workspace and todo") |
Oops, something went wrong.