diff --git a/src/versions/pyfm-0.0.1/PyFM/new/pyfm/__init__.py b/src/versions/pyfm-0.0.1/PyFM/new/pyfm/__init__.py index 102b39e..14e08ac 100644 --- a/src/versions/pyfm-0.0.1/PyFM/new/pyfm/__init__.py +++ b/src/versions/pyfm-0.0.1/PyFM/new/pyfm/__init__.py @@ -5,7 +5,7 @@ import os, inspect, time # Application imports from utils import Settings -from signal_classes import Signals +from signal_classes import Controller from __builtins__ import Builtins @@ -30,13 +30,13 @@ class Main(Builtins): settings = Settings() settings.createWindow() - signals = Signals(args, unknownargs, settings) - if not signals: - raise Exception("Signals exited...") + controller = Controller(args, unknownargs, settings) + if not controller: + raise Exception("Controller exited and doesn't exist...") # Gets the methods from the classes and sets to handler. # Then, builder connects to any signals it needs. - classes = [signals] + classes = [controller] handlers = {} for c in classes: methods = None diff --git a/src/versions/pyfm-0.0.1/PyFM/new/pyfm/resources/Main_Window.glade b/src/versions/pyfm-0.0.1/PyFM/new/pyfm/resources/Main_Window.glade index e5a25d0..b8e61b0 100644 --- a/src/versions/pyfm-0.0.1/PyFM/new/pyfm/resources/Main_Window.glade +++ b/src/versions/pyfm-0.0.1/PyFM/new/pyfm/resources/Main_Window.glade @@ -388,6 +388,7 @@ PyFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspecti mouse splashscreen south + False diff --git a/src/versions/pyfm-0.0.1/PyFM/new/pyfm/signal_classes/Signals.py b/src/versions/pyfm-0.0.1/PyFM/new/pyfm/signal_classes/Controller.py similarity index 67% rename from src/versions/pyfm-0.0.1/PyFM/new/pyfm/signal_classes/Signals.py rename to src/versions/pyfm-0.0.1/PyFM/new/pyfm/signal_classes/Controller.py index e5fbebb..4a5dca8 100644 --- a/src/versions/pyfm-0.0.1/PyFM/new/pyfm/signal_classes/Signals.py +++ b/src/versions/pyfm-0.0.1/PyFM/new/pyfm/signal_classes/Controller.py @@ -4,15 +4,13 @@ import threading, subprocess, signal, inspect, os, time # Gtk imports import gi gi.require_version('Gtk', '3.0') -gi.require_version('Gdk', '3.0') from gi.repository import Gtk -from gi.repository import Gdk from gi.repository import GLib # Application imports from .mixins import * from shellfm import WindowController -from . import KeyboardSignalsMixin +from . import ShowHideMixin, KeyboardSignalsMixin def threaded(fn): @@ -21,7 +19,7 @@ def threaded(fn): return wrapper -class Signals(KeyboardSignalsMixin, WidgetFileActionMixin, PaneMixin, WindowMixin): +class Controller(ShowHideMixin, KeyboardSignalsMixin, WidgetFileActionMixin, PaneMixin, WindowMixin): def __init__(self, args, unknownargs, settings): self.settings = settings self.builder = self.settings.builder @@ -95,15 +93,7 @@ class Signals(KeyboardSignalsMixin, WidgetFileActionMixin, PaneMixin, WindowMixi return callable(getattr(o, name, None)) - def refresh_tab(data=None): - self, ids = data - wid, tid = ids.split("|") - notebook = self.builder.get_object(f"window_{wid}") - store, tab_label = self.get_store_and_label_from_notebook(notebook, f"{wid}|{tid}") - view = self.get_fm_window(wid).get_view_by_id(tid) - view.load_directory() - self.load_store(view, store) def do_edit_files(self, widget=None, eve=None): self.to_rename_files = self.selected_files @@ -147,57 +137,6 @@ class Signals(KeyboardSignalsMixin, WidgetFileActionMixin, PaneMixin, WindowMixi self.ctrlDown = False - def show_about_page(self, widget, eve): - about_page = self.builder.get_object("about_page") - response = about_page.run() - if response == -4: - self.hide_about_page() - - def hide_about_page(self, widget=None, eve=None): - about_page = self.builder.get_object("about_page").hide() - - def show_appchooser_menu(self, widget=None, eve=None): - appchooser_menu = self.builder.get_object("appchooser_menu") - appchooser_widget = self.builder.get_object("appchooser_widget") - - resp = appchooser_menu.run() - if resp == Gtk.ResponseType.CANCEL: - self.hide_appchooser_menu() - if resp == Gtk.ResponseType.OK: - self.open_with_files(appchooser_widget) - self.hide_appchooser_menu() - - def hide_appchooser_menu(self, widget=None, eve=None): - self.builder.get_object("appchooser_menu").hide() - - def run_appchooser_launch(self, widget=None, eve=None): - self.builder.get_object("appchooser_select_btn").pressed() - - def show_context_menu(self, widget=None, eve=None): - self.builder.get_object("context_menu").run() - - def hide_context_menu(self, widget=None, eve=None): - self.builder.get_object("context_menu").hide() - - def show_new_file_menu(self, widget=None, eve=None): - self.builder.get_object("new_file_menu").run() - - def hide_new_file_menu(self, widget=None, eve=None): - self.builder.get_object("new_file_menu").hide() - - def show_edit_file_menu(self, widget=None, eve=None): - self.builder.get_object("edit_file_menu").run() - - def hide_edit_file_menu(self, widget=None, eve=None): - self.builder.get_object("edit_file_menu").hide() - - def hide_edit_file_menu_skip(self, widget=None, eve=None): - self.skip_edit = True - self.builder.get_object("edit_file_menu").hide() - - def hide_edit_file_menu_cancel(self, widget=None, eve=None): - self.cancel_edit = True - self.builder.get_object("edit_file_menu").hide() def generate_windows(self, data = None): diff --git a/src/versions/pyfm-0.0.1/PyFM/new/pyfm/signal_classes/ShowHideMixin.py b/src/versions/pyfm-0.0.1/PyFM/new/pyfm/signal_classes/ShowHideMixin.py new file mode 100644 index 0000000..e21a314 --- /dev/null +++ b/src/versions/pyfm-0.0.1/PyFM/new/pyfm/signal_classes/ShowHideMixin.py @@ -0,0 +1,62 @@ +# Python imports + +# Gtk imports +import gi +gi.require_version('Gtk', '3.0') +from gi.repository import Gtk + +# Application imports + + +class ShowHideMixin: + def show_about_page(self, widget, eve): + about_page = self.builder.get_object("about_page") + response = about_page.run() + if response == -4: + self.hide_about_page() + + def hide_about_page(self, widget=None, eve=None): + about_page = self.builder.get_object("about_page").hide() + + def show_appchooser_menu(self, widget=None, eve=None): + appchooser_menu = self.builder.get_object("appchooser_menu") + appchooser_widget = self.builder.get_object("appchooser_widget") + + resp = appchooser_menu.run() + if resp == Gtk.ResponseType.CANCEL: + self.hide_appchooser_menu() + if resp == Gtk.ResponseType.OK: + self.open_with_files(appchooser_widget) + self.hide_appchooser_menu() + + def hide_appchooser_menu(self, widget=None, eve=None): + self.builder.get_object("appchooser_menu").hide() + + def run_appchooser_launch(self, widget=None, eve=None): + self.builder.get_object("appchooser_select_btn").pressed() + + def show_context_menu(self, widget=None, eve=None): + self.builder.get_object("context_menu").run() + + def hide_context_menu(self, widget=None, eve=None): + self.builder.get_object("context_menu").hide() + + def show_new_file_menu(self, widget=None, eve=None): + self.builder.get_object("new_file_menu").run() + + def hide_new_file_menu(self, widget=None, eve=None): + self.builder.get_object("new_file_menu").hide() + + def show_edit_file_menu(self, widget=None, eve=None): + self.builder.get_object("edit_file_menu").run() + + def hide_edit_file_menu(self, widget=None, eve=None): + self.builder.get_object("edit_file_menu").hide() + + def hide_edit_file_menu_skip(self, widget=None, eve=None): + self.skip_edit = True + self.builder.get_object("edit_file_menu").hide() + + def hide_edit_file_menu_cancel(self, widget=None, eve=None): + self.cancel_edit = True + self.builder.get_object("edit_file_menu").hide() diff --git a/src/versions/pyfm-0.0.1/PyFM/new/pyfm/signal_classes/__init__.py b/src/versions/pyfm-0.0.1/PyFM/new/pyfm/signal_classes/__init__.py index 29313d6..6fc7fbd 100644 --- a/src/versions/pyfm-0.0.1/PyFM/new/pyfm/signal_classes/__init__.py +++ b/src/versions/pyfm-0.0.1/PyFM/new/pyfm/signal_classes/__init__.py @@ -4,4 +4,5 @@ from .mixins import * from .DBusControllerMixin import DBusControllerMixin from .KeyboardSignalsMixin import KeyboardSignalsMixin -from .Signals import Signals +from .ShowHideMixin import ShowHideMixin +from .Controller import Controller diff --git a/src/versions/pyfm-0.0.1/PyFM/new/pyfm/signal_classes/mixins/TabMixin.py b/src/versions/pyfm-0.0.1/PyFM/new/pyfm/signal_classes/mixins/TabMixin.py index 3359d43..c0079ea 100644 --- a/src/versions/pyfm-0.0.1/PyFM/new/pyfm/signal_classes/mixins/TabMixin.py +++ b/src/versions/pyfm-0.0.1/PyFM/new/pyfm/signal_classes/mixins/TabMixin.py @@ -105,6 +105,15 @@ class TabMixin(WidgetMixin): def get_tab_iconview_from_notebook(self, notebook): return notebook.get_children()[1].get_children()[0] + def refresh_tab(data=None): + self, ids = data + wid, tid = ids.split("|") + notebook = self.builder.get_object(f"window_{wid}") + store, tab_label = self.get_store_and_label_from_notebook(notebook, f"{wid}|{tid}") + view = self.get_fm_window(wid).get_view_by_id(tid) + + view.load_directory() + self.load_store(view, store) def do_action_from_bar_controls(self, widget, eve=None): action = widget.get_name()