Kaydet (Commit) b7ebb83a authored tarafından Guido van Rossum's avatar Guido van Rossum

Make sure the Tcl variables are shared between windows.

üst 07ec8967
...@@ -83,10 +83,14 @@ class EditorWindow: ...@@ -83,10 +83,14 @@ class EditorWindow:
about_title = about_title about_title = about_title
about_text = about_text about_text = about_text
vars = {}
def __init__(self, flist=None, filename=None, key=None, root=None): def __init__(self, flist=None, filename=None, key=None, root=None):
self.flist = flist self.flist = flist
root = root or flist.root root = root or flist.root
self.root = root self.root = root
if flist:
self.vars = flist.vars
self.menubar = Menu(root) self.menubar = Menu(root)
self.top = top = self.Toplevel(root, menu=self.menubar) self.top = top = self.Toplevel(root, menu=self.menubar)
self.vbar = vbar = Scrollbar(top, name='vbar') self.vbar = vbar = Scrollbar(top, name='vbar')
...@@ -550,15 +554,10 @@ class EditorWindow: ...@@ -550,15 +554,10 @@ class EditorWindow:
var.set(value) var.set(value)
def getrawvar(self, name, vartype=None): def getrawvar(self, name, vartype=None):
key = ".VARS." var = self.vars.get(name)
vars = self.menudict.get(key) if not var and vartype:
if not vars and vartype: self.vars[name] = var = vartype(self.text)
self.menudict[key] = vars = {} return var
if vars is not None:
var = vars.get(name)
if not var and vartype:
vars[name] = var = vartype(self.text)
return var
def prepstr(s): def prepstr(s):
......
...@@ -22,6 +22,7 @@ class FileList: ...@@ -22,6 +22,7 @@ class FileList:
self.root = root self.root = root
self.dict = {} self.dict = {}
self.inversedict = {} self.inversedict = {}
self.vars = {} # For EditorWindow.getrawvar (shared Tcl variables)
def goodname(self, filename): def goodname(self, filename):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment