mum4k / termdash

Terminal based dashboard.
Apache License 2.0
2.71k stars 135 forks source link

How to use in tview #321

Open sayi65 opened 2 years ago

sayi65 commented 2 years ago

Hello, my golang project use tview(https://github.com/rivo/tview) I would like to put this chat in tview, is there a way?

mum4k commented 2 years ago

Hello @sayi65 and thank you for reaching out.

I am sorry, but I don't understand the question. Can you help me understand what you mean by "put this chat in tview" ?

sayi65 commented 2 years ago

Hello @mum4k

I want to put the barchart in the pages of the tview I would like to know if there is any way to do this

mum4k commented 2 years ago

Thank you for explaining the question.

I think this would be doable, but you would have to write some API adapters. Looks like tview also uses tcell. Both tview and termdash take over the entire screen with tcell, so they aren't directly compatible. However you could run tview and import just the widget code from the termdash repository. If you then write an adapter from the Widget API to what tview uses when talking to tcell, you should be able to make any widgets from her work with tview.

sayi65 commented 2 years ago

@mum4k Thanks for the response. 

I think I have worked out how to put barchat into tview. However, when I change the screen from barchat to tview, it collapses. The current process is to use the TAB keyboard to change screens. is there any way to clear the barchat?

mum4k commented 2 years ago

@sayi65 thank you for sharing the screenshots.

First we need to ensure that the barchart is no longer periodically drawing itself onto the terminal after we switch away.

Secondly this looks like we may need to instruct tview to clear / redraw the entire screen after we switch away form the barchart and stop drawing it. I am not familiar with tview and its API. Do you know if tview allows such a call?

sayi65 commented 2 years ago

@mum4k thank you for your comment. Does it occur when transitioning from the barchat to the page on the tview side, so there is a process to clear in the barchat? Since barchat uses containers, is there a way to clear the containers? If the following function can clear the screen?

https://github.com/mum4k/termdash/blob/d2b202a0d3b9f8868fefc02a0ead603b09a4de19/container/options.go#L380

mum4k commented 2 years ago

@sayi65 is there any way how you could share the code that produce the images uploaded in the thread? Is there a repository or a branch I could look at?

That might help me to point you to the to a function or a process that would clear the screen.

sayi65 commented 2 years ago

@mum4k Sorry for the late reply.Since this project is private. I will modify the code and share it later.