removed the terminal cause it sucks
This commit is contained in:
@@ -33,32 +33,13 @@
|
||||
}
|
||||
|
||||
#editor {
|
||||
margin-top: 1;
|
||||
margin: 1 0;
|
||||
|
||||
#code-editor {
|
||||
min-height: 3;
|
||||
}
|
||||
}
|
||||
|
||||
#console-container {
|
||||
padding-top: 1;
|
||||
margin: 1;
|
||||
border-top: tall $boost;
|
||||
height: 35%;
|
||||
min-height: 12;
|
||||
|
||||
#console {
|
||||
border: tall $boost;
|
||||
margin-bottom: 1;
|
||||
}
|
||||
}
|
||||
|
||||
#terminal {
|
||||
height: 35%;
|
||||
min-height: 12;
|
||||
margin: 1;
|
||||
}
|
||||
|
||||
#find-window {
|
||||
width: 45;
|
||||
height: 11;
|
||||
|
||||
35
main.py
35
main.py
@@ -69,9 +69,9 @@ class Berry(App):
|
||||
yield TextArea.code_editor(placeholder="This file is empty.", theme="css", id="code-editor", disabled=True, soft_wrap=True)
|
||||
|
||||
#if os.name == "nt":
|
||||
with Vertical(id="console-container"):
|
||||
yield RichLog(id="console")
|
||||
yield Input(placeholder="> ", id="console-input")
|
||||
#with Vertical(id="console-container"):
|
||||
# yield RichLog(id="console")
|
||||
# yield Input(placeholder="> ", id="console-input")
|
||||
#else:
|
||||
# yield Terminal(command="bash", id="terminal")
|
||||
|
||||
@@ -104,30 +104,6 @@ class Berry(App):
|
||||
|
||||
yield SystemCommand("Settings", "Open the settings menu", self.action_settings)
|
||||
|
||||
def on_input_submitted(self, event: Input.Submitted):
|
||||
if event.input.id != "console-input":
|
||||
return
|
||||
|
||||
self.run_command(event.input.value)
|
||||
event.input.clear()
|
||||
|
||||
def run_command(self, command: str):
|
||||
console = self.query_one("#console")
|
||||
|
||||
console.write(f"> {command}")
|
||||
|
||||
if command == "clear" or command == "cls":
|
||||
console.clear()
|
||||
else:
|
||||
try:
|
||||
result = subprocess.check_output(command, shell=True, text=True, stderr=subprocess.STDOUT)
|
||||
console.write(result)
|
||||
except subprocess.CalledProcessError as e:
|
||||
console.write(e.stdout)
|
||||
|
||||
|
||||
self.query_one("#console-input").focus()
|
||||
|
||||
async def chose_file_to_open(self, result):
|
||||
if result == None: return
|
||||
result = str(result)
|
||||
@@ -374,11 +350,6 @@ class Berry(App):
|
||||
self.observer.schedule(Watcher(self), path=self.path)
|
||||
self.observer.start()
|
||||
|
||||
#if os.name == "nt":
|
||||
self.query_one("#console").write("Run a command below.")
|
||||
#else:
|
||||
# self.query_one("#terminal").start()
|
||||
|
||||
self.config_handler.apply_settings()
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user