|
|||||||
![]() |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,293
Karma: 1428313
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
|
[Editor Plugin] - Enabling 'Customize plugin' dialog directly from the Editor
Hi, everyone!
Firts of all, I am one BIG NOOB. So, if you can help me, please be as detailed as possible. ![]() Here is the deal: I've created an Editor Plugin (ACE) and it is working fine. It can be configured via Preferences > Plugin > Customize Plugin. It has a simple dialog with only 3 options. What I want is to enable this configuration to take place directly from the Plugin Icon (actualy, a litle arrow beside it) on the Editor Plugins toolbar. I've managed to create the menu entry 'Customize'. On 'main.py', I'm calling 'ConfigWidget' from 'config.py'. Altough, I get no error, nothing happens when I click 'Customize'. Relevant code on 'main.py': Spoiler:
Relevant code on 'config.py': Spoiler:
In case the code provide above is not enough, I'm attaching the actual plugin. Can anyone point me what I got wrong?
|
|
|
|
|
|
#2 |
|
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,609
Karma: 28549044
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
First for language, you want:
Code:
if language[0] in ("pt_BR", "pt_PT", "pt")
Now for the config dialog , you have to link up the config menu item to some code to actually open the dialog, like this, in main.py: Code:
def do_config(self):
from calibre.gui2.widgets2 import Dialog
from calibre.gui2.tweak_book import tprefs
from PyQt5.Qt import QVBoxLayout
from calibre_plugins.ACE.config import ConfigWidget
tool = self
class ConfigDialog(Dialog):
def __init__(self):
Dialog.__init__(self, 'Configure ACE', 'plugin-ace-config-dialog', parent=tool.gui, prefs=tprefs)
def setup_ui(self):
self.l = QVBoxLayout(self)
self.w = ConfigWidget()
self.l.addWidget(self.w)
def accept(self):
if self.w.validate():
self.w.save_settings()
Dialog.accept(self)
d = ConfigDialog()
d.exec_()
Code:
config_menu_item.triggered.connect(self.do_config) |
|
|
|
| Advert | |
|
|
|
|
#3 | |||
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,293
Karma: 1428313
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
|
Quote:
Quote:
Just one question: supose I have the POT (and PO/MO) file, how do I add it to Transifex? Quote:
|
|||
|
|
|
|
|
#4 | |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,293
Karma: 1428313
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
|
Quote:
Got everthing working and using MO files for translation. |
|
|
|
|
|
|
#5 |
|
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,609
Karma: 28549044
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
cool, you are welcome. If you wish to extract the translations into transifex, the best way to do it is to setup a guthub project for you plugin, have the .pot file there, then I can add the plugin to calibre-plugins on transifex and have it update the translations automatically from there. See for example how the SmartEject or PrincePDF plugins do their translations.
|
|
|
|
| Advert | |
|
|
|
|
#6 | |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,293
Karma: 1428313
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
|
Quote:
I think it is all set: https://github.com/thiagoeec/ACE. Please take I look if this is ok for integration with Transifex. |
|
|
|
|
|
|
#7 |
|
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,609
Karma: 28549044
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I have added it to transifex: https://www.transifex.com/calibre/calibre-plugins/ace/
|
|
|
|
|
|
#8 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,293
Karma: 1428313
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
|
I've pushed the pt_BR.po file and it is working as expected.
Thank you, Kovid. |
|
|
|
![]() |
| Tags |
| customize, editor plugin, menu |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Editor Plugin] EpubCheck | Doitsu | Plugins | 217 | 09-02-2025 01:26 AM |
| [Editor Plugin] LanguageTool | Doitsu | Plugins | 17 | 04-20-2024 03:21 PM |
| Open Metadata Editor from plugin | notbuu | Development | 5 | 10-05-2016 01:10 AM |
| Sample Plugin for the Editor | DiapDealer | Editor | 77 | 12-10-2014 08:16 AM |
| Editor plugin question | DiapDealer | Development | 2 | 07-28-2014 11:23 PM |