From b56b524a7837cf6ab4c36a318aa580021c4cf14e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 10 Aug 2022 22:20:58 +0530 Subject: [PATCH] Remove webeninge_demo plugin example as now we can use webengine in the main calibre process --- manual/creating_plugins.rst | 28 --------- .../webengine_demo/__init__.py | 30 ---------- .../webengine_demo/images/icon.png | Bin 4035 -> 0 bytes manual/plugin_examples/webengine_demo/main.py | 21 ------- .../plugin-import-name-webengine_demo.txt | 0 manual/plugin_examples/webengine_demo/ui.py | 55 ------------------ 6 files changed, 134 deletions(-) delete mode 100644 manual/plugin_examples/webengine_demo/__init__.py delete mode 100644 manual/plugin_examples/webengine_demo/images/icon.png delete mode 100644 manual/plugin_examples/webengine_demo/main.py delete mode 100644 manual/plugin_examples/webengine_demo/plugin-import-name-webengine_demo.txt delete mode 100644 manual/plugin_examples/webengine_demo/ui.py diff --git a/manual/creating_plugins.rst b/manual/creating_plugins.rst index ebd8de28af..58064d86c1 100644 --- a/manual/creating_plugins.rst +++ b/manual/creating_plugins.rst @@ -255,34 +255,6 @@ HTML/CSS/image files and has convenience methods for doing many useful things. The container object and various useful utility functions that can be reused in your plugin code are documented in :ref:`polish_api`. - -Running User Interface plugins in a separate process ------------------------------------------------------------ - -If you are writing a user interface plugin that needs to make use -of Qt WebEngine, it cannot be run in the main calibre process as it -is not possible to use WebEngine there. Instead you can copy the data -your plugin needs to a temporary folder and run the plugin with that -data in a separate process. A simple example plugin follows that shows how -to do this. - -You can download the plugin from -:download_file:`webengine_demo_plugin.zip`. - -The important part of the plugin is in two functions: - -.. literalinclude:: plugin_examples/webengine_demo/ui.py - :lines: 47- - -.. literalinclude:: plugin_examples/webengine_demo/main.py - :lines: 12- - - -The ``show_demo()`` function asks the user for a URL and then runs -the ``main()`` function passing it that URL. The ``main()`` function -displays the URL in a ``QWebEngineView``. - - Adding translations to your plugin -------------------------------------- diff --git a/manual/plugin_examples/webengine_demo/__init__.py b/manual/plugin_examples/webengine_demo/__init__.py deleted file mode 100644 index 7d8b4fdcc1..0000000000 --- a/manual/plugin_examples/webengine_demo/__init__.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env python -# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai -# License: GPLv3 Copyright: 2019, Kovid Goyal - - -# The class that all Interface Action plugin wrappers must inherit from -from calibre.customize import InterfaceActionBase - - -class WebEginePluginDemo(InterfaceActionBase): - ''' - This class is a simple wrapper that provides information about the actual - plugin class. The actual interface plugin class is called InterfacePlugin - and is defined in the ui.py file, as specified in the actual_plugin field - below. - - The reason for having two classes is that it allows the command line - calibre utilities to run without needing to load the GUI libraries. - ''' - name = 'WebEngine Plugin Demo' - description = 'A WebEngine plugin demo' - supported_platforms = ['windows', 'osx', 'linux'] - author = 'Kovid Goyal' - version = (1, 0, 0) - minimum_calibre_version = (3, 99, 3) - - #: This field defines the GUI plugin class that contains all the code - #: that actually does something. Its format is module_path:class_name - #: The specified class must be defined in the specified module. - actual_plugin = 'calibre_plugins.webengine_demo.ui:InterfacePlugin' diff --git a/manual/plugin_examples/webengine_demo/images/icon.png b/manual/plugin_examples/webengine_demo/images/icon.png deleted file mode 100644 index 26db5241afe732cb3d831cb896c9e1e7b3c4536a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4035 zcmZ`+WmMGP)BoaRbl1`iOP4fDxgh*#5RmQ=sg+ndM3in2gO*%G>Fx#r z$^ZKDdGVY(cjiod?#!9F=bm$8b+uJU@6+7}0Dx3YRZ$Ns4Y6C75Fg8(#KgC-0@o3y z1p|PZWa4WZJgg3}Q`OS~fB<#?2#o-MOROn$69ByV0ASl103@;i;PK0xR=5<_fp4p! zq6pmmTj-9mGyouLP*a2%_)YKS%osm3?(Dsxx`g9yUk-qhIRu|o**#&?s0%>kB*d!W z$Fk!;g2Aa)#|w{uxDWgsW4L>QC|c<>PXDa*9Q)iV8HpYmIGByh6L}C8=KXPdyYz2f zbgP%Jm*||Q>+-4D0^aWB-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05-v=!wD;ITZ`WOt;>r~Pk7S0(+v{f2Na&J^~cPDYv zBr4w^+N2PY@wH57+r6R>^w}JAi2*=;HoY|$Unfhc0+}3+ifJ%_9CN}{#y7B_QWppB zK!+ivFGC*)sAIphY+gzxUiLO#4ia{r4p;#Q@CgV&`9z@t0tS4d68r)Zd}2I&d=h+o zpJIPn{T~3*-QF4D|NjHJF>WhZ0PVjF`tArXUmH&c0A}xQ>i|(h+BiDsIoR0yd-OZ} Q`&k2OO4^Fm^44Mh1Ea2yX8-^I diff --git a/manual/plugin_examples/webengine_demo/main.py b/manual/plugin_examples/webengine_demo/main.py deleted file mode 100644 index 542c1f4798..0000000000 --- a/manual/plugin_examples/webengine_demo/main.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python -# vim:fileencoding=utf-8 -# License: GPL v3 Copyright: 2019, Kovid Goyal - - -from qt.core import QUrl -from qt.webengine import QWebEngineView - -from calibre.gui2 import Application - - -def main(url): - # This function is run in a separate process and can do anything it likes, - # including use QWebEngine. Here it simply opens the passed in URL - # in a QWebEngineView - app = Application([]) - w = QWebEngineView() - w.setUrl(QUrl(url)) - w.show() - w.raise_() - app.exec() diff --git a/manual/plugin_examples/webengine_demo/plugin-import-name-webengine_demo.txt b/manual/plugin_examples/webengine_demo/plugin-import-name-webengine_demo.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/manual/plugin_examples/webengine_demo/ui.py b/manual/plugin_examples/webengine_demo/ui.py deleted file mode 100644 index d5fa6f9afc..0000000000 --- a/manual/plugin_examples/webengine_demo/ui.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env python -# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai - -# License: GPLv3 Copyright: 2019, Kovid Goyal - -if False: - # This is here to keep my python error checker from complaining about - # the builtin functions that will be defined by the plugin loading system - # You do not need this code in your plugins - get_icons = get_resources = None - -# The class that all interface action plugins must inherit from -from calibre.gui2.actions import InterfaceAction -from qt.core import QInputDialog - - -class InterfacePlugin(InterfaceAction): - - name = 'WebEngine Plugin Demo' - - # Declare the main action associated with this plugin - # The keyboard shortcut can be None if you dont want to use a keyboard - # shortcut. Remember that currently calibre has no central management for - # keyboard shortcuts, so try to use an unusual/unused shortcut. - action_spec = ('WebEngine Plugin Demo', None, - 'Run the WebEngine Plugin Demo', 'Ctrl+Shift+F2') - - def genesis(self): - # This method is called once per plugin, do initial setup here - - # Set the icon for this interface action - # The get_icons function is a builtin function defined for all your - # plugin code. It loads icons from the plugin zip file. It returns - # QIcon objects, if you want the actual data, use the analogous - # get_resources builtin function. - # - # Note that if you are loading more than one icon, for performance, you - # should pass a list of names to get_icons. In this case, get_icons - # will return a dictionary mapping names to QIcons. Names that - # are not found in the zip file will result in null QIcons. - icon = get_icons('images/icon.png') - - # The qaction is automatically created from the action_spec defined - # above - self.qaction.setIcon(icon) - self.qaction.triggered.connect(self.show_dialog) - - def show_dialog(self): - # Ask the user for a URL - url, ok = QInputDialog.getText(self.gui, 'Enter a URL', 'Enter a URL to browse below', text='https://calibre-ebook.com') - if not ok or not url: - return - # Launch a separate process to view the URL in WebEngine - self.gui.job_manager.launch_gui_app('webengine-dialog', kwargs={ - 'module':'calibre_plugins.webengine_demo.main', 'url':url})