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.
This commit is contained in:
Simon Forman
2020-05-02 12:51:29 -07:00
parent b935e53ca4
commit 8604dccc24
2 changed files with 16 additions and 13 deletions
+12 -2
View File
@@ -426,7 +426,6 @@ class TextViewerWidget(tk.Text, MouseBindingsMixin, SavingMixin):
return 'break'
def init(self, title, filename, repo_relative_filename, repo, font):
self.set_window_title(title)
if os.path.exists(filename):
with open(filename) as f:
data = f.read()
@@ -434,7 +433,6 @@ class TextViewerWidget(tk.Text, MouseBindingsMixin, SavingMixin):
# Prevent this from triggering a git commit.
self.update()
self._cancelSave()
self.pack(expand=True, fill=tk.BOTH)
self.filename = filename
self.repo_relative_filename = repo_relative_filename
self.repo = repo
@@ -472,3 +470,15 @@ class TextViewerWidget(tk.Text, MouseBindingsMixin, SavingMixin):
T.pack(expand=1, fill=tk.BOTH)
T.see(tk.END)
def make_main_window(world):
m = tk.PanedWindow(orient=tk.HORIZONTAL)
m.winfo_toplevel().title('Thun')
m.pack(fill=tk.BOTH, expand=True)
H = 45
t = TextViewerWidget(world, m, width=128, height=H)
log = TextViewerWidget(world, m, width=73, height=H)
m.add(log)
m.add(t)
return m, t, log