diff --git a/ofscraper/classes/table/app.py b/ofscraper/classes/table/app.py index 4adceb0f..f4d5b8d5 100644 --- a/ofscraper/classes/table/app.py +++ b/ofscraper/classes/table/app.py @@ -44,12 +44,13 @@ def __call__(self, *args, **kwargs): self.run() def compose(self): - return composer(read_args.retriveArgs()) + try: + return composer() + except Exception as e: + pass def on_ready(self) -> None: self.init_table() - self.query_one("#options_sidebar").toggle_class("-hidden") - self.query_one("#page_option_sidebar").toggle_class("-hidden") logger.add_widget(self.query_one("#console_page").query_one(OutConsole)) diff --git a/ofscraper/classes/table/compose.py b/ofscraper/classes/table/compose.py index bcef1ba4..137f3aaa 100644 --- a/ofscraper/classes/table/compose.py +++ b/ofscraper/classes/table/compose.py @@ -1,4 +1,4 @@ -from textual.containers import Container, Horizontal, Vertical +from textual.containers import Container, Horizontal, Vertical,HorizontalGroup,VerticalGroup from textual.widgets import Button, ContentSwitcher, Rule,Static from ofscraper.classes.table.fields.datefield import DateField @@ -16,81 +16,80 @@ from ofscraper.classes.table.const import AMOUNT_PER_PAGE,START_PAGE -def composer(args): +def composer(): with Horizontal(id="buttons"): yield Button("DataTable", id="table") yield Button("Console", id="console") with ContentSwitcher(initial="table_page"): - with Vertical(id="table_page"): - with Horizontal(): - with Vertical(classes="table_info"): - yield Static("[bold blue]Toggle Sidebar for search[/bold blue]: Ctrl+S",markup=True) - yield Static("[bold blue]Toggle Page Selection[/bold blue]: Ctrl+T",markup=True) - yield Rule( orientation="vertical") - with Vertical(classes="table_info"): - yield Static("[bold blue]Navigate Table[/bold blue]: Arrows",markup=True) - yield Static('[bold blue]Filter Table via Cell[/bold blue]: ; or \'',markup=True) - yield Static("[bold blue]Add to Cart[/bold blue]: Click cell in \'download cart\' Column",markup=True) + with VerticalGroup(id="table_page"): + with Container(id="table_header"): + with Horizontal(): + with Vertical(classes="table_info"): + yield Static("[bold blue]Toggle Sidebar for search[/bold blue]: Ctrl+S",markup=True) + yield Static("[bold blue]Toggle Page Selection[/bold blue]: Ctrl+T",markup=True) + yield Rule( orientation="vertical") + with Vertical(classes="table_info"): + yield Static("[bold blue]Navigate Table[/bold blue]: Arrows",markup=True) + yield Static('[bold blue]Filter Table via Cell[/bold blue]: ; or \'',markup=True) + yield Static("[bold blue]Add to Cart[/bold blue]: Click cell in \'download cart\' Column",markup=True) + yield Rule() + for _ in range(3): + yield Static("",classes="search_info",shrink=True,markup=True) yield Rule() - for _ in range(3): - yield Static("",classes="search_info",shrink=True,markup=True) - yield Rule() - with Horizontal(id="data"): - yield Button("Reset", id="reset") - yield Button( - ">> Send Downloads to OF-Scraper", id="send_downloads" - ) - - - with Container(id="table_main"): - with Sidebar(id="page_option_sidebar"): - yield Button("Enter", id="page_enter") - for ele in ["Page"]: - yield PostiveNumField(ele, default=START_PAGE) - for ele in ["Num_Per_Page"]: - yield PostiveNumField(ele, default=AMOUNT_PER_PAGE) - yield Button("Enter", id="page_enter2") - - with Sidebar(id="options_sidebar"): - with Container(id="main_options"): - yield Button("Filter", id="filter") - yield Rule() - for ele in ["Text"]: - yield TextSearch(ele) - yield Rule() - - for ele in ["Media_ID"]: - yield NumField(ele, default=args.media_id) - for ele in ["Post_ID"]: - yield NumField(ele, default=args.post_id) - yield Rule() - for ele in ["Post_Media_Count"]: - yield NumField(ele) - yield Rule() - for ele in ["Price"]: - yield PriceField(ele) - yield Rule() - for ele in ["Post_Date"]: - yield DateField(ele) - yield Rule() - for ele in ["Length"]: - yield TimeField(ele) - yield Rule() - yield SelectField("Downloaded") - yield SelectField("Unlocked") - yield Rule() - for ele in ["Mediatype"]: - yield MediaField(ele) - for ele in ["Responsetype"]: - yield ResponseField(ele) - yield Rule() - for ele in ["username"]: - yield StrInput(id=ele) - yield Rule() - yield Button("Filter", id="filter2") + with HorizontalGroup(id="data"): + yield Button("Reset", id="reset") + yield Button( + ">> Send Downloads to OF-Scraper", id="send_downloads" + ) + with VerticalGroup(id="table_main"): yield DataTable(id="data_table") yield DataTable(id="data_table_hidden") + with Sidebar(id="page_option_sidebar",classes="-hidden"): + yield Button("Enter", id="page_enter") + for ele in ["Page"]: + yield PostiveNumField(ele, default=START_PAGE) + for ele in ["Num_Per_Page"]: + yield PostiveNumField(ele, default=AMOUNT_PER_PAGE) + yield Button("Enter", id="page_enter2") + + with Sidebar(id="options_sidebar",classes="-hidden"): + with Container(id="main_options"): + yield Button("Filter", id="filter") + yield Rule() + for ele in ["Text"]: + yield TextSearch(ele) + yield Rule() + + for ele in ["Media_ID"]: + yield NumField(ele) + for ele in ["Post_ID"]: + yield NumField(ele) + yield Rule() + for ele in ["Post_Media_Count"]: + yield NumField(ele) + yield Rule() + for ele in ["Price"]: + yield PriceField(ele) + yield Rule() + for ele in ["Post_Date"]: + yield DateField(ele) + yield Rule() + for ele in ["Length"]: + yield TimeField(ele) + yield Rule() + yield SelectField("Downloaded") + yield SelectField("Unlocked") + yield Rule() + for ele in ["Mediatype"]: + yield MediaField(ele) + for ele in ["Responsetype"]: + yield ResponseField(ele) + yield Rule() + for ele in ["username"]: + yield StrInput(id=ele) + yield Rule() + yield Button("Filter", id="filter2") with Vertical(id="console_page"): - yield OutConsole() + yield OutConsole(id="console_page", classes="-hidden") diff --git a/ofscraper/classes/table/css.py b/ofscraper/classes/table/css.py index b2b4093e..4a882f92 100644 --- a/ofscraper/classes/table/css.py +++ b/ofscraper/classes/table/css.py @@ -1,7 +1,43 @@ -CSS = """ - Screen { +Widgets=""" + Sidebar.-hidden { + display: none; + } + +Widget { + column-span:4; + row-span:2; + } +Screen { layers: sidebar; - overflow: hidden; + overflow-y:scroll; + overflow-x:scroll; + } + + Button{ +height:3; +} +""" + +Table=""" + #data_table{ + margin-bottom:5; + margin-top:2; + height:70%; + min-height:40; + } + + #data_table_hidden { + display:None; + } + + #table_main{ + height:70%; + min-height:50; + } + #table_header{ + height:30%; + max-height:18; + min-height:15; } .table_info,Static{ max-width:45; @@ -9,14 +45,16 @@ min-width:20; } +""" - #options_sidebar, #page_option_sidebar{ +Options=""" +#options_sidebar, #page_option_sidebar{ width: 45%; dock: left; layer: sidebar; overflow-y:scroll; overflow-x:scroll; - height: 100%; + height: 100vh; } @@ -35,38 +73,10 @@ margin-top:2; } -#buttons{ -height:15vh; -} - - Sidebar.-hidden { - display: none; - } - - #data_table { - margin-bottom:2; - height:95vh; - width:100vw; - } - - - #data_table_holder { - overflow-x:scroll; - overflow-y:scroll; - width:80%; - height:80%; - } +""" - Widget { - column-span:4; - row-span:2; - } - +CSS=""" #post_id,#media_id{ column-span:2; } - #table_main{ - height:6fr; - } - - """ \ No newline at end of file +""" + Widgets+Table+Options \ No newline at end of file