-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add VSCode, Youtube, extensions
- Loading branch information
Showing
4 changed files
with
152 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |