Browse Source

Actually convert to Python3

- Update shebang.
- Drop encoding line, useless in Python3.
- Use GObject rather than gobject.
Matteo Cypriani 1 year ago
parent
commit
cd317355f1
1 changed files with 6 additions and 7 deletions
  1. 6
    7
      gcp

+ 6
- 7
gcp View File

@@ -1,5 +1,4 @@
1
-#!/usr/bin/python
2
-# -*- coding: utf-8 -*-
1
+#!/usr/bin/env python3
3 2
 
4 3
 """
5 4
 gcp: Goffi's CoPier
@@ -35,7 +34,7 @@ import os,os.path
35 34
 from argparse import ArgumentParser
36 35
 import pickle
37 36
 try:
38
-    import gobject
37
+    from gi.repository import GObject
39 38
     #DBus
40 39
     import dbus, dbus.glib
41 40
     import dbus.service
@@ -341,8 +340,8 @@ class GCP():
341 340
                 source_fd.close()
342 341
                 return True
343 342
 
344
-            gobject.io_add_watch(source_fd,gobject.IO_IN,self._copyFile,
345
-                                 (dest_fd, options), priority=gobject.PRIORITY_DEFAULT)
343
+            GObject.io_add_watch(source_fd, GObject.IO_IN,self._copyFile,
344
+                                 (dest_fd, options), priority=GObject.PRIORITY_DEFAULT)
346 345
             if not self.progress:
347 346
                 info(_("COPYING %(source)s ==> %(dest)s") % {"source":source_file, "dest":dest_file})
348 347
             return True
@@ -665,7 +664,7 @@ class GCP():
665 664
             self.__checkArgs(options, source_dir, args)
666 665
             if not self.__launched:
667 666
                 self.journal = Journal()
668
-                gobject.idle_add(self.__copyNextFile)
667
+                GObject.idle_add(self.__copyNextFile)
669 668
                 self.__launched = True
670 669
         return (True,'')
671 670
 
@@ -675,7 +674,7 @@ class GCP():
675 674
 
676 675
     def go(self):
677 676
         """Launch main loop"""
678
-        self.loop = gobject.MainLoop()
677
+        self.loop = GObject.MainLoop()
679 678
         try:
680 679
             self.loop.run()
681 680
         except KeyboardInterrupt:

Loading…
Cancel
Save