Skip to content

Commit

Permalink
[script.module.web-pdb] 1.6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
romanvm committed Dec 15, 2024
1 parent cd6b042 commit 82be0bd
Show file tree
Hide file tree
Showing 9 changed files with 215 additions and 151 deletions.
5 changes: 2 additions & 3 deletions script.module.web-pdb/addon.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.module.web-pdb"
name="Web-PDB"
version="1.6.2"
version="1.6.3"
provider-name="Roman V.M.">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
Expand All @@ -22,7 +22,6 @@
<icon>icon.png</icon>
<screenshot>resources/screenshot.jpg</screenshot>
</assets>
<news>- 1.6.2: Various internal changes.
- 1.6.0: Dropped Python 2 compatibility.</news>
<news>- 1.6.3: Sync changes with the upstream library version.</news>
</extension>
</addon>
55 changes: 55 additions & 0 deletions script.module.web-pdb/libs/web_pdb/buffer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Author: Roman Miroshnychenko aka Roman V.M.
# E-mail: roman1972@gmail.com
#
# Copyright (c) 2016 Roman Miroshnychenko
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

from threading import RLock

__all__ = ['ThreadSafeBuffer']


class ThreadSafeBuffer:
"""
A buffer for data exchange between threads
"""
def __init__(self, contents=None):
self._lock = RLock()
self._contents = contents
self._is_dirty = contents is not None

@property
def is_dirty(self):
"""Indicates whether a buffer contains unread data"""
with self._lock:
return self._is_dirty

@property
def contents(self):
"""Get or set buffer contents"""
with self._lock:
self._is_dirty = False
return self._contents

@contents.setter
def contents(self, value):
with self._lock:
self._contents = value
self._is_dirty = True
33 changes: 2 additions & 31 deletions script.module.web-pdb/libs/web_pdb/static/bundle.min.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*!
* Bootstrap v3.4.1 (https://getbootstrap.com/)
* Copyright 2011-2019 Twitter, Inc.
* Licensed under the MIT license
*/

/*!
* Sizzle CSS Selector Engine v2.3.6
* https://sizzlejs.com/
*
* Copyright JS Foundation and other contributors
* Released under the MIT license
* https://js.foundation/
*
* Date: 2021-02-16
*/

/*!
* jQuery JavaScript Library v3.6.0
* https://jquery.com/
*
* Includes Sizzle.js
* https://sizzlejs.com/
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2021-03-02T17:08Z
*/

/**
* Prism: Lightweight, robust, elegant syntax highlighting
*
* @license MIT <https://opensource.org/licenses/MIT>
* @author Lea Verou <https://lea.verou.me>
* @namespace
* @public
*/
Original file line number Diff line number Diff line change
@@ -1 +1 @@
44d15b3f2f94eb4fd016f539d421d9e052a55e77dce513ba1d3ec3fe73a1084a bundle.min.js
00f4d0c2e5e9ace53fd0c8e6aa27e5fb55d9fd57b0a0bb03e06c81ea705ccc35 *bundle.min.js
190 changes: 108 additions & 82 deletions script.module.web-pdb/libs/web_pdb/static/styles.min.css

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
c69f3afa25647e7eeb45402621a59f83d3007005fb4c54f27a19f58e4358058a styles.min.css
71ffc923fa5b013c1450597ae0a3443f79c26fc38f21ed7aab7b287ec883e5dd *styles.min.css
36 changes: 4 additions & 32 deletions script.module.web-pdb/libs/web_pdb/web_console.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@

import queue
import weakref
from threading import Thread, Event, RLock
from threading import Thread, Event

import xbmc
from xbmcaddon import Addon
from xbmcgui import DialogProgressBG

from .asyncore_wsgi import make_server, AsyncWebSocketHandler
from .buffer import ThreadSafeBuffer
from .logging import getLogger
from .wsgi_app import app

Expand All @@ -43,35 +44,6 @@
logger = getLogger(__name__)


class ThreadSafeBuffer(object):
"""
A buffer for data exchange between threads
"""
def __init__(self, contents=None):
self._lock = RLock()
self._contents = contents
self._is_dirty = contents is not None

@property
def is_dirty(self):
"""Indicates whether a buffer contains unread data"""
with self._lock:
return self._is_dirty

@property
def contents(self):
"""Get or set buffer contents"""
with self._lock:
self._is_dirty = False
return self._contents

@contents.setter
def contents(self, value):
with self._lock:
self._contents = value
self._is_dirty = True


class WebConsoleSocket(AsyncWebSocketHandler):
"""
WebConsoleSocket receives PDB commands from the front-end and
Expand Down Expand Up @@ -103,7 +75,7 @@ class WebConsole(object):
def __init__(self, host, port, debugger):
self._debugger = weakref.proxy(debugger)
self._console_history = ThreadSafeBuffer('')
self._frame_data = ThreadSafeBuffer()
self._frame_data = None
self._stop_all = Event()
self._server_thread = Thread(target=self._run_server, args=(host, port))
self._server_thread.daemon = True
Expand All @@ -126,7 +98,7 @@ def closed(self):
return self._stop_all.is_set()

def _run_server(self, host, port):
app.frame_data = self._frame_data
self._frame_data = app.frame_data
httpd = make_server(host, port, app, ws_handler_class=WebConsoleSocket)
logger.info(f'Web-PDB: starting web-server on {httpd.server_name}:{port}...')
dialog = DialogProgressBG()
Expand Down
4 changes: 3 additions & 1 deletion script.module.web-pdb/libs/web_pdb/wsgi_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

import bottle

from .buffer import ThreadSafeBuffer

__all__ = ['app']

# bottle.debug(True)
Expand Down Expand Up @@ -65,7 +67,7 @@ def wrapper(*args, **kwargs):
class WebConsoleApp(bottle.Bottle):
def __init__(self):
super(WebConsoleApp, self).__init__()
self.frame_data = None
self.frame_data = ThreadSafeBuffer()


app = WebConsoleApp()
Expand Down

0 comments on commit 82be0bd

Please sign in to comment.