| 1 |
# SOME DESCRIPTIVE TITLE. |
| 2 |
# Copyright (C) Kovid Goyal |
| 3 |
# This file is distributed under the same license as the calibre package. |
| 4 |
# |
| 5 |
# Translators: |
| 6 |
# Michal Várady <[email protected]>, 2026 |
| 7 |
# Trottel <[email protected]>, 2014-2017,2019-2023 |
| 8 |
msgid "" |
| 9 |
msgstr "" |
| 10 |
"Project-Id-Version: calibre\n" |
| 11 |
"Report-Msgid-Bugs-To: \n" |
| 12 |
"POT-Creation-Date: 2026-06-12 19:09+0000\n" |
| 13 |
"PO-Revision-Date: 2014-06-17 08:35+0000\n" |
| 14 |
"Last-Translator: Michal Várady <[email protected]>, 2026\n" |
| 15 |
"Language-Team: Czech (http://app.transifex.com/calibre/calibre/language/cs/)\n" |
| 16 |
"MIME-Version: 1.0\n" |
| 17 |
"Content-Type: text/plain; charset=UTF-8\n" |
| 18 |
"Content-Transfer-Encoding: 8bit\n" |
| 19 |
"Language: cs\n" |
| 20 |
"Plural-Forms: nplurals=4; plural=(n == 1 && n % 1 == 0) ? 0 : (n >= 2 && n <= 4 && n % 1 == 0) ? 1: (n % 1 != 0 ) ? 2 : 3;\n" |
| 21 |
|
| 22 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:4 |
| 23 |
msgid "Writing your own plugins to extend calibre's functionality" |
| 24 |
msgstr "Psaní vlastních modulů pro rozšíření funkcí Calibre" |
| 25 |
|
| 26 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:6 |
| 27 |
msgid "" |
| 28 |
"calibre has a very modular design. Almost all functionality in calibre comes" |
| 29 |
" in the form of plugins. Plugins are used for conversion, for downloading " |
| 30 |
"news (though these are called recipes), for various components of the user " |
| 31 |
"interface, to connect to different devices, to process files when adding " |
| 32 |
"them to calibre and so on. You can get a complete list of all the built-in " |
| 33 |
"plugins in calibre by going to :guilabel:`Preferences->Advanced->Plugins`." |
| 34 |
msgstr "Calibre má velice modulární provedení. Téměř všechny funkce jsou ve formě modulů. Moduly jsou použity pro převod, stahování zpráv (ačkoliv ty jsou nazvány předpisy), různé komponenty uživatelského rozhraní, připojení k různým zařízením, zpracování souborů při jejich přidávání do Calibre a tak dále. Kompletní seznam všech vestavěných modulů můžete získat v Calibre v :guilabel:`Předvolby->Rozšířené->Moduly`." |
| 35 |
|
| 36 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:8 |
| 37 |
msgid "" |
| 38 |
"Here, we will teach you how to create your own plugins to add new features " |
| 39 |
"to calibre." |
| 40 |
msgstr "Zde vás naučíme, jak vytvořit vlastní moduly pro přidání nových funkcí do Calibre." |
| 41 |
|
| 42 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:13 |
| 43 |
msgid "Contents" |
| 44 |
msgstr "Obsah" |
| 45 |
|
| 46 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:15 |
| 47 |
msgid "This only applies to calibre releases >= 0.8.60" |
| 48 |
msgstr "Toto platí pouze pro vydání Calibre >= 0.8.60" |
| 49 |
|
| 50 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:18 |
| 51 |
msgid "Anatomy of a calibre plugin" |
| 52 |
msgstr "Anatomie modulu Calibre" |
| 53 |
|
| 54 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:20 |
| 55 |
msgid "" |
| 56 |
"A calibre plugin is very simple, it's just a ZIP file that contains some " |
| 57 |
"Python code and any other resources like image files needed by the plugin. " |
| 58 |
"Without further ado, let's see a basic example." |
| 59 |
msgstr "Modul Calibre je velice jednoduchý, je to prostě soubor ZIP, který obsahuje nějaký kód Pythonu a jakékoliv jiné zdroje, jako soubory obrázků vyžadované modulem. Bez dalších okolků se pojďme podívat na základní příklad." |
| 60 |
|
| 61 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:24 |
| 62 |
msgid "" |
| 63 |
"Suppose you have an installation of calibre that you are using to self " |
| 64 |
"publish various e-documents in EPUB and MOBI formats. You would like all " |
| 65 |
"files generated by calibre to have their publisher set as \"Hello world\", " |
| 66 |
"here's how to do it. Create a file named :file:`__init__.py` (this is a " |
| 67 |
"special name and must always be used for the main file of your plugin) and " |
| 68 |
"enter the following Python code into it:" |
| 69 |
msgstr "Předpokládejme, že máte instalaci Calibre, kterou používáte pro vlastní publikaci různých elektronických dokumentů ve formátech EPUB a MOBI. Chtěli byste, aby všechny soubory generované v Calibre měli vydavatele nastaveného jako \"Hello World\", zde je návod, jak to udělat. Vytvořte soubor s názvem :file:`__init__.py` (toto je speciální název a musí být vždy použit pro hlavní soubor vašeho modulu) a zadejte do něj následující kód Pythonu:" |
| 70 |
|
| 71 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:32 |
| 72 |
msgid "" |
| 73 |
"That's all. To add this code to calibre as a plugin, simply run the " |
| 74 |
"following in the folder in which you created :file:`__init__.py`::" |
| 75 |
msgstr "To je vše. Pro přidání tohoto kódu do Calibre jako modulu stačí spustit následující ve složce, ve které jste vytvořili :file:`__init__.py`::" |
| 76 |
|
| 77 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:38 |
| 78 |
msgid "" |
| 79 |
"On macOS, the command line tools are inside the calibre bundle, for example," |
| 80 |
" if you installed calibre in :file:`/Applications` the command line tools " |
| 81 |
"are in :file:`/Applications/calibre.app/Contents/MacOS/`." |
| 82 |
msgstr "Na macOS jsou nástroje příkazového řádku uvnitř sady Calibre, například pokud jste nainstalovali Calibre do :file:`/Applications`, nástroje příkazového řádku jsou v :file:`/Applications/calibre.app/Contents/MacOS/`." |
| 83 |
|
| 84 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:42 |
| 85 |
msgid "" |
| 86 |
"You can download the Hello World plugin from " |
| 87 |
":download_file:`helloworld_plugin.zip`." |
| 88 |
msgstr "Modul Hello World můžete stáhnout z :download_file:`helloworld_plugin.zip`." |
| 89 |
|
| 90 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:45 |
| 91 |
msgid "" |
| 92 |
"Every time you use calibre to convert a book, the plugin's :meth:`run` " |
| 93 |
"method will be called and the converted book will have its publisher set to " |
| 94 |
"\"Hello World\". This is a trivial plugin, let's move on to a more complex " |
| 95 |
"example that actually adds a component to the user interface." |
| 96 |
msgstr "Pokaždé, když pomocí calibre převedete knihu, zavolá se metoda modulu :meth:`run` a převedená kniha bude mít vydavatele nastaveného na „Hello World“. Toto je triviální modul, přejděme tedy ke složitějšímu příkladu, který skutečně přidává komponentu do uživatelského rozhraní." |
| 97 |
|
| 98 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:50 |
| 99 |
msgid "A User Interface plugin" |
| 100 |
msgstr "Modul uživatelského rozhraní" |
| 101 |
|
| 102 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:52 |
| 103 |
msgid "" |
| 104 |
"This plugin will be spread over a few files (to keep the code clean). It " |
| 105 |
"will show you how to get resources (images or data files) from the plugin " |
| 106 |
"ZIP file, allow users to configure your plugin, how to create elements in " |
| 107 |
"the calibre user interface and how to access and query the books database in" |
| 108 |
" calibre." |
| 109 |
msgstr "Tento modul bude rozdělen do několika souborů (aby kód zůstal čistý). Ukáže vám, jak získat zdroje (soubory obrázků nebo dat) ze souboru ZIP modulu, což umožňuje uživatelům konfigurovat váš modul, jak vytvořit prvky v uživatelském rozhraní Calibre a jak přistupovat k a dotazovat se databáze knih v Calibre." |
| 110 |
|
| 111 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:57 |
| 112 |
msgid "" |
| 113 |
"You can download this plugin from :download_file:`interface_demo_plugin.zip`" |
| 114 |
msgstr "Tento modul můžete stáhnout z :download_file:`interface_demo_plugin.zip`" |
| 115 |
|
| 116 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:61 |
| 117 |
msgid "" |
| 118 |
"The first thing to note is that this ZIP file has a lot more files in it, " |
| 119 |
"explained below, pay particular attention to ``plugin-import-name-" |
| 120 |
"interface_demo.txt``." |
| 121 |
msgstr "První věc, na kterou pamatujte, je to, že tento soubor ZIP má v sobě mnohem více souborů, vysvětleno níže, věnujte zvláštní pozornost ``plugin-import-name-interface_demo.txt``." |
| 122 |
|
| 123 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:64 |
| 124 |
msgid "**plugin-import-name-interface_demo.txt**" |
| 125 |
msgstr "**plugin-import-name-interface_demo.txt**" |
| 126 |
|
| 127 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:65 |
| 128 |
msgid "" |
| 129 |
"An empty text file used to enable the multi-file plugin magic. This file " |
| 130 |
"must be present in all plugins that use more than one .py file. It should be" |
| 131 |
" empty and its filename must be of the form: ``plugin-import-" |
| 132 |
"name-**some_name**.txt``. The presence of this file allows you to import " |
| 133 |
"code from the .py files present inside the ZIP file, using a statement " |
| 134 |
"like::" |
| 135 |
msgstr "Prázdný textový soubor použitý pro umožnění kouzla vícesouborového modulu. Tento soubor musí být přítomen ve všech modulech, které používají více než jeden soubor .py. Měl by být prázdný a jeho název souboru musí být ve formě: plugin-import-name-**some_name**.txt. Přítomnost tohoto souboru vám umožňuje importovat kód ze souborů .py přítomných uvnitř souboru ZIP pomocí příkazu, jako je:" |
| 136 |
|
| 137 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:71 |
| 138 |
msgid "" |
| 139 |
"The prefix ``calibre_plugins`` must always be present. ``some_name`` comes " |
| 140 |
"from the filename of the empty text file. ``some_module`` refers to " |
| 141 |
":file:`some_module.py` file inside the ZIP file. Note that this importing is" |
| 142 |
" just as powerful as regular Python imports. You can create packages and " |
| 143 |
"subpackages of .py modules inside the ZIP file, just like you would normally" |
| 144 |
" (by defining __init__.py in each sub-folder), and everything should \"just " |
| 145 |
"work\"." |
| 146 |
msgstr "Předpona ``calibre_plugins`` musí být vždy přítomna. ``some_name`` pochází z názvu prázdného textového souboru. ``some_module`` odkazuje na soubor :file:`some_module.py` uvnitř souboru ZIP. Všimněte si, že tento import je stejně výkonný jako běžné importy v Pythonu. Uvnitř souboru ZIP můžete vytvářet balíčky a podbalíčky modulů .py stejně jako obvykle (definováním __init__.py v každé podsložce) a vše by mělo „prostě fungovat“." |
| 147 |
|
| 148 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:76 |
| 149 |
msgid "" |
| 150 |
"The name you use for ``some_name`` enters a global namespace shared by all " |
| 151 |
"plugins, **so make it as unique as possible**. But remember that it must be " |
| 152 |
"a valid Python identifier (only alphabets, numbers and the underscore)." |
| 153 |
msgstr "Název, který použijete pro ``some_name``, zadá globální obor názvů sdílený všemi moduly, **takže by měl být co nejjedinečnější**. Ale nezapomeňte, že to musí být platný identifikátor Pythonu (pouze abecední znaky, číslice a podtržítko)." |
| 154 |
|
| 155 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:79 |
| 156 |
msgid "**__init__.py**" |
| 157 |
msgstr "**__init__.py**" |
| 158 |
|
| 159 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:80 |
| 160 |
msgid "As before, the file that defines the plugin class" |
| 161 |
msgstr "Jako předtím, soubor, který definuje třídu modulu" |
| 162 |
|
| 163 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:82 |
| 164 |
msgid "**main.py**" |
| 165 |
msgstr "**main.py**" |
| 166 |
|
| 167 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:83 |
| 168 |
msgid "This file contains the actual code that does something useful" |
| 169 |
msgstr "Tento soubor obsahuje skutečný kód, který dělá něco užitečného" |
| 170 |
|
| 171 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:85 |
| 172 |
msgid "**ui.py**" |
| 173 |
msgstr "**ui.py**" |
| 174 |
|
| 175 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:86 |
| 176 |
msgid "This file defines the interface part of the plugin" |
| 177 |
msgstr "Tento soubor definuje součást rozhraní modulu" |
| 178 |
|
| 179 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:88 |
| 180 |
msgid "**images/icon.png**" |
| 181 |
msgstr "**images/icon.png**" |
| 182 |
|
| 183 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:89 |
| 184 |
msgid "The icon for this plugin" |
| 185 |
msgstr "Ikona pro tento modul" |
| 186 |
|
| 187 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:91 |
| 188 |
msgid "**about.txt**" |
| 189 |
msgstr "**about.txt**" |
| 190 |
|
| 191 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:92 |
| 192 |
msgid "A text file with information about the plugin" |
| 193 |
msgstr "Textový soubor s informacemi o modulu" |
| 194 |
|
| 195 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:94 |
| 196 |
msgid "**translations**" |
| 197 |
msgstr "**translations**" |
| 198 |
|
| 199 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:95 |
| 200 |
msgid "" |
| 201 |
"A folder containing .mo files with the translations of the user interface of" |
| 202 |
" your plugin into different languages. See below for details." |
| 203 |
msgstr "Složka obsahující soubory .mo s překlady uživatelského rozhraní vašeho modulu do různých jazyků. Podívejte se níže na podrobnosti." |
| 204 |
|
| 205 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:99 |
| 206 |
msgid "Now let's look at the code." |
| 207 |
msgstr "Nyní se podívejme na kód." |
| 208 |
|
| 209 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:102 |
| 210 |
msgid "__init__.py" |
| 211 |
msgstr "__init__.py" |
| 212 |
|
| 213 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:104 |
| 214 |
msgid "First, the obligatory ``__init__.py`` to define the plugin metadata:" |
| 215 |
msgstr "Nejdříve povinný ``__init__.py`` pro definování metadat modulu:" |
| 216 |
|
| 217 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:109 |
| 218 |
msgid "" |
| 219 |
"The only noteworthy feature is the field :attr:`actual_plugin`. Since " |
| 220 |
"calibre has both command line and GUI interfaces, GUI plugins like this one " |
| 221 |
"should not load any GUI libraries in __init__.py. The actual_plugin field " |
| 222 |
"does this for you, by telling calibre that the actual plugin is to be found " |
| 223 |
"in another file inside your ZIP archive, which will only be loaded in a GUI " |
| 224 |
"context." |
| 225 |
msgstr "Jediná funkce, která stojí za pozornost, je pole :attr:`actual_plugin`. Protože Calibre má jak příkazový řádek, tak grafická rozhraní, moduly grafického rozhraní, jako je tento, by v __init__.py neměly načítat žádné knihovny grafického rozhraní. Pole actual_plugin to dělá za vás tím, že řekne Calibre, že skutečný modul je třeba hledat v jiném souboru uvnitř vašeho archivu ZIP, který bude načten pouze v kontextu grafického rozhraní." |
| 226 |
|
| 227 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:114 |
| 228 |
msgid "" |
| 229 |
"Remember that for this to work, you must have a plugin-import-name-" |
| 230 |
"some_name.txt file in your plugin ZIP file, as discussed above." |
| 231 |
msgstr "Nezapomeňte, že aby toto fungovalo, musíte mít ve svém souboru ZIP soubor plugin-import-name-some_name.txt, jak bylo probráno výše." |
| 232 |
|
| 233 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:117 |
| 234 |
msgid "" |
| 235 |
"Also there are a couple of methods for enabling user configuration of the " |
| 236 |
"plugin. These are discussed below." |
| 237 |
msgstr "Také existuje pár metod pro povolení uživatelské konfigurace modulu. Ty jsou popsány níže." |
| 238 |
|
| 239 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:120 |
| 240 |
msgid "ui.py" |
| 241 |
msgstr "ui.py" |
| 242 |
|
| 243 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:122 |
| 244 |
msgid "" |
| 245 |
"Now let's look at ui.py which defines the actual GUI plugin. The source code" |
| 246 |
" is heavily commented and should be self explanatory:" |
| 247 |
msgstr "Nyní se podívejme na ui.py, který definuje skutečné grafické rozhraní modulu. Zdrojový kód je silně okomentovaný a měl by být sebevysvětlující:" |
| 248 |
|
| 249 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:128 |
| 250 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:220 |
| 251 |
msgid "main.py" |
| 252 |
msgstr "main.py" |
| 253 |
|
| 254 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:130 |
| 255 |
msgid "The actual logic to implement the Interface Plugin Demo dialog." |
| 256 |
msgstr "Skutečná logika pro implementaci dialogového okna rozhraní ukázkového modulu." |
| 257 |
|
| 258 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:136 |
| 259 |
msgid "Getting resources from the plugin ZIP file" |
| 260 |
msgstr "Získání zdrojů ze souboru ZIP modulu" |
| 261 |
|
| 262 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:138 |
| 263 |
msgid "" |
| 264 |
"calibre's plugin loading system defines a couple of built-in functions that " |
| 265 |
"allow you to conveniently get files from the plugin ZIP file." |
| 266 |
msgstr "Systém načítání doplňků Calibre definuje pár vestavěných funkcí, které vám umožňují pohodlně získat soubory ze souboru ZIP modulu." |
| 267 |
|
| 268 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:140 |
| 269 |
msgid "**get_resources(name_or_list_of_names)**" |
| 270 |
msgstr "**get_resources(name_or_list_of_names)**" |
| 271 |
|
| 272 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:141 |
| 273 |
msgid "" |
| 274 |
"This function should be called with a list of paths to files inside the ZIP " |
| 275 |
"file. For example to access the file :file:`icon.png` in the folder images " |
| 276 |
"in the ZIP file, you would use: ``images/icon.png``. Always use a forward " |
| 277 |
"slash as the path separator, even on Windows. When you pass in a single " |
| 278 |
"name, the function will return the raw bytes of that file or None if the " |
| 279 |
"name was not found in the ZIP file. If you pass in more than one name then " |
| 280 |
"it returns a dictionary mapping the names to bytes. If a name is not found," |
| 281 |
" it will not be present in the returned dictionary." |
| 282 |
msgstr "Tato funkce by měla být volána se seznamem cest k souborům uvnitř souboru ZIP. Například pro přístup k souboru :file:`icon.png` ve složce images v souboru ZIP byste použili: ``images/icon.png``. Jako oddělovač cest vždy používejte lomítko, a to i ve Windows. Pokud předáte jeden název, funkce vrátí nezpracované bajty tohoto souboru nebo None, pokud název nebyl v souboru ZIP nalezen. Pokud předáte více než jeden název, vrátí slovník mapující názvy na bajty. Pokud název nebyl nalezen, nebude ve vráceném slovníku přítomen." |
| 283 |
|
| 284 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:150 |
| 285 |
msgid "**get_icons(name_or_list_of_names, plugin_name='')**" |
| 286 |
msgstr "**get_icons(name_or_list_of_names, plugin_name='')**" |
| 287 |
|
| 288 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:151 |
| 289 |
msgid "" |
| 290 |
"A wrapper for get_resources() that creates QIcon objects from the raw bytes " |
| 291 |
"returned by get_resources. If a name is not found in the ZIP file the " |
| 292 |
"corresponding QIcon will be null. In order to support icon theme-ing, pass " |
| 293 |
"in the human friendly name of your plugin as ``plugin_name``. If the user is" |
| 294 |
" using an icon theme with icons for your plugin, they will be loaded " |
| 295 |
"preferentially." |
| 296 |
msgstr "Obal pro funkci get_resources(), který vytváří objekty QIcon ze surových bajtů vrácených funkcí get_resources. Pokud v souboru ZIP není nalezen název, bude odpovídající QIcon nulový. Aby bylo možné podporovat změnu ikon motivu, předejte lidsky přívětivý název vašeho modulu jako ``nazev_modulu``. Pokud uživatel používá motiv ikon s ikonami vašeho modulu, budou načteny přednostně." |
| 297 |
|
| 298 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:160 |
| 299 |
msgid "Enabling user configuration of your plugin" |
| 300 |
msgstr "Povolení uživatelské konfigurace vašeho modulu" |
| 301 |
|
| 302 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:162 |
| 303 |
msgid "" |
| 304 |
"To allow users to configure your plugin, you must define three methods in " |
| 305 |
"your base plugin class, **is_customizable**, **config_widget** and " |
| 306 |
"**save_settings** as shown below:" |
| 307 |
msgstr "Abyste povolili uživatelům konfigurovat váš modul, musíte definovat ve své základní třídě modulu tři metody, **is_customizable**, **config_widget** a **save_settings** jak je uvedeno níže:" |
| 308 |
|
| 309 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:173 |
| 310 |
msgid "" |
| 311 |
"calibre has many different ways to store configuration data (a legacy of its" |
| 312 |
" long history). The recommended way is to use the **JSONConfig** class, " |
| 313 |
"which stores your configuration information in a .json file." |
| 314 |
msgstr "Calibre má mnoho různých způsobů, jak ukládat konfigurační data (starší verze jeho dlouhé historie). Doporučený způsob je použít třídu **JSONConfig**, která ukládá vaše konfigurační informace v souboru .json." |
| 315 |
|
| 316 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:175 |
| 317 |
msgid "" |
| 318 |
"The code to manage configuration data in the demo plugin is in config.py:" |
| 319 |
msgstr "Kód pro správu konfiguračních dat v ukázkovém modulu je v config.py:" |
| 320 |
|
| 321 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:180 |
| 322 |
msgid "" |
| 323 |
"The ``prefs`` object is now available throughout the plugin code by a " |
| 324 |
"simple::" |
| 325 |
msgstr "Object ``prefs`` je nyní dostupný v celém kódu modulu jednoduchým::" |
| 326 |
|
| 327 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:185 |
| 328 |
msgid "You can see the ``prefs`` object being used in main.py:" |
| 329 |
msgstr "Můžete vidět objekt ``prefs`` použitý v main.py:" |
| 330 |
|
| 331 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:192 |
| 332 |
msgid "Edit book plugins" |
| 333 |
msgstr "Moduly pro úpravu knihy" |
| 334 |
|
| 335 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:194 |
| 336 |
msgid "" |
| 337 |
"Now let's change gears for a bit and look at creating a plugin to add tools " |
| 338 |
"to the calibre book editor. The plugin is available here: " |
| 339 |
":download_file:`editor_demo_plugin.zip`." |
| 340 |
msgstr "Nyní pojďme na chvíli přeřadit a podívejme se na vytvoření modulu pro přidání nástrojů do editoru knih Calibre. Modul je dostupný zde: :download_file:`editor_demo_plugin.zip`." |
| 341 |
|
| 342 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:198 |
| 343 |
msgid "" |
| 344 |
"The first step, as for all plugins is to create the import name empty txt " |
| 345 |
"file, as described :ref:`above <import_name_txt>`. We shall name the file " |
| 346 |
"``plugin-import-name-editor_plugin_demo.txt``." |
| 347 |
msgstr "Prvním krokem, stejně jako pro všechny moduly, je vytvořit název importu prázdného souboru txt, jak je popsáno :ref:`výše <import_name_txt>`. Pojmenujeme soubor ``plugin-import-name-editor_plugin_demo.txt``." |
| 348 |
|
| 349 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:202 |
| 350 |
msgid "" |
| 351 |
"Now we create the mandatory ``__init__.py`` file that contains metadata " |
| 352 |
"about the plugin -- its name, author, version, etc." |
| 353 |
msgstr "Nyní vytvoříme povinný soubor ``__init__.py``, který obsahuje metadata o modulu -- jeho název, autora, verzi atd." |
| 354 |
|
| 355 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:208 |
| 356 |
msgid "" |
| 357 |
"A single editor plugin can provide multiple tools each tool corresponds to a" |
| 358 |
" single button in the toolbar and entry in the :guilabel:`Plugins` menu in " |
| 359 |
"the editor. These can have sub-menus in case the tool has multiple related " |
| 360 |
"actions." |
| 361 |
msgstr "Jeden modul editoru může poskytnout více nástrojů, každý nástroj odpovídá jednomu tlačítku na panelu nástrojů a položce v nabídce :guilabel:Moduly` v editoru. Ty mohou mít podnabídky v případě, že nástroj má více souvisejících akcí." |
| 362 |
|
| 363 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:212 |
| 364 |
msgid "" |
| 365 |
"The tools must all be defined in the file ``main.py`` in your plugin. Every " |
| 366 |
"tool is a class that inherits from the " |
| 367 |
":class:`calibre.gui2.tweak_book.plugin.Tool` class. Let's look at " |
| 368 |
"``main.py`` from the demo plugin, the source code is heavily commented and " |
| 369 |
"should be self-explanatory. Read the API documents of the " |
| 370 |
":class:`calibre.gui2.tweak_book.plugin.Tool` class for more details." |
| 371 |
msgstr "Nástroje musí být všechny definovány v souboru ``main.py`` ve vašem modulu. Každý nástroj je třída, která dědí ze třídy :class:`calibre.gui2.tweak_book.plugin.Tool`. Pojďme se podívat na ``main.py`` z ukázkového modulu, zdrojový kód je silně komentován a měl by být samovysvětlující. Pro více informací si přečtěte dokumenty API ke třídě :class:`calibre.gui2.tweak_book.plugin.Tool`." |
| 372 |
|
| 373 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:222 |
| 374 |
msgid "" |
| 375 |
"Here we will see the definition of a single tool that will multiply all font" |
| 376 |
" sizes in the book by a number provided by the user. This tool demonstrates " |
| 377 |
"various important concepts that you will need in developing your own " |
| 378 |
"plugins, so you should read the (heavily commented) source code carefully." |
| 379 |
msgstr "Zde uvidíme definici jednoho nástroje, který se bude násobit všechny velikosti písem v knize číslem zadaným uživatelem. Tento nástroj ukazuje různé důležité pojmy, které budete potřebovat při vývoji svých vlastních modulů, takže byste si měli pečlivě přečíst (silně komentovaný) zdrojový kód." |
| 380 |
|
| 381 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:230 |
| 382 |
msgid "" |
| 383 |
"Let's break down ``main.py``. We see that it defines a single tool, named " |
| 384 |
"*Magnify fonts*. This tool will ask the user for a number and multiply all " |
| 385 |
"font sizes in the book by that number." |
| 386 |
msgstr "Pojďme si rozebrat ``main.py``. Vidíme, že definuje jeden nástroj s názvem *Zvětšit písma*. Tento nástroj požádá uživatele o číslo a vynásobí všechny velikosti písem v knize tímto číslem." |
| 387 |
|
| 388 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:234 |
| 389 |
msgid "" |
| 390 |
"The first important thing is the tool name which you must set to some " |
| 391 |
"relatively unique string as it will be used as the key for this tool." |
| 392 |
msgstr "První důležitá věc je název nástroje, který musíte nastavit na nějaký relativně jedinečný řetězec, protože bude použit jako klíč pro tento nástroj." |
| 393 |
|
| 394 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:237 |
| 395 |
msgid "" |
| 396 |
"The next important entry point is the " |
| 397 |
":meth:`calibre.gui2.tweak_book.plugin.Tool.create_action`. This method " |
| 398 |
"creates the QAction objects that appear in the plugins toolbar and plugin " |
| 399 |
"menu. It also, optionally, assigns a keyboard shortcut that the user can " |
| 400 |
"customize. The triggered signal from the QAction is connected to the " |
| 401 |
"ask_user() method that asks the user for the font size multiplier, and then " |
| 402 |
"runs the magnification code." |
| 403 |
msgstr "Dalším důležitým vstupním bodem je :meth:`calibre.gui2.tweak_book.plugin.Tool.create_action`. Tato metoda vytvoří objekty QAction, které se zobrazí v panelu nástrojů modulů a nabídce modulu. Také to volitelně přiřadí klávesovou zkratku, kterou si uživatel může přizpůsobit. Spuštěný signál z QAction je spojený s metodou ask_user(), která se zeptá uživatele na násobitel velikosti písma, a pak spustí kód zvětšení." |
| 404 |
|
| 405 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:245 |
| 406 |
msgid "" |
| 407 |
"The magnification code is well commented and fairly simple. The main things " |
| 408 |
"to note are that you get a reference to the editor window as ``self.gui`` " |
| 409 |
"and the editor *Boss* as ``self.boss``. The *Boss* is the object that " |
| 410 |
"controls the editor user interface. It has many useful methods, that are " |
| 411 |
"documented in the :class:`calibre.gui2.tweak_book.boss.Boss` class." |
| 412 |
msgstr "Kód zvětšení kód je dobře okomentován a poměrně jednoduchý. Hlavními věcmi, na které pamatujte, je to, že jste získali odkaz na okno editoru jako ``self.gui`` a *Boss* editoru jako ``self.boss``. *Boss* je objekt, který řídí uživatelské rozhraní editoru. Má mnoho užitečných metod, které jsou popsány ve třídě :class:`calibre.gui2.tweak_book.boss.Boss`." |
| 413 |
|
| 414 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:251 |
| 415 |
msgid "" |
| 416 |
"Finally, there is ``self.current_container`` which is a reference to the " |
| 417 |
"book being edited as a " |
| 418 |
":class:`calibre.ebooks.oeb.polish.container.Container` object. This " |
| 419 |
"represents the book as a collection of its constituent HTML/CSS/image files " |
| 420 |
"and has convenience methods for doing many useful things. The container " |
| 421 |
"object and various useful utility functions that can be reused in your " |
| 422 |
"plugin code are documented in :ref:`polish_api`." |
| 423 |
msgstr "Nakonec je zde ``self.current_container``, což je odkaz na knihu upravovanou jako objekt :class:`calibre.ebooks.oeb.polish.container.Container`. Znázorňuje knihu jako kolekci jejích základních souborů HTML, CSS nebo obrázků a má pohodlné metody pro provádění mnoha užitečných věcí. Objekt kontejneru a různé užitečné funkce nástrojů, které mohou být znovu použity v kódu vašeho modulu, jsou popsány v :ref:`polish_api`." |
| 424 |
|
| 425 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:259 |
| 426 |
msgid "Adding translations to your plugin" |
| 427 |
msgstr "Přidávání překladů do vašeho modulu" |
| 428 |
|
| 429 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:261 |
| 430 |
msgid "" |
| 431 |
"You can have all the user interface strings in your plugin translated and " |
| 432 |
"displayed in whatever language is set for the main calibre user interface." |
| 433 |
msgstr "Všechny řetězce uživatelského rozhraní ve svém modulu můžete mít přeloženy a zobrazeny v jakémkoliv jazyce, který je nastaven pro hlavní uživatelské rozhraní Calibre." |
| 434 |
|
| 435 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:264 |
| 436 |
msgid "" |
| 437 |
"The first step is to go through your plugin's source code and mark all user " |
| 438 |
"visible strings as translatable, by surrounding them in _(). For example::" |
| 439 |
msgstr "Prvním krokem je projít zdrojový kód svého modulu a označit všechny řetězce viditelné uživatelem jako přeložitelné jejich obklopením _(). Například::" |
| 440 |
|
| 441 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:269 |
| 442 |
msgid "" |
| 443 |
"Then use some program to generate .po files from your plugin source code. " |
| 444 |
"There should be one .po file for every language you want to translate into. " |
| 445 |
"For example: de.po for German, fr.po for French and so on. You can use the " |
| 446 |
"`Poedit <https://poedit.net/>`_ program for this." |
| 447 |
msgstr "Pak použijte nějaký program pro vygenerování souborů .po ze zdrojového kódu vašeho doplňku. Měl by být jeden soubor .po pro každý jazyk, do kterého chcete překládat. Například: cs.po pro češtinu, de.po pro němčinu, fr.po pro francouzštinu a tak dále. K tomu můžete použít program `Poedit <https://poedit.net/>`_." |
| 448 |
|
| 449 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:274 |
| 450 |
msgid "" |
| 451 |
"Send these .po files to your translators. Once you get them back, compile " |
| 452 |
"them into .mo files. You can again use Poedit for that, or just do::" |
| 453 |
msgstr "Tyto soubory .po pošlete svým překladatelům. Jakmile je dostanete zpátky, zkompilovat je do souborů .mo. K tomu můžete znovu použít Poedit, nebo prostě udělejte::" |
| 454 |
|
| 455 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:279 |
| 456 |
msgid "Put the .mo files into the ``translations`` folder in your plugin." |
| 457 |
msgstr "Soubory .mo umístěte do složky ``translations`` ve svém modulu." |
| 458 |
|
| 459 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:281 |
| 460 |
msgid "" |
| 461 |
"The last step is to simply call the function `load_translations()` at the " |
| 462 |
"top of your plugin's .py files. For performance reasons you should only call" |
| 463 |
" this function in those .py files that actually have translatable strings. " |
| 464 |
"So in a typical User Interface plugin you would call it at the top of " |
| 465 |
"``ui.py`` but not ``__init__.py``." |
| 466 |
msgstr "Posledním krokem je jednoduše zavolat funkci `load_translations()` na začátku souborů .py vašeho modulu. Z výkonnostních důvodů byste měli volat tuto funkci pouze v těch souborech .py, které skutečně mají přeložitelné řetězce. Takže v typickém modulu uživatelského rozhraní byste ji volali na začátku ``ui.py`` ale ne ``__init__.py``." |
| 467 |
|
| 468 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:287 |
| 469 |
msgid "" |
| 470 |
"You can test the translations of your plugins by changing the user interface" |
| 471 |
" language in calibre under :guilabel:`Preferences->Interface->Look & feel` " |
| 472 |
"or by running calibre with the ``CALIBRE_OVERRIDE_LANG`` environment " |
| 473 |
"variable set. For example::" |
| 474 |
msgstr "Překlady svých modulů můžete otestovat změnou jazyka uživatelského rozhraní v Calibre pod :guilabel:`Předvolby->Rozhraní->Vzhled a chování` nebo spuštěním Calibre s nastavenou proměnnou prostředí ``CALIBRE_OVERRIDE_LANG``. Například::" |
| 475 |
|
| 476 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:293 |
| 477 |
msgid "" |
| 478 |
"Replace ``de`` with the language code of the language you want to test." |
| 479 |
msgstr "Nahraďte ``de`` kódem jazyka, který chcete otestovat." |
| 480 |
|
| 481 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:295 |
| 482 |
msgid "" |
| 483 |
"For translations with plurals, use the ``ngettext()`` function instead of " |
| 484 |
"``_()``. For example::" |
| 485 |
msgstr "Pro překlady s množnými čísly použijte funkci ``ngettext()`` namísto ``_()``. Například::" |
| 486 |
|
| 487 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:301 |
| 488 |
msgid "The plugin API" |
| 489 |
msgstr "Rozhraní API modulu" |
| 490 |
|
| 491 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:303 |
| 492 |
msgid "" |
| 493 |
"As you may have noticed above, a plugin in calibre is a class. There are " |
| 494 |
"different classes for the different types of plugins in calibre. Details on " |
| 495 |
"each class, including the base class of all plugins can be found in " |
| 496 |
":ref:`plugins`." |
| 497 |
msgstr "Jak jste si možná všimli výše, modul Calibre je třída. V Calibre existují různé třídy pro různé typy modulů. Podrobnosti o každé třídě, včetně základní třídy všech modulů, lze nalézt v :ref:`moduly <plugins>`." |
| 498 |
|
| 499 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:306 |
| 500 |
msgid "" |
| 501 |
"Your plugin is almost certainly going to use code from calibre. To learn how" |
| 502 |
" to find various bits of functionality in the calibre code base, read the " |
| 503 |
"section on the calibre :ref:`code_layout`." |
| 504 |
msgstr "Váš modul téměř určitě bude používat kód z Calibre. Abyste zjistili, jak najít různé kousky funkcí v základním kódu Calibre, přečtěte si část o :ref:`code_layout` Calibre." |
| 505 |
|
| 506 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:311 |
| 507 |
msgid "Debugging plugins" |
| 508 |
msgstr "Ladění modulů" |
| 509 |
|
| 510 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:313 |
| 511 |
msgid "" |
| 512 |
"The first, most important step is to run calibre in debug mode. You can do " |
| 513 |
"this from the command line with::" |
| 514 |
msgstr "Prvním a nejdůležitějším krokem je spuštění Calibre v režimu ladění. To můžete udělat z příkazového řádku pomocí::" |
| 515 |
|
| 516 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:317 |
| 517 |
msgid "" |
| 518 |
"Or from within calibre by right-clicking the :guilabel:`Preferences` button " |
| 519 |
"or using the :kbd:`Ctrl+Shift+R` keyboard shortcut." |
| 520 |
msgstr "Nebo z Calibre kliknutím pravým tlačítkem myši na tlačítko :guilabel:`Předvolby` nebo pomocí klávesové zkratky :kbd:`Ctrl+Shift+R`." |
| 521 |
|
| 522 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:319 |
| 523 |
msgid "" |
| 524 |
"When running from the command line, debug output will be printed to the " |
| 525 |
"console, when running from within calibre the output will go to a txt file." |
| 526 |
msgstr "Při spuštění z příkazového řádku, bude výstup ladění vypsán do konzole, při spuštění z Calibre, půjde výstup do textového souboru." |
| 527 |
|
| 528 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:321 |
| 529 |
msgid "" |
| 530 |
"You can insert print statements anywhere in your plugin code, they will be " |
| 531 |
"output in debug mode. Remember, this is Python, you really shouldn't need " |
| 532 |
"anything more than print statements to debug ;) I developed all of calibre " |
| 533 |
"using just this debugging technique." |
| 534 |
msgstr "Do kódu svého modulu můžete kamkoliv vložit příkazy tisku, budou mít výstup v režimu ladění. Nezapomeňte, že je to Python, neměli byste opravdu potřebovat nic víc než příkazy tisku pro ladění ;) Celé Celibre jsem vytvořil pouze pomocí této techniky ladění." |
| 535 |
|
| 536 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:323 |
| 537 |
msgid "" |
| 538 |
"You can quickly test changes to your plugin by using the following command " |
| 539 |
"line::" |
| 540 |
msgstr "Změny ve svém modulu můžete rychle testovat pomocí následujícího příkazového řádku::" |
| 541 |
|
| 542 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:328 |
| 543 |
msgid "" |
| 544 |
"This will shutdown a running calibre, wait for the shutdown to complete, " |
| 545 |
"then update your plugin in calibre and relaunch calibre." |
| 546 |
msgstr "Toto vypne spuštěné Calibre, počkejte až bude vypnutí dokončeno, a pak aktualizujte svůj modul v Calibre a znovu spusťte Calibre." |
| 547 |
|
| 548 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:331 |
| 549 |
msgid "More plugin examples" |
| 550 |
msgstr "Další příklady modulů" |
| 551 |
|
| 552 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:333 |
| 553 |
msgid "" |
| 554 |
"You can find a list of many sophisticated calibre plugins `here " |
| 555 |
"<https://www.mobileread.com/forums/showthread.php?t=118764>`_." |
| 556 |
msgstr "Seznam mnoha propracovaných modulů Calibre můžete nalézt `zde <https://www.mobileread.com/forums/showthread.php?t=118764>`_." |
| 557 |
|
| 558 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:336 |
| 559 |
msgid "Sharing your plugins with others" |
| 560 |
msgstr "Sdílení vašeho modulu s ostatními" |
| 561 |
|
| 562 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:338 |
| 563 |
msgid "" |
| 564 |
"If you would like to share the plugins you have created with other users of " |
| 565 |
"calibre, post your plugin in a new thread in the `calibre plugins forum " |
| 566 |
"<https://www.mobileread.com/forums/forumdisplay.php?f=237>`_." |
| 567 |
msgstr "Pokud byste chtěli sdílet moduly, které jste vytvořili, s ostatními uživateli Calibre, zveřejněte svůj modul v novém vláknu ve `fóru modulů Calibre <https://www.mobileread.com/forums/forumdisplay.php?f=237>`_." |