Fixed trasher alert dialog issue, moved import lines
This commit is contained in:
parent
22b22958de
commit
b488c989b2
|
@ -101,14 +101,14 @@ class Plugin(PluginBase):
|
||||||
state = self._fm_state
|
state = self._fm_state
|
||||||
uris = state.selected_files
|
uris = state.selected_files
|
||||||
response = None
|
response = None
|
||||||
|
|
||||||
state.warning_alert.format_secondary_text(f"Do you really want to delete the {len(uris)} file(s)?")
|
state.message_dialog.format_secondary_text(f"Do you really want to delete the {len(uris)} file(s)?")
|
||||||
for uri in uris:
|
for uri in uris:
|
||||||
file = Gio.File.new_for_path(uri)
|
file = Gio.File.new_for_path(uri)
|
||||||
|
|
||||||
if not response:
|
if not response:
|
||||||
response = state.warning_alert.run()
|
response = state.message_dialog.run()
|
||||||
state.warning_alert.hide()
|
state.message_dialog.hide()
|
||||||
if response == Gtk.ResponseType.YES:
|
if response == Gtk.ResponseType.YES:
|
||||||
type = file.query_file_type(flags=Gio.FileQueryInfoFlags.NONE)
|
type = file.query_file_type(flags=Gio.FileQueryInfoFlags.NONE)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
"""
|
||||||
|
Dialogs module
|
||||||
|
"""
|
|
@ -1,7 +1,7 @@
|
||||||
# Python imports
|
# Python imports
|
||||||
|
import inspect
|
||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
import inspect
|
|
||||||
import gi
|
import gi
|
||||||
gi.require_version('Gtk', '3.0')
|
gi.require_version('Gtk', '3.0')
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Python imports
|
# Python imports
|
||||||
|
import inspect
|
||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
import inspect
|
|
||||||
import gi
|
import gi
|
||||||
gi.require_version('Gtk', '3.0')
|
gi.require_version('Gtk', '3.0')
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Python imports
|
# Python imports
|
||||||
|
import inspect
|
||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
import inspect
|
|
||||||
import gi
|
import gi
|
||||||
gi.require_version('Gtk', '3.0')
|
gi.require_version('Gtk', '3.0')
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Python imports
|
# Python imports
|
||||||
|
import inspect
|
||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
import inspect
|
|
||||||
import gi
|
import gi
|
||||||
gi.require_version('Gtk', '3.0')
|
gi.require_version('Gtk', '3.0')
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
|
@ -17,17 +17,25 @@ class MessageWidget(Gtk.MessageDialog):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(MessageWidget, self).__init__()
|
super(MessageWidget, self).__init__()
|
||||||
|
|
||||||
|
|
||||||
self._setup_styling()
|
self._setup_styling()
|
||||||
self._setup_signals()
|
self._setup_signals()
|
||||||
self._load_widgets()
|
self._load_widgets()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _setup_styling(self):
|
def _setup_styling(self):
|
||||||
...
|
self.type = Gtk.MessageType.WARNING
|
||||||
|
|
||||||
def _setup_signals(self):
|
def _setup_signals(self):
|
||||||
...
|
...
|
||||||
|
|
||||||
|
|
||||||
def _load_widgets(self):
|
def _load_widgets(self):
|
||||||
...
|
message_area = self.get_message_area()
|
||||||
|
message_area.get_children()[0].set_label("Alert!")
|
||||||
|
message_area.show_all()
|
||||||
|
|
||||||
|
self.set_image( Gtk.Image.new_from_icon_name("user-alert", 16) )
|
||||||
|
self.add_buttons(Gtk.STOCK_NO, Gtk.ResponseType.NO)
|
||||||
|
self.add_buttons(Gtk.STOCK_YES, Gtk.ResponseType.YES)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Python imports
|
# Python imports
|
||||||
|
import inspect
|
||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
import inspect
|
|
||||||
import gi
|
import gi
|
||||||
gi.require_version('Gtk', '3.0')
|
gi.require_version('Gtk', '3.0')
|
||||||
gi.require_version('Gdk', '3.0')
|
gi.require_version('Gdk', '3.0')
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Python imports
|
# Python imports
|
||||||
|
import inspect
|
||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
import inspect
|
|
||||||
import gi
|
import gi
|
||||||
gi.require_version('Gtk', '3.0')
|
gi.require_version('Gtk', '3.0')
|
||||||
gi.require_version('Gdk', '3.0')
|
gi.require_version('Gdk', '3.0')
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Python imports
|
# Python imports
|
||||||
|
import inspect
|
||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
import inspect
|
|
||||||
import gi
|
import gi
|
||||||
gi.require_version('Gtk', '3.0')
|
gi.require_version('Gtk', '3.0')
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Python imports
|
# Python imports
|
||||||
|
import inspect
|
||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
import inspect
|
|
||||||
import gi
|
import gi
|
||||||
gi.require_version('Gtk', '3.0')
|
gi.require_version('Gtk', '3.0')
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
|
|
Loading…
Reference in New Issue