Home Download Buy Blog Forum Support

Inheritance and TextCommands

Inheritance and TextCommands

Postby SteveCooperOrg on Wed Jun 11, 2008 10:15 am

Anyone help me out with what may be a simple python problem?

I'm trying to create a set of TextCommands which share a lot of behaviour. I thought I'd use inheritance, like this;

Code: Select all

class PandocCompileCommand(sublimeplugin.TextCommand):
    def run(self, view, args):
        pass

class CompileToRtfCommand(PandocCompileCommand):
    def run(self, view, args):
        print "RTF"

class CompileToPdfCommand(PandocCompileCommand):
    def run(self, view, args):
        print "PDF"


problem is, these are disabled as commands. If I inherit directly ( class CompileToRtfCommand(sublimeplugin.TextCommand) ) then they *are* enabled.

Am I doing something dumb, or does ST require the IMMEDIATE base class to be sublimeplugin.TextCommand?

Steve
Maybe what you're looking for is at the http://www.sublimetextwiki.com
SteveCooperOrg
 
Posts: 193
Joined: Thu Mar 20, 2008 9:53 am

Re: Inheritance and TextCommands

Postby SteveCooperOrg on Wed Jun 11, 2008 12:58 pm

that seems to work perfectly. Thanks, Nick.
Maybe what you're looking for is at the http://www.sublimetextwiki.com
SteveCooperOrg
 
Posts: 193
Joined: Thu Mar 20, 2008 9:53 am

Re: Inheritance and TextCommands

Postby jps on Thu Jun 12, 2008 8:44 am

I'll fix this for the next beta, it's a fairly simple problem with the way plugins are detected.
jps
Site Admin
 
Posts: 3062
Joined: Wed Mar 19, 2008 12:33 pm

Re: Inheritance and TextCommands

Postby SteveCooperOrg on Thu Jun 12, 2008 3:31 pm

thanks, Jon. I appreciate it.
SteveCooperOrg
 
Posts: 193
Joined: Thu Mar 20, 2008 9:53 am


Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 6 guests