Merge Stable Changesto Master #9

Merged
itdominator merged 30 commits from develop into master 2022-11-29 04:58:09 +00:00
16 changed files with 154 additions and 466 deletions
Showing only changes of commit 9697e8ca16 - Show all commits

View File

@ -5,7 +5,7 @@
"version": "0.0.1",
"support": "",
"requests": {
"ui_target": "context_menu",
"ui_target": "context_menu_plugins",
"pass_fm_events": "true"
}
}

View File

@ -81,13 +81,12 @@ class Plugin(PluginBase):
self._archiver_dialogue = self._builder.get_object("archiver_dialogue")
self._arc_command_buffer = self._builder.get_object("arc_command_buffer")
icon = Gtk.Image(stock=Gtk.STOCK_FLOPPY)
button = Gtk.Button(label=self.name)
item = Gtk.ImageMenuItem(self.name)
item.set_image( Gtk.Image(stock=Gtk.STOCK_FLOPPY) )
item.connect("activate", self.show_archiver_dialogue)
item.set_always_show_image(True)
return item
button.set_image(icon)
button.connect("button-release-event", self.show_archiver_dialogue)
return button
def run(self):
...

View File

@ -99,13 +99,11 @@ class Plugin(PluginBase):
self._file_group = self._builder.get_object("file_group")
def generate_reference_ui_element(self):
icon = Gtk.Image(stock=Gtk.STOCK_PROPERTIES )
button = Gtk.Button(label=self.name)
button.connect("button-release-event", self._show_properties_page)
button.set_image(icon)
return button
item = Gtk.ImageMenuItem(self.name)
item.set_image( Gtk.Image(stock=Gtk.STOCK_PROPERTIES) )
item.connect("activate", self._show_properties_page)
item.set_always_show_image(True)
return item
@threaded

View File

@ -5,7 +5,7 @@
"version": "0.0.1",
"support": "",
"requests": {
"ui_target": "context_menu",
"ui_target": "context_menu_plugins",
"pass_fm_events": "true"
}
}

View File

@ -70,13 +70,11 @@ class Plugin(PluginBase):
self._trailer_link = self._builder.get_object("trailer_link")
def generate_reference_ui_element(self):
icon = Gtk.Image(stock=Gtk.STOCK_FIND)
button = Gtk.Button(label=self.name)
button.connect("button-release-event", self._show_info_page)
button.set_image(icon)
return button
item = Gtk.ImageMenuItem(self.name)
item.set_image( Gtk.Image(stock=Gtk.STOCK_FIND) )
item.connect("activate", self._show_info_page)
item.set_always_show_image(True)
return item
@threaded
def _show_info_page(self, widget=None, eve=None):

View File

@ -80,13 +80,11 @@ class Plugin(IPCServer, FileSearchMixin, GrepSearchMixin, PluginBase):
self.create_ipc_listener()
def generate_reference_ui_element(self):
icon = Gtk.Image(stock=Gtk.STOCK_FIND)
button = Gtk.Button(label=self.name)
button.connect("button-release-event", self._show_page)
button.set_image(icon)
return button
item = Gtk.ImageMenuItem(self.name)
item.set_image( Gtk.Image(stock=Gtk.STOCK_FIND) )
item.connect("activate", self._show_page)
item.set_always_show_image(True)
return item
def _show_page(self, widget=None, eve=None):
@ -113,6 +111,7 @@ class Plugin(IPCServer, FileSearchMixin, GrepSearchMixin, PluginBase):
self.grep_list_parent.add(self._grep_list)
self.grep_list_parent.show_all()
time.sleep(0.05)
Gtk.main_iteration()
def reset_file_list_box(self) -> None:
@ -128,4 +127,5 @@ class Plugin(IPCServer, FileSearchMixin, GrepSearchMixin, PluginBase):
self.file_list_parent.add(self._file_list)
self.file_list_parent.show_all()
time.sleep(0.05)
Gtk.main_iteration()

View File

@ -47,34 +47,49 @@ class Plugin(PluginBase):
self._event_system.subscribe("trash_files", self.trash_files)
def generate_reference_ui_element(self):
self._builder = Gtk.Builder()
self._builder.add_from_file(self._GLADE_FILE)
trash_a = Gtk.MenuItem("Trash Actions")
trash_menu = Gtk.Menu()
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.restore = Gtk.MenuItem("Restore From Trash")
self.restore.connect("activate", self.restore_trash_files)
self._builder.connect_signals(handlers)
self.empty = Gtk.MenuItem("Empty Trash")
self.empty.connect("activate", self.empty_trash)
trasher = self._builder.get_object("trasher")
trasher.show_all()
trash = Gtk.ImageMenuItem("Trash")
trash.set_image( Gtk.Image.new_from_icon_name("user-trash", 16) )
trash.connect("activate", self.trash_files)
trash.set_always_show_image(True)
return trasher
go_to = Gtk.ImageMenuItem("Go To Trash")
go_to.set_image( Gtk.Image.new_from_icon_name("user-trash", 16) )
go_to.connect("activate", self.go_to_trash)
go_to.set_always_show_image(True)
delete = Gtk.ImageMenuItem("Delete")
delete.set_image( Gtk.Image(stock=Gtk.STOCK_DELETE) )
delete.connect("activate", self.delete_files)
delete.set_always_show_image(True)
trash_a.set_submenu(trash_menu)
trash_a.show_all()
self._appen_menu_items(trash_menu, [self.restore, self.empty, trash, go_to, delete])
return trash_a
def _appen_menu_items(self, menu, items):
for item in items:
menu.append(item)
def _show_trash_buttons(self):
self._builder.get_object("restore_from_trash").show()
self._builder.get_object("empty_trash").show()
self.restore.show()
self.empty.show()
def _hide_trash_buttons(self):
self._builder.get_object("restore_from_trash").hide()
self._builder.get_object("empty_trash").hide()
self.restore.hide()
self.empty.hide()
def delete_files(self, widget = None, eve = None):
self._event_system.emit("do_hide_context_menu")

View File

@ -1,126 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.16"/>
<object class="GtkImage" id="trash_img">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">user-trash</property>
</object>
<object class="GtkImage" id="trash_img2">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">user-trash</property>
</object>
<object class="GtkExpander" id="trasher">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="margin-top">5</property>
<property name="margin-bottom">10</property>
<property name="label-fill">True</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkButton" id="restore_from_trash">
<property name="label" translatable="yes">Restore From Trash</property>
<property name="name">restore_from_trash</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Restore From Trash...</property>
<signal name="button-release-event" handler="restore_trash_files" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="empty_trash">
<property name="label" translatable="yes">Empty Trash</property>
<property name="name">empty_trash</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Empty Trash...</property>
<property name="margin-bottom">20</property>
<signal name="button-release-event" handler="empty_trash" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Trash</property>
<property name="name">trash</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Move to Trash...</property>
<property name="image">trash_img</property>
<property name="always-show-image">True</property>
<signal name="button-release-event" handler="trash_files" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Go To Trash</property>
<property name="name">go_to_trash</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Go To Trash...</property>
<property name="image">trash_img2</property>
<property name="always-show-image">True</property>
<signal name="button-release-event" handler="go_to_trash" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label">gtk-delete</property>
<property name="name">delete</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Delete...</property>
<property name="margin-top">20</property>
<property name="use-stock">True</property>
<property name="always-show-image">True</property>
<signal name="button-release-event" handler="delete_files" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">False</property>
<property name="label" translatable="yes">Trash</property>
<property name="justify">center</property>
</object>
</child>
</object>
</interface>

View File

@ -5,7 +5,7 @@
"version": "0.0.1",
"support": "",
"requests": {
"ui_target": "context_menu",
"ui_target": "context_menu_plugins",
"pass_fm_events": "true"
}
}

View File

@ -70,12 +70,11 @@ class Plugin(PluginBase):
def generate_reference_ui_element(self):
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(f"{self.path}/../../icons/video.png", 16, 16, True)
icon = Gtk.Image.new_from_pixbuf(pixbuf)
button = Gtk.Button(label=self.name)
button.set_image(icon)
button.connect("button-release-event", self._show_thumbnailer_page)
return button
item = Gtk.ImageMenuItem("Delete")
item.set_image( icon )
item.connect("activate", self._show_thumbnailer_page)
item.set_always_show_image(True)
return item
@threaded

View File

@ -24,7 +24,6 @@ def daemon_threaded_wrapper(fn):
# NOTE: Just reminding myself we can add to builtins two different ways...
# __builtins__.update({"event_system": Builtins()})
builtins.app_name = "SolarFM"

View File

@ -22,7 +22,7 @@ if __name__ == "__main__":
""" Set process title, get arguments, and create GTK main thread. """
try:
setproctitle('SolarFM')
setproctitle(f"{app_name}")
faulthandler.enable() # For better debug info
parser = argparse.ArgumentParser()

View File

@ -4,6 +4,8 @@ from dataclasses import dataclass
# Lib imports
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository import GLib
# Application imports
@ -100,6 +102,89 @@ class Controller_Data:
if settings.is_debug():
self.window.set_interactive_debugging(True)
self.build_context_menu()
def build_context_menu(self) -> None:
main_menu = Gtk.Menu()
open_menu = Gtk.Menu()
filea_menu = Gtk.Menu()
plugins_menu = Gtk.Menu()
open_a = Gtk.MenuItem("Open Actions")
file_a = Gtk.MenuItem("File Actions")
plugins = Gtk.MenuItem("Plugins")
self._appen_menu_items(main_menu, [open_a, file_a, plugins])
open = Gtk.ImageMenuItem("Open")
open.set_name("open")
open.set_image( Gtk.Image(stock=Gtk.STOCK_OPEN) )
open.set_always_show_image(True)
open.connect("activate", self.do_action_from_menu_controls)
open_with = Gtk.ImageMenuItem("Open With")
open_with.set_name("open_with")
open_with.set_image( Gtk.Image(stock=Gtk.STOCK_OPEN) )
open_with.set_always_show_image(True)
open_with.connect("activate", self.do_action_from_menu_controls)
execute = Gtk.ImageMenuItem("Execute")
execute.set_name("execute")
execute.set_image( Gtk.Image(stock=Gtk.STOCK_EXECUTE) )
execute.set_always_show_image(True)
execute.connect("activate", self.do_action_from_menu_controls)
execute_term = Gtk.ImageMenuItem("Execute in Terminal")
execute_term.set_name("execute_in_terminal")
execute_term.set_image( Gtk.Image(stock=Gtk.STOCK_EXECUTE) )
execute_term.set_always_show_image(True)
execute_term.connect("activate", self.do_action_from_menu_controls)
self._appen_menu_items(open_menu, [open, open_with, execute, execute_term])
new = Gtk.ImageMenuItem("New")
new.set_name("create")
new.set_image( Gtk.Image(stock=Gtk.STOCK_ADD) )
new.set_always_show_image(True)
new.connect("activate", self.do_action_from_menu_controls)
rename = Gtk.ImageMenuItem("Rename")
rename.set_name("rename")
rename.set_image( Gtk.Image(stock=Gtk.STOCK_EDIT) )
rename.set_always_show_image(True)
rename.connect("activate", self.do_action_from_menu_controls)
cut = Gtk.ImageMenuItem("Cut")
cut.set_name("cut")
cut.set_image( Gtk.Image(stock=Gtk.STOCK_CUT) )
cut.set_always_show_image(True)
cut.connect("activate", self.do_action_from_menu_controls)
copy = Gtk.ImageMenuItem("Copy")
copy.set_name("copy")
copy.set_image( Gtk.Image(stock=Gtk.STOCK_COPY) )
copy.set_always_show_image(True)
copy.connect("activate", self.do_action_from_menu_controls)
paste = Gtk.ImageMenuItem("Paste")
paste.set_name("paste")
paste.set_image( Gtk.Image(stock=Gtk.STOCK_PASTE) )
paste.set_always_show_image(True)
paste.connect("activate", self.do_action_from_menu_controls)
self._appen_menu_items(filea_menu, [new, rename, cut, copy, paste])
open_a.set_submenu(open_menu)
file_a.set_submenu(filea_menu)
plugins.set_submenu(plugins_menu)
main_menu.attach_to_widget(self.window, None)
main_menu.show_all()
self.builder.expose_object("context_menu", main_menu)
self.builder.expose_object("context_menu_plugins", plugins_menu)
def _appen_menu_items(self, menu, items):
for item in items:
menu.append(item)
def get_current_state(self) -> State:
'''

View File

@ -83,10 +83,10 @@ class ShowHideMixin:
self.builder.get_object("plugin_controls").hide()
def show_context_menu(self, widget=None, eve=None):
self.builder.get_object("context_menu_popup").run()
self.builder.get_object("context_menu").popup_at_pointer(None)
def hide_context_menu(self, widget=None, eve=None):
self.builder.get_object("context_menu_popup").hide()
self.builder.get_object("context_menu").popdown()
def show_new_file_menu(self, widget=None, eve=None):
if widget:

View File

@ -56,7 +56,8 @@ class ManifestProcessor:
if requests["ui_target"] in [
"none", "other", "main_Window", "main_menu_bar",
"main_menu_bttn_box_bar", "path_menu_bar", "plugin_control_list",
"context_menu", "window_1", "window_2", "window_3", "window_4"
"context_menu", "context_menu_plugins", "window_1",
"window_2", "window_3", "window_4"
]:
if requests["ui_target"] == "other":
if "ui_target_id" in keys:

View File

@ -457,11 +457,6 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
<property name="can-focus">False</property>
<property name="stock">gtk-new</property>
</object>
<object class="GtkImage" id="exec_in_term_img">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="stock">gtk-execute</property>
</object>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can-focus">False</property>
@ -488,287 +483,12 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
<property name="stock">gtk-execute</property>
</object>
<object class="GtkTextBuffer" id="message_buffer"/>
<object class="GtkImage" id="open_with_img">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="stock">gtk-open</property>
</object>
<object class="GtkImage" id="rename_img">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="stock">gtk-edit</property>
<property name="icon_size">3</property>
</object>
<object class="GtkImage" id="rename_img2">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="stock">gtk-edit</property>
</object>
<object class="GtkDialog" id="context_menu_popup">
<property name="can-focus">False</property>
<property name="resizable">False</property>
<property name="window-position">mouse</property>
<property name="type-hint">splashscreen</property>
<property name="skip-pager-hint">True</property>
<property name="decorated">False</property>
<property name="deletable">False</property>
<property name="gravity">static</property>
<signal name="focus-out-event" handler="hide_context_menu" swapped="no"/>
<child internal-child="vbox">
<object class="GtkBox">
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can-focus">False</property>
<property name="layout-style">end</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="context_menu">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkExpander">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="expanded">True</property>
<property name="label-fill">True</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkButton">
<property name="label">gtk-open</property>
<property name="name">open</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Open...</property>
<property name="use-stock">True</property>
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Open With</property>
<property name="name">open_with</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">open_with_img</property>
<property name="always-show-image">True</property>
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label">gtk-execute</property>
<property name="name">execute</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="use-stock">True</property>
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Execute in Terminal</property>
<property name="name">execute_in_terminal</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">exec_in_term_img</property>
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">False</property>
<property name="label" translatable="yes">Open</property>
<property name="justify">center</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkExpander">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="expanded">True</property>
<property name="label-fill">True</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkButton">
<property name="label">gtk-new</property>
<property name="name">create</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">New File/Folder...</property>
<property name="use-stock">True</property>
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Rename</property>
<property name="name">rename</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Rename...</property>
<property name="image">rename_img2</property>
<property name="always-show-image">True</property>
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label">gtk-cut</property>
<property name="name">cut</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Cut...</property>
<property name="use-stock">True</property>
<property name="always-show-image">True</property>
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label">gtk-copy</property>
<property name="name">copy</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Copy...</property>
<property name="use-stock">True</property>
<property name="always-show-image">True</property>
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label">gtk-paste</property>
<property name="name">paste</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Paste...</property>
<property name="use-stock">True</property>
<property name="always-show-image">True</property>
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">False</property>
<property name="label" translatable="yes">File Actions</property>
<property name="justify">center</property>
<property name="ellipsize">end</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkFileChooserDialog" id="save_load_dialog">
<property name="can-focus">False</property>
<property name="type-hint">dialog</property>