mirror of
https://github.com/gizak/termui.git
synced 2025-05-01 22:18:15 +08:00
Remove md
This commit is contained in:
parent
003059e215
commit
67290bc16d
@ -1,32 +0,0 @@
|
||||
Overview
|
||||
---
|
||||
|
||||
Bufferer
|
||||
---
|
||||
|
||||
Block
|
||||
---
|
||||
|
||||
BarChart
|
||||
---
|
||||
|
||||
Canvas
|
||||
---
|
||||
|
||||
Gauge
|
||||
---
|
||||
|
||||
LineChart
|
||||
---
|
||||
|
||||
MBarChart
|
||||
---
|
||||
|
||||
Par
|
||||
---
|
||||
|
||||
Sparkline
|
||||
---
|
||||
|
||||
Sparklines
|
||||
---
|
@ -1,14 +0,0 @@
|
||||
Event System
|
||||
---
|
||||
|
||||
Keyboard Events
|
||||
---
|
||||
|
||||
Mouse Events
|
||||
---
|
||||
|
||||
Window Events
|
||||
---
|
||||
|
||||
Custom Events
|
||||
---
|
@ -1,15 +0,0 @@
|
||||
[termui]() is a cross-platform, easy-to-compile, and fully-customizable terminal dashboard. It aims to provide a terminal front end for your applications with less struggle:
|
||||
|
||||
> 
|
||||
>
|
||||
> _cast under osx 10.10; Terminal.app; Menlo Regular 12pt._
|
||||
|
||||
This guide describes the essential parts used to build a interface, which includes:
|
||||
|
||||
- Installation & Usage
|
||||
- Layout System
|
||||
- Event System
|
||||
- Theming
|
||||
- Components
|
||||
|
||||
[Quickstart](quickstart.md) is the way to go for starters and [Recipes](recipes.md) contains some practical resolutions you might need.
|
@ -1,26 +0,0 @@
|
||||
Overview
|
||||
---
|
||||
|
||||
termui offers two layout system: [Absolute]() and [Grid](). The two concept actually spawned from Web:
|
||||
|
||||
- The __Absolute layout__ is a plain coordination system, like [CSS position property](https://developer.mozilla.org/en/docs/Web/CSS/position) `position: absolute`. You will need manually assign `.X`, `.Y`, `.Width` and `.Height` to a component.
|
||||
- The __Grid system__ actually is a simplified version of [the 12 columns CSS grid system](http://www.w3schools.com/bootstrap/bootstrap_grid_system.asp) on terminal. You do not need to bother setting positions and width properties, these values will be synced up according to their containers.
|
||||
|
||||
!!! note
|
||||
`Align` property can help you set your component position based on terminal window. Find more at [Magic Variables](#magic-variables)
|
||||
|
||||
__Cons and pros:__
|
||||
|
||||
- Use of Absolute layout gives you maximum control over how to arrange your components, while you have
|
||||
to put a little more effort to set things up. Fortunately there are some "magic variables" may help you out.
|
||||
- Grid layout can save you some time, it adjusts components location and size based on it's container. But note that you do need to set `.Height` property to each components because termui can not decide it for you.
|
||||
|
||||
|
||||
Absolute Layout
|
||||
---
|
||||
|
||||
Grid Layout
|
||||
---
|
||||
|
||||
Magic Variables
|
||||
---
|
@ -1,80 +0,0 @@
|
||||
Installation
|
||||
---
|
||||
|
||||
Since [termui](https://github.com/gizak/termui) is a Go lib, we will need a working Go environment to begin with. If you have not set it up, there is a great intro you can follow up: [How to write Go code](https://golang.org/doc/code.html).
|
||||
|
||||
Once you have the environment set up, you can proceed to install termui by the following command:
|
||||
|
||||
`go get github.com/gizak/termui`
|
||||
|
||||
The current version of termui is v2. If you are working with the old version of termui or the new version does not seem right to you, you can always go back to v1 version by:
|
||||
|
||||
`go get gopkg.in/gizak/termui.v1`
|
||||
|
||||
!!! note
|
||||
v2 has many features implemented which you can not find in v1, such as new event system and asynchronous rendering. To find more about versions difference in section [Versions](versions.md).
|
||||
|
||||
|
||||
Usage
|
||||
---
|
||||
|
||||
Let's throw an simple example to get our feet wet:
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import ui "github.com/gizak/termui" // use ui as an alias
|
||||
|
||||
func main() {
|
||||
err := ui.Init()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer ui.Close()
|
||||
|
||||
p := ui.NewPar(":PRESS q TO QUIT DEMO")
|
||||
p.Height = 3
|
||||
p.Width = 50
|
||||
p.TextFgColor = ui.ColorWhite
|
||||
p.BorderLabel = "Text Box"
|
||||
p.BorderFg = ui.ColorCyan
|
||||
|
||||
ui.Render(p) // feel free to call Render, it's async and non-block
|
||||
|
||||
ui.Handle("/sys/kbd/q",func(e ui.Event){
|
||||
ui.StopLoop()
|
||||
})
|
||||
|
||||
ui.Loop()
|
||||
}
|
||||
```
|
||||
There are only around 20 lines for the main function. Break this down into 4 parts:
|
||||
|
||||
1. __Init termui__:
|
||||
`ui.Init()` initializes the termui. From this point, termui will take over your terminal display.
|
||||
`ui.Close()` closes resources and cleans up your terminal content. Make sure it is called before exit or you will end up with a messed up looking terminal.
|
||||
|
||||
2. __Build your component__:
|
||||
`ui.NewPar(:PRESS q TO QUIT DEMO)` returns a structure representing a paragraph component. You can assign position, size, text colour, border and many other properties to a component.
|
||||
|
||||
3. __Draw your component on display__:
|
||||
`ui.Render(p)` renders p onto terminal display.
|
||||
|
||||
4. __Handle events__:
|
||||
`ui.Handle("/sys/kbd/q", func(e Event))` registers an event handler for event: key q is pressed.
|
||||
`ui.StopLoop()` exits the event listening loop invoked by `ui.Loop()`.
|
||||
`ui.Loop()` makes the program stops at here and start listening & handling events. Call
|
||||
`ui.StopLoop()` to leave the circle.
|
||||
|
||||
The example code gives us:
|
||||
|
||||
> 
|
||||
|
||||
Now you can press q to quit the program.
|
||||
|
||||
After knowing of some basics, next we can discover more about:
|
||||
|
||||
1. how to set component location in [Layouts](layouts.md)
|
||||
2. how to capture and handle events in [Events](events.md)
|
||||
3. the different [components](components.md)
|
||||
4. check out some real world examples in [recipes](recipes.md)
|
@ -1 +0,0 @@
|
||||
_Sorry, it is still Work in Progress..._
|
@ -1,8 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# termui documentation build configuration file, created by
|
||||
# sphinx-quickstart on Wed Nov 16 07:04:00 2016.
|
||||
# sphinx-quickstart on Wed Nov 16 23:25:36 2016.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its
|
||||
# containing dir.
|
||||
@ -49,18 +48,18 @@ source_suffix = '.rst'
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = 'termui'
|
||||
copyright = '2016, gizak'
|
||||
author = 'gizak'
|
||||
project = u'termui'
|
||||
copyright = u'2016, gizak'
|
||||
author = u'gizak'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = 'v2'
|
||||
version = u'v2'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = 'v2'
|
||||
release = u'v2'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
@ -134,7 +133,7 @@ html_theme = 'alabaster'
|
||||
# The name for this set of Sphinx documents.
|
||||
# "<project> v<release> documentation" by default.
|
||||
#
|
||||
# html_title = 'termui vv2'
|
||||
# html_title = u'termui vv2'
|
||||
|
||||
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||
#
|
||||
@ -217,8 +216,8 @@ html_static_path = ['_static']
|
||||
|
||||
# Language to be used for generating the HTML full-text search index.
|
||||
# Sphinx supports the following languages:
|
||||
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
|
||||
# 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr', 'zh'
|
||||
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
|
||||
# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh'
|
||||
#
|
||||
# html_search_language = 'en'
|
||||
|
||||
@ -260,8 +259,8 @@ latex_elements = {
|
||||
# (source start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
(master_doc, 'termui.tex', 'termui Documentation',
|
||||
'gizak', 'manual'),
|
||||
(master_doc, 'termui.tex', u'termui Documentation',
|
||||
u'gizak', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
@ -302,7 +301,7 @@ latex_documents = [
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
(master_doc, 'termui', 'termui Documentation',
|
||||
(master_doc, 'termui', u'termui Documentation',
|
||||
[author], 1)
|
||||
]
|
||||
|
||||
@ -317,7 +316,7 @@ man_pages = [
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
(master_doc, 'termui', 'termui Documentation',
|
||||
(master_doc, 'termui', u'termui Documentation',
|
||||
author, 'termui', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
Before Width: | Height: | Size: 152 KiB After Width: | Height: | Size: 152 KiB |
Before Width: | Height: | Size: 125 KiB After Width: | Height: | Size: 125 KiB |
@ -1,8 +1,20 @@
|
||||
.. termui documentation master file, created by
|
||||
sphinx-quickstart on Wed Nov 16 07:04:00 2016.
|
||||
sphinx-quickstart on Wed Nov 16 23:25:36 2016.
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
.. pages:
|
||||
- Home: 'index.md'
|
||||
- Quickstart: 'quickstart.md'
|
||||
- Recipes: 'recipes.md'
|
||||
- References:
|
||||
- Layouts: 'layouts.md'
|
||||
- Components: 'components.md'
|
||||
- Events: 'events.md'
|
||||
- Themes: 'themes.md'
|
||||
- Versions: 'versions.md'
|
||||
- About: 'about.md'
|
||||
|
||||
Welcome to termui's documentation!
|
||||
==================================
|
||||
|
28
mkdocs.yml
28
mkdocs.yml
@ -1,28 +0,0 @@
|
||||
pages:
|
||||
- Home: 'index.md'
|
||||
- Quickstart: 'quickstart.md'
|
||||
- Recipes: 'recipes.md'
|
||||
- References:
|
||||
- Layouts: 'layouts.md'
|
||||
- Components: 'components.md'
|
||||
- Events: 'events.md'
|
||||
- Themes: 'themes.md'
|
||||
- Versions: 'versions.md'
|
||||
- About: 'about.md'
|
||||
|
||||
site_name: termui
|
||||
repo_url: https://github.com/gizak/termui/
|
||||
site_description: 'termui user guide'
|
||||
site_author: gizak
|
||||
|
||||
docs_dir: '_docs'
|
||||
|
||||
theme: readthedocs
|
||||
|
||||
markdown_extensions:
|
||||
- smarty
|
||||
- def_list
|
||||
- footnotes
|
||||
- tables
|
||||
- admonition
|
||||
- toc
|
Loading…
x
Reference in New Issue
Block a user