Release 1.9

This commit is contained in:
MikeTheWatchGuy 2019-05-26 11:38:42 -04:00
parent deed0caa5e
commit 9f61064fc1
2 changed files with 40 additions and 12 deletions

View File

@ -25,8 +25,8 @@ def non_user_init():
def InVar(key1, key2):
row1 = [sg.T(' '),
sg.I(key=key1, size=(WIDTH_VARIABLES,1)),
sg.T('',key=key1+'CHANGED_', size=(WIDTH_RESULTS,1)),sg.B('Detail', key=key1+'DETAIL_'), sg.T(' '),
sg.T(' '), sg.I(key=key2, size=(WIDTH_VARIABLES, 1)), sg.T('',key=key2 + 'CHANGED_', size=(WIDTH_RESULTS, 1)), sg.B('Detail', key=key2+'DETAIL_'),]
sg.T('',key=key1+'CHANGED_', size=(WIDTH_RESULTS,1)),sg.B('Detail', key=key1+'DETAIL_'),sg.B('Obj', key=key1+'OBJ_'), sg.T(' '),
sg.T(' '), sg.I(key=key2, size=(WIDTH_VARIABLES, 1)), sg.T('',key=key2 + 'CHANGED_', size=(WIDTH_RESULTS, 1)), sg.B('Detail', key=key2+'DETAIL_'),sg.B('Obj', key=key1+'OBJ_')]
return row1
variables_frame = [ InVar('_VAR1_', '_VAR2_'),
@ -41,7 +41,7 @@ def non_user_init():
[sg.Button('Exit')]]
window = sg.Window('PySimpleGUI Debugger', layout, icon=PSGDebugLogo).Finalize()
window.Element('_INTERACTIVE_').SetFocus()
window.Element('_VAR1_').SetFocus()
watcher_window = window
sg.ChangeLookAndFeel('SystemDefault')
return window
@ -81,7 +81,16 @@ PySimpleGUIdebugger.PySimpleGUIdebugger.myrc = {} """.format(_values['_VAR{}_'.f
sg.PopupScrolled(str(_values['_VAR{}_'.format(_event[4])]) + '\n' + str(myrc))
except:
print('Detail failed')
elif _event.endswith('_OBJ_'):
var = _values['_VAR{}_'.format(_event[4])]
expression = """
global myrc
PySimpleGUIdebugger.PySimpleGUIdebugger.myrc = {} """.format(var)
try:
exec(expression, myglobals, mylocals)
sg.PopupScrolled(sg.ObjToStringSingleObj(myrc))
except:
print('Detail failed')
# -------------------- Process the "watch list" ------------------
for i in range(1, 7):
key = '_VAR{}_'.format(i)
@ -129,3 +138,4 @@ def initialize():
myrc = ''
watcher_window = None

View File

@ -1,5 +1,6 @@
![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png)
![PySimpleGUI_Debugger_Logo](https://user-images.githubusercontent.com/13696193/58375496-38cbb280-7f22-11e9-99b8-286fe1fa41b5.png)
![Downloads](http://pepy.tech/badge/pysimpleguidebugger)
@ -30,12 +31,19 @@ or if you need to upgrade later:
`pip install --upgrade --no-cache-dir PySimpleGUIdebugger`
Should this not work, you can copy and paste the file PySimpleGUIdebugger.py into your application folder.
Note that you need to install the debugger using pip rather than downloading. There are some detailed technical reasons for this.
So, don't forget: __You must pip install PySimpleGUIdebugger in order to use it.__
## Integrating PySimpleGUIdebugger Into Your Application
There are 3 lines of code to add to a PySimpleGUI program in order to make it debugger ready - The import, an initialization, once each time through the even loop.
Copy and paste these lines of code into your code just as you see them written. Don't get clever and rename anything. Don't do an "import as". Just copy the lines of code.
Here is an entire program including this integration code:
```python
@ -98,7 +106,7 @@ This "refresh" call that must be added to your event loop. Your `window.Read` c
Add this line to the top of your event loop.
`PySimpleGUIdebugger.refresh(locals(), globals())`
### Using in "when needed"
### Using in "when needed" mode
The Demo Program was recently updated so that instead of launching with the Debugger window immediately shown, the program launches with the Debugger not started. With this new code, you can open and close the Debugger as many times as you wish.
@ -160,16 +168,26 @@ In the future I want to add a "hotkey" or some other trivial way of launching a
## Requirements
**You'll need to have PySimpleGUI installed.**
The newest PyPI installation should automatically install PySimpleGUI for you now.
** You'll need to have PySimpleGUI installed. It will automatically be installed if it is not already installed. **
The debugger itself is written using PySimpleGUI, the tkinter version. It could be changed to use Qt for example by modifying the pip installed version.
You MUST run the debugger from the pip installed version. You cannot download the debugger from the GitHub at this point and use it.
## What's it good for, when should it be used??
Hell if I know. Maybe it's a terrible idea! Or, maybe it'll be really helpful, particularly in situations where you don't have many resources on the target system and perhaps you can't fit a debugger onto that system. PySimpleGUIdebugger provides another tool for your PySimpleGUI GUI Toolbox.
## The Future
LOTS of plans for this debugger in the future. One of the immediate things I want to do is to integrate this into the PySimpleGUI.py file itself. To include the debugger with the SDK so that it doesn't have to be installed.
This will enable the use of a "hotkey" or other mechanism to "magically launch" your very own PySimpleGUI Debugger.
I'll be adding a "Launch debugger" button for sure so that it's trivial for you to add this capability to your code.
Watch this space in the future! COOL SHIT COMING SOON!
# Design
# Author