Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add zh_cn char and column width space #27

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion unimatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
refreshing, 100 uses none. Use negative numbers for
even lower speeds. Default=85

-S SPACE Integer up to 5. Space between columns

-t TIME Exit the process after TIME seconds

-u CUSTOM_CHARACTERS Your own string of characters to display. Enclose in
Expand All @@ -79,6 +81,7 @@
-h --help
-l --character-list=CHARACTER_LIST
-s --speed=SPEED
-S --space=space
-n --no-bold
-o --status-off
-t --time
Expand Down Expand Up @@ -107,6 +110,7 @@
s A subset of symbols actually used in the Matrix films ( -=*_+|:<>" )
S All common keyboard symbols ( `-=~!z#$%^&*()_+[]{}|\;':",./<>?" )
u Custom characters selected using -u switch
z chinese characters

For example: '-l naAS' or '--character_list=naAS' will give something similar
to the output of the original cmatrix program in its default mode.
Expand Down Expand Up @@ -201,6 +205,10 @@
parser.add_argument('-w', '--single-wave',
help='runs a single "wave" of green rain then exits',
action='store_true')
parser.add_argument('-S', '--space',
help='space, integer up to 5. Default=1',
default=1,
type=int)

args = parser.parse_args()

Expand Down Expand Up @@ -231,6 +239,12 @@
'S': '`-=~!@#$%^&*()_+[]{}|\;\':",./<>?"',
'u': args.custom_characters}

zhcn_chars=""
for ch in range(0x4e00, 0x9fa6):
zhcn_chars += chr(ch)
# zhcn_chars +=" "
char_set["z"]=zhcn_chars

colors_str = {
'green': curses.COLOR_GREEN,
'red': curses.COLOR_RED,
Expand All @@ -246,6 +260,11 @@
start_bg = colors_str[args.bg_color]

speed = args.speed

width_space = args.space
if width_space >5 :
width_space=5

start_delay = (100 - speed) * 10

runtime = None
Expand Down Expand Up @@ -293,7 +312,8 @@ def __init__(self, screen):
self.row_count = rows
self.size_changed = False
self.columns = []
for col in range(0, cols, 2):
#for col in range(0, cols, 2):
for col in range(0, cols, width_space*2):
self.columns.append(Column(col, self.row_count))
self.nodes = []
self.flashers = set()
Expand Down