[rhythmbox/gobject-introspection: 24/34] port coherence plugin to gi, tenuously



commit cd115383c7b65dcaa44ff8ad67e905efbadaacf3
Author: Jonathan Matthew <jonathan d14n org>
Date:   Tue Jul 13 15:46:52 2010 +1000

    port coherence plugin to gi, tenuously

 plugins/coherence/upnp_coherence/MediaPlayer.py |   41 +++++++++---------
 plugins/coherence/upnp_coherence/MediaStore.py  |   52 ++++++++++++-----------
 plugins/coherence/upnp_coherence/UpnpSource.py  |   24 ++++++-----
 plugins/coherence/upnp_coherence/__init__.py    |   51 ++++++++++++----------
 4 files changed, 87 insertions(+), 81 deletions(-)
---
diff --git a/plugins/coherence/upnp_coherence/MediaPlayer.py b/plugins/coherence/upnp_coherence/MediaPlayer.py
index d90b5f4..7dfc2ee 100644
--- a/plugins/coherence/upnp_coherence/MediaPlayer.py
+++ b/plugins/coherence/upnp_coherence/MediaPlayer.py
@@ -6,19 +6,18 @@
 import os.path
 import urllib
 
-from twisted.python import failure
+from gi.repository import RhythmDB
 
-import rhythmdb
+from twisted.python import failure
 
 from coherence.upnp.core.soap_service import errorCode
 from coherence.upnp.core import DIDLLite
 
 import louie
-
 from coherence.extern.simple_plugin import Plugin
-
 from coherence import log
 
+
 TRACK_COUNT = 1000000
 
 class RhythmboxPlayer(log.Loggable):
@@ -79,29 +78,29 @@ class RhythmboxPlayer(log.Loggable):
             self.metadata = None
             self.duration = None
         else:
-            id = self.shell.props.db.entry_get (entry, rhythmdb.PROP_ENTRY_ID)
-            bitrate = self.shell.props.db.entry_get(entry, rhythmdb.PROP_BITRATE) * 1024 / 8
+            id = self.shell.props.db.entry_get (entry, RhythmDB.PropType.ENTRY_ID)
+            bitrate = self.shell.props.db.entry_get(entry, RhythmDB.PropType.BITRATE) * 1024 / 8
             # Duration is in HH:MM:SS format
-            seconds = self.shell.props.db.entry_get(entry, rhythmdb.PROP_DURATION)
+            seconds = self.shell.props.db.entry_get(entry, RhythmDB.PropType.DURATION)
             hours = seconds / 3600
             seconds = seconds - hours * 3600
             minutes = seconds / 60
             seconds = seconds - minutes * 60
             self.duration = "%02d:%02d:%02d" % (hours, minutes, seconds)
 
-            mimetype = self.shell.props.db.entry_get(entry, rhythmdb.PROP_MIMETYPE)
+            mimetype = self.shell.props.db.entry_get(entry, RhythmDB.PropType.MIMETYPE)
             # This isn't a real mime-type
             if mimetype == "application/x-id3":
                 mimetype = "audio/mpeg"
-            size = self.shell.props.db.entry_get(entry, rhythmdb.PROP_FILE_SIZE)
+            size = self.shell.props.db.entry_get(entry, RhythmDB.PropType.FILE_SIZE)
 
             # create item
             item = DIDLLite.MusicTrack(id + TRACK_COUNT,'101')
-            item.album = self.shell.props.db.entry_get(entry, rhythmdb.PROP_ALBUM)
-            item.artist = self.shell.props.db.entry_get(entry, rhythmdb.PROP_ARTIST)
-            item.genre = self.shell.props.db.entry_get(entry, rhythmdb.PROP_GENRE)
-            item.originalTrackNumber = str(self.shell.props.db.entry_get (entry, rhythmdb.PROP_TRACK_NUMBER))
-            item.title = self.shell.props.db.entry_get(entry, rhythmdb.PROP_TITLE) # much nicer if it was entry.title
+            item.album = self.shell.props.db.entry_get(entry, RhythmDB.PropType.ALBUM)
+            item.artist = self.shell.props.db.entry_get(entry, RhythmDB.PropType.ARTIST)
+            item.genre = self.shell.props.db.entry_get(entry, RhythmDB.PropType.GENRE)
+            item.originalTrackNumber = str(self.shell.props.db.entry_get (entry, RhythmDB.PropType.TRACK_NUMBER))
+            item.title = self.shell.props.db.entry_get(entry, RhythmDB.PropType.TITLE) # much nicer if it was entry.title
 
             cover = self.shell.props.db.entry_request_extra_metadata(entry, "rb:coverArt-uri")
             if cover != None:
@@ -110,7 +109,7 @@ class RhythmboxPlayer(log.Loggable):
 
             item.res = []
 
-            location = self.shell.props.db.entry_get(entry, rhythmdb.PROP_LOCATION)
+            location = self.shell.props.db.entry_get(entry, RhythmDB.PropType.LOCATION)
             if location.startswith("file://"):
                 location = unicode(urllib.unquote(location[len("file://"):]))
 
@@ -281,22 +280,22 @@ class RhythmboxPlayer(log.Loggable):
                         bitrate = res.bitrate
                         break
 
-                self.shell.props.db.set(self.entry, rhythmdb.PROP_TITLE, item.title)
+                self.shell.props.db.set(self.entry, RhythmDB.PropType.TITLE, item.title)
                 try:
                     if item.artist is not None:
-                        self.shell.props.db.set(self.entry, rhythmdb.PROP_ARTIST, item.artist)
+                        self.shell.props.db.set(self.entry, RhythmDB.PropType.ARTIST, item.artist)
                 except AttributeError:
                     pass
                 try:
                     if item.album is not None:
-                        self.shell.props.db.set(self.entry, rhythmdb.PROP_ALBUM, item.album)
+                        self.shell.props.db.set(self.entry, RhythmDB.PropType.ALBUM, item.album)
                 except AttributeError:
                     pass
 
                 try:
                     self.info("%r %r", item.title,item.originalTrackNumber)
                     if item.originalTrackNumber is not None:
-                        self.shell.props.db.set(self.entry, rhythmdb.PROP_TRACK_NUMBER, int(item.originalTrackNumber))
+                        self.shell.props.db.set(self.entry, RhythmDB.PropType.TRACK_NUMBER, int(item.originalTrackNumber))
                 except AttributeError:
                     pass
 
@@ -304,10 +303,10 @@ class RhythmboxPlayer(log.Loggable):
                     h,m,s = duration.split(':')
                     seconds = int(h)*3600 + int(m)*60 + int(s)
                     self.info("%r %r:%r:%r %r", duration, h, m , s, seconds)
-                    self.shell.props.db.set(self.entry, rhythmdb.PROP_DURATION, seconds)
+                    self.shell.props.db.set(self.entry, RhythmDB.PropType.DURATION, seconds)
 
                 if size is not None:
-                    self.shell.props.db.set(self.entry, rhythmdb.PROP_FILE_SIZE,int(size))
+                    self.shell.props.db.set(self.entry, RhythmDB.PropType.FILE_SIZE,int(size))
 
         else:
             if uri.startswith('track-'):
diff --git a/plugins/coherence/upnp_coherence/MediaStore.py b/plugins/coherence/upnp_coherence/MediaStore.py
index 0915f5d..5b0ce90 100644
--- a/plugins/coherence/upnp_coherence/MediaStore.py
+++ b/plugins/coherence/upnp_coherence/MediaStore.py
@@ -5,16 +5,18 @@
 # Copyright 2007, Frank Scholz <coherence beebits net>
 
 import os.path
-import rhythmdb
 import louie
 import urllib
 
+from gi.repository import RhythmDB
+
 from coherence import __version_info__
 
 from coherence.upnp.core import DIDLLite
 
 from coherence.backend import BackendItem, BackendStore
 
+
 ROOT_CONTAINER_ID = 0
 AUDIO_CONTAINER = 100
 AUDIO_ALL_CONTAINER_ID = 101
@@ -88,8 +90,8 @@ class Album(BackendItem):
         self.store = store
 
         query = self.store.db.query_new()
-        self.store.db.query_append(query,[rhythmdb.QUERY_PROP_EQUALS, rhythmdb.PROP_TYPE, self.store.db.entry_type_get_by_name('song')],
-                                      [rhythmdb.QUERY_PROP_EQUALS, rhythmdb.PROP_ALBUM, self.title])
+        self.store.db.query_append(query,[RhythmDB.QueryType.EQUALS, RhythmDB.PropType.TYPE, self.store.db.entry_type_get_by_name('song')],
+                                      [RhythmDB.QueryType.EQUALS, RhythmDB.PropType.ALBUM, self.title])
         self.tracks_per_album_query = self.store.db.query_model_new(query)
         #self.tracks_per_album_query.set_sort_order(rhythmdb.rhythmdb_query_model_track_sort_func)
         self.store.db.do_full_query_async_parsed(self.tracks_per_album_query, query)
@@ -99,9 +101,9 @@ class Album(BackendItem):
 
         def track_sort(x,y):
             entry = self.store.db.entry_lookup_by_id (x.id)
-            x_track = self.store.db.entry_get (entry, rhythmdb.PROP_TRACK_NUMBER)
+            x_track = self.store.db.entry_get (entry, RhythmDB.PropType.TRACK_NUMBER)
             entry = self.store.db.entry_lookup_by_id (y.id)
-            y_track = self.store.db.entry_get (entry, rhythmdb.PROP_TRACK_NUMBER)
+            y_track = self.store.db.entry_get (entry, RhythmDB.PropType.TRACK_NUMBER)
             return cmp(x_track,y_track)
 
         def collate (model, path, iter):
@@ -150,12 +152,12 @@ class Artist(BackendItem):
         self.store = store
 
         query = self.store.db.query_new()
-        self.store.db.query_append(query,[rhythmdb.QUERY_PROP_EQUALS, rhythmdb.PROP_TYPE, self.store.db.entry_type_get_by_name('song')],
-                                      [rhythmdb.QUERY_PROP_EQUALS, rhythmdb.PROP_ARTIST, self.name])
+        self.store.db.query_append(query,[RhythmDB.QueryType.EQUALS, RhythmDB.PropType.TYPE, self.store.db.entry_type_get_by_name('song')],
+                                      [RhythmDB.QueryType.EQUALS, RhythmDB.PropType.ARTIST, self.name])
         self.tracks_per_artist_query = self.store.db.query_model_new(query)
         self.store.db.do_full_query_async_parsed(self.tracks_per_artist_query, query)
 
-        self.albums_per_artist_query = self.store.db.property_model_new(rhythmdb.PROP_ALBUM)
+        self.albums_per_artist_query = self.store.db.property_model_new(RhythmDB.PropType.ALBUM)
         self.albums_per_artist_query.props.query_model = self.tracks_per_artist_query
 
     def get_artist_all_tracks(self,id):
@@ -223,7 +225,7 @@ class Track(BackendItem):
         if type(id) == int:
             self.id = id
         else:
-            self.id = self.store.db.entry_get (id, rhythmdb.PROP_ENTRY_ID)
+            self.id = self.store.db.entry_get (id, RhythmDB.PropType.ENTRY_ID)
         self.parent_id = parent_id
 
     def get_children(self, start=0, request_count=0):
@@ -241,9 +243,9 @@ class Track(BackendItem):
         # load common values
         entry = self.store.db.entry_lookup_by_id(self.id)
         # Bitrate is in bytes/second, not kilobits/second
-        bitrate = self.store.db.entry_get(entry, rhythmdb.PROP_BITRATE) * 1024 / 8
+        bitrate = self.store.db.entry_get(entry, RhythmDB.PropType.BITRATE) * 1024 / 8
         # Duration is in HH:MM:SS format
-        seconds = self.store.db.entry_get(entry, rhythmdb.PROP_DURATION)
+        seconds = self.store.db.entry_get(entry, RhythmDB.PropType.DURATION)
         hours = seconds / 3600
         seconds = seconds - hours * 3600
         minutes = seconds / 60
@@ -251,13 +253,13 @@ class Track(BackendItem):
         duration = ("%02d:%02d:%02d") % (hours, minutes, seconds)
 
         location = self.get_path(entry)
-        mimetype = self.store.db.entry_get(entry, rhythmdb.PROP_MIMETYPE)
+        mimetype = self.store.db.entry_get(entry, RhythmDB.PropType.MIMETYPE)
         # This isn't a real mime-type
         if mimetype == "application/x-id3":
             mimetype = "audio/mpeg"
-        size = self.store.db.entry_get(entry, rhythmdb.PROP_FILE_SIZE)
+        size = self.store.db.entry_get(entry, RhythmDB.PropType.FILE_SIZE)
 
-        album = self.store.db.entry_get(entry, rhythmdb.PROP_ALBUM)
+        album = self.store.db.entry_get(entry, RhythmDB.PropType.ALBUM)
         if self.parent_id == None:
             try:
                 self.parent_id = self.store.albums[album].id
@@ -268,11 +270,11 @@ class Track(BackendItem):
         item = DIDLLite.MusicTrack(self.id + TRACK_COUNT,self.parent_id)
         item.album = album
 
-        item.artist = self.store.db.entry_get(entry, rhythmdb.PROP_ARTIST)
+        item.artist = self.store.db.entry_get(entry, RhythmDB.PropType.ARTIST)
         #item.date =
-        item.genre = self.store.db.entry_get(entry, rhythmdb.PROP_GENRE)
-        item.originalTrackNumber = str(self.store.db.entry_get (entry, rhythmdb.PROP_TRACK_NUMBER))
-        item.title = self.store.db.entry_get(entry, rhythmdb.PROP_TITLE) # much nicer if it was entry.title
+        item.genre = self.store.db.entry_get(entry, RhythmDB.PropType.GENRE)
+        item.originalTrackNumber = str(self.store.db.entry_get (entry, RhythmDB.PropType.TRACK_NUMBER))
+        item.title = self.store.db.entry_get(entry, RhythmDB.PropType.TITLE) # much nicer if it was entry.title
 
         cover = self.store.db.entry_request_extra_metadata(entry, "rb:coverArt-uri")
         #self.warning("cover for %r is %r", item.title, cover)
@@ -308,7 +310,7 @@ class Track(BackendItem):
 
     def get_name(self):
         entry = self.store.db.entry_lookup_by_id (self.id)
-        return self.store.db.entry_get(entry, rhythmdb.PROP_TITLE)
+        return self.store.db.entry_get(entry, RhythmDB.PropType.TITLE)
 
     def get_url(self):
         return self.store.urlbase + str(self.id + TRACK_COUNT)
@@ -316,7 +318,7 @@ class Track(BackendItem):
     def get_path(self, entry = None):
         if entry is None:
             entry = self.store.db.entry_lookup_by_id (self.id)
-        uri = self.store.db.entry_get(entry, rhythmdb.PROP_LOCATION)
+        uri = self.store.db.entry_get(entry, RhythmDB.PropType.LOCATION)
         self.info("Track get_path uri = %r", uri)
         location = None
         if uri.startswith("file://"):
@@ -363,14 +365,14 @@ class MediaStore(BackendStore):
 
         query = self.db.query_new()
         self.info(query)
-        self.db.query_append(query, [rhythmdb.QUERY_PROP_EQUALS, rhythmdb.PROP_TYPE, self.db.entry_type_get_by_name('song')])
+        self.db.query_append(query, [RhythmDB.QueryType.EQUALS, RhythmDB.PropType.TYPE, self.db.entry_type_get_by_name('song')])
         qm = self.db.query_model_new(query)
         self.db.do_full_query_async_parsed(qm, query)
 
-        self.album_query = self.db.property_model_new(rhythmdb.PROP_ALBUM)
+        self.album_query = self.db.property_model_new(RhythmDB.PropType.ALBUM)
         self.album_query.props.query_model = qm
 
-        self.artist_query = self.db.property_model_new(rhythmdb.PROP_ARTIST)
+        self.artist_query = self.db.property_model_new(RhythmDB.PropType.ARTIST)
         self.artist_query.props.query_model = qm
 
         self.containers = {}
@@ -435,9 +437,9 @@ class MediaStore(BackendStore):
         tracks = []
 
         def track_cb (entry):
-            if self.db.entry_get (entry, rhythmdb.PROP_HIDDEN):
+            if self.db.entry_get (entry, RhythmDB.PropType.HIDDEN):
                 return
-            id = self.db.entry_get (entry, rhythmdb.PROP_ENTRY_ID)
+            id = self.db.entry_get (entry, RhythmDB.PropType.ENTRY_ID)
             track = Track(self, id, parent_id)
             tracks.append(track)
 
diff --git a/plugins/coherence/upnp_coherence/UpnpSource.py b/plugins/coherence/upnp_coherence/UpnpSource.py
index 93a20ba..4b944f1 100644
--- a/plugins/coherence/upnp_coherence/UpnpSource.py
+++ b/plugins/coherence/upnp_coherence/UpnpSource.py
@@ -4,26 +4,28 @@
 # Copyright 2007, James Livingston  <doclivingston gmail com>
 # Copyright 2007,2008 Frank Scholz <coherence beebits net>
 
-import rb, rhythmdb
-import gobject, gtk
+import gobject
+
+from gi.repository import RB, RhythmDB
 
 from coherence import __version_info__ as coherence_version
 
 from coherence import log
 from coherence.upnp.core import DIDLLite
 
-class UpnpSource(rb.BrowserSource,log.Loggable):
+
+class UpnpSource(RB.BrowserSource,log.Loggable):
 
     logCategory = 'rb_media_store'
 
     __gproperties__ = {
-        'plugin': (rb.Plugin, 'plugin', 'plugin', gobject.PARAM_WRITABLE|gobject.PARAM_CONSTRUCT_ONLY),
+        'plugin': (RB.Plugin, 'plugin', 'plugin', gobject.PARAM_WRITABLE|gobject.PARAM_CONSTRUCT_ONLY),
         'client': (gobject.TYPE_PYOBJECT, 'client', 'client', gobject.PARAM_WRITABLE|gobject.PARAM_CONSTRUCT_ONLY),
         'udn': (gobject.TYPE_PYOBJECT, 'udn', 'udn', gobject.PARAM_WRITABLE|gobject.PARAM_CONSTRUCT_ONLY),
     }
 
     def __init__(self):
-        rb.BrowserSource.__init__(self)
+        RB.BrowserSource.__init__(self)
         self.__db = None
         self.__activated = False
         self.container_watch = []
@@ -111,22 +113,22 @@ class UpnpSource(rb.BrowserSource,log.Loggable):
                     if entry == None:
                         entry = self.__db.entry_new(self.__entry_type, url)
 
-                    self.__db.set(entry, rhythmdb.PROP_TITLE, item.title)
+                    self.__db.set(entry, RhythmDB.PropType.TITLE, item.title)
                     try:
                         if item.artist is not None:
-                            self.__db.set(entry, rhythmdb.PROP_ARTIST, item.artist)
+                            self.__db.set(entry, RhythmDB.PropType.ARTIST, item.artist)
                     except AttributeError:
                         pass
                     try:
                         if item.album is not None:
-                            self.__db.set(entry, rhythmdb.PROP_ALBUM, item.album)
+                            self.__db.set(entry, RhythmDB.PropType.ALBUM, item.album)
                     except AttributeError:
                         pass
 
                     try:
                         self.info("%r %r", item.title,item.originalTrackNumber)
                         if item.originalTrackNumber is not None:
-                            self.__db.set(entry, rhythmdb.PROP_TRACK_NUMBER, int(item.originalTrackNumber))
+                            self.__db.set(entry, RhythmDB.PropType.TRACK_NUMBER, int(item.originalTrackNumber))
                     except AttributeError:
                         pass
 
@@ -134,10 +136,10 @@ class UpnpSource(rb.BrowserSource,log.Loggable):
                         h,m,s = duration.split(':')
                         seconds = int(h)*3600 + int(m)*60 + int(s)
                         self.info("%r %r:%r:%r %r", duration, h, m , s, seconds)
-                        self.__db.set(entry, rhythmdb.PROP_DURATION, seconds)
+                        self.__db.set(entry, RhythmDB.PropType.DURATION, seconds)
 
                     if size is not None:
-                        self.__db.set(entry, rhythmdb.PROP_FILE_SIZE,int(size))
+                        self.__db.set(entry, RhythmDB.PropType.FILE_SIZE,int(size))
 
                     self.__db.commit()
 
diff --git a/plugins/coherence/upnp_coherence/__init__.py b/plugins/coherence/upnp_coherence/__init__.py
index caf2b46..c8438f6 100644
--- a/plugins/coherence/upnp_coherence/__init__.py
+++ b/plugins/coherence/upnp_coherence/__init__.py
@@ -6,18 +6,14 @@
 # Licensed under the MIT license
 # http://opensource.org/licenses/mit-license.php
 
-
-import rhythmdb, rb
-import gobject, gtk
-
-import gconf
-
 import louie
-
 from coherence import log
 
 # for the icon
-import os.path, urllib, gio, gtk.gdk
+import os.path, urllib, gio
+
+from gi.repository import RB
+from gi.repository import Gtk, GConf, GdkPixbuf
 
 # the gconf configuration
 gconf_keys = {
@@ -37,14 +33,14 @@ gconf_keys = {
     'dmc_active': "/apps/rhythmbox/plugins/coherence/dmc/active",
 }
 
-class CoherencePlugin(rb.Plugin, log.Loggable):
+class CoherencePlugin(RB.Plugin, log.Loggable):
 
     logCategory = 'rb_coherence_plugin'
 
     def __init__(self):
-        rb.Plugin.__init__(self)
+        RB.Plugin.__init__(self)
         self.coherence = None
-        self.config = gconf.client_get_default()
+        self.config = GConf.Client.get_default()
 
         if self.config.get(gconf_keys['dmc_active']) is None:
             # key not yet found represented by "None"
@@ -58,6 +54,7 @@ class CoherencePlugin(rb.Plugin, log.Loggable):
         self.config.set_bool(gconf_keys['dmc_active'], True)
 
     def activate(self, shell):
+	# oh shit
         from twisted.internet import gtk2reactor
         try:
             gtk2reactor.install()
@@ -82,7 +79,7 @@ class CoherencePlugin(rb.Plugin, log.Loggable):
             url = file.get_uri();
             info = file.query_info("standard::content-type");
             mimetype = info.get_attribute_as_string("standard::content-type");
-            pixbuf = gtk.gdk.pixbuf_new_from_file(face_path)
+            pixbuf = GdkPixbuf.Pixbuf.new_from_file(face_path)
             width = "%s" % pixbuf.get_width()
             height = "%s" % pixbuf.get_height()
             depth = '24'
@@ -248,7 +245,7 @@ class CoherencePlugin(rb.Plugin, log.Loggable):
             return
 
         db = self.shell.props.db
-        group = rb.rb_source_group_get_by_name("shared")
+        group = RB.rb_source_group_get_by_name("shared")
         entry_type = db.entry_register_type("CoherenceUpnp:%s" %
                  client.device.get_id()[5:])
 
@@ -276,43 +273,49 @@ class CoherencePlugin(rb.Plugin, log.Loggable):
                     self.config.set_string(gconf_keys['interface'],interface)
                 dialog.hide()
 
-            dialog = gtk.Dialog(title='DLNA/UPnP Configuration',
+            dialog = Gtk.Dialog(title='DLNA/UPnP Configuration',
                             parent=None,flags=0,buttons=None)
             dialog.set_default_size(400,350)
 
-            table = gtk.Table(rows=2, columns=2, homogeneous=True)
+            table = Gtk.Table(rows=2, columns=2, homogeneous=True)
             dialog.vbox.pack_start(table, False, False, 0)
 
-            label = gtk.Label("Port :")
+            label = Gtk.Label(str="Port :")
             label.set_alignment(0,0.5)
             table.attach(label, 0, 1, 0, 1)
 
             value = 0
             if self.config.get_int(gconf_keys['port']) != None:
                 value = self.config.get_int(gconf_keys['port'])
-            adj = gtk.Adjustment(value, 0, 65535, 1, 100, 0)
-            port_spinner = gtk.SpinButton(adj, 0, 0)
+            adj = Gtk.Adjustment(value, 0, 65535, 1, 100, 0)
+            port_spinner = Gtk.SpinButton(adj, 0, 0)
             port_spinner.set_wrap(True)
             port_spinner.set_numeric(True)
             table.attach(port_spinner, 1, 2, 0, 1,
-                         xoptions=gtk.FILL|gtk.EXPAND,yoptions=gtk.FILL|gtk.EXPAND,xpadding=5,ypadding=5)
+                         xoptions=Gtk.AttachOptions.FILL|Gtk.AttachOptions.EXPAND,
+			 yoptions=Gtk.AttachOptions.FILL|Gtk.AttachOptions.EXPAND,
+			 xpadding=5,
+			 ypadding=5)
 
-            label = gtk.Label("Interface :")
+            label = Gtk.Label(str="Interface :")
             label.set_alignment(0,0.5)
             table.attach(label, 0, 1, 1, 2)
-            interface_entry = gtk.Entry()
+            interface_entry = Gtk.Entry()
             interface_entry.set_max_length(16)
             if self.config.get_string(gconf_keys['interface']) != None:
                 interface_entry.set_text(self.config.get_string(gconf_keys['interface']))
             else:
                 interface_entry.set_text('')
             table.attach(interface_entry, 1, 2, 1, 2,
-                         xoptions=gtk.FILL|gtk.EXPAND,yoptions=gtk.FILL|gtk.EXPAND,xpadding=5,ypadding=5)
+                         xoptions=Gtk.AttachOptions.FILL|Gtk.AttachOptions.EXPAND,
+			 yoptions=Gtk.AttachOptions.FILL|Gtk.AttachOptions.EXPAND,
+			 xpadding=5,
+			 ypadding=5)
 
-            button = gtk.Button(stock=gtk.STOCK_CANCEL)
+            button = Gtk.Button(stock=Gtk.STOCK_CANCEL)
             dialog.action_area.pack_start(button, True, True, 5)
             button.connect("clicked", lambda w: dialog.hide())
-            button = gtk.Button(stock=gtk.STOCK_OK)
+            button = Gtk.Button(stock=Gtk.STOCK_OK)
             button.connect("clicked", lambda w: store_config(dialog,port_spinner,interface_entry))
             dialog.action_area.pack_start(button, True, True, 5)
             dialog.show_all()



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