develop #11
|
@ -0,0 +1,3 @@
|
||||||
|
"""
|
||||||
|
Pligin Module
|
||||||
|
"""
|
|
@ -0,0 +1,3 @@
|
||||||
|
"""
|
||||||
|
Pligin Package
|
||||||
|
"""
|
|
@ -0,0 +1,20 @@
|
||||||
|
#!/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() {
|
||||||
|
cd "$(dirname "")"
|
||||||
|
echo "Working Dir: " $(pwd)
|
||||||
|
|
||||||
|
TARGETDIR="${1}"
|
||||||
|
LINK=`xclip -selection clipboard -o`
|
||||||
|
|
||||||
|
cd "${TARGETDIR}"
|
||||||
|
git clone "${LINK}"
|
||||||
|
}
|
||||||
|
main "$@";
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"manifest": {
|
||||||
|
"name": "Git Clone",
|
||||||
|
"author": "ITDominator",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"support": "",
|
||||||
|
"requests": {
|
||||||
|
"ui_target": "plugin_control_list",
|
||||||
|
"pass_fm_events": "true"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
# Python imports
|
||||||
|
import os, threading, subprocess, time
|
||||||
|
|
||||||
|
# Lib imports
|
||||||
|
import gi
|
||||||
|
gi.require_version('Gtk', '3.0')
|
||||||
|
from gi.repository import Gtk
|
||||||
|
|
||||||
|
# Application imports
|
||||||
|
from plugins.plugin_base import PluginBase
|
||||||
|
|
||||||
|
|
||||||
|
# NOTE: Threads WILL NOT die with parent's destruction.
|
||||||
|
def threaded(fn):
|
||||||
|
def wrapper(*args, **kwargs):
|
||||||
|
threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=False).start()
|
||||||
|
return wrapper
|
||||||
|
|
||||||
|
# NOTE: Threads WILL die with parent's destruction.
|
||||||
|
def daemon_threaded(fn):
|
||||||
|
def wrapper(*args, **kwargs):
|
||||||
|
threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=True).start()
|
||||||
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Plugin(PluginBase):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
|
||||||
|
self.path = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
self.name = "Git Clone" # NOTE: Need to remove after establishing private bidirectional 1-1 message bus
|
||||||
|
# where self.name should not be needed for message comms
|
||||||
|
|
||||||
|
def generate_reference_ui_element(self):
|
||||||
|
button = Gtk.Button(label=self.name)
|
||||||
|
button.connect("button-release-event", self._do_download)
|
||||||
|
return button
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
def _do_download(self, widget=None, eve=None):
|
||||||
|
self._event_system.emit("get_current_state")
|
||||||
|
|
||||||
|
dir = self._fm_state.tab.get_current_directory()
|
||||||
|
self._download(dir)
|
||||||
|
|
||||||
|
@threaded
|
||||||
|
def _download(self, dir):
|
||||||
|
subprocess.Popen([f'{self.path}/download.sh', dir])
|
|
@ -31,14 +31,18 @@ class GridMixin:
|
||||||
for file in files:
|
for file in files:
|
||||||
store.append([None, file[0]])
|
store.append([None, file[0]])
|
||||||
|
|
||||||
for i, file in enumerate(files):
|
self.load_icons(tab, store, dir, files)
|
||||||
self.create_icon(i, tab, store, dir, file[0])
|
|
||||||
|
|
||||||
# NOTE: Not likely called often from here but it could be useful
|
# NOTE: Not likely called often from here but it could be useful
|
||||||
if save_state and not trace_debug:
|
if save_state and not trace_debug:
|
||||||
self.fm_controller.save_state()
|
self.fm_controller.save_state()
|
||||||
|
|
||||||
|
|
||||||
@threaded
|
@threaded
|
||||||
|
def load_icons(self, tab, store, dir, files):
|
||||||
|
for i, file in enumerate(files):
|
||||||
|
self.create_icon(i, tab, store, dir, file[0])
|
||||||
|
|
||||||
def create_icon(self, i, tab, store, dir, file):
|
def create_icon(self, i, tab, store, dir, file):
|
||||||
icon = tab.create_icon(dir, file)
|
icon = tab.create_icon(dir, file)
|
||||||
GLib.idle_add(self.update_store, *(i, store, icon, tab, dir, file,))
|
GLib.idle_add(self.update_store, *(i, store, icon, tab, dir, file,))
|
||||||
|
|
Loading…
Reference in New Issue