Added execute contexts; moved popups to new glade file

This commit is contained in:
2021-12-01 16:26:20 -06:00
parent f497a8a05f
commit f2dfd94a5f
10 changed files with 920 additions and 713 deletions

View File

@@ -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

View File

@@ -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()

View File

@@ -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)

View File

@@ -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])

View File

@@ -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 "$@";

View File

@@ -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"