Пример #1
0
 def configure(self, window):
     """
     Configures the ZotoSink
     """
     widget = Utils.dataprovider_glade_get_widget(
             __file__,
             "zoto.glade",
             "ZotoSinkConfigDialog")
             
     # Get configuration widgets
     username = widget.get_widget("username")
     password = widget.get_widget("password")
     album = widget.get_widget("album")
             
     # Load the widgets with presets
     username.set_text(self.username)
     password.set_text(self.password)
     album.set_text(self.albumName)
             
     dlg = widget.get_widget("ZotoSinkConfigDialog")
     
     response = Utils.run_dialog(dlg, window)
             
     if response == True:
         self.username = username.get_text()
         self.password = password.get_text()
         self.albumName = album.get_text()
             
     dlg.destroy()
Пример #2
0
    def configure( self, window ):
        # thanks to the evolution module for some of this
        import gtk
        tree = Utils.dataprovider_glade_get_widget(
                        __file__, 
                        "config.glade",
                        "Firefox3ConfigDialog"
                        )

        sourceComboBox = tree.get_widget("profileComboBox")
        store = gtk.ListStore( str, str )
        sourceComboBox.set_model(store)

        cell = gtk.CellRendererText()
        sourceComboBox.pack_start(cell, True)
        sourceComboBox.add_attribute(cell, 'text', 0)
        sourceComboBox.set_active(0)

        for profilename, profilepath in self.get_profiles():
            rowref = store.append( ( profilename, profilepath ) )
            if profilepath == self.ProfilePath:
                sourceComboBox.set_active_iter(rowref)

        dlg = tree.get_widget("Firefox3ConfigDialog")
        
        response = Utils.run_dialog (dlg, window)
        if response == True:
            self.ProfilePath = store.get_value(sourceComboBox.get_active_iter(), 1)
        dlg.destroy()
Пример #3
0
    def configure(self, window):
        """
        Configures the RTM Backend
        """
        import gtk
        import gobject

        def on_login_finish(*args):
            Utils.dialog_reset_cursor(dlg)

        def on_response(sender, responseID):
            if responseID == gtk.RESPONSE_OK:
                self.username = str(tree.get_widget('user_entry').get_text())
                self.password = str(tree.get_widget('pass_entry').get_text())

        def load_button_clicked(button):
            Utils.dialog_set_busy_cursor(dlg)
            conduit.GLOBALS.syncManager.run_blocking_dataprovider_function_calls(
                self, on_login_finish, self._login)

        tree = Utils.dataprovider_glade_get_widget(__file__, "config.glade",
                                                   "RTMConfigDialog")

        #get a whole bunch of widgets
        load_button = tree.get_widget("load_button")
        dlg = tree.get_widget("RTMConfigDialog")

        # load button
        load_button.connect('clicked', load_button_clicked)

        # run the dialog
        Utils.run_dialog_non_blocking(dlg, on_response, window)
Пример #4
0
    def configure(self, window, name):
        import gtk
        tree = Utils.dataprovider_glade_get_widget(
                        __file__, 
                        "config.glade",
                        "EvolutionConfigDialog"
                        )
        
        #get a whole bunch of widgets
        sourceComboBox = tree.get_widget("sourceComboBox")
        sourceLabel = tree.get_widget("sourceLabel")
        sourceLabel.set_text(_("Select %s:") % name)

        #make a combobox with the addressbooks
        store = gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING)
        sourceComboBox.set_model(store)

        cell = gtk.CellRendererText()
        sourceComboBox.pack_start(cell, True)
        sourceComboBox.add_attribute(cell, 'text', 0)
        sourceComboBox.set_active(0)
        
        for name,uri in self.allSourceURIs:
            rowref = store.append( (name, uri) )
            if uri == self.selectedSourceURI:
                sourceComboBox.set_active_iter(rowref)
        
        dlg = tree.get_widget("EvolutionConfigDialog")
        
        response = Utils.run_dialog (dlg, window)
        if response == True:
            self.selectedSourceURI = store.get_value(sourceComboBox.get_active_iter(), 1)
        dlg.destroy()  
Пример #5
0
    def configure(self, window):
        import gtk
        import gobject
        def on_login_finish(*args):
            if self.fapi.uid:
                build_album_store()
            Utils.dialog_reset_cursor(dlg)
            
        def on_response(sender, responseID):
            if responseID == gtk.RESPONSE_OK:
                self.albumname = albumnamecombo.child.get_text()
                
        def load_button_clicked(button):
            Utils.dialog_set_busy_cursor(dlg)
            conduit.GLOBALS.syncManager.run_blocking_dataprovider_function_calls(
                                            self,
                                            on_login_finish,
                                            self._login)

        def build_album_store():
            album_store.clear()
            album_count = 0
            album_iter = None
            for album_name in self._get_albums().keys():
                iter = album_store.append((album_name,))
                if album_name != "" and album_name == self.albumname:
                    album_iter = iter
                album_count += 1

            if album_iter:
                albumnamecombo.set_active_iter(album_iter)
            elif self.albumname:
                albumnamecombo.child.set_text(self.albumname)
            elif album_count:
                albumnamecombo.set_active(0)

        tree = Utils.dataprovider_glade_get_widget(
                        __file__,
                        "config.glade",
                        "FacebookConfigDialog")

        #get a whole bunch of widgets
        albumnamecombo = tree.get_widget("albumnamecombo")
        load_button = tree.get_widget("load_button")
        dlg = tree.get_widget("FacebookConfigDialog")

        # setup combobox
        album_store = gtk.ListStore(gobject.TYPE_STRING)
        albumnamecombo.set_model(album_store)
        cell = gtk.CellRendererText()
        albumnamecombo.pack_start(cell, True)
        albumnamecombo.set_text_column(0)

        # load button
        load_button.connect('clicked', load_button_clicked)
        albumnamecombo.child.set_text(self.albumname)

        # run the dialog
        Utils.run_dialog_non_blocking(dlg, on_response, window)
Пример #6
0
    def configure(self, window):
        import gobject
        import gtk
        def col1_toggled_cb(cell, path, model ):
            #not because we get this cb before change state
            checked = not cell.get_active()
            model[path][2] = checked
            val = model[path][FILENAME_IDX]
            if checked and val not in self.enabledAlbums:
                self.enabledAlbums.append(val)
            elif not checked and val in self.enabledAlbums:
                self.enabledAlbums.remove(val)

        tree = Utils.dataprovider_glade_get_widget(
                        __file__, 
                        "config.glade",
						"PicasaDesktopConfigDialog"
						)
        tagtreeview = tree.get_widget("albumtreeview")
        #Build a list of all the tags
        list_store = gtk.ListStore( gobject.TYPE_STRING,    #FILENAME_IDX
                                    gobject.TYPE_STRING,    #DISLAYNAME_IDX
                                    gobject.TYPE_BOOLEAN,   #active
                                    )
        #Fill the list store
        for t in self._get_all_albums():
            list_store.append((
                        t[FILENAME_IDX],
                        t[DISPLAYNAME_IDX],
                        t[FILENAME_IDX] in self.enabledAlbums)
                        )
        #Set up the treeview
        tagtreeview.set_model(list_store)
        #column 1 is the album name
        tagtreeview.append_column(  gtk.TreeViewColumn(_("Album Name"), 
                                    gtk.CellRendererText(), 
                                    text=DISPLAYNAME_IDX)
                                    )
        #column 2 is a checkbox for selecting the album to sync
        renderer1 = gtk.CellRendererToggle()
        renderer1.set_property('activatable', True)
        renderer1.connect( 'toggled', col1_toggled_cb, list_store )
        tagtreeview.append_column(  gtk.TreeViewColumn(_("Enabled"), 
                                    renderer1, 
                                    active=2)
                                    )

        dlg = tree.get_widget("PicasaDesktopConfigDialog")
        
        response = Utils.run_dialog (dlg, window)
        dlg.destroy()
        
        print self.enabledAlbums
Пример #7
0
    def configure(self, window):
        import gobject
        import gtk

        def build_album_model(albumCombo):
            self.album_store.clear()
            album_count = 0
            album_iter = None
            for name in self._get_photo_albums():
                iter = self.album_store.append((name,))
                if name == self.albumName:
                    album_iter = iter
                album_count += 1

            if album_iter:
                albumCombo.set_active_iter(album_iter)
            elif self.albumName:
                albumCombo.child.set_text(self.albumName)
            elif album_count:
                albumCombo.set_active(0)

        def delete_click(sender, albumCombo):
            albumName = albumCombo.get_active_text()
            if albumName:
                self._delete_album(albumName)
                build_album_model(albumCombo)

        # get a whole bunch of widgets
        tree = Utils.dataprovider_glade_get_widget(__file__, "config.glade", "PhotoConfigDialog")
        albumCombo = tree.get_widget("album_combobox")
        delete_button = tree.get_widget("delete_button")

        # setup album store
        self.album_store = gtk.ListStore(gobject.TYPE_STRING)
        albumCombo.set_model(self.album_store)
        cell = gtk.CellRendererText()
        albumCombo.pack_start(cell, True)
        albumCombo.set_text_column(0)

        # setup widgets
        build_album_model(albumCombo)
        delete_button.connect("clicked", delete_click, albumCombo)

        # run dialog
        dlg = tree.get_widget("PhotoConfigDialog")
        response = Utils.run_dialog(dlg, window)

        if response == True:
            # get the values from the widgets
            self.albumName = albumCombo.get_active_text()
        dlg.destroy()

        del self.album_store
Пример #8
0
    def configure(self, window):
        import gtk
        import gobject
        def col1_toggled_cb(cell, path, model ):
            #not because we get this cb before change state
            checked = not cell.get_active()
            model[path][CHECK_IDX] = checked
            val = model[path][NAME_IDX]
            if checked and val not in self.playlists:
                self.playlists.append(val)
            elif not checked and val in self.playlists:
                self.playlists.remove(val)

            log.debug("Toggle '%s' to: %s" % (val, checked))
            return

        #FIXME: This should not run here, it should run in initialize() instead
        self.allPlaylists = self._parse_playlists(RhythmboxSource.PLAYLIST_PATH)
        tree = Utils.dataprovider_glade_get_widget(
                        __file__, 
                        "config.glade",
						"RBConfigDialog"
						)
        tagtreeview = tree.get_widget("tagtreeview")
        #Build a list of all the playlists
        list_store = gtk.ListStore( gobject.TYPE_STRING,    #name
                                    gobject.TYPE_BOOLEAN,   #active
                                    )
        #Fill the list store, preselect some playlists
        for p in self.allPlaylists:
            list_store.append( (p[0],p[0] in self.playlists) )
        #Set up the treeview
        tagtreeview.set_model(list_store)
        #column 1 is the tag name
        tagtreeview.append_column(  gtk.TreeViewColumn(_("Tag Name"), 
                                    gtk.CellRendererText(), 
                                    text=NAME_IDX)
                                    )
        #column 2 is a checkbox for selecting the tag to sync
        renderer1 = gtk.CellRendererToggle()
        renderer1.set_property('activatable', True)
        renderer1.connect( 'toggled', col1_toggled_cb, list_store )
        tagtreeview.append_column(  gtk.TreeViewColumn(_("Enabled"), 
                                    renderer1, 
                                    active=CHECK_IDX)
                                    )

        dlg = tree.get_widget("RBConfigDialog")

        response = Utils.run_dialog (dlg, window)
        dlg.destroy()
Пример #9
0
    def configure(self, window):
        import gobject
        import gtk

        def col1_toggled_cb(cell, path, model):
            #not because we get this cb before change state
            checked = not cell.get_active()
            model[path][2] = checked
            val = model[path][FILENAME_IDX]
            if checked and val not in self.enabledAlbums:
                self.enabledAlbums.append(val)
            elif not checked and val in self.enabledAlbums:
                self.enabledAlbums.remove(val)

        tree = Utils.dataprovider_glade_get_widget(
            __file__, "config.glade", "PicasaDesktopConfigDialog")
        tagtreeview = tree.get_widget("albumtreeview")
        #Build a list of all the tags
        list_store = gtk.ListStore(
            gobject.TYPE_STRING,  #FILENAME_IDX
            gobject.TYPE_STRING,  #DISLAYNAME_IDX
            gobject.TYPE_BOOLEAN,  #active
        )
        #Fill the list store
        for t in self._get_all_albums():
            list_store.append(
                (t[FILENAME_IDX], t[DISPLAYNAME_IDX], t[FILENAME_IDX]
                 in self.enabledAlbums))
        #Set up the treeview
        tagtreeview.set_model(list_store)
        #column 1 is the album name
        tagtreeview.append_column(
            gtk.TreeViewColumn(_("Album Name"),
                               gtk.CellRendererText(),
                               text=DISPLAYNAME_IDX))
        #column 2 is a checkbox for selecting the album to sync
        renderer1 = gtk.CellRendererToggle()
        renderer1.set_property('activatable', True)
        renderer1.connect('toggled', col1_toggled_cb, list_store)
        tagtreeview.append_column(
            gtk.TreeViewColumn(_("Enabled"), renderer1, active=2))

        dlg = tree.get_widget("PicasaDesktopConfigDialog")

        response = Utils.run_dialog(dlg, window)
        dlg.destroy()

        print self.enabledAlbums
Пример #10
0
    def configure(self, window):
        import gtk
        import gobject

        def col1_toggled_cb(cell, path, model):
            #not because we get this cb before change state
            checked = not cell.get_active()
            model[path][CHECK_IDX] = checked
            val = model[path][NAME_IDX]
            if checked and val not in self.playlists:
                self.playlists.append(val)
            elif not checked and val in self.playlists:
                self.playlists.remove(val)

            log.debug("Toggle '%s' to: %s" % (val, checked))
            return

        self.allPlaylists = self._get_playlists()
        tree = Utils.dataprovider_glade_get_widget(__file__, "config.glade",
                                                   "RBConfigDialog")
        tagtreeview = tree.get_widget("tagtreeview")
        #Build a list of all the playlists
        list_store = gtk.ListStore(
            gobject.TYPE_STRING,  #name
            gobject.TYPE_BOOLEAN,  #active
        )
        #Fill the list store, preselect some playlists
        for p in self.allPlaylists:
            list_store.append((p, p in self.playlists))
        #Set up the treeview
        tagtreeview.set_model(list_store)
        #column 1 is the tag name
        tagtreeview.append_column(
            gtk.TreeViewColumn(_("Tag Name"),
                               gtk.CellRendererText(),
                               text=NAME_IDX))
        #column 2 is a checkbox for selecting the tag to sync
        renderer1 = gtk.CellRendererToggle()
        renderer1.set_property('activatable', True)
        renderer1.connect('toggled', col1_toggled_cb, list_store)
        tagtreeview.append_column(
            gtk.TreeViewColumn(_("Enabled"), renderer1, active=CHECK_IDX))

        dlg = tree.get_widget("RBConfigDialog")

        response = Utils.run_dialog(dlg, window)
        dlg.destroy()
Пример #11
0
    def __init__(self, mainWindow, db):
        Vfs.FolderScannerThreadManager.__init__(self)
        self.tree = Utils.dataprovider_glade_get_widget(
                        __file__, 
                        "config.glade",
						"FileSourceConfigDialog"
						)
        dic = { "on_addfile_clicked" : self.on_addfile_clicked,
                "on_adddir_clicked" : self.on_adddir_clicked,
                "on_remove_clicked" : self.on_remove_clicked,                
                None : None
                }
        self.tree.signal_autoconnect(dic)
        self.mainWindow = mainWindow
        self.db = db
        self.model = Database.GenericDBListStore("config", self.db)
        
        self._make_view()

        #setup dnd onto the file list
        targets = [ ( "text/uri-list", 0, 0 ) ]
        f = self.tree.get_widget("filesscrolledwindow")
        f.drag_dest_set(
            gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_HIGHLIGHT | gtk.DEST_DEFAULT_DROP,
            targets, 
            gtk.gdk.ACTION_COPY
            )
        f.connect("drag_data_received", self._dnd_data_get)

        self.dlg = self.tree.get_widget("FileSourceConfigDialog")
        #connect to dialog response signal because we want to validate that
        #the user has named all the groups before we let them quit
        self.dlg.connect("response",self.on_response)
        self.dlg.set_transient_for(self.mainWindow)
        self.dlg.show_all()

        #Now go an background scan some folders to populate the UI estimates.
        for oid,uri in self.db.select("SELECT oid,URI FROM config WHERE TYPE=? and SCAN_COMPLETE=?",(FileDataProvider.TYPE_FOLDER,False,)):
            self.make_thread(
                    uri, 
                    False,  #include hidden
                    False,  #follow symlinks
                    self._on_scan_folder_progress, 
                    self._on_scan_folder_completed, 
                    oid
                    )
Пример #12
0
    def configure(self, window):
        """
        Show configuration dialog for this module.

        @param window: The parent window (used for modal dialogs)
        @type window: C{gtk.Window}
        """
        # lazily import gtk so if conduit is run from command line or a non
        # gtk system, this module will still load. There should be no need
        # to use gtk outside of this function
        import gtk

        def on_dialog_response(sender, response_id):
            """
            Response handler for configuration dialog.
            """
            if response_id == gtk.RESPONSE_OK:
                self._set_aws_access_key(access_key_entry.get_text())
                self._set_aws_secret_access_key(
                    secret_access_key_entry.get_text())
                self._set_bucket_name(bucket_name_entry.get_text())
                self._set_use_ssl((True, False)[ssl_combo_box.get_active()])

        tree = Utils.dataprovider_glade_get_widget(__file__,
                                                   "config.glade",
                                                   "AmazonS3ConfigDialog")

        # get widgets
        dialog = tree.get_widget("AmazonS3ConfigDialog")
        access_key_entry = tree.get_widget("accessKey")
        secret_access_key_entry = tree.get_widget("secretAccessKey")
        bucket_name_entry = tree.get_widget("bucketName")
        ssl_combo_box = tree.get_widget("useSsl")

        # set values of widgets
        access_key_entry.set_text(
            (self.aws_access_key, "")[self.aws_access_key == None])
        secret_access_key_entry.set_text((self.aws_secret_access_key, "")
                                         [self.aws_secret_access_key == None])
        bucket_name_entry.set_text(self.bucket_name)
        ssl_combo_box.set_active((1, 0)[self.use_ssl])

        # show dialog
        Utils.run_dialog_non_blocking(dialog, on_dialog_response, window)
Пример #13
0
    def configure(self, window):
        """
        Show configuration dialog for this module.

        @param window: The parent window (used for modal dialogs)
        @type window: C{gtk.Window}
        """
        # lazily import gtk so if conduit is run from command line or a non
        # gtk system, this module will still load. There should be no need
        # to use gtk outside of this function
        import gtk

        def on_dialog_response(sender, response_id):
            """
            Response handler for configuration dialog.
            """
            if response_id == gtk.RESPONSE_OK:
                self._set_aws_access_key(access_key_entry.get_text())
                self._set_aws_secret_access_key(
                    secret_access_key_entry.get_text())
                self._set_bucket_name(bucket_name_entry.get_text())
                self._set_use_ssl((True, False)[ssl_combo_box.get_active()])

        tree = Utils.dataprovider_glade_get_widget(__file__, "config.glade",
                                                   "AmazonS3ConfigDialog")

        # get widgets
        dialog = tree.get_widget("AmazonS3ConfigDialog")
        access_key_entry = tree.get_widget("accessKey")
        secret_access_key_entry = tree.get_widget("secretAccessKey")
        bucket_name_entry = tree.get_widget("bucketName")
        ssl_combo_box = tree.get_widget("useSsl")

        # set values of widgets
        access_key_entry.set_text(
            (self.aws_access_key, "")[self.aws_access_key == None])
        secret_access_key_entry.set_text(
            (self.aws_secret_access_key,
             "")[self.aws_secret_access_key == None])
        bucket_name_entry.set_text(self.bucket_name)
        ssl_combo_box.set_active((1, 0)[self.use_ssl])

        # show dialog
        Utils.run_dialog_non_blocking(dialog, on_dialog_response, window)
Пример #14
0
 def configure(self, window):
     tree = Utils.dataprovider_glade_get_widget(
                     __file__, 
                     "config.glade",
                     "RSSSourceConfigDialog"
                     )
     
     #get a whole bunch of widgets
     url = tree.get_widget("url")
     limitCb = tree.get_widget("limitdownloads")
     limitSb = tree.get_widget("limitnumber")        
     randomize = tree.get_widget("randomize")
     photosCb = tree.get_widget("downloadphotos")
     audioCb = tree.get_widget("downloadaudio")
     videoCb = tree.get_widget("downloadvideo")
     
     #preload the widgets
     if self.limit > 0:
         limitCb.set_active(True)
         limitSb.set_value(self.limit)
     else:
         limitCb.set_active(False)
     url.set_text(self.feedUrl)
     randomize.set_active(self.randomize)
     photosCb.set_active(self.downloadPhotos)
     audioCb.set_active(self.downloadAudio)
     videoCb.set_active(self.downloadVideo)
             
     dlg = tree.get_widget("RSSSourceConfigDialog")
     
     response = Utils.run_dialog (dlg, window)
     if response == True:
         self.feedUrl = url.get_text()
         if limitCb.get_active():
             self.limit = int(limitSb.get_value())
         self.randomize = randomize.get_active()
         self.downloadPhotos = photosCb.get_active()
         self.downloadAudio = audioCb.get_active()
         self.downloadVideo = videoCb.get_active()
         
     dlg.destroy()            
Пример #15
0
    def configure(self, window):
        tree = Utils.dataprovider_glade_get_widget(__file__, "config.glade", "BackpackNotesSinkConfigDialog")

        # get a whole bunch of widgets
        usernameEntry = tree.get_widget("username")
        apikeyEntry = tree.get_widget("apikey")
        pagenameEntry = tree.get_widget("pagename")

        # preload the widgets
        usernameEntry.set_text(self.username)
        apikeyEntry.set_text(self.apikey)
        pagenameEntry.set_text(self.storeInPage)

        dlg = tree.get_widget("BackpackNotesSinkConfigDialog")

        response = Utils.run_dialog(dlg, window)
        if response == True:
            self.username = usernameEntry.get_text()
            self.storeInPage = pagenameEntry.get_text()
            if apikeyEntry.get_text() != self.apikey:
                self.apikey = apikeyEntry.get_text()
        dlg.destroy()
Пример #16
0
    def __init__(self, mainWindow, folder, includeHidden, compareIgnoreMtime, followSymlinks):
        log.debug("Starting new folder chooser at %s" % folder)
        self.folder = folder
        self.includeHidden = includeHidden
        self.compareIgnoreMtime = compareIgnoreMtime
        self.followSymlinks = followSymlinks

        tree = Utils.dataprovider_glade_get_widget(
                        __file__, 
                        "config.glade",
						"FolderTwoWayConfigDialog"
						)
        self.folderChooser = tree.get_widget("filechooserbutton1")
        self.folderChooser.set_current_folder_uri(self.folder)
        self.hiddenCb = tree.get_widget("hidden")
        self.hiddenCb.set_active(includeHidden)
        self.mtimeCb = tree.get_widget("ignoreMtime")
        self.mtimeCb.set_active(self.compareIgnoreMtime)
        self.followSymlinksCb = tree.get_widget("followSymlinks")
        self.followSymlinksCb.set_active(self.followSymlinks)

        self.dlg = tree.get_widget("FolderTwoWayConfigDialog")
        self.dlg.connect("response",self.on_response)
        self.dlg.set_transient_for(mainWindow)
Пример #17
0
    def configure(self, window):
        """
        Configures the RTM Backend
        """
        import gtk
        import gobject
        def on_login_finish(*args):
            Utils.dialog_reset_cursor(dlg)
            
        def on_response(sender, responseID):
            if responseID == gtk.RESPONSE_OK:
                self.username = str(tree.get_widget('user_entry').get_text())
                self.password = str(tree.get_widget('pass_entry').get_text())
                
        def load_button_clicked(button):
            Utils.dialog_set_busy_cursor(dlg)
            conduit.GLOBALS.syncManager.run_blocking_dataprovider_function_calls(
                                            self,
                                            on_login_finish,
                                            self._login)


        tree = Utils.dataprovider_glade_get_widget(
                        __file__,
                        "config.glade",
                        "RTMConfigDialog")

        #get a whole bunch of widgets
        load_button = tree.get_widget("load_button")
        dlg = tree.get_widget("RTMConfigDialog")

        # load button
        load_button.connect('clicked', load_button_clicked)

        # run the dialog
        Utils.run_dialog_non_blocking(dlg, on_response, window)
Пример #18
0
    def configure(self, window):
        import gtk
        def create_tags_clicked_cb(button):
            text = self.tags_entry.get_text()
            if not text:
                return
            tags = text.split(',')
            for tag in tags:
                self._create_tag (tag.strip ())
            refresh_list_store()                

        def col1_toggled_cb(cell, path, model ):
            #not because we get this cb before change state
            checked = not cell.get_active()

            model[path][1] = checked
            val = model[path][NAME_IDX]

            if checked and val not in self.enabledTags:
                self.enabledTags.append(val)
            elif not checked and val in self.enabledTags:
                self.enabledTags.remove(val)

            log.debug("Toggle '%s'(%s) to: %s" % (model[path][NAME_IDX], val, checked))
            return

        def refresh_list_store ():
            #Build a list of all the tags
            if not self.list_store:
                self.list_store = gtk.ListStore(gobject.TYPE_STRING,    #NAME_IDX
                                                gobject.TYPE_BOOLEAN,   #active
                                               )
            else:
                self.list_store.clear ()                
            #Fill the list store
            i = 0
            for tag in self._get_all_tags():
                self.list_store.append((tag,tag in self.enabledTags))
                i += 1

        #Fspot must be running
        if not self._connect_to_fspot():
            return

        tree = Utils.dataprovider_glade_get_widget(
                        __file__, 
                        "config.glade",
						"FspotConfigDialog"
						)
        tagtreeview = tree.get_widget("tagtreeview")
        refresh_list_store()
        tagtreeview.set_model(self.list_store)

        #column 1 is the tag name
        tagtreeview.append_column(  gtk.TreeViewColumn(_("Tag Name"), 
                                    gtk.CellRendererText(), 
                                    text=NAME_IDX)
                                    )
        #column 2 is a checkbox for selecting the tag to sync
        renderer1 = gtk.CellRendererToggle()
        renderer1.set_property('activatable', True)
        renderer1.connect( 'toggled', col1_toggled_cb, self.list_store )
        tagtreeview.append_column(  gtk.TreeViewColumn(_("Enabled"), 
                                    renderer1, 
                                    active=1)
                                    )
  
        # Area for creating additional tags
        create_button = tree.get_widget ('create_button')
        self.tags_entry = tree.get_widget ('tags_entry')
        create_button.connect('clicked', create_tags_clicked_cb)

        dlg = tree.get_widget("FspotConfigDialog")
        dlg.set_transient_for(window)

        response = Utils.run_dialog (dlg, window)
        dlg.destroy()
Пример #19
0
    def configure(self, window):
        """
        Configures the BoxDotNet sink
        """
        import gtk
        import gobject
        def on_login_finish(*args):
            if self.token:
                build_folder_store()
            Utils.dialog_reset_cursor(dlg)
            
        def on_response(sender, responseID):
            if responseID == gtk.RESPONSE_OK:
                self.foldername = foldernamecombo.child.get_text()
                
        def load_button_clicked(button):
            Utils.dialog_set_busy_cursor(dlg)
            conduit.GLOBALS.syncManager.run_blocking_dataprovider_function_calls(
                                            self,
                                            on_login_finish,
                                            self._login)

        def build_folder_store():
            folder_store.clear()
            folder_count = 0
            folder_iter = None
            for folder_name in self._get_folders().keys():
                iter = folder_store.append((folder_name,))
                if folder_name != "" and folder_name == self.foldername:
                    folder_iter = iter
                folder_count += 1

            if folder_iter:
                foldernamecombo.set_active_iter(folder_iter)
            elif self.foldername:
                foldernamecombo.child.set_text(self.foldername)
            elif folder_count:
                foldernamecombo.set_active(0)

        tree = Utils.dataprovider_glade_get_widget(
                        __file__,
                        "config.glade",
                        "BoxDotNetConfigDialog")

        #get a whole bunch of widgets
        foldernamecombo = tree.get_widget("foldernamecombo")
        load_button = tree.get_widget("load_button")
        dlg = tree.get_widget("BoxDotNetConfigDialog")

        # setup combobox
        folder_store = gtk.ListStore(gobject.TYPE_STRING)
        foldernamecombo.set_model(folder_store)
        cell = gtk.CellRendererText()
        foldernamecombo.pack_start(cell, True)
        foldernamecombo.set_text_column(0)

        # load button
        load_button.connect('clicked', load_button_clicked)
        foldernamecombo.child.set_text(self.foldername)

        # run the dialog
        Utils.run_dialog_non_blocking(dlg, on_response, window)
Пример #20
0
    def configure(self, window):
        import gtk
        def col1_toggled_cb(cell, path, model ):
            #not because we get this cb before change state
            checked = not cell.get_active()
            model[path][CHECKED_IDX] = checked
            ( Name, Id, Type ) = ( model[path][NAME_IDX], model[path][ID_IDX], model[path][TYPE_IDX] )
            if Type == NORMAL_PLAYLIST:
                if checked and Name not in self.playlists:
                    self.playlists.append(Id)
                elif not checked and Name in self.playlists:
                    self.playlists.remove(Id)
            elif Type == SMART_PLAYLIST:
                if checked and Name not in self.smart_playlists:
                    self.smart_playlists.append(Id)
                elif not checked and Name in self.smart_playlists:
                    self.smart_playlists.remove(Id)
            elif Type == VIDEO_PLAYLIST:
                if checked and Name not in self.video_playlists:
                    self.video_playlists.append(Id)
                elif not checked and Name in self.video_playlists:
                    self.video_playlists.remove(Id)
            log.debug("Toggle name: '%s', type: '%s', id: '%s' to: %s" % (Name, Type, Id, checked))
            return

        tree = Utils.dataprovider_glade_get_widget(
                        __file__, 
                        "config.glade",
                        "BansheeConfigDialog"
        )
        tagtreeview = tree.get_widget("tagtreeview")
        #Build a list of all the tags
        list_store = gtk.ListStore( gobject.TYPE_STRING,    #ID_IDX      - 0
                                    gobject.TYPE_STRING,    #NAME_IDX    - 1
                                    gobject.TYPE_BOOLEAN,   #CHECKED_IDX - 2
                                    gobject.TYPE_INT,       #TYPE_IDX    - 3
                                    )
        #Fill the list store
        for playlist in self._get_all_playlists():
            if playlist["type"] == NORMAL_PLAYLIST and playlist["id"] in self.playlists:
                checked = True
            elif playlist["type"] == SMART_PLAYLIST and playlist["id"] in self.smart_playlists:
                checked = True
            elif playlist["type"] == VIDEO_PLAYLIST and playlist["id"] in self.video_playlists:
                checked = True
            else:
                checked = False
            # Make video playlists more obvious
            if playlist["type"] == VIDEO_PLAYLIST:
                playlist["name"] += " (Video)"
            list_store.append( ( playlist["id"], playlist["name"], checked, playlist["type"] ) )
                     
        #Set up the treeview
        tagtreeview.set_model(list_store)
        #column 1 is the tag name
        tagtreeview.append_column(  gtk.TreeViewColumn(_("Playlist Name"), # Tag name is confusing?
                                    gtk.CellRendererText(), 
                                    text=NAME_IDX)
                                    )
        #column 2 is a checkbox for selecting the tag to sync
        renderer1 = gtk.CellRendererToggle()
        renderer1.set_property('activatable', True)
        renderer1.connect( 'toggled', col1_toggled_cb, list_store )
        tagtreeview.append_column(  gtk.TreeViewColumn(_("Enabled"), 
                                    renderer1, 
                                    active=CHECKED_IDX)
                                    )

        dlg = tree.get_widget("BansheeConfigDialog")
        
        response = Utils.run_dialog (dlg, window)
        dlg.destroy()