diff --git a/courses.py b/courses.py index 5422c78..735946c 100644 --- a/courses.py +++ b/courses.py @@ -1011,7 +1011,7 @@ def enroll_gott_workshops(): #'GOTT 5: Essentials of Blended Learning (HyFlex)2023-06-25 17:00:00': 17987, #'GOTT 1: Intro to Teaching Online with Canvas2023-05-29 17:00:00': 17985, #'GOTT 1: Intro to Teaching Online with Canvas2023-08-20 17:00:00': 17994 - 'GOTT 1: Intro to Online Teaching2024-01-02 16:00:00': 19221, + 'GOTT 1: Intro to Online Teaching2024-01-02 16:00:00': 19278, 'GOTT 2: Intro to Asynchronous Teaching and Learning2024-01-02 16:00:00': 19222, 'GOTT 5: Essentials of Blended Learning2024-01-02 16:00:00': 19223, 'GOTT 6: Intro to Live Online Teaching and Learning2024-01-14 16:00:00': 19224, @@ -1369,7 +1369,7 @@ def teacher_to_many_shells(): import os, pickle def create_sandboxes(): - courses_to_sandbox = [ (19221, ' Sandbox GOTT1 WI24'), + courses_to_sandbox = [ (19278, ' Sandbox GOTT1 WI24'), (19222, ' Sandbox GOTT2 WI24'), (19223, ' Sandbox GOTT5 WI24'), #(19224, ' Sandbox GOTT6 WI24') @@ -1387,6 +1387,7 @@ def create_sandboxes(): for crs_id, label in courses_to_sandbox: crs_info = getCourses(crs_id) + print(json.dumps(crs_info,indent=2)) c_name = crs_info['name'] print(f"Students in course {crs_id}: {c_name}" ) enrolled = course_enrollment(crs_id) diff --git a/ui.py b/ui.py new file mode 100644 index 0000000..329b94e --- /dev/null +++ b/ui.py @@ -0,0 +1,113 @@ + + + +from textual.app import App, ComposeResult +from textual.widgets import Placeholder, Static +from textual.containers import VerticalScroll +from textual import events +from textual.reactive import Reactive + +from itertools import cycle + +hellos = cycle( + [ + "Hola", + "Bonjour", + "Guten tag", + "Salve", + "Nǐn hǎo", + "Olá", + "Asalaam alaikum", + "Konnichiwa", + "Anyoung haseyo", + "Zdravstvuyte", + "Hello", + ] +) + +class Hello(Static): + # Display a greeting. + + DEFAULT_CSS = """ + Hello { + width: 40; + height: 9; + padding: 1 2; + background: $panel; + border: $secondary tall; + content-align: center middle; + } + """ + + def on_mount(self) -> None: + self.next_word() + + def on_click(self) -> None: + self.next_word() + + def next_word(self) -> None: + # Get a new hello and update the content area. + hello = next(hellos) + self.update(f"{hello}, [b]World[/b]!") + + +class MyApp(App): + + async def startup(self): + await self.bind("q", "action_quit") + await self.push_view(self.control) + + # Left area with numbers + numbers = "\n".join(str(i) for i in range(1, 501)) + self.view.grid.set_focus("content") + h = Hello() + self.view.add_right( + #VerticalScroll(StrContent(numbers), name="Numbers"), + h, + width=50, + padding=(0,1), + ) + + # Right area with lorem ipsum placeholder + lorem_ipsum = """ + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod + tempor incididunt ut labore et dolore magna aliqua. + """ + self.view.add_right( + # VerticalScroll(StrContent(lorem_ipsum), name="Lorem"), + Static(lorem_ipsum, name="Lorem"), + width=50, + padding=(0,1), + ) + + # Command input at the bottom + self.view.add_bottom(Static("Enter command: "), height=3) + + def action_quit(self): + self.exit() + +""" +class CanvasApp(App): + # A Textual app to manage canvas. + + BINDINGS = [("d", "toggle_dark", "Toggle dark mode")] + + def compose(self) -> ComposeResult: + # Create child widgets for the app. + yield Header() + yield Footer() + + def quit(self): + self.exit() + + def action_toggle_dark(self) -> None: + # An action to toggle dark mode. + self.dark = not self.dark +""" + +def text_app(): + app = MyApp() + app.run() + + +text_app() \ No newline at end of file