Enhanced launcher by collecting relative paths when running from the terminal
This commit is contained in:
parent
dbc198513f
commit
1f4584d801
|
@ -65,6 +65,3 @@ class Controller(DummyMixin, SignalsMixins, ControllerData):
|
||||||
self.base_container = BaseContainer()
|
self.base_container = BaseContainer()
|
||||||
|
|
||||||
settings_manager.register_signals_to_builder([self, self.base_container])
|
settings_manager.register_signals_to_builder([self, self.base_container])
|
||||||
|
|
||||||
def get_base_container(self):
|
|
||||||
return self.base_container
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# Python imports
|
# Python imports
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
from shutil import which
|
||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
|
|
||||||
|
@ -24,6 +25,8 @@ class ControllerData:
|
||||||
self.setup_builder_and_container()
|
self.setup_builder_and_container()
|
||||||
self.plugins = PluginsController()
|
self.plugins = PluginsController()
|
||||||
|
|
||||||
|
def get_base_container(self):
|
||||||
|
return self.base_container
|
||||||
|
|
||||||
def clear_console(self) -> None:
|
def clear_console(self) -> None:
|
||||||
''' Clears the terminal screen. '''
|
''' Clears the terminal screen. '''
|
||||||
|
@ -55,14 +58,26 @@ class ControllerData:
|
||||||
for child in widget.get_children():
|
for child in widget.get_children():
|
||||||
widget.remove(child)
|
widget.remove(child)
|
||||||
|
|
||||||
def get_clipboard_data(self, encoding="utf-8") -> str:
|
def get_clipboard_data(self, encoding = "utf-8") -> str:
|
||||||
proc = subprocess.Popen(['xclip','-selection', 'clipboard', '-o'], stdout=subprocess.PIPE)
|
if which("xclip"):
|
||||||
|
command = ['xclip','-selection','clipboard']
|
||||||
|
else:
|
||||||
|
logger.info('xclip not found...')
|
||||||
|
return
|
||||||
|
|
||||||
|
proc = subprocess.Popen(['xclip','-selection', 'clipboard', '-o'], stdout = subprocess.PIPE)
|
||||||
retcode = proc.wait()
|
retcode = proc.wait()
|
||||||
data = proc.stdout.read()
|
data = proc.stdout.read()
|
||||||
return data.decode(encoding).strip()
|
return data.decode(encoding).strip()
|
||||||
|
|
||||||
def set_clipboard_data(self, data: type, encoding="utf-8") -> None:
|
def set_clipboard_data(self, data: type, encoding = "utf-8") -> None:
|
||||||
proc = subprocess.Popen(['xclip','-selection','clipboard'], stdin=subprocess.PIPE)
|
if which("xclip"):
|
||||||
|
command = ['xclip','-selection','clipboard']
|
||||||
|
else:
|
||||||
|
logger.info('xclip not found...')
|
||||||
|
return
|
||||||
|
|
||||||
|
proc = subprocess.Popen(command, stdin = subprocess.PIPE)
|
||||||
proc.stdin.write(data.encode(encoding))
|
proc.stdin.write(data.encode(encoding))
|
||||||
proc.stdin.close()
|
proc.stdin.close()
|
||||||
retcode = proc.wait()
|
retcode = proc.wait()
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
# Python imports
|
# Python imports
|
||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
from .signals.ipc_signals_mixin import IPCSignalsMixin
|
|
||||||
from .signals.keyboard_signals_mixin import KeyboardSignalsMixin
|
|
||||||
|
|
||||||
# Application imports
|
# Application imports
|
||||||
|
from .signals.ipc_signals_mixin import IPCSignalsMixin
|
||||||
|
from .signals.keyboard_signals_mixin import KeyboardSignalsMixin
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,19 +11,23 @@ function main() {
|
||||||
call_path=`pwd`
|
call_path=`pwd`
|
||||||
path=""
|
path=""
|
||||||
|
|
||||||
|
# NOTE: Remove if you want to pass file(s) besides directories...
|
||||||
if [[ ! "${1::1}" == /* ]]; then
|
if [[ ! "${1::1}" == /* ]]; then
|
||||||
path="${call_path}/${1}"
|
path="${call_path}/${1}"
|
||||||
else
|
else
|
||||||
path="${1}"
|
path="${1}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# NOTE: Remove if you want to pass file(s) besides directories...
|
|
||||||
if [ ! -d "${path}" ]; then
|
if [ ! -d "${path}" ]; then
|
||||||
echo "<change_me>: Path given not a directory..."
|
echo "<change_me>: Path given not a directory..."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
# End NOTE: Remove if you want to pass file(s) besides directories...
|
||||||
|
|
||||||
|
# Collect abs paths and stuff in 'files' array
|
||||||
|
mapfile -t files < <(readlink -f "$@")
|
||||||
|
|
||||||
cd "/opt/"
|
cd "/opt/"
|
||||||
python /opt/<change_me>.zip "$@"
|
python /opt/<change_me>.zip "$@"
|
||||||
}
|
}
|
||||||
main "$@";
|
main "$@";
|
Loading…
Reference in New Issue