Sublime Forum

Inheritance and TextCommands

#1

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;


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
0 Likes

#2

that seems to work perfectly. Thanks, Nick.

0 Likes

#3

I’ll fix this for the next beta, it’s a fairly simple problem with the way plugins are detected.

0 Likes

#4

thanks, Jon. I appreciate it.

0 Likes