Home Download Buy Blog Forum Support

ST2 Input

Re: ST2 Input

Postby mrmccormack on Mon Jul 22, 2013 12:38 am

As a general rule, you should almost never be using view.window()


From the goto line, it uses

Code: Select all
class PromptGotoLineCommand(sublime_plugin.WindowCommand):

    def run(self):
        self.window.show_input_panel("Goto Line:", "", self.on_done, None, None)
        pass




but, with my Plugin, I use
.TextCommand, it seems I have to use the window() syntax

Code: Select all
class Example1Command(sublime_plugin.TextCommand):
    def run(self, edit):
        # 'something' is the default message
        self.view.window().show_input_panel("Say something-:", 'something', self.on_done, None, None)



Is there anything wrong with that?

Thanks
Rob
mrmccormack
 
Posts: 18
Joined: Wed Jul 17, 2013 4:28 pm

Re: Try this.

Postby Hexenon on Sun Jul 28, 2013 11:20 am

import sublime, sublime_plugin

class foxpro_brow(sublime_plugin.WindowCommand):
def run(self):
self.window.show_input_panel("Browse:", "", self.on_done, None, None)
pass<---- you are missing this keyword.

def on_done(self,user_input):
self.window.run_command("exec",{"cmd":["brow.bat",user_input],"working_dir": "\\program\\start\\"})
pass<---- you are missing this keyword.

I just noticed u are missing a keyword "pass" just after showing the input panel or doing the job it has to. Try it out.
Hexenon
 
Posts: 3
Joined: Sun Jul 28, 2013 11:17 am

Previous

Return to Plugin Development

Who is online

Users browsing this forum: TurnitinBot [Bot] and 6 guests