From f2dfd94a5fb20c432402ae8055b1a2909462426c Mon Sep 17 00:00:00 2001
From: itdominator <1itdominator@gmail.com>
Date: Wed, 1 Dec 2021 16:26:20 -0600
Subject: [PATCH] Added execute contexts; moved popups to new glade file
---
README.md | 1 -
.../shellfm/windows/view/utils/Settings.py | 1 +
.../new/solarfm/signal_classes/Controller.py | 9 +-
.../mixins/WidgetFileActionMixin.py | 10 +
.../signal_classes/mixins/WidgetMixin.py | 7 +-
.../solarfm-0.0.1/SolarFM/new/solarfm/solarfm | 18 -
.../SolarFM/new/solarfm/utils/Settings.py | 8 +-
user_config/solarfm/Main_Window.glade | 687 --------------
user_config/solarfm/Menu_Popups.glade | 889 ++++++++++++++++++
user_config/solarfm/settings.json | 3 +-
10 files changed, 920 insertions(+), 713 deletions(-)
delete mode 100755 src/versions/solarfm-0.0.1/SolarFM/new/solarfm/solarfm
create mode 100644 user_config/solarfm/Menu_Popups.glade
diff --git a/README.md b/README.md
index 298505c..d445a66 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,6 @@ SolarFM is a Gtk+ Python file manager.
- Add prompt guards for actions.
- Add path bar search dropdown.
-- Add "execute" and "execute in terminal" context options.
- Add "clear trash", "restore from trash" options.
- Add drive size free and consumed info to bottom bar.
- Add simpleish plugin system to run bash/python scripts.
diff --git a/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/shellfm/windows/view/utils/Settings.py b/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/shellfm/windows/view/utils/Settings.py
index 408bc42..211f2d7 100644
--- a/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/shellfm/windows/view/utils/Settings.py
+++ b/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/shellfm/windows/view/utils/Settings.py
@@ -69,6 +69,7 @@ class Settings:
pdf_app = settings["pdf_app"]
text_app = settings["text_app"]
file_manager_app = settings["file_manager_app"]
+ terminal_app = settings["terminal_app"]
remux_folder_max_disk_usage = settings["remux_folder_max_disk_usage"]
# Filters
diff --git a/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/signal_classes/Controller.py b/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/signal_classes/Controller.py
index 179c65c..79916a9 100644
--- a/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/signal_classes/Controller.py
+++ b/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/signal_classes/Controller.py
@@ -123,13 +123,18 @@ class Controller(Controller_Data, ShowHideMixin, KeyboardSignalsMixin, \
- def do_action_from_menu_controls(self, imagemenuitem, eventbutton):
- action = imagemenuitem.get_name()
+ def do_action_from_menu_controls(self, widget, eventbutton):
+ action = widget.get_name()
self.ctrlDown = True
self.hide_context_menu()
self.hide_new_file_menu()
self.hide_edit_file_menu()
+
+ if action == "execute":
+ self.execute_files()
+ if action == "execute_in_terminal":
+ self.execute_files(in_terminal=True)
if action == "create":
self.create_file()
self.hide_new_file_menu()
diff --git a/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/signal_classes/mixins/WidgetFileActionMixin.py b/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/signal_classes/mixins/WidgetFileActionMixin.py
index e883c39..1ba1a28 100644
--- a/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/signal_classes/mixins/WidgetFileActionMixin.py
+++ b/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/signal_classes/mixins/WidgetFileActionMixin.py
@@ -79,6 +79,16 @@ class WidgetFileActionMixin:
store = iconview.get_model()
return wid, tid, view, iconview, store
+ def execute_files(self, in_terminal=False):
+ wid, tid, view, iconview, store = self.get_current_state()
+ paths = self.format_to_uris(store, wid, tid, self.selected_files, True)
+ current_dir = view.get_current_directory()
+ command = None
+
+ for path in paths:
+ command = f"sh -c '{path}'" if not in_terminal else f"{view.terminal_app} -e '{path}'"
+ self.execute(command, current_dir)
+
def open_files(self):
wid, tid, view, iconview, store = self.get_current_state()
uris = self.format_to_uris(store, wid, tid, self.selected_files, True)
diff --git a/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/signal_classes/mixins/WidgetMixin.py b/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/signal_classes/mixins/WidgetMixin.py
index a3cf20b..cf21599 100644
--- a/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/signal_classes/mixins/WidgetMixin.py
+++ b/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/signal_classes/mixins/WidgetMixin.py
@@ -46,9 +46,14 @@ class WidgetMixin:
# NOTE: Might need to keep an eye on this throwing invalid iters when too
# many updates are happening to a folder. Example: /tmp
+ # Will sink for now. (Aka ignore forever)
def update_store(self, item):
i, store, icon, view, fpath = item
- itr = store.get_iter(i)
+ itr = None
+ try:
+ itr = store.get_iter(i)
+ except Exception as e:
+ return
if not icon:
icon = self.get_system_thumbnail(fpath, view.SYS_ICON_WH[0])
diff --git a/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/solarfm b/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/solarfm
deleted file mode 100755
index 40cd1fd..0000000
--- a/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/solarfm
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-
-# . CONFIG.sh
-
-# set -o xtrace ## To debug scripts
-# set -o errexit ## To exit on error
-# set -o errunset ## To exit if a variable is referenced but not set
-
-
-function main() {
- SCRIPTPATH="$( cd "$(dirname "")" >/dev/null 2>&1 ; pwd -P )"
- cd "${SCRIPTPATH}"
- echo "Working Dir: " $(pwd)
-
- source "/home/abaddon/Portable_Apps/py-venvs/flask-apps-venv/venv/bin/activate"
- python ../solarfm "$@"
-}
-main "$@";
diff --git a/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/utils/Settings.py b/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/utils/Settings.py
index 566e876..77a7240 100644
--- a/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/utils/Settings.py
+++ b/src/versions/solarfm-0.0.1/SolarFM/new/solarfm/utils/Settings.py
@@ -21,12 +21,14 @@ class Settings:
self.USER_HOME = path.expanduser('~')
self.CONFIG_PATH = self.USER_HOME + "/.config/solarfm"
- self.gladefile = self.CONFIG_PATH + "/Main_Window.glade"
+ self.windows_glade = self.CONFIG_PATH + "/Main_Window.glade"
+ self.popups_glade = self.CONFIG_PATH + "/Menu_Popups.glade"
self.cssFile = self.CONFIG_PATH + '/stylesheet.css'
- self.logger = Logger().get_logger()
+ self.logger = Logger().get_logger()
self.builder = gtk.Builder()
- self.builder.add_from_file(self.gladefile)
+ self.builder.add_from_file(self.windows_glade)
+ self.builder.add_from_file(self.popups_glade)
self.DEFAULT_ICONS = self.CONFIG_PATH + "/icons"
self.window_icon = self.DEFAULT_ICONS + "/solarfm.png"
diff --git a/user_config/solarfm/Main_Window.glade b/user_config/solarfm/Main_Window.glade
index bcb481c..d5a730f 100644
--- a/user_config/solarfm/Main_Window.glade
+++ b/user_config/solarfm/Main_Window.glade
@@ -382,76 +382,6 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
-
@@ -611,325 +541,12 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
button3
-
-
-
-
-
-
-
-
-
-
- True
- False
- user-trash
-
-
- True
- False
- user-trash
-
-
diff --git a/user_config/solarfm/Menu_Popups.glade b/user_config/solarfm/Menu_Popups.glade
new file mode 100644
index 0000000..b950331
--- /dev/null
+++ b/user_config/solarfm/Menu_Popups.glade
@@ -0,0 +1,889 @@
+
+
+
+
+
+
+ $(which 7za || echo 7zr) a %o %N
+
+
+ False
+ True
+ center
+ dialog
+ center
+ True
+ True
+
+
+ False
+ vertical
+ 2
+
+
+ False
+ end
+
+
+ gtk-cancel
+ True
+ True
+ True
+ True
+
+
+ True
+ True
+ 0
+
+
+
+
+ gtk-ok
+ True
+ True
+ True
+ True
+
+
+ True
+ True
+ 1
+
+
+
+
+ False
+ False
+ 0
+
+
+
+
+ True
+ False
+ vertical
+
+
+ True
+ False
+ True
+
+
+ True
+ False
+ Compress Commands:
+ 0.20000000298023224
+
+
+
+
+
+ False
+ True
+ 0
+
+
+
+
+
+
+
+ True
+ False
+ Archive Format:
+ 1
+
+
+
+
+
+ False
+ True
+ 2
+
+
+
+
+ True
+ False
+ 0
+ 0
+
+ - 7Zip (*.7z)
+ - Zip (*.zip *.ZIP)
+ - RAR (*.rar *.RAR)
+ - Tar (*.tar)
+ - Tar bzip2 (*.tar.bz2)
+ - Tar Gzip (*.tar.gz *.tgz)
+ - Tar xz (*.tar.xz *.txz)
+ - Gzip (*.gz)
+ - XZ (*.xz)
+
+
+
+
+ False
+ True
+ 3
+
+
+
+
+ False
+ True
+ 0
+
+
+
+
+ 72
+ True
+ True
+ arc_command_buffer
+
+
+ True
+ True
+ 1
+
+
+
+
+ False
+ True
+ 2
+
+
+
+
+
+ button2
+ button3
+
+
+
+ True
+ False
+ gtk-save-as
+
+
+ True
+ False
+ gtk-new
+
+
+
+ True
+ False
+ gtk-execute
+
+
+
+ 320
+ False
+ True
+ bottom
+
+
+ True
+ False
+ vertical
+
+
+ gtk-save-as
+ True
+ True
+ True
+ True
+
+
+
+ False
+ True
+ 0
+
+
+
+
+ 600
+ True
+ True
+ True
+ in
+ False
+
+
+ message_view
+ True
+ True
+ True
+ False
+ False
+ message_buffer
+
+
+
+
+ False
+ True
+ 1
+
+
+
+
+
+
+ True
+ False
+ gtk-open
+
+
+ True
+ False
+ gtk-edit
+ 3
+
+
+ True
+ False
+ gtk-edit
+
+
+ True
+ False
+ gtk-media-forward
+
+
+
+ True
+ False
+ user-trash
+
+
+ True
+ False
+ user-trash
+
+
+
diff --git a/user_config/solarfm/settings.json b/user_config/solarfm/settings.json
index a30a757..c9f246f 100644
--- a/user_config/solarfm/settings.json
+++ b/user_config/solarfm/settings.json
@@ -2,7 +2,7 @@
"settings": {
"base_of_home": "",
"hide_hidden_files": "true",
- "thumbnailer_path": "",
+ "thumbnailer_path": "ffmpegthumbnailer",
"go_past_home": "true",
"lock_folder": "false",
"locked_folders": "venv::::flasks",
@@ -14,6 +14,7 @@
"pdf_app": "evince",
"text_app": "leafpad",
"file_manager_app": "solarfm",
+ "terminal_app": "terminator",
"remux_folder_max_disk_usage": "8589934592"
}
}