diff options
author | Jasper St. Pierre <[email protected]> | 2012-06-01 00:52:54 -0400 |
---|---|---|
committer | Alexei Sorokin <[email protected]> | 2016-08-22 23:03:32 +0300 |
commit | ceb6c512c613a5e1c8e1ee3bf744a5725bd58751 (patch) | |
tree | 10652f051268b604eaf8e3ef743d0863baf0a5cd /Mozo/MenuEditor.py | |
parent | 870210e6ed51a47e3054026d92cc712381353b46 (diff) | |
download | mozo-ceb6c512c613a5e1c8e1ee3bf744a5725bd58751.tar.bz2 mozo-ceb6c512c613a5e1c8e1ee3bf744a5725bd58751.tar.xz |
move revert item code close together
quick organizational commit
Diffstat (limited to 'Mozo/MenuEditor.py')
-rw-r--r-- | Mozo/MenuEditor.py | 50 |
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([]) |