Thread changes, small dbl click random issue fix
This commit is contained in:
parent
3c636b3da8
commit
bc085fc4cf
|
@ -17,8 +17,6 @@ class Builtins(DBusControllerMixin):
|
|||
# Where data may be any kind of data
|
||||
self._gui_events = []
|
||||
self._fm_events = []
|
||||
self.monitor_events = True
|
||||
self.keep_ipc_alive = True
|
||||
self.is_ipc_alive = False
|
||||
|
||||
# Makeshift fake "events" type system FIFO
|
||||
|
|
|
@ -33,7 +33,5 @@ if __name__ == "__main__":
|
|||
Main(args, unknownargs)
|
||||
Gtk.main()
|
||||
except Exception as e:
|
||||
print(repr(e))
|
||||
event_system.keep_ipc_alive = False
|
||||
if debug:
|
||||
traceback.print_exc()
|
||||
quit()
|
||||
|
|
|
@ -10,7 +10,7 @@ from . import Window
|
|||
|
||||
def threaded(fn):
|
||||
def wrapper(*args, **kwargs):
|
||||
threading.Thread(target=fn, args=args, kwargs=kwargs).start()
|
||||
threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=True).start()
|
||||
return wrapper
|
||||
|
||||
|
||||
|
@ -28,7 +28,7 @@ class WindowController:
|
|||
|
||||
@threaded
|
||||
def fm_event_observer(self):
|
||||
while event_system.monitor_events:
|
||||
while True:
|
||||
time.sleep(event_sleep_time)
|
||||
event = event_system.consume_fm_event()
|
||||
if event:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# System import
|
||||
import os, subprocess, threading
|
||||
import os, threading, subprocess
|
||||
|
||||
|
||||
# Lib imports
|
||||
|
@ -8,6 +8,12 @@ import os, subprocess, threading
|
|||
# Apoplication imports
|
||||
|
||||
|
||||
def threaded(fn):
|
||||
def wrapper(*args, **kwargs):
|
||||
threading.Thread(target=fn, args=args, kwargs=kwargs).start()
|
||||
return wrapper
|
||||
|
||||
|
||||
class Launcher:
|
||||
def open_file_locally(self, file):
|
||||
lowerName = file.lower()
|
||||
|
@ -43,10 +49,15 @@ class Launcher:
|
|||
if use_os_system:
|
||||
os.system(command)
|
||||
else:
|
||||
# DEVNULL = open(os.devnull, 'w')
|
||||
# subprocess.Popen(command, cwd=start_dir, shell=use_shell, start_new_session=True, stdout=DEVNULL, stderr=DEVNULL, close_fds=True)
|
||||
subprocess.Popen(command, cwd=start_dir, shell=use_shell, start_new_session=True, stdout=None, stderr=None, close_fds=True)
|
||||
|
||||
def execute_and_return_thread_handler(self, command, start_dir=os.getenv("HOME"), use_shell=True):
|
||||
DEVNULL = open(os.devnull, 'w')
|
||||
return subprocess.Popen(command, cwd=start_dir, shell=use_shell, start_new_session=True, stdout=DEVNULL, stderr=DEVNULL, close_fds=True)
|
||||
|
||||
@threaded
|
||||
def app_chooser_exec(self, app_info, uris):
|
||||
app_info.launch_uris_async(uris)
|
||||
|
||||
def remux_video(self, hash, file):
|
||||
remux_vid_pth = self.REMUX_FOLDER + "/" + hash + ".mp4"
|
||||
|
|
|
@ -13,7 +13,7 @@ from . import ShowHideMixin, KeyboardSignalsMixin, Controller_Data
|
|||
|
||||
def threaded(fn):
|
||||
def wrapper(*args, **kwargs):
|
||||
threading.Thread(target=fn, args=args, kwargs=kwargs).start()
|
||||
threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=True).start()
|
||||
return wrapper
|
||||
|
||||
|
||||
|
@ -54,7 +54,7 @@ class Controller(WidgetFileActionMixin, PaneMixin, WindowMixin, ShowHideMixin, \
|
|||
|
||||
@threaded
|
||||
def gui_event_observer(self):
|
||||
while event_system.monitor_events:
|
||||
while True:
|
||||
time.sleep(event_sleep_time)
|
||||
event = event_system.consume_gui_event()
|
||||
if event:
|
||||
|
|
|
@ -9,7 +9,7 @@ from multiprocessing.connection import Listener, Client
|
|||
|
||||
def threaded(fn):
|
||||
def wrapper(*args, **kwargs):
|
||||
threading.Thread(target=fn, args=args, kwargs=kwargs).start()
|
||||
threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=True).start()
|
||||
return wrapper
|
||||
|
||||
|
||||
|
@ -21,7 +21,7 @@ class DBusControllerMixin:
|
|||
def create_ipc_server(self):
|
||||
listener = Listener(('127.0.0.1', 4848), authkey=b'solarfm-ipc')
|
||||
self.is_ipc_alive = True
|
||||
while event_system.keep_ipc_alive:
|
||||
while True:
|
||||
conn = listener.accept()
|
||||
start_time = time.time()
|
||||
|
||||
|
@ -45,7 +45,6 @@ class DBusControllerMixin:
|
|||
break
|
||||
if msg == 'close server':
|
||||
conn.close()
|
||||
event_system.keep_ipc_alive = False
|
||||
break
|
||||
|
||||
# NOTE: Not perfect but insures we don't lockup the connection for too long.
|
||||
|
|
|
@ -87,7 +87,7 @@ class WidgetFileActionMixin:
|
|||
app_info = appchooser_widget.get_app_info()
|
||||
uris = self.format_to_uris(store, wid, tid, self.selected_files)
|
||||
|
||||
app_info.launch_uris_async(uris)
|
||||
view.app_chooser_exec(app_info, uris)
|
||||
|
||||
def execute_files(self, in_terminal=False):
|
||||
wid, tid, view, iconview, store = self.get_current_state()
|
||||
|
|
|
@ -13,7 +13,7 @@ from gi.repository import Gtk, Gdk, GLib, Gio, GdkPixbuf
|
|||
|
||||
def threaded(fn):
|
||||
def wrapper(*args, **kwargs):
|
||||
threading.Thread(target=fn, args=args, kwargs=kwargs).start()
|
||||
threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=True).start()
|
||||
return wrapper
|
||||
|
||||
|
||||
|
|
|
@ -32,19 +32,22 @@ class WindowMixin(TabMixin):
|
|||
if isHidden:
|
||||
self.toggle_notebook_pane(object)
|
||||
|
||||
try:
|
||||
if not self.is_pane4_hidden:
|
||||
widget = self.window4.get_children()[1].get_children()[0]
|
||||
widget.event(Gdk.Event().new(type=Gdk.EventType.BUTTON_RELEASE))
|
||||
icon_view = self.window4.get_children()[1].get_children()[0]
|
||||
icon_view.event(Gdk.Event().new(type=Gdk.EventType.BUTTON_RELEASE))
|
||||
elif not self.is_pane3_hidden:
|
||||
widget = self.window3.get_children()[1].get_children()[0]
|
||||
widget.event(Gdk.Event().new(type=Gdk.EventType.BUTTON_RELEASE))
|
||||
icon_view = self.window3.get_children()[1].get_children()[0]
|
||||
icon_view.event(Gdk.Event().new(type=Gdk.EventType.BUTTON_RELEASE))
|
||||
elif not self.is_pane2_hidden:
|
||||
widget = self.window2.get_children()[1].get_children()[0]
|
||||
widget.event(Gdk.Event().new(type=Gdk.EventType.BUTTON_RELEASE))
|
||||
icon_view = self.window2.get_children()[1].get_children()[0]
|
||||
icon_view.event(Gdk.Event().new(type=Gdk.EventType.BUTTON_RELEASE))
|
||||
elif not self.is_pane1_hidden:
|
||||
widget = self.window1.get_children()[1].get_children()[0]
|
||||
widget.event(Gdk.Event().new(type=Gdk.EventType.BUTTON_RELEASE))
|
||||
|
||||
icon_view = self.window1.get_children()[1].get_children()[0]
|
||||
icon_view.event(Gdk.Event().new(type=Gdk.EventType.BUTTON_RELEASE))
|
||||
except Exception as e:
|
||||
print("\n: The saved session might be missing window data! :\nLocation: ~/.config/solarfm/session.json\nFix: Back it up and delete it to reset.\n")
|
||||
print(repr(e))
|
||||
else:
|
||||
for j in range(0, 4):
|
||||
i = j + 1
|
||||
|
@ -150,8 +153,8 @@ class WindowMixin(TabMixin):
|
|||
dir = view.get_current_directory()
|
||||
file = f"{dir}/{fileName}"
|
||||
|
||||
if isdir(file):
|
||||
view.set_path(file)
|
||||
if isdir(f"{file}/"):
|
||||
view.set_path(f"{file}/")
|
||||
self.update_view(tab_label, view, store, wid, tid)
|
||||
else:
|
||||
self.open_files()
|
||||
|
|
Loading…
Reference in New Issue