Changing out threading for some sections; added 2 new tab option
This commit is contained in:
parent
d936b17429
commit
9336df2afa
@ -135,6 +135,8 @@ class Controller(UIMixin, SignalsMixins, Controller_Data):
|
|||||||
event_system.emit("open_files")
|
event_system.emit("open_files")
|
||||||
if action == "open_with":
|
if action == "open_with":
|
||||||
event_system.emit("show_appchooser_menu")
|
event_system.emit("show_appchooser_menu")
|
||||||
|
if action == "open_2_new_tab":
|
||||||
|
event_system.emit("open_2_new_tab")
|
||||||
if action == "execute":
|
if action == "execute":
|
||||||
event_system.emit("execute_files")
|
event_system.emit("execute_files")
|
||||||
if action == "execute_in_terminal":
|
if action == "execute_in_terminal":
|
||||||
|
@ -40,6 +40,7 @@ class FileSystemActions(HandlerMixin, CRUDMixin):
|
|||||||
|
|
||||||
event_system.subscribe("open_files", self.open_files)
|
event_system.subscribe("open_files", self.open_files)
|
||||||
event_system.subscribe("open_with_files", self.open_with_files)
|
event_system.subscribe("open_with_files", self.open_with_files)
|
||||||
|
event_system.subscribe("open_2_new_tab", self.open_2_new_tab)
|
||||||
event_system.subscribe("execute_files", self.execute_files)
|
event_system.subscribe("execute_files", self.execute_files)
|
||||||
|
|
||||||
event_system.subscribe("cut_files", self.cut_files)
|
event_system.subscribe("cut_files", self.cut_files)
|
||||||
@ -104,6 +105,12 @@ class FileSystemActions(HandlerMixin, CRUDMixin):
|
|||||||
|
|
||||||
state.tab.app_chooser_exec(app_info, uris)
|
state.tab.app_chooser_exec(app_info, uris)
|
||||||
|
|
||||||
|
def open_2_new_tab(self):
|
||||||
|
state = event_system.emit_and_await("get_current_state")
|
||||||
|
uri = state.uris[0]
|
||||||
|
message = f"FILE|{uri}"
|
||||||
|
logger.info(message)
|
||||||
|
event_system.emit("post_file_to_ipc", message)
|
||||||
|
|
||||||
def execute_files(self, in_terminal=False):
|
def execute_files(self, in_terminal=False):
|
||||||
state = event_system.emit_and_await("get_current_state")
|
state = event_system.emit_and_await("get_current_state")
|
||||||
|
@ -48,7 +48,7 @@ class FileActionSignalsMixin:
|
|||||||
else:
|
else:
|
||||||
self.soft_lock_countdown(data[0])
|
self.soft_lock_countdown(data[0])
|
||||||
|
|
||||||
@threaded
|
@daemon_threaded
|
||||||
def soft_lock_countdown(self, tab_widget):
|
def soft_lock_countdown(self, tab_widget):
|
||||||
self.soft_update_lock[tab_widget] = { "last_update_time": time.time()}
|
self.soft_update_lock[tab_widget] = { "last_update_time": time.time()}
|
||||||
|
|
||||||
|
@ -26,13 +26,13 @@ class GridMixin:
|
|||||||
store.append([None, file[0]])
|
store.append([None, file[0]])
|
||||||
|
|
||||||
Gtk.main_iteration()
|
Gtk.main_iteration()
|
||||||
thread = self.generate_icons(tab, store, dir, files)
|
GLib.Thread("", self.generate_icons, tab, store, dir, files)
|
||||||
|
|
||||||
# NOTE: Not likely called often from here but it could be useful
|
# NOTE: Not likely called often from here but it could be useful
|
||||||
if save_state and not trace_debug:
|
if save_state and not trace_debug:
|
||||||
self.fm_controller.save_state()
|
self.fm_controller.save_state()
|
||||||
|
|
||||||
@daemon_threaded
|
|
||||||
def generate_icons(self, tab, store, dir, files):
|
def generate_icons(self, tab, store, dir, files):
|
||||||
try:
|
try:
|
||||||
loop = asyncio.get_running_loop()
|
loop = asyncio.get_running_loop()
|
||||||
@ -47,6 +47,7 @@ class GridMixin:
|
|||||||
async def create_icons(self, tab, store, dir, files):
|
async def create_icons(self, tab, store, dir, files):
|
||||||
tasks = [self.update_store(i, store, dir, tab, file[0]) for i, file in enumerate(files)]
|
tasks = [self.update_store(i, store, dir, tab, file[0]) for i, file in enumerate(files)]
|
||||||
await asyncio.gather(*tasks)
|
await asyncio.gather(*tasks)
|
||||||
|
GLib.idle_add(Gtk.main_iteration)
|
||||||
|
|
||||||
async def update_store(self, i, store, dir, tab, file):
|
async def update_store(self, i, store, dir, tab, file):
|
||||||
icon = tab.create_icon(dir, file)
|
icon = tab.create_icon(dir, file)
|
||||||
|
@ -6,6 +6,7 @@ gi.require_version('Gtk', '3.0')
|
|||||||
gi.require_version('Gdk', '3.0')
|
gi.require_version('Gdk', '3.0')
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
from gi.repository import Gdk
|
from gi.repository import Gdk
|
||||||
|
from gi.repository import GLib
|
||||||
|
|
||||||
# Application imports
|
# Application imports
|
||||||
from .mixins.ui.pane_mixin import PaneMixin
|
from .mixins.ui.pane_mixin import PaneMixin
|
||||||
@ -37,14 +38,12 @@ class UIMixin(PaneMixin, WindowMixin):
|
|||||||
event_system.emit("load_files_view_state", (nickname, tabs, isHidden))
|
event_system.emit("load_files_view_state", (nickname, tabs, isHidden))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@daemon_threaded
|
|
||||||
def _focus_last_visible_notebook(self, icon_grid):
|
def _focus_last_visible_notebook(self, icon_grid):
|
||||||
import time
|
import time
|
||||||
|
|
||||||
window = settings_manager.get_main_window()
|
window = settings_manager.get_main_window()
|
||||||
while not window.is_visible() and not window.get_realized():
|
while not window.is_visible() and not window.get_realized():
|
||||||
time.sleep(0.1)
|
time.sleep(0.2)
|
||||||
|
|
||||||
icon_grid.event(Gdk.Event().new(type = Gdk.EventType.BUTTON_RELEASE))
|
icon_grid.event(Gdk.Event().new(type = Gdk.EventType.BUTTON_RELEASE))
|
||||||
|
|
||||||
@ -79,7 +78,7 @@ class UIMixin(PaneMixin, WindowMixin):
|
|||||||
|
|
||||||
scroll_win = notebook.get_children()[-1]
|
scroll_win = notebook.get_children()[-1]
|
||||||
icon_grid = scroll_win.get_children()[0]
|
icon_grid = scroll_win.get_children()[0]
|
||||||
self._focus_last_visible_notebook(icon_grid)
|
GLib.Thread("", self._focus_last_visible_notebook, icon_grid)
|
||||||
except UIMixinException as e:
|
except UIMixinException as e:
|
||||||
logger.info("\n: The saved session might be missing window data! :\nLocation: ~/.config/solarfm/session.json\nFix: Back it up and delete it to reset.\n")
|
logger.info("\n: The saved session might be missing window data! :\nLocation: ~/.config/solarfm/session.json\nFix: Back it up and delete it to reset.\n")
|
||||||
logger.debug(repr(e))
|
logger.debug(repr(e))
|
||||||
|
@ -26,13 +26,12 @@ class GridMixin:
|
|||||||
store.append([None, file[0]])
|
store.append([None, file[0]])
|
||||||
|
|
||||||
Gtk.main_iteration()
|
Gtk.main_iteration()
|
||||||
thread = self.generate_icons(tab, store, dir, files)
|
GLib.Thread("", self.generate_icons, tab, store, dir, files)
|
||||||
|
|
||||||
# NOTE: Not likely called often from here but it could be useful
|
# NOTE: Not likely called often from here but it could be useful
|
||||||
if save_state and not trace_debug:
|
if save_state and not trace_debug:
|
||||||
self.fm_controller.save_state()
|
self.fm_controller.save_state()
|
||||||
|
|
||||||
@daemon_threaded
|
|
||||||
def generate_icons(self, tab, store, dir, files):
|
def generate_icons(self, tab, store, dir, files):
|
||||||
try:
|
try:
|
||||||
loop = asyncio.get_running_loop()
|
loop = asyncio.get_running_loop()
|
||||||
|
@ -50,8 +50,8 @@ class Icon(DesktopIconMixin, VideoIconMixin, MeshsIconMixin):
|
|||||||
|
|
||||||
if not thumbnl:
|
if not thumbnl:
|
||||||
# TODO: Detect if not in a thread and use directly for speed get_system_thumbnail
|
# TODO: Detect if not in a thread and use directly for speed get_system_thumbnail
|
||||||
thumbnl = self.get_system_thumbnail(full_path, self.sys_icon_wh[0])
|
# thumbnl = self.get_system_thumbnail(full_path, self.sys_icon_wh[0])
|
||||||
# thumbnl = self._get_system_thumbnail_gtk_thread(full_path, self.sys_icon_wh[0])
|
thumbnl = self._get_system_thumbnail_gtk_thread(full_path, self.sys_icon_wh[0])
|
||||||
if not thumbnl:
|
if not thumbnl:
|
||||||
raise IconException("No known icons found.")
|
raise IconException("No known icons found.")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user