rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
if self.browser.wd != "/": self.browse(None, self.browserdata.get_value(self.browserdata.get_iter((1,)), 1)) | if self.browser.is_focus(): if self.browser.wd != "/": self.browse(None, self.browserdata.get_value(self.browserdata.get_iter((1,)), 1)) return | def parent_dir(self, action): if self.notebook.get_current_page() == 1: if self.browser.wd != "/": self.browse(None, self.browserdata.get_value(self.browserdata.get_iter((1,)), 1)) |
self.browserdata.append(['sonata', item.file, escape_html(name)]) | try: self.browserdata.append(['sonata', item.file, escape_html(item.artist + ' - ' + item.title)]) except: self.browserdata.append(['sonata', item.file, escape_html(name)]) | def browse(self, widget=None, root='/'): if not self.conn: return |
def withdraw_app_on_escape(self, action): if self.minimize_to_systray: self.widthdraw_app() | def withdraw_app_on_escape(self, action): if self.minimize_to_systray: self.widthdraw_app() | |
if self.notebook.get_current_page() == 0: | page_num = self.notebook.get_current_page() if page_num == 0: | def remove(self, widget): if self.notebook.get_current_page() == 0: model, selected = self.current.get_selection().get_selected_rows() iters = [model.get_iter(path) for path in selected] for iter in iters: self.conn.do.deleteid(self.currentdata.get_value(iter, 0)) else: model, selected = self.playlists.get_selection().... |
else: | elif page_num == 2: | def remove(self, widget): if self.notebook.get_current_page() == 0: model, selected = self.current.get_selection().get_selected_rows() iters = [model.get_iter(path) for path in selected] for iter in iters: self.conn.do.deleteid(self.currentdata.get_value(iter, 0)) else: model, selected = self.playlists.get_selection().... |
table2.attach(display_lyrics, 1, 3, 5, 6, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0) table2.attach(display_volume, 1, 3, 6, 7, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0) table2.attach(gtk.Label(), 1, 3, 7, 8, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 15, 0) | table2.attach(display_search, 1, 3, 5, 6, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0) table2.attach(display_lyrics, 1, 3, 6, 7, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0) table2.attach(display_volume, 1, 3, 7, 8, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0) | def prefs(self, widget, show_mpd_tab=False): prefswindow = gtk.Dialog(_("Preferences"), self.window, flags=gtk.DIALOG_DESTROY_WITH_PARENT) prefswindow.set_resizable(False) prefswindow.set_has_separator(False) hbox = gtk.HBox() prefsnotebook = gtk.Notebook() # MPD tab table = gtk.Table(9, 2, False) #table.set_row_spacin... |
self.currentdata.connect('row-changed', self.current_changed) | def __init__(self): | |
self.total_time = self.total_time + int(track.time) | try: self.total_time = self.total_time + int(track.time) except: pass | def update_playlist(self): if self.conn: self.songs = self.conn.do.playlistinfo() self.total_time = 0 self.current.freeze_child_notify() self.currentdata.clear() for track in self.songs: item = self.parse_formatting(self.currentformat, track, True) # Check if the item is one of the user's streams; if so, # we want to d... |
info_file.write('Time: ' + self.songinfo.time + '\n') | try: info_file.write('Time: ' + self.songinfo.time + '\n') except: info_file.write('Time: 0\n') | def update_infofile(self): if self.use_infofile is True: try: info_file = open(self.infofile_path, 'w') |
def current_changed(self, treemodel, path, iter): pass | def on_drag_drop(self, treeview, drag_context, x, y, selection, info, timestamp): model = treeview.get_model() foobar, self._selected = self.current_selection.get_selected_rows() data = pickle.loads(selection.data) drop_info = treeview.get_dest_row_at_pos(x, y) | |
searchby = self.search_terms[self.searchcombo.get_active()] | searchby = self.search_terms_mpd[self.searchcombo.get_active()] | def search(self, entry): searchby = self.search_terms[self.searchcombo.get_active()] if self.searchtext.get_text() != "": list = self.conn.do.search(searchby, self.searchtext.get_text()) self.browserdata.clear() for item in list: if item.type == 'directory': name = item.directory.split('/')[-1] self.browserdata.append(... |
self.stop_art_update = False self.updating_art = False | def __init__(self): | |
self.downloading_art = False | def __init__(self): | |
if self.downloading_art: return | def update_album_art(self): if self.downloading_art: return self.stop_art_update = True while self.updating_art: gtk.main_iteration() thread = threading.Thread(target=self.update_album_art2) thread.start() | |
while self.updating_art: gtk.main_iteration() | def update_album_art(self): if self.downloading_art: return self.stop_art_update = True while self.updating_art: gtk.main_iteration() thread = threading.Thread(target=self.update_album_art2) thread.start() | |
self.updating_art = False | def update_album_art2(self): self.stop_art_update = False if not self.show_covers: self.updating_art = False return self.updating_art = True if self.conn and self.status and self.status.state in ['play', 'pause']: artist = getattr(self.songinfo, 'artist', None) if not artist: artist = "" album = getattr(self.songinfo, ... | |
self.updating_art = True | def update_album_art2(self): self.stop_art_update = False if not self.show_covers: self.updating_art = False return self.updating_art = True if self.conn and self.status and self.status.state in ['play', 'pause']: artist = getattr(self.songinfo, 'artist', None) if not artist: artist = "" album = getattr(self.songinfo, ... | |
gtk.gdk.threads_leave() | def update_album_art2(self): self.stop_art_update = False if not self.show_covers: self.updating_art = False return self.updating_art = True if self.conn and self.status and self.status.state in ['play', 'pause']: artist = getattr(self.songinfo, 'artist', None) if not artist: artist = "" album = getattr(self.songinfo, ... | |
gc.collect() self.updating_art = False self.stop_art_update = False def set_image_for_cover(self, filename): gtk.gdk.threads_enter() pix = gtk.gdk.pixbuf_new_from_file(filename) pix = pix.scale_simple(75, 75, gtk.gdk.INTERP_HYPER) if self.stop_art_update: gtk.gdk.threads_leave() self.stop_art_update = False self.updat... | self.lastalbumart = filename del pix def filename_is_for_current_song(self, filename): if self.conn and self.status and self.status.state in ['play', 'pause']: artist = getattr(self.songinfo, 'artist', None) if not artist: artist = "" album = getattr(self.songinfo, 'album', None) if not album: album = "" currfilena... | def update_album_art2(self): self.stop_art_update = False if not self.show_covers: self.updating_art = False return self.updating_art = True if self.conn and self.status and self.status.state in ['play', 'pause']: artist = getattr(self.songinfo, 'artist', None) if not artist: artist = "" album = getattr(self.songinfo, ... |
if self.downloading_art: return self.downloading_art = True | def download_image_to_filename(self, artist, album, dest_filename, all_images=False): if len(artist) == 0 and len(album) == 0: return try: if self.downloading_art: return self.downloading_art = True artist = urllib.quote(artist) album = urllib.quote(album) amazon_key = "12DR2PGAQT303YTEWP02" search_url = "http://webser... | |
if self.stop_art_update: self.downloading_art = False return | def download_image_to_filename(self, artist, album, dest_filename, all_images=False): if len(artist) == 0 and len(album) == 0: return try: if self.downloading_art: return self.downloading_art = True artist = urllib.quote(artist) album = urllib.quote(album) amazon_key = "12DR2PGAQT303YTEWP02" search_url = "http://webser... | |
self.downloading_art = False | def download_image_to_filename(self, artist, album, dest_filename, all_images=False): if len(artist) == 0 and len(album) == 0: return try: if self.downloading_art: return self.downloading_art = True artist = urllib.quote(artist) album = urllib.quote(album) amazon_key = "12DR2PGAQT303YTEWP02" search_url = "http://webser... | |
self.stop_art_update = True while self.updating_art: gtk.main_iteration() | def choose_image(self, widget): self.stop_art_update = True while self.updating_art: gtk.main_iteration() self.change_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) choose_dialog = gtk.Dialog(_("Choose Cover Art"), self.window, gtk.DIALOG_MODAL, (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT)) choosebutton = choose_dialog.add_button(_(... | |
self.stop_art_update = False | def choose_image(self, widget): self.stop_art_update = True while self.updating_art: gtk.main_iteration() self.change_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) choose_dialog = gtk.Dialog(_("Choose Cover Art"), self.window, gtk.DIALOG_MODAL, (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT)) choosebutton = choose_dialog.add_button(_(... | |
artist = getattr(self.songinfo, 'artist', None) if not artist: artist = "" album = getattr(self.songinfo, 'album', None) if not album: album = "" | artist = getattr(self.songinfo, 'artist', "") artist = artist.replace("/", "") album = getattr(self.songinfo, 'album', "") album = album.replace("/", "") | def update_album_art2(self): self.stop_art_update = False if not self.show_covers: return if self.conn and self.status and self.status.state in ['play', 'pause']: artist = getattr(self.songinfo, 'artist', None) if not artist: artist = "" album = getattr(self.songinfo, 'album', None) if not album: album = "" try: filena... |
artist = getattr(self.songinfo, 'artist', None) if not artist: artist = "" album = getattr(self.songinfo, 'album', None) if not album: album = "" | artist = getattr(self.songinfo, 'artist', "") artist = artist.replace("/", "") album = getattr(self.songinfo, 'album', "") album = album.replace("/", "") | def filename_is_for_current_song(self, filename): # Since there can be multiple threads that are getting album art, # this will ensure that only the artwork for the currently playing # song is displayed if self.conn and self.status and self.status.state in ['play', 'pause']: artist = getattr(self.songinfo, 'artist', No... |
if hostentry.get_text() != self.host or portentry.get_text() != self.port or passwordentry.get_text() != self.password: | self.stop_on_exit = exit_stop.get_active() self.ontop = win_ontop.get_active() self.sticky = win_sticky.get_active() self.minimize_to_systray = minimize.get_active() if self.ontop: self.window.set_keep_above(True) else: self.window.set_keep_above(False) if self.sticky: self.window.stick() else: self.window.unstick() if... | def prefs(self, widget, show_mpd_tab=False): prefswindow = gtk.Dialog(_("Preferences"), self.window, flags=gtk.DIALOG_DESTROY_WITH_PARENT) prefswindow.set_resizable(False) prefswindow.set_has_separator(False) hbox = gtk.HBox() prefsnotebook = gtk.Notebook() # MPD tab table = gtk.Table(9, 2, False) #table.set_row_spacin... |
self.stop_on_exit = exit_stop.get_active() self.ontop = win_ontop.get_active() self.sticky = win_sticky.get_active() self.minimize_to_systray = minimize.get_active() if self.ontop: self.window.set_keep_above(True) else: self.window.set_keep_above(False) if self.sticky: self.window.stick() else: self.window.unstick() | def prefs(self, widget, show_mpd_tab=False): prefswindow = gtk.Dialog(_("Preferences"), self.window, flags=gtk.DIALOG_DESTROY_WITH_PARENT) prefswindow.set_resizable(False) prefswindow.set_has_separator(False) hbox = gtk.HBox() prefsnotebook = gtk.Notebook() # MPD tab table = gtk.Table(9, 2, False) #table.set_row_spacin... | |
('parentdirkey', None, 'Parent Dir Key', 'BackSpace', None, self.parent_dir) | ('parentdirkey', None, 'Parent Dir Key', 'BackSpace', None, self.parent_dir), ('hidewinkey', None, 'Hide Window Key', 'Escape', None, self.withdraw_app) | def __init__(self): |
if self.show_covers: self.traytips.set_size_request(350, -1) else: self.traytips.set_size_request(250, -1) | def update_cursong(self): if self.conn and self.status and self.status.state in ['play', 'pause']: # We must show the trayprogressbar and trayalbumeventbox # before changing self.cursonglabel (and consequently calling # self.labelnotify()) in order to ensure that the notification # popup will have the correct height wh... | |
self.traytips.set_size_request(-1, -1) | def update_cursong(self): if self.conn and self.status and self.status.state in ['play', 'pause']: # We must show the trayprogressbar and trayalbumeventbox # before changing self.cursonglabel (and consequently calling # self.labelnotify()) in order to ensure that the notification # popup will have the correct height wh... | |
if os.path.exists(self.musicdir + model.get_value(model.get_iter(path), 1)): files.append(self.musicdir + model.get_value(model.get_iter(path), 1)) temp_mpdpaths.append(model.get_value(model.get_iter(path), 1)) | if model.get_value(model.get_iter(path), 2) != ".." and model.get_value(model.get_iter(path), 2) != "/": if os.path.isdir(self.musicdir + model.get_value(model.get_iter(path), 1)): if self.conn: for item in self.conn.do.listall(model.get_value(model.get_iter(path), 1)): if item.type == 'file': files.append(self.music... | def edit_tags(self, widget): if not os.path.isdir(self.musicdir): error_dialog = gtk.MessageDialog(self.window, gtk.DIALOG_MODAL, gtk.MESSAGE_WARNING, gtk.BUTTONS_CLOSE, _("The path") + " " + self.musicdir + " " + _("does not exist. Please specify a valid music directory in preferences.")) error_dialog.set_title(_("Edi... |
except: gettext.install('sonata', '/usr/local/share/locale', unicode=1) | def __init__(self, window=None, sugar=False): | |
elif os.path.exists(os.path.join(__file__.split('/lib')[0]+'/', 'share', 'pixmaps', filename)): full_filename = os.path.join(__file__.split('/lib')[0]+'/', 'share', 'pixmaps', filename) | elif os.path.exists(os.path.join(__file__.split('/lib')[0], 'share', 'pixmaps', filename)): full_filename = os.path.join(__file__.split('/lib')[0], 'share', 'pixmaps', filename) | def find_path(self, filename): if os.path.exists(os.path.join(sys.prefix, 'share', 'pixmaps', filename)): full_filename = os.path.join(sys.prefix, 'share', 'pixmaps', filename) elif os.path.exists(os.path.join(os.path.split(__file__)[0], filename)): full_filename = os.path.join(os.path.split(__file__)[0], filename) eli... |
self.searchcombo.append_text(_('Artist')) self.searchcombo.append_text(_('Title')) self.searchcombo.append_text(_('Album')) self.searchcombo.append_text(_('Genre')) self.searchcombo.append_text(_('Filename')) | for item in self.search_terms: self.searchcombo.append_text(item) | def __init__(self): |
searchby = self.searchcombo.get_active_text().lower() | searchby = self.search_terms[self.searchcombo.get_active()] | def search(self, entry): searchby = self.searchcombo.get_active_text().lower() if self.searchtext.get_text() != "": list = self.conn.do.search(searchby, self.searchtext.get_text()) self.browserdata.clear() for item in list: if item.type == 'directory': name = item.directory.split('/')[-1] self.browserdata.append([gtk.S... |
self.about_dialog.set_translator_credits('fr - Floreal M <florealm@gmail.com>\nes - Isidro Arribas <cdhotfire@gmail.com>\npl - Tomasz Dominikowski <dominikowski@gmail.com>\nde - Paul Johnson <thrillerator@googlemail.com>') | self.about_dialog.set_translator_credits('fr - Floreal M <florealm@gmail.com>\npl - Tomasz Dominikowski <dominikowski@gmail.com>\nde - Paul Johnson <thrillerator@googlemail.com>') | def about(self, action): self.about_dialog = gtk.AboutDialog() try: self.about_dialog.set_transient_for(self.window) self.about_dialog.set_modal(True) except: pass self.about_dialog.set_name('Sonata') self.about_dialog.set_version(__version__) self.about_dialog.set_comments(_('A lightweight music player for MPD.')) sel... |
infofilebox.pack_start(infofile_usage, False, False, 3) infofilebox.pack_start(infopath_options, True, True, 3) | infofilebox.pack_start(infofile_usage, False, False, 0) infofilebox.pack_start(infopath_options, True, True, 5) | def prefs(self, widget): prefswindow = gtk.Dialog(_("Preferences"), self.window, flags=gtk.DIALOG_DESTROY_WITH_PARENT) prefswindow.set_resizable(False) prefswindow.set_has_separator(False) hbox = gtk.HBox() prefsnotebook = gtk.Notebook() # MPD tab table = gtk.Table(9, 2, False) table.set_col_spacings(3) mpdlabel = gtk.... |
print " -s, --status " + _("Display current song info") | print " -i, --info " + _("Display current song info") print " -s, --status " + _("Display MPD status") | def print_usage(self): self.print_version() print "" print _("Usage: sonata [OPTION]") print "" print _("Options") + ":" print " -h, --help " + _("Show this help and exit") print " -v, --version " + _("Show version information and exit") print " -s, --status " + _("Display current song info"... |
response = dialog.run() | dialog.show() def choose_image_local_response(self, dialog, response): | def choose_image_local(self, widget): dialog = gtk.FileChooserDialog(title=_("Open Image"),action=gtk.FILE_CHOOSER_ACTION_OPEN,buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK)) filter = gtk.FileFilter() filter.set_name(_("Images")) filter.add_pixbuf_formats() dialog.add_filter(filter) filte... |
self.cursonglabel.set_markup() | self.cursonglabel.set_markup(newlabel) | def update_cursong(self): if self.conn and self.status and self.status.state in ['play', 'pause']: # We must show the trayprogressbar and trayalbumeventbox # before changing self.cursonglabel (and consequently calling # self.labelnotify() in order to ensure that the notification # popup will have the correct height whe... |
keys = mmkeys.MmKeys() keys.connect("mm_prev", self.mmprev) keys.connect("mm_next", self.mmnext) keys.connect("mm_playpause", self.mmpp) keys.connect("mm_stop", self.mmstop) | self.keys = mmkeys.MmKeys() self.keys.connect("mm_prev", self.mmprev) self.keys.connect("mm_next", self.mmnext) self.keys.connect("mm_playpause", self.mmpp) self.keys.connect("mm_stop", self.mmstop) | def __init__(self): |
self.outtertipbox.show_all() | def __init__(self): | |
return self.filename_or_fullpath(item.file) | text = text.replace("%A", _('Unknown')) | def parse_formatting(self, format, item, use_escape_html): if self.song_has_metadata(item): text = format if "%A" in text: try: text = text.replace("%A", item.artist) except: return self.filename_or_fullpath(item.file) if "%B" in text: try: text = text.replace("%B", item.album) except: text = text.replace("%B", "Unknow... |
text = text.replace("%B", "Unknown") | text = text.replace("%B", _('Unknown')) | def parse_formatting(self, format, item, use_escape_html): if self.song_has_metadata(item): text = format if "%A" in text: try: text = text.replace("%A", item.artist) except: return self.filename_or_fullpath(item.file) if "%B" in text: try: text = text.replace("%B", item.album) except: text = text.replace("%B", "Unknow... |
name = self.filename_or_fullpath(self.songinfo.file) for i in range(len(self.stream_uris)): if name == self.stream_uris[i]: name = self.stream_names[i] newlabel = '<big><b>' + escape_html(name) + '</b></big>\n<small>' + _('by Unknown') + '</small>' newlabel_tray = newlabel | try: newlabel = '<big><b>' + escape_html(getattr(self.songinfo, 'title', None)) + '</b></big>\n<small>' + _('by') + ' ' + _('Unknown') + '</small>' newlabel_tray = newlabel newlabelfound = True except: pass if not newlabelfound: name = self.filename_or_fullpath(self.songinfo.file) newlabel = '<big><b>' + escape_html(... | def update_cursong(self): if self.conn and self.status and self.status.state in ['play', 'pause']: # We must show the trayprogressbar and trayalbumeventbox # before changing self.cursonglabel (and consequently calling # self.labelnotify()) in order to ensure that the notification # popup will have the correct height wh... |
if item == self.stream_uris[i]: | if track.file == self.stream_uris[i]: | def update_playlist(self): if self.conn: self.songs = self.conn.do.playlistinfo() self.currentdata.clear() self.current.freeze_child_notify() for track in self.songs: item = self.parse_formatting(self.currentformat, track, True) # Check if the item is one of the user's streams; if so, # we want to display the stream na... |
self.cursonglabel.set_markup('<big><b>' + escape_html(getattr(self.songinfo, 'title', None)) + '</b></big>\n<small>' + _('by') + ' ' + escape_html(getattr(self.songinfo, 'artist', None)) + ' ' + _('from') + ' ' + escape_html(getattr(self.songinfo, 'album', None)) + '</small>') | newlabel = '<big><b>' + escape_html(getattr(self.songinfo, 'title', None)) + '</b></big>\n<small>' + _('by') + ' ' + escape_html(getattr(self.songinfo, 'artist', None)) + ' ' + _('from') + ' ' + escape_html(getattr(self.songinfo, 'album', None)) + '</small>' if newlabel != self.cursonglabel.get_label(): self.cursonglab... | def update_cursong(self): if self.conn and self.status and self.status.state in ['play', 'pause']: try: self.cursonglabel.set_markup('<big><b>' + escape_html(getattr(self.songinfo, 'title', None)) + '</b></big>\n<small>' + _('by') + ' ' + escape_html(getattr(self.songinfo, 'artist', None)) + ' ' + _('from') + ' ' + esc... |
self.cursonglabel.set_markup('<big><b>' + escape_html(name) + '</b></big>\n<small>' + _('by Unknown') + '</small>') | newlabel = '<big><b>' + escape_html(name) + '</b></big>\n<small>' + _('by Unknown') + '</small>' if newlabel != self.cursonglabel.get_label(): self.cursonglabel.set_markup() | def update_cursong(self): if self.conn and self.status and self.status.state in ['play', 'pause']: try: self.cursonglabel.set_markup('<big><b>' + escape_html(getattr(self.songinfo, 'title', None)) + '</b></big>\n<small>' + _('by') + ' ' + escape_html(getattr(self.songinfo, 'artist', None)) + ' ' + _('from') + ' ' + esc... |
if (self.status and self.status.state == 'stop') or not self.conn: | def update_cursong(self): if self.conn and self.status and self.status.state in ['play', 'pause']: try: self.cursonglabel.set_markup('<big><b>' + escape_html(getattr(self.songinfo, 'title', None)) + '</b></big>\n<small>' + _('by') + ' ' + escape_html(getattr(self.songinfo, 'artist', None)) + ' ' + _('from') + ' ' + esc... | |
else: self.trayprogressbar.show() if self.show_covers: self.trayalbumeventbox.show() | def update_cursong(self): if self.conn and self.status and self.status.state in ['play', 'pause']: try: self.cursonglabel.set_markup('<big><b>' + escape_html(getattr(self.songinfo, 'title', None)) + '</b></big>\n<small>' + _('by') + ' ' + escape_html(getattr(self.songinfo, 'artist', None)) + ' ' + _('from') + ' ' + esc... | |
h = 92 | def _calculate_pos(self, widget): screen = widget.get_screen() x, y = widget.window.get_origin() w, h = self.size_request() h = 92 | |
self.browser.freeze_child_notify() | def browse(self, widget=None, root='/'): if not self.conn: return | |
if mins and mins.startswith('0') and len(mins) > 1: | if mins: if mins.startswith('0') and len(mins) > 1: | def update_statusbar(self): if self.conn and self.status and self.show_statusbar: hours = None mins = None total_time = convert_time(self.total_time) try: mins = total_time.split(":")[-2] hours = total_time.split(":")[-3] except: pass if mins and mins.startswith('0') and len(mins) > 1: mins = mins[1:] if hours and hour... |
if hours and hours.startswith('0'): hours = hours[1:] | if mins == "1": mins_text = _('minute') else: mins_text = _('minutes') if hours: if hours.startswith('0'): hours = hours[1:] if hours == "1": hours_text = _('hour and') else: hours_text = _('hours and') | def update_statusbar(self): if self.conn and self.status and self.show_statusbar: hours = None mins = None total_time = convert_time(self.total_time) try: mins = total_time.split(":")[-2] hours = total_time.split(":")[-3] except: pass if mins and mins.startswith('0') and len(mins) > 1: mins = mins[1:] if hours and hour... |
status_text = str(self.status.playlistlength) + ' ' + _('songs') + ', ' + hours + ' ' + _('hours and') + ' ' + mins + ' ' + _('minutes') | status_text = str(self.status.playlistlength) + ' ' + songs_text + ', ' + hours + ' ' + hours_text + ' ' + mins + ' ' + mins_text | def update_statusbar(self): if self.conn and self.status and self.show_statusbar: hours = None mins = None total_time = convert_time(self.total_time) try: mins = total_time.split(":")[-2] hours = total_time.split(":")[-3] except: pass if mins and mins.startswith('0') and len(mins) > 1: mins = mins[1:] if hours and hour... |
status_text = str(self.status.playlistlength) + ' ' + _('songs') + ', ' + mins + ' ' + _('minutes') | status_text = str(self.status.playlistlength) + ' ' + songs_text + ', ' + mins + ' ' + mins_text | def update_statusbar(self): if self.conn and self.status and self.show_statusbar: hours = None mins = None total_time = convert_time(self.total_time) try: mins = total_time.split(":")[-2] hours = total_time.split(":")[-3] except: pass if mins and mins.startswith('0') and len(mins) > 1: mins = mins[1:] if hours and hour... |
availableheading.set_markup('<small>Available options:</small>') | availableheading.set_markup('<small>' + _('Available options') + ':</small>') | def prefs(self, widget): prefswindow = gtk.Dialog(_("Preferences"), self.window, flags=gtk.DIALOG_DESTROY_WITH_PARENT) prefswindow.set_resizable(False) prefswindow.set_has_separator(False) hbox = gtk.HBox() prefsnotebook = gtk.Notebook() # MPD tab table = gtk.Table(9, 2, False) table.set_col_spacings(3) mpdlabel = gtk.... |
dict["path"] = item | dict["path"] = item.file | def browse(self, widget=None, root='/'): if not self.conn: return |
table3.attach(gtk.Label(), 1, 3, 12, 13, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 15, 0) | table3.attach(infofilebox, 1, 3, 12, 13, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0) | def prefs(self, widget): prefswindow = gtk.Dialog(_("Preferences"), self.window, flags=gtk.DIALOG_DESTROY_WITH_PARENT) prefswindow.set_resizable(False) prefswindow.set_has_separator(False) hbox = gtk.HBox() prefsnotebook = gtk.Notebook() # MPD tab table = gtk.Table(9, 2, False) table.set_col_spacings(3) mpdlabel = gtk.... |
table3.attach(gtk.Label(), 1, 3, 14, 15, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 15, 0) table3.attach(gtk.Label(), 1, 3, 15, 16, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 15, 0) | table3.attach(gtk.Label(), 1, 3, 14, 15, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0) table3.attach(gtk.Label(), 1, 3, 15, 16, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 45, 0) | def prefs(self, widget): prefswindow = gtk.Dialog(_("Preferences"), self.window, flags=gtk.DIALOG_DESTROY_WITH_PARENT) prefswindow.set_resizable(False) prefswindow.set_has_separator(False) hbox = gtk.HBox() prefsnotebook = gtk.Notebook() # MPD tab table = gtk.Table(9, 2, False) table.set_col_spacings(3) mpdlabel = gtk.... |
begin_pos = f.find("\"</b><BR><BR>", 1) + len("\"</b><BR><BR>") end_pos = f.find("<BR><BR>[", begin_pos) | begin_pos = f.find("\"</b><BR>", 1) + len("\"</b><BR>") end_pos = f.find("<BR><BR>", begin_pos) | def update_lyrics(self): if not self.show_lyrics: return if self.conn and self.status and self.status.state in ['play', 'pause']: while gtk.events_pending(): gtk.main_iteration() artist = getattr(self.songinfo, 'artist', None) if not artist: artist = "" title = getattr(self.songinfo, 'title', None) if not title: title ... |
return escape_html(item.file.split('/')[-1]) | if len(item.file.split('/')[-1]) == 0 or item.file[:7] == 'http://' or item.file[:6] == 'ftp://': return escape_html(item.file) else: return escape_html(item.file.split('/')[-1]) | def parse_formatting(self, format, item): if self.song_has_metadata(item): text = format if "%A" in text: try: text = text.replace("%A", item.artist) except: return escape_html(item.file.split('/')[-1]) if "%B" in text: try: text = text.replace("%B", item.album) except: text = text.replace("%B", "Unknown") if "%S" in t... |
def mmpp(self, keys, key, player): | def mmpp(self, keys, key): | def mmpp(self, keys, key, player): if self.conn: self.pp(None) |
def mmstop(self, keys, key, player): | def mmstop(self, keys, key): | def mmstop(self, keys, key, player): if self.conn: self.stop(None) |
def mmprev(self, keys, key, player): | def mmprev(self, keys, key): | def mmprev(self, keys, key, player): if self.conn: self.prev(None) |
def mmnext(self, keys, key, player): | def mmnext(self, keys, key): | def mmnext(self, keys, key, player): if self.conn: self.next(None) |
for file in os.listdir(self.musicdir + songdir): for i in gtk.gdk.pixbuf_get_formats(): if os.path.splitext(file)[1].replace(".","").lower() in i['extensions']: if single_img == None: single_img = file else: return False return single_img | if os.path.exists(self.musicdir + songdir): for file in os.listdir(self.musicdir + songdir): for i in gtk.gdk.pixbuf_get_formats(): if os.path.splitext(file)[1].replace(".","").lower() in i['extensions']: if single_img == None: single_img = file else: return False return single_img else: return False | def get_single_img_in_path(self, songdir): single_img = None for file in os.listdir(self.musicdir + songdir): # Check against gtk+ supported image formats for i in gtk.gdk.pixbuf_get_formats(): if os.path.splitext(file)[1].replace(".","").lower() in i['extensions']: if single_img == None: single_img = file else: return... |
self.conn.do.password(self.password) | if self.conn: self.conn.do.password(self.password) | def __init__(self): # Initialize vars: self.host = 'localhost' self.port = 6600 self.password = '' self.x = 0 self.y = 0 self.w = 400 self.h = 300 self.expanded = True self.visible = True self.withdrawn = False self.screen = 0 self.prevconn = [] self.prevstatus = None self.prevsonginfo = None self.lastalbumart = None s... |
if self.status.state in ['play', 'pause']: | if self.status and self.status.state in ['play', 'pause']: | def progressbar_button_press_event(self, widget, event): if self.status.state in ['play', 'pause']: at, len = [int(c) for c in self.status.time.split(':')] try: progressbarsize = self.progressbar.allocation seektime = int((event.x/progressbarsize.width) * len) self.seek(int(self.status.song), seektime) except: pass ret... |
if self.status.state in ['play', 'pause']: | if self.status and self.status.state in ['play', 'pause']: | def progressbar_scroll_event(self, widget, event): if self.status.state in ['play', 'pause']: try: gobject.source_remove(self.seekidle) except: pass self.seekidle = gobject.idle_add(self.seek_when_idle, event.direction) return True |
self.conn.do.password(self.password) | if self.conn: self.conn.do.password(self.password) | def prefs(self, widget): prefswindow = gtk.Dialog("Preferences", self.window, flags=gtk.DIALOG_DESTROY_WITH_PARENT) prefswindow.set_resizable(False) prefswindow.set_has_separator(False) hbox = gtk.HBox() prefsnotebook = gtk.Notebook() table = gtk.Table(7, 2) table.set_row_spacings(7) table.set_col_spacings(3) table.att... |
if HAVE_DBUS: def start_dbus_interface(): | def start_dbus_interface(): if HAVE_DBUS: exit_now = False | def removeall(path): if not os.path.isdir(path): return files=os.listdir(path) for x in files: fullpath=os.path.join(path, x) if os.path.isfile(fullpath): f=os.remove rmgeneric(fullpath, f) elif os.path.isdir(fullpath): removeall(fullpath) f=os.rmdir rmgeneric(fullpath, f) |
for i in range(len(entries)): | for i in range(len(entries)-1): | def edit_tags(self, widget): if not os.path.isdir(self.musicdir): error_dialog = gtk.MessageDialog(self.window, gtk.DIALOG_MODAL, gtk.MESSAGE_WARNING, gtk.BUTTONS_CLOSE, _("The path") + " " + self.musicdir + " " + _("does not exist. Please specify a valid music directory in preferences.")) error_dialog.set_title(_("Edi... |
if filetagnum >= self.filetagnum: | if filetagnum >= self.filetagnum-1: | def editwindow_applyall(self, button, item, filetags, tag_changed, entries): filetagnum = 0 for filetag in filetags: filetagnum = filetagnum + 1 tag_changed[filetagnum-1][item] = True if item == "title": filetag.tag().title = entries[0].get_text() elif item == "album": filetag.tag().album = entries[2].get_text() elif i... |
filetag.tag().track = filetagnum - self.filetagnum + 1 | filetag.tag().track = filetagnum - self.filetagnum | def editwindow_applyall(self, button, item, filetags, tag_changed, entries): filetagnum = 0 for filetag in filetags: filetagnum = filetagnum + 1 tag_changed[filetagnum-1][item] = True if item == "title": filetag.tag().title = entries[0].get_text() elif item == "album": filetag.tag().album = entries[2].get_text() elif i... |
time = convert_time(int(self.songinfo.time)) self.progressbar.set_text(at_time + " / " + time) | try: time = convert_time(int(self.songinfo.time)) self.progressbar.set_text(at_time + " / " + time) except AttributeError: self.progressbar.set_text(at_time) | def update_progressbar(self): if self.conn and self.status and self.status.state in ['play', 'pause']: at, len = [float(c) for c in self.status.time.split(':')] try: self.progressbar.set_fraction(at/len) except ZeroDivisionError: self.progressbar.set_fraction(0) else: self.progressbar.set_fraction(0) if self.conn: if s... |
if self.withdrawn: | if self.withdrawn and HAVE_EGG: | def __init__(self): |
self.trayimage.set_from_stock('sonata', gtk.ICON_SIZE_BUTTON) | try: self.trayimage.set_from_stock('sonata', gtk.ICON_SIZE_BUTTON) except: pass | def handle_change_conn(self): if not self.conn: self.ppbutton.set_property('sensitive', False) self.stopbutton.set_property('sensitive', False) self.prevbutton.set_property('sensitive', False) self.nextbutton.set_property('sensitive', False) self.volumebutton.set_property('sensitive', False) self.trayimage.set_from_sto... |
self.window.hide() self.withdrawn = True | if HAVE_EGG: self.window.hide() self.withdrawn = True | def withdraw_app(self): self.window.hide() self.withdrawn = True |
prefsnotebook.set_current_page(2) | prefsnotebook.set_current_page(3) | def prefs(self, widget, show_mpd_tab=False): prefswindow = gtk.Dialog(_("Preferences"), self.window, flags=gtk.DIALOG_DESTROY_WITH_PARENT) prefswindow.set_resizable(False) prefswindow.set_has_separator(False) hbox = gtk.HBox() prefsnotebook = gtk.Notebook() # MPD tab table = gtk.Table(9, 2, False) #table.set_row_spacin... |
self.trayalbumeventbox.set_size_request(57, 90) | self.trayalbumeventbox.set_size_request(59, 90) | def __init__(self, window=None, sugar=False): |
self.trayalbumimage1.set_size_request(50, 75) | self.trayalbumimage1.set_size_request(51, 77) | def __init__(self, window=None, sugar=False): |
self.trayalbumimage2.set_size_request(25, 75) | self.trayalbumimage2.set_size_request(26, 77) | def __init__(self, window=None, sugar=False): |
begin_pos = format.find("(") | begin_pos = format.find("{") | def parse_formatting_return_substrings(self, format): substrings = [] begin_pos = format.find("(") end_pos = -1 while begin_pos > -1: if begin_pos > end_pos + 1: substrings.append(format[end_pos+1:begin_pos]) end_pos = format.find(")", begin_pos) substrings.append(format[begin_pos:end_pos+1]) begin_pos = format.find("(... |
end_pos = format.find(")", begin_pos) | end_pos = format.find("}", begin_pos) | def parse_formatting_return_substrings(self, format): substrings = [] begin_pos = format.find("(") end_pos = -1 while begin_pos > -1: if begin_pos > end_pos + 1: substrings.append(format[end_pos+1:begin_pos]) end_pos = format.find(")", begin_pos) substrings.append(format[begin_pos:end_pos+1]) begin_pos = format.find("(... |
begin_pos = format.find("(", end_pos) | begin_pos = format.find("{", end_pos) | def parse_formatting_return_substrings(self, format): substrings = [] begin_pos = format.find("(") end_pos = -1 while begin_pos > -1: if begin_pos > end_pos + 1: substrings.append(format[end_pos+1:begin_pos]) end_pos = format.find(")", begin_pos) substrings.append(format[begin_pos:end_pos+1]) begin_pos = format.find("(... |
if subformat.startswith("(") and subformat.endswith(")"): has_parantheses = True | if subformat.startswith("{") and subformat.endswith("}"): has_brackets = True | def parse_formatting_for_substring(self, subformat, item, wintitle): text = subformat if subformat.startswith("(") and subformat.endswith(")"): has_parantheses = True else: has_parantheses = False if "%A" in text: try: text = text.replace("%A", item.artist) except: if not has_parantheses: text = text.replace("%A", _('U... |
has_parantheses = False | has_brackets = False | def parse_formatting_for_substring(self, subformat, item, wintitle): text = subformat if subformat.startswith("(") and subformat.endswith(")"): has_parantheses = True else: has_parantheses = False if "%A" in text: try: text = text.replace("%A", item.artist) except: if not has_parantheses: text = text.replace("%A", _('U... |
if not has_parantheses: | if not has_brackets: | def parse_formatting_for_substring(self, subformat, item, wintitle): text = subformat if subformat.startswith("(") and subformat.endswith(")"): has_parantheses = True else: has_parantheses = False if "%A" in text: try: text = text.replace("%A", item.artist) except: if not has_parantheses: text = text.replace("%A", _('U... |
if text.startswith("(") and text.endswith(")"): | if text.startswith("{") and text.endswith("}"): | def parse_formatting_for_substring(self, subformat, item, wintitle): text = subformat if subformat.startswith("(") and subformat.endswith(")"): has_parantheses = True else: has_parantheses = False if "%A" in text: try: text = text.replace("%A", item.artist) except: if not has_parantheses: text = text.replace("%A", _('U... |
if HAVE_STATUS_ICON: self.statusicon.set_tooltip(_('Not connected')) else: self.traycursonglabel.set_label(_('Not connected')) | self.traycursonglabel.set_label(_('Not connected')) | def update_cursong(self): if self.conn and self.status and self.status.state in ['play', 'pause']: # We must show the trayprogressbar and trayalbumeventbox # before changing self.cursonglabel (and consequently calling # self.labelnotify()) in order to ensure that the notification # popup will have the correct height wh... |
if HAVE_STATUS_ICON: self.statusicon.set_tooltip(_('Stopped')) else: self.traycursonglabel.set_label(_('Stopped')) | self.traycursonglabel.set_label(_('Stopped')) | def update_cursong(self): if self.conn and self.status and self.status.state in ['play', 'pause']: # We must show the trayprogressbar and trayalbumeventbox # before changing self.cursonglabel (and consequently calling # self.labelnotify()) in order to ensure that the notification # popup will have the correct height wh... |
pix1 = pix.subpixbuf(0, 0, 50, 75) pix2 = pix.subpixbuf(50, 0, 25, 75) | pix1 = pix.subpixbuf(0, 0, 51, 77) pix2 = pix.subpixbuf(51, 0, 26, 77) | def set_tooltip_art(self, pix): pix1 = pix.subpixbuf(0, 0, 50, 75) pix2 = pix.subpixbuf(50, 0, 25, 75) self.trayalbumimage1.set_from_pixbuf(pix1) self.trayalbumimage2.set_from_pixbuf(pix2) del pix1 del pix2 |
pointer_screen, px, py, _ = self.window.get_screen().get_display().get_pointer() icon_screen, icon_rect, icon_orient = self.statusicon.get_geometry() x = icon_rect[0] y = icon_rect[1] width = icon_rect[2] height = icon_rect[3] if px >= x and px <= x+width and py >= y and py <= y+height: self.traytips._start_delay(self.... | if not self.traytips.notif_handler: pointer_screen, px, py, _ = self.window.get_screen().get_display().get_pointer() icon_screen, icon_rect, icon_orient = self.statusicon.get_geometry() x = icon_rect[0] y = icon_rect[1] width = icon_rect[2] height = icon_rect[3] if px >= x and px <= x+width and py >= y and py <= y+heig... | def tooltip_show_manually(self): # Since there is no signal to connect to when the user puts their # mouse over the trayicon, we will check the mouse position # manually and show/hide the window as appropriate. This is called # every iteration. pointer_screen, px, py, _ = self.window.get_screen().get_display().get_poin... |
lyricseventbox = gtk.EventBox() | self.lyricseventbox = gtk.EventBox() | def __init__(self): |
self.expanderwindow4.set_no_show_all(True) self.expanderwindow4.hide() | self.lyricseventbox.set_no_show_all(True) self.lyricseventbox.hide() | def __init__(self): |
lyricseventbox.add(self.expanderwindow4) | self.lyricseventbox.add(self.expanderwindow4) | def __init__(self): |
self.notebook.append_page(lyricseventbox, lyricshbox) | self.notebook.append_page(self.lyricseventbox, lyricshbox) | def __init__(self): |
self.expanderwindow4.set_no_show_all(False) self.expanderwindow4.show() | self.lyricseventbox.set_no_show_all(False) self.lyricseventbox.show() | def prefs_lyrics_toggled(self, button): if button.get_active(): self.expanderwindow4.set_no_show_all(False) self.expanderwindow4.show() self.show_lyrics = True self.update_lyrics() else: self.expanderwindow4.set_no_show_all(True) self.expanderwindow4.hide() self.show_lyrics = False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.