This repo is not current. Development has moved from Hg to Git. For the latest code use the "Source Code" tab above to go to the "Thun" git repo or navigate to:
https://osdn.net/projects/joypy/scm/git/Thun
Revision | 9a180df09e64699336036cf720cf354b2a6a21ce (tree) |
---|---|
Time | 2020-05-03 04:51:29 |
Author | Simon Forman <sforman@hush...> |
Commiter | Simon Forman |
Put the log and scratch text in the same window.
This is a step towards Ticket #40360 without going all the way. You can
open additional viewer windows. They are not connected by an
Oberon-style messaging system (yet. It would be nice to use the Tk event
system for that.)
This way the log and the main/scratch/system-menu text are conceptually
unified in the (equivelent of "desktop") base metaphor of the system.
@@ -46,7 +46,7 @@ | ||
46 | 46 | |
47 | 47 | # Now that logging is set up, continue loading the system. |
48 | 48 | |
49 | -from joy.gui.textwidget import TextViewerWidget, tk, get_font | |
49 | +from joy.gui.textwidget import TextViewerWidget, tk, get_font, make_main_window | |
50 | 50 | from joy.gui.world import StackDisplayWorld |
51 | 51 | from joy.library import initialize, DefinitionWrapper |
52 | 52 | from joy.utils.stack import stack_to_string |
@@ -116,8 +116,8 @@ | ||
116 | 116 | |
117 | 117 | |
118 | 118 | def show_log(*args): |
119 | - log_window.wm_deiconify() | |
120 | - log_window.update() | |
119 | + # log_window.wm_deiconify() | |
120 | + # log_window.update() | |
121 | 121 | return args |
122 | 122 | |
123 | 123 |
@@ -144,14 +144,7 @@ | ||
144 | 144 | |
145 | 145 | world = StackDisplayWorld(repo, STACK_FN, REL_STACK_FN, dictionary=D) |
146 | 146 | |
147 | -t = TextViewerWidget(world, **VIEWER_DEFAULTS) | |
148 | - | |
149 | -log_window = tk.Toplevel() | |
150 | -# Make it so that you can't actually close the log window, if you try it | |
151 | -# will just "withdraw" (which is like minifying but without a entry in | |
152 | -# the taskbar or icon or whatever.) | |
153 | -log_window.protocol("WM_DELETE_WINDOW", log_window.withdraw) | |
154 | -log = TextViewerWidget(world, log_window, **VIEWER_DEFAULTS) | |
147 | +top, t, log = make_main_window(world) | |
155 | 148 | |
156 | 149 | FONT = get_font('Iosevka', size=14) # Requires Tk root already set up. |
157 | 150 |
@@ -426,7 +426,6 @@ | ||
426 | 426 | return 'break' |
427 | 427 | |
428 | 428 | def init(self, title, filename, repo_relative_filename, repo, font): |
429 | - self.set_window_title(title) | |
430 | 429 | if os.path.exists(filename): |
431 | 430 | with open(filename) as f: |
432 | 431 | data = f.read() |
@@ -434,7 +433,6 @@ | ||
434 | 433 | # Prevent this from triggering a git commit. |
435 | 434 | self.update() |
436 | 435 | self._cancelSave() |
437 | - self.pack(expand=True, fill=tk.BOTH) | |
438 | 436 | self.filename = filename |
439 | 437 | self.repo_relative_filename = repo_relative_filename |
440 | 438 | self.repo = repo |
@@ -472,3 +470,15 @@ | ||
472 | 470 | |
473 | 471 | T.pack(expand=1, fill=tk.BOTH) |
474 | 472 | T.see(tk.END) |
473 | + | |
474 | + | |
475 | +def make_main_window(world): | |
476 | + m = tk.PanedWindow(orient=tk.HORIZONTAL) | |
477 | + m.winfo_toplevel().title('Thun') | |
478 | + m.pack(fill=tk.BOTH, expand=True) | |
479 | + H = 45 | |
480 | + t = TextViewerWidget(world, m, width=128, height=H) | |
481 | + log = TextViewerWidget(world, m, width=73, height=H) | |
482 | + m.add(log) | |
483 | + m.add(t) | |
484 | + return m, t, log |