[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [calligra/krita-scripting-rempt] krita/plugins/extensions/pykrita/src: remove unused configuration.p
From:       Boudewijn Rempt <boud () valdyas ! org>
Date:       2014-07-31 9:30:35
Message-ID: E1XCmh1-0005Sh-P8 () scm ! kde ! org
[Download RAW message or body]

Git commit abd8cab54e88947ef702930b936a687c3e406b50 by Boudewijn Rempt.
Committed on 31/07/2014 at 08:16.
Pushed by rempt into branch 'krita-scripting-rempt'.

remove unused configuration.py

M  +5    -2    krita/plugins/extensions/pykrita/src/engine.cpp
M  +0    -1    krita/plugins/extensions/pykrita/src/krita/__init__.py
D  +0    -142  krita/plugins/extensions/pykrita/src/krita/configuration.py
M  +3    -1    krita/plugins/extensions/pykrita/src/plugins/hello/hello.py

http://commits.kde.org/calligra/abd8cab54e88947ef702930b936a687c3e406b50

diff --git a/krita/plugins/extensions/pykrita/src/engine.cpp \
b/krita/plugins/extensions/pykrita/src/engine.cpp index 86c9fff..6cabaaa 100644
--- a/krita/plugins/extensions/pykrita/src/engine.cpp
+++ b/krita/plugins/extensions/pykrita/src/engine.cpp
@@ -757,8 +757,10 @@ void PyKrita::Engine::loadModule(const int idx)
             PyObject* const args = Py_BuildValue("(s)", PQ(module_name));
             PyObject* result = py.functionCall("_pluginLoaded", \
Python::PYKRITA_ENGINE, args);  Py_DECREF(args);
-            if (result)
-                return;                                     // Success!
+            if (result) {
+                return;
+                // Success!
+            }
         }
         plugin.m_errorReason = i18nc("@info:tooltip", "Internal engine failure");
     } else {
@@ -769,6 +771,7 @@ void PyKrita::Engine::loadModule(const int idx)
                                );
     }
     plugin.m_broken = true;
+    warnScript << "Error loading plugin" << module_name << ":" << \
plugin.m_errorReason;  }
 
 void PyKrita::Engine::unloadModule(int idx)
diff --git a/krita/plugins/extensions/pykrita/src/krita/__init__.py \
b/krita/plugins/extensions/pykrita/src/krita/__init__.py index b846e25..c10c8db \
                100644
--- a/krita/plugins/extensions/pykrita/src/krita/__init__.py
+++ b/krita/plugins/extensions/pykrita/src/krita/__init__.py
@@ -3,7 +3,6 @@ import os
 import sys
 
 from .api import *
-from .configuration import *
 from .decorators import *
 
 def kDebug(text):
diff --git a/krita/plugins/extensions/pykrita/src/krita/configuration.py \
b/krita/plugins/extensions/pykrita/src/krita/configuration.py deleted file mode \
100644 index 9e94abc..0000000
--- a/krita/plugins/extensions/pykrita/src/krita/configuration.py
+++ /dev/null
@@ -1,142 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (C) 2006 Paul Giannaros <paul@giannaros.org>
-# Copyright (C) 2013 Shaheed Haque <srhaque@theiet.org>
-# Copyright (C) 2013 Alex Turbov <i.zaufi@gmail.com>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) version 3.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this library; see the file COPYING.LIB.  If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
-
-'''Configuration related stuff'''
-
-import pykrita                                                 # Built-in module
-import sys
-
-
-class Configuration:
-    '''A Configuration object provides a plugin-specific persistent
-    configuration dictionary. The configuration is saved and loaded from disk
-    automatically.
-
-    Do not instantiate your own Configuration object; a plugin simply uses
-    pykrita.configuration and the class automatically creates a plugin-specific
-    dictionary to support it.
-
-    Use a string key. Any Python type that can be pickled is can be used as a
-    value -- dictionaries, lists, numbers, strings, sets, and so on.
-    '''
-
-    def __init__(self, root):
-        self.root = root
-
-    def __getitem__(self, key):
-        plugin = sys._getframe(1).f_globals['__name__']
-        return self.root.get(plugin, {})[key]
-
-    def __setitem__(self, key, value):
-        plugin = sys._getframe(1).f_globals['__name__']
-        if plugin not in self.root:
-            self.root[plugin] = {}
-        self.root[plugin][key] = value
-
-    def __delitem__(self, key):
-        plugin = sys._getframe(1).f_globals['__name__']
-        del self.root.get(plugin, {})[key]
-
-    def __contains__(self, key):
-        plugin = sys._getframe(1).f_globals['__name__']
-        return key in self.root.get(plugin, {})
-
-    def __len__(self):
-        plugin = sys._getframe(1).f_globals['__name__']
-        return len(self.root.get(plugin, {}))
-
-    def __iter__(self):
-        plugin = sys._getframe(1).f_globals['__name__']
-        return iter(self.root.get(plugin, {}))
-
-    def __str__(self):
-        plugin = sys._getframe(1).f_globals['__name__']
-        return str(self.root.get(plugin, {}))
-
-    def __repr__(self):
-        plugin = sys._getframe(1).f_globals['__name__']
-        return repr(self.root.get(plugin, {}))
-
-    def keys(self):
-        '''Return the keys from the configuration dictionary.'''
-        plugin = sys._getframe(1).f_globals['__name__']
-        return self.root.get(plugin, {}).keys()
-
-    def values(self):
-        '''Return the values from the configuration dictionary.'''
-        plugin = sys._getframe(1).f_globals['__name__']
-        return self.root.get(plugin, {}).values()
-
-    def items(self):
-        '''Return the items from the configuration dictionary.'''
-        plugin = sys._getframe(1).f_globals['__name__']
-        return self.root.get(plugin, {}).items()
-
-    def get(self, key, default=None):
-        '''Fetch a configuration item using it's string key, returning
-        a given default if not found.
-
-        Parameters:
-            * key -             String key for item.
-            * default -         Value to return if key is not found.
-
-        Returns:
-            The item value for key, or the given default if not found.
-        '''
-        plugin = sys._getframe(1).f_globals['__name__']
-        try:
-            return self.root.get(plugin, {})[key]
-        except KeyError:
-            return default
-
-    def pop(self, key):
-        '''Delete a configuration item using it's string key.
-
-        Parameters:
-            * key -             String key for item.
-        Returns:
-            The value of the removed item.
-        Throws:
-            KeyError if key doesn't exist.
-        '''
-        plugin = sys._getframe(1).f_globals['__name__']
-        value = self.root.get(plugin, {})[key]
-        del self.root.get(plugin, {})[key]
-        return value
-
-    def save(self):
-        pykrita.saveConfiguration()
-
-    def _name(self):
-        return sys._getframe(1).f_globals['__name__']
-
-
-globalConfiguration = pykrita.configuration
-'''Configuration for all plugins.
-
-This can also be used by one plugin to access another plugin's configurations.
-'''
-
-configuration = Configuration(pykrita.configuration)
-'''Persistent configuration dictionary for this plugin.'''
-
-
-sessionConfiguration = Configuration(pykrita.sessionConfiguration)
-'''Per session persistent configuration dictionary for this plugin.'''
diff --git a/krita/plugins/extensions/pykrita/src/plugins/hello/hello.py \
b/krita/plugins/extensions/pykrita/src/plugins/hello/hello.py index 712673c..65768b4 \
                100644
--- a/krita/plugins/extensions/pykrita/src/plugins/hello/hello.py
+++ b/krita/plugins/extensions/pykrita/src/plugins/hello/hello.py
@@ -1,7 +1,9 @@
 from PyQt4.QtGui import *
 from PyKrita4.krita import *
+from krita import *
 
 def hello():
-
     QMessageBox.information(QWidget(), "Test", "Hello World")
 
+QAction ac = Krita.createAction("Hello")
+ac.triggered.conect(hello)


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic