Commit 4a46a7a1 authored by Jeffrey Baitis's avatar Jeffrey Baitis

Modified source to work under python3

parent a8260197
from plugin import DBusPlugin
from .plugin import DBusPlugin
......@@ -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))
......
from plugin import EventsDumpPlugin
from .plugin import EventsDumpPlugin
......@@ -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
from plugin import NewEventsExamplePlugin
from .plugin import NewEventsExamplePlugin
......@@ -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
......
__all__ = ['RosterButtonsPlugin']
from plugin import RosterButtonsPlugin
from .plugin import RosterButtonsPlugin
......@@ -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
......
......@@ -25,6 +25,6 @@ Main file of plugins package.
'''
from .pluginmanager import PluginManager
from .plugin import GajimPlugin
from .gajimplugin import GajimPlugin
__all__ = ['PluginManager', 'GajimPlugin']
......@@ -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):
'''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment