From 16f7172db6f14595de1806f2a4d885c01150c4fa Mon Sep 17 00:00:00 2001 From: The-UltimateGamer <2357931342@qq.com> Date: Thu, 27 Aug 2020 20:10:28 +0800 Subject: [PATCH 1/2] Input hotfix --- files.img | 8 ++++++++ kernel.py | 39 ++++++++++++++++++++++++++++----------- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/files.img b/files.img index 4696092..835ad46 100644 --- a/files.img +++ b/files.img @@ -578,9 +578,17 @@ If you're seeing this, then the `cat` command is working! + + !LOC=/ !FNAME=a.txt + + + + + + diff --git a/kernel.py b/kernel.py index af62be5..d05548d 100644 --- a/kernel.py +++ b/kernel.py @@ -242,11 +242,13 @@ def __init__(self, x, y, w, h): self.placeholder = ['%s# ' % self.pwd] self.txtBuffer = [] self.content = [] + self.overlay = [] # MAGIC # self.caps = { '`': '~', '1': '!', '2': '@', '3': '#', '4': '$', '5': '%', '6': '^', '7': '&', '8': '*', '9': '(', '0': ')', '-': '_', '=': '+', '[': '{', ']': '}', '\\': '|', ';': ':', '\'': '"', ',': '<', '.': '>', '/': '?', 'a': 'A', 'b': 'B', 'c': 'C', 'd': 'D', 'e': 'E', 'f': 'F', 'g': 'G', 'h': 'H', 'i': 'I', 'j': 'J', 'k': 'K', 'l': 'L', 'm': 'M', 'n': 'N', 'o': 'O', 'p': 'P', 'q': 'Q', 'r': 'R', 's': 'S', 't': 'T', 'u': 'U', 'v': 'V', 'w': 'W', 'x': 'X', 'y': 'Y', 'z': 'Z' } self.shift, self.capsLock = False, False self.currentLine, self.loc, self.maxIndex = 0, 0, 0 self.cLineStr = "" + self.blink = True self.raster = pygame.font.Font("res/Perfect_DOS_VGA_437.ttf", 16) def wrap(self, txtBuffer): lines = [] @@ -277,10 +279,22 @@ def wrap(self, txtBuffer): lines.append(ph) return lines def draw(self, screen, lines, c = (255, 255, 255), y = 0): + tempY = y for line in lines: img = self.raster.render(line, True, c) screen.blit(img, (self.x, y)) y += 16 + if counter % 50 > 25: + self.blink = True + else: + self.blink = False + if self.blink: + y = tempY + temp = self.wrap(self.overlay) + for line in temp: + img = self.raster.render(line, True, c) + screen.blit(img, (self.x, y)) + y += 16 def cd(self, dir_name): def process_dir(dr: str): for d in dr.split('/'): @@ -329,8 +343,6 @@ def vis(self, args): while True: for event in pygame.event.get(): if event.type == pygame.KEYDOWN: - self.txtBuffer = [] - self.content = [] self.keyDown(event.key, True) files.write(self.cLineStr + '\n') framework.launch() @@ -373,6 +385,8 @@ def keyDown(self, key, isVis = False): self.txtBuffer.pop(self.loc - 1) self.maxIndex -= 1 self.loc -= 1 + self.overlay = [' '] * (len(self.txtBuffer) + 1) + self.overlay[self.currentLine + self.loc] = '_' except: pass elif key == pygame.K_DELETE: try: @@ -380,24 +394,20 @@ def keyDown(self, key, isVis = False): self.loc = self.maxIndex self.txtBuffer.pop(self.currentLine + self.loc) self.maxIndex -= 1 + self.overlay = [' '] * (len(self.txtBuffer) + 1) + self.overlay[self.currentLine + self.loc] = '_' except: pass elif key == pygame.K_RETURN: cmd = '' self.loc = 0 self.maxIndex = 0 i = -1 - if isVis: - while len(self.txtBuffer) > - i - 1 and self.txtBuffer[i] != '\r': - cmd = self.txtBuffer[i] + cmd - i -= 1 - else: - while len(self.txtBuffer) > - i - 1 and self.txtBuffer[i] != '\n': - cmd = self.txtBuffer[i] + cmd - i -= 1 + while len(self.txtBuffer) > - i - 1 and self.txtBuffer[i] != '\n': + cmd = self.txtBuffer[i] + cmd + i -= 1 if isVis: self.cLineStr = cmd self.txtBuffer.append('\r') - return else: self.exec_cmd(cmd) self.txtBuffer.append('\n') @@ -406,6 +416,9 @@ def keyDown(self, key, isVis = False): for i in range(4): self.txtBuffer.append(' ') self.loc += 1 + self.maxIndex += 1 + self.overlay = [' '] * (len(self.txtBuffer) + 1) + self.overlay[self.currentLine + self.loc] = '_' elif key == pygame.K_LSHIFT or key == pygame.K_RSHIFT: self.shift = True elif key == pygame.K_CAPSLOCK: @@ -426,6 +439,8 @@ def keyDown(self, key, isVis = False): self.txtBuffer.insert(self.loc, chr(key)) self.loc += 1 self.maxIndex += 1 + self.overlay = [' '] * (len(self.txtBuffer) + 1) + self.overlay[self.currentLine + self.loc] = '_' framework.launch() print(self.txtBuffer, self.loc, self.maxIndex) @@ -545,7 +560,9 @@ def keyDown(self, key): snake.addButton(Button("res/button/txt_btn.bmp", width // 2 - 35, 20, bg.appID, font=framework.raster, content="CLOSE")) term.enableTxtField(50, 60, 100, 40) +counter = 0 while True: + counter += 1 for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() From d367acf328c2d19efeef418846a17023e9d385e6 Mon Sep 17 00:00:00 2001 From: The-UltimateGamer <2357931342@qq.com> Date: Sat, 29 Aug 2020 20:45:50 +0800 Subject: [PATCH 2/2] Done! --- README.md | 18 +- README.pdf | Bin 54730 -> 48981 bytes README_zh_CN.md | 57 +++++ README_zh_CN.pdf | Bin 0 -> 125956 bytes files.img | 50 ++-- kernel.py | 565 --------------------------------------------- stub.py | 3 +- wiki/FAQ.md | 15 +- wiki/FAQ.pdf | Bin 35320 -> 46394 bytes wiki/FAQ_zh_CN.md | 24 ++ wiki/FAQ_zh_CN.pdf | Bin 0 -> 131581 bytes 11 files changed, 122 insertions(+), 610 deletions(-) create mode 100644 README_zh_CN.md create mode 100644 README_zh_CN.pdf delete mode 100644 kernel.py create mode 100644 wiki/FAQ_zh_CN.md create mode 100644 wiki/FAQ_zh_CN.pdf 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 2b720032a0d1f7a845b48e7f28d836b9c1bf95b9..b4f80f1779552ce7d5d4e606e44b9a61be67f6ec 100644 GIT binary patch delta 41881 zcmZ^~bx@o^^Dc_JyL*seySTdtcXzh{!EJH(#a$BIH8=!!m*BzOT`%8v&b{@!b?W@l zJ3T!!-MjDm^vqLJy`vS-3-3?~$MC#BHa0GH_QWfa|5pX$Kn8=kOEAF(EI=>`G!l3h zQUjb0sQ?axQU~)w$&+vacvt}396an4oNR0?+-$t;+!S2wKo)j(POc=VuaF$zaVTYQ z2Q(@%4+|SR7biCbkei(az{SPOLBa7kkDG&yhZhV9MGc0B5d?cfi~T1G2|G7{g$>BT z#`{0Kvh%XDaBy=1KPNMQJz+7x5-{?lY@b2dc{#cMXLvRaP8KdsE)I6^6)Z1!A4Uvp z4~I@^43Y~xnNJG>0(b!I zLP8WjTwN?o9FRP-2Mksx_xM!1E=shQWGZ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