Add folder name to title
This commit is contained in:
parent
1464273506
commit
c88d04b302
3 changed files with 33 additions and 0 deletions
|
@ -41,7 +41,16 @@ class UIStateManager:
|
||||||
if handler:
|
if handler:
|
||||||
handler()
|
handler()
|
||||||
|
|
||||||
|
def _update_title(self, folder_name=None):
|
||||||
|
w = self.window
|
||||||
|
base = "Recoder"
|
||||||
|
if folder_name:
|
||||||
|
w.folder_label.set_text(f"{base} — {folder_name}")
|
||||||
|
else:
|
||||||
|
w.folder_label.set_text(base)
|
||||||
|
|
||||||
def _handle_idle(self):
|
def _handle_idle(self):
|
||||||
|
self._update_title(None)
|
||||||
w = self.window
|
w = self.window
|
||||||
w.clear_listbox()
|
w.clear_listbox()
|
||||||
w.file_rows.clear()
|
w.file_rows.clear()
|
||||||
|
@ -58,6 +67,7 @@ class UIStateManager:
|
||||||
|
|
||||||
def _handle_files_loaded(self):
|
def _handle_files_loaded(self):
|
||||||
w = self.window
|
w = self.window
|
||||||
|
self._update_title(w.current_folder_name)
|
||||||
w.drop_hint.set_visible(False)
|
w.drop_hint.set_visible(False)
|
||||||
w.progress_bar.set_visible(False)
|
w.progress_bar.set_visible(False)
|
||||||
w.btn_transcode.set_visible(True)
|
w.btn_transcode.set_visible(True)
|
||||||
|
@ -100,6 +110,7 @@ class UIStateManager:
|
||||||
|
|
||||||
def _handle_error(self):
|
def _handle_error(self):
|
||||||
w = self.window
|
w = self.window
|
||||||
|
self._update_title(w.current_folder_name)
|
||||||
w.drop_hint.set_visible(False)
|
w.drop_hint.set_visible(False)
|
||||||
w.progress_bar.set_visible(False)
|
w.progress_bar.set_visible(False)
|
||||||
w.btn_transcode.set_visible(False)
|
w.btn_transcode.set_visible(False)
|
||||||
|
|
|
@ -27,11 +27,13 @@ class RecoderWindow(Adw.ApplicationWindow):
|
||||||
btn_transcode = Gtk.Template.Child()
|
btn_transcode = Gtk.Template.Child()
|
||||||
btn_cancel = Gtk.Template.Child()
|
btn_cancel = Gtk.Template.Child()
|
||||||
progress_bar = Gtk.Template.Child()
|
progress_bar = Gtk.Template.Child()
|
||||||
|
folder_label = Gtk.Template.Child()
|
||||||
|
|
||||||
def __init__(self, application):
|
def __init__(self, application):
|
||||||
super().__init__(application=application)
|
super().__init__(application=application)
|
||||||
|
|
||||||
self.file_items_to_process = []
|
self.file_items_to_process = []
|
||||||
|
self.current_folder_name = None
|
||||||
self.transcoder = None
|
self.transcoder = None
|
||||||
self.file_rows = {}
|
self.file_rows = {}
|
||||||
self.is_paused = False
|
self.is_paused = False
|
||||||
|
@ -56,6 +58,19 @@ class RecoderWindow(Adw.ApplicationWindow):
|
||||||
Notify.init("Recoder")
|
Notify.init("Recoder")
|
||||||
|
|
||||||
def process_drop_value(self, value):
|
def process_drop_value(self, value):
|
||||||
|
|
||||||
|
# value could be a list of Gio.File or a single Gio.File
|
||||||
|
# Assuming it's a list:
|
||||||
|
folder_file = None
|
||||||
|
if isinstance(value, list) and len(value) > 0:
|
||||||
|
folder_file = value[0]
|
||||||
|
elif hasattr(value, 'get_path'):
|
||||||
|
folder_file = value
|
||||||
|
|
||||||
|
if folder_file:
|
||||||
|
# Set the current folder name for UI
|
||||||
|
self.current_folder_name = folder_file.get_basename()
|
||||||
|
|
||||||
file_items = extract_video_files(value)
|
file_items = extract_video_files(value)
|
||||||
if not file_items:
|
if not file_items:
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -18,6 +18,13 @@
|
||||||
<property name="sensitive">False</property>
|
<property name="sensitive">False</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
<child type="title">
|
||||||
|
<object class="GtkLabel" id="folder_label">
|
||||||
|
<property name="ellipsize">end</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
<property name="halign">center</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
<child type="end">
|
<child type="end">
|
||||||
<object class="GtkButton" id="btn_cancel">
|
<object class="GtkButton" id="btn_cancel">
|
||||||
<property name="label">Cancel</property>
|
<property name="label">Cancel</property>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue