• R/O
  • SSH

Joypy: Commit

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


Commit MetaInfo

Revision9a180df09e64699336036cf720cf354b2a6a21ce (tree)
Time2020-05-03 04:51:29
AuthorSimon Forman <sforman@hush...>
CommiterSimon Forman

Log Message

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.

Change Summary

Incremental Difference

diff -r 23bd7dd5bb0c -r 9a180df09e64 joy/gui/main.py
--- a/joy/gui/main.py Fri May 01 23:09:09 2020 -0700
+++ b/joy/gui/main.py Sat May 02 12:51:29 2020 -0700
@@ -46,7 +46,7 @@
4646
4747 # Now that logging is set up, continue loading the system.
4848
49-from joy.gui.textwidget import TextViewerWidget, tk, get_font
49+from joy.gui.textwidget import TextViewerWidget, tk, get_font, make_main_window
5050 from joy.gui.world import StackDisplayWorld
5151 from joy.library import initialize, DefinitionWrapper
5252 from joy.utils.stack import stack_to_string
@@ -116,8 +116,8 @@
116116
117117
118118 def show_log(*args):
119- log_window.wm_deiconify()
120- log_window.update()
119+ # log_window.wm_deiconify()
120+ # log_window.update()
121121 return args
122122
123123
@@ -144,14 +144,7 @@
144144
145145 world = StackDisplayWorld(repo, STACK_FN, REL_STACK_FN, dictionary=D)
146146
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)
155148
156149 FONT = get_font('Iosevka', size=14) # Requires Tk root already set up.
157150
diff -r 23bd7dd5bb0c -r 9a180df09e64 joy/gui/textwidget.py
--- a/joy/gui/textwidget.py Fri May 01 23:09:09 2020 -0700
+++ b/joy/gui/textwidget.py Sat May 02 12:51:29 2020 -0700
@@ -426,7 +426,6 @@
426426 return 'break'
427427
428428 def init(self, title, filename, repo_relative_filename, repo, font):
429- self.set_window_title(title)
430429 if os.path.exists(filename):
431430 with open(filename) as f:
432431 data = f.read()
@@ -434,7 +433,6 @@
434433 # Prevent this from triggering a git commit.
435434 self.update()
436435 self._cancelSave()
437- self.pack(expand=True, fill=tk.BOTH)
438436 self.filename = filename
439437 self.repo_relative_filename = repo_relative_filename
440438 self.repo = repo
@@ -472,3 +470,15 @@
472470
473471 T.pack(expand=1, fill=tk.BOTH)
474472 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
Show on old repository browser