| 23701 | |
| 23702 | # Includes the DUAL PANE (now 2 tabs)! Don't forget REPL is there too! |
| 23703 | def _build_main_debugger_window(self, location=(None, None)): |
| 23704 | old_theme = theme() |
| 23705 | theme(_Debugger.DEBUGGER_MAIN_WINDOW_THEME) |
| 23706 | |
| 23707 | def InVar(key1): |
| 23708 | row1 = [T(' '), |
| 23709 | I(key=key1, size=(_Debugger.WIDTH_VARIABLES, 1)), |
| 23710 | T('', key=key1 + 'CHANGED_', size=(_Debugger.WIDTH_RESULTS, 1)), B('Detail', key=key1 + 'DETAIL_'), |
| 23711 | B('Obj', key=key1 + 'OBJ_'), ] |
| 23712 | return row1 |
| 23713 | |
| 23714 | variables_frame = [InVar('_VAR0_'), |
| 23715 | InVar('_VAR1_'), |
| 23716 | InVar('_VAR2_'), ] |
| 23717 | |
| 23718 | interactive_frame = [[T('>>> '), In(size=(83, 1), key='-REPL-', |
| 23719 | tooltip='Type in any "expression" or "statement"\n and it will be disaplayed below.\nPress RETURN KEY instead of "Go"\nbutton for faster use'), |
| 23720 | B('Go', bind_return_key=True, visible=True)], |
| 23721 | [Multiline(size=(93, 26), key='-OUTPUT-', autoscroll=True, do_not_clear=True, expand_x=True, expand_y=True)], ] |
| 23722 | |
| 23723 | autowatch_frame = [[Button('Choose Variables To Auto Watch', key='-LOCALS-'), |
| 23724 | Button('Clear All Auto Watches'), |
| 23725 | Button('Show All Variables', key='-SHOW_ALL-'), |
| 23726 | Button('Locals', key='-ALL_LOCALS-'), |
| 23727 | Button('Globals', key='-GLOBALS-'), |
| 23728 | Button('Popout', key='-POPOUT-')]] |
| 23729 | |
| 23730 | var_layout = [] |
| 23731 | for i in range(_Debugger.NUM_AUTO_WATCH): |
| 23732 | var_layout.append([T('', size=(_Debugger.WIDTH_WATCHER_VARIABLES, 1), key='_WATCH%s_' % i), |
| 23733 | T('', size=(_Debugger.WIDTH_WATCHER_RESULTS, _Debugger.MAX_LINES_PER_RESULT_MAIN), key='_WATCH%s_RESULT_' % i, )]) |
| 23734 | |
| 23735 | col1 = [ |
| 23736 | # [Frame('Auto Watches', autowatch_frame+variable_values, title_color='blue')] |
| 23737 | [Frame('Auto Watches', autowatch_frame + var_layout, title_color=theme_button_color()[0])] |
| 23738 | ] |
| 23739 | |
| 23740 | col2 = [ |
| 23741 | [Frame('Variables or Expressions to Watch', variables_frame, title_color=theme_button_color()[0]), ], |
| 23742 | [Frame('REPL-Light - Press Enter To Execute Commands', interactive_frame, title_color=theme_button_color()[0], expand_x=True, expand_y=True), ] |
| 23743 | ] |
| 23744 | |
| 23745 | # Tab based layout |
| 23746 | layout = [[Text('Debugging: ' + self._find_users_code())], |
| 23747 | [TabGroup([[Tab('Variables', col1), Tab('REPL & Watches', col2)]], expand_x=True, expand_y=True)]] |
| 23748 | |
| 23749 | # ------------------------------- Create main window ------------------------------- |
| 23750 | window = Window("PySimpleGUI Debugger", layout, icon=PSG_DEBUGGER_LOGO, margins=(0, 0), location=location, keep_on_top=True, right_click_menu=[[''], ['Exit', ]], resizable=True) |
| 23751 | |
| 23752 | Window._read_call_from_debugger = True |
| 23753 | window.finalize() |
| 23754 | Window._read_call_from_debugger = False |
| 23755 | |
| 23756 | window.Element('_VAR1_').SetFocus() |
| 23757 | self.watcher_window = window |
| 23758 | theme(old_theme) |
| 23759 | return window |
| 23760 | |