Re: [anjuta-devel] [GCI] Add Python wizard to class-gen plugin



Hi Kenny!


First off, I assume after started modifying the code that the original
developer of class-gen didn't have in mind adding support for other languages,
because the use of a header/source file is pretty hard coded into the plugin
at some points and languages like Python/Javascript don't have the concept of
header files, as I am sure you know better than me.

Yes, they probably didn't think about that.

I still haven't written the Python autogen template so I still can't report any
issues with that, but refactorings may be necessary. (I guess that will be
even more necessary when adding support for other languages besides Python).

The templates are very flexibel so I don't assume you will have many
problems with generating the templates.

I will leave the Header and Source File entryboxes as they are at the moment,
until we figure out what the best solution is.

I think you can just disable the header file entry when using python (or
other languages that don't have header files, basically any but C/C++).
Just call gtk_widget_set_sensitive (FALSE) on the widget when the tab
changes.

Second, in the class-gen wizard you can specify "Class Elements", for
C++/GObject classes.  Well, what class elements are there for Python?

I've thrown together a short list of possible Python class elements:
  - Class variables

  - Class constants (practically the same as class variable, but as a
    convention in Python you write them in UPPERCASE letters)

  - Class methods (public, pseudoprivate, private, built-ins)

These three are enough IMHO!


    In Python pseudoprivate methods are the ones who start with a leading
    underscore, but they are not really private, but anyway I'm just citing
    the Python documentation.
    http://docs.python.org/tutorial/classes.html#private-variables

    I'd say a programmer will know what kind of methods he wants, I guess. So
    can I let the "Implementation" column out? Also Implementation sounds
    confusing to me in the case of Python.
    Maybe "Type" would be better?

Don't know if "Type" is better for C++, I guess it is obvious for the
choices given anyway.
Anyway, for Python I think programmers will know about those
pseudo-private methods so they will be able to prefix them with _ and we
don't need this column.

  - Nested classes
    Now, implementing this sounds scary. Do we need this?

  - Are there any more?

No, we don't need nested classes.

I have attached a patch of my current work to this mail in git-format-patch
style. I started to work off the ANJUTA_2_32_1 tag, because it was recommended
so. Maybe it's good to mention that I have setup a JHBuild environment for
Anjuta. It works for me like that.

That's it for the moment.  I would really appreciate your input, guys.

If there's anything you feel I should know about, please tell me.

From the first look the patch looks really good but haven't had time to
test it, yet.

Thanks for your work so far!

Johannes

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]