Home Download Buy Blog Forum Support

[ST3] on_activated_async not called at ST3 launch

[ST3] on_activated_async not called at ST3 launch

Postby bizoo on Mon Mar 18, 2013 10:31 am

When ST3 is launched, a on_activated is triggered for the active view.
But is there any reason that on_activated_async is not called ?
Code: Select all
def on_api_ready():
    global api_ready
    api_ready = True

    for m in list(sys.modules.values()):
        if "plugin_loaded" in m.__dict__:
            try:
                m.plugin_loaded()
            except:
                traceback.print_exc()

    # Synthesize an on_activated call
    w = sublime.active_window()
    if w:
        view_id = sublime_api.window_active_view(w.window_id)
        if view_id != 0:
            try:
                on_activated(view_id)
            except:
                traceback.print_exc()
bizoo
 
Posts: 880
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: [ST3] on_activated_async not called at ST3 launch

Postby bizoo on Mon Mar 18, 2013 1:43 pm

I've added the call to on_activated_async() and everything seems to work fine:
Code: Select all
    def on_api_ready():
        global api_ready
        api_ready = True

        for m in list(sys.modules.values()):
            if "plugin_loaded" in m.__dict__:
                try:
                    m.plugin_loaded()
                except:
                    traceback.print_exc()

        # Synthesize an on_activated call
        w = sublime.active_window()
        if w:
            view_id = sublime_api.window_active_view(w.window_id)
            if view_id != 0:
                try:
                    on_activated(view_id)
                    on_activated_async(view_id)
                except:
                    traceback.print_exc()
bizoo
 
Posts: 880
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: [ST3] on_activated_async not called at ST3 launch

Postby bizoo on Mon Apr 22, 2013 10:40 am

bump.
Please add this line to the next build, I'm tired to do it manually at each update.
bizoo
 
Posts: 880
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: [ST3] on_activated_async not called at ST3 launch

Postby bizoo on Tue Jun 25, 2013 8:03 am

re-bump.

Either my request is plenty wrong, if so please tell me why.
Either this issue was lost in the limbo of this forum, thanks to the non existent bug tracker...
bizoo
 
Posts: 880
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: [ST3] on_activated_async not called at ST3 launch

Postby DisposaBoy on Wed Jul 10, 2013 1:46 pm

Works For Me ™

Code: Select all
>>> sublime.version()
'3048'


share the code?
DisposaBoy
 
Posts: 23
Joined: Tue Aug 23, 2011 3:39 pm

Re: [ST3] on_activated_async not called at ST3 launch

Postby bizoo on Wed Jul 10, 2013 2:16 pm

Code: Select all
import sublime, sublime_plugin

class TestAsyncCommand(sublime_plugin.EventListener):
   def on_activated(self, view):
      print('on_activated', view.file_name())
   def on_activated_async(self, view):
      print('on_activated_async', view.file_name())


-Close ST3
-Run ST3
-Look at the console

There's only a on_activated for the current file, no on_activated_async.
bizoo
 
Posts: 880
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: [ST3] on_activated_async not called at ST3 launch

Postby bizoo on Wed Jul 10, 2013 2:26 pm

In addition, when you navigate in the Goto Anything popup:
-Opened files doesn't trigger the on_activated event.
-Unopened files trigger the on_activated event.

Well, not very consistent.
I suppose we have to check view.window() to know if it's a transient view ?
bizoo
 
Posts: 880
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: [ST3] on_activated_async not called at ST3 launch

Postby bizoo on Wed Oct 23, 2013 7:35 am

bump.
bizoo
 
Posts: 880
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland


Return to Technical Support

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 15 guests