Merge Stable Changesto Master #9
|
@ -81,8 +81,12 @@ class Plugin(PluginBase):
|
||||||
self._archiver_dialogue = self._builder.get_object("archiver_dialogue")
|
self._archiver_dialogue = self._builder.get_object("archiver_dialogue")
|
||||||
self._arc_command_buffer = self._builder.get_object("arc_command_buffer")
|
self._arc_command_buffer = self._builder.get_object("arc_command_buffer")
|
||||||
|
|
||||||
|
icon = Gtk.Image(stock=Gtk.STOCK_FLOPPY)
|
||||||
button = Gtk.Button(label=self.name)
|
button = Gtk.Button(label=self.name)
|
||||||
|
|
||||||
|
button.set_image(icon)
|
||||||
button.connect("button-release-event", self.show_archiver_dialogue)
|
button.connect("button-release-event", self.show_archiver_dialogue)
|
||||||
|
|
||||||
return button
|
return button
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
|
@ -99,8 +99,12 @@ class Plugin(PluginBase):
|
||||||
self._file_group = self._builder.get_object("file_group")
|
self._file_group = self._builder.get_object("file_group")
|
||||||
|
|
||||||
def generate_reference_ui_element(self):
|
def generate_reference_ui_element(self):
|
||||||
|
icon = Gtk.Image(stock=Gtk.STOCK_PROPERTIES )
|
||||||
button = Gtk.Button(label=self.name)
|
button = Gtk.Button(label=self.name)
|
||||||
|
|
||||||
button.connect("button-release-event", self._show_properties_page)
|
button.connect("button-release-event", self._show_properties_page)
|
||||||
|
button.set_image(icon)
|
||||||
|
|
||||||
return button
|
return button
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -70,8 +70,12 @@ class Plugin(PluginBase):
|
||||||
self._trailer_link = self._builder.get_object("trailer_link")
|
self._trailer_link = self._builder.get_object("trailer_link")
|
||||||
|
|
||||||
def generate_reference_ui_element(self):
|
def generate_reference_ui_element(self):
|
||||||
|
icon = Gtk.Image(stock=Gtk.STOCK_FIND)
|
||||||
button = Gtk.Button(label=self.name)
|
button = Gtk.Button(label=self.name)
|
||||||
|
|
||||||
button.connect("button-release-event", self._show_info_page)
|
button.connect("button-release-event", self._show_info_page)
|
||||||
|
button.set_image(icon)
|
||||||
|
|
||||||
return button
|
return button
|
||||||
|
|
||||||
@threaded
|
@threaded
|
||||||
|
|
|
@ -49,8 +49,8 @@ class FileSearchMixin:
|
||||||
GLib.idle_add(self.reset_file_list_box)
|
GLib.idle_add(self.reset_file_list_box)
|
||||||
|
|
||||||
# NOTE: If query create new process and do all new loop.
|
# NOTE: If query create new process and do all new loop.
|
||||||
self.pause_fifo_update = False
|
|
||||||
if query:
|
if query:
|
||||||
|
self.pause_fifo_update = False
|
||||||
GLib.idle_add(self._exec_find_file_query, query)
|
GLib.idle_add(self._exec_find_file_query, query)
|
||||||
|
|
||||||
def _exec_find_file_query(self, widget=None, eve=None):
|
def _exec_find_file_query(self, widget=None, eve=None):
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# Python imports
|
# Python imports
|
||||||
import threading, subprocess, signal, json, shlex
|
import ctypes, threading, subprocess, signal, json, shlex
|
||||||
|
libgcc_s = ctypes.CDLL('libgcc_s.so.1')
|
||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
import gi
|
import gi
|
||||||
|
@ -49,8 +50,8 @@ class GrepSearchMixin:
|
||||||
GLib.idle_add(self.reset_grep_box)
|
GLib.idle_add(self.reset_grep_box)
|
||||||
|
|
||||||
# NOTE: If query create new process and do all new loop.
|
# NOTE: If query create new process and do all new loop.
|
||||||
self.pause_fifo_update = False
|
|
||||||
if query:
|
if query:
|
||||||
|
self.pause_fifo_update = False
|
||||||
GLib.idle_add(self._exec_grep_query, query)
|
GLib.idle_add(self._exec_grep_query, query)
|
||||||
|
|
||||||
def _exec_grep_query(self, widget=None, eve=None):
|
def _exec_grep_query(self, widget=None, eve=None):
|
||||||
|
|
|
@ -80,8 +80,12 @@ class Plugin(IPCServer, FileSearchMixin, GrepSearchMixin, PluginBase):
|
||||||
self.create_ipc_listener()
|
self.create_ipc_listener()
|
||||||
|
|
||||||
def generate_reference_ui_element(self):
|
def generate_reference_ui_element(self):
|
||||||
|
icon = Gtk.Image(stock=Gtk.STOCK_FIND)
|
||||||
button = Gtk.Button(label=self.name)
|
button = Gtk.Button(label=self.name)
|
||||||
|
|
||||||
button.connect("button-release-event", self._show_page)
|
button.connect("button-release-event", self._show_page)
|
||||||
|
button.set_image(icon)
|
||||||
|
|
||||||
return button
|
return button
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,9 @@ from multiprocessing.connection import Client
|
||||||
_ipc_address = f'/tmp/solarfm-search_grep-ipc.sock'
|
_ipc_address = f'/tmp/solarfm-search_grep-ipc.sock'
|
||||||
_ipc_authkey = b'' + bytes(f'solarfm-search_grep-ipc', 'utf-8')
|
_ipc_authkey = b'' + bytes(f'solarfm-search_grep-ipc', 'utf-8')
|
||||||
|
|
||||||
filter = (".mkv", ".mp4", ".webm", ".avi", ".mov", ".m4v", ".mpg", ".mpeg", ".wmv", ".flv") + \
|
filter = (".cpp", ".css", ".c", ".go", ".html", ".htm", ".java", ".js", ".json", ".lua", ".md", ".py", ".rs", ".toml", ".xml", ".pom") + \
|
||||||
(".png", ".jpg", ".jpeg", ".gif", ".ico", ".tga", ".webp") + \
|
(".txt", ".text", ".sh", ".cfg", ".conf", ".log")
|
||||||
(".psf", ".mp3", ".ogg", ".flac", ".m4a")
|
|
||||||
|
|
||||||
# NOTE: Threads WILL NOT die with parent's destruction.
|
# NOTE: Threads WILL NOT die with parent's destruction.
|
||||||
def threaded(fn):
|
def threaded(fn):
|
||||||
|
@ -59,7 +59,7 @@ def _search_for_string(file, query):
|
||||||
grep_result_set = {}
|
grep_result_set = {}
|
||||||
padding = 15
|
padding = 15
|
||||||
|
|
||||||
with open(file, 'r') as fp:
|
with open(file, 'rb') as fp:
|
||||||
# NOTE: I know there's an issue if there's a very large file with content
|
# NOTE: I know there's an issue if there's a very large file with content
|
||||||
# all on one line will lower and dupe it. And, yes, it will only
|
# all on one line will lower and dupe it. And, yes, it will only
|
||||||
# return one instance from the file.
|
# return one instance from the file.
|
||||||
|
@ -80,7 +80,7 @@ def _search_for_string(file, query):
|
||||||
else:
|
else:
|
||||||
line = raw
|
line = raw
|
||||||
|
|
||||||
b64_line = base64.urlsafe_b64encode(line.encode('utf-8')).decode('utf-8')
|
b64_line = base64.urlsafe_b64encode(line).decode('utf-8')
|
||||||
if f"{b64_file}" in grep_result_set.keys():
|
if f"{b64_file}" in grep_result_set.keys():
|
||||||
grep_result_set[f"{b64_file}"][f"{i+1}"] = b64_line
|
grep_result_set[f"{b64_file}"][f"{i+1}"] = b64_line
|
||||||
else:
|
else:
|
||||||
|
@ -109,7 +109,7 @@ def grep_search(path, query):
|
||||||
if os.path.isdir(target):
|
if os.path.isdir(target):
|
||||||
grep_search(target, query)
|
grep_search(target, query)
|
||||||
else:
|
else:
|
||||||
if not target.lower().endswith(filter):
|
if target.lower().endswith(filter):
|
||||||
size = os.path.getsize(target)
|
size = os.path.getsize(target)
|
||||||
if not size > 5000:
|
if not size > 5000:
|
||||||
_search_for_string(target, query)
|
_search_for_string(target, query)
|
||||||
|
@ -125,7 +125,7 @@ def search(args):
|
||||||
file_search(args.dir, args.query.lower())
|
file_search(args.dir, args.query.lower())
|
||||||
|
|
||||||
if args.type == "grep_search":
|
if args.type == "grep_search":
|
||||||
grep_search(args.dir, args.query.lower())
|
grep_search(args.dir, args.query.lower().encode("utf-8"))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
<property name="can-focus">True</property>
|
<property name="can-focus">True</property>
|
||||||
<property name="receives-default">True</property>
|
<property name="receives-default">True</property>
|
||||||
<property name="tooltip-text" translatable="yes">Empty Trash...</property>
|
<property name="tooltip-text" translatable="yes">Empty Trash...</property>
|
||||||
|
<property name="margin-bottom">20</property>
|
||||||
<signal name="button-release-event" handler="empty_trash" swapped="no"/>
|
<signal name="button-release-event" handler="empty_trash" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
@ -63,7 +64,6 @@
|
||||||
<property name="can-focus">True</property>
|
<property name="can-focus">True</property>
|
||||||
<property name="receives-default">True</property>
|
<property name="receives-default">True</property>
|
||||||
<property name="tooltip-text" translatable="yes">Move to Trash...</property>
|
<property name="tooltip-text" translatable="yes">Move to Trash...</property>
|
||||||
<property name="margin-top">20</property>
|
|
||||||
<property name="image">trash_img</property>
|
<property name="image">trash_img</property>
|
||||||
<property name="always-show-image">True</property>
|
<property name="always-show-image">True</property>
|
||||||
<signal name="button-release-event" handler="trash_files" swapped="no"/>
|
<signal name="button-release-event" handler="trash_files" swapped="no"/>
|
||||||
|
|
|
@ -68,8 +68,13 @@ class Plugin(PluginBase):
|
||||||
self._file_hash = self._builder.get_object("file_hash")
|
self._file_hash = self._builder.get_object("file_hash")
|
||||||
|
|
||||||
def generate_reference_ui_element(self):
|
def generate_reference_ui_element(self):
|
||||||
|
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(f"{self.path}/../../icons/video.png", 16, 16, True)
|
||||||
|
icon = Gtk.Image.new_from_pixbuf(pixbuf)
|
||||||
button = Gtk.Button(label=self.name)
|
button = Gtk.Button(label=self.name)
|
||||||
|
|
||||||
|
button.set_image(icon)
|
||||||
button.connect("button-release-event", self._show_thumbnailer_page)
|
button.connect("button-release-event", self._show_thumbnailer_page)
|
||||||
|
|
||||||
return button
|
return button
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
|
||||||
# Python imports
|
# Python imports
|
||||||
import argparse, faulthandler, traceback
|
import argparse, faulthandler, traceback
|
||||||
from setproctitle import setproctitle
|
from setproctitle import setproctitle
|
||||||
|
|
|
@ -54,6 +54,7 @@ class Controller(UIMixin, KeyboardSignalsMixin, IPCSignalsMixin, ExceptionHookMi
|
||||||
if not settings.is_trace_debug():
|
if not settings.is_trace_debug():
|
||||||
self.fm_controller.save_state()
|
self.fm_controller.save_state()
|
||||||
|
|
||||||
|
settings.clear_pid()
|
||||||
time.sleep(event_sleep_time)
|
time.sleep(event_sleep_time)
|
||||||
Gtk.main_quit()
|
Gtk.main_quit()
|
||||||
|
|
||||||
|
|
|
@ -50,13 +50,8 @@ class DesktopIconMixin:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def traverse_icons_folder(self, path, icon):
|
def traverse_icons_folder(self, path, icon):
|
||||||
alt_icon_path = ""
|
|
||||||
|
|
||||||
for (dirpath, dirnames, filenames) in os.walk(path):
|
for (dirpath, dirnames, filenames) in os.walk(path):
|
||||||
for file in filenames:
|
for file in filenames:
|
||||||
appNM = "application-x-" + icon
|
appNM = "application-x-" + icon
|
||||||
if icon in file or appNM in file:
|
if icon in file or appNM in file:
|
||||||
alt_icon_path = dirpath + "/" + file
|
return f"{dirpath}/{file}"
|
||||||
break
|
|
||||||
|
|
||||||
return alt_icon_path
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# System import
|
# System import
|
||||||
import os, threading, subprocess, shlex
|
import os, threading, subprocess
|
||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ class Settings:
|
||||||
FFMPG_THUMBNLR = f"{CONFIG_PATH}/ffmpegthumbnailer" # Thumbnail generator binary
|
FFMPG_THUMBNLR = f"{CONFIG_PATH}/ffmpegthumbnailer" # Thumbnail generator binary
|
||||||
REMUX_FOLDER = f"{USER_HOME}/.remuxs" # Remuxed files folder
|
REMUX_FOLDER = f"{USER_HOME}/.remuxs" # Remuxed files folder
|
||||||
|
|
||||||
ICON_DIRS = ["/usr/share/pixmaps", "/usr/share/icons", f"{USER_HOME}/.icons" ,]
|
ICON_DIRS = ["/usr/share/icons", f"{USER_HOME}/.icons" "/usr/share/pixmaps"]
|
||||||
BASE_THUMBS_PTH = f"{USER_HOME}/.thumbnails" # Used for thumbnail generation
|
BASE_THUMBS_PTH = f"{USER_HOME}/.thumbnails" # Used for thumbnail generation
|
||||||
ABS_THUMBS_PTH = f"{BASE_THUMBS_PTH}/normal" # Used for thumbnail generation
|
ABS_THUMBS_PTH = f"{BASE_THUMBS_PTH}/normal" # Used for thumbnail generation
|
||||||
STEAM_ICONS_PTH = f"{BASE_THUMBS_PTH}/steam_icons"
|
STEAM_ICONS_PTH = f"{BASE_THUMBS_PTH}/steam_icons"
|
||||||
|
|
|
@ -38,8 +38,8 @@ class IPCServer:
|
||||||
@daemon_threaded
|
@daemon_threaded
|
||||||
def create_ipc_listener(self) -> None:
|
def create_ipc_listener(self) -> None:
|
||||||
if self._conn_type == "socket":
|
if self._conn_type == "socket":
|
||||||
if os.path.exists(self._ipc_address):
|
if os.path.exists(self._ipc_address) and settings.is_dirty_start():
|
||||||
return
|
os.unlink(self._ipc_address)
|
||||||
|
|
||||||
listener = Listener(address=self._ipc_address, family="AF_UNIX", authkey=self._ipc_authkey)
|
listener = Listener(address=self._ipc_address, family="AF_UNIX", authkey=self._ipc_authkey)
|
||||||
elif "unsecured" not in self._conn_type:
|
elif "unsecured" not in self._conn_type:
|
||||||
|
|
|
@ -31,6 +31,7 @@ class Settings:
|
||||||
self._KEY_BINDINGS = f"{self._CONFIG_PATH}/key-bindings.json"
|
self._KEY_BINDINGS = f"{self._CONFIG_PATH}/key-bindings.json"
|
||||||
self._DEFAULT_ICONS = f"{self._CONFIG_PATH}/icons"
|
self._DEFAULT_ICONS = f"{self._CONFIG_PATH}/icons"
|
||||||
self._WINDOW_ICON = f"{self._DEFAULT_ICONS}/{app_name.lower()}.png"
|
self._WINDOW_ICON = f"{self._DEFAULT_ICONS}/{app_name.lower()}.png"
|
||||||
|
self._PID_FILE = f"{self._CONFIG_PATH}/solarfm.pid"
|
||||||
self._ICON_THEME = Gtk.IconTheme.get_default()
|
self._ICON_THEME = Gtk.IconTheme.get_default()
|
||||||
|
|
||||||
if not os.path.exists(self._CONFIG_PATH):
|
if not os.path.exists(self._CONFIG_PATH):
|
||||||
|
@ -65,6 +66,44 @@ class Settings:
|
||||||
|
|
||||||
self._trace_debug = False
|
self._trace_debug = False
|
||||||
self._debug = False
|
self._debug = False
|
||||||
|
self._dirty_start = False
|
||||||
|
|
||||||
|
self._check_for_dirty_state()
|
||||||
|
|
||||||
|
|
||||||
|
def _check_for_dirty_state(self):
|
||||||
|
if not os.path.exists(self._PID_FILE):
|
||||||
|
self._write_new_pid()
|
||||||
|
else:
|
||||||
|
with open(self._PID_FILE, "r") as _pid:
|
||||||
|
pid = _pid.readline().strip()
|
||||||
|
if pid not in ("", None):
|
||||||
|
self._check_alive_status(int(pid))
|
||||||
|
else:
|
||||||
|
self._write_new_pid()
|
||||||
|
|
||||||
|
""" Check For the existence of a unix pid. """
|
||||||
|
def _check_alive_status(self, pid):
|
||||||
|
print(f"PID Found: {pid}")
|
||||||
|
try:
|
||||||
|
os.kill(pid, 0)
|
||||||
|
except OSError:
|
||||||
|
print("SolarFM Is starting dirty...")
|
||||||
|
self._dirty_start = True
|
||||||
|
self._write_new_pid()
|
||||||
|
|
||||||
|
print("PID is alive... Let downstream errors handle app closure.")
|
||||||
|
|
||||||
|
def _write_new_pid(self):
|
||||||
|
pid = os.getpid()
|
||||||
|
self._write_pid(pid)
|
||||||
|
|
||||||
|
def _clean_pid(self):
|
||||||
|
os.unlink(self._PID_FILE)
|
||||||
|
|
||||||
|
def _write_pid(self, pid):
|
||||||
|
with open(self._PID_FILE, "w") as _pid:
|
||||||
|
_pid.write(f"{pid}")
|
||||||
|
|
||||||
|
|
||||||
def create_window(self) -> None:
|
def create_window(self) -> None:
|
||||||
|
@ -104,6 +143,7 @@ class Settings:
|
||||||
|
|
||||||
return monitors
|
return monitors
|
||||||
|
|
||||||
|
|
||||||
def get_main_window(self) -> Gtk.ApplicationWindow: return self._main_window
|
def get_main_window(self) -> Gtk.ApplicationWindow: return self._main_window
|
||||||
def get_builder(self) -> Gtk.Builder: return self._builder
|
def get_builder(self) -> Gtk.Builder: return self._builder
|
||||||
def get_logger(self) -> Logger: return self._logger
|
def get_logger(self) -> Logger: return self._logger
|
||||||
|
@ -117,6 +157,8 @@ class Settings:
|
||||||
|
|
||||||
def is_trace_debug(self) -> str: return self._trace_debug
|
def is_trace_debug(self) -> str: return self._trace_debug
|
||||||
def is_debug(self) -> str: return self._debug
|
def is_debug(self) -> str: return self._debug
|
||||||
|
def is_dirty_start(self) -> bool: return self._dirty_start
|
||||||
|
def clear_pid(self): self._clean_pid()
|
||||||
|
|
||||||
|
|
||||||
def set_trace_debug(self, trace_debug):
|
def set_trace_debug(self, trace_debug):
|
||||||
|
|
|
@ -740,23 +740,6 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
|
||||||
<property name="position">4</property>
|
<property name="position">4</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<object class="GtkButton">
|
|
||||||
<property name="label" translatable="yes">Archive</property>
|
|
||||||
<property name="name">archive</property>
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">True</property>
|
|
||||||
<property name="receives-default">True</property>
|
|
||||||
<property name="tooltip-text" translatable="yes">Archive...</property>
|
|
||||||
<property name="always-show-image">True</property>
|
|
||||||
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">5</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child type="label">
|
<child type="label">
|
||||||
|
@ -1079,17 +1062,6 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
|
||||||
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
|
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<object class="GtkImageMenuItem">
|
|
||||||
<property name="label">gtk-delete</property>
|
|
||||||
<property name="name">delete</property>
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
<property name="use-underline">True</property>
|
|
||||||
<property name="use-stock">True</property>
|
|
||||||
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|
Loading…
Reference in New Issue