Added save error messages button
This commit is contained in:
parent
3e8ed89e77
commit
cd1e5003fb
|
@ -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>
|
||||
|
|
|
@ -1421,23 +1421,50 @@ SolarFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspe
|
|||
<property name="relative-to">controll_box</property>
|
||||
<property name="position">bottom</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="height-request">600</property>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<property name="overlay-scrolling">False</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkTextView" id="message_view">
|
||||
<property name="name">message_view</property>
|
||||
<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>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="editable">False</property>
|
||||
<property name="cursor-visible">False</property>
|
||||
<property name="buffer">message_buffer</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<property name="overlay-scrolling">False</property>
|
||||
<child>
|
||||
<object class="GtkTextView" id="message_view">
|
||||
<property name="name">message_view</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="editable">False</property>
|
||||
<property name="cursor-visible">False</property>
|
||||
<property name="buffer">message_buffer</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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}")
|
||||
|
||||
|
|
Loading…
Reference in New Issue