added methods, added example, removed pre creates

This commit is contained in:
itdominator 2021-04-22 02:07:30 -05:00
parent 288ed41b58
commit 3686034ac7
2 changed files with 25 additions and 3 deletions

19
src/Example.py Normal file
View File

@ -0,0 +1,19 @@
from shellfm import WindowController
def main():
window_controller = WindowController()
# Create "File Window" 1
window_controller.add_window()
window_controller.add_view_for_window(1)
# Create "File Window" 2
window_controller.add_window()
window_controller.add_view_for_window(2)
window_controller.list_windows()
if __name__ == '__main__':
main()

View File

@ -4,7 +4,6 @@ from . import Window
class WindowController:
def __init__(self):
self.windows = []
self.add_window()
def get_window(self, win_id):
for window in self.windows:
@ -20,7 +19,6 @@ class WindowController:
window = Window()
window.id = len(self.windows) + 1
window.name = "window_" + str(window.id)
window.create_view()
self.windows.append(window)
def add_view_for_window(self, win_id):
@ -54,13 +52,18 @@ class WindowController:
print("View Count: " + str( len(window.views) ))
def list_views_from_window(self, win_id):
def list_files_from_views_of_window(self, win_id):
for window in self.windows:
if window.id == win_id:
for view in window.views:
print(view.files)
break
def get_views_count(self, win_id):
for window in self.windows:
if window.id == win_id:
return len(window.views)
def return_views_from_window(self, win_id):
for window in self.windows:
if window.id == win_id: