Modified source to work under python3
This commit is contained in:
		
							parent
							
								
									a826019739
								
							
						
					
					
						commit
						4a46a7a195
					
				
					 11 changed files with 18 additions and 16 deletions
				
			
		|  | @ -1 +1 @@ | ||||||
| from plugin import DBusPlugin | from .plugin import DBusPlugin | ||||||
|  |  | ||||||
|  | @ -34,7 +34,8 @@ Based on src/remote_control.py | ||||||
| :license: GPL | :license: GPL | ||||||
| ''' | ''' | ||||||
| import os | import os | ||||||
| import new | # import new # depricated in python3; use types instead | ||||||
|  | import types | ||||||
| 
 | 
 | ||||||
| import gobject | import gobject | ||||||
| 
 | 
 | ||||||
|  | @ -722,10 +723,9 @@ class DBusPlugin(GajimPlugin): | ||||||
|     def _set_handling_methods(self): |     def _set_handling_methods(self): | ||||||
|         for event_name in self.events_names: |         for event_name in self.events_names: | ||||||
|             setattr(self, event_name, |             setattr(self, event_name, | ||||||
|                             new.instancemethod( |                             types.MethodType( | ||||||
|                                     self._generate_handling_method(event_name), |                                     self._generate_handling_method(event_name), | ||||||
|                                     self, |                                     self)) | ||||||
|                                     DBusPlugin)) |  | ||||||
|             self.events_handlers[event_name] = (ged.POSTCORE, |             self.events_handlers[event_name] = (ged.POSTCORE, | ||||||
|                 getattr(self, event_name)) |                 getattr(self, event_name)) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1 +1 @@ | ||||||
| from plugin import EventsDumpPlugin | from .plugin import EventsDumpPlugin | ||||||
|  |  | ||||||
|  | @ -25,7 +25,7 @@ Dumps info about selected events to console. | ||||||
| :license: GPL | :license: GPL | ||||||
| ''' | ''' | ||||||
| 
 | 
 | ||||||
| import new | import types | ||||||
| from pprint import pformat | from pprint import pformat | ||||||
| 
 | 
 | ||||||
| from plugins import GajimPlugin | from plugins import GajimPlugin | ||||||
|  | @ -110,15 +110,14 @@ class EventsDumpPlugin(GajimPlugin): | ||||||
|     def _set_handling_methods(self): |     def _set_handling_methods(self): | ||||||
|         for event_name in self.events_names: |         for event_name in self.events_names: | ||||||
|             setattr(self, event_name, |             setattr(self, event_name, | ||||||
|                             new.instancemethod( |                             types.MethodType( | ||||||
|                                     self._generate_handling_method(event_name), |                                     self._generate_handling_method(event_name), | ||||||
|                                     self, |                                     self)) | ||||||
|                                     EventsDumpPlugin)) |  | ||||||
|             self.events_handlers[event_name] = (ged.POSTCORE, |             self.events_handlers[event_name] = (ged.POSTCORE, | ||||||
|                                                                                getattr(self, event_name)) |                                                                                getattr(self, event_name)) | ||||||
| 
 | 
 | ||||||
|     def _generate_handling_method(self, event_name): |     def _generate_handling_method(self, event_name): | ||||||
|         def handler(self, *args): |         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 |         return handler | ||||||
|  |  | ||||||
|  | @ -1 +1 @@ | ||||||
| from plugin import NewEventsExamplePlugin | from .plugin import NewEventsExamplePlugin | ||||||
|  |  | ||||||
|  | @ -26,7 +26,7 @@ based on existing one. | ||||||
| :license: GPL | :license: GPL | ||||||
| ''' | ''' | ||||||
| 
 | 
 | ||||||
| import new | #import new # Depricated in python3 for types module | ||||||
| from pprint import pformat | from pprint import pformat | ||||||
| 
 | 
 | ||||||
| from common import helpers | from common import helpers | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| 
 | 
 | ||||||
| __all__ = ['RosterButtonsPlugin'] | __all__ = ['RosterButtonsPlugin'] | ||||||
| 
 | 
 | ||||||
| from plugin import RosterButtonsPlugin | from .plugin import RosterButtonsPlugin | ||||||
|  |  | ||||||
|  | @ -49,7 +49,10 @@ if os.name == 'nt': | ||||||
| 
 | 
 | ||||||
| import sys | import sys | ||||||
| import signal | import signal | ||||||
|  | import gi | ||||||
|  | gi.require_version('Gtk', '3.0') | ||||||
| from gi.repository import Gtk | from gi.repository import Gtk | ||||||
|  | gi.require_version('GdkX11', '3.0') | ||||||
| from gi.repository import Gdk | from gi.repository import Gdk | ||||||
| from gi.repository import GLib | from gi.repository import GLib | ||||||
| import time | import time | ||||||
|  |  | ||||||
|  | @ -25,6 +25,6 @@ Main file of plugins package. | ||||||
| ''' | ''' | ||||||
| 
 | 
 | ||||||
| from .pluginmanager import PluginManager | from .pluginmanager import PluginManager | ||||||
| from .plugin import GajimPlugin | from .gajimplugin import GajimPlugin | ||||||
| 
 | 
 | ||||||
| __all__ = ['PluginManager', '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 log, log_calls, Singleton | ||||||
| from plugins.helpers import GajimPluginActivateException | from plugins.helpers import GajimPluginActivateException | ||||||
| from plugins.plugin import GajimPlugin, GajimPluginException | from plugins.GajimPlugin import GajimPlugin, GajimPluginException | ||||||
| 
 | 
 | ||||||
| class PluginManager(metaclass=Singleton): | class PluginManager(metaclass=Singleton): | ||||||
|     ''' |     ''' | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue