Skip to content

Commit

Permalink
refactor: naming
Browse files Browse the repository at this point in the history
  • Loading branch information
kraanzu committed Nov 18, 2024
1 parent a3d674f commit 82b5a5b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dooit/ui/api/api_components/vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def show_confirm(self, value: bool):

@property
def mode(self) -> str:
return self.api.app._mode
return self.api.app.dooit_mode

@property
def theme(self) -> DooitThemeBase:
Expand Down
2 changes: 1 addition & 1 deletion dooit/ui/api/dooit_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(self, app: "Dooit") -> None:
self.app = app
self.plugin_manager = PluginManager(self)
self.css = CssManager()
self.keys = KeyManager(self.app.get_mode)
self.keys = KeyManager(self.app.get_dooit_mode)
self.layouts = LayoutManager(self.app)
self.formatter = Formatter(self)
self.bar = BarManager(self)
Expand Down
12 changes: 6 additions & 6 deletions dooit/ui/tui.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Dooit(App):

def __init__(self, connection_string: Optional[str] = None):
super().__init__(watch_css=True)
self._mode: ModeType = "NORMAL"
self.dooit_mode: ModeType = "NORMAL"
manager.connect(connection_string)

async def base_setup(self):
Expand All @@ -45,7 +45,7 @@ async def base_setup(self):
self.push_screen("main")

async def setup_poller(self):
self.set_interval(1, self.poll)
self.set_interval(1, self.poll_dooit_db)

async def on_mount(self):
await self.base_setup()
Expand All @@ -67,10 +67,10 @@ def bar(self) -> StatusBar:
def bar_switcher(self) -> BarSwitcher:
return self.query_one(BarSwitcher)

def get_mode(self) -> ModeType:
return self._mode
def get_dooit_mode(self) -> ModeType:
return self.dooit_mode

async def poll(self): # pragma: no cover
async def poll_dooit_db(self): # pragma: no cover
def refresh_all_trees():
trees = self.query(ModelTree)
for tree in trees:
Expand All @@ -91,7 +91,7 @@ def shutdown(self, _: ShutDown):

@on(ModeChanged)
def change_status(self, event: ModeChanged):
self._mode = event.mode
self.dooit_mode = event.mode
if event.mode == "NORMAL":
self.workspace_tree.refresh_options()
todos_tree = self.api.vars.todos_tree
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ui/test_startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ async def test_startup():
app.bar_switcher
app.workspace_tree

assert app.get_mode() == "NORMAL"
assert app.get_dooit_mode() == "NORMAL"

0 comments on commit 82b5a5b

Please sign in to comment.