Added initial status bottom bar info

This commit is contained in:
itdominator 2021-11-27 22:03:00 -06:00
parent 2ea9768d27
commit 96f3ba0735
6 changed files with 97 additions and 4 deletions

View File

@ -1333,7 +1333,56 @@ PyFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspecti
</packing> </packing>
</child> </child>
<child> <child>
<placeholder/> <object class="GtkStatusbar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-left">10</property>
<property name="margin-right">10</property>
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="spacing">15</property>
<property name="baseline-position">top</property>
<child>
<object class="GtkLabel" id="bottom_size_label">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="bottom_file_count_label">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="bottom_path_label">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child> </child>
</object> </object>
</child> </child>

View File

@ -31,6 +31,7 @@ class View(Settings, FileHandler, Launcher, Icon, Path):
self.images = [] self.images = []
self.desktop = [] self.desktop = []
self.ungrouped = [] self.ungrouped = []
self.hidden = []
self.generate_id() self.generate_id()
self.set_to_home() self.set_to_home()
@ -66,6 +67,7 @@ class View(Settings, FileHandler, Launcher, Icon, Path):
self.images = [] self.images = []
self.desktop = [] self.desktop = []
self.ungrouped = [] self.ungrouped = []
self.hidden = []
self.files = [] self.files = []
if not isdir(path): if not isdir(path):
@ -76,6 +78,7 @@ class View(Settings, FileHandler, Launcher, Icon, Path):
file = join(path, f) file = join(path, f)
if self.hide_hidden: if self.hide_hidden:
if f.startswith('.'): if f.startswith('.'):
self.hidden.append(f)
continue continue
if isfile(file): if isfile(file):
@ -125,7 +128,19 @@ class View(Settings, FileHandler, Launcher, Icon, Path):
return False return False
def get_not_hidden_count(self):
return len(self.files) + \
len(self.dirs) + \
len(self.vids) + \
len(self.images) + \
len(self.desktop) + \
len(self.ungrouped)
def get_hidden_count(self):
return len(self.hidden)
def get_files_count(self):
return len(self.files)
def get_path_part_from_hash(self, hash): def get_path_part_from_hash(self, hash):
files = self.get_files() files = self.get_files()

View File

@ -25,6 +25,10 @@ class Controller_Data:
self.message_widget = self.builder.get_object("message_widget") self.message_widget = self.builder.get_object("message_widget")
self.message_label = self.builder.get_object("message_label") self.message_label = self.builder.get_object("message_label")
self.bottom_size_label = self.builder.get_object("bottom_size_label")
self.bottom_file_count_label = self.builder.get_object("bottom_file_count_label")
self.bottom_path_label = self.builder.get_object("bottom_path_label")
self.notebooks = [self.window1, self.window2, self.window3, self.window4] self.notebooks = [self.window1, self.window2, self.window3, self.window4]
self.selected_files = [] self.selected_files = []
self.to_rename_files = [] self.to_rename_files = []

View File

@ -1,5 +1,5 @@
# Python imports # Python imports
import threading, socket import threading, socket, time
from multiprocessing.connection import Listener, Client from multiprocessing.connection import Listener, Client
# Gtk imports # Gtk imports
@ -21,6 +21,8 @@ class DBusControllerMixin:
self.is_ipc_alive = True self.is_ipc_alive = True
while event_system.keep_ipc_alive: while event_system.keep_ipc_alive:
conn = listener.accept() conn = listener.accept()
start_time = time.time()
print(f"New Connection: {listener.last_accepted}") print(f"New Connection: {listener.last_accepted}")
while True: while True:
msg = conn.recv() msg = conn.recv()
@ -43,6 +45,12 @@ class DBusControllerMixin:
conn.close() conn.close()
event_system.keep_ipc_alive = False event_system.keep_ipc_alive = False
break break
# NOTE: Not perfect but insures we don't lockup the connection for too long.
end_time = time.time()
if (end - start) > 15.0:
conn.close()
listener.close() listener.close()

View File

@ -42,6 +42,7 @@ class WidgetFileActionMixin:
view.load_directory() view.load_directory()
self.load_store(view, store) self.load_store(view, store)
tab_label.set_label(view.get_end_of_path()) tab_label.set_label(view.get_end_of_path())
self.set_bottom_labels(view)

View File

@ -39,11 +39,25 @@ class WindowMixin(TabMixin):
return uris return uris
def set_bottom_labels(self, view):
self.bottom_size_label.set_label("TBD")
if view.hide_hidden:
if view.get_hidden_count() > 0:
self.bottom_file_count_label.set_label(f"{view.get_not_hidden_count()} visible ({view.get_hidden_count()} hidden)")
else:
self.bottom_file_count_label.set_label(f"{view.get_files_count()} items")
else:
self.bottom_file_count_label.set_label(f"{view.get_files_count()} items")
self.bottom_path_label.set_label(view.get_current_directory())
def set_window_title(self): def set_window_title(self):
wid, tid = self.window_controller.get_active_data() wid, tid = self.window_controller.get_active_data()
view = self.get_fm_window(wid).get_view_by_id(tid) view = self.get_fm_window(wid).get_view_by_id(tid)
dir = view.get_current_directory() dir = view.get_current_directory()
self.window.set_title("PyFM ~ " + dir) self.window.set_title("PyFM ~ " + dir)
self.set_bottom_labels(view)
def set_path_text(self, wid, tid): def set_path_text(self, wid, tid):
path_entry = self.builder.get_object("path_entry") path_entry = self.builder.get_object("path_entry")
@ -68,6 +82,7 @@ class WindowMixin(TabMixin):
except Exception as e: except Exception as e:
print(repr(e)) print(repr(e))
self.display_message(self.error, f"{repr(e)}")
def grid_icon_double_left_click(self, iconview, item, data=None): def grid_icon_double_left_click(self, iconview, item, data=None):
try: try:
@ -95,8 +110,9 @@ class WindowMixin(TabMixin):
tab_label.set_label(view.get_end_of_path()) tab_label.set_label(view.get_end_of_path())
path_entry.set_text(view.get_current_directory()) path_entry.set_text(view.get_current_directory())
self.set_file_watcher(view) self.set_file_watcher(view)
self.set_bottom_labels(view)
except Exception as e: except Exception as e:
print(repr(e)) self.display_message(self.error, f"{repr(e)}")