[alacarte] Remove dumb explicit checks
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [alacarte] Remove dumb explicit checks
- Date: Fri, 1 Jun 2012 06:09:53 +0000 (UTC)
commit a825a8da823e99167158b08c1140d553aaa23c90
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Fri Jun 1 01:45:19 2012 -0400
Remove dumb explicit checks
Replace "== None" with "is None"
Replace "!= None" with "is not None"
Replace "== False" with "not"
Replace "!= False" with ""
If I see "== True" I'm going to shoot myself.
Alacarte/MainWindow.py | 18 +++++++++---------
Alacarte/MenuEditor.py | 8 ++++----
2 files changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/Alacarte/MainWindow.py b/Alacarte/MainWindow.py
index fcec157..c091764 100644
--- a/Alacarte/MainWindow.py
+++ b/Alacarte/MainWindow.py
@@ -249,14 +249,14 @@ class MainWindow(object):
#this is a little timeout callback to insert new items after
#gnome-desktop-item-edit has finished running
def waitForNewItemProcess(self, process, parent_id, file_path):
- if process.poll() != None:
+ if process.poll() is not None:
if os.path.isfile(file_path):
self.editor.insertExternalItem(os.path.split(file_path)[1], parent_id)
return False
return True
def waitForNewMenuProcess(self, process, parent_id, file_path):
- if process.poll() != None:
+ if process.poll() is not None:
if os.path.isfile(file_path):
self.editor.insertExternalMenu(os.path.split(file_path)[1], parent_id)
return False
@@ -264,7 +264,7 @@ class MainWindow(object):
#this callback keeps you from editing the same item twice
def waitForEditProcess(self, process, file_path):
- if process.poll() != None:
+ if process.poll() is not None:
self.edit_pool.remove(file_path)
return False
return True
@@ -390,14 +390,14 @@ class MainWindow(object):
context.finish(False, False, etime)
return False
if selection.target in ('ALACARTE_ITEM_ROW', 'ALACARTE_MENU_ROW'):
- if self.drag_data == None:
+ if self.drag_data is None:
return False
item = self.drag_data
new_parent = menus[path][2]
if isinstance(item, GMenu.TreeEntry):
self.editor.copyItem(item, new_parent)
elif isinstance(item, GMenu.TreeDirectory):
- if self.editor.moveMenu(item, new_parent) == False:
+ if not self.editor.moveMenu(item, new_parent):
self.loadUpdates()
elif isinstance(item, GMenu.TreeSeparator):
self.editor.moveSeparator(item, new_parent)
@@ -462,7 +462,7 @@ class MainWindow(object):
button = event.button
event_time = event.time
info = item_tree.get_path_at_pos(int(event.x), int(event.y))
- if info != None:
+ if info is not None:
path, col, cellx, celly = info
item_tree.grab_focus()
item_tree.set_cursor(path, col, 0)
@@ -490,7 +490,7 @@ class MainWindow(object):
drop_info = treeview.get_dest_row_at_pos(x, y)
before = None
after = None
- if self.drag_data == None:
+ if self.drag_data is None:
return False
item = self.drag_data
# by default we assume, that the items stays in the same menu
@@ -515,13 +515,13 @@ class MainWindow(object):
if isinstance(item, GMenu.TreeEntry):
self.editor.moveItem(item, destination, before, after)
elif isinstance(item, GMenu.TreeDirectory):
- if self.editor.moveMenu(item, destination, before, after) == False:
+ if not self.editor.moveMenu(item, destination, before, after):
self.loadUpdates()
elif isinstance(item, GMenu.TreeSeparator):
self.editor.moveSeparator(item, destination, before, after)
context.finish(True, True, etime)
elif selection.target == 'text/plain':
- if selection.data == None:
+ if selection.data is None:
return False
menus, iter = self.tree.get_object('menu_tree').get_selection().get_selected()
parent = menus[iter][2]
diff --git a/Alacarte/MenuEditor.py b/Alacarte/MenuEditor.py
index 3034cba..cbe02df 100644
--- a/Alacarte/MenuEditor.py
+++ b/Alacarte/MenuEditor.py
@@ -107,7 +107,7 @@ class MenuEditor(object):
self.save()
def getMenus(self, parent=None):
- if parent == None:
+ if parent is None:
yield self.applications.tree.get_root_directory()
else:
item_iter = parent.iter()
@@ -342,7 +342,7 @@ class MenuEditor(object):
def findMenu(self, menu_id, parent=None):
root_directory = self.applications.tree.get_root_directory()
- if parent == None and root_directory != None:
+ if parent is None and root_directory is not None:
return self.findMenu(menu_id, root_directory)
if menu_id == root_directory.get_menu_id():
return root_directory
@@ -354,7 +354,7 @@ class MenuEditor(object):
if item.get_menu_id() == menu_id:
return item
menu = self.findMenu(menu_id, item)
- if menu != None:
+ if menu is not None:
return menu
item_type = item_iter.next()
@@ -366,7 +366,7 @@ class MenuEditor(object):
if menu == self.applications:
root = self.applications.visible_tree.get_root_directory()
if isinstance(item, GMenu.TreeDirectory):
- if self.findMenu(item.get_menu_id(), root) == None:
+ if self.findMenu(item.get_menu_id(), root) is None:
return False
return True
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]