develop #13

Merged
itdominator merged 5 commits from develop into master 2023-11-12 06:51:24 +00:00
6 changed files with 44 additions and 11 deletions
Showing only changes of commit ce0f45e168 - Show all commits

View File

@ -164,6 +164,8 @@ class Controller(UIMixin, SignalsMixins, Controller_Data):
event_system.emit("show_plugins_popup") event_system.emit("show_plugins_popup")
if action == "messages_popup": if action == "messages_popup":
event_system.emit("show_messages_popup") event_system.emit("show_messages_popup")
if action == "ui_debug":
event_system.emit("load_interactive_debug")
if action == "tear_down": if action == "tear_down":
event_system.emit("tear_down") event_system.emit("tear_down")

View File

@ -55,6 +55,10 @@ class Controller_Data:
self.shift_down = False self.shift_down = False
self.alt_down = False self.alt_down = False
self._state = State()
self.message_dialog = MessageWidget()
self.user_pass_dialog = UserPassWidget()
def get_current_state(self) -> State: def get_current_state(self) -> State:
''' '''
@ -66,7 +70,8 @@ class Controller_Data:
Returns: Returns:
state (obj): State state (obj): State
''' '''
state = State() # state = State()
state = self._state
state.fm_controller = self.fm_controller state.fm_controller = self.fm_controller
state.notebooks = self.notebooks state.notebooks = self.notebooks
state.wid, state.tid = self.fm_controller.get_active_wid_and_tid() state.wid, state.tid = self.fm_controller.get_active_wid_and_tid()
@ -74,8 +79,14 @@ class Controller_Data:
state.icon_grid = self.builder.get_object(f"{state.wid}|{state.tid}|icon_grid", use_gtk = False) state.icon_grid = self.builder.get_object(f"{state.wid}|{state.tid}|icon_grid", use_gtk = False)
# state.icon_grid = event_system.emit_and_await("get_files_view_icon_grid", (state.wid, state.tid)) # state.icon_grid = event_system.emit_and_await("get_files_view_icon_grid", (state.wid, state.tid))
state.store = state.icon_grid.get_model() state.store = state.icon_grid.get_model()
state.message_dialog = MessageWidget()
state.user_pass_dialog = UserPassWidget() # NOTE: Need to watch this as I thought we had issues with just using single reference upon closing it.
# But, I found that not doing it this way caused objects to generate upon every click... (Because we're getting state info, duh)
# Yet interactive debug view shows them just pilling on and never clearing...
state.message_dialog = self.message_dialog
state.user_pass_dialog = self.user_pass_dialog
# state.message_dialog = MessageWidget()
# state.user_pass_dialog = UserPassWidget()
selected_files = state.icon_grid.get_selected_items() selected_files = state.icon_grid.get_selected_items()
if selected_files: if selected_files:

View File

@ -26,14 +26,15 @@ class GridMixin:
store.append([None, file[0]]) store.append([None, file[0]])
Gtk.main_iteration() Gtk.main_iteration()
# for i, file in enumerate(files):
# self.create_icon(i, tab, store, dir, file[0])
if use_generator: if use_generator:
# NOTE: tab > icon > _get_system_thumbnail_gtk_thread must not be used # NOTE: tab > icon > _get_system_thumbnail_gtk_thread must not be used
# as the attempted promotion back to gtk threading stalls the generator. (We're already in main gtk thread) # as the attempted promotion back to gtk threading stalls the generator. (We're already in main gtk thread)
for i, icon in enumerate( self.create_icons_generator(tab, dir, files) ): for i, icon in enumerate( self.create_icons_generator(tab, dir, files) ):
self.load_icon(i, store, icon) self.load_icon(i, store, icon)
else: else:
# for i, file in enumerate(files):
# self.create_icon(i, tab, store, dir, file[0])
try: try:
loop = asyncio.get_running_loop() loop = asyncio.get_running_loop()
except RuntimeError: except RuntimeError:

View File

@ -73,13 +73,9 @@ class TabMixin(GridMixin):
self.builder.dereference_object(f"{wid}|{tid}") self.builder.dereference_object(f"{wid}|{tid}")
store.clear() store.clear()
# store.run_dispose()
icon_grid.destroy() icon_grid.destroy()
# icon_grid.run_dispose()
scroll.destroy() scroll.destroy()
#scroll.run_dispose()
tab_box.destroy() tab_box.destroy()
# tab_box.run_dispose()
del store del store
del icon_grid del icon_grid

View File

@ -53,6 +53,7 @@ class Window(Gtk.ApplicationWindow):
def _subscribe_to_events(self): def _subscribe_to_events(self):
event_system.subscribe("tear_down", self._tear_down) event_system.subscribe("tear_down", self._tear_down)
event_system.subscribe("load_interactive_debug", self._load_interactive_debug)
def _load_widgets(self, args, unknownargs): def _load_widgets(self, args, unknownargs):
if settings_manager.is_debug(): if settings_manager.is_debug():
@ -87,6 +88,9 @@ class Window(Gtk.ApplicationWindow):
cr.paint() cr.paint()
cr.set_operator(cairo.OPERATOR_OVER) cr.set_operator(cairo.OPERATOR_OVER)
def _load_interactive_debug(self):
self.set_interactive_debugging(True)
def _tear_down(self, widget = None, eve = None): def _tear_down(self, widget = None, eve = None):
event_system.emit("shutting_down") event_system.emit("shutting_down")

View File

@ -13,7 +13,20 @@ class EventSystem(Singleton):
def __init__(self): def __init__(self):
self.subscribers = defaultdict(list) self.subscribers = defaultdict(list)
self._is_paused = False
self._subscribe_to_events()
def _subscribe_to_events(self):
self.subscribe("pause_event_processing", self._pause_processing_events)
self.subscribe("resume_event_processing", self._resume_processing_events)
def _pause_processing_events(self):
self._is_paused = True
def _resume_processing_events(self):
self._is_paused = False
def subscribe(self, event_type, fn): def subscribe(self, event_type, fn):
self.subscribers[event_type].append(fn) self.subscribers[event_type].append(fn)
@ -25,6 +38,9 @@ class EventSystem(Singleton):
self.subscribers.pop(event_type, None) self.subscribers.pop(event_type, None)
def emit(self, event_type, data = None): def emit(self, event_type, data = None):
if self._is_paused and event_type != "resume_event_processing":
return
if event_type in self.subscribers: if event_type in self.subscribers:
for fn in self.subscribers[event_type]: for fn in self.subscribers[event_type]:
if data: if data:
@ -36,6 +52,9 @@ class EventSystem(Singleton):
fn() fn()
def emit_and_await(self, event_type, data = None): def emit_and_await(self, event_type, data = None):
if self._is_paused and event_type != "resume_event_processing":
return
""" NOTE: Should be used when signal has only one listener and vis-a-vis """ """ NOTE: Should be used when signal has only one listener and vis-a-vis """
if event_type in self.subscribers: if event_type in self.subscribers:
response = None response = None