Re: [gedit-list] Plugin custom highlighter



Hi Pander,

Recently, I started to develop a Gedit plugin to markup of texts. I don't remember where I found a way to insert a button on gedit toolbar, but I've used this to turn on/off highlighter of my plugin.
You can see it in the code at: https://github.com/melissawen/highlight-plugin/blob/master/highlighter-dev.py
This is specifically defined by "_insert_toolbar_icon" function. I just use a toggle button and insert it on toolbar.

Sorry for some messy codes

Hope it can help you!

Melissa Shihfan Ribeiro Wen

"...pois não há nada, senão os sentidos, capaz de curar a alma,
assim como não há nada, senão a alma, capaz de curar os sentidos."
[Oscar Wilde]


2013/4/27 Pander <pander users sourceforge net>
On 01/22/2013 02:23 PM, Mark Ballard wrote:
> +1 on a custom highlight for Gedit .
>
> A most useful and very powerful first step would be a simple highlight:
> swipe 'n' key-press.
>
> This is very important to me. The lack of a highlight is the one thing
> that makes Gedit seriously dysfunctional. It's many other attributes
> make it an excellent editor for my purpose, which is writing and
> researching.
>
> Gedit has a multitude of auto-highlight templates for different
> programming languages. But not a single, simple highlight for writers.
>
> Yet there are many reasons why Gedit is a good tool for the task of
> writing and keeping research notes. It is not bloated. It has a spell
> check and word count. It has tabs.
>
> But it does not have a highlight. I don't think that to implement one
> would take you down the path towards the sort of preposterously bloated
> word processors you get nowadays, where the written page is girded with
> what looks like a tool belt you would find round the belly of a DIY
> fanatic. It would merely provide the same simple facility for
> highlighting the written word as it provides people who write computer
> programs.
>
> It's not necessary to go down the route of having hold, italic, subhead,
> head, bullet, number, style, spacing blah blah blah. But there is not a
> single way for a writer to highlight text aside from putting it in
> capitals or using other conventions to ----------------- perhaps
> underline or wotnot. These conventions are good for improvised header
> styles. This is the deal with text editors: speed, simplicity, flexibility.
>
> Even full-blown word-processors do not in my experience implement the
> highlight well. This is because word processors are designed for people
> who think of the printed page. They are designed to emulate the printed
> page.
>
> But researchers are interested more in the semantics of the text than
> its presentation. This means most especially having the means to
> physically highlight the most salient portions of a passage, so when you
> come back to the notes, you see instantly what it was you thought was
> most important when you first read it, so you don't have to repeat the
> work of comprehension.
>
> Without this facility you have your hands tied behind your back. You
> don't want to destroy the original passage, and it is anyway too time
> consuming. What Gedit forces you to do instead is manually cut and paste
> the most salient points to pull them out of the text. This is
> ridiculously time consuming. But it is the only way to handle research
> notes without a simple highlight.
>
> Please note: simple: swipe: (edit colour in preferences) - that's a
> really good start that would make such a powerful difference.
>
> It doesn't even really have to go any further than that. But I can see
> that there might be possibilities to create tailored highlight templates
> for writers like those for different programming languages, particularly
> if they used semantic technology.
>
> The sort of things Pander has proposed have immense potential: to
> highlight certain words in the text - to assign particular colours to
> particular words, or particular genres of word like verbs, nouns.
>
> If there were a central place where the user could control the treatment
> of words handled by different applications, then you would be really flying.
>
> I can see immense possibilities for adapting Gedit to my tasks in other
> ways as well. It could be a very powerful research tool. But that's a
> different story.
>
> For now just a simple highlight would revolutionize Gedit for me.
>
> Mark.
>

Thanks. I have started a plugin here:
  https://github.com/PanderMusubi/gedit-customhighlighter

At the moment the config.py can read the configuration file. Since I use
gedit 3.7.5 in gnome-shell 3.8.1 a lot has changed compared to the older
documentation and examples.

Could someone help me out with the following:
- adding a menu item in gedit's tool menu with an icon and a short cut
to activate and deactivate this plugin
- getting me started with some simple (overriding) highlighting
by pointing at some example code.

The coming days I have some time so with the help of you guys I would
like to get to a working first version soon.

Thanks,

Pander

>
> On 15 January 2013 16:31, Pander <pander users sourceforge net
> <mailto:pander users sourceforge net>> wrote:
>
>     Hi all,
>
>     I would like to have a custom hightlighter plugin for gedit. Perhaps
>     something already exists or other people are interested in helping
>     develop it.
>
>     In short, it would do the following:
>     - highlight words which are in custom lists
>     - these lists are stored in ~/.config/gedit/custom-highlight
>     - this highlighting will be overruling standard syntax highlighting
>     - each list of words can have custom highlighting:
>       - font color
>       - background color
>       - regular/bold/italic/bolditalic
>     - each list can be language specific (use spell check language)
>
>     Rationale: this custom highlighting can be a writing aid to:
>
>     1) Warn for certain know writing errors (independent of spelling and
>     grammar checking) mainly in proper names not supported by these
>     checkers. Also to detect these mistakes in documents created by others.
>
>     2) Warn for words a user know he or she uses too often and want to keep
>     track of. For example, I tend to use the word 'also' a lot. Each time I
>     have to search my text for occurrences and rewrite it to use 'too' or
>     another contrustion. I would like to be notified for each time is use
>     that word. Similarly, I like to be notified for usage of words such as
>     therefore, nevertheless, despite, however, albeit, and alike. Preloaded
>     lists of this kind can be offered with the plugin.
>
>     Who sees the added value of these wishes and would like to help me?
>
>     Regards,
>
>     Pander
>     _______________________________________________
>     gedit-list mailing list
>     gedit-list gnome org <mailto:gedit-list gnome org>
>     https://mail.gnome.org/mailman/listinfo/gedit-list
>
>
>
>

_______________________________________________
gedit-list mailing list
gedit-list gnome org
https://mail.gnome.org/mailman/listinfo/gedit-list



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