Turned out that window.active_view() does not return panels. Print("result", result, self.choose if result != -1 else None) Quick_panel(self.window, self.choose, self.on_done) W.show_quick_panel(items, callback, flags)Ĭlass TestCommandCommand(sublime_plugin.WindowCommand): t_timeout(lambda: find_quick_panel_id(w, current_id), 0) Quick_panel_active = False # what if there's still a quick paneL active? t_timeout(lambda: find_quick_panel_id(w, current_id, time + wait), wait) Global quick_panel_active, quick_panel_id This is the code with t_timeout(): import sublimeĭef quick_panel(w, items, callback, flags=0):ĭef find_quick_panel_id(w, current_id, time=0): I started using the thread module for this but calling window.active_view().id() raised a RuntimeError and told me it cannot be run in a thread other than the main thread. From this id I could determine in an event listener if the currently “modified” view is the quick panel or just some other view/panel I don’t care about. Here are my thoughts and tests on this (warning: this post is long):Īt first I tried to write a function that opens a quick panel and periodically checks until it has opened to write a global flag and id. If you do anything else though you may need to make sure that you focus back on the quick-panel. You can use show() or show_at_center() to scroll the view. I don’t know if there is any easier way to confirm that the current view is a quick-panel. That is, get all the ids for the views - if the current id is not in this list then deduce that it is the quick panel?! You could do this just before, and just after, showing the quick-panel! My isView function may still be of use.Īdded: Actually, just after showing the quick-panel you could just store the id of the current view(?). Using the id is probably easiest it might require a process of elimination though. show_quick_panel does not return a reference so it might be a little tricky to confirm. You need some way of recognising, though, that the quick-panel is active. You can use the **on_modified **event to read keystrokes in the quick-panel. I’d like to do it like goto_anithing : when you focus list item it scrolls the view to that item. Sublime.status_message('You are in a different view.')Įdited = _regions("edited_rgns") or ]įor reg in : Sublime.active_window().show_quick_panel(the_edits, self.on_chosen) def on_chosen(self, index): The_edits = getEditList(self.view, edited) Sublime.status_message(‘No edits to list.’) Sublime.status_message(‘Click into the view/tab first.’) # Shows a quick panel to jump to edit lines. Return (view is not None and view.id() = view_id)Ĭlass QuickEditsCommand(sublime_plugin.TextCommand): View = window.active_view() if window != None else None # check that they are in a View, rather than some panel, etc. I have been given permission to repost a portion of the Focus/Value list the Mask of Romek meticulously gathered together to help those of us who get writer’s block during the character creation process.Here is some code that I use it should point you in the right direction. Here is a helpful tool built by the mysterious Mask of Romek, the provider of the Star Trek Adventures Resources and Scenarios website. One of my favorite things to do is point fans of Star Trek Adventures to amazing online resources to make gameplay easier. How can you round out a player-generated character? By adding focuses that set them apart from other crew members.
0 Comments
Leave a Reply. |