refactor AboutCommand into own file

master
Felix Pankratz 5 months ago
parent 2879d2abb1
commit a885298d00

@ -0,0 +1,24 @@
from textual.command import DiscoveryHit, Provider, Hits, Hit
class AboutCommand(Provider):
'''Class to represent the About command in the menu'''
async def discover(self) -> Hits:
yield DiscoveryHit(
display='About',
command=self.app.action_toggle_sidebar,
help='Link to repo etc.'
)
async def search(self, query: str) -> Hits:
'''Called when the search functionality is used'''
matcher = self.matcher(query)
command = "About"
score = matcher.match(command)
if score > 0:
yield Hit(
score,
matcher.highlight(command),
self.app.action_toggle_sidebar,
'Link to repo etc.'
)

@ -4,12 +4,12 @@ from textual.app import App, ComposeResult
from textual.widgets import Header, Input, Static, Button
from textual.containers import Horizontal, Container
from textual.validation import Number
from textual.command import DiscoveryHit, Provider, Hits, Hit
from textual.reactive import reactive
from datetime import datetime
from BingoBoard import BingoBoard
from AboutCommand import AboutCommand
MESSAGE = '''
Be excellent to each other!
@ -23,23 +23,6 @@ Built using [@click="app.open_link('https://textual.textualize.io/')"]Textual[/]
'''
class AboutCommand(Provider):
'''Class to represent the About command in the menu'''
async def discover(self) -> Hits:
yield DiscoveryHit(display='About', command=self.app.action_toggle_sidebar, help='Link to repo etc.')
def show_about(self) -> None:
pass
async def search(self, query: str) -> Hits:
'''Called when the search functionality is used'''
matcher = self.matcher(query)
command = "About"
score = matcher.match(command)
if score > 0:
yield Hit(score, matcher.highlight(command), self.app.action_toggle_sidebar, 'Link to repo etc.')
class Sidebar(Container):
'''Class to represent the sidebar'''

Loading…
Cancel
Save