10-02-2013, 09:41 PM | #61 | ||||||
Sigil & calibre developer
Posts: 2,487
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
|
Yes. Sigil already uses Qt as the GUI.
Yes but I don't recommend it. I looked at using it but decided against it. It's cumbersome to work with. It also has poor regex support. You can hack it on but it's not very friendly. It doesn't support RTL languages. But mainly the API isn't nice. It would bring a lot of cool features to Sigil instantly but it may be more trouble than it's worth. Just like Sigil already does, yes, QWebKit via one of the above mentioned Python bindings. Quote:
Quote:
Quote:
Probably none. The advantage of Sigil are those things that you said could be added later. At that point you'd have Sigil Python which isn't as good a Sigil. That means no one will want to use it so no feed back, and no one interested in helping when Sigil is already better. Quote:
Quote:
I'm not saying I don't like C or it's not useful. It is extremely useful and I enjoy working with it. I just don't like doing the same task over. Once for work then again at home. When it comes to raw performance it's hard to beat C. Quote:
|
||||||
10-02-2013, 10:17 PM | #62 | |
Color me gone
Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
|
Quote:
Thank you for working on Sigil for such a long time after pounding on code all day at work. It is a fantastic tool and for me, a hobbyist, it does everything needed. The only problem is fully discovering and using all its features. |
|
Advert | |
|
10-02-2013, 10:40 PM | #63 |
creator of calibre
Posts: 44,380
Karma: 23766374
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
@user_none: I fully understand the reasons you chose to not rewrite Sigil in python, I would probably have done the same if I were in your shoes. I was just saying, it's a pity
Regarding folding it into calibre, or alternatively, adding a GUI based ebook tweak tool to calibre, I dont imagine being able to directly use Sigil's code, it would need to be re-written. However, calibre has lots of ebook related code that can be re-used, for example, the ToC editor and the Polish Books code. This would make various bits of the re-implementation available for free and would have the bonus of supporting both epub and azw3. The idea would be to take inspiration and techniques from Sigil, not use the code directly. I would be happy to help with such an effort, unfortunately, it's not something I am in a position to do alone, as my plate is pretty full with work that is a higher priority for calibre. |
10-03-2013, 08:07 PM | #64 | ||||||
Grand Sorcerer
Posts: 6,111
Karma: 34000001
Join Date: Mar 2008
Device: KPW1, KA1
|
Quote:
Quote:
Quote:
Quote:
If it would be possible to put Sigil's EPUB capability into a library (so, to open an EPUB, hand out an object with everything in it, and also save an EPUB if the library receives such an object back again), then it may be possible to fork an existing editor that already has a plugin structure, tack the EPUB library beneath it (coupled to its Open and Save functions), and then write the other needed parts as plugins. Even if that other editor is written in something like C++, it would save on maintaining the editor itself. I'm just brainstorming here... Quote:
Quote:
And on speed and compactness... that's the reason why it's still used a lot for microcontrollers. When programming a chip that runs at 10-25 MHz and has 32-512 kB of RAM, C is still first choice most of the time. |
||||||
10-03-2013, 08:16 PM | #65 | |
Grand Sorcerer
Posts: 6,111
Karma: 34000001
Join Date: Mar 2008
Device: KPW1, KA1
|
Quote:
How much work would you think it to be, if Calibre was extended with an EPUB/AZW3 file explorer and a code editor, based on some already existing component? |
|
Advert | |
|
10-03-2013, 08:43 PM | #66 | |||||||
Sigil & calibre developer
Posts: 2,487
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
|
Quote:
The one Sigil uses is a subclass of QPlainTextEdit with a lot of functionality added. Look qt QtCreator. It uses the same technique for their editor. There really isn't any reason it can't be as powerful as Scintilla. It just isn't there yet. Quote:
The approach is fine. I'm saying I wouldn't recommend trying. You'd be better off starting over and looking at how Sigil deals with certain cases then coding that then trying to turn Sigil into a library. Quote:
I just feel that the focus should be on differentiating a rewrite from other editors. Focus on what those editors that can open and save epubs don't offer. If your goal is create an editor that can't do with Sigil already does and what other editors already do then worry at that time start thinking about how to add the epub features you're taking the wrong approach. Quote:
Quote:
Once you have an over view of the format focus on the parts you actually need to care about when you need to worry about them. This does mean you'll end up having to recode when you read something later on that you didn't account for but you'll save in the long run by not spending time designing around features you'll never implement. Sigil doesn't touch and completely ignores parts of the epub spec. Other than a basic over view of those parts I don't know implementation details. Finally, understanding the epub format has a lot to do with calibre. I've implemented conversion for a number formats. Calibre's conversion pipe line is in -> OEB (basically the guts of an epub) -> out. That has helped a lot. Quote:
The Python community even takes this even further. XML libraries like lxml actually use the same API as the XML API that comes with Python. So transitioning between the two is pretty much seamless. Quote:
As for the editor you'll need a good editor. I was looking at this and it would work with minimal tweaking. It uses the subclassed QPlainTextEdit concept I spoke about. Look at this, this, and this blog post I wrote for examples of extending and working with QPlainTextEdit. These concepts are the basis of what Sigil, QtCreator and Spyderlib do to provide their editors. Hooking in the regex stuff would be the hardest part but python has very strong regex (search and replace) support. You'd essentially get the data from the editor, run the search, get the offsets and highlight that area of the editor. |
|||||||
10-03-2013, 09:13 PM | #67 | |||||
Grand Sorcerer
Posts: 6,111
Karma: 34000001
Join Date: Mar 2008
Device: KPW1, KA1
|
Quote:
I hope the original designer of Sigil had a very good reason to do it like that. Personally, I would never have intertwined Sgil's GUI and business logic. (Even if it wasn't for the fact that, when I was in university, it would almost certainly lower your mark by two points or so if you did something like that without a *very* good reason...) OK... in that case, turning Sigil into an EPUB library is out. It would indeed be much better to just look at the code, and rewrite it in Python. Quote:
Quote:
Quote:
Quote:
What version of Python does Calibre use at this moment? There is some (very small) stuff I may want to add to one of Kiwidude's plugins. I think it's a good exercise to get going with Python and take a first look at how Calibre actually works, but of course then I must use the same Python version as Calibre does. |
|||||
10-03-2013, 09:33 PM | #68 | |||
Grand Sorcerer
Posts: 27,942
Karma: 198500000
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
From the Python 3.3 release-notes: Quote:
Quote:
|
|||
10-03-2013, 10:27 PM | #69 | ||||
Sigil & calibre developer
Posts: 2,487
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
|
Quote:
Don't forget the GUI need to show the data elements. The GUI needs to hold those elements. You can have them stored in a library object but then you need to duplicate them for the GUI to display them because the GUI needs them in a format understandable by the GUI. So you end up with two options. 1) You have two sets of the same data that need to be kept in sync. Make a change to the GUI and make sure you change the lib version. Make an API change using the lib then you have to ensure the GUI gets updated. In this case how do you inform the GUI the elements changes? You need to signal to the GUI that that happened. Now you have a whole lot more logic to deal with. 2) Put the data into the GUI format (model and view based not necessarily owned by the GUI). Then you only have one copy to deal with and you don't need extra logic for syncing. You could have a library that uses the GUI model for the data but you're in the same boat because it's coupled to the GUI framework and not really a library (in the sense of a decoupled reusable component) at that point. This is a basic trade off in GUI programming of dealing with time and effort to get something done. What it really comes down to is why spend the extra time and effort on something that you're design isn't supposed to ever need to do. Quote:
Quote:
Quote:
That said Sigil doesn't use Qt's regex for user level searches anyway. I wrote a custom bindings for QString to libPCRE and all the replacement code in Sigil because I found QRegExp lacking. Qt5's new PCRE based replacement is still lacking the replace options mine supports. So, that doesn't necessarily negate Python. A different regex library like the one you mentioned could be used in place of Pythons standard re. |
||||
10-03-2013, 10:56 PM | #70 |
creator of calibre
Posts: 44,380
Karma: 23766374
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
The hardest part of writing a sigil replacement inside calibre would be the editor component, especially if you want both a code editor and a WYSIWYG editor.
The rest: editing a list of files, editing metadata, editing ToC, renaming/moving around files would be trivial. So to move this conversation along, here's a concrete offer. I offer to implement the *rest* part of it -- list of files, edit metadata, edit tocs, renaming/moving files, editing the spine, various automated actions from the Polish Books component -- if someone will volunteer to tackle the editor component. I can set up a basic GUI shell that does most of that in a few weeks, and then let whoever volunteers work on the editor component. But, I will only spend the time to do that if I get a firm commitment from someone to handle the editor part. That committment will need to include ongoing support for fixing bugs in the editor component. Last edited by kovidgoyal; 10-03-2013 at 10:59 PM. |
10-04-2013, 02:37 AM | #71 |
Wizard
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
That is a very generous offer Kovid! It makes me want to try out Python again to be honest. I tried it, but lacked a target.
However, I first need to finish the programs I am currently working on first and I would do not have the time to do big contributions, but for small ones I would be fine. |
10-04-2013, 04:48 AM | #72 |
Interested in the matter
Posts: 421
Karma: 426094
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook InkPad 3
|
Ah Kovid! you are great.
And... an idea. Who needs a WYSIWYG editor? With the code editor and the preview window, I think that's enough. |
10-04-2013, 09:23 AM | #73 |
Sigil & calibre developer
Posts: 2,487
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
|
|
10-04-2013, 09:41 AM | #74 | ||
Grand Sorcerer
Posts: 6,111
Karma: 34000001
Join Date: Mar 2008
Device: KPW1, KA1
|
Quote:
Quote:
|
||
10-04-2013, 09:41 AM | #75 | |
Well trained by Cats
Posts: 30,397
Karma: 58055234
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Two of the GREAT benefits of Sigil: 1) Text location Synchronization from the GUI (BV) to nearby in CV 2) Simple BV edits Split, Join (sorta works in 7.x. Code cleanup needed afterwards.) and simple character edits (words that may be spelled correct, but are the wrong word in context. Auto-incorrect ). Anything complex, I switch to CV where I mostly do work(need to see what part of the CSS to fix). |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how many tocs does Sigil make? | Gregg Bell | Sigil | 17 | 01-31-2013 09:39 AM |
Sigil 0.3.4 / Problème CSS entre Sigil et iPad | Grivels | Software | 10 | 07-03-2011 09:06 AM |
using sigil to make changes befote conversion | alansplace | Sigil | 11 | 06-07-2011 07:50 AM |
i can't make sigil run in fedora 14 | nastarovia | Sigil | 1 | 01-20-2011 05:02 AM |