summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper St. Pierre <[email protected]>2012-06-01 01:45:19 -0400
committerAlexei Sorokin <[email protected]>2016-08-22 23:03:32 +0300
commit2f6ec7aabdeaf6575f93dbe71d08df98aa13cda2 (patch)
tree67b99cac1b90cb78266c31f0aad20ae630398e89
parentfb0de4c06f32a030b183c58d25e4d77846cd3b5e (diff)
downloadmozo-2f6ec7aabdeaf6575f93dbe71d08df98aa13cda2.tar.bz2
mozo-2f6ec7aabdeaf6575f93dbe71d08df98aa13cda2.tar.xz
remove dumb explicit checks
replace "== None" with "is None", replace "== False" with "not"
-rw-r--r--Mozo/MainWindow.py18
-rw-r--r--Mozo/MenuEditor.py12
-rw-r--r--Mozo/util.py6
3 files changed, 18 insertions, 18 deletions
diff --git a/Mozo/MainWindow.py b/Mozo/MainWindow.py
index 5ce6d0b..367b9c8 100644
--- a/Mozo/MainWindow.py
+++ b/Mozo/MainWindow.py
@@ -271,14 +271,14 @@ class MainWindow:
#this is a little timeout callback to insert new items after
#mate-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:
#hack for broken mate-desktop-item-edit
broken_path = os.path.join(os.path.split(file_path)[0], '.directory')
if os.path.isfile(broken_path):
@@ -290,7 +290,7 @@ class MainWindow:
#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
@@ -413,7 +413,7 @@ class MainWindow:
context.finish(False, False, etime)
return False
if str(selection.get_target()) in ('MOZO_ITEM_ROW', 'MOZO_MENU_ROW'):
- if self.drag_data == None:
+ if self.drag_data is None:
return False
item = self.drag_data
new_parent = menus[path][2]
@@ -421,7 +421,7 @@ class MainWindow:
if item.get_type() == matemenu.TYPE_ENTRY:
self.editor.copyItem(item, new_parent)
elif item.get_type() == matemenu.TYPE_DIRECTORY:
- if self.editor.moveMenu(item, new_parent) == False:
+ if not self.editor.moveMenu(item, new_parent):
self.loadUpdates()
elif item.get_type() == matemenu.TYPE_SEPARATOR:
self.editor.moveSeparator(item, new_parent)
@@ -480,7 +480,7 @@ class MainWindow:
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)
@@ -508,7 +508,7 @@ class MainWindow:
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
@@ -533,13 +533,13 @@ class MainWindow:
if item.get_type() == matemenu.TYPE_ENTRY:
self.editor.moveItem(item, destination, before, after)
elif item.get_type() == matemenu.TYPE_DIRECTORY:
- if self.editor.moveMenu(item, destination, before, after) == False:
+ if not self.editor.moveMenu(item, destination, before, after):
self.loadUpdates()
elif item.get_type() == matemenu.TYPE_SEPARATOR:
self.editor.moveSeparator(item, destination, before, after)
context.finish(True, True, etime)
elif str(selection.get_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/Mozo/MenuEditor.py b/Mozo/MenuEditor.py
index 0a8c5b0..4033a2b 100644
--- a/Mozo/MenuEditor.py
+++ b/Mozo/MenuEditor.py
@@ -188,7 +188,7 @@ class MenuEditor:
self.__undo.append(undo)
def getMenus(self, parent=None):
- if parent == None:
+ if parent is None:
yield self.applications.tree.root
yield self.settings.tree.root
else:
@@ -419,7 +419,7 @@ class MenuEditor:
else:
continue
elif item.get_type() == matemenu.TYPE_DIRECTORY:
- if item.get_desktop_file_path() == None:
+ if item.get_desktop_file_path() is None:
continue
file_path = os.path.join(util.getUserDirectoryPath(), os.path.split(item.get_desktop_file_path())[1])
if not os.path.isfile(file_path):
@@ -451,9 +451,9 @@ class MenuEditor:
return self.settings
def __findMenu(self, menu_id, parent=None):
- if parent == None:
+ if parent is None:
menu = self.__findMenu(menu_id, self.applications.tree.root)
- if menu != None:
+ if menu is not None:
return menu
else:
return self.__findMenu(menu_id, self.settings.tree.root)
@@ -466,7 +466,7 @@ class MenuEditor:
if item.menu_id == menu_id:
return item
menu = self.__findMenu(menu_id, item)
- if menu != None:
+ if menu is not None:
return menu
def __isVisible(self, item):
@@ -478,7 +478,7 @@ class MenuEditor:
elif menu == self.settings:
root = self.settings.visible_tree.root
if item.get_type() == matemenu.TYPE_DIRECTORY:
- if self.__findMenu(item.menu_id, root) == None:
+ if self.__findMenu(item.menu_id, root) is None:
return False
return True
diff --git a/Mozo/util.py b/Mozo/util.py
index 2688c4b..49d9d4a 100644
--- a/Mozo/util.py
+++ b/Mozo/util.py
@@ -132,7 +132,7 @@ def getUserMenuXml(tree):
def getIcon(item, for_properties=False):
pixbuf, path = None, None
- if item == None:
+ if item is None:
if for_properties:
return None, None
return None
@@ -153,7 +153,7 @@ def getIcon(item, for_properties=False):
path = iconName
except:
pass
- if pixbuf == None:
+ if pixbuf is None:
if for_properties:
return None, None
if item.get_type() == matemenu.TYPE_DIRECTORY:
@@ -165,7 +165,7 @@ def getIcon(item, for_properties=False):
path = icon_theme.lookup_icon(iconName, 24, 0).get_filename()
except:
return None
- if pixbuf == None:
+ if pixbuf is None:
return None
if pixbuf.get_width() != 24 or pixbuf.get_height() != 24:
pixbuf = pixbuf.scale_simple(24, 24, GdkPixbuf.InterpType.HYPER)