Re: Need to write a macro for wincvs

"kingcrustybun" <[email protected]>
Newsgroups gmane.comp.version-control.cvs.gui.user
Message-ID <[email protected]>
Aziz,

I am no expert myself but here is what i do based on the example
macros. Do the following 5 steps in a single .py file and place the
file in the macros folder of wincvs.

1. For each macro i create a class which is based on the Macro base
class, eg.
class MyFirstMacro(Macro):

2. In the constructor i add the macro to the menu, eg.
Macro.__init__(self, "My First Macro", MACRO_SELECTION, 0, "Aziz Macros")

3. Add a 'Run' method to the class. This is called when the wincvs
user selects to execute the macro from the menu, eg.
def Run(self):

4. In the run method, create an instance of the console (if you want
to output messages to the macro user), eg.
console = ColorConsole ()

5. Instantiate your new class by calling the class, eg.
MyFirstMacro()

So the above 5 steps will result in the following:


class MyFirstMacro(Macro):
    def __init__(self):
        Macro.__init__(self, "My First Macro", MACRO_SELECTION, 0,
"Aziz Macros")
    def Run(self):
        console = ColorConsole ()
        # Here you put commands which implement the macro

MyFirstMacro()


You will then do the work in the Run method.
There is a lot more to wrting a useful macro, but you did ask how to
get started :)

hope this helps

cheers





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/cvsgui/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.