added methods, added example, removed pre creates
This commit is contained in:
parent
288ed41b58
commit
3686034ac7
|
@ -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()
|
|
@ -4,7 +4,6 @@ from . import Window
|
||||||
class WindowController:
|
class WindowController:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.windows = []
|
self.windows = []
|
||||||
self.add_window()
|
|
||||||
|
|
||||||
def get_window(self, win_id):
|
def get_window(self, win_id):
|
||||||
for window in self.windows:
|
for window in self.windows:
|
||||||
|
@ -20,7 +19,6 @@ class WindowController:
|
||||||
window = Window()
|
window = Window()
|
||||||
window.id = len(self.windows) + 1
|
window.id = len(self.windows) + 1
|
||||||
window.name = "window_" + str(window.id)
|
window.name = "window_" + str(window.id)
|
||||||
window.create_view()
|
|
||||||
self.windows.append(window)
|
self.windows.append(window)
|
||||||
|
|
||||||
def add_view_for_window(self, win_id):
|
def add_view_for_window(self, win_id):
|
||||||
|
@ -54,13 +52,18 @@ class WindowController:
|
||||||
print("View Count: " + str( len(window.views) ))
|
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:
|
for window in self.windows:
|
||||||
if window.id == win_id:
|
if window.id == win_id:
|
||||||
for view in window.views:
|
for view in window.views:
|
||||||
print(view.files)
|
print(view.files)
|
||||||
break
|
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):
|
def return_views_from_window(self, win_id):
|
||||||
for window in self.windows:
|
for window in self.windows:
|
||||||
if window.id == win_id:
|
if window.id == win_id:
|
||||||
|
|
Loading…
Reference in New Issue