Added save error messages button

This commit is contained in:
itdominator 2021-11-28 20:27:49 -06:00
parent 3e8ed89e77
commit cd1e5003fb
5 changed files with 60 additions and 16 deletions

View File

@ -12,7 +12,6 @@ SolarFM is a Gtk + Python file manager.
<li>Add path bar search dropdown.</li>
<li>Add "execute" and "execute in terminal" context options.</li>
<li>Add "go to trash" and "delete all trash" options.</li>
<li>Add save button for "show errors" dropdown.</li>
<li>Add simpleish plugin system to run bash/python scripts.</li>
<li>Add DnD context awareness for over folder drop.</li>
</ul>

View File

@ -1420,6 +1420,26 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
<property name="hexpand">True</property>
<property name="relative-to">controll_box</property>
<property name="position">bottom</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-save-as</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="save_debug_alerts" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="height-request">600</property>
@ -1440,6 +1460,13 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
</object>
</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="GtkImage" id="trash_img">

View File

@ -82,6 +82,27 @@ class Controller(Controller_Data, ShowHideMixin, KeyboardSignalsMixin, WidgetFil
time.sleep(seconds)
GLib.idle_add(self.message_widget.popdown)
def save_debug_alerts(self, widget=None, eve=None):
start_itr, end_itr = self.message_buffer.get_bounds()
save_location_prompt = Gtk.FileChooserDialog("Choose Save Folder", self.window, \
action = Gtk.FileChooserAction.SAVE, \
buttons = (Gtk.STOCK_CANCEL, \
Gtk.ResponseType.CANCEL, \
Gtk.STOCK_SAVE, \
Gtk.ResponseType.OK))
text = self.message_buffer.get_text(start_itr, end_itr, False)
resp = save_location_prompt.run()
if (resp == Gtk.ResponseType.CANCEL) or (resp == Gtk.ResponseType.DELETE_EVENT):
pass
elif resp == Gtk.ResponseType.OK:
target = save_location_prompt.get_filename();
with open(target, "w") as f:
f.write(text)
save_location_prompt.destroy()
def do_edit_files(self, widget=None, eve=None):

View File

@ -15,7 +15,7 @@ class ShowHideMixin:
def show_about_page(self, widget=None, eve=None):
about_page = self.builder.get_object("about_page")
response = about_page.run()
if response == -4:
if (response == Gtk.ResponseType.CANCEL) or (response == Gtk.ResponseType.DELETE_EVENT):
self.hide_about_page()
def hide_about_page(self, widget=None, eve=None):

View File

@ -76,7 +76,6 @@ class WidgetMixin:
return None
except Exception as e:
print("System icon generation issue:")
print( repr(e) )
return None
@ -91,8 +90,6 @@ class WidgetMixin:
label.set_label(f"{view.get_end_of_path()}")
label.set_width_chars(len(view.get_end_of_path()))
# label.set_margin_start(5)
# label.set_margin_end(15)
label.set_xalign(0.0)
tid.set_label(f"{view.id}")