Hi Kristof,
Please, no Mr., just call me Matic.
Yes, you can use my responses on StackOverflow, I do not care about the points.
Thanks for mentioning me in the answer!
Now:
1.) I accidentally left the 'send_scintilla = ' line in, just remove it. The code in my editor is 'send_scintilla = self.SendScintilla', then send_scintilla is used, to save me some typing.
2.) To connect to the signal use the code below in the QScintilla editors __init__ function:
def hotspot_click(position, modifiers):
print("Hotspot click!")
self.SCN_HOTSPOTRELEASECLICK.connect(hotspot_click)
Check the attached example. I just added the hotspot code to your StackOverflow example and disabled the lexer. Hover the mouse over the SimplePythonEditor word in line 18 and click on it.
When you click on it, it will print to the console the index you clicked on.
!! Note that for this example to work, YOU HAVE TO DISABLE THE LEXER, as hotspots should be styled by the lexer if you are using it with your QScintilla editor !!
3.) As 位user<http://stackoverflow.com/users/6541288/%ce%bbuser> already mentioned, you have to parse the text for the functions yourself and then style the hotspots manually. QScintilla has no functionality to parse code, it only styles the text according to predefined tokens. This is done in the underlying C++ code for the built-in lexers like C or Python.
If you want to make functions clickable and have syntax highlighting at the same time, you have to make your custom lexer by inheriting from the QsciLexerCustom class and writing you custom styleText function.
Check my editor's Oberon lexer and its styleText function in the lexers.py module (link<https://github.com/matkuki/ExCo/blob/master/lexers.py#L280>). This function is called everytime you change the text in the editor. In the Oberon lexer, the text is just split using a list of separator characters into tokens, then the tokens are iterated over and styled according to what type of token it is. Here is where you would have to add your custom hotspot styling code.
So if you're parsing C code for your GNEB editor, your custom lexer's styleText function would have to do the following:
- parse the editor text for C functions and variables
- tokenize the editor text (for each token you need it's starting index and length)
- loop over the tokens and style them either normally or if the token is a C function or variable as a hotspot
You also have to add a function that will handle the clicks on functions and variables.
I know it probably looks complicated looking at the code, but after a while you'll get the hang of how the lexers work. If you need more help with any detail, just ask and I'll help if I can.
The other thing you can do is what I did in Ex.Co.. Instead of making functions and variables clickable, parse the code and show a list on the side with all the functions and variables in it. Then when you click on a function or variable in the list, the editor jumps to the function definition.
As for GNEB, it a great idea! At one point I wanted to add in-built support for the SDCC compiler into Ex.Co., but simply couldn't find the time.
I looked at your website a couple of days ago, but couldn't find any references if you will support 16-bit PIC's? I will try GNEB this week and mail you.
I'm from Slovenia, so yes, we're in the same timezone.
Hope this info helps.
Matic
________________________________
From: kristof.mulier at telenet.be <kristof.mulier at telenet.be>
Sent: Wednesday, October 12, 2016 9:58 PM
To: Matic Kukovec
Subject: Re: [QScintilla] Clickable functions and variables
Dear Mr. Kukovec,
About QScintilla
--------------------------
First of all, a big thank you for your help. Your answer is very useful. I have taken the freedom to post it on StackOverflow, with of course your name mentioned. If you would like to, you can post it yourself (and I'll remove my post), such that you can earn the StackOverflow points you deserve ;-)
Anyway, a big big thank you!
Could you take a quick look at the StackOverflow post?
http://stackoverflow.com/questions/40002373/qscintilla-based-text-editor-in-pyqt5-with-clickable-functions-and-variables/40006957#40006957
I have added a few questions below the post, to ask for clarification of a few things in your answer. I lack some experience in QScintilla, so certain things are a bit hard for me to grasp.
About your project
-----------------------------
I have downloaded the IDE from your github account, and I am truly amazed. This is a wonderful work. You have certainly spent a lot of time on it!
Could you take a quick look at my project?
www.gneb.io<http://www.gneb.io>
I am making an IDE that is targeted at microcontroller programming in C. What do you think about it?
I hope we could exchange some thoughts. Do you also live in the European timezone? I'm from Belgium :-)
Kind greetings,
Kristof
________________________________
Van: "Matic Kukovec" <kukovecmatic at hotmail.com>
Aan: "QScintilla" <qscintilla at riverbankcomputing.com>
Verzonden: Woensdag 12 oktober 2016 20:08:55
Onderwerp: Re: [QScintilla] Clickable functions and variables
Hey Kristof,
Hotspots make text clickable. You have to style it manualy using the QScintilla.SendScintilla function.
Example function I used in my editor Ex.Co. (https://github.com/matkuki/ExCo):
def style_hotspot(self, index_from, length, color=0xff0000):
"""Style the text from/to with a hotspot"""
send_scintilla =
#Use the scintilla low level messaging system to set the hotspot
self.SendScintilla(PyQt4.Qsci.QsciScintillaBase.SCI_STYLESETHOTSPOT, 2, True)
self.SendScintilla(PyQt4.Qsci.QsciScintillaBase.SCI_SETHOTSPOTACTIVEFORE, True, color)
self.SendScintilla(PyQt4.Qsci.QsciScintillaBase.SCI_SETHOTSPOTACTIVEUNDERLINE, True)
self.SendScintilla(PyQt4.Qsci.QsciScintillaBase.SCI_STARTSTYLING, index_from, 2)
self.SendScintilla(PyQt4.Qsci.QsciScintillaBase.SCI_SETSTYLING, length, 2)
This makes text in the QScintilla editor clickable when you hover the mouse over it.
The number 2 in the above functions is the hotspot style number.
To catch the event that fires when you click the hotspot, connect to these signals:
QScintilla.SCN_HOTSPOTCLICK
QScintilla.SCN_HOTSPOTDOUBLECLICK
QScintilla.SCN_HOTSPOTRELEASECLICK
For more details look at Scintilla hotspot documentation:
http://www.scintilla.org/ScintillaDoc.html#SCI_STYLESETHOTSPOT
and QScintilla hotspot events:
http://pyqt.sourceforge.net/Docs/QScintilla2/classQsciScintillaBase.html#a5eff383e6fa96cbbaba6a2558b076c0b
Try it. Hope it helps.
Matic
________________________________
From: QScintilla <qscintilla-bounces at riverbankcomputing.com> on behalf of kristof.mulier at telenet.be <kristof.mulier at telenet.be>
Sent: Wednesday, October 12, 2016 5:33 PM
To: qscintilla at riverbankcomputing.com
Subject: [QScintilla] Clickable functions and variables
Dear QScintilla users and developers,
Can you please take a look at this StackOverflow question?
http://stackoverflow.com/questions/40002373/qscintilla-based-text-editor-in-pyqt5-with-clickable-functions-and-variables
I am still trying to build an IDE in PyQt5, and use QScintilla for the syntax highlighting. I wonder if certain features are available in QScintilla. The official documentation is way too short.
Kind greetings,
Kristof Mulier
PS: The IDE I am building can be found on my website: www.gneb.io<http://www.gneb.io>
_______________________________________________
QScintilla mailing list
QScintilla at riverbankcomputing.com/mailman/listinfo/qscintilla
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/qscintilla/attachments/20161012/e10721e1/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hotspot_example.py
Type: text/x-python
Size: 4368 bytes
Desc: hotspot_example.py
URL: </pipermail/qscintilla/attachments/20161012/e10721e1/attachment-0001.py>
More information about the QScintilla
mailing list
‘She has never mentioned her father to me. Was he—well, the sort of man whom the County Club would not have blackballed?’ "We walked by the side of our teams or behind the wagons, we slept on the ground at night, we did our own cooking, we washed our knives by sticking them into the ground rapidly a few times, and we washed our plates with sand and wisps of grass. When we stopped, we arranged our wagons in a circle, and thus formed a 'corral,' or yard, where we drove our oxen to yoke them up. And the corral was often very useful as a fort, or camp, for defending ourselves against the Indians. Do you see that little hollow down there?" he asked, pointing to a depression in the ground a short distance to the right of the train. "Well, in that hollow our wagon-train was kept three days and nights by the Indians. Three days and nights they stayed around, and made several attacks. Two of our men were killed and three were wounded by their arrows, and others had narrow escapes. One arrow hit me on the throat, but I was saved by the knot of my neckerchief, and the point only tore the skin a little. Since that time I have always had a fondness for large neckties. I don't know how many of the Indians we killed, as they carried off their dead and wounded, to save them from being scalped. Next to getting the scalps of their enemies, the most important thing with the Indians is to save their own. We had several fights during our journey, but that one was the worst. Once a little party of us were surrounded in a small 'wallow,' and had a tough time to defend ourselves successfully. Luckily for us, the Indians had no fire-arms then, and their bows and arrows were no match for our rifles. Nowadays they are well armed, but there are[Pg 41] not so many of them, and they are not inclined to trouble the railway trains. They used to do a great deal of mischief in the old times, and many a poor fellow has been killed by them." As dusk came on nearly the whole population of Maastricht, with all their temporary guests, formed an endless procession and went to invoke God's mercy by the Virgin Mary's intercession. They went to Our Lady's Church, in which stands the miraculous statue of Sancta Maria Stella Maris. The procession filled all the principal streets and squares of the town. I took my stand at the corner of the Vrijthof, where all marched past me, men, women, and children, all praying aloud, with loud voices beseeching: "Our Lady, Star of the Sea, pray for us ... pray for us ... pray for us ...!" It had not occurred to her for some hours after Mrs. Campbell had told her of Landor's death that she was free now to give herself to Cairness. She had gasped, indeed, when she did remember it, and had put the thought away, angrily and self-reproachfully. But it returned now, and she felt that she might cling to it. She had been grateful, and she had been faithful, too.[Pg 286] She remembered only that Landor had been kind to her, and forgot that for the last two years she had borne with much harsh coldness, and with a sort of contempt which she felt in her unanalyzing mind to have been entirely unmerited. Gradually she raised herself until she sat quite erect by the side of the mound, the old exultation of her half-wild girlhood shining in her face as she planned the future, which only a few minutes before had seemed so hopeless. After he had gloated over Sergeant Ramsey, Shorty got his men into the road ready to start. Si placed himself in front of the squad and deliberately loaded his musket in their sight. Shorty took his place in the rear, and gave out: The groups about each gun thinned out, as the shrieking fragments of shell mowed down man after man, but the rapidity of the fire did not slacken in the least. One of the Lieutenants turned and motioned with his saber to the riders seated on their horses in the line of limbers under the cover of the slope. One rider sprang from each team and ran up to take the place of men who had fallen. "As long as there's men and women in the world, the men 'ull be top and the women bottom." Then, in the house, the little girls were useful. Mrs. Backfield was not so energetic as she used to be. She had never been a robust woman, and though her husband's care had kept her well and strong, her frame was not equal to Reuben's demands; after fourteen years' hard labour, she suffered from rheumatism, which though seldom acute, was inclined to make her stiff and slow. It was here that Caro and Tilly came in, and Reuben began to appreciate his girls. After all, girls were needed in a house—and as for young men and marriage, their father could easily see that such follies did not spoil their usefulness or take them from him. Caro and Tilly helped their grandmother in all sorts of ways—they dusted, they watched pots, they shelled peas and peeled potatoes, they darned house-linen, they could even make a bed between them. HoME一级毛片视频免费公开
ENTER NUMBET 0018sxchkj.com.cn www.skcgogogo.com.cn 40812.com.cn nxrkj.net.cn www.ifyixia.com.cn www.yzzxo.com.cn enyier.com.cn www.xuf888.com.cn fryfjbj.net.cn www.ag8.org.cn