Skip to content

Commit

Permalink
Remove need for Document to have an implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 committed Jul 1, 2024
1 parent ea2e6e5 commit ccbc45b
Show file tree
Hide file tree
Showing 10 changed files with 4 additions and 103 deletions.
53 changes: 0 additions & 53 deletions cocoa/src/toga_cocoa/documents.py

This file was deleted.

2 changes: 0 additions & 2 deletions cocoa/src/toga_cocoa/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from . import dialogs
from .app import App
from .command import Command
from .documents import Document
from .fonts import Font
from .hardware.camera import Camera
from .hardware.location import Location
Expand Down Expand Up @@ -46,7 +45,6 @@ def not_implemented(feature):
"not_implemented",
"App",
"Command",
"Document",
# Resources
"Font",
"Icon",
Expand Down
9 changes: 0 additions & 9 deletions cocoa/src/toga_cocoa/libs/appkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,15 +273,6 @@ class NSBezelStyle(IntEnum):

NSCursor = ObjCClass("NSCursor")

######################################################################
# NSDocument.h
NSDocument = ObjCClass("NSDocument")

######################################################################
# NSDocumentController.h
NSDocumentController = ObjCClass("NSDocumentController")
NSDocumentController.declare_class_property("sharedDocumentController")

######################################################################
# NSEvent.h
NSEvent = ObjCClass("NSEvent")
Expand Down
8 changes: 4 additions & 4 deletions core/src/toga/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ def __init__(self, app: App):
# Create the visual representation of the document
self.create()

# Create a platform specific implementation of the Document
self._impl = app.factory.Document(interface=self)

######################################################################
# Document properties
######################################################################
Expand Down Expand Up @@ -80,7 +77,10 @@ def open(self, path: str | Path):
:param path: The file to open.
"""
self._path = Path(path).absolute()
self._impl.open()
if self._path.exists():
self.read()
else:
raise FileNotFoundError()

# Set the title of the document window to match the path
self._main_window.title = self._main_window._default_title
Expand Down
11 changes: 0 additions & 11 deletions dummy/src/toga_dummy/documents.py

This file was deleted.

2 changes: 0 additions & 2 deletions dummy/src/toga_dummy/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from . import dialogs
from .app import App, DocumentApp
from .command import Command
from .documents import Document
from .fonts import Font
from .hardware.camera import Camera
from .hardware.location import Location
Expand Down Expand Up @@ -48,7 +47,6 @@ def not_implemented(feature):
"App",
"DocumentApp",
"Command",
"Document",
"Font",
"Icon",
"Image",
Expand Down
9 changes: 0 additions & 9 deletions gtk/src/toga_gtk/documents.py

This file was deleted.

2 changes: 0 additions & 2 deletions gtk/src/toga_gtk/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from . import dialogs
from .app import App
from .command import Command
from .documents import Document
from .fonts import Font
from .icons import Icon
from .images import Image
Expand Down Expand Up @@ -42,7 +41,6 @@ def not_implemented(feature):
"not_implemented",
"App",
"Command",
"Document",
# Resources
"Font",
"Icon",
Expand Down
9 changes: 0 additions & 9 deletions winforms/src/toga_winforms/documents.py

This file was deleted.

2 changes: 0 additions & 2 deletions winforms/src/toga_winforms/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from . import dialogs
from .app import App
from .command import Command
from .documents import Document
from .fonts import Font
from .icons import Icon
from .images import Image
Expand Down Expand Up @@ -42,7 +41,6 @@ def not_implemented(feature):
"not_implemented",
"App",
"Command",
"Document",
# Resources
"Font",
"Icon",
Expand Down

0 comments on commit ccbc45b

Please sign in to comment.