reverts and refactors
This commit is contained in:
parent
2c258d470b
commit
f2314500b7
|
@ -18,6 +18,11 @@ class Builtins(IPCServerMixin):
|
|||
self._gui_events = []
|
||||
self._fm_events = []
|
||||
self.is_ipc_alive = False
|
||||
self.ipc_authkey = b'solarfm-ipc'
|
||||
self.ipc_address = '127.0.0.1'
|
||||
self.ipc_port = 4848
|
||||
self.ipc_timeout = 15.0
|
||||
|
||||
|
||||
# Makeshift fake "events" type system FIFO
|
||||
def _pop_gui_event(self):
|
||||
|
|
|
@ -24,7 +24,7 @@ class Path:
|
|||
self.load_directory()
|
||||
|
||||
def pop_from_path(self):
|
||||
if self.path:
|
||||
if len(self.path) > 1:
|
||||
self.path.pop()
|
||||
|
||||
if not self.go_past_home:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Python imports
|
||||
import sys, traceback, threading, signal, inspect, os, time
|
||||
import sys, traceback, threading, inspect, os, time
|
||||
|
||||
# Lib imports
|
||||
import gi
|
||||
|
@ -23,15 +23,10 @@ class Controller(WidgetFileActionMixin, PaneMixin, WindowMixin, ShowHideMixin, \
|
|||
KeyboardSignalsMixin, Controller_Data):
|
||||
def __init__(self, args, unknownargs, _settings):
|
||||
# sys.excepthook = self.custom_except_hook
|
||||
self.settings = _settings
|
||||
self.setup_controller_data()
|
||||
|
||||
self.setup_controller_data(_settings)
|
||||
self.window.show()
|
||||
self.generate_windows(self.state)
|
||||
|
||||
self.window.connect("delete-event", self.tear_down)
|
||||
GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, self.tear_down)
|
||||
|
||||
if not trace_debug:
|
||||
self.gui_event_observer()
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# Python imports
|
||||
import signal
|
||||
|
||||
# Lib imports
|
||||
from gi.repository import GLib
|
||||
|
@ -14,16 +15,17 @@ class Controller_Data:
|
|||
def has_method(self, o, name):
|
||||
return callable(getattr(o, name, None))
|
||||
|
||||
def setup_controller_data(self):
|
||||
self.window_controller = WindowController()
|
||||
def setup_controller_data(self, _settings):
|
||||
self.trashman = XDGTrash()
|
||||
self.window_controller = WindowController()
|
||||
self.state = self.window_controller.load_state()
|
||||
self.trashman.regenerate()
|
||||
|
||||
self.state = self.window_controller.load_state()
|
||||
self.builder = self.settings.builder
|
||||
self.logger = self.settings.logger
|
||||
self.settings = _settings
|
||||
self.builder = self.settings.get_builder()
|
||||
self.logger = self.settings.get_logger()
|
||||
|
||||
self.window = self.settings.getMainWindow()
|
||||
self.window = self.settings.get_main_window()
|
||||
self.window1 = self.builder.get_object("window_1")
|
||||
self.window2 = self.builder.get_object("window_2")
|
||||
self.window3 = self.builder.get_object("window_3")
|
||||
|
@ -99,3 +101,7 @@ class Controller_Data:
|
|||
self.success = "#88cc27"
|
||||
self.warning = "#ffa800"
|
||||
self.error = "#ff0000"
|
||||
|
||||
|
||||
self.window.connect("delete-event", self.tear_down)
|
||||
GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, self.tear_down)
|
||||
|
|
|
@ -19,7 +19,7 @@ class IPCServerMixin:
|
|||
|
||||
@threaded
|
||||
def create_ipc_server(self):
|
||||
listener = Listener(('127.0.0.1', 4848), authkey=b'solarfm-ipc')
|
||||
listener = Listener((self.ipc_address, self.ipc_port), authkey=self.ipc_authkey)
|
||||
self.is_ipc_alive = True
|
||||
while True:
|
||||
conn = listener.accept()
|
||||
|
@ -49,7 +49,7 @@ class IPCServerMixin:
|
|||
|
||||
# NOTE: Not perfect but insures we don't lockup the connection for too long.
|
||||
end_time = time.time()
|
||||
if (end - start) > 15.0:
|
||||
if (end - start) > self.ipc_timeout:
|
||||
conn.close()
|
||||
|
||||
listener.close()
|
||||
|
@ -57,7 +57,7 @@ class IPCServerMixin:
|
|||
|
||||
def send_ipc_message(self, message="Empty Data..."):
|
||||
try:
|
||||
conn = Client(('127.0.0.1', 4848), authkey=b'solarfm-ipc')
|
||||
conn = Client((self.ipc_address, self.ipc_port), authkey=self.ipc_authkey)
|
||||
conn.send(message)
|
||||
conn.send('close connection')
|
||||
except Exception as e:
|
||||
|
|
|
@ -232,9 +232,6 @@ class WidgetFileActionMixin:
|
|||
target = f"{view.get_current_directory()}"
|
||||
|
||||
if file_name:
|
||||
if len(target) == 1:
|
||||
path = f"{target}{file_name}"
|
||||
else:
|
||||
path = f"{target}/{file_name}"
|
||||
|
||||
if type == True: # Create File
|
||||
|
|
|
@ -101,11 +101,16 @@ class WindowMixin(TabMixin):
|
|||
uris = self.format_to_uris(store, _wid, _tid, selected_files, True)
|
||||
combined_size = 0
|
||||
for uri in uris:
|
||||
try:
|
||||
file_info = Gio.File.new_for_path(uri).query_info(attributes="standard::size",
|
||||
flags=Gio.FileQueryInfoFlags.NONE,
|
||||
cancellable=None)
|
||||
file_size = file_info.get_size()
|
||||
combined_size += file_size
|
||||
except Exception as e:
|
||||
if debug:
|
||||
print(repr(e))
|
||||
|
||||
|
||||
formatted_size = self.sizeof_fmt(combined_size)
|
||||
if view.hide_hidden:
|
||||
|
|
|
@ -72,7 +72,9 @@ class Settings:
|
|||
cr.paint()
|
||||
cr.set_operator(cairo.OPERATOR_OVER)
|
||||
|
||||
def getMainWindow(self): return self.main_window
|
||||
def get_builder(self): return self.builder
|
||||
def get_logger(self): return self.logger
|
||||
def get_main_window(self): return self.main_window
|
||||
|
||||
|
||||
def getMonitorData(self):
|
||||
|
|
Loading…
Reference in New Issue