mirror of
https://github.com/rr-/pq-cli.git
synced 2026-09-29 23:01:00 -06:00
ui/curses: add colors
This commit is contained in:
1 parent
7a835c615e
commit
9fc078ad94
19 files changed
+137
-42
No files matched your search
@@ -8,11 +8,10 @@ from pqcli.roster import Roster
|
||||
from pqcli.ui.curses.event_handler import EventHandler
|
||||
from pqcli.ui.curses.util import KEYS_DOWN, KEYS_LEFT, KEYS_RIGHT, KEYS_UP
|
||||
from pqcli.ui.curses.views.base_view import BaseView
|
||||
from pqcli.ui.curses.widgets import Scrollable, Widget
|
||||
from pqcli.ui.curses.widgets import Focusable, Scrollable, Widget
|
||||
|
||||
from .character_sheet_window import CharacterSheetWindow
|
||||
from .equipment_window import EquipmentWindow
|
||||
from .focusable import Focusable
|
||||
from .inventory_window import InventoryWindow
|
||||
from .plot_window import PlotWindow
|
||||
from .quest_book_window import QuestBookWindow
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import typing as T
|
||||
|
||||
from pqcli.mechanic import Player, StatType
|
||||
from pqcli.ui.curses.widgets import Focusable
|
||||
|
||||
from .focusable import Focusable
|
||||
from .progress_bar_window import DataTableProgressBarWindow
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import typing as T
|
||||
|
||||
from pqcli.mechanic import EquipmentType, Player
|
||||
from pqcli.ui.curses.widgets import DataTable, WindowWrapper
|
||||
|
||||
from .focusable import Focusable
|
||||
from pqcli.ui.curses.widgets import DataTable, Focusable, WindowWrapper
|
||||
|
||||
|
||||
class EquipmentWindow(Focusable, WindowWrapper):
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
import contextlib
|
||||
import typing as T
|
||||
|
||||
from pqcli.ui.curses.event_handler import EventHandler
|
||||
|
||||
|
||||
class Focusable:
|
||||
def __init__(self, *args: T.Any, **kwargs: T.Any) -> None:
|
||||
self._focused = False
|
||||
self._on_focus_change = EventHandler()
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
@property
|
||||
def focused(self) -> bool:
|
||||
return self._focused
|
||||
|
||||
@focused.setter
|
||||
def focused(self, focused: bool) -> None:
|
||||
self._focused = focused
|
||||
self._on_focus_change()
|
||||
|
||||
@contextlib.contextmanager
|
||||
def focus_standout(self, win: T.Any) -> T.Generator:
|
||||
if self._focused:
|
||||
win.standout()
|
||||
yield
|
||||
if self._focused:
|
||||
win.standend()
|
||||
@@ -3,9 +3,13 @@ import typing as T
|
||||
|
||||
from pqcli.lingo import to_roman
|
||||
from pqcli.mechanic import InventoryItem, Player
|
||||
from pqcli.ui.curses.widgets import DataTable, ProgressBar, WindowWrapper
|
||||
from pqcli.ui.curses.widgets import (
|
||||
DataTable,
|
||||
Focusable,
|
||||
ProgressBar,
|
||||
WindowWrapper,
|
||||
)
|
||||
|
||||
from .focusable import Focusable
|
||||
from .progress_bar_window import DataTableProgressBarWindow
|
||||
|
||||
|
||||
|
||||
@@ -2,9 +2,8 @@ import typing as T
|
||||
|
||||
from pqcli.lingo import act_name
|
||||
from pqcli.mechanic import Player
|
||||
from pqcli.ui.curses.widgets import ListBox, WindowWrapper
|
||||
from pqcli.ui.curses.widgets import Focusable, ListBox, WindowWrapper
|
||||
|
||||
from .focusable import Focusable
|
||||
from .progress_bar_window import ListBoxProgressBarWindow
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import curses
|
||||
import typing as T
|
||||
|
||||
from pqcli.ui.curses.views.game_view.focusable import Focusable
|
||||
from pqcli.ui.curses.widgets import (
|
||||
DataTable,
|
||||
Focusable,
|
||||
ListBox,
|
||||
ProgressBar,
|
||||
WindowWrapper,
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import typing as T
|
||||
|
||||
from pqcli.mechanic import Player
|
||||
from pqcli.ui.curses.widgets import ListBox, WindowWrapper
|
||||
from pqcli.ui.curses.widgets import Focusable, ListBox, WindowWrapper
|
||||
|
||||
from .focusable import Focusable
|
||||
from .progress_bar_window import ListBoxProgressBarWindow
|
||||
|
||||
|
||||
|
||||
@@ -2,9 +2,7 @@ import typing as T
|
||||
|
||||
from pqcli.lingo import to_roman
|
||||
from pqcli.mechanic import Player, Spell
|
||||
from pqcli.ui.curses.widgets import DataTable, WindowWrapper
|
||||
|
||||
from .focusable import Focusable
|
||||
from pqcli.ui.curses.widgets import DataTable, Focusable, WindowWrapper
|
||||
|
||||
|
||||
class SpellBookWindow(Focusable, WindowWrapper):
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import typing as T
|
||||
|
||||
from pqcli.mechanic import Player
|
||||
from pqcli.ui.curses.widgets import Label, ProgressBar, WindowWrapper
|
||||
|
||||
from .focusable import Focusable
|
||||
from pqcli.ui.curses.widgets import (
|
||||
Focusable,
|
||||
Label,
|
||||
ProgressBar,
|
||||
WindowWrapper,
|
||||
)
|
||||
|
||||
|
||||
class TaskProgressWindow(Focusable, WindowWrapper):
|
||||
|
||||
Reference in new issue
Block a user