]>
git.wh0rd.org - gnudebbugs.git/blob - src/gnudebbugs/ui/__init__.py
1 # Copyright (C) 2021 Free Software Foundation, Inc.
3 # This program is free software: you can redistribute it and/or modify it under
4 # the terms of the GNU Lesser General Public License as published by the Free
5 # Software Foundation, either version 3 of the License, or at your option) any
8 # This program is distributed in the hope that it will be useful, but WITHOUT
9 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 # You should have received a copy of the GNU Lesser General Public License
14 # along with this program. If not, see <https://www.gnu.org/licenses/>.
16 """Common UI settings."""
20 from .. import BaseError
23 class Error(BaseError
):
24 """Base UI error class."""
27 class MissingUrwidError(Error
):
28 """The urwid module is unavailable."""
31 class UIBase(abc
.ABC
):
32 """Base class for all UI implementations."""
37 def start(self
) -> None:
40 def stop(self
) -> None:
43 def status(self
, text
: str) -> None:
44 """Print status information."""
46 def interface_query(self
, client
, statuses
, bug_width
, summary_tags
, tags_width
, summary_states
, states_width
) -> None:
47 """Run the query interface."""
50 def get_backend(backend
: str) -> UIBase
:
51 """Helper to dynamically load the right backend."""
56 elif backend
== "urwid":
59 except ImportError as e
:
60 raise MissingUrwidError(f
'Unable to import urwid: {e}')