Skip to content

Commit

Permalink
flow; store active flow file on the project which will persist across…
Browse files Browse the repository at this point in the history
… sessions and reactivate itself on loading up sublime after a short delay.
  • Loading branch information
ruby0x1 committed Mar 25, 2015
1 parent 9d11cce commit 1898771
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,29 @@ def __init__(self):
self.build_only = False
self.launch_only = False

sublime.set_timeout(lambda: self.check_for_last_used_flow_file(), 300)

print("[flow] __init__")

def check_for_last_used_flow_file(self):

self.window = sublime.active_window()
self.project_data = self.window.project_data()
last_used_flow = self.project_data.get('flow_file')
self.set_flow_file(last_used_flow)

def set_flow_file( self, file_name ):
if not file_name:
print("[flow] set flow file to ?!?" + str(file_name))
print("[flow] nothing will happen")
return

file_name = str(file_name)
print("[flow] set flow file to " + file_name)
sublime.status_message('set flow file to ' + file_name)

self.project_data['flow_file'] = file_name;
self.window.set_project_data(self.project_data)
self.flow_file = file_name
self.refresh_info()

Expand Down Expand Up @@ -319,16 +338,12 @@ def force_reload():
except:
pass

from .commands.flow_show_status import FlowShowStatus
from .commands.flow_set_target_build import FlowSetTargetBuild
from .commands.flow_set_project_file import FlowSetProjectFile
from .commands.flow_run_build import FlowRunBuild
from .commands.haxe_generate_import import HaxeGenerateImport

#only use this when developing
force_reload()

from .commands.flow_show_status import FlowShowStatus
from .commands.flow_set_target_build import FlowSetTargetBuild
from .commands.flow_set_project_file import FlowSetProjectFile
from .commands.flow_run_build import FlowRunBuild
from .commands.haxe_generate_import import HaxeGenerateImport
from .commands.haxe_generate_import import HaxeGenerateImport

0 comments on commit 1898771

Please sign in to comment.