Tue, 22 Apr 2008 21:15:40 +0200 <thp@perli.net>
Python code fixup: Compare "None" with "is not" instead of "!=" * src/gpodder/config.py: "!= None" => "is not None" * src/gpodder/download.py: "!= None" => "is not None" * src/gpodder/gui.py: "!= None" => "is not None" * src/gpodder/libconverter.py: "!= None" => "is not None" * src/gpodder/libgpodder.py: "!= None" => "is not None" * src/gpodder/libpodcasts.py: "!= None" => "is not None" * src/gpodder/services.py: "!= None" => "is not None" * src/gpodder/util.py: "!= None" => "is not None" git-svn-id: svn://svn.berlios.de/gpodder/trunk@683 b0d088ad-0a06-0410-aad2-9ed5178a7e87
This commit is contained in:
parent
bba4db9632
commit
18df6b386c
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
Tue, 22 Apr 2008 21:15:40 +0200 <thp@perli.net>
|
||||
Python code fixup: Compare "None" with "is not" instead of "!="
|
||||
|
||||
* src/gpodder/config.py: "!= None" => "is not None"
|
||||
* src/gpodder/download.py: "!= None" => "is not None"
|
||||
* src/gpodder/gui.py: "!= None" => "is not None"
|
||||
* src/gpodder/libconverter.py: "!= None" => "is not None"
|
||||
* src/gpodder/libgpodder.py: "!= None" => "is not None"
|
||||
* src/gpodder/libpodcasts.py: "!= None" => "is not None"
|
||||
* src/gpodder/services.py: "!= None" => "is not None"
|
||||
* src/gpodder/util.py: "!= None" => "is not None"
|
||||
|
||||
Tue, 22 Apr 2008 21:07:28 +0200 <thp@perli.net>
|
||||
Logging traceback is enabled by default (needs to be disabled on demand)
|
||||
|
||||
|
|
|
@ -222,17 +222,17 @@ class Config(dict):
|
|||
|
||||
def save_thread_proc( self):
|
||||
for i in range(self.WRITE_TO_DISK_TIMEOUT*10):
|
||||
if self.__save_thread != None:
|
||||
if self.__save_thread is not None:
|
||||
time.sleep( .1)
|
||||
if self.__save_thread != None:
|
||||
if self.__save_thread is not None:
|
||||
self.save()
|
||||
|
||||
def __atexit( self):
|
||||
if self.__save_thread != None:
|
||||
if self.__save_thread is not None:
|
||||
self.save()
|
||||
|
||||
def save( self, filename = None):
|
||||
if filename != None:
|
||||
if filename is not None:
|
||||
self.__filename = filename
|
||||
|
||||
log( 'Flushing settings to disk', sender = self)
|
||||
|
@ -251,7 +251,7 @@ class Config(dict):
|
|||
self.__save_thread = None
|
||||
|
||||
def load( self, filename = None):
|
||||
if filename != None:
|
||||
if filename is not None:
|
||||
self.__filename = filename
|
||||
|
||||
self.__model.clear()
|
||||
|
|
|
@ -185,7 +185,7 @@ class DownloadThread(threading.Thread):
|
|||
except DownloadCancelledException:
|
||||
log( 'Download has been cancelled: %s', self.episode.title, sender = self)
|
||||
except IOError, ioe:
|
||||
if self.notification != None:
|
||||
if self.notification is not None:
|
||||
title = ioe.strerror
|
||||
message = _('An error happened while trying to download <b>%s</b>.') % ( saxutils.escape( self.episode.title), )
|
||||
self.notification( message, title)
|
||||
|
|
|
@ -1554,7 +1554,7 @@ class gPodder(GladeWidget):
|
|||
def on_treeChannels_cursor_changed(self, widget, *args):
|
||||
( model, iter ) = self.treeChannels.get_selection().get_selected()
|
||||
|
||||
if model != None and iter != None:
|
||||
if model is not None and iter != None:
|
||||
id = model.get_path( iter)[0]
|
||||
self.active_channel = self.channels[id]
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ class FileConverter:
|
|||
|
||||
class ConverterCollection( types.DictType):
|
||||
def add_converter( self, extension, command, arguments):
|
||||
if util.find_command( command) != None:
|
||||
if util.find_command(command) is not None:
|
||||
log( 'Found "%s", will try to convert ".%s" files.' % ( command, extension ), sender = self)
|
||||
self[extension.lower()] = FileConverter( command, arguments)
|
||||
else:
|
||||
|
|
|
@ -233,7 +233,7 @@ class gPodderLib(object):
|
|||
return ( True, command_line[0] )
|
||||
|
||||
def image_download_thread( self, url, callback_pixbuf = None, callback_status = None, callback_finished = None, cover_file = None):
|
||||
if callback_status != None:
|
||||
if callback_status is not None:
|
||||
util.idle_add(callback_status, _('Downloading channel cover...'))
|
||||
pixbuf = gtk.gdk.PixbufLoader()
|
||||
|
||||
|
@ -241,13 +241,13 @@ class gPodderLib(object):
|
|||
log( 'Downloading %s', url)
|
||||
pixbuf.write( urllib.urlopen(url).read())
|
||||
|
||||
if cover_file != None and not os.path.exists( cover_file):
|
||||
if cover_file is not None and not os.path.exists(cover_file):
|
||||
log( 'Downloading cover to %s', cover_file)
|
||||
cachefile = open( cover_file, "w")
|
||||
cachefile.write( urllib.urlopen(url).read())
|
||||
cachefile.close()
|
||||
|
||||
if cover_file != None:
|
||||
if cover_file is not None:
|
||||
log( 'Reading cover from %s', cover_file)
|
||||
try:
|
||||
pixbuf.write( open( cover_file, "r").read())
|
||||
|
@ -263,7 +263,7 @@ class gPodderLib(object):
|
|||
util.delete_file( cover_file)
|
||||
|
||||
MAX_SIZE = 400
|
||||
if callback_pixbuf != None:
|
||||
if callback_pixbuf is not None:
|
||||
pb = pixbuf.get_pixbuf()
|
||||
if pb:
|
||||
if pb.get_width() > MAX_SIZE:
|
||||
|
@ -273,9 +273,9 @@ class gPodderLib(object):
|
|||
factor = MAX_SIZE*1.0/pb.get_height()
|
||||
pb = pb.scale_simple( int(pb.get_width()*factor), int(pb.get_height()*factor), gtk.gdk.INTERP_BILINEAR)
|
||||
util.idle_add(callback_pixbuf, pb)
|
||||
if callback_status != None:
|
||||
if callback_status is not None:
|
||||
util.idle_add(callback_status, '')
|
||||
if callback_finished != None:
|
||||
if callback_finished is not None:
|
||||
util.idle_add(callback_finished)
|
||||
|
||||
def get_image_from_url( self, url, callback_pixbuf = None, callback_status = None, callback_finished = None, cover_file = None):
|
||||
|
|
|
@ -449,7 +449,7 @@ class podcastChannel(ListType):
|
|||
self.update_save_dir_size()
|
||||
|
||||
iter = self.tree_model.get_iter_first()
|
||||
while iter != None:
|
||||
while iter is not None:
|
||||
self.iter_set_downloading_columns( self.tree_model, iter, new_episodes)
|
||||
iter = self.tree_model.iter_next( iter)
|
||||
|
||||
|
@ -595,7 +595,7 @@ class podcastItem(object):
|
|||
if len(entry.enclosures) > 1:
|
||||
for e in entry.enclosures:
|
||||
if hasattr( e, 'href') and hasattr( e, 'length') and hasattr( e, 'type') and (e.type.startswith('audio/') or e.type.startswith('video/')):
|
||||
if util.normalize_feed_url( e.href) != None:
|
||||
if util.normalize_feed_url(e.href) is not None:
|
||||
log( 'Selected enclosure: %s', e.href, sender = episode)
|
||||
enclosure = e
|
||||
break
|
||||
|
@ -720,7 +720,7 @@ class podcastItem(object):
|
|||
except:
|
||||
# by default, do as if this is not the same
|
||||
# this is here so that comparisons with None
|
||||
# can be allowed (item != None -> True)
|
||||
# can be allowed (item is not None -> True)
|
||||
return -1
|
||||
|
||||
return timestamp_self - timestamp_other
|
||||
|
|
|
@ -163,7 +163,7 @@ class DownloadStatusManager(ObservableService):
|
|||
if not id in self.status_list:
|
||||
return
|
||||
iter = self.status_list[id]['iter']
|
||||
if iter != None:
|
||||
if iter is not None:
|
||||
self.tree_model_lock.acquire()
|
||||
util.idle_add(self.remove_iter, iter)
|
||||
self.tree_model_lock.release()
|
||||
|
@ -221,7 +221,7 @@ class DownloadStatusManager(ObservableService):
|
|||
def is_download_in_progress( self, url):
|
||||
for element in self.status_list:
|
||||
thread = self.status_list[element]['thread']
|
||||
if thread != None and thread.url == url:
|
||||
if thread is not None and thread.url == url:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
@ -237,7 +237,7 @@ class DownloadStatusManager(ObservableService):
|
|||
def cancel_by_url( self, url):
|
||||
for element in self.status_list:
|
||||
thread = self.status_list[element]['thread']
|
||||
if thread != None and thread.url == url:
|
||||
if thread is not None and thread.url == url:
|
||||
self.remove_download_id( element)
|
||||
return True
|
||||
|
||||
|
|
|
@ -404,7 +404,7 @@ def file_extension_from_url( url):
|
|||
filename = os.path.basename( urllib.unquote(path))
|
||||
(filename, extension) = os.path.splitext(filename)
|
||||
|
||||
if file_type_by_extension(extension) != None:
|
||||
if file_type_by_extension(extension) is not None:
|
||||
# We have found a valid extension (audio, video, torrent)
|
||||
return extension.lower()
|
||||
|
||||
|
@ -413,7 +413,7 @@ def file_extension_from_url( url):
|
|||
query_url = '://'.join((scheme, urllib.unquote(query)))
|
||||
query_extension = file_extension_from_url(query_url)
|
||||
|
||||
if file_type_by_extension(query_extension) != None:
|
||||
if file_type_by_extension(query_extension) is not None:
|
||||
return query_extension
|
||||
|
||||
# No exact match found, simply return the original extension
|
||||
|
@ -465,7 +465,7 @@ def get_tree_icon(icon_name, add_bullet=False, add_padlock=False, icon_cache=Non
|
|||
"""
|
||||
global ICON_UNPLAYED, ICON_LOCKED
|
||||
|
||||
if icon_cache != None and (icon_name,add_bullet,add_padlock,icon_size) in icon_cache:
|
||||
if icon_cache is not None and (icon_name,add_bullet,add_padlock,icon_size) in icon_cache:
|
||||
return icon_cache[(icon_name,add_bullet,add_padlock,icon_size)]
|
||||
|
||||
icon_theme = gtk.icon_theme_get_default()
|
||||
|
@ -497,7 +497,7 @@ def get_tree_icon(icon_name, add_bullet=False, add_padlock=False, icon_cache=Non
|
|||
except:
|
||||
log('(get_tree_icon) Error adding emblem to icon "%s".', icon_name)
|
||||
|
||||
if icon_cache != None:
|
||||
if icon_cache is not None:
|
||||
icon_cache[(icon_name,add_bullet,add_padlock,icon_size)] = icon
|
||||
|
||||
return icon
|
||||
|
|
Loading…
Reference in New Issue