OSDN Git Service

Minor cleanup.
authorSimon Forman <sforman@hushmail.com>
Sun, 15 Jul 2018 03:55:34 +0000 (20:55 -0700)
committerSimon Forman <sforman@hushmail.com>
Sun, 15 Jul 2018 03:55:34 +0000 (20:55 -0700)
joy/gui/main.py

index 5dc8ac4..bb0e02d 100755 (executable)
@@ -47,9 +47,6 @@ GLOBAL_COMMANDS = {
   }
 
 
-JOY_HOME, repo = init_home()
-
-
 def repo_relative_path(path):
   return os.path.relpath(
     path,
@@ -57,12 +54,6 @@ def repo_relative_path(path):
     )
 
 
-STACK_FN = os.path.join(JOY_HOME, 'stack.pickle')
-REL_STACK_FN = repo_relative_path(STACK_FN)
-JOY_FN = os.path.join(JOY_HOME, 'scratch.txt')
-LOG_FN = os.path.join(JOY_HOME, 'log.txt')
-
-
 def key_bindings(*args):
   print dedent('''
     Ctrl-Enter - Run the selection as Joy code.
@@ -107,12 +98,17 @@ def show_log(*args):
 
 
 def grand_reset(s, e, d):
-  stack = load_stack() or ()
+  stack = world.load_stack() or ()
   log.reset()
   t.reset()
   return stack, e, d
 
 
+JOY_HOME, repo = init_home()
+STACK_FN = os.path.join(JOY_HOME, 'stack.pickle')
+REL_STACK_FN = repo_relative_path(STACK_FN)
+JOY_FN = os.path.join(JOY_HOME, 'scratch.txt')
+LOG_FN = os.path.join(JOY_HOME, 'log.txt')
 D = initialize()
 for func in (
   reset_log,
@@ -122,8 +118,6 @@ for func in (
   mouse_bindings,
   ):
   D[func.__name__] = func
-
-
 world = StackDisplayWorld(repo, STACK_FN, REL_STACK_FN, dictionary=D)
 t = TextViewerWidget(world, **defaults)
 log_window = tk.Toplevel()