"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "plugins/python/scripter/debugger_scripter/debugger.py" between
krita-5.1.3.tar.xz and krita-5.1.4.tar.xz

About: Krita is a painting program offering art tools for everyone (concept art, texture and matte painters, illustrations and comics).

debugger.py  (krita-5.1.3.tar.xz):debugger.py  (krita-5.1.4.tar.xz)
""" """
SPDX-FileCopyrightText: 2017 Eliakin Costa <eliakim170@gmail.com> SPDX-FileCopyrightText: 2017 Eliakin Costa <eliakim170@gmail.com>
SPDX-License-Identifier: GPL-2.0-or-later SPDX-License-Identifier: GPL-2.0-or-later
""" """
import bdb import bdb
import multiprocessing import multiprocessing
import sys import sys
if sys.version_info[0] > 2: import asyncio
import asyncio
import trollius as asyncio
from . import debuggerformatter from . import debuggerformatter
class Debugger(bdb.Bdb): class Debugger(bdb.Bdb):
def __init__(self, scripter, cmd): def __init__(self, scripter, cmd):
bdb.Bdb.__init__(self) bdb.Bdb.__init__(self)
self.quit = False self.quit = False
self.debugq = multiprocessing.Queue() self.debugq = multiprocessing.Queue()
self.scripter = scripter self.scripter = scripter
skipping to change at line 85 skipping to change at line 82
def user_return(self, frame, value): def user_return(self, frame, value):
name = frame.f_code.co_name or "<unknown>" name = frame.f_code.co_name or "<unknown>"
if name == '<module>': if name == '<module>':
self.applicationq.put({"quit": True}) self.applicationq.put({"quit": True})
def user_exception(self, frame, exception): def user_exception(self, frame, exception):
self.applicationq.put({"exception": str(exception[1])}) self.applicationq.put({"exception": str(exception[1])})
@asyncio.coroutine async def display(self):
def display(self):
"""Coroutine for updating the UI""" """Coroutine for updating the UI"""
while True: while True:
if self.applicationq.empty(): if self.applicationq.empty():
yield from asyncio.sleep(0.3) await asyncio.sleep(0.3)
else: else:
while not self.applicationq.empty(): while not self.applicationq.empty():
self.application_data.update(self.applicationq.get()) self.application_data.update(self.applicationq.get())
self.scripter.uicontroller.repaintDebugArea() self.scripter.uicontroller.repaintDebugArea()
return return
@asyncio.coroutine async def start(self):
def start(self): await self.display()
yield from self.display()
@asyncio.coroutine async def step(self):
def step(self):
self.debugq.put("step") self.debugq.put("step")
yield from self.display() await self.display()
@asyncio.coroutine async def stop(self):
def stop(self):
self.debugq.put("stop") self.debugq.put("stop")
self.applicationq.put({"quit": True}) self.applicationq.put({"quit": True})
yield from self.display() await self.display()
 End of changes. 8 change blocks. 
15 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)