Bringing to latest changes #3

Merged
itdominator merged 41 commits from develop into master 2022-07-16 19:14:30 +00:00
10 changed files with 35 additions and 42 deletions
Showing only changes of commit c3f637b5fd - Show all commits

View File

@ -4,7 +4,7 @@ import builtins
# Lib imports # Lib imports
# Application imports # Application imports
from ipc_server import IPCServer from utils.ipc_server import IPCServer

View File

@ -28,7 +28,7 @@ class Controller(UIMixin, KeyboardSignalsMixin, IPCSignalsMixin, ExceptionHookMi
self.setup_controller_data(_settings) self.setup_controller_data(_settings)
self.window.show() self.window.show()
self.generate_windows(self.state) self.generate_windows(self.fm_controller_data)
self.plugins.launch_plugins() self.plugins.launch_plugins()
if debug: if debug:
@ -140,10 +140,8 @@ class Controller(UIMixin, KeyboardSignalsMixin, IPCSignalsMixin, ExceptionHookMi
if action == "rename": if action == "rename":
self.rename_files() self.rename_files()
if action == "cut": if action == "cut":
self.to_copy_files.clear()
self.cut_files() self.cut_files()
if action == "copy": if action == "copy":
self.to_cut_files.clear()
self.copy_files() self.copy_files()
if action == "paste": if action == "paste":
self.paste_files() self.paste_files()

View File

@ -30,7 +30,7 @@ class Controller_Data:
self.trashman = XDGTrash() self.trashman = XDGTrash()
self.fm_controller = WindowController() self.fm_controller = WindowController()
self.plugins = Plugins(_settings) self.plugins = Plugins(_settings)
self.state = self.fm_controller.load_state() self.fm_controller_data = self.fm_controller.get_state_from_file()
self.trashman.regenerate() self.trashman.regenerate()
self.window = self.settings.get_main_window() self.window = self.settings.get_main_window()
@ -128,10 +128,9 @@ class Controller_Data:
state (obj): State state (obj): State
''' '''
state = State() state = State()
wid, tid = self.fm_controller.get_active_wid_and_tid()
state.wid, state.tid = self.fm_controller.get_active_wid_and_tid() state.wid, state.tid = self.fm_controller.get_active_wid_and_tid()
state.tab = self.get_fm_window(wid).get_tab_by_id(tid) state.tab = self.get_fm_window(state.wid).get_tab_by_id(state.tid)
state.icon_grid = self.builder.get_object(f"{wid}|{tid}|icon_grid") state.icon_grid = self.builder.get_object(f"{state.wid}|{state.tid}|icon_grid")
state.store = state.icon_grid.get_model() state.store = state.icon_grid.get_model()
return state return state

View File

@ -15,7 +15,10 @@ from .widget_mixin import WidgetMixin
class TabMixin(WidgetMixin): class TabMixin(WidgetMixin):
"""docstring for TabMixin""" """docstring for TabMixin"""
def create_tab(self, wid, path=None): def create_tab(self, wid=None, path=None):
if not wid:
wid, _tid = self.fm_controller.get_active_wid_and_tid()
notebook = self.builder.get_object(f"window_{wid}") notebook = self.builder.get_object(f"window_{wid}")
path_entry = self.builder.get_object(f"path_entry") path_entry = self.builder.get_object(f"path_entry")
tab = self.fm_controller.add_tab_for_window_by_nickname(f"window_{wid}") tab = self.fm_controller.add_tab_for_window_by_nickname(f"window_{wid}")
@ -30,7 +33,7 @@ class TabMixin(WidgetMixin):
# scroll, store = self.create_icon_tree_widget(tab, wid) # scroll, store = self.create_icon_tree_widget(tab, wid)
index = notebook.append_page(scroll, tab_widget) index = notebook.append_page(scroll, tab_widget)
self.fm_controller.set__wid_and_tid(wid, tab.get_id()) self.fm_controller.set_wid_and_tid(wid, tab.get_id())
path_entry.set_text(tab.get_current_directory()) path_entry.set_text(tab.get_current_directory())
notebook.show_all() notebook.show_all()
notebook.set_current_page(index) notebook.set_current_page(index)
@ -79,7 +82,7 @@ class TabMixin(WidgetMixin):
def on_tab_switch_update(self, notebook, content=None, index=None): def on_tab_switch_update(self, notebook, content=None, index=None):
self.selected_files.clear() self.selected_files.clear()
wid, tid = content.get_children()[0].get_name().split("|") wid, tid = content.get_children()[0].get_name().split("|")
self.fm_controller.set__wid_and_tid(wid, tid) self.fm_controller.set_wid_and_tid(wid, tid)
self.set_path_text(wid, tid) self.set_path_text(wid, tid)
self.set_window_title() self.set_window_title()

View File

@ -191,11 +191,13 @@ class WidgetFileActionMixin:
self.selected_files.clear() self.selected_files.clear()
def cut_files(self): def cut_files(self):
self.to_copy_files.clear()
state = self.get_current_state() state = self.get_current_state()
uris = self.format_to_uris(state.store, state.wid, state.tid, self.selected_files, True) uris = self.format_to_uris(state.store, state.wid, state.tid, self.selected_files, True)
self.to_cut_files = uris self.to_cut_files = uris
def copy_files(self): def copy_files(self):
self.to_cut_files.clear()
state = self.get_current_state() state = self.get_current_state()
uris = self.format_to_uris(state.store, state.wid, state.tid, self.selected_files, True) uris = self.format_to_uris(state.store, state.wid, state.tid, self.selected_files, True)
self.to_copy_files = uris self.to_copy_files = uris

View File

@ -165,7 +165,7 @@ class WindowMixin(TabMixin):
try: try:
self.path_menu.popdown() self.path_menu.popdown()
wid, tid = icons_grid.get_name().split("|") wid, tid = icons_grid.get_name().split("|")
self.fm_controller.set__wid_and_tid(wid, tid) self.fm_controller.set_wid_and_tid(wid, tid)
self.set_path_text(wid, tid) self.set_path_text(wid, tid)
self.set_window_title() self.set_window_title()
@ -235,7 +235,7 @@ class WindowMixin(TabMixin):
self.override_drop_dest = uri if isdir(uri) else None self.override_drop_dest = uri if isdir(uri) else None
if target not in current: if target not in current:
self.fm_controller.set__wid_and_tid(wid, tid) self.fm_controller.set_wid_and_tid(wid, tid)
def grid_on_drag_data_received(self, widget, drag_context, x, y, data, info, time): def grid_on_drag_data_received(self, widget, drag_context, x, y, data, info, time):

View File

@ -72,10 +72,6 @@ class KeyboardSignalsMixin:
return True return True
def keyboard_create_tab(self, widget=None, eve=None):
self.builder.get_object("create_tab").released()
def keyboard_close_tab(self): def keyboard_close_tab(self):
wid, tid = self.fm_controller.get_active_wid_and_tid() wid, tid = self.fm_controller.get_active_wid_and_tid()
notebook = self.builder.get_object(f"window_{wid}") notebook = self.builder.get_object(f"window_{wid}")
@ -89,11 +85,3 @@ class KeyboardSignalsMixin:
notebook.remove_page(page) notebook.remove_page(page)
self.fm_controller.save_state() self.fm_controller.save_state()
self.set_window_title() self.set_window_title()
def keyboard_copy_files(self, widget=None, eve=None):
self.to_cut_files.clear()
self.copy_files()
def keyboard_cut_files(self, widget=None, eve=None):
self.to_copy_files.clear()
self.cut_files()

View File

@ -26,7 +26,7 @@ class WindowController:
self._windows = [] self._windows = []
def set__wid_and_tid(self, wid, tid): def set_wid_and_tid(self, wid, tid):
self._active_window_id = str(wid) self._active_window_id = str(wid)
self._active_tab_id = str(tid) self._active_tab_id = str(tid)
@ -176,7 +176,7 @@ class WindowController:
else: else:
raise Exception("Window data corrupted! Can not save session!") raise Exception("Window data corrupted! Can not save session!")
def load_state(self, session_file = None): def get_state_from_file(self, session_file = None):
if not session_file: if not session_file:
session_file = self._session_file session_file = self._session_file

View File

@ -1,10 +1,13 @@
{ {
"keybindings": { "keybindings": {
"help" : "F1", "help" : "F1",
"rename_files" : ["F2", "<Control>e"], "rename_files" : ["F2",
"<Control>e"],
"open_terminal" : "F4", "open_terminal" : "F4",
"refresh_tab" : ["F5", "<Control>r"], "refresh_tab" : ["F5",
"delete_files" : "Delete", "<Control>r"],
"delete_files" : ["Delete",
"<Shift><Control>d"],
"tggl_top_main_menubar" : "<Alt>", "tggl_top_main_menubar" : "<Alt>",
"trash_files" : "<Shift><Control>t", "trash_files" : "<Shift><Control>t",
"tear_down" : "<Control>q", "tear_down" : "<Control>q",
@ -13,10 +16,10 @@
"grab_focus_path_entry" : "<Control>l", "grab_focus_path_entry" : "<Control>l",
"open_files" : "<Control>o", "open_files" : "<Control>o",
"show_hide_hidden_files" : "<Control>h", "show_hide_hidden_files" : "<Control>h",
"keyboard_create_tab" : "<Control>t", "create_tab" : "<Control>t",
"keyboard_close_tab" : "<Control>w", "keyboard_close_tab" : "<Control>w",
"keyboard_copy_files" : "<Control>c", "copy_files" : "<Control>c",
"keyboard_cut_files" : "<Control>x", "cut_files" : "<Control>x",
"paste_files" : "<Control>v", "paste_files" : "<Control>v",
"show_new_file_menu" : "<Control>n" "show_new_file_menu" : "<Control>n"
} }