Example #1
0
    def create_dialog(self):
        if not os.path.exists(os.path.join(functions.install_dir(), "plugins", "PVC", "PVC.glade")):
            print ("PVC.glade wasn't found.")
        else:
#            ##gtk.gdk.threads_enter()##
            xml = gtk.glade.XML(os.path.join(functions.install_dir(), "plugins", "PVC", "PVC.glade"))
            self.dialog = xml.get_widget('dialog1')
            self.dialog.set_icon_from_file(os.path.join(functions.install_dir(), "images", "pyjama.png"))
            self.dialog.set_title("Pyjama Version Control")
            self.dialog.connect('delete_event', self.cb_quit)
            self.textview = xml.get_widget('textview1')
            self.buffer = self.textview.get_buffer()
            self.bOK = xml.get_widget('button1')
            self.bOK.connect("clicked", self.cb_button_clicked, "ok")

            self.bUpdate = xml.get_widget('button2')
            self.bUpdate.connect("clicked", self.cb_button_clicked, "update")
            self.bPermissions = xml.get_widget('button3')
            self.bPermissions.connect("clicked", self.cb_button_clicked, "permissions")
#            ##gtk.gdk.threads_leave()##
            self.change_stock_button_text(self.bPermissions, "      Set\npermissions")
            self.change_stock_button_text(self.bUpdate, "Update")

            if self.check_permissions() is not None and not os.access(functions.install_dir(), os.W_OK):
#                ##gtk.gdk.threads_enter()##
                self.bPermissions.show()
#                ##gtk.gdk.threads_leave()##
            else:
#                ##gtk.gdk.threads_enter()##
                self.bPermissions.hide()
#                ##gtk.gdk.threads_leave()##
#            ##gtk.gdk.threads_enter()##
            self.buffer.create_tag("monospace", font="courier")
Example #2
0
    def draw(self, a, b, c, d):
        self.pyjama.window.tvList.clear()
        self.pyjama.window.toolbar.lbMoreAlbumsFromThisArtist2.hide()
        self.pyjama.window.toolbar.lbAppendAlbum.hide()
        self.pyjama.window.TVListFrame.get_label_widget().set_markup("")
        self.table = gtk.HBox(True)
        self.table.set_size_request(800, 400)
        self.table.set_border_width(25)
        self.table.set_spacing(50)

        self.put(self.table, 0, 0)

        self.target_usb = gtk.Button()
        self.img_usb = gtk.Image()
        self.target_cd  = gtk.Button()
        self.img_cd = gtk.Image()

        self.img_usb.set_from_file(os.path.join(functions.install_dir(), "images", "burn_usb.png"))
        self.img_cd.set_from_file(os.path.join(functions.install_dir(), "images", "burn_cd.png"))
        self.target_usb.set_size_request(256,256)
        self.target_cd.set_size_request(256,256)
        self.img_usb.set_size_request(256,256)
        self.img_cd.set_size_request(256,256)

        self.target_usb.connect('clicked', self.cb_target_usb_clicked)
        self.target_cd.connect('clicked', self.cb_target_cd_clicked)

        self.target_usb.set_image(self.img_usb)
        self.target_cd.set_image(self.img_cd)

        self.table.pack_start(self.target_usb)
        self.table.pack_end(self.target_cd)

        self.show_all()
Example #3
0
    def ev_alldone(self):
        # add star buttont to main toolbar
        self.bStar = gtk.ToolButton()
        self.bStar.set_label(_("Stared"))
        self.bStar.set_tooltip_text(_("Show stared Albums"))
#        pos = self.pyjama.window.toolbar.get_item_index(self.pyjama.window.toolbar.bFullScreen)
        self.pyjama.window.toolbar.insert(self.bStar, -1)
        self.pyjama.window.toolbar.set_image(self.bStar, os.path.join(functions.install_dir(), "images", "star.png"))
        self.bStar.connect("clicked", self.ev_show_star_layout)
        self.bStar.show()

        # add star button to album view
        self.ibStarAlbum = ImageButton(os.path.join(functions.install_dir(), "images", "star.png"), 26, 26)#StockButton(gtk.STOCK_STAR, gtk.ICON_SIZE_LARGE_TOOLBAR)
        self.pyjama.layouts.toolbars['album'].pack_start(self.ibStarAlbum, False, True, 2)
        self.ibStarAlbum.set_tooltip_text(_("Star this album"))
        self.ibStarAlbum.set_size_request(40,40)
        self.ibStarAlbum.show()
        self.ibStarAlbum.connect("clicked", self.on_StarAlbum, "tag")

        self.pyjama.layouts.register_layout("star", clStarLayout.StarLayout(self.pyjama))

        # Append menu entry
        menu = self.pyjama.window.menubar
        entry = menu.append_entry(menu.get_rootmenu("Browse"), _("Stared"), "Star")
        entry.connect("activate", self.ev_show_star_layout)
        menu.set_item_image(entry, os.path.join(functions.install_dir(), "images", "star.png"))
        import_star = menu.append_entry(menu.get_rootmenu("Extras"), _("Import Stared Albums"), "ImportStar")
        import_star.connect("activate", self.ev_import_stared_albums)
        menu.set_item_image(import_star, gtk.STOCK_NETWORK) 

        self.accel_group = gtk.AccelGroup()
        entry.add_accelerator("activate", self.accel_group, gtk.keysyms.F7, 0, gtk.ACCEL_VISIBLE)
        self.pyjama.window.add_accel_group(self.accel_group)
Example #4
0
    def show_progress_dialog(self):
        if not os.path.exists(os.path.join(functions.install_dir(), "plugins", "PVC", "progressdialog.glade")):
            print ("progressdialog.glade wasn't found.")
        else:
#            ##gtk.gdk.threads_enter()##
            xml = gtk.glade.XML(os.path.join(functions.install_dir(), "plugins", "PVC", "progressdialog.glade"))
            self.progressdialog = xml.get_widget('dialog1')
            self.progressdialog.set_icon_from_file(os.path.join(functions.install_dir(), "images", "pyjama.png"))
            self.progressdialog.set_title("Downloading Pyjama")
            self.progressbar = xml.get_widget('progressbar1')
            self.progressdialog.show()
            self.pyjama.window.do_events()
Example #5
0
    def ev_alldone(self):
        menu = self.pyjama.window.menubar

#        entry = menu.append_entry(menu.get_rootmenu("Extras"), "---", "jamlists-sep")

        entry = menu.insert_entry(2, menu.get_rootmenu("Extras"), _("Jamendo Playlists"), "jamlists")
        menu.set_item_image(entry, os.path.join(functions.install_dir(), "images", "playlist.png"))

        submenu = gtk.Menu()
        entry.set_submenu(submenu)
        submenu.show()

        ### Top 100
        top100 = gtk.ImageMenuItem(_("This weeks top 100 charts"))
        menu.set_item_image(top100, os.path.join(functions.install_dir(), "plugins", "jamlists", "100.png"))
        top100.connect("activate", self.cb_menuactivate, "top100")
        top100.show()
        submenu.append(top100)

        ### Custom Top
        customtop = gtk.ImageMenuItem(_("Generate custom charts"))
#        menu.set_item_image(customtop, "100.png")
        customtop.connect("activate", self.cb_menuactivate, "customtop")
        customtop.show()
        submenu.append(customtop)

        sep = gtk.SeparatorMenuItem()
        sep.show()
        submenu.append(sep)

        ### Top Playlists
        self.toplists = gtk.ImageMenuItem(_("Best rated Playlists"))
        self.toplists.show()
        submenu.append(self.toplists)

        self.toplists_submenu = gtk.Menu()
        self.toplists_submenu.show()
        self.toplists.set_submenu(self.toplists_submenu)

        ### Playlists powered by Jamendo
        self.jamlists = gtk.ImageMenuItem(_("Official Jamendo Playlists"))
        self.jamlists.show()
        submenu.append(self.jamlists)



        # Get top playlists in a new thread
        thr = Thread(target = self.load_playlists, args = ())
        thr.start()
Example #6
0
    def create_dialog(self):
        gladefile = os.path.join(self.install_dir, "plugins", "downloadGUI", "downloadGUI.glade")
        try:
            self.wTree = gtk.glade.XML(gladefile)  
        except RuntimeError:
            print "Error loading glade file"
            print "tried to load it from: ", gladefile
            raise

        self.dialog = self.wTree.get_widget("dialog1")
        self.dialog.set_size_request(300,177)
        self.bCancel = self.wTree.get_widget("bCancel")
        self.bStart = self.wTree.get_widget("bStart")
        self.bOK = self.wTree.get_widget("bOK")
        self.progressbar = self.wTree.get_widget("progressbar1")

        self.bCancel.show()
        self.progressbar.show()

        self.dialog.set_title("Downloading Database")

        self.dialog.connect('delete_event', self.quit)
        self.bCancel.connect('clicked', self.ev_bCancel_clicked)
        self.bOK.connect('clicked', self.ev_bOK_clicked)
        self.bStart.connect('clicked', self.ev_bStart_clicked)

        self.dialog.set_icon_from_file(os.path.join(functions.install_dir(), "images", "pyjama.png"))
Example #7
0
 def genInfoFile(self):
     # Todo for eyecandy download and add to image:
     #http://api.jamendo.com/get2/image/album/redirect/?id=%s&imagesize=%i" % (album[ALBUM_ID], 100)
     tracklist=[("      %s\n        - Licence: %s\n        - Track page: http://www.jamendo.com/en/track/%s" %
                 (os.path.join(track.artist_name.replace(' ','_'),
                               track.album_name.replace(' ','_'),
                               "%02d_-_%s" % (int(track.numalbum), track.name.replace(' ','_'))),
                  track.license,
                  track.id),
                 track)
                for track in self.tracks]
     tracklist.sort()
     res=[]
     curArtist=0
     curAlbum=0
     for track in tracklist:
         if track[1].artist_id != curArtist:
             res.append("")
             res.append("Artist: %s\n  - Donate: http://www.jamendo.com/en/artist/%s/donate" % (track[1].artist_name,track[1].artist_name.replace(' ','_')))
             curArtist=track[1].artist_id
         if track[1].album_id != curAlbum:
             res.append("")
             res.append("  Album: %s\n    - Page: http://www.jamendo.com/en/album/%s" % (track[1].album_name,track[1].album_id))
             curAlbum=track[1].album_id
         res.append(track[0])
     fname=os.path.join(functions.install_dir(), 'spool', _("contents.txt"))
     infofile=open(fname,'w')
     infofile.write("\n".join(res))
     infofile.close()
     return fname
Example #8
0
    def ev_alldone(self):
        menu = self.pyjama.window.menubar
        entry = menu.append_entry(menu.get_rootmenu("Extras"), _("Get Imagepack"), "imagepack")
        entry.connect("activate", self.start_download)
        menu.set_item_image(entry, os.path.join(functions.install_dir(), "plugins", "imagepack", "package.png"))

        gobject.timeout_add(2000, self.check_download_neccessary)
Example #9
0
    def ev_populate_playlistmenu(self, rootmenu):
        model, tmpIter = self.pyjama.window.tvSelection.get_selected()
        if tmpIter is None: return
        path =  model.get_path(tmpIter)
        track = self.pyjama.player.playlist[path[0]]

        mnu = gtk.ImageMenuItem(_("Rate track"))
        rootmenu.append(mnu)

        try:
            img = gtk.Image()
            pix = gtk.gdk.pixbuf_new_from_file_at_size(os.path.join(functions.install_dir(), "plugins", "rating", "rating.png"), 16, 16)
            img.set_from_pixbuf(pix)
            mnu.set_image(img)
        except:
            print ("Star image not found or corrupt")



        submenu = gtk.Menu()

        for rating in range(5,0,-1):
            tmp = MyMenuItem(rating)
            tmp.connect("activate", self.cb_rating, rating, track)
            submenu.append(tmp)
            tmp.show()

        mnu.set_submenu(submenu)
        submenu.show()
        mnu.show()
Example #10
0
    def ev_populate_playlistmenu(self, rootmenu):
        model, tmpIter = self.pyjama.window.tvSelection.get_selected()
        if tmpIter is None: return
        path =  model.get_path(tmpIter)
        track = self.pyjama.player.playlist[path[0]]

        url = "track/id/track/data/json/%s?tri=lyrics_text" % track.id
        ret = self.pyjama.jamendo.queryold( url, raise_query_event=False )
        if ret is None: 
            txt = ""
            ex = False
        else:    
            txt = ret[0]['lyrics_text']
            if txt is None: txt = ""
            ex = ret[0]['lyrics_exists']

        mnu = gtk.ImageMenuItem(_("Show Lyrics"))
        rootmenu.append(mnu)

        try:
            img = gtk.Image()
            pix = gtk.gdk.pixbuf_new_from_file_at_size(os.path.join(functions.install_dir(), "plugins", "lyrics", "lyrics.png"), 16, 16)
            img.set_from_pixbuf(pix)
            mnu.set_image(img)
        except:
            print ("Image not found or corrupt")

        mnu.show()
        mnu.connect("activate", self.cb_show_lyrics_activate, txt, track.id)
        if len(txt) < 10: mnu.set_sensitive(False)
Example #11
0
    def __init__(self, pyjama, radio_id, name, image, album_image=None):
        self.pyjama = pyjama
        gtk.Frame.__init__(self)

        img = gtk.Image()
        img.show()

        lbl = clWidgets.MyLinkButton(name, name)
        lbl.show()
        self.set_label_widget(lbl)
        self.set_label_align(0.5, 0.5)
        self.set_shadow_type(gtk.SHADOW_ETCHED_OUT)
        self.set_size_request(150,160) #(150,160) before controls

        # Event-Box
        self.eventFrame = gtk.EventBox()
        self.eventFrame.set_above_child(False) # ???
        self.eventFrame.add_events (gtk.gdk.ENTER_NOTIFY_MASK)
        self.eventFrame.add_events (gtk.gdk.LEAVE_NOTIFY_MASK)
#        self.eventFrame.connect("enter-notify-event", self.show_vbControl)
#        self.eventFrame.connect("leave-notify-event", self.hide_vbControl)
#        self.eventFrame.connect("button_release_event", self.image_clicked, radio_id)
        self.eventFrame.show()

        self.eventFrame.add(img)
        self.eventFrame.connect("realize", self.cb_realize)
        self.add(self.eventFrame)

        # Image
        imgs = [image,  "radio", "stock"] #album_image
        for i in imgs:
            if i != "radio" and i != "stock":
                md5hash = hashlib.md5(i).hexdigest()
                imagepath = os.path.join(pyjama.home, "images", md5hash)
                if not os.path.exists(imagepath):
                    try:
                        urllib.urlretrieve(i, imagepath)
                        pb = gtk.gdk.pixbuf_new_from_file_at_size(imagepath, 100, 100)
                        img.set_from_pixbuf(pb)
                        return
                    except:
                        pass
                else:
                    try:
                        pb = gtk.gdk.pixbuf_new_from_file_at_size(imagepath, 100, 100)
                        img.set_from_pixbuf(pb)
                        return
                    except:
                        pass
            if i == "radio":
                try:
                    img.set_from_file(os.path.join(functions.install_dir(), "images", "radio2.png"))
                except:
                    pass
            if i == "sock":
                img.set_from_stock(gtk.STOCK_MISSING_IMAGE, gtk.ICON_SIZE_DIALOG)
Example #12
0
    def __init__(self, pyjama):
        self.pyjama = pyjama
        self.home = functions.preparedirs()

        self.install_dir = functions.install_dir()

        self.pyjama.dump_tools.download_fkt = self.download
        self.pyjama.set_download_database_fkt(self.auto_download)

        self.pyjama.Events.connect_event("dbtools_message", self.ev_message)
        self.pyjama.Events.connect_event("alldone", self.ev_alldone)
Example #13
0
    def ev_alldone(self):
        # Register Layout
        self.__pyjama.layouts.register_layout("artistbrowser", clArtistBrowser.ArtistBrowser(self.__pyjama))

        # Create menu entry:
        menu = self.__pyjama.window.menubar
        entry = menu.append_entry(menu.get_rootmenu("Browse"), _("Artists") + " (experimental)", "artistbrowser")
        entry.connect("activate", self.cb_show_alrtist_browser)
        menu.set_item_image(entry, os.path.join(functions.install_dir(), "images", "star.png"))
#        entry.set_sensitive(False)
        menu.show()
Example #14
0
    def alldone(self):
        self.pyjama.layouts.register_layout("radios", RadioBrowser(self.pyjama))

        #
        # Add menu entry to Extras-menu
        #
        menu = self.pyjama.window.menubar
        entry = menu.append_entry(menu.get_rootmenu("Browse"), _("Radios"), "Radios")
        if not "radios" in sys.argv:
            entry.set_sensitive(False)
        entry.connect("activate", self.ev_show_radio_layout)
        menu.set_item_image(entry, os.path.join(functions.install_dir(), "images", "radio.png"))
Example #15
0
    def draw(self, a, b, c, d):
        self.pyjama.window.tvList.clear()
        self.pyjama.window.toolbar.lbMoreAlbumsFromThisArtist2.hide()
        self.pyjama.window.toolbar.lbAppendAlbum.hide()
        self.pyjama.window.toolbar.Separator2.hide()
        self.table = gtk.HBox(True)
        self.table.set_size_request(700, 350)
        self.table.set_border_width(25)
        self.table.set_spacing(30)

        self.iData = gtk.Image()
        self.iData.set_from_file(os.path.join(functions.install_dir(), "images", "file-mp3-cd.png"))
        #self.iData.set_size_request(256,256)
        self.bData = gtk.Button()
        self.bData.set_image(self.iData)
        #self.bData.set_size_request(256,256)
        self.bData.set_tooltip_text(_("Burn as Data - MP3"))
        self.bData.connect("clicked", self.on_bData_activated)
        #self.bData.connect("button_press_event", self.on_bData_activated)
        self.table.pack_start(self.bData)

        self.iAudio = gtk.Image()
        self.iAudio.set_from_file(os.path.join(functions.install_dir(), "images", "file-audio-cd.png"))
        #self.iAudio.set_size_request(256,256)
        self.bAudio  = gtk.Button()
        self.bAudio.set_image(self.iAudio)
        #self.bAudio.set_size_request(256,256)
        self.bAudio.set_tooltip_text(_("Burn as Audio"))
        self.bAudio.connect("clicked", self.on_bAudio_activated)
        #self.bAudio.connect("button_press_event", self.on_bAudio_activated)
        self.table.pack_end(self.bAudio)

        #self.lWarning = gtk.Label()
        #self.lWarning.set_markup(_("<b>Rock'n'Roll overload</b>\nToo many tracks on playlist, please remove some to continue burning."))
       #self.table.pack_end(self.lWarning, True, True, 0)

        self.put(self.table, 0, 0)
        self.show_all()

        self.cb_playlist_changed(0,0,0)
Example #16
0
    def ev_populate_listmenu(self, rootmenu):
        selection = self.pyjama.window.tvList.get_selection()
        model, tmpIter = selection.get_selected()
        if tmpIter is None:
            return

        path = model.get_path(tmpIter)
        ret = self.pyjama.window.tvList.get_item(path)
        track = Track()
        track.id = ret[self.pyjama.window.tvList.COLUMN_TRACKID]
        if track.id < 0:
            return

        mnu = gtk.ImageMenuItem("Add track to playlist")
        rootmenu.append(mnu)

        try:
            img = gtk.Image()
            pix = gtk.gdk.pixbuf_new_from_file_at_size(
                os.path.join(functions.install_dir(), "images", "playlist.png"), 16, 16
            )
            img.set_from_pixbuf(pix)
            mnu.set_image(img)
        except:
            print ("Playlist image not found or corrupt")

        submenu = gtk.Menu()
        addnew = gtk.ImageMenuItem("Create new playlist")
        addnew.connect("activate", self.cb_addnew_playlist_activate, track)
        img = gtk.Image()
        img.set_from_stock(gtk.STOCK_ADD, gtk.ICON_SIZE_MENU)
        addnew.set_image(img)
        addnew.show()
        submenu.append(addnew)
        sep = gtk.SeparatorMenuItem()
        sep.show()
        submenu.append(sep)

        #        if self.pyjama.settings.section_exists("Playlists"):
        #            playlists = self.pyjama.settings.config.items("Playlists")
        sql = "SELECT option, value FROM settings WHERE section='playlists'"
        playlists = self.pyjama.settingsdb.query(sql)
        if playlists:
            for name, ids in playlists:
                tmp = gtk.ImageMenuItem(name.replace("_", "__"))
                tmp.connect("activate", self.cb_append_to_playlist, name, track)
                submenu.append(tmp)
                tmp.show()

        mnu.set_submenu(submenu)
        submenu.show()
        mnu.show()
Example #17
0
    def __init__(self, rating):
        gtk.MenuItem.__init__(self)

#        # get and remove label
#        lbl = self.get_children()[0]
#        self.remove(lbl)

        img = gtk.Image()
        pix = gtk.gdk.pixbuf_new_from_file_at_size(os.path.join(functions.install_dir(), "plugins", "rating", "star%s.png" % rating), 16*rating, 16)
        img.set_from_pixbuf(pix)
        img.show()
        self.add(img)
        self.show_all()
Example #18
0
 def burn(self):
     if self.format=='AUDIO':
         tracks=[x.local[7:] for x in self.tracks]
     else:
         tracks=["%s.mp3=%s" %
                 (os.path.join(track.artist_name.replace(' ','_'),
                               track.album_name.replace(' ','_'),
                               "%02d_-_%s" % (int(track.numalbum), track.name.replace(' ','_'))),
                  track.local[7:])
                 for track in self.tracks]
         tracks.append(os.path.join(functions.install_dir(),'burnstation.txt'))
         tracks.append(self.genInfoFile())
     self.burner.BurnCD(tracks, self.format)
Example #19
0
    def draw(self, lyrics, track_id, *args):
        track = self.pyjama.db.get_trackinfos2(track_id)
 #       markup = self.pyjama.window.markuplbCaption.replace("TEXT", _("Showing Lyrics of '%s' by %s" % (track.name, track.artist_name)))
        txt = _("Showing Lyrics of '%s' by %s" % (track.name, track.artist_name))
#        self.pyjama.window.lbCaption.set_markup(markup)
        self.pyjama.window.LayoutInfo.set_text(txt)
        self.pyjama.window.LayoutInfo.set_image(os.path.join(functions.install_dir(), "plugins", "lyrics", "lyrics.png"))
        self.show()

#        self.buffer.set_text(lyrics)
        self.lbl.set_text(lyrics)
        n = lyrics.count("\n")
        self.set_size(700, 300+10*n)
Example #20
0
 def ev_showing_album_page(self, albuminfos):
     albumid = str(albuminfos['id'])
     stared = self.pyjama.settings.get_value("STAR PLUGIN", "STARED ALBUMS", "")
     if albumid in stared:
         # show remove button
         self.ibStarAlbum.set_tooltip_text(_("Un-star this album"))
         self.ibStarAlbum.setstock(gtk.STOCK_REMOVE, gtk.ICON_SIZE_LARGE_TOOLBAR)
     else:
         # show add button
         self.ibStarAlbum.set_tooltip_text(_("Star this album"))
         self.ibStarAlbum.setimage(os.path.join(functions.install_dir(), "images", "star.png"), 26, 26)
     # Set id as tag to read out later
     self.ibStarAlbum.tag = albumid
Example #21
0
    def create_download_dialog(self):
        ##gtk.gdk.threads_enter()##
        gladefile = os.path.join(functions.install_dir(), "plugins", "imagepack", "imagepack.glade")
        try:
            self.wTree = gtk.glade.XML(gladefile)  
        except RuntimeError:
            self.pyjama.Events.raise_event("error", None, "Could not load necessary glade file: %s" % gladefile)
            ##gtk.gdk.threads_leave()##
            return

        self.dialog = self.wTree.get_widget("dialog1")
        self.dialog.set_size_request(300,200)
        self.bCancel = self.wTree.get_widget("bClose")
        self.bOK = self.wTree.get_widget("bOK")
        self.label = self.wTree.get_widget("label1")
        self.progressbar = self.wTree.get_widget("progressbar1")

        self.dialog.connect('delete_event', self.cb_quit)
        self.bCancel.connect('clicked', self.cb_button_clicked)
        self.bOK.connect('clicked', self.cb_button_clicked)

        self.bOK.set_sensitive(True)
        self.dialog.set_title("Downloading Imagepack")
        self.dialog.set_icon_from_file(os.path.join(functions.install_dir(), "images", "pyjama.png"))
Example #22
0
    def ev_alldone(self):
        menubar = self.pyjama.window.menubar

        entry = menubar.insert_entry(4, menubar.get_rootmenu("Extras"), _("Favorite Tracks"), "Favorite Tracks")
        menubar.set_item_image(entry, os.path.join(functions.install_dir(), "images", "star.png"))
#        entry.connect("enter-notify-event", self.cb_enter_notify_event)

        self.submenu = gtk.Menu()
        self.submenu.show()

        entry.set_submenu(self.submenu)

        menubar.append_entry(menubar.get_rootmenu("Extras"), "---", "favtracks_sep")

        self.load_data()
Example #23
0
        def __init__(self, pyjama):
            gtk.HBox.__init__(self)
            self.pyjama = pyjama
            self.layout = self.pyjama.layouts.layouts['album']

            # ADD ALBUM TO PLAYLIST
            self.lbAppendAlbum = clWidgets.StockButton(gtk.STOCK_ADD, gtk.ICON_SIZE_DND)
            self.lbAppendAlbum.set_tooltip_text(_("Append this album on playlist"))
            self.lbAppendAlbum.show()
            self.pack_start(self.lbAppendAlbum, False, True, 2)
            self.lbAppendAlbum.connect("clicked", self.on_lbAppendAlbum_clicked)
            # GET MORE ALBUMS FROM THIS PLAYLIST
            self.lbMoreAlbumsFromThisArtist2 = clWidgets.ImageButton(os.path.join(functions.install_dir(), "images", "personal.png"), gtk.ICON_SIZE_DND )
            self.pack_start(self.lbMoreAlbumsFromThisArtist2, False, True, 2)
            self.lbMoreAlbumsFromThisArtist2.connect("clicked", self.on_lbMoreAlbumsFromThisArtist_clicked)
            self.lbMoreAlbumsFromThisArtist2.show()
Example #24
0
    def ev_alldone(self):
        if self.pyjama.xmlrpc.role == "client":
            self.pyjama.Events.raise_event("error", None, "Another instance of pyjama is running - won't start spread-torrent")
            return

        ## If the previous session wasn't closed regulary,
        # this will write its stats to config file
        self.write_total_session_transfer()

        menu = self.pyjama.window.menubar
        entry = menu.append_entry(menu.get_rootmenu("Extras"), _("Spread Torrents"), "potato")
        entry.connect("activate", self.show_window)
        menu.set_item_image(entry, os.path.join(functions.install_dir(), "plugins", "spread-torrent", "spread-torrent.png"))

        gobject.timeout_add(3000, self.start_threads)
        gobject.timeout_add(60000, self.timeout_60_seconds)
        gobject.timeout_add(60000*5, self.save_fast_resume)
Example #25
0
    def new_browser(self):
        import functions

        curdir = os.path.abspath(os.path.curdir)
        curdir = os.path.join(curdir, "plugins")
        self.gladefile = os.path.join(functions.install_dir(), "plugins", "mozplug", "mozplug.glade")
        try:
            self.wTree = gtk.glade.XML(self.gladefile)
        except RuntimeError:
            print "Error loading glade file"
            print "tried to load it from: ", self.gladefile
        window = self.wTree.get_widget("window1")
        fixed = self.wTree.get_widget("fixed1")

        window.show_all()
        browser = gtkmozembed.MozEmbed()
        fixed.put(browser, 0, 0)
        return browser
Example #26
0
 def ev_albuminfo_created(self, albuminfo):
     albumid = str(albuminfo.album['album_id'])
     stared = self.pyjama.settings.get_value("STAR PLUGIN", "STARED ALBUMS", "")
     if albumid in stared:
         # add remove button to albuminfo
         bControlStar = StockButton(gtk.STOCK_REMOVE, gtk.ICON_SIZE_MENU)
         bControlStar.set_tooltip_text(_("Un-star this album"))
         #~ albuminfo.vbControl.pack_start(bControlStar, False, True, 10)
         bControlStar.connect("clicked", self.on_StarAlbum, albumid)
     else:
         # Add Star to albuminfo
         bControlStar = ImageButton(os.path.join(functions.install_dir(), "images", "star.png"), 16, 16)
         bControlStar.set_tooltip_text(_("Star this album"))
         #~ albuminfo.vbControl.pack_start(bControlStar, False, True, 10)
         bControlStar.connect("clicked", self.on_StarAlbum , albumid)
     albuminfo.layout.put(bControlStar, 0,0)
     albuminfo.widgets_list.append(bControlStar)
     #~ bControlStar.show()
     albuminfo.star = bControlStar
Example #27
0
    def ev_playlist_tooltip(self, x, y, tooltip_boxes):
        vbox1, vbox2 = tooltip_boxes
        path = self.pyjama.window.tvPlaylist.get_path_at_pos(int(x), int(y))

        if path:
            track = self.pyjama.player.playlist[path[0][0]]

            rating = self.pyjama.settingsdb.get_value("rating_track", track.id, None)
            if rating is not None:
                label = gtk.Label()
                label.set_markup(_("<i>Rating:</i>"))
#                label.set_justify(gtk.JUSTIFY_LEFT)
                label.show()
                vbox1.pack_start(label, False, True)

                pix = gtk.gdk.pixbuf_new_from_file_at_size(os.path.join(functions.install_dir(), "plugins", "rating", "star%s.png" % rating), 16*rating, 16)

                img = gtk.Image()
                img.set_from_pixbuf(pix)
                img.show()
                vbox2.pack_start(img, False, True)
Example #28
0
    def __init__(self, rating, track):
        gtk.MenuItem.__init__(self)

        hbox= gtk.HBox()
        hbox.show()

        lbl = gtk.Label()
        lbl.set_text("%s: %s" % (track.artist_name,track.name))
        lbl.show()

        img = gtk.Image()
        pix = gtk.gdk.pixbuf_new_from_file_at_size(os.path.join(functions.install_dir(), "plugins", "rating", "star%s.png" % rating), 16*rating, 16)
        img.set_from_pixbuf(pix)
        img.show()


        hbox.pack_start(img, False, True)
        hbox.pack_start(lbl, False, True)

        self.add(hbox)
        self.show_all()
Example #29
0
    def start_download(self, widget=None):
        self.pyjama.need_attention = True
        ##gtk.gdk.threads_enter()##
        dia = gtk.Dialog()
        dia.set_icon_from_file(os.path.join(functions.install_dir(), "images", "pyjama.png"))
        dia.set_title("Download an imagepack?")
        hbox = gtk.HBox()
        dia.vbox.pack_start(hbox, True, True, 10)

        img = gtk.Image()
        img.set_from_stock(gtk.STOCK_DIALOG_QUESTION, gtk.ICON_SIZE_DIALOG)
        hbox.pack_start(img, False, False)

        lbl = gtk.Label()
        lbl.set_markup("Usually pyjama downloads any images one by one from jamendo when it's needed. This makes browsing very slow if many images weren't cached before.\nDo you want do download an imagepack which makes browsing faster for you?\n\n\n<b>Smart = 600 frequently used images- 1 MB in size</b>.\nLarge = 20.000 images - 70 MB to download, 100 MB on disc.")
        lbl.set_single_line_mode(False)
        lbl.set_line_wrap(True)
        hbox.pack_start(lbl, False, True, 10)

        dia.add_button(gtk.STOCK_CANCEL, -3)
        dia.add_button("Large", -2)
        dia.add_button("Smart [recommended]", -1)

        dia.show_all()
        dia.present()
        ret = dia.run()
        gtk.gdk.threads_leave()##
        dia.destroy()

        if ret == -1:
            imagepack = "smart"
        elif ret == -2:
            imagepack = "large"
        elif ret <= -3:
            return

#        thr = Thread(target = self.__start_download, args = (imagepack,))
#        thr.start()
        self.__start_download(imagepack)
Example #30
0
    def ev_playlist_tooltip(self, x, y, tooltip_boxes):
        vbox1, vbox2 = tooltip_boxes
        path = self.pyjama.window.tvPlaylist.get_path_at_pos(int(x), int(y))

        if path:
            track = self.pyjama.player.playlist[path[0][0]]

#            label_desc = gtk.Label()
#            label_desc.set_markup(_("<u>Listen\nstats:</u>"))
#            label_desc.show()
            img = gtk.Image()
            pix = gtk.gdk.pixbuf_new_from_file_at_size(os.path.join(functions.install_dir(), "plugins", "listenstats", "listenstats.png"), 25, 25)
            img.set_from_pixbuf(pix)
            img.show()
            vbox1.pack_start(img, False, True)

            trackcount = self.pyjama.settingsdb.get_value("listenstats_tracks", track.id, 0)
            artistcount = self.pyjama.settingsdb.get_value("listenstats_artists", track.artist_id, 0)
            albumcount = self.pyjama.settingsdb.get_value("listenstats_albums", track.album_id, 0)
            label = gtk.Label()
            label.set_markup(_("Artist: %i\nAlbum: %i\nTrack: %i" % (artistcount, albumcount, trackcount)))
            label.show()
            vbox2.pack_start(label, False, True)