cjprecord / editra-plugins

Automatically exported from code.google.com/p/editra-plugins
0 stars 0 forks source link

[codebrowser] Class group description can't be changed #106

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

I am writing a support for a new language.
In GenerateTags I have something as follows:
    rtags = taglib.DocStruct()
    rtags.SetElementDescription('class', "MetaType Definitions")
    ...
    rtags.AddClass(...)

What is the expected output? What do you see instead?

I expect class group to be labeled as "MetaType Definitions" and not
as "Class Definitions".

Additional information
----------------------

The problem is in the CodeBrowserTree.AppendClass method. It hardcodes
group name to "Class Definitions". 
I have attached a patch that seems to solve the problem.

Original issue reported on code.google.com by igor.dejanovic@gmail.com on 15 May 2009 at 8:51

Attachments:

GoogleCodeExporter commented 9 years ago
Sorry for posting this issue here instead of in the main issue tracker. I saw 
now
that I should post there issues related to bundled plugins.

Original comment by igor.dejanovic@gmail.com on 15 May 2009 at 9:15

GoogleCodeExporter commented 9 years ago
Hello,

1) You should derive a new type of Code/Scope object for new elements.

class MetaType(Scope):
    def __init__(self, name, line, scope=None):
        Scope.__init__(self, name, line, "metatype", scope)

Or if you need the extensions in Class then derive from class. On a quick 
review it
would be good to add a setter to Code for the 'type' attribute. So the type id 
can be
changed easily (i.e the "metatype" argument in the above example).

2) The codebrowser tree should probably not use the AppendClass method at all
anymore, I will look at updating this, it should use the generic methods now 
instead.
AppendClass is left over from the early drafts and just hasn't been removed...

Thanks,

Cody

Original comment by CodyPrec...@gmail.com on 15 May 2009 at 12:11

GoogleCodeExporter commented 9 years ago
Hi Cody.
Yes, that was what I have tried first but I haven't figure out how to define 
icon for
a type. I would like to reuse icon for class type but I don't see what would be 
the
straightforward way to do that.
GenerateTags returns only document structure without any visual properties 
which is
good, but what would be the best way to define type visual properties (only 
icon in
this case).

Thanks,
Igor

Original comment by igor.dejanovic@gmail.com on 15 May 2009 at 1:06

GoogleCodeExporter commented 9 years ago
Hello,

Set the association in the CodeBrowsers, _SetupImageList function in 
cbrowser.py.
Looking at this it may also be better to change how this is done, to look at the
object type instead of its string type and use introspection to walk up the 
objects
class hierarchy to select the appropriate icon.

I can look at this too sometime, so if you want to just add the association in 
the
way it is done now that is fine.

Cody

Original comment by CodyPrec...@gmail.com on 15 May 2009 at 1:31

GoogleCodeExporter commented 9 years ago
Hello,

I remember why AppendClass is still there now, its for sorting reasons. All the
existing doc generators would need to be updated to use the SetElementPriority 
method
before removing it so the sorting would be correct.

I added a check in the icon setting to use the Class icon for all object that 
derive
from class that do not have another specialized icon set.

Closing this issue, if you have any further questions please feel free to ask 
on the
forum or mailing list.

Thanks,

Cody

Original comment by CodyPrec...@gmail.com on 15 May 2009 at 11:49

GoogleCodeExporter commented 9 years ago
Cody,
You made a typo in _GetIconIndex (impg -> img).

Best regards,
Igor

Original comment by igor.dejanovic@gmail.com on 16 May 2009 at 7:07

GoogleCodeExporter commented 9 years ago
oh my,

fixed

cody

Original comment by CodyPrec...@gmail.com on 16 May 2009 at 1:46