Commit Graph

51 Commits

Author SHA1 Message Date
Philipp Hörist cb05671254 Dont fail when importing plugin_i18n for tests 2018-11-21 21:44:19 +01:00
Philipp Hörist 30a20e16d2 Enforce min and max version for plugin manifest
This reduces problems with old plugins without max version
2018-11-11 10:21:46 +01:00
Philipp Hörist dcfaba09b9 PluginsWindow: Refactor code
- Use get_builder
- Sort imports
- Use load_icon instead of get_icon_pixmap
2018-10-28 20:17:59 +01:00
Philipp Hörist 08fe232695 Fix error when plugin cant be loaded
Fixes #9403
2018-10-25 21:20:38 +02:00
Philipp Hörist 2b7006e883 Catch exceptions when loading plugins 2018-10-13 14:13:38 +02:00
Philipp Hörist 683e7aa4c7 Bind textomain also for plugins 2018-10-13 13:27:33 +02:00
Philipp Hörist 6c43c0f408 Allow to load multiple widgets with get_builder() 2018-10-13 00:33:33 +02:00
Philipp Hörist c43714e4c2 Dont monkey patch _() into plugins
Plugins can import _() from plugins_i18n
2018-10-12 23:42:38 +02:00
Philipp Hörist e5fe30cb5b Add get_builder() for plugins 2018-10-12 23:42:38 +02:00
Yann Leboulanger 00c8e5c01d Ability to update plugins on startup from a download folder 2018-10-12 22:17:34 +02:00
Philipp Hörist bae95858aa Dont overwrite user plugins with base plugins
- Dont load plugins without short_name
- Check with the short_name if a plugin is already loaded
2018-10-10 21:25:54 +02:00
Philipp Hörist ad4e1258d3 Improve finding locale dir
- Dont install _() globally, although its elegant mypy cant deal with it
- If gettext cant find the translation itself, iter through all dirs and search for it
2018-10-06 22:44:26 +02:00
Philipp Hörist bf87ad5ac8 Import _() instead of using builtin namespace
- Prepare for removing the global installed _() method in builtins
- Sort some imports along the way
2018-10-06 22:38:55 +02:00
Philipp Hörist f89347516f Only use absolute imports from gtk module
- This reduces import cycles
2018-09-26 19:06:47 +02:00
Philipp Hörist 26b8125446 configpaths: Add get_plugin_dirs() method
This helps with mypy because otherwise get() has multiple return types

This reduces our usage of cast()
2018-09-23 14:41:44 +02:00
Philipp Hörist 74b66837fa Add annotations
- Remove some unused vars from app
2018-09-21 15:46:52 +02:00
Philipp Hörist 6b54863157 Dont move window between virtual desktops
Its the job of the window manager to restore a window to the correct
location
2018-09-18 16:28:33 +02:00
Philipp Hörist df88cc5e15 Fix redefined-builtin pylint errors 2018-09-18 13:54:25 +02:00
Philipp Hörist 29647ea693 Fix trailing-whitespace pylint errors 2018-09-18 13:38:22 +02:00
Philipp Hörist ccc06a04ab Fix bad-whitespace pylint errors 2018-09-18 12:06:01 +02:00
Philipp Hörist ff6ca57033 Fix no-else-return pylint errors 2018-09-18 10:16:54 +02:00
Philipp Hörist 158d013a86 Fix literal-comparison pylint errors 2018-09-17 23:03:45 +02:00
Philipp Hörist e8ac644440 Fix unused-variable pylint errors 2018-09-17 21:16:19 +02:00
Philipp Hörist d638087c26 Fix logging-not-lazy pylint errors 2018-09-17 18:57:00 +02:00
Philipp Hörist 7bb6f8b22e Fix bare-except pylint errors 2018-09-16 23:45:01 +02:00
Philipp Hörist d53b95218a Fix redefined-outer-name pylint errors 2018-09-16 18:04:15 +02:00
Philipp Hörist bb545d546a Fix useless-object-inheritance pylint errors 2018-09-16 11:56:56 +02:00
Philipp Hörist de0c0a9c08 Fix unsued-import pylint errors 2018-09-16 11:37:38 +02:00
Philipp Hörist d54d4bc232 Add annotations and fix pylint/mypy errors 2018-09-13 23:56:12 +02:00
Philipp Hörist a4a136566f Fix license comment format
every linter flags this as an error
2018-09-05 02:59:34 +02:00
Philipp Hörist 931e3f60ba Register modules defined by plugins 2018-08-28 23:03:00 +02:00
Philipp Hörist 1c69b92d85 Move filechoosers into gtk module 2018-08-19 17:47:17 +02:00
Philipp Hörist 3a3b5aff20 Move some dialogs into gtk module 2018-07-18 00:15:46 +02:00
Sophie Herold f89169517e Rework Plugins Dialog 2018-07-16 22:38:08 +02:00
Alexander Krotov 1d27ab2254 Spellcheck 2018-06-21 03:05:47 +03:00
Philipp Hörist c38db84e04 Refactor FileChooserDialogs
Use GtkFileChooserDialog only when we need previews, default to
NativeFileChooser otherwise.

GtkFileChooserDialogs have a long list of issues, so lets only use it
if we gain something from it.

Flatpak should only run NativeFileChoosers because its sandboxed and
this is needed for security purposes. As a result of that, Flatpak Users
dont have image previews in the FileOpenDialogs

Refactor all FileChoosers for a more simple approach when we use them

Add a new SendFileDialog, so we dont have to put widgets into the FileChooser
which forces non-native Dialogs.
2018-05-05 09:22:08 +02:00
Philipp Hörist 779a4d4ce3 Get version from package instead of config 2018-05-01 00:37:13 +02:00
Markus Wintermann 49bfc1f226 Add support for dynamic reloading of plugins
‎* rename the remove_plugin function to uninstall_plugin because it
deletes files on the disc and uninstall is the label of the button which
triggers this function
* added a new remove_plugin function, which deactivates the plugin (if
needed), removes it from the list of managed plugins and deletes the
contents of sys.modules
2018-04-28 13:31:19 +02:00
Philipp Hörist 105427b8fd Use consistent way to get paths
This lets us now import the app module without setting paths
2018-04-25 20:49:37 +02:00
Philipp Hörist 276daa991c Correctly split version string
We changed the version format
2017-11-24 16:49:30 +01:00
Philipp Hörist 775fec2fea Dont activate plugins in PluginManager init
Plugins maybe want to use in their activation Gajim methods that
use an extension point. But because the PluginManager Object is not fully
initialized, the extension point method is not available yet

First create the PluginManager Object, then load Plugins.
2017-11-15 22:26:55 +01:00
André Apitzsch 2872405f07 Fix deprecation warnings 2017-10-07 21:01:27 +02:00
Philipp Hörist b9aba06f71 Remove unused variables 2017-09-29 02:41:03 +02:00
Philipp Hörist dd39067ef7 Allow Plugins to use other dialogs 2017-09-29 02:40:01 +02:00
Yann Leboulanger 8d4e815f3e fix some pylint errors 2017-08-24 23:01:06 +02:00
André Apitzsch 89c7eb6e6a Rename gajim.common.gajim to avoid name conflicts 2017-08-18 20:03:20 +02:00
André Apitzsch efec098aef Use absolute imports 2017-08-18 19:48:48 +02:00
Philipp Hörist 635ce52856 PluginManager: prefer plugins in user path
As we always load plugins from the user path first, we should not
reload them later from Gajims plugin base dir
2017-08-07 20:02:03 +02:00
Philipp Hörist 7e0e4cced0 PluginManager: remove plugin path from sys.path
Remove plugin path from sys.path after importing.

If we scan multiple plugin dirs and never remove the path from
sys.path, it is hard to predict from which path python will import
a package.

The chance that the same plugin package is in multiple plugin paths
is high.
2017-08-07 19:28:54 +02:00
Philipp Hörist 0eca29d484 Fix memory leak in plugins window
- remove gui extension point on close, to remove the reference the plugin manager holds to the Class.

- reduce scope of var that holds reference to Gtk.Builder(). We have to be careful with
Gtk.Builder, because it can hold a reference to our Class (methods bound to signals) which creates a reference cycle
which python is not able to detect. Hence neither Gtk.Builder nor our Class are garbage collected.
Why this is not detected as a reference cylce is unclear at the moment.

There are two approaches to circumvent the problem:

1. we lose our reference to Gtk.Builder when closing the window, which lets python garbage
collect the builder, afterwards it can garbage collect our class.

2. we reduce the scope of the var that holds a reference to Gtk.Builder, so that the builder
can be garbage collected at the end of __init__.

I chose to reduce the scope because the builder is not needed class wide.
2017-07-10 01:15:30 +02:00