Modified source to work under python3

This commit is contained in:
Jeffrey Baitis 2016-09-02 13:05:03 -07:00
parent a826019739
commit 4a46a7a195
11 changed files with 18 additions and 16 deletions

View File

@ -1 +1 @@
from plugin import DBusPlugin
from .plugin import DBusPlugin

View File

@ -34,7 +34,8 @@ Based on src/remote_control.py
:license: GPL
'''
import os
import new
# import new # depricated in python3; use types instead
import types
import gobject
@ -722,10 +723,9 @@ class DBusPlugin(GajimPlugin):
def _set_handling_methods(self):
for event_name in self.events_names:
setattr(self, event_name,
new.instancemethod(
types.MethodType(
self._generate_handling_method(event_name),
self,
DBusPlugin))
self))
self.events_handlers[event_name] = (ged.POSTCORE,
getattr(self, event_name))

View File

@ -1 +1 @@
from plugin import EventsDumpPlugin
from .plugin import EventsDumpPlugin

View File

@ -25,7 +25,7 @@ Dumps info about selected events to console.
:license: GPL
'''
import new
import types
from pprint import pformat
from plugins import GajimPlugin
@ -110,15 +110,14 @@ class EventsDumpPlugin(GajimPlugin):
def _set_handling_methods(self):
for event_name in self.events_names:
setattr(self, event_name,
new.instancemethod(
types.MethodType(
self._generate_handling_method(event_name),
self,
EventsDumpPlugin))
self))
self.events_handlers[event_name] = (ged.POSTCORE,
getattr(self, event_name))
def _generate_handling_method(self, event_name):
def handler(self, *args):
print "Event '%s' occured. Arguments: %s\n\n===\n"%(event_name, pformat(args))
print ("Event '%s' occured. Arguments: %s\n\n===\n" % (event_name, pformat(args)))
return handler

View File

@ -1 +1 @@
from plugin import NewEventsExamplePlugin
from .plugin import NewEventsExamplePlugin

View File

@ -26,7 +26,7 @@ based on existing one.
:license: GPL
'''
import new
#import new # Depricated in python3 for types module
from pprint import pformat
from common import helpers

View File

@ -1,4 +1,4 @@
__all__ = ['RosterButtonsPlugin']
from plugin import RosterButtonsPlugin
from .plugin import RosterButtonsPlugin

View File

@ -49,7 +49,10 @@ if os.name == 'nt':
import sys
import signal
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
gi.require_version('GdkX11', '3.0')
from gi.repository import Gdk
from gi.repository import GLib
import time

View File

@ -25,6 +25,6 @@ Main file of plugins package.
'''
from .pluginmanager import PluginManager
from .plugin import GajimPlugin
from .gajimplugin import GajimPlugin
__all__ = ['PluginManager', 'GajimPlugin']

View File

@ -40,7 +40,7 @@ from common.exceptions import PluginsystemError
from plugins.helpers import log, log_calls, Singleton
from plugins.helpers import GajimPluginActivateException
from plugins.plugin import GajimPlugin, GajimPluginException
from plugins.GajimPlugin import GajimPlugin, GajimPluginException
class PluginManager(metaclass=Singleton):
'''