Global threading decorators; Endpoint registry creation
This commit is contained in:
parent
3f5664da5b
commit
b058dc3667
|
@ -0,0 +1,3 @@
|
||||||
|
"""
|
||||||
|
Pligin Module
|
||||||
|
"""
|
|
@ -0,0 +1,173 @@
|
||||||
|
# Python imports
|
||||||
|
import os, threading, subprocess, time, inspect, hashlib
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
# Gtk imports
|
||||||
|
import gi
|
||||||
|
gi.require_version('Gtk', '3.0')
|
||||||
|
gi.require_version('GdkPixbuf', '2.0')
|
||||||
|
from gi.repository import Gtk, GLib, Gio, GdkPixbuf
|
||||||
|
|
||||||
|
# Application imports
|
||||||
|
|
||||||
|
|
||||||
|
# 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 Manifest:
|
||||||
|
path: str = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
name: str = "VOD Thumbnailer"
|
||||||
|
author: str = "ITDominator"
|
||||||
|
version: str = "0.0.1"
|
||||||
|
support: str = ""
|
||||||
|
requests: {} = {
|
||||||
|
'ui_target': "context_menu",
|
||||||
|
'pass_fm_events': "true"
|
||||||
|
}
|
||||||
|
|
||||||
|
class Plugin(Manifest):
|
||||||
|
def __init__(self):
|
||||||
|
self._GLADE_FILE = f"{self.path}/re_thumbnailer.glade"
|
||||||
|
self._builder = None
|
||||||
|
self._thumbnailer_dialog = None
|
||||||
|
self._thumbnail_preview_img = None
|
||||||
|
self._file_name = None
|
||||||
|
self._file_location = None
|
||||||
|
self._file_hash = None
|
||||||
|
self._state = None
|
||||||
|
|
||||||
|
self._event_system = None
|
||||||
|
self._event_sleep_time = .5
|
||||||
|
self._event_message = None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def get_ui_element(self):
|
||||||
|
self._builder = Gtk.Builder()
|
||||||
|
self._builder.add_from_file(self._GLADE_FILE)
|
||||||
|
|
||||||
|
classes = [self]
|
||||||
|
handlers = {}
|
||||||
|
for c in classes:
|
||||||
|
methods = None
|
||||||
|
try:
|
||||||
|
methods = inspect.getmembers(c, predicate=inspect.ismethod)
|
||||||
|
handlers.update(methods)
|
||||||
|
except Exception as e:
|
||||||
|
print(repr(e))
|
||||||
|
|
||||||
|
self._builder.connect_signals(handlers)
|
||||||
|
|
||||||
|
self._thumbnailer_dialog = self._builder.get_object("thumbnailer_dialog")
|
||||||
|
self._file_name = self._builder.get_object("file_name")
|
||||||
|
self._file_location = self._builder.get_object("file_location")
|
||||||
|
self._thumbnail_preview_img = self._builder.get_object("thumbnail_preview_img")
|
||||||
|
self._file_hash = self._builder.get_object("file_hash")
|
||||||
|
|
||||||
|
button = Gtk.Button(label=self.name)
|
||||||
|
button.connect("button-release-event", self._show_thumbnailer_page)
|
||||||
|
return button
|
||||||
|
|
||||||
|
def set_fm_event_system(self, fm_event_system):
|
||||||
|
self._event_system = fm_event_system
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
self._module_event_observer()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@threaded
|
||||||
|
def _show_thumbnailer_page(self, widget=None, eve=None):
|
||||||
|
self._event_system.push_gui_event([self.name, "get_current_state", ()])
|
||||||
|
self.wait_for_fm_message()
|
||||||
|
|
||||||
|
state = self._event_message
|
||||||
|
self._event_message = None
|
||||||
|
|
||||||
|
GLib.idle_add(self._process_changes, (state))
|
||||||
|
|
||||||
|
def _process_changes(self, state):
|
||||||
|
self._state = None
|
||||||
|
|
||||||
|
if len(state.selected_files) == 1:
|
||||||
|
if state.selected_files[0].lower().endswith(state.tab.fvideos):
|
||||||
|
self._state = state
|
||||||
|
self._set_ui_data()
|
||||||
|
response = self._thumbnailer_dialog.run()
|
||||||
|
if response in [Gtk.ResponseType.CANCEL, Gtk.ResponseType.DELETE_EVENT]:
|
||||||
|
self._thumbnailer_dialog.hide()
|
||||||
|
|
||||||
|
|
||||||
|
def _regenerate_thumbnail(self, widget=None, eve=None):
|
||||||
|
print("Regenerating thumbnail...")
|
||||||
|
file = self._file_name.get_text()
|
||||||
|
dir = self._file_location.get_text()
|
||||||
|
file_hash = self._file_hash.get_text()
|
||||||
|
|
||||||
|
hash_img_pth = f"{self._state.tab.ABS_THUMBS_PTH}/{file_hash}.jpg"
|
||||||
|
try:
|
||||||
|
if os.path.isfile(hash_img_pth):
|
||||||
|
os.remove(hash_img_pth)
|
||||||
|
|
||||||
|
img_pixbuf = self._state.tab.create_icon(dir, file)
|
||||||
|
self._thumbnail_preview_img.set_from_pixbuf(img_pixbuf)
|
||||||
|
except Exception as e:
|
||||||
|
print("Couldn't regenerate thumbnail!")
|
||||||
|
|
||||||
|
def _use_selected_thumbnail(self, widget=None, eve=None):
|
||||||
|
print("_use_selected_thumbnail stub...")
|
||||||
|
|
||||||
|
|
||||||
|
def _set_ui_data(self):
|
||||||
|
uri = self._state.selected_files[0]
|
||||||
|
path = self._state.tab.get_current_directory()
|
||||||
|
parts = uri.split("/")
|
||||||
|
|
||||||
|
file_hash = hashlib.sha256(str.encode(uri)).hexdigest()
|
||||||
|
hash_img_pth = f"{self._state.tab.ABS_THUMBS_PTH}/{file_hash}.jpg"
|
||||||
|
img_pixbuf = GdkPixbuf.Pixbuf.new_from_file(hash_img_pth)
|
||||||
|
|
||||||
|
self._thumbnail_preview_img.set_from_pixbuf(img_pixbuf)
|
||||||
|
self._file_name.set_text(parts[ len(parts) - 1 ])
|
||||||
|
self._file_location.set_text(path)
|
||||||
|
self._file_hash.set_text(file_hash)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def wait_for_fm_message(self):
|
||||||
|
while not self._event_message:
|
||||||
|
pass
|
||||||
|
|
||||||
|
@daemon_threaded
|
||||||
|
def _module_event_observer(self):
|
||||||
|
while True:
|
||||||
|
time.sleep(self._event_sleep_time)
|
||||||
|
event = self._event_system.read_module_event()
|
||||||
|
if event:
|
||||||
|
try:
|
||||||
|
if event[0] == self.name:
|
||||||
|
target_id, method_target, data = self._event_system.consume_module_event()
|
||||||
|
|
||||||
|
if not method_target:
|
||||||
|
self._event_message = data
|
||||||
|
else:
|
||||||
|
method = getattr(self.__class__, f"{method_target}")
|
||||||
|
if data:
|
||||||
|
data = method(*(self, *data))
|
||||||
|
else:
|
||||||
|
method(*(self,))
|
||||||
|
except Exception as e:
|
||||||
|
print(repr(e))
|
|
@ -0,0 +1,219 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Generated with glade 3.38.2 -->
|
||||||
|
<interface>
|
||||||
|
<requires lib="gtk+" version="3.16"/>
|
||||||
|
<object class="GtkDialog" id="thumbnailer_dialog">
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="border-width">6</property>
|
||||||
|
<property name="title" translatable="yes">VOD Thumbnailer</property>
|
||||||
|
<property name="modal">True</property>
|
||||||
|
<property name="window-position">center-on-parent</property>
|
||||||
|
<property name="default-width">420</property>
|
||||||
|
<property name="destroy-with-parent">True</property>
|
||||||
|
<property name="type-hint">dialog</property>
|
||||||
|
<property name="skip-taskbar-hint">True</property>
|
||||||
|
<property name="skip-pager-hint">True</property>
|
||||||
|
<property name="gravity">center</property>
|
||||||
|
<child internal-child="vbox">
|
||||||
|
<object class="GtkBox" id="dialog_vbox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="spacing">12</property>
|
||||||
|
<child internal-child="action_area">
|
||||||
|
<object class="GtkButtonBox" id="dialog_action_area">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="layout-style">end</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="cancel_button">
|
||||||
|
<property name="label">gtk-cancel</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="can-default">True</property>
|
||||||
|
<property name="receives-default">False</property>
|
||||||
|
<property name="use-stock">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="pack-type">end</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage" id="thumbnail_preview_img">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="stock">gtk-missing-image</property>
|
||||||
|
<property name="icon_size">6</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTable" id="general_table">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="border-width">4</property>
|
||||||
|
<property name="n-rows">4</property>
|
||||||
|
<property name="n-columns">2</property>
|
||||||
|
<property name="column-spacing">12</property>
|
||||||
|
<property name="row-spacing">6</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label" translatable="yes"><b>File _Name:</b></property>
|
||||||
|
<property name="use-markup">True</property>
|
||||||
|
<property name="use-underline">True</property>
|
||||||
|
<property name="mnemonic-widget">file_name</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="x-options">GTK_FILL</property>
|
||||||
|
<property name="y-options"/>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkEntry" id="file_name">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="editable">False</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="right-attach">2</property>
|
||||||
|
<property name="y-options"/>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label" translatable="yes"><b>_Location:</b></property>
|
||||||
|
<property name="use-markup">True</property>
|
||||||
|
<property name="use-underline">True</property>
|
||||||
|
<property name="mnemonic-widget">file_location</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="top-attach">1</property>
|
||||||
|
<property name="bottom-attach">2</property>
|
||||||
|
<property name="x-options">GTK_FILL</property>
|
||||||
|
<property name="y-options"/>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkEntry" id="file_location">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="editable">False</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="right-attach">2</property>
|
||||||
|
<property name="top-attach">1</property>
|
||||||
|
<property name="bottom-attach">2</property>
|
||||||
|
<property name="x-options">GTK_FILL</property>
|
||||||
|
<property name="y-options"/>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton">
|
||||||
|
<property name="label" translatable="yes">Regenerate</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="receives-default">True</property>
|
||||||
|
<signal name="released" handler="_regenerate_thumbnail" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="right-attach">2</property>
|
||||||
|
<property name="top-attach">3</property>
|
||||||
|
<property name="bottom-attach">4</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton">
|
||||||
|
<property name="label" translatable="yes">Use Selected</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="receives-default">True</property>
|
||||||
|
<signal name="released" handler="_use_selected_thumbnail" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="top-attach">3</property>
|
||||||
|
<property name="bottom-attach">4</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="hash">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label" translatable="yes"><b>_Thumbnail Hash:</b></property>
|
||||||
|
<property name="use-markup">True</property>
|
||||||
|
<property name="use-underline">True</property>
|
||||||
|
<property name="mnemonic-widget">file_location</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="top-attach">2</property>
|
||||||
|
<property name="bottom-attach">3</property>
|
||||||
|
<property name="x-options">GTK_FILL</property>
|
||||||
|
<property name="y-options"/>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkEntry" id="file_hash">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="editable">False</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="right-attach">2</property>
|
||||||
|
<property name="top-attach">2</property>
|
||||||
|
<property name="bottom-attach">3</property>
|
||||||
|
<property name="x-options">GTK_FILL</property>
|
||||||
|
<property name="y-options"/>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<action-widgets>
|
||||||
|
<action-widget response="-6">cancel_button</action-widget>
|
||||||
|
</action-widgets>
|
||||||
|
</object>
|
||||||
|
</interface>
|
|
@ -1,5 +1,5 @@
|
||||||
# Python imports
|
# Python imports
|
||||||
import builtins
|
import builtins, threading
|
||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
|
|
||||||
|
@ -7,6 +7,21 @@ import builtins
|
||||||
from utils.ipc_server import IPCServer
|
from utils.ipc_server import IPCServer
|
||||||
|
|
||||||
|
|
||||||
|
# NOTE: Threads will not die with parent's destruction
|
||||||
|
def threaded_wrapper(fn):
|
||||||
|
def wrapper(*args, **kwargs):
|
||||||
|
threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=False).start()
|
||||||
|
return wrapper
|
||||||
|
|
||||||
|
# NOTE: Insure threads die with parent's destruction
|
||||||
|
def daemon_threaded_wrapper(fn):
|
||||||
|
def wrapper(*args, **kwargs):
|
||||||
|
threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=True).start()
|
||||||
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class EventSystem(IPCServer):
|
class EventSystem(IPCServer):
|
||||||
|
@ -65,10 +80,32 @@ class EventSystem(IPCServer):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class EndpointRegistry():
|
||||||
|
def __init__(self):
|
||||||
|
self._endpoints = {}
|
||||||
|
|
||||||
|
def register(self, rule, **options):
|
||||||
|
def decorator(f):
|
||||||
|
_endpoint = options.pop("endpoint", None)
|
||||||
|
self._endpoints[rule] = f
|
||||||
|
return f
|
||||||
|
|
||||||
|
return decorator
|
||||||
|
|
||||||
|
def get_endpoints(self):
|
||||||
|
return self._endpoints
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# NOTE: Just reminding myself we can add to builtins two different ways...
|
# NOTE: Just reminding myself we can add to builtins two different ways...
|
||||||
# __builtins__.update({"event_system": Builtins()})
|
# __builtins__.update({"event_system": Builtins()})
|
||||||
builtins.app_name = "SolarFM"
|
builtins.app_name = "SolarFM"
|
||||||
builtins.event_system = EventSystem()
|
builtins.event_system = EventSystem()
|
||||||
|
builtins.endpoint_registry = EndpointRegistry()
|
||||||
|
builtins.threaded = threaded_wrapper
|
||||||
|
builtins.daemon_threaded = daemon_threaded_wrapper
|
||||||
builtins.event_sleep_time = 0.05
|
builtins.event_sleep_time = 0.05
|
||||||
builtins.trace_debug = False
|
builtins.trace_debug = False
|
||||||
builtins.debug = False
|
builtins.debug = False
|
||||||
|
builtins.app_settings = None
|
||||||
|
|
|
@ -4,9 +4,9 @@ import os, inspect, time
|
||||||
# Lib imports
|
# Lib imports
|
||||||
|
|
||||||
# Application imports
|
# Application imports
|
||||||
|
from __builtins__ import EventSystem
|
||||||
from utils.settings import Settings
|
from utils.settings import Settings
|
||||||
from core.controller import Controller
|
from core.controller import Controller
|
||||||
from __builtins__ import EventSystem
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Python imports
|
# Python imports
|
||||||
import os, gc, threading, time
|
import os, gc, time
|
||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
import gi
|
import gi
|
||||||
|
@ -14,19 +14,6 @@ from .signals.keyboard_signals_mixin import KeyboardSignalsMixin
|
||||||
from .controller_data import Controller_Data
|
from .controller_data import Controller_Data
|
||||||
|
|
||||||
|
|
||||||
# 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: Insure threads 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 Controller(UIMixin, KeyboardSignalsMixin, IPCSignalsMixin, ExceptionHookMixin, Controller_Data):
|
class Controller(UIMixin, KeyboardSignalsMixin, IPCSignalsMixin, ExceptionHookMixin, Controller_Data):
|
||||||
|
@ -177,23 +164,28 @@ class Controller(UIMixin, KeyboardSignalsMixin, IPCSignalsMixin, ExceptionHookMi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@endpoint_registry.register(rule="go_home")
|
||||||
def go_home(self, widget=None, eve=None):
|
def go_home(self, widget=None, eve=None):
|
||||||
self.builder.get_object("go_home").released()
|
self.builder.get_object("go_home").released()
|
||||||
|
|
||||||
|
@endpoint_registry.register(rule="refresh_tab")
|
||||||
def refresh_tab(self, widget=None, eve=None):
|
def refresh_tab(self, widget=None, eve=None):
|
||||||
self.builder.get_object("refresh_tab").released()
|
self.builder.get_object("refresh_tab").released()
|
||||||
|
|
||||||
|
@endpoint_registry.register(rule="go_up")
|
||||||
def go_up(self, widget=None, eve=None):
|
def go_up(self, widget=None, eve=None):
|
||||||
self.builder.get_object("go_up").released()
|
self.builder.get_object("go_up").released()
|
||||||
|
|
||||||
|
@endpoint_registry.register(rule="grab_focus_path_entry")
|
||||||
def grab_focus_path_entry(self, widget=None, eve=None):
|
def grab_focus_path_entry(self, widget=None, eve=None):
|
||||||
self.builder.get_object("path_entry").grab_focus()
|
self.builder.get_object("path_entry").grab_focus()
|
||||||
|
|
||||||
|
@endpoint_registry.register(rule="tggl_top_main_menubar")
|
||||||
def tggl_top_main_menubar(self, widget=None, eve=None):
|
def tggl_top_main_menubar(self, widget=None, eve=None):
|
||||||
top_main_menubar = self.builder.get_object("top_main_menubar")
|
top_main_menubar = self.builder.get_object("top_main_menubar")
|
||||||
top_main_menubar.hide() if top_main_menubar.is_visible() else top_main_menubar.show()
|
top_main_menubar.hide() if top_main_menubar.is_visible() else top_main_menubar.show()
|
||||||
|
|
||||||
|
@endpoint_registry.register(rule="open_terminal")
|
||||||
def open_terminal(self, widget=None, eve=None):
|
def open_terminal(self, widget=None, eve=None):
|
||||||
wid, tid = self.fm_controller.get_active_wid_and_tid()
|
wid, tid = self.fm_controller.get_active_wid_and_tid()
|
||||||
tab = self.get_fm_window(wid).get_tab_by_id(tid)
|
tab = self.get_fm_window(wid).get_tab_by_id(tid)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Python imports
|
# Python imports
|
||||||
import traceback, threading, time
|
import traceback, time
|
||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
import gi
|
import gi
|
||||||
|
@ -9,10 +9,6 @@ from gi.repository import Gtk, GLib
|
||||||
# Application imports
|
# Application imports
|
||||||
|
|
||||||
|
|
||||||
def threaded(fn):
|
|
||||||
def wrapper(*args, **kwargs):
|
|
||||||
threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=True).start()
|
|
||||||
return wrapper
|
|
||||||
|
|
||||||
|
|
||||||
class ExceptionHookMixin:
|
class ExceptionHookMixin:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Python imports
|
# Python imports
|
||||||
import os, threading, subprocess, time
|
import os
|
||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
import gi
|
import gi
|
||||||
|
@ -11,12 +11,6 @@ from gi.repository import Gtk, Gdk, GLib, Gio, GdkPixbuf
|
||||||
# Application imports
|
# Application imports
|
||||||
|
|
||||||
|
|
||||||
def threaded(fn):
|
|
||||||
def wrapper(*args, **kwargs):
|
|
||||||
threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=True).start()
|
|
||||||
return wrapper
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# NOTE: Consider trying to use Gtk.TreeView with css that turns it into a grid...
|
# NOTE: Consider trying to use Gtk.TreeView with css that turns it into a grid...
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Python imports
|
# Python imports
|
||||||
import os, time, threading, shlex
|
import os, time, shlex
|
||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
import gi
|
import gi
|
||||||
|
@ -9,10 +9,6 @@ from gi.repository import Gtk, GObject, GLib, Gio
|
||||||
# Application imports
|
# Application imports
|
||||||
|
|
||||||
|
|
||||||
def threaded(fn):
|
|
||||||
def wrapper(*args, **kwargs):
|
|
||||||
threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=True).start()
|
|
||||||
return wrapper
|
|
||||||
|
|
||||||
|
|
||||||
class WidgetFileActionMixin:
|
class WidgetFileActionMixin:
|
||||||
|
|
Loading…
Reference in New Issue