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>
</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>
</object>
</child>

View File

@ -31,6 +31,7 @@ class View(Settings, FileHandler, Launcher, Icon, Path):
self.images = []
self.desktop = []
self.ungrouped = []
self.hidden = []
self.generate_id()
self.set_to_home()
@ -66,6 +67,7 @@ class View(Settings, FileHandler, Launcher, Icon, Path):
self.images = []
self.desktop = []
self.ungrouped = []
self.hidden = []
self.files = []
if not isdir(path):
@ -76,6 +78,7 @@ class View(Settings, FileHandler, Launcher, Icon, Path):
file = join(path, f)
if self.hide_hidden:
if f.startswith('.'):
self.hidden.append(f)
continue
if isfile(file):
@ -125,7 +128,19 @@ class View(Settings, FileHandler, Launcher, Icon, Path):
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):
files = self.get_files()

View File

@ -25,6 +25,10 @@ class Controller_Data:
self.message_widget = self.builder.get_object("message_widget")
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.selected_files = []
self.to_rename_files = []

View File

@ -1,5 +1,5 @@
# Python imports
import threading, socket
import threading, socket, time
from multiprocessing.connection import Listener, Client
# Gtk imports
@ -20,7 +20,9 @@ class DBusControllerMixin:
listener = Listener(('127.0.0.1', 4848), authkey=b'pyfm-ipc')
self.is_ipc_alive = True
while event_system.keep_ipc_alive:
conn = listener.accept()
conn = listener.accept()
start_time = time.time()
print(f"New Connection: {listener.last_accepted}")
while True:
msg = conn.recv()
@ -43,6 +45,12 @@ class DBusControllerMixin:
conn.close()
event_system.keep_ipc_alive = False
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()

View File

@ -42,6 +42,7 @@ class WidgetFileActionMixin:
view.load_directory()
self.load_store(view, store)
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
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):
wid, tid = self.window_controller.get_active_data()
view = self.get_fm_window(wid).get_view_by_id(tid)
dir = view.get_current_directory()
self.window.set_title("PyFM ~ " + dir)
self.set_bottom_labels(view)
def set_path_text(self, wid, tid):
path_entry = self.builder.get_object("path_entry")
@ -68,6 +82,7 @@ class WindowMixin(TabMixin):
except Exception as e:
print(repr(e))
self.display_message(self.error, f"{repr(e)}")
def grid_icon_double_left_click(self, iconview, item, data=None):
try:
@ -95,8 +110,9 @@ class WindowMixin(TabMixin):
tab_label.set_label(view.get_end_of_path())
path_entry.set_text(view.get_current_directory())
self.set_file_watcher(view)
self.set_bottom_labels(view)
except Exception as e:
print(repr(e))
self.display_message(self.error, f"{repr(e)}")