Fixed IPC issues; cleaned up arg passthrough flow
This commit is contained in:
@@ -47,13 +47,26 @@ class FileActionSignalsMixin:
|
|||||||
if tab_widget_id in self.soft_update_lock:
|
if tab_widget_id in self.soft_update_lock:
|
||||||
timeout_id = self.soft_update_lock[tab_widget_id]["timeout_id"]
|
timeout_id = self.soft_update_lock[tab_widget_id]["timeout_id"]
|
||||||
GLib.source_remove(timeout_id)
|
GLib.source_remove(timeout_id)
|
||||||
|
self.soft_update_lock[tab_widget_id]["call_count"] += 1
|
||||||
|
else:
|
||||||
|
self.soft_update_lock[tab_widget_id] = {}
|
||||||
|
self.soft_update_lock[tab_widget_id]["call_count"] = 0
|
||||||
|
|
||||||
timeout_id = GLib.timeout_add(0, self.update_on_soft_lock_end, 600, *(tab_widget_id,))
|
timeout_id = GLib.timeout_add(
|
||||||
|
500 if self.soft_update_lock[tab_widget_id]["call_count"] <= 5 else 1000,
|
||||||
|
self.update_on_soft_lock_end,
|
||||||
|
tab_widget_id
|
||||||
|
)
|
||||||
|
|
||||||
|
self.soft_update_lock[tab_widget_id]["timeout_id"] = timeout_id
|
||||||
|
|
||||||
|
|
||||||
def update_on_soft_lock_end(self, timout_ms, tab_widget_id):
|
def update_on_soft_lock_end(self, tab_widget_id):
|
||||||
|
GLib.idle_add(self._update_interface, tab_widget_id)
|
||||||
self.soft_update_lock.pop(tab_widget_id, None)
|
self.soft_update_lock.pop(tab_widget_id, None)
|
||||||
|
return False
|
||||||
|
|
||||||
|
def _update_interface(self, tab_widget_id):
|
||||||
wid, tid = tab_widget_id.split("|")
|
wid, tid = tab_widget_id.split("|")
|
||||||
notebook = self.builder.get_object(f"window_{wid}")
|
notebook = self.builder.get_object(f"window_{wid}")
|
||||||
tab = self.get_fm_window(wid).get_tab_by_id(tid)
|
tab = self.get_fm_window(wid).get_tab_by_id(tid)
|
||||||
@@ -70,8 +83,6 @@ class FileActionSignalsMixin:
|
|||||||
if [wid, tid] in [state.wid, state.tid]:
|
if [wid, tid] in [state.wid, state.tid]:
|
||||||
self.set_bottom_labels(tab)
|
self.set_bottom_labels(tab)
|
||||||
|
|
||||||
return False
|
|
||||||
|
|
||||||
def do_file_search(self, widget, eve = None):
|
def do_file_search(self, widget, eve = None):
|
||||||
if not self.ctrl_down and not self.shift_down and not self.alt_down:
|
if not self.ctrl_down and not self.shift_down and not self.alt_down:
|
||||||
target = widget.get_name()
|
target = widget.get_name()
|
||||||
|
|||||||
0
src/solarfm/utils/cbindings/__init__.py
Normal file
0
src/solarfm/utils/cbindings/__init__.py
Normal file
15
src/solarfm/utils/cbindings/python_package_works/compile.sh
Executable file
15
src/solarfm/utils/cbindings/python_package_works/compile.sh
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/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)
|
||||||
|
|
||||||
|
python3 setup.py build && python3 setup.py install --user
|
||||||
|
}
|
||||||
|
main "$@";
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
#include <Python.h>
|
||||||
|
#include <gtk.h>
|
||||||
|
#include <cairo.h>
|
||||||
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
// static PyObject* free_pixbuf(PyObject* self, PyObject* args) {
|
||||||
|
static void free_pixbuf(PyObject* self, PyObject* args) {
|
||||||
|
PyObject *py_pixbuf;
|
||||||
|
|
||||||
|
if (!PyArg_ParseTuple(args, "O", &py_pixbuf)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
GdkPixbuf *pixbuf = (GdkPixbuf *) PyLong_AsVoidPtr(py_pixbuf);
|
||||||
|
if (!GDK_IS_PIXBUF(pixbuf)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "Invalid GdkPixbuf pointer.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free(pixbuf);
|
||||||
|
// return PyBytes_FromStringAndSize((const char *) cairo_data, buffer_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void free_list_store(PyObject* self, PyObject* args) {
|
||||||
|
PyObject *py_list_store;
|
||||||
|
|
||||||
|
if (!PyArg_ParseTuple(args, "O", &py_list_store)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
GtkListStore *list_store = (GtkListStore *) PyLong_AsVoidPtr(py_list_store);
|
||||||
|
if (!GTK_IS_LIST_STORE(list_store)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "Invalid Gtk.ListStore pointer.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_object_unref(list_store);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static PyMethodDef Methods[] = {
|
||||||
|
{"free_pixbuf", free_pixbuf, METH_VARARGS, "Clear GdkPixbuf* ."},
|
||||||
|
{"free_list_store", free_list_store, METH_VARARGS, "Clear GtkListStore* ."},
|
||||||
|
{NULL, NULL, 0, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct PyModuleDef moduledef = {
|
||||||
|
PyModuleDef_HEAD_INIT,
|
||||||
|
"gtkmemreaper",
|
||||||
|
NULL,
|
||||||
|
-1,
|
||||||
|
Methods
|
||||||
|
};
|
||||||
|
|
||||||
|
PyMODINIT_FUNC PyInit_gtkmemreaper(void) {
|
||||||
|
return PyModule_Create(&moduledef);
|
||||||
|
}
|
||||||
28
src/solarfm/utils/cbindings/python_package_works/setup.py
Normal file
28
src/solarfm/utils/cbindings/python_package_works/setup.py
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# Python imports
|
||||||
|
from setuptools import setup, Extension
|
||||||
|
from subprocess import check_output
|
||||||
|
|
||||||
|
# Lib imports
|
||||||
|
|
||||||
|
# Application imports
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
pkg_config_args = ["gdk-pixbuf-2.0", "cairo", "gtk"]
|
||||||
|
|
||||||
|
def get_pkgconfig_flags(flag_type):
|
||||||
|
return check_output(["pkg-config", flag_type] + pkg_config_args).decode().split()
|
||||||
|
|
||||||
|
ext = Extension(
|
||||||
|
"gtkmemreaper",
|
||||||
|
sources = ["gtkmemreaper.c"],
|
||||||
|
include_dirs = [],
|
||||||
|
extra_compile_args = get_pkgconfig_flags("--cflags"),
|
||||||
|
extra_link_args = get_pkgconfig_flags("--libs")
|
||||||
|
)
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name = "gtkmemreaper",
|
||||||
|
version = "0.1",
|
||||||
|
ext_modules = [ext]
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user