[Sugar-devel] [API proposal] Source editor and widget
Gary C Martin
gary at garycmartin.com
Wed Jul 15 18:06:03 EDT 2009
On 15 Jul 2009, at 17:07, Lucian Branescu wrote:
> Here it is http://wiki.sugarlabs.org/go/Development_Team/Almanac#How_do_I_create_a_text_box_for_code_editing.3F
Thanks Lucian, I've been watching this thread from the sidelines. I
for one would LOVE the current 'view source' view to become an 'edit
source' view... Perhaps a lock button to prevent initial accidental
editing, and a revert to original (and/or undo if feasible).
I guess even without revert/undo features, if installed Activities are
always accessible as bundles via the Journal (++), the original
version can always be resumed to overwrite some screwed up edits and
get back to a working state. The extra sugar coating for view/edit
source would then be an extra button for "Make Journal Activity
bundle" so that folks could turn edited source into something they
could perhaps share, 'send to -> friend', or restore at a later date
for further work (after using some official version).
Regards,
--Gary
> 2009/7/15 Lucian Branescu <lucian.branescu at gmail.com>:
>> Sure, I'll put it on the wiki, then.
>>
>> About editing userscripts, I'll resort to overriding the default View
>> Source, at least for now.
>>
>> 2009/7/15 Tomeu Vizoso <tomeu at sugarlabs.org>:
>>> 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
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
> _______________________________________________
> 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