[Sugar-devel] [API proposal] Source editor and widget

Tomeu Vizoso tomeu at sugarlabs.org
Wed Jul 15 11:18:28 EDT 2009


On Wed, Jul 15, 2009 at 17:09, Lucian Branescu<lucian.branescu at gmail.com> wrote:
> Alright then. I'm unfamiliar with policies about code duplication in
> sugar and activity code. If duplication is ok, then my proposal is
> moot :) Ignore and move along.

Is not ok, it's bad, but avoiding code duplication has a cost that
needs to be taken into account. Worst than simple code duplication is
duplication of logic and also inefficient learning efforts.

In the code you attached I don't see any logic complex enough, but I
see how someone not familiar yet with gtk.SourceView2 could spend lots
of time getting the desired configuration, that's why I suggested the
Almanac instead.

Regards,

Tomeu

> 2009/7/15 Tomeu Vizoso <tomeu at sugarlabs.org>:
>> On Mon, Jul 13, 2009 at 19:09, Lucian Branescu<lucian.branescu at gmail.com> wrote:
>>> I've attached a file with a SourceView class.
>>
>> I'm still a bit unsure about the convenience of adding this code to
>> sugar-toolkit. It's quite trivial code and the API we add to
>> sugar-toolkit should be more or less stable (though we aren't yet
>> promising a stable API).
>>
>> The code you are attaching basically preconfigures gtk.SourceView2 and
>> adds a little bit of code to set the language. Maybe this would be
>> more appropriate as a snippet in the Sugar Almanac?
>>
>> http://wiki.sugarlabs.org/go/Development_Team/Almanac
>>
>> Regards,
>>
>> Tomeu
>>
>>> I'll try to write up a FilesView class as well, since 3 of the 4
>>> aforementioned use cases do something like this.
>>>
>>> 2009/7/13 Tomeu Vizoso <tomeu at sugarlabs.org>:
>>>> On Mon, Jul 13, 2009 at 18:09, Lucian Branescu<lucian.branescu at gmail.com> wrote:
>>>>> I'm proposing the addition of sugar.graphics.sourceedit.SourceView. It
>>>>> would be similar to what can be found in jarabe.view.viewsource. Exact
>>>>> names of classes and/or module are up for debate.
>>>>
>>>> May be better if you first code your new stuff and then we discuss
>>>> about merging it in the sugar-toolkit? viewsource.py doesn't add too
>>>> much around gtksourceview2.View itself, so you may end up with more
>>>> differences than similarities with viewsource.py.
>>>>
>>>> Regards,
>>>>
>>>> Tomeu
>>>>
>>>>> I'm also thinking of adding a FileView class in there, but I'm not
>>>>> sure about it.
>>>>>
>>>>>
>>>>> I've already seen almost the exact same code in Pippy and
>>>>> viewsource.py; now I'm writing almost the same code in my branch of
>>>>> Browse and it could be a base for the proposed Clipboard text editor
>>>>> (http://wiki.sugarlabs.org/go/Features/Edit-panel-on-Frame). Thus, I
>>>>> believe it's a common enough need.
>>>>> _______________________________________________
>>>>> Sugar-devel mailing list
>>>>> Sugar-devel at lists.sugarlabs.org
>>>>> http://lists.sugarlabs.org/listinfo/sugar-devel
>>>>>
>>>>
>>>
>>
>


More information about the Sugar-devel mailing list