Skip to content

Commit

Permalink
Remove the redundant resource API. (bartfeenstra#929)
Browse files Browse the repository at this point in the history
  • Loading branch information
bartfeenstra authored Dec 5, 2022
1 parent 74c2cdb commit f0ac277
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 22 deletions.
10 changes: 1 addition & 9 deletions betty/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
from babel.core import parse_locale
from babel.localedata import locale_identifiers

from betty.resource import Releaser, Acquirer

try:
from typing import Self # type: ignore
except ImportError:
Expand Down Expand Up @@ -116,7 +114,7 @@ def dump(self) -> DumpedConfiguration:


@reactive
class App(Acquirer, Releaser, Configurable[AppConfiguration], ReactiveInstance):
class App(Configurable[AppConfiguration], ReactiveInstance):
def __init__(self, *args, **kwargs):
from betty.url import AppUrlGenerator, StaticPathUrlGenerator

Expand Down Expand Up @@ -167,12 +165,6 @@ def acquire(self) -> None:
self._acquire_contexts.enter_context(Translations(NullTranslations()))
# Then acquire the actual locale.
self._acquire_contexts.enter_context(self.acquire_locale())

for extension in self.extensions.flatten():
if isinstance(extension, Acquirer):
extension.acquire()
if isinstance(extension, Releaser):
self._acquire_contexts.callback(extension.release)
except BaseException:
self.release()
raise
Expand Down
6 changes: 1 addition & 5 deletions betty/gui/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import functools
import traceback
from typing import Optional, Callable, Any, List, TYPE_CHECKING
from typing import Optional, Callable, Any, TYPE_CHECKING

if TYPE_CHECKING:
from betty.builtins import _
Expand Down Expand Up @@ -69,8 +69,6 @@ def __exit__(self, exc_type, exc_val, exc_tb):


class Error(QMessageBox):
_errors: List[Error] = []

def __init__(
self,
message: str,
Expand All @@ -83,7 +81,6 @@ def __init__(
with App():
self.setWindowTitle('{error} - Betty'.format(error=_("Error")))
self.setText(message)
Error._errors.append(self)

standard_button = QMessageBox.StandardButton.Close
self.setStandardButtons(standard_button)
Expand All @@ -93,7 +90,6 @@ def __init__(
self.button(QMessageBox.StandardButton.Close).clicked.connect(self.close) # type: ignore

def closeEvent(self, event: QCloseEvent) -> None:
Error._errors.remove(self)
if self._close_parent:
parent = self.parent()
if isinstance(parent, QWidget):
Expand Down
8 changes: 0 additions & 8 deletions betty/resource.py

This file was deleted.

0 comments on commit f0ac277

Please sign in to comment.