rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
startStr = '<tr><th>subClassOf</th>\n' | startStr = '<tr><th>Subclass Of</th>\n' | def termlist(self): """Term List for html doc""" stableTxt = '' testingTxt = '' unstableTxt = '' archaicTxt = '' |
startStr = '<tr><th>has subclass</th>\n' | startStr = '<tr><th>Has Subclass</th>\n' | def termlist(self): """Term List for html doc""" stableTxt = '' testingTxt = '' unstableTxt = '' archaicTxt = '' |
if (getenv('SUDO_USER') and username == getenv('SUDO_USER')): | if getenv('SUDO_USER') and username == getenv('SUDO_USER'): | def isnormal(username, uidmin, uidmax): # NOTE: Hides active (current admin) user - bug #286529 if (getenv('SUDO_USER') and username == getenv('SUDO_USER')): return False userid = int(pwd.getpwnam(username)[2]) if uidmin <= userid <= uidmax: return True else: return False |
msg = _("Could not find file with login default settings: %s" % (f)) common.errormsg(msg) | common.popup(_("timekpr administration warning"), _("Could not open file %(file)s -- cannot distinguish normal users from system users.\nAll users will be shown.") % {'file': f}) return ("ERROR", "ERROR") | def read_uid_minmax(f=dirs.LOGIN_DEFS): try: logindefs = open(f) except IOError: msg = _("Could not find file with login default settings: %s" % (f)) common.errormsg(msg) uidminmax = re.compile('^UID_(?:MIN|MAX)\s+(\d+)', re.M).findall(logindefs.read()) # TODO: Check if uidminmax has 2 variables or 1 or none # FIXME:... |
if len(uidminmax) == 1: pass elif len(uidminmax) == 0: pass if uidminmax[0] < uidminmax[1]: uidmin = int(uidminmax[0]) uidmax = int(uidminmax[1]) | if len(uidminmax) < 2: common.popup(_("timekpr administration warning"), _("Missing UID_MIN / UID_MAX variables -- Cannot distinguish normal users from system users.\nAll users will be shown.")) return ("ERROR", "ERROR") | def read_uid_minmax(f=dirs.LOGIN_DEFS): try: logindefs = open(f) except IOError: msg = _("Could not find file with login default settings: %s" % (f)) common.errormsg(msg) uidminmax = re.compile('^UID_(?:MIN|MAX)\s+(\d+)', re.M).findall(logindefs.read()) # TODO: Check if uidminmax has 2 variables or 1 or none # FIXME:... |
uidmin = int(uidminmax[1]) uidmax = int(uidminmax[0]) return (uidmin, uidmax) | if uidminmax[0] < uidminmax[1]: uidmin = int(uidminmax[0]) uidmax = int(uidminmax[1]) else: uidmin = int(uidminmax[1]) uidmax = int(uidminmax[0]) return (uidmin, uidmax) | def read_uid_minmax(f=dirs.LOGIN_DEFS): try: logindefs = open(f) except IOError: msg = _("Could not find file with login default settings: %s" % (f)) common.errormsg(msg) uidminmax = re.compile('^UID_(?:MIN|MAX)\s+(\d+)', re.M).findall(logindefs.read()) # TODO: Check if uidminmax has 2 variables or 1 or none # FIXME:... |
cursor = connection.cursor() cursor.execute(""" SELECT pe.phrase_id, d.id FROM afg_phrase_entries pe INNER JOIN afg_diaryentry d ON pe.diaryentry_id=d.id WHERE pe.phrase_id IN (SELECT * FROM (VALUES %s) AS phrase_id_set); """ % (",".join("(%s)" % i for i in phrase_ids))) | def show_entry(request, rid, template='afg/entry_page.html'): try: entry = models.DiaryEntry.objects.get(report_key=rid) except models.DiaryEntry.DoesNotExist: raise Http404 phrases = models.Phrase.objects.filter(entry_count__gt=1, entry_count__lt=10, entries=entry) | |
for row in cursor.fetchall(): dest_ids[int(row[0])].append(row[1]) | if phrase_ids: cursor = connection.cursor() cursor.execute(""" SELECT pe.phrase_id, d.id FROM afg_phrase_entries pe INNER JOIN afg_diaryentry d ON pe.diaryentry_id=d.id WHERE pe.phrase_id IN (SELECT * FROM (VALUES %s) AS phrase_id_set); """ % (",".join("(%s)" % i for i in phrase_ids))) for row in cursor.fetchall(): d... | def show_entry(request, rid, template='afg/entry_page.html'): try: entry = models.DiaryEntry.objects.get(report_key=rid) except models.DiaryEntry.DoesNotExist: raise Http404 phrases = models.Phrase.objects.filter(entry_count__gt=1, entry_count__lt=10, entries=entry) |
self.assertRaises(Exception, test_view( 'account_invoice_line_standalone')) | test_view('account_invoice_line_standalone') | def test0005views(self): ''' Test views. ''' self.assertRaises(Exception, test_view( 'account_invoice_line_standalone')) |
if axisattributes is None: axisattributes = tarrays[0].getAxis(0).attributes axes[axis] = axisConcatenate([t.getAxis(axis) for t in tarrays], axisid, axisattributes) | allunitsequal=True allunits=tarrays[0].getAxis(axis).units for t in tarrays[1:]: if t.getAxis(axis).units!=allunits: allunitsequal=False if allunitsequal: if axisattributes is None: axisattributes = tarrays[0].getAxis(axis).attributes axes[axis] = axisConcatenate([t.getAxis(axis) for t in tarrays], axisid, axisattribut... | def concatenate (arrays, axis=0, axisid=None, axisattributes=None): """Concatenate the arrays along the given axis. Give the extended axis the id and attributes provided - by default, those of the first array.""" tarrays = [_makeMaskedArg(a) for a in arrays] maresult = numpy.ma.concatenate(arrays, axis=axis) if len(arr... |
id, tstart, tend, levstart, levend, fcstart, fcent = matchnames | id, tstart, tend, levstart, levend, fcstart, fcend = matchnames | def getFilePath(self, matchnames, template): """Lookup or generate the file path, depending on whether a filemap or template is present. """ if hasattr(self.parent,'cdms_filemap'): id, tstart, tend, levstart, levend, fcstart, fcent = matchnames filename = self.parent._filemap_[(self.id, tstart, levstart, fcstart)] # ..... |
Typically dataset_list = fm[i][1] where fm is the output of | Normally dataset_list = fm[i][1] where fm is the output of | def __init__( self, tau0time, dataset_list, path="" ): """tau0time is the first time of the forecast, i.e. the time at which tau=0. dataset_list is used to get the forecast file from the forecast time. Each list item should look like this example: [None, None, None, None, 2006022200000L, 'file2006-02-22-00000.nc'] Typi... |
so you should call forecast.close() to close it. """ self.fctl,self.fct = two_times_from_one( tau0time ) filenames = [l[5] for l in dataset_list if l[4]==self.fctl] | so later on you should call forecast.close() to close it. """ self.fctl, self.fct = two_times_from_one( tau0time ) filenames = [ l[5] for l in dataset_list if l[4]==self.fctl ] | def __init__( self, tau0time, dataset_list, path="" ): """tau0time is the first time of the forecast, i.e. the time at which tau=0. dataset_list is used to get the forecast file from the forecast time. Each list item should look like this example: [None, None, None, None, 2006022200000L, 'file2006-02-22-00000.nc'] Typi... |
self.dataset=cdms2.openDataset( dataset_file ) | self.dataset=cdms2.openDataset( dataset_file, dpath=path ) | def __init__( self, dataset_file, forecast_times, path="" ): """Creates a set of forecasts. Normally you do it by something like f = forecasts( 'file.xml', (min_time, max_time) ) or f = forecasts( 'file.xml', (min_time, max_time), '/home/me/data/' ) or f = forecasts( 'file.xml', [ time1, time2, time3, time4, time5 ] )... |
""" For a forecasts object f, f( min_time, max_time ) will reduce the scope of f, to forecasts whose start time t has min_time<=t<max_time. This is done in place, i.e. any other forecasts in f will be discarded. If slice notation were possible for forecasts (it's not because times take too many bits), this function wo... | """ For a forecasts object f, f( min_time, max_time ) will reduce the scope of f, to forecasts whose start time t has min_time<=t<max_time. This is done in place, i.e. any other forecasts in f will be discarded. If slice notation were possible for forecasts (it's not because we need too many bits to represent time), th... | def reduce_inplace( self, min_time, max_time ): """ For a forecasts object f, f( min_time, max_time ) will reduce the scope of f, to forecasts whose start time t has min_time<=t<max_time. This is done in place, i.e. any other forecasts in f will be discarded. If slice notation were possible for forecasts (it's not bec... |
for i in range(len(dom)): | for domitem in dom: | def forecast_axis( self, varname ): """returns a tuple (axis,start,length,true_length) where axis is in the forecast direction""" # TO DO: see whether I can get an axis without starting with a variable name. # Most variables will have a suitable domain. |
domdir = dom[i] if getattr(domdir[0],'id',None)=='fctau0': | if getattr(domitem[0],'id',None)=='fctau0': | def forecast_axis( self, varname ): """returns a tuple (axis,start,length,true_length) where axis is in the forecast direction""" # TO DO: see whether I can get an axis without starting with a variable name. # Most variables will have a suitable domain. |
domdir1 = 0 domdir2 = len(self.fcs) domdir3 = len(self.fcs) axis = copy.copy(domdir[0]) | domitem1 = 0 domitem2 = len(self.fcs) domitem3 = len(self.fcs) axis = copy.copy(domitem[0]) | def forecast_axis( self, varname ): """returns a tuple (axis,start,length,true_length) where axis is in the forecast direction""" # TO DO: see whether I can get an axis without starting with a variable name. # Most variables will have a suitable domain. |
return ( axis, domdir1, domdir2, domdir3 ) | return ( axis, domitem1, domitem2, domitem3 ) | def forecast_axis( self, varname ): """returns a tuple (axis,start,length,true_length) where axis is in the forecast direction""" # TO DO: see whether I can get an axis without starting with a variable name. # Most variables will have a suitable domain. |
attribute, typically a DatasetVariable. | attribute, normally a DatasetVariable. | def __getitem__( self, varname ): """returns whatever the forecast set has that matches the given attribute, typically a DatasetVariable. """ if type(varname) is not str : raise CDMSError, "bad argument to forecasts[]" |
domdir = dom[i] if getattr(domdir[0],'id',None)=='fctau0': | domitem = dom[i] if getattr(domitem[0],'id',None)=='fctau0': | def __getitem__( self, varname ): """returns whatever the forecast set has that matches the given attribute, typically a DatasetVariable. """ if type(varname) is not str : raise CDMSError, "bad argument to forecasts[]" |
sorted_languages = Gtk.TreeModelSort.new_with_model(languages) | sorted_languages = Gtk.TreeModelSort (model = languages) | def os_build_dialog(self, action): builder = Totem.plugin_load_interface ("opensubtitles", "opensubtitles.ui", True, self.totem.get_main_window (), self) |
self.action.connect('activate', self.os_show_dialog, self.totem) | self.action.connect('activate', self.os_show_dialog) | def os_append_menu(self): """ """ |
if Gio.content_type_guess(filename, '', 0)[0].split('/')[0] == 'audio': | if Gio.content_type_guess(filename, '')[0].split('/')[0] == 'audio': | def os_check_is_audio(self): # FIXME need to use something else here # I think we must use video widget metadata but I don't found a way |
self.dialog.window.set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH)) | self.dialog.get_window().set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH)) | def os_get_results(self): """ """ self.liststore.clear() |
self.dialog.window.set_cursor(None) | self.dialog.get_window().set_cursor(None) | def os_populate_treeview(self): """ """ if self.model.lock.acquire(False) == False: return True |
self.dialog.window.set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH)) | self.dialog.get_window().set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH)) | def os_save_selected_subtitle(self, filename=None): """ """ self.dialog.window.set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH)) |
self.dialog.window.set_cursor(None) | self.dialog.get_window().set_cursor(None) | def os_save_subtitles(self, filename): if self.model.lock.acquire(False) == False: return True |
self.settings.bind ('format', combo, 'active', Gio.SettingsBindFlags.DEFAULT) | combo.connect ('changed', self.on_format_combo_changed) self.settings.connect ('changed::format', self.on_format_setting_changed, combo) | def do_create_configure_widget(self): """ Plugin config widget. This code must be independent from the rest of the plugin. FIXME: bgo#624073 """ builder = Totem.plugin_load_interface ('jamendo', 'jamendo.ui', True, None, self) config_widget = builder.get_object ('config_widget') config_widget.connect ('destroy', self.o... |
if path[1] not in rows[1]: | if path[0] not in rows[1]: | def on_treeview_row_clicked(self, tv, evt): """ Called when the user clicked on a treeview element. """ try: if evt.button == 3: path = tv.get_path_at_pos(int(evt.x), int(evt.y)) sel = tv.get_selection() (rows, _) = sel.get_selected_rows() if path[1] not in rows[1]: sel.unselect_all() sel.select_path(path[1]) tv.grab_... |
sel.select_path(path[1]) | sel.select_path(path[0]) | def on_treeview_row_clicked(self, tv, evt): """ Called when the user clicked on a treeview element. """ try: if evt.button == 3: path = tv.get_path_at_pos(int(evt.x), int(evt.y)) sel = tv.get_selection() (rows, _) = sel.get_selected_rows() if path[1] not in rows[1]: sel.unselect_all() sel.select_path(path[1]) tv.grab_... |
_, path, c, x, y = tv.get_path_at_pos(int(coords[0]), int(coords[1])) | path, c, x, y = tv.get_path_at_pos(int(coords[0]), int(coords[1])) | def on_treeview_row_clicked(self, tv, evt): """ Called when the user clicked on a treeview element. """ try: if evt.button == 3: path = tv.get_path_at_pos(int(evt.x), int(evt.y)) sel = tv.get_selection() (rows, _) = sel.get_selected_rows() if path[1] not in rows[1]: sel.unselect_all() sel.select_path(path[1]) tv.grab_... |
self.totem.action_error (_('Error Listing Channel Categories'), _('There was an unknown error getting the list of television channels available on BBC iPlayer.')) | self.totem.action_error (_('Error listing channel categories'), _('There was an unknown error getting the list of television channels available on BBC iPlayer.')) | def _populate_channel_list_cb (self, tree_store, parent_path, values): # Callback from PopulateChannelsThread to add stuff to the tree store if values == None: self.totem.action_error (_('Error Listing Channel Categories'), _('There was an unknown error getting the list of television channels available on BBC iPlayer.'... |
self.totem.action_error (_('Error getting programme feed'), _('There was an unknown error getting the list of programmes for this channel and category combination.')) | self.totem.action_error (_('Error getting programme feed'), _('There was an error getting the list of programmes for this channel and category combination.')) | def _populate_programme_list_cb (self, tree_store, category_path, values, remove_placeholder): # Callback from PopulateProgrammesThread to add stuff to the tree store if values == None: self.totem.action_error (_('Error getting programme feed'), _('There was an unknown error getting the list of programmes for this chan... |
num_per_page = self.settings.get_int ('num-per-page') | num_per_page = self.settings.get_value ('num-per-page').get_uint32 () | def do_create_configure_widget(self): """ Plugin config widget. This code must be independent from the rest of the plugin. FIXME: bgo#624073 """ builder = Totem.plugin_load_interface ('jamendo', 'jamendo.ui', True, None, self) config_widget = builder.get_object ('config_widget') config_widget.connect ('destroy', self.o... |
tooltip=_("Download movie subtitles from OpenSubtitles")) | tooltip=_("Download movie subtitles from OpenSubtitles"), stock_id=None) | def os_append_menu(self): """ """ |
server = xmlrpclib.Server('http://www.opensubtitles.org/xml-rpc') | server = xmlrpclib.Server('http://api.opensubtitles.org/xml-rpc') | def activate(self, totem_object): """ Called when the plugin is activated. Here the sidebar page is initialized(set up the treeview, connect the callbacks, ...) and added to totem. |
'&order=numalbum_asc' % (self.API_URL, album['id']) | '&order=numalbum_asc&streamencoding=%s' % (self.API_URL, album['id'], self.AUDIO_FORMAT) | def run(self): url = '%s/id+name+duration+image+genre+dates+url+artist_id+' \ 'artist_name+artist_url/album/json/?n=%s&imagesize=50' % \ (self.API_URL, self.NUM_PER_PAGE) if len(self.params): url += '&%s' % urllib.urlencode(self.params) try: self.lock.acquire() albums = json.loads(self._request(url)) ret = [] for i, al... |
if path[0] not in rows[1]: | if path[1] not in rows[1]: | def on_treeview_row_clicked(self, tv, evt): """ Called when the user clicked on a treeview element. """ try: if evt.button == 3: path = tv.get_path_at_pos(int(evt.x), int(evt.y)) sel = tv.get_selection() (rows, _) = sel.get_selected_rows() if path[0] not in rows[1]: sel.unselect_all() sel.select_path(path[0]) tv.grab_... |
sel.select_path(path[0]) | sel.select_path(path[1]) | def on_treeview_row_clicked(self, tv, evt): """ Called when the user clicked on a treeview element. """ try: if evt.button == 3: path = tv.get_path_at_pos(int(evt.x), int(evt.y)) sel = tv.get_selection() (rows, _) = sel.get_selected_rows() if path[0] not in rows[1]: sel.unselect_all() sel.select_path(path[0]) tv.grab_... |
path, c, x, y = tv.get_path_at_pos(int(coords[0]), int(coords[1])) if (len(path) == 1): | _, path, c, x, y = tv.get_path_at_pos(int(coords[0]), int(coords[1])) if (path.get_depth() == 1): | def on_treeview_row_clicked(self, tv, evt): """ Called when the user clicked on a treeview element. """ try: if evt.button == 3: path = tv.get_path_at_pos(int(evt.x), int(evt.y)) sel = tv.get_selection() (rows, _) = sel.get_selected_rows() if path[0] not in rows[1]: sel.unselect_all() sel.select_path(path[0]) tv.grab_... |
except Exception, exc: | except Exception as exc: | def run(self): url = '%s/id+name+duration+image+genre+dates+url+artist_id+' \ 'artist_name+artist_url/album/json/?n=%s&imagesize=50' % \ (self.API_URL, self.NUM_PER_PAGE) if len(self.params): url += '&%s' % urllib.urlencode(self.params) try: self.lock.acquire() albums = json.loads(self._request(url)) ret = [] for i, al... |
[album, album['image'], title, dur, tip] | [DictWrapper(album), album['image'], title, dur, tip] | def add_treeview_item(self, treeview, album): if not isinstance(album['image'], GdkPixbuf.Pixbuf): # album image pixbuf is not yet built try: pb = GdkPixbuf.Pixbuf.new_from_file(album['image']) os.unlink(album['image']) album['image'] = pb except: # do not fail for this, just display a dummy pixbuf album['image'] = Gdk... |
treeview.get_model().append(parent, [track, icon, tt, td, tip]) | treeview.get_model().append(parent, [DictWrapper(track), icon, tt, td, tip]) | def add_treeview_item(self, treeview, album): if not isinstance(album['image'], GdkPixbuf.Pixbuf): # album image pixbuf is not yet built try: pb = GdkPixbuf.Pixbuf.new_from_file(album['image']) os.unlink(album['image']) album['image'] = pb except: # do not fail for this, just display a dummy pixbuf album['image'] = Gdk... |
self.add_album_to_playlist('replace', item) | self.add_album_to_playlist('replace', item.dictionary) | def on_treeview_row_activated(self, tv, path, column): """ Called when the user double-clicked on a treeview element. """ try: item = self._get_selection()[0] # first item selected except: return if len(path) == 1: self.add_album_to_playlist('replace', item) else: self.add_track_to_playlist('replace', item) |
self.add_track_to_playlist('replace', item) | self.add_track_to_playlist('replace', item.dictionary) | def on_treeview_row_activated(self, tv, path, column): """ Called when the user double-clicked on a treeview element. """ try: item = self._get_selection()[0] # first item selected except: return if len(path) == 1: self.add_album_to_playlist('replace', item) else: self.add_track_to_playlist('replace', item) |
dialog = Gtk.MessageDialog(None, 0, Gtk.MessageType.INFO, Gtk.ButtonType.OK_CANCEL, msg) | dialog = Gtk.MessageDialog(None, 0, Gtk.MessageType.INFO, Gtk.ButtonsType.OK_CANCEL, msg) | def enable_debugging(self, action): msg = _("After you press OK, Totem will wait until you connect to it with winpdb or rpdb2. If you have not set a debugger password in DConf, it will use the default password ('totem').") dialog = Gtk.MessageDialog(None, 0, Gtk.MessageType.INFO, Gtk.ButtonType.OK_CANCEL, msg) if dialo... |
rows = sel.get_selected_rows(None) | (rows, _) = sel.get_selected_rows() | def on_treeview_row_clicked(self, tv, evt): """ Called when the user clicked on a treeview element. """ try: if evt.button == 3: path = tv.get_path_at_pos(int(evt.x), int(evt.y)) sel = tv.get_selection() rows = sel.get_selected_rows(None) if path[0] not in rows[1]: sel.unselect_all() sel.select_path(path[0]) tv.grab_f... |
model = self.current_treeview.get_model() rows = sel.get_selected_rows(None) | (rows, model) = sel.get_selected_rows() | def _get_selection(self, root=False): """ Shortcut method to retrieve the treeview items selected. """ ret = [] sel = self.current_treeview.get_selection() model = self.current_treeview.get_model() rows = sel.get_selected_rows(None) for row in rows: if root: it = model.get_iter((row[0],)) else: it = model.get_iter(row)... |
model = self.current_treeview.get_model() rows = sel.get_selected_rows(None) | (rows, model) = sel.get_selected_rows() | def _update_buttons_state(self): """ Update the state of the previous and next buttons. """ sel = self.current_treeview.get_selection() model = self.current_treeview.get_model() rows = sel.get_selected_rows(None) try: it = model.get_iter(rows[0]) except: it = None pindex = self.treeviews.index(self.current_treeview) se... |
(b, parent_iter) = tree_store.get_iter (parent_path) | parent_iter = tree_store.get_iter (parent_path) | def _populate_channel_list_cb (self, tree_store, parent_path, values): # Callback from PopulateChannelsThread to add stuff to the tree store if values == None: self.totem.action_error (_('Error listing channel categories'), _('There was an unknown error getting the list of television channels available on BBC iPlayer.'... |
(b, tree_iter) = tree_store.get_iter (path) if b == False: | tree_iter = tree_store.get_iter (path) if tree_iter == None: | def _row_activated_cb (self, tree_view, path, view_column): tree_store = tree_view.get_model () (b, tree_iter) = tree_store.get_iter (path) if b == False: return |
(b, category_iter) = tree_store.get_iter (category_path) tree_store.append (category_iter, values) | category_iter = tree_store.get_iter (category_path) if category_iter != None: tree_store.append (category_iter, values) | def _populate_programme_list_cb (self, tree_store, category_path, values, remove_placeholder): # Callback from PopulateProgrammesThread to add stuff to the tree store if values == None: # Translators: the "programme feed" is the list of TV shows available to watch online self.totem.action_error (_('Error getting progra... |
(b, children) = tree_store.iter_children (category_iter) if remove_placeholder and b: | children = tree_store.iter_children (category_iter) if remove_placeholder and children != None: | def _populate_programme_list_cb (self, tree_store, category_path, values, remove_placeholder): # Callback from PopulateProgrammesThread to add stuff to the tree store if values == None: # Translators: the "programme feed" is the list of TV shows available to watch online self.totem.action_error (_('Error getting progra... |
i = -1; valid = True while valid == True: (valid, tree_iter) = tree_model.iter_parent (tree_iter) | i = 0; while True: tree_iter = tree_model.iter_parent (tree_iter) if tree_iter == None: break | def get_iter_level (tree_model, tree_iter): i = -1; valid = True while valid == True: (valid, tree_iter) = tree_model.iter_parent (tree_iter) i += 1 return i |
(valid, tree_iter) = self.tree_model.get_iter_first () while (valid == True): | tree_iter = self.tree_model.get_iter_first () while (tree_iter != None): | def run (self): shown_error = False (valid, tree_iter) = self.tree_model.get_iter_first () while (valid == True): channel_id = self.tree_model.get_value (tree_iter, 1) parent_path = self.tree_model.get_path (tree_iter) |
valid = self.tree_model.iter_next (tree_iter) | tree_iter = self.tree_model.iter_next (tree_iter) | def run (self): shown_error = False (valid, tree_iter) = self.tree_model.get_iter_first () while (valid == True): channel_id = self.tree_model.get_value (tree_iter, 1) parent_path = self.tree_model.get_path (tree_iter) |
(b, category_iter) = self.tree_model.get_iter (self.category_path) if b == False: | category_iter = self.tree_model.get_iter (self.category_path) if category_iter == None: | def run (self): self.plugin.programme_download_lock.acquire () |
(v, parent_iter) = self.tree_model.iter_parent (category_iter) | parent_iter = self.tree_model.iter_parent (category_iter) | def run (self): self.plugin.programme_download_lock.acquire () |
if not isinstance(album['image'], Gdk.Pixbuf): | if not isinstance(album['image'], GdkPixbuf.Pixbuf): | def add_treeview_item(self, treeview, album): if not isinstance(album['image'], Gdk.Pixbuf): # album image pixbuf is not yet built try: pb = Gdk.Pixbuf.new_from_file(album['image']) os.unlink(album['image']) album['image'] = pb except: # do not fail for this, just display a dummy pixbuf album['image'] = GdkPixbuf.Pixbu... |
pb = Gdk.Pixbuf.new_from_file(album['image']) | pb = GdkPixbuf.Pixbuf.new_from_file(album['image']) | def add_treeview_item(self, treeview, album): if not isinstance(album['image'], Gdk.Pixbuf): # album image pixbuf is not yet built try: pb = Gdk.Pixbuf.new_from_file(album['image']) os.unlink(album['image']) album['image'] = pb except: # do not fail for this, just display a dummy pixbuf album['image'] = GdkPixbuf.Pixbu... |
album['image'] = GdkPixbuf.Pixbuf(GdkPixbuf.Colorspace.RGB, True, | album['image'] = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, True, | def add_treeview_item(self, treeview, album): if not isinstance(album['image'], Gdk.Pixbuf): # album image pixbuf is not yet built try: pb = Gdk.Pixbuf.new_from_file(album['image']) os.unlink(album['image']) album['image'] = pb except: # do not fail for this, just display a dummy pixbuf album['image'] = GdkPixbuf.Pixbu... |
icon = GdkPixbuf.Pixbuf(GdkPixbuf.Colorspace.RGB, True, 8, 1, 1) | icon = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, True, 8, 1, 1) | def add_treeview_item(self, treeview, album): if not isinstance(album['image'], Gdk.Pixbuf): # album image pixbuf is not yet built try: pb = Gdk.Pixbuf.new_from_file(album['image']) os.unlink(album['image']) album['image'] = pb except: # do not fail for this, just display a dummy pixbuf album['image'] = GdkPixbuf.Pixbu... |
dlg = Gtk.MessageDialog( type=Gtk.MessageType.ERROR, buttons=Gtk.ButtonsType.OK ) dlg.set_markup( '<b>%s</b>' % _('An error occurred while fetching albums.') ) | def on_fetch_albums_error(self, treeview, exc): """ Called when an error occured in the thread. """ self.reset() pindex = self.treeviews.index(treeview) self.progressbars[pindex].set_fraction(0.0) self.progressbars[pindex].hide() self.running_threads[pindex] = False dlg = Gtk.MessageDialog( type=Gtk.MessageType.ERROR, ... | |
dlg.format_secondary_text(msg) dlg.run() dlg.destroy() | self.totem.action_error(_('An error occurred while fetching albums.'), msg) | def on_fetch_albums_error(self, treeview, exc): """ Called when an error occured in the thread. """ self.reset() pindex = self.treeviews.index(treeview) self.progressbars[pindex].set_fraction(0.0) self.progressbars[pindex].hide() self.running_threads[pindex] = False dlg = Gtk.MessageDialog( type=Gtk.MessageType.ERROR, ... |
self.builder = Totem.plugin_load_interface ("jamendo", "jamendo.ui", True, totem_object.get_main_window (), self) self.config_dialog = self.builder.get_object('config_dialog') self.popup = self.builder.get_object('popup_menu') container = self.builder.get_object('container') self.notebook = self.builder.get_object('not... | builder = Totem.plugin_load_interface ("jamendo", "jamendo.ui", True, totem_object.get_main_window (), self) self.popup = builder.get_object('popup_menu') container = builder.get_object('container') self.notebook = builder.get_object('notebook') self.search_entry = builder.get_object('search_entry') self.search_combo =... | def do_activate(self, totem_object): """ Plugin activation. """ # Initialise the interface self.builder = Totem.plugin_load_interface ("jamendo", "jamendo.ui", True, totem_object.get_main_window (), self) self.config_dialog = self.builder.get_object('config_dialog') self.popup = self.builder.get_object('popup_menu') co... |
self.album_button = self.builder.get_object('album_button') self.previous_button = self.builder.get_object('previous_button') self.next_button = self.builder.get_object('next_button') | self.album_button = builder.get_object('album_button') self.previous_button = builder.get_object('previous_button') self.next_button = builder.get_object('next_button') | def do_activate(self, totem_object): """ Plugin activation. """ # Initialise the interface self.builder = Totem.plugin_load_interface ("jamendo", "jamendo.ui", True, totem_object.get_main_window (), self) self.config_dialog = self.builder.get_object('config_dialog') self.popup = self.builder.get_object('popup_menu') co... |
self.builder.get_object('results_progressbar'), self.builder.get_object('popular_progressbar'), self.builder.get_object('latest_progressbar'), | builder.get_object('results_progressbar'), builder.get_object('popular_progressbar'), builder.get_object('latest_progressbar'), | def do_activate(self, totem_object): """ Plugin activation. """ # Initialise the interface self.builder = Totem.plugin_load_interface ("jamendo", "jamendo.ui", True, totem_object.get_main_window (), self) self.config_dialog = self.builder.get_object('config_dialog') self.popup = self.builder.get_object('popup_menu') co... |
self.builder.get_object('results_treeview'), self.builder.get_object('popular_treeview'), self.builder.get_object('latest_treeview'), | builder.get_object('results_treeview'), builder.get_object('popular_treeview'), builder.get_object('latest_treeview'), | def do_activate(self, totem_object): """ Plugin activation. """ # Initialise the interface self.builder = Totem.plugin_load_interface ("jamendo", "jamendo.ui", True, totem_object.get_main_window (), self) self.config_dialog = self.builder.get_object('config_dialog') self.popup = self.builder.get_object('popup_menu') co... |
self.builder.get_object('search_button').connect('clicked', self.on_search_button_clicked) | builder.get_object('search_button').connect('clicked', self.on_search_button_clicked) | def do_activate(self, totem_object): """ Plugin activation. """ # Initialise the interface self.builder = Totem.plugin_load_interface ("jamendo", "jamendo.ui", True, totem_object.get_main_window (), self) self.config_dialog = self.builder.get_object('config_dialog') self.popup = self.builder.get_object('popup_menu') co... |
self.builder.get_object('cancel_button').connect('clicked', self.on_cancel_button_clicked) self.builder.get_object('ok_button').connect('clicked', self.on_ok_button_clicked) self.builder.get_object('add_to_playlist').connect('activate', self.on_add_to_playlist_activate) self.builder.get_object('jamendo_album_page').con... | builder.get_object('add_to_playlist').connect('activate', self.on_add_to_playlist_activate) builder.get_object('jamendo_album_page').connect('activate', self.on_open_jamendo_album_page_activate) | def do_activate(self, totem_object): """ Plugin activation. """ # Initialise the interface self.builder = Totem.plugin_load_interface ("jamendo", "jamendo.ui", True, totem_object.get_main_window (), self) self.config_dialog = self.builder.get_object('config_dialog') self.popup = self.builder.get_object('popup_menu') co... |
def do_create_configure_dialog(self): """ Plugin config dialog. """ format = self.gconf.get_string('%s/format' % gconf_key) num_per_page = self.gconf.get_int('%s/num_per_page' % gconf_key) combo = self.builder.get_object('preferred_format_combo') | def do_create_configure_widget(self): """ Plugin config widget. This code must be independent from the rest of the plugin. FIXME: bgo """ builder = Totem.plugin_load_interface ('jamendo', 'jamendo.ui', True, None, self) print builder gconf = GConf.Client.get_default() config_widget = builder.get_object ('config_widget'... | def do_create_configure_dialog(self): """ Plugin config dialog. """ format = self.gconf.get_string('%s/format' % gconf_key) num_per_page = self.gconf.get_int('%s/num_per_page' % gconf_key) combo = self.builder.get_object('preferred_format_combo') combo.set_active(self.AUDIO_FORMATS.index(format)) spinbutton = self.buil... |
spinbutton = self.builder.get_object('album_num_spinbutton') | combo.connect ('changed', self.on_preferred_format_combo_changed) spinbutton = builder.get_object('album_num_spinbutton') | def do_create_configure_dialog(self): """ Plugin config dialog. """ format = self.gconf.get_string('%s/format' % gconf_key) num_per_page = self.gconf.get_int('%s/num_per_page' % gconf_key) combo = self.builder.get_object('preferred_format_combo') combo.set_active(self.AUDIO_FORMATS.index(format)) spinbutton = self.buil... |
self.config_dialog.set_default_response(Gtk.ResponseType.OK) return self.config_dialog | spinbutton.connect ('value-changed', self.on_album_num_spinbutton_value_changed) return config_widget def on_preferred_format_combo_changed (self, combo): """ Called when the preferred audio format combo box is changed in the configuration dialogue """ gconf = GConf.Client.get_default() format = self.AUDIO_FORMATS[co... | def do_create_configure_dialog(self): """ Plugin config dialog. """ format = self.gconf.get_string('%s/format' % gconf_key) num_per_page = self.gconf.get_int('%s/num_per_page' % gconf_key) combo = self.builder.get_object('preferred_format_combo') combo.set_active(self.AUDIO_FORMATS.index(format)) spinbutton = self.buil... |
def on_cancel_button_clicked(self, *args): """ Called when the user clicked cancel in the config dialog. """ self.config_dialog.hide() def on_ok_button_clicked(self, *args): """ Called when the user clicked ok in the config dialog. """ combo = self.builder.get_object('preferred_format_combo') spinbutton = self.builder... | def on_cancel_button_clicked(self, *args): """ Called when the user clicked cancel in the config dialog. """ self.config_dialog.hide() | |
[DictWrapper(album), album['image'], title, dur, tip] | [album, album['image'], title, dur, tip] | def add_treeview_item(self, treeview, album): if not isinstance(album['image'], GdkPixbuf.Pixbuf): # album image pixbuf is not yet built try: pb = GdkPixbuf.Pixbuf.new_from_file(album['image']) os.unlink(album['image']) album['image'] = pb except: # do not fail for this, just display a dummy pixbuf album['image'] = Gdk... |
treeview.get_model().append(parent, [DictWrapper(track), icon, tt, td, tip]) | treeview.get_model().append(parent, [track, icon, tt, td, tip]) | def add_treeview_item(self, treeview, album): if not isinstance(album['image'], GdkPixbuf.Pixbuf): # album image pixbuf is not yet built try: pb = GdkPixbuf.Pixbuf.new_from_file(album['image']) os.unlink(album['image']) album['image'] = pb except: # do not fail for this, just display a dummy pixbuf album['image'] = Gdk... |
if album is DictWrapper: album = album.dictionary | def add_album_to_playlist(self, mode, album): """ Add an album to the playlist, mode can be: replace, enqueue or enqueue_and_play. """ if album is DictWrapper: album = album.dictionary | |
self.add_album_to_playlist('replace', item.dictionary) | self.add_album_to_playlist('replace', item) | def on_treeview_row_activated(self, tv, path, column): """ Called when the user double-clicked on a treeview element. """ try: item = self._get_selection()[0] # first item selected except: return if len(path) == 1: self.add_album_to_playlist('replace', item.dictionary) else: self.add_track_to_playlist('replace', item.d... |
self.add_track_to_playlist('replace', item.dictionary) | self.add_track_to_playlist('replace', item) | def on_treeview_row_activated(self, tv, path, column): """ Called when the user double-clicked on a treeview element. """ try: item = self._get_selection()[0] # first item selected except: return if len(path) == 1: self.add_album_to_playlist('replace', item.dictionary) else: self.add_track_to_playlist('replace', item.d... |
class DictWrapper(gobject.GObject): __gtype_name__ = 'DictWrapper' def __init__(self, dictionary): self.dictionary = dictionary gobject.GObject.__init__(self) | def _request(self, url): opener = urllib2.build_opener() opener.addheaders = [('User-agent', 'Totem Jamendo plugin')] handle = opener.open(url) data = handle.read() handle.close() return data | |
def on_format_changed (self, settings, key) | def on_format_changed (self, settings, key): | def on_format_changed (self, settings, key) JamendoService.AUDIO_FORMAT = self.settings.get_enum ('format') |
def on_num_per_page_changed (self, settings, key) | def on_num_per_page_changed (self, settings, key): | def on_num_per_page_changed (self, settings, key) JamendoService.NUM_PER_PAGE = self.settings.get_int ('num-per-page') |
cell.set_property('wrap-mode', Pango.WrapMode.WORD) cell.set_property('wrap-width', 30) | cell.set_property('ellipsize', Pango.EllipsizeMode.END) | def setup_treeviews(self): """ Setup the 3 treeview: result, popular and latest """ self.current_treeview = self.treeviews[0] for w in self.treeviews: selection = w.get_selection () selection.set_mode(Gtk.SelectionMode.MULTIPLE) selection.connect ('changed', self.on_treeview_selection_changed) |
self.view.modify_font(Pango.Font.description_from_string('Monospace')) | self.view.modify_font(Pango.font_description_from_string('Monospace')) | def __init__(self, namespace = {}, destroy_cb = None): Gtk.ScrolledWindow.__init__(self) |
if event.key.keyval == Gdk.d and event.key.state == Gdk.ModifierType.CONTROL_MASK: | (_, state) = event.get_state () if event.key.keyval == Gdk.KEY_d and state & Gdk.ModifierType.CONTROL_MASK: | def __key_press_event_cb(self, view, event): if event.key.keyval == Gdk.d and event.key.state == Gdk.ModifierType.CONTROL_MASK: self.destroy() elif event.key.keyval == Gdk.Return and event.key.state == Gdk.ModifierType.CONTROL_MASK: # Get the command buffer = view.get_buffer() inp_mark = buffer.get_mark("input") inp =... |
elif event.key.keyval == Gdk.Return and event.key.state == Gdk.ModifierType.CONTROL_MASK: | elif event.key.keyval == Gdk.KEY_Return and state & Gdk.ModifierType.CONTROL_MASK: | def __key_press_event_cb(self, view, event): if event.key.keyval == Gdk.d and event.key.state == Gdk.ModifierType.CONTROL_MASK: self.destroy() elif event.key.keyval == Gdk.Return and event.key.state == Gdk.ModifierType.CONTROL_MASK: # Get the command buffer = view.get_buffer() inp_mark = buffer.get_mark("input") inp =... |
elif event.key.keyval == Gdk.Return: | elif event.key.keyval == Gdk.KEY_Return: | def __key_press_event_cb(self, view, event): if event.key.keyval == Gdk.d and event.key.state == Gdk.ModifierType.CONTROL_MASK: self.destroy() elif event.key.keyval == Gdk.Return and event.key.state == Gdk.ModifierType.CONTROL_MASK: # Get the command buffer = view.get_buffer() inp_mark = buffer.get_mark("input") inp =... |
elif event.key.keyval == Gdk.KP_Down or event.key.keyval == Gdk.Down: | elif event.key.keyval == Gdk.KEY_KP_Down or event.key.keyval == Gdk.KEY_Down: | def __key_press_event_cb(self, view, event): if event.key.keyval == Gdk.d and event.key.state == Gdk.ModifierType.CONTROL_MASK: self.destroy() elif event.key.keyval == Gdk.Return and event.key.state == Gdk.ModifierType.CONTROL_MASK: # Get the command buffer = view.get_buffer() inp_mark = buffer.get_mark("input") inp =... |
elif event.key.keyval == Gdk.KP_Up or event.key.keyval == Gdk.Up: | elif event.key.keyval == Gdk.KEY_KP_Up or event.key.keyval == Gdk.KEY_Up: | def __key_press_event_cb(self, view, event): if event.key.keyval == Gdk.d and event.key.state == Gdk.ModifierType.CONTROL_MASK: self.destroy() elif event.key.keyval == Gdk.Return and event.key.state == Gdk.ModifierType.CONTROL_MASK: # Get the command buffer = view.get_buffer() inp_mark = buffer.get_mark("input") inp =... |
elif event.key.keyval == Gdk.KP_Left or event.key.keyval == Gdk.Left or \ event.key.keyval == Gdk.BackSpace: | elif event.key.keyval == Gdk.KEY_KP_Left or event.key.keyval == Gdk.KEY_Left or \ event.key.keyval == Gdk.KEY_BackSpace: | def __key_press_event_cb(self, view, event): if event.key.keyval == Gdk.d and event.key.state == Gdk.ModifierType.CONTROL_MASK: self.destroy() elif event.key.keyval == Gdk.Return and event.key.state == Gdk.ModifierType.CONTROL_MASK: # Get the command buffer = view.get_buffer() inp_mark = buffer.get_mark("input") inp =... |
elif event.key.keyval == Gdk.Home: | elif event.key.keyval == Gdk.KEY_Home: | def __key_press_event_cb(self, view, event): if event.key.keyval == Gdk.d and event.key.state == Gdk.ModifierType.CONTROL_MASK: self.destroy() elif event.key.keyval == Gdk.Return and event.key.state == Gdk.ModifierType.CONTROL_MASK: # Get the command buffer = view.get_buffer() inp_mark = buffer.get_mark("input") inp =... |
if event.key.state == Gdk.ModifierType.SHIFT_MASK: | if state & Gdk.ModifierType.SHIFT_MASK: | def __key_press_event_cb(self, view, event): if event.key.keyval == Gdk.d and event.key.state == Gdk.ModifierType.CONTROL_MASK: self.destroy() elif event.key.keyval == Gdk.Return and event.key.state == Gdk.ModifierType.CONTROL_MASK: # Get the command buffer = view.get_buffer() inp_mark = buffer.get_mark("input") inp =... |
if evt.button == 3: path = tv.get_path_at_pos(int(evt.x), int(evt.y)) | if evt.button.button == 3: (path, _, _, _) = tv.get_path_at_pos(int(evt.x), int(evt.y)) | def on_treeview_row_clicked(self, tv, evt): """ Called when the user clicked on a treeview element. """ try: if evt.button == 3: path = tv.get_path_at_pos(int(evt.x), int(evt.y)) sel = tv.get_selection() (rows, _) = sel.get_selected_rows() if path[0] not in rows[1]: sel.unselect_all() sel.select_path(path[0]) tv.grab_... |
if path[0] not in rows[1]: | if path not in rows: | def on_treeview_row_clicked(self, tv, evt): """ Called when the user clicked on a treeview element. """ try: if evt.button == 3: path = tv.get_path_at_pos(int(evt.x), int(evt.y)) sel = tv.get_selection() (rows, _) = sel.get_selected_rows() if path[0] not in rows[1]: sel.unselect_all() sel.select_path(path[0]) tv.grab_... |
sel.select_path(path[0]) | sel.select_path(path) | def on_treeview_row_clicked(self, tv, evt): """ Called when the user clicked on a treeview element. """ try: if evt.button == 3: path = tv.get_path_at_pos(int(evt.x), int(evt.y)) sel = tv.get_selection() (rows, _) = sel.get_selected_rows() if path[0] not in rows[1]: sel.unselect_all() sel.select_path(path[0]) tv.grab_... |
self.popup.popup(None, None, None, evt.button, evt.time) | self.popup.popup_for_device(None, None, None, None, None, evt.button.button, evt.time) | def on_treeview_row_clicked(self, tv, evt): """ Called when the user clicked on a treeview element. """ try: if evt.button == 3: path = tv.get_path_at_pos(int(evt.x), int(evt.y)) sel = tv.get_selection() (rows, _) = sel.get_selected_rows() if path[0] not in rows[1]: sel.unselect_all() sel.select_path(path[0]) tv.grab_... |
coords = evt.get_coords() path, c, x, y = tv.get_path_at_pos(int(coords[0]), int(coords[1])) | (_, event_x, event_y) = evt.get_coords() path, c, x, y = tv.get_path_at_pos(int(event_x), int(event_y)) | def on_treeview_row_clicked(self, tv, evt): """ Called when the user clicked on a treeview element. """ try: if evt.button == 3: path = tv.get_path_at_pos(int(evt.x), int(evt.y)) sel = tv.get_selection() (rows, _) = sel.get_selected_rows() if path[0] not in rows[1]: sel.unselect_all() sel.select_path(path[0]) tv.grab_... |
totem.action_error (_('Error getting programme feed'), _('There was an unknown error getting the list of programmes for this channel and category combination.')) | self.totem.action_error (_('Error getting programme feed'), _('There was an unknown error getting the list of programmes for this channel and category combination.')) | def _populate_programme_list_cb (self, tree_store, category_path, values, remove_placeholder): # Callback from PopulateProgrammesThread to add stuff to the tree store if values == None: totem.action_error (_('Error getting programme feed'), _('There was an unknown error getting the list of programmes for this channel a... |
gobject.idle_add (self.plugin._populate_channel_list_cb, self.tree_model, parent_path, None) | if not shown_error: gobject.idle_add (self.plugin._populate_channel_list_cb, self.tree_model, parent_path, None) shown_error = True | def run (self): tree_iter = self.tree_model.get_iter_first () while (tree_iter != None): channel_id = self.tree_model.get_value (tree_iter, 1) parent_path = self.tree_model.get_path (tree_iter) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.