mirror of
https://github.com/aclist/dztui.git
synced 2026-11-08 02:50:46 +01:00
feat: launch offline (WIP))
This commit is contained in:
1 parent
0070fe4061
commit
831bd9145d
9 files changed
+82
-6
No files matched your search
@@ -33,3 +33,28 @@ class FilePicker(Gtk.FileChooserDialog):
|
||||
self.destroy()
|
||||
return Path(file)
|
||||
return None
|
||||
|
||||
|
||||
class FolderPicker(Gtk.FileChooserDialog):
|
||||
def __init__(self, parent: Gtk.Window) -> None:
|
||||
super().__init__(
|
||||
title=picker.title,
|
||||
action=Gtk.FileChooserAction.SELECT_FOLDER,
|
||||
parent=parent,
|
||||
resizable=True,
|
||||
)
|
||||
self.add_buttons("_Cancel", Gtk.ResponseType.CANCEL)
|
||||
self.add_buttons("_OK", Gtk.ResponseType.OK)
|
||||
self.set_default_response(Gtk.ResponseType.OK)
|
||||
|
||||
def pick_folder(self) -> Path | None:
|
||||
res = self.run()
|
||||
if res in (Gtk.ResponseType.CANCEL, Gtk.ResponseType.DELETE_EVENT):
|
||||
self.destroy()
|
||||
return None
|
||||
if res == Gtk.ResponseType.OK:
|
||||
folder = self.get_current_folder()
|
||||
if folder is not None:
|
||||
self.destroy()
|
||||
return Path(folder)
|
||||
return None
|
||||
Reference in new issue
Block a user