Browse Source

demonstrate max_lines; minor improvements

Falko Schindler 3 years ago
parent
commit
090295fc57
3 changed files with 3 additions and 3 deletions
  1. 1 1
      main.py
  2. 1 1
      nicegui/elements/log.js
  3. 1 1
      nicegui/elements/log.py

+ 1 - 1
main.py

@@ -267,7 +267,7 @@ with example(ui.line_plot):
 with example(ui.log):
     from datetime import datetime
 
-    log = ui.log().classes('h-16')
+    log = ui.log(max_lines=10).classes('h-16')
     ui.button('Log time', on_click=lambda: log.push(datetime.now().strftime("%X.%f")[:-5]))
 
 with example(ui.joystick):

+ 1 - 1
nicegui/elements/log.js

@@ -7,7 +7,7 @@ Vue.component("log", {
   },
   methods: {
     push(line) {
-      const decoded = decodeURI(line);
+      const decoded = decodeURIComponent(line);
       const textarea = document.getElementById(this.$props.jp_props.id);
       textarea.innerHTML += (num_lines ? "\n" : "") + decoded;
       textarea.scrollTop = textarea.scrollHeight;

+ 1 - 1
nicegui/elements/log.py

@@ -22,7 +22,7 @@ class Log(Element):
 
         super().__init__(LogView(max_lines=max_lines))
 
-        self.classes('border whitespace-pre font-mono').style('opacity: 1 !important')
+        self.classes('border whitespace-pre font-mono').style('opacity: 1 !important; cursor: text !important')
 
     async def push_async(self, line: str):