summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper St. Pierre <[email protected]>2012-06-01 00:52:54 -0400
committerAlexei Sorokin <[email protected]>2016-08-22 23:03:32 +0300
commitceb6c512c613a5e1c8e1ee3bf744a5725bd58751 (patch)
tree10652f051268b604eaf8e3ef743d0863baf0a5cd
parent870210e6ed51a47e3054026d92cc712381353b46 (diff)
downloadmozo-ceb6c512c613a5e1c8e1ee3bf744a5725bd58751.tar.bz2
mozo-ceb6c512c613a5e1c8e1ee3bf744a5725bd58751.tar.xz
move revert item code close together
quick organizational commit
-rw-r--r--Mozo/MenuEditor.py50
1 files changed, 25 insertions, 25 deletions
diff --git a/Mozo/MenuEditor.py b/Mozo/MenuEditor.py
index f6068b5..a8e960a 100644
--- a/Mozo/MenuEditor.py
+++ b/Mozo/MenuEditor.py
@@ -110,6 +110,31 @@ class MenuEditor:
self.revertItem(child)
self.revertMenu(menu)
+ def revertItem(self, item):
+ if not self.canRevert(item):
+ return
+ self.__addUndo([item,])
+ try:
+ os.remove(item.get_desktop_file_path())
+ except OSError:
+ pass
+ self.save()
+
+ def revertMenu(self, menu):
+ if not self.canRevert(menu):
+ return
+ #wtf happened here? oh well, just bail
+ if not menu.get_desktop_file_path():
+ return
+ self.__addUndo([menu,])
+ file_id = os.path.split(menu.get_desktop_file_path())[1]
+ path = os.path.join(util.getUserDirectoryPath(), file_id)
+ try:
+ os.remove(path)
+ except OSError:
+ pass
+ self.save()
+
def undo(self):
if len(self.__undo) == 0:
return
@@ -372,31 +397,6 @@ class MenuEditor:
self.__addUndo([self.__getMenu(item.get_parent()),])
self.save()
- def revertItem(self, item):
- if not self.canRevert(item):
- return
- self.__addUndo([item,])
- try:
- os.remove(item.get_desktop_file_path())
- except OSError:
- pass
- self.save()
-
- def revertMenu(self, menu):
- if not self.canRevert(menu):
- return
- #wtf happened here? oh well, just bail
- if not menu.get_desktop_file_path():
- return
- self.__addUndo([menu,])
- file_id = os.path.split(menu.get_desktop_file_path())[1]
- path = os.path.join(util.getUserDirectoryPath(), file_id)
- try:
- os.remove(path)
- except OSError:
- pass
- self.save()
-
#private stuff
def __addUndo(self, items):
self.__undo.append([])