diff --git a/README.md b/README.md
index 66879cb..af64f0f 100644
--- a/README.md
+++ b/README.md
@@ -2,26 +2,23 @@
## Overview
-Pygame GUI library, named after the creator of Python, Guido van Rossum, believing that this library will be the first to implement a GUI completely compatible with pygame. Included is a "mini-OS" to show off all the elements. That "mini-OS" is called *Winnux 58* (**Win**dows 9**5** + **Win**dows 9**8** + Li**nux**).
-
-~~i kinda hate this name now~~
+Pygame GUI library, named after the creator of Python, Guido van Rossum, believing that this library will be the first to implement a GUI library completely compatible with pygame. Included is a "mini-OS" to show off all the elements. It's called *Winnux 58* (**Win**dows 9**5** + **Win**dows 9**8** + Li**nux**).
## Features
-- A working command line, with these *nix-style commands*:
+- A working command line, with these \*nix-style commands:
- `pwd`: print working directory
- - `ls`: list file and directories
+ - `cat`: show contents of file(s)
+ - `ls`: list files and directories
- `rm`: remove file(s)
- `cd`: change directory
- A command-line text editor, `vis`
- SNAKE! (with an incredibly high framerate soo good luck with that)
- A virtual disk to put programs in
-Please check our [wiki](https://github.com/The-UltimateGamer/GUIdo/wiki) for more details.
-
-## NEVER TRY TO MOUNT `files.img`
+Please check our [wiki](https://github.com/The-UltimateGamer/GUIdo/wiki) for more details. There is also an offline version in the `wiki` folder of this repository.
-## Directory structure:
+## Directory Structure
- `/home/`
- test.txt
@@ -32,11 +29,10 @@ Please check our [wiki](https://github.com/The-UltimateGamer/GUIdo/wiki) for mor
- kernel.py
(This is where our OS boots. **DO NOT TRY TO DELETE IT.**)
-## License Notice
+## License Agreement
Winnux 58 is brought to you under the [GNU AGPL-3.0 License](https://www.gnu.org/licenses/agpl-3.0.en.html).
-OS emulator using pygame.
Copyright (C) 2020 The-UltimateGamer & pythonleo
This program is free software: you can redistribute it and/or modify
diff --git a/README.pdf b/README.pdf
index 2b72003..b4f80f1 100644
Binary files a/README.pdf and b/README.pdf differ
diff --git a/README_zh_CN.md b/README_zh_CN.md
new file mode 100644
index 0000000..0c038b0
--- /dev/null
+++ b/README_zh_CN.md
@@ -0,0 +1,57 @@
+# GUIdo
+
+## 概览
+
+使用 pygame 的 GUI 库,名字取自 Python 的创始人,Guido van Rossum。我们相信这将会是第一个与 pygame 无缝衔接的 GUI 库。此项目包含一个”迷你操作系统“,名叫 *Winnux 58*(**Win**dows 9**5** + **Win**dows 9**8** + Li**nux**)。
+
+## 功能
+
+- 一个命令行,具有基本 \*nix 风格的指令:
+
+ - `pwd`:显示当前工作目录
+
+ - `cat`:显示一个或多个文件的内容
+
+ - `ls`:列出当前目录下的子目录与文件
+
+ - `rm`:删除一个或多个文件
+
+ - `cd`:改变当前目录
+- 命令行编辑器 `vis`
+- 贪 吃 蛇(帧率特高,祝你好运)
+- 用于存储程序的虚拟磁盘
+
+想了解更多细节,请查阅我们的 [wiki](https://github.com/The-UltimateGamer/GUIdo/wiki)。同时,本仓库的 `wiki` 目录下有离线版本。
+
+## 文件目录
+
+- `/home/`
+
+ - test.txt
+
+ (为了测试 `cat` 指令的实例文档)
+
+- `/sys/`
+
+ - kernel.py
+
+ (操作系统的核心。**请不要删除它**。)
+
+## 软件许可协议
+
+Winnux 58 使用 [GNU Affero 通用公共许可证版本 3.0](https://www.gnu.org/licenses/agpl-3.0.en.html),请遵循其中的条款。
+
+Copyright (C) 2020 The-UltimateGamer & pythonleo
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as
+published by the Free Software Foundation, either version 3 of the
+License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Affero General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see .
\ No newline at end of file
diff --git a/README_zh_CN.pdf b/README_zh_CN.pdf
new file mode 100644
index 0000000..cce17e7
Binary files /dev/null and b/README_zh_CN.pdf differ
diff --git a/files.img b/files.img
index 7f5cc48..a8af33c 100644
--- a/files.img
+++ b/files.img
@@ -12,10 +12,10 @@ from enum import Enum
width, height = 1024, 768
-def pwd(working_dir, args):
+def pwd(working_dir, args = None):
print(working_dir, end='\r')
-def ls(working_dir, args, flag=True):
+def ls(working_dir, args = None, flag = True):
files = open("files.img", 'r+', encoding="ISO-8859-1")
lines = files.read().strip('\0').split('\n')
@@ -26,9 +26,9 @@ def ls(working_dir, args, flag=True):
result.append(lines[i + 1].strip('!FNAME='))
return result
-def cat(working_dir, args):
+def cat(working_dir, args = None):
if not args:
- print("Missing argument.\rUsage: cat ", end='\r')
+ print("cat: missing argument.\rUsage: cat ", end='\r')
return
for target in args:
files = open("files.img", 'r+', encoding="ISO-8859-1")
@@ -42,11 +42,14 @@ def cat(working_dir, args):
contents.append(lines[i])
break
else:
- print("cat: %s: no such file" % target, end = '\r')
- print('\r'.join(contents))
+ print("cat: %s: no such file." % target, end = '\r')
+ print('\r'.join(contents), end='\r')
files.close()
-def rm(working_dir, args):
+def rm(working_dir, args = None):
+ if not args:
+ print("rm: missing argument.\rUsage: rm ", end='\r')
+ return
files = open("files.img", 'r+', encoding="ISO-8859-1")
to_be_written = []
target = args[0]
@@ -123,7 +126,6 @@ class Kernel:
self.dialogs[self.dialogID].mouseDown(pos, button)
except:
pass
- print(event.pos)
def mouseUp(self, pos, button):
self.apps[self.appID].mouseUp(pos, button)
def mouseMotion(self, pos):
@@ -270,7 +272,6 @@ class TxtField:
def wrap(self, txtBuffer):
self.frame += 1
- self.frame %= 60
lines = []
ptr = 0
prev_i = 0
@@ -304,7 +305,7 @@ class TxtField:
screen.blit(img, (self.x, y))
y += 16
- if self.frame <= 30: self.cursor.image.fill(pygame.Color(252, 252, 252))
+ if self.frame % 50 <= 25: self.cursor.image.fill(pygame.Color(252, 252, 252))
else: self.cursor.image.fill(pygame.Color(0, 0, 0))
lines = self.txtBuffer.count('\r') + self.txtBuffer.count('\n')
@@ -313,7 +314,7 @@ class TxtField:
self.cursor.rect.center = (self.x + (self.loc + (len(self.pwd) if not self.isVis else -2) + 1) * 9 + 8,
self.y + lines * 16 + 8)
screen.blit(self.cursor.image, self.cursor.rect)
- def cd(self, dir_name):
+ def cd(self, dir_name = None):
def process_dir(dr: str):
for d in dr.split('/'):
if d:
@@ -343,7 +344,7 @@ class TxtField:
self.pwd = '/'
dir_name = dir_name[1:]
process_dir(dir_name)
- def vis(self, args):
+ def vis(self, args = None):
self.isVis = True
if not args:
print("vis: missing argument.\rUsage: vis ", end='\r')
@@ -364,11 +365,11 @@ class TxtField:
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
+ self.loc = 0
flg = False
break
self.keyDown(event.key, True)
files.write(self.cLineStr)
- framework.launch()
elif event.type == pygame.KEYUP:
if event.key in (pygame.K_LSHIFT, pygame.K_RSHIFT):
self.shift = False
@@ -377,8 +378,7 @@ class TxtField:
elif event.type == pygame.QUIT:
pygame.quit()
sys.exit()
- framework.launch()
- self.frame += 1
+ framework.launch()
files.close()
self.isVis = False
@@ -389,15 +389,18 @@ class TxtField:
output = io.StringIO()
with redirect_stdout(output):
if main:
- if main == 'cd': self.cd(cmd[0])
- elif main == 'vis': self.vis(cmd[0])
+ if main == "cd":
+ try: self.cd(cmd[0])
+ except: print("cd: missing argument.\rUsage: cd ", end='\r')
+ elif main == "vis":
+ try: self.vis(cmd[0])
+ except: print("vis: missing argument.\rUsage: vis ", end='\r')
else:
try: exec("%s('%s', %s)" % (main, self.pwd, str(cmd)))
- except: print("%s: command not found" % on_scr, end='')
+ except: print("%s: command not found" % on_scr, end='\r')
else: pass
self.txtBuffer.append('\r')
self.txtBuffer += list(output.getvalue().rstrip('\n'))
- print(output.getvalue())
self.placeholder.append('%s# ' % self.pwd)
def keyUp(self, key):
if key == pygame.K_LSHIFT or key == pygame.K_RSHIFT:
@@ -440,7 +443,6 @@ class TxtField:
else:
self.exec_cmd(cmd)
self.txtBuffer.append('\n')
- framework.launch()
elif key == pygame.K_TAB:
for _ in range(4):
self.txtBuffer.append(' ')
@@ -463,10 +465,8 @@ class TxtField:
self.txtBuffer.insert(self.loc + self.currentLine, self.caps[chr(key)])
else:
self.txtBuffer.insert(self.loc + self.currentLine, chr(key))
- self.loc += 1
- self.maxIndex += 1
-
- framework.launch()
+ self.loc += 1
+ self.maxIndex += 1
class Secret:
def __init__(self, rect, dialogID):
@@ -609,4 +609,4 @@ If you're seeing this, then the `cat` command is working!
!FNAME=sys/
!LOC=/
-!FNAME=home/
+!FNAME=home/
\ No newline at end of file
diff --git a/stub.py b/stub.py
index 7a16018..3d660a1 100644
--- a/stub.py
+++ b/stub.py
@@ -43,6 +43,7 @@
kernel.append(dsk_spl[j])
break
- exec('\n'.join(kernel))
+ try: exec('\n'.join(kernel))
+ except: pass
img.close()
\ No newline at end of file
diff --git a/wiki/FAQ.md b/wiki/FAQ.md
index d67312b..a28c6f3 100644
--- a/wiki/FAQ.md
+++ b/wiki/FAQ.md
@@ -1,4 +1,7 @@
+# FAQ
+
## What do I need?
+
You will need:
- A working Python interpreter, version 3 and up
- The [pygame module](pygame.org) installed
@@ -8,13 +11,9 @@ Run `stub.py` either by double-clicking on it (in Windows) or using the command
## FAQ for `vis`
### How do I use `vis`?
-When you open it up through the virtual terminal, you will be put in *input mode*, which means whatever you type will be written into the file. `vis` is a *line-based* editor, meaning you can only edit the line you're on.
-Enter `vis ` to start editing a file. Press Enter whenever you have finished editing a line. The line will be immediately saved and cannot be altered again in this editing session. Press Esc to exit `vis`.
+When you open it up through the virtual terminal, you will be put in *input mode*, which means whatever you type will be written into the file. `vis` is a *line-based* editor, meaning you can only edit the line you're on.
-### Where do the files go?
-Everything you created in Winnux 58 will go into the `files.img` *virtual disk*. You can view them using the `cat` command in the virtual terminal. Note that `files.img` is NOT a traditional disk image, so don't try to mount that!
+Enter `vis ` to start editing a file. Press Enter whenever you have finished editing a line. The line will be immediately saved and cannot be altered again in this editing session. Press Esc to exit `vis`.
-## Known issues
-
- - The cursor behaves strangely in vis. It does not update regularly anymore, but rather updates at every event.
-
+### Where do the files go?
+Everything you created in Winnux 58 will go into the `files.img` *virtual disk*. You can view them using the `cat` command in the virtual terminal. Note that `files.img` is **NOT** a traditional disk image, so don't try to mount that!
\ No newline at end of file
diff --git a/wiki/FAQ.pdf b/wiki/FAQ.pdf
index d22410c..a062b95 100644
Binary files a/wiki/FAQ.pdf and b/wiki/FAQ.pdf differ
diff --git a/wiki/FAQ_zh_CN.md b/wiki/FAQ_zh_CN.md
new file mode 100644
index 0000000..e03c2cc
--- /dev/null
+++ b/wiki/FAQ_zh_CN.md
@@ -0,0 +1,24 @@
+# FAQ
+
+## 我需要什么?
+
+您将会需要:
+
+- 一个 Python 解释器,版本 3 及以上
+- [pygame](pygame.org) 模块
+
+## 我如何运行此程序?
+
+运行 `stub.py`。您可以使用命令行或者(在 Windows 系统下)双击文件。
+
+## `vis` 程序 FAQ
+
+### 我如何使用 `vis`?
+
+当您打开 `vis` 时,您会进入*输入模式*,这代表您所输入的全部内容将会写入文件。`vis` 是一个*行编辑器*,这代表着您只能更改当前行的内容(后文将加以解释)。
+
+使用 `vis <文件名>` 来开始输入文本。当您完成输入一行文字时,请按 Enter 键。这行文本将会被直接保存且您不能再修改它。要退出 `vis`,请按 Esc 键。
+
+### 我的文件被存到了哪里?
+
+您在 Winnux 58 中创建的所有内容都储存在 `files.img` *虚拟磁盘*里。您可以在虚拟命令行中使用 `cat` 命令查看文件内容。要注意的是,`files.img` **并不是**传统的磁盘映像,所以请勿装载它!
\ No newline at end of file
diff --git a/wiki/FAQ_zh_CN.pdf b/wiki/FAQ_zh_CN.pdf
new file mode 100644
index 0000000..a3a57a9
Binary files /dev/null and b/wiki/FAQ_zh_CN.pdf differ