Skip to content

Commit

Permalink
fix: Open new terminals in working directory (or $home if no director…
Browse files Browse the repository at this point in the history
…y opened), add a terminal instance when panel is toggled (active terminal type, otherwise the default configured)
  • Loading branch information
tomlin7 committed May 15, 2024
1 parent e6778b4 commit f80797b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion biscuit/core/components/views/panel/terminal/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def start_service(self, *_) -> None:
self.alive = True
self.last_command = None

self.p = PTY.spawn([self.shell])
self.p = PTY.spawn([self.shell], cwd=self.cwd)
Thread(target=self.write_loop, daemon=True).start()

def destroy(self, *_) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def __init__(self, master, name: str, data: list, *args, **kwargs) -> None:
self.name = name
self.file = os.path.join(self.base.extensionsdir, data[0])
self.author = data[1]
self.description = data[2]
self.description = data[2][:35] + "..." if len(data[2]) > 30 else data[2]
self.url = f"{master.repo_url}extensions/{data[0]}"
self.installed = os.path.isfile(self.file)

Expand Down
3 changes: 3 additions & 0 deletions biscuit/core/layout/base/content/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ def toggle_panel(self, *_) -> None:
self.editorspane.pack_forget()
else:
self.panel.pack(fill=tk.BOTH, pady=(1, 0))

if not self.panel.terminals.active_terminal:
self.panel.terminals.open_terminal()

self._panel_enabled = not self._panel_enabled

Expand Down
6 changes: 5 additions & 1 deletion biscuit/core/utils/python_dialog.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import subprocess as sp
import webbrowser
from tkinter import messagebox
Expand All @@ -13,7 +14,10 @@ def show_python_not_installed_message():

def check_python_installation():
try:
sp.check_call(["python", "--version"])
if os.name == "nt":
sp.check_call(["python", "--version"])
else:
sp.check_call(["python3", "--version"])
reqs = sp.check_output(['pip', 'freeze'])

# install python language server
Expand Down
12 changes: 12 additions & 0 deletions biscuit/core/utils/sysinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ def __init__(self, base: App) -> None:
self.processor = platform.processor()
self.python_version = sys.version
self.tk_version = tk.TclVersion

@property
def is_windows(self) -> bool:
return self.os == "Windows"

@property
def is_linux(self) -> bool:
return self.os == "Linux"

@property
def is_macos(self) -> bool:
return self.os == "Darwin"

def get_current_stats(self) -> str:
"""Get current CPU and Memory usage"""
Expand Down

0 comments on commit f80797b

Please sign in to comment.