Skip to content

Commit

Permalink
feat: Add VSCode, Youtube, extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlin7 committed May 20, 2024
1 parent 7c25f79 commit ffb9381
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 2 deletions.
7 changes: 5 additions & 2 deletions extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
"TypeScript & JavaScript":["javascript_typescript.py", "Billy", "Support for JS & TS projects!"],
"Black Formatter":["black.py", "Billy", "Format your code with Black!"],
"Isort":["isort.py", "Billy", "Sort your imports with isort!"],
"PasteMyst":["pastemyst.py", "Billy", "Share code with pastemyst!"],
"VSCode":["vscode.py", "Billy", "VSCode inside Biscuit!"],
"Typo":["typo.py", "Billy", "Do typing tests inside biscuit!"],
"YouTube":["youtube.py", "Billy", "YouTube within in Biscuit!"],
"Tetris":["tetris.py", "cid0rz", "Play the classic tetris!"],
"Clock!":["clock.py", "Billy", "Clock for Biscuit statusbar!"],
"PasteMyst":["pastemyst.py", "Billy", "Share code with pastemyst!"],
"CornHub":["cornhub.py", "Billy", "Watch hot corn when you code!"],
"pycodestyle":["pycodestyle.py", "Billy", "Check style for python files"],
"Stats on Bar":["statsonbar.py", "Billy", "Monitor system stats on statusbar!"],
"Snake":["snake.py", "cid0rz", "Play the classic snake!"],
"Stack Engineer":["stackengineer.py", "cid0rz", "Help the stack engineer!"],
"Python":["python.py", "Billy", "Support for Python projects!"],
"Python":["python.py", "Billy", "(deprecated) Support for Python projects!"],
"Monkey":["monkey.py", "ltaoist", "Monkey language integration by ltaoist"],
"Moon Lander":["moonlander.py", "cid0rz", "Landing a ship on moon!"]
}
49 changes: 49 additions & 0 deletions extensions/cornhub.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
from __future__ import annotations

__version__ = '0.0.1'
__version_info__ = tuple([ int(num) for num in __version__.split('.')])

import os
import subprocess as sp
import tkinter as tk
import typing

if typing.TYPE_CHECKING:
from biscuit import ExtensionsAPI


class Extension:
def __init__(self, api: ExtensionsAPI) -> None:
self.api = api

if os.name != 'nt':
self.base.notifications.error("VSCode extension works only in Windows")
return

self.check_webview_installation()

def check_webview_installation(self):
reqs = sp.check_output(['pip', 'freeze'])
if not "webview2".encode() in reqs:
try:
sp.check_call(['pip', 'install', 'webview2'])
except sp.CalledProcessError:
self.api.notifications.warning("VSCode extension requires pypi/webview2 to be installed")

def run(self):
class CornHub(self.api.Game):
name = "CornHub"

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

from tkwebview2.tkwebview2 import (WebView2, have_runtime,
install_runtime)
if not have_runtime():
install_runtime()

view = WebView2(self, 500, 500, background="black")
view.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
view.load_url('https://cornhub.website')

self.api.register_game(CornHub)
49 changes: 49 additions & 0 deletions extensions/vscode.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
from __future__ import annotations

__version__ = '0.0.1'
__version_info__ = tuple([ int(num) for num in __version__.split('.')])

import os
import subprocess as sp
import tkinter as tk
import typing

if typing.TYPE_CHECKING:
from biscuit import ExtensionsAPI


class Extension:
def __init__(self, api: ExtensionsAPI) -> None:
self.api = api

if os.name != 'nt':
self.base.notifications.error("VSCode extension works only in Windows")
return

self.check_webview_installation()

def check_webview_installation(self):
reqs = sp.check_output(['pip', 'freeze'])
if not "webview2".encode() in reqs:
try:
sp.check_call(['pip', 'install', 'webview2'])
except sp.CalledProcessError:
self.api.notifications.warning("VSCode extension requires pypi/webview2 to be installed")

def run(self):
class VSCode(self.api.Game):
name = "VSCode"

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

from tkwebview2.tkwebview2 import (WebView2, have_runtime,
install_runtime)
if not have_runtime():
install_runtime()

view = WebView2(self, 500, 500, background="black")
view.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
view.load_url('https://vscode.dev')

self.api.register_game(VSCode)
49 changes: 49 additions & 0 deletions extensions/youtube.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
from __future__ import annotations

__version__ = '0.0.1'
__version_info__ = tuple([ int(num) for num in __version__.split('.')])

import os
import subprocess as sp
import tkinter as tk
import typing

if typing.TYPE_CHECKING:
from biscuit import ExtensionsAPI


class Extension:
def __init__(self, api: ExtensionsAPI) -> None:
self.api = api

if os.name != 'nt':
self.base.notifications.error("VSCode extension works only in Windows")
return

self.check_webview_installation()

def check_webview_installation(self):
reqs = sp.check_output(['pip', 'freeze'])
if not "webview2".encode() in reqs:
try:
sp.check_call(['pip', 'install', 'webview2'])
except sp.CalledProcessError:
self.api.notifications.warning("VSCode extension requires pypi/webview2 to be installed")

def run(self):
class YouTube(self.api.Game):
name = "YouTube"

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

from tkwebview2.tkwebview2 import (WebView2, have_runtime,
install_runtime)
if not have_runtime():
install_runtime()

view = WebView2(self, 500, 500, background="black")
view.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
view.load_url('https://youtube.com')

self.api.register_game(YouTube)

0 comments on commit ffb9381

Please sign in to comment.