From e9bd2440b7e4a07ea6a4db29ff4afe9a322a9982 Mon Sep 17 00:00:00 2001 From: itdominator <1itdominator@gmail.com> Date: Tue, 27 Apr 2021 22:09:21 -0500 Subject: [PATCH] name consistency and method placement changes --- src/shellfm/windows/WindowController.py | 2 +- src/shellfm/windows/view/Path.py | 6 ++-- src/shellfm/windows/view/View.py | 37 +++++++++++++------------ 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/shellfm/windows/WindowController.py b/src/shellfm/windows/WindowController.py index feed957..4d82114 100644 --- a/src/shellfm/windows/WindowController.py +++ b/src/shellfm/windows/WindowController.py @@ -119,7 +119,7 @@ class WindowController: if window.id == win_id: return window.get_views_count() - def return_views_from_window(self, win_id): + def get_views_from_window(self, win_id): for window in self.windows: if window.id == win_id: return window.get_all_views() diff --git a/src/shellfm/windows/view/Path.py b/src/shellfm/windows/view/Path.py index 5d46fbd..986dda8 100644 --- a/src/shellfm/windows/view/Path.py +++ b/src/shellfm/windows/view/Path.py @@ -7,6 +7,9 @@ import os class Path: + def get_home(self): + return os.path.expanduser("~") + self.subpath + def get_path(self): return "/" + "/".join(self.path) @@ -41,6 +44,3 @@ class Path: path = list( filter(None, home.replace("\\", "/").split('/')) ) self.path = path self.load_directory() - - def get_home(self): - return os.path.expanduser("~") + self.subpath diff --git a/src/shellfm/windows/view/View.py b/src/shellfm/windows/view/View.py index f5800a2..1437e4b 100644 --- a/src/shellfm/windows/view/View.py +++ b/src/shellfm/windows/view/View.py @@ -91,6 +91,25 @@ class View(Settings, Launcher, Icon, Path): data.append([arr, self.hash_text(arr)]) return data + def is_folder_locked(self, hash): + if self.lock_folder: + path_parts = self.get_path().split('/') + file = self.get_path_part_from_hash(hash) + + # Insure chilren folders are locked too. + lockedFolderInPath = False + for folder in self.locked_folders: + if folder in path_parts: + lockedFolderInPath = True + break + + return (file in self.locked_folders or lockedFolderInPath) + else: + return False + + + + def get_path_part_from_hash(self, hash): files = self.get_files() file = None @@ -122,24 +141,6 @@ class View(Settings, Launcher, Icon, Path): } } - def is_folder_locked(self, hash): - if self.lock_folder: - path_parts = self.get_path().split('/') - file = self.get_path_part_from_hash(hash) - - # Insure chilren folders are locked too. - lockedFolderInPath = False - for folder in self.locked_folders: - if folder in path_parts: - lockedFolderInPath = True - break - - return (file in self.locked_folders or lockedFolderInPath) - else: - return False - - - def get_pixbuf_icon_str_combo(self): data = [] dir = self.get_current_directory()