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()
|
||||
|
||||
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
|
||||
import os
|
||||
import subprocess
|
||||
from shutil import which
|
||||
|
||||
# Lib imports
|
||||
|
||||
|
@ -24,6 +25,8 @@ class ControllerData:
|
|||
self.setup_builder_and_container()
|
||||
self.plugins = PluginsController()
|
||||
|
||||
def get_base_container(self):
|
||||
return self.base_container
|
||||
|
||||
def clear_console(self) -> None:
|
||||
''' Clears the terminal screen. '''
|
||||
|
@ -55,14 +58,26 @@ class ControllerData:
|
|||
for child in widget.get_children():
|
||||
widget.remove(child)
|
||||
|
||||
def get_clipboard_data(self, encoding="utf-8") -> str:
|
||||
proc = subprocess.Popen(['xclip','-selection', 'clipboard', '-o'], stdout=subprocess.PIPE)
|
||||
def get_clipboard_data(self, encoding = "utf-8") -> str:
|
||||
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()
|
||||
data = proc.stdout.read()
|
||||
return data.decode(encoding).strip()
|
||||
|
||||
def set_clipboard_data(self, data: type, encoding="utf-8") -> None:
|
||||
proc = subprocess.Popen(['xclip','-selection','clipboard'], stdin=subprocess.PIPE)
|
||||
def set_clipboard_data(self, data: type, encoding = "utf-8") -> None:
|
||||
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.close()
|
||||
retcode = proc.wait()
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# Python imports
|
||||
|
||||
# Lib imports
|
||||
from .signals.ipc_signals_mixin import IPCSignalsMixin
|
||||
from .signals.keyboard_signals_mixin import KeyboardSignalsMixin
|
||||
|
||||
# Application imports
|
||||
from .signals.ipc_signals_mixin import IPCSignalsMixin
|
||||
from .signals.keyboard_signals_mixin import KeyboardSignalsMixin
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -11,17 +11,21 @@ function main() {
|
|||
call_path=`pwd`
|
||||
path=""
|
||||
|
||||
# NOTE: Remove if you want to pass file(s) besides directories...
|
||||
if [[ ! "${1::1}" == /* ]]; then
|
||||
path="${call_path}/${1}"
|
||||
else
|
||||
path="${1}"
|
||||
fi
|
||||
|
||||
# NOTE: Remove if you want to pass file(s) besides directories...
|
||||
if [ ! -d "${path}" ]; then
|
||||
echo "<change_me>: Path given not a directory..."
|
||||
exit 1
|
||||
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/"
|
||||
python /opt/<change_me>.zip "$@"
|
||||
|
|
Loading…
Reference in New Issue