LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 11-12-2009, 04:20 PM   #1
Snouffelaire
LQ Newbie
 
Registered: Mar 2007
Location: France
Distribution: Ubuntu 9.04
Posts: 13

Rep: Reputation: 0
How to do syntax highlighting in a python-qt application ?


Hello all,

I have done a little app (TeXamator) that can (but it's not its first goal) edit some TeX code. It is written in Python with the PyQt4 library. I would like to highlight the TeX code but I'm not sure how to do this. My first thoughts were to use the code of, say, kate, or any other text editor that supports TeX (like kwrite, gedit, kile, you name it). After a bit of looking around, I couldn't find what I was looking for.

Do you know where those codes are hidden ? If not, would you know how to easily implement it ?

Thanks you,

Alexis.
 
Old 11-12-2009, 04:51 PM   #2
ammorais
Member
 
Registered: Nov 2009
Location: Lisbon, Portugal
Distribution: Gentoo, CentOs, Ubuntu, Debian
Posts: 182

Rep: Reputation: 49
I have only programed trough the C++ api in Qt, I think that every class as it's correspondent in python.
So I suggest you have a look at this example http://qt.nokia.com/doc/4.0/richtext...ghlighter.html and try to apply to python.
All the concepts are there.

<edit>
To the moderators: I think this would be better at the programming section.
</edit>

Last edited by ammorais; 11-12-2009 at 04:55 PM.
 
Old 11-12-2009, 04:59 PM   #3
Snouffelaire
LQ Newbie
 
Registered: Mar 2007
Location: France
Distribution: Ubuntu 9.04
Posts: 13

Original Poster
Rep: Reputation: 0
Quote:
<edit>
To the moderators: I think this would be better at the programming section.
</edit>
I didn't find it, please move my thread !

And thanks for your quick reply, I will have a look at it !
 
Old 11-12-2009, 06:32 PM   #4
Elv13
Member
 
Registered: Apr 2006
Location: Montreal,Quebec
Distribution: Gentoo
Posts: 825

Rep: Reputation: 128Reputation: 128
Yea, QSyntaxHighlighter is the way to go. Keep your code clean, it is easy to do messy/hacky syntax highlight code. KatePart can also work, but I never tested using python.
 
Old 11-13-2009, 03:19 AM   #5
Snouffelaire
LQ Newbie
 
Registered: Mar 2007
Location: France
Distribution: Ubuntu 9.04
Posts: 13

Original Poster
Rep: Reputation: 0
Thank you both for this advice, this seems to be exactly what I need. My C++ skills are kind of low but they should be sufficient to translate this code to Python

Thanks again,

Alexis.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VIM Syntax Highlighting JMJ_coder Programming 3 03-05-2008 04:37 PM
syntax highlighting in vi mehrots Linux - Software 10 07-16-2007 08:50 AM
C++ syntax highlighting with PHP ckoniecny Programming 1 08-11-2006 07:09 AM
syntax highlighting rohr Programming 3 07-06-2005 06:07 AM
Vim syntax highlighting NSKL Linux - Software 2 11-09-2002 02:39 AM


All times are GMT -5. The time now is 04:39 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration