[gnome-dvb-daemon/gst-1.0] Converted to python3



commit 77cff0c717829623dfd522918c55bd822fa8adbb
Author: Sebastian Pölsterl <sebp k-d-w org>
Date:   Sun Oct 13 20:18:23 2013 +0200

    Converted to python3

 client/gnome-dvb-setup                             |    2 +-
 client/gnomedvb/Callback.py                        |    3 ++-
 client/gnomedvb/DBusWrapper.py                     |    2 +-
 .../channellisteditor/ChannelListEditorDialog.py   |    2 +-
 .../ui/controlcenter/ControlCenterWindow.py        |    2 +-
 client/gnomedvb/ui/preferences/DeviceGroupsView.py |    4 ++--
 client/gnomedvb/ui/preferences/Preferences.py      |    2 +-
 client/gnomedvb/ui/timers/EditTimersDialog.py      |    6 +++---
 client/gnomedvb/ui/widgets/CellRendererDatetime.py |    4 ++--
 client/gnomedvb/ui/widgets/ChannelGroupsStore.py   |    2 +-
 client/gnomedvb/ui/widgets/ChannelsStore.py        |   14 +++++++-------
 client/gnomedvb/ui/widgets/RecordingsStore.py      |    4 ++--
 client/gnomedvb/ui/widgets/RunningNextStore.py     |    4 ++--
 client/gnomedvb/ui/widgets/ScheduleStore.py        |    6 +++---
 client/gnomedvb/ui/wizard/SetupWizard.py           |    2 +-
 client/gnomedvb/ui/wizard/pages/ChannelScanPage.py |    2 +-
 .../ui/wizard/pages/InitialTuningDataPage.py       |    4 ++--
 17 files changed, 33 insertions(+), 32 deletions(-)
---
diff --git a/client/gnome-dvb-setup b/client/gnome-dvb-setup
index 0cdf252..be926f5 100644
--- a/client/gnome-dvb-setup
+++ b/client/gnome-dvb-setup
@@ -32,7 +32,7 @@ w = SetupWizard()
 w.realize()
 
 if options.transient_for:
-       print "Parent window:", options.transient_for
+       print("Parent window:", options.transient_for)
        w.set_position(Gtk.WindowPosition.CENTER_ON_PARENT)
        w.set_modal(True)
        #XXX foreign_win = Gdk.window_foreign_new(options.transient_for)
diff --git a/client/gnomedvb/Callback.py b/client/gnomedvb/Callback.py
index 6736321..7b654a9 100644
--- a/client/gnomedvb/Callback.py
+++ b/client/gnomedvb/Callback.py
@@ -1,3 +1,4 @@
+import collections
 # -*- coding: utf-8 -*-
 # Copyright (C) 2009 Sebastian Pölsterl
 #
@@ -22,7 +23,7 @@ class Callback:
         self.callbacks = []
 
     def add_callback(self, callback_function, *args):
-        if not callable(callback_function):
+        if not isinstance(callback_function, collections.Callable):
             raise TypeError("first argument must be callable")
         self.callbacks.append((callback_function, args))
 
diff --git a/client/gnomedvb/DBusWrapper.py b/client/gnomedvb/DBusWrapper.py
index 5b40780..6d26776 100644
--- a/client/gnomedvb/DBusWrapper.py
+++ b/client/gnomedvb/DBusWrapper.py
@@ -45,7 +45,7 @@ CHANNEL_LIST_IFACE = "org.gnome.DVB.ChannelList"
 SCHEDULE_IFACE = "org.gnome.DVB.Schedule"
 
 def _default_error_handler_func(*args):
-    print >> sys.stderr, "Error: " + str(args)
+    print("Error: " + str(args), file=sys.stderr)
 
 global_error_handler = _default_error_handler_func
 
diff --git a/client/gnomedvb/ui/channellisteditor/ChannelListEditorDialog.py 
b/client/gnomedvb/ui/channellisteditor/ChannelListEditorDialog.py
index 68a49e4..09f8416 100644
--- a/client/gnomedvb/ui/channellisteditor/ChannelListEditorDialog.py
+++ b/client/gnomedvb/ui/channellisteditor/ChannelListEditorDialog.py
@@ -125,7 +125,7 @@ class ChannelListEditorDialog(Gtk.Dialog):
         cbox.pack_start(left_frame, True, True, 0)
 
         # selected channels
-        self.selected_channels_store = Gtk.ListStore(str, long) # Name, sid
+        self.selected_channels_store = Gtk.ListStore(str, int) # Name, sid
         self.selected_channels_view = Gtk.TreeView.new_with_model(self.selected_channels_store)
         self.selected_channels_view.set_reorderable(True)
         self.selected_channels_view.set_headers_visible(False)
diff --git a/client/gnomedvb/ui/controlcenter/ControlCenterWindow.py 
b/client/gnomedvb/ui/controlcenter/ControlCenterWindow.py
index 6e6a957..294cf1f 100644
--- a/client/gnomedvb/ui/controlcenter/ControlCenterWindow.py
+++ b/client/gnomedvb/ui/controlcenter/ControlCenterWindow.py
@@ -595,7 +595,7 @@ class ControlCenterWindow(Gtk.Window):
         #translators: These appear in the About dialog, usual format applies.
         about.set_translator_credits( _("translator-credits") )
 
-        for prop, val in gnomedvb.INFOS.items():
+        for prop, val in list(gnomedvb.INFOS.items()):
             about.set_property(prop, val)
 
         about.set_screen(self.get_screen())
diff --git a/client/gnomedvb/ui/preferences/DeviceGroupsView.py 
b/client/gnomedvb/ui/preferences/DeviceGroupsView.py
index 3fa4d95..75af37b 100644
--- a/client/gnomedvb/ui/preferences/DeviceGroupsView.py
+++ b/client/gnomedvb/ui/preferences/DeviceGroupsView.py
@@ -25,7 +25,7 @@ __all__ = ["UnassignedDevicesStore", "DeviceGroupsStore", "DeviceGroupsView"]
 
 class UnassignedDevicesStore (Gtk.ListStore):
 
-    (COL_DEVICE,) = range(1)
+    (COL_DEVICE,) = list(range(1))
 
     def __init__(self):
         Gtk.ListStore.__init__(self, GObject.TYPE_PYOBJECT)
@@ -33,7 +33,7 @@ class UnassignedDevicesStore (Gtk.ListStore):
 
 class DeviceGroupsStore (Gtk.TreeStore):
 
-    (COL_GROUP, COL_DEVICE,) = range(2)
+    (COL_GROUP, COL_DEVICE,) = list(range(2))
 
     def __init__(self):
         Gtk.TreeStore.__init__(self, GObject.GObject, GObject.TYPE_PYOBJECT)
diff --git a/client/gnomedvb/ui/preferences/Preferences.py b/client/gnomedvb/ui/preferences/Preferences.py
index 7b486a7..994ff86 100644
--- a/client/gnomedvb/ui/preferences/Preferences.py
+++ b/client/gnomedvb/ui/preferences/Preferences.py
@@ -31,7 +31,7 @@ class Preferences(Gtk.Window):
     (BUTTON_EDIT,
      BUTTON_REMOVE,
      SEP1,
-     BUTTON_PREFERENCES,) = range(4)
+     BUTTON_PREFERENCES,) = list(range(4))
 
     def __init__(self, model, parent=None):
         GObject.GObject.__init__(self)
diff --git a/client/gnomedvb/ui/timers/EditTimersDialog.py b/client/gnomedvb/ui/timers/EditTimersDialog.py
index f073c4d..2bf8c0c 100644
--- a/client/gnomedvb/ui/timers/EditTimersDialog.py
+++ b/client/gnomedvb/ui/timers/EditTimersDialog.py
@@ -33,7 +33,7 @@ class EditTimersDialog(Gtk.Dialog):
     COL_TITLE,
     COL_START,
     COL_DURATION,
-    COL_ACTIVE,) = range(6)
+    COL_ACTIVE,) = list(range(6))
 
     def __init__(self, device_group, parent=None):
         """
@@ -63,7 +63,7 @@ class EditTimersDialog(Gtk.Dialog):
         self.main_box.show()
         self.get_content_area().pack_start(self.main_box, True, True, 0)
 
-        self.timerslist = Gtk.ListStore(long, str, str, GObject.TYPE_PYOBJECT, long, bool)
+        self.timerslist = Gtk.ListStore(int, str, str, GObject.TYPE_PYOBJECT, int, bool)
         self.timerslist.set_sort_func(self.COL_START,
             self._datetime_sort_func)
 
@@ -150,7 +150,7 @@ class EditTimersDialog(Gtk.Dialog):
             starttime = datetime.datetime(*start_list)
             (duration, active, channel, title) = self.recorder.get_all_informations(timer_id)[0][1:]
 
-            self.timerslist.append([long(timer_id), channel, title, starttime, duration, bool(active)])
+            self.timerslist.append([int(timer_id), channel, title, starttime, duration, bool(active)])
 
     def _remove_timer(self, timer_id):
         for row in self.timerslist:
diff --git a/client/gnomedvb/ui/widgets/CellRendererDatetime.py 
b/client/gnomedvb/ui/widgets/CellRendererDatetime.py
index d415b13..549ae74 100644
--- a/client/gnomedvb/ui/widgets/CellRendererDatetime.py
+++ b/client/gnomedvb/ui/widgets/CellRendererDatetime.py
@@ -43,7 +43,7 @@ class CellRendererDatetime(Gtk.CellRendererText):
         elif prop.name == 'format':
             return self._format
         else:
-            raise AttributeError, 'unknown property %s' % prop.name
+            raise AttributeError('unknown property %s' % prop.name)
 
     def do_set_property(self, prop, value):
         if prop.name == 'datetime':
@@ -53,7 +53,7 @@ class CellRendererDatetime(Gtk.CellRendererText):
             self._format = value
             self._set_text()
         else:
-            raise AttributeError, 'unknown property %s' % prop.name
+            raise AttributeError('unknown property %s' % prop.name)
 
     def _set_text(self):
         if self._datetime == None:
diff --git a/client/gnomedvb/ui/widgets/ChannelGroupsStore.py 
b/client/gnomedvb/ui/widgets/ChannelGroupsStore.py
index b253528..c593b27 100644
--- a/client/gnomedvb/ui/widgets/ChannelGroupsStore.py
+++ b/client/gnomedvb/ui/widgets/ChannelGroupsStore.py
@@ -22,7 +22,7 @@ class ChannelGroupsStore(Gtk.ListStore):
 
     (COL_ID,
      COL_NAME,
-     COL_EDITABLE,) = range(3)
+     COL_EDITABLE,) = list(range(3))
 
     def __init__(self):
         Gtk.ListStore.__init__(self, int, str, bool)
diff --git a/client/gnomedvb/ui/widgets/ChannelsStore.py b/client/gnomedvb/ui/widgets/ChannelsStore.py
index 56a869b..7df7b01 100644
--- a/client/gnomedvb/ui/widgets/ChannelsStore.py
+++ b/client/gnomedvb/ui/widgets/ChannelsStore.py
@@ -27,7 +27,7 @@ from gnomedvb import _
 class ChannelsStore(Gtk.ListStore):
 
     (COL_NAME,
-     COL_SID,) = range(2)
+     COL_SID,) = list(range(2))
 
     __gsignals__ = {
         "loading-finished":  (GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE, []),
@@ -39,7 +39,7 @@ class ChannelsStore(Gtk.ListStore):
         list of channels should be retrieved
         """
 
-        Gtk.ListStore.__init__(self, str, long)
+        Gtk.ListStore.__init__(self, str, int)
 
         self.set_sort_column_id(self.COL_NAME,
             Gtk.SortType.ASCENDING)
@@ -63,14 +63,14 @@ class ChannelsTreeStore(Gtk.TreeStore):
     (COL_GROUP_ID,
      COL_NAME,
      COL_SID,
-     COL_GROUP,) = range(4)
+     COL_GROUP,) = list(range(4))
 
     __gsignals__ = {
         "loading-finished":  (GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE, [int]),
     }
 
     def __init__(self, use_channel_groups=False):
-        Gtk.TreeStore.__init__(self, int, str, long, GObject.GObject)
+        Gtk.TreeStore.__init__(self, int, str, int, GObject.GObject)
 
         self.set_sort_order(Gtk.SortType.ASCENDING)
 
@@ -92,7 +92,7 @@ class ChannelsTreeStore(Gtk.TreeStore):
         group_id = dev_group.get_id()
         group_name = dev_group.get_name()
 
-        group_iter = self.append(None, [group_id, group_name, 0L, dev_group])
+        group_iter = self.append(None, [group_id, group_name, 0, dev_group])
         channellist = dev_group.get_channel_list()
 
         d = Callback()
@@ -104,9 +104,9 @@ class ChannelsTreeStore(Gtk.TreeStore):
                 error_handler=global_error_handler)
             # Put all available channels either in TV or radio group
             tv_group_iter = self.append(group_iter,
-                [group_id, _("TV Channels"), 0L, dev_group])
+                [group_id, _("TV Channels"), 0, dev_group])
             radio_group_iter = self.append(group_iter,
-                [group_id, _("Radio Channels"), 0L, dev_group])
+                [group_id, _("Radio Channels"), 0, dev_group])
         else:
             # Do not distinguish between radio and TV
             tv_group_iter = group_iter
diff --git a/client/gnomedvb/ui/widgets/RecordingsStore.py b/client/gnomedvb/ui/widgets/RecordingsStore.py
index eb77076..29fe3ed 100644
--- a/client/gnomedvb/ui/widgets/RecordingsStore.py
+++ b/client/gnomedvb/ui/widgets/RecordingsStore.py
@@ -29,10 +29,10 @@ class RecordingsStore(Gtk.ListStore):
     COL_NAME,
     COL_DURATION,
     COL_LOCATION,
-    COL_ID,) = range(6)
+    COL_ID,) = list(range(6))
 
     def __init__(self):
-        Gtk.ListStore.__init__(self, GObject.TYPE_PYOBJECT, str, str, long, str, long)
+        Gtk.ListStore.__init__(self, GObject.TYPE_PYOBJECT, str, str, int, str, int)
 
         self._recstore = DVBRecordingsStoreClient()
         self._recstore.connect("changed", self._on_changed)
diff --git a/client/gnomedvb/ui/widgets/RunningNextStore.py b/client/gnomedvb/ui/widgets/RunningNextStore.py
index 610bdb3..fe0dc49 100644
--- a/client/gnomedvb/ui/widgets/RunningNextStore.py
+++ b/client/gnomedvb/ui/widgets/RunningNextStore.py
@@ -29,10 +29,10 @@ class RunningNextStore(Gtk.ListStore):
      COL_NEXT,
      COL_SID,
      COL_RUNNING_EVENT,
-     COL_NEXT_EVENT) = range(8)
+     COL_NEXT_EVENT) = list(range(8))
 
     def __init__(self, group):
-        Gtk.ListStore.__init__(self, str, long, str, long, str, long, long, long)
+        Gtk.ListStore.__init__(self, str, int, str, int, str, int, int, int)
 
         self.set_sort_column_id(self.COL_CHANNEL,
             Gtk.SortType.ASCENDING)
diff --git a/client/gnomedvb/ui/widgets/ScheduleStore.py b/client/gnomedvb/ui/widgets/ScheduleStore.py
index 9f64aa1..711069f 100644
--- a/client/gnomedvb/ui/widgets/ScheduleStore.py
+++ b/client/gnomedvb/ui/widgets/ScheduleStore.py
@@ -31,16 +31,16 @@ class ScheduleStore(Gtk.ListStore):
      COL_SHORT_DESC,
      COL_EXTENDED_DESC,
      COL_RECORDED,
-     COL_EVENT_ID,) = range(8)
+     COL_EVENT_ID,) = list(range(8))
 
-    NEW_DAY = -1L
+    NEW_DAY = -1
 
     __gsignals__ = {
         "loading-finished":  (GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE, []),
     }
 
     def __init__(self, dev_group, sid):
-        Gtk.ListStore.__init__(self, GObject.TYPE_PYOBJECT, str, long, str, str, str, int, long)
+        Gtk.ListStore.__init__(self, GObject.TYPE_PYOBJECT, str, int, str, str, str, int, int)
         self._client = dev_group.get_schedule(sid)
         if self._client != None:
             self._recorder = dev_group.get_recorder()
diff --git a/client/gnomedvb/ui/wizard/SetupWizard.py b/client/gnomedvb/ui/wizard/SetupWizard.py
index 71f1078..d0d4ec8 100644
--- a/client/gnomedvb/ui/wizard/SetupWizard.py
+++ b/client/gnomedvb/ui/wizard/SetupWizard.py
@@ -63,7 +63,7 @@ class SetupWizard(Gtk.Assistant):
      CHANNEL_SCAN_PAGE,
      SAVE_CHANNELS_PAGE,
      SETUP_DEVICE_PAGE,
-     SUMMARY_PAGE) = range(7)
+     SUMMARY_PAGE) = list(range(7))
 
     def __init__(self):
         GObject.GObject.__init__(self)
diff --git a/client/gnomedvb/ui/wizard/pages/ChannelScanPage.py 
b/client/gnomedvb/ui/wizard/pages/ChannelScanPage.py
index 1f34c2f..b49a17d 100644
--- a/client/gnomedvb/ui/wizard/pages/ChannelScanPage.py
+++ b/client/gnomedvb/ui/wizard/pages/ChannelScanPage.py
@@ -34,7 +34,7 @@ class ChannelScanPage(BasePage):
      COL_NAME,
      COL_ACTIVE,
      COL_SID,
-     COL_SCRAMBLED) = range(5)
+     COL_SCRAMBLED) = list(range(5))
 
     MENU = '''<ui>
     <popup name="channels-popup">
diff --git a/client/gnomedvb/ui/wizard/pages/InitialTuningDataPage.py 
b/client/gnomedvb/ui/wizard/pages/InitialTuningDataPage.py
index a964dae..536d64a 100644
--- a/client/gnomedvb/ui/wizard/pages/InitialTuningDataPage.py
+++ b/client/gnomedvb/ui/wizard/pages/InitialTuningDataPage.py
@@ -226,7 +226,7 @@ class InitialTuningDataPage(BasePage):
         self.countries.set_sort_column_id(0, Gtk.SortType.ASCENDING)
         self.countries.set_sort_func(0, self.combobox_sort_func)
 
-        for code, name in countries.items():
+        for code, name in list(countries.items()):
             self.countries.append([name, code])
 
         self.country_combo = Gtk.ComboBox.new_with_model_and_entry(self.countries)
@@ -299,7 +299,7 @@ class InitialTuningDataPage(BasePage):
         self.countries.set_sort_column_id(0, Gtk.SortType.ASCENDING)
         self.countries.set_sort_func(0, self.combobox_sort_func, None)
 
-        for code, name in countries.items():
+        for code, name in list(countries.items()):
             self.countries.append([name, code])
 
         self.country_combo = Gtk.ComboBox.new_with_model_and_entry(self.countries)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]