From 1d8e2ab1f4331239cb7da6c51a3fa33b0aefc54c Mon Sep 17 00:00:00 2001 From: nyanpasu64 Date: Tue, 11 Dec 2018 18:08:03 -0800 Subject: [PATCH] Add title, separate from file_stem --- ovgenpy/gui/__init__.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ovgenpy/gui/__init__.py b/ovgenpy/gui/__init__.py index 2ad4307..e55e078 100644 --- a/ovgenpy/gui/__init__.py +++ b/ovgenpy/gui/__init__.py @@ -51,7 +51,6 @@ class MainWindow(qw.QMainWindow): # Load UI. uic.loadUi(res('mainwindow.ui'), self) # sets windowTitle - self.setWindowTitle(APP_NAME) # Bind UI buttons, etc. self.master_audio_browse.clicked.connect(self.on_master_audio_browse) @@ -66,8 +65,12 @@ class MainWindow(qw.QMainWindow): self._cfg_path = cfg_path self.load_cfg(cfg) + self.load_title() self.show() + def load_title(self): + self.setWindowTitle(f'{self.title} - {APP_NAME}') + @property def cfg_dir(self) -> str: maybe_path = self._cfg_path or self.cfg.master_audio @@ -76,8 +79,16 @@ class MainWindow(qw.QMainWindow): return '.' + UNTITLED = 'Untitled' + @property def title(self) -> str: + if self._cfg_path: + return self._cfg_path.name + return self.UNTITLED + + @property + def file_stem(self) -> str: return cli.get_name(self._cfg_path or self.cfg.master_audio) @property @@ -110,7 +121,7 @@ class MainWindow(qw.QMainWindow): def on_action_render(self): """ Get file name. Then show a progress dialog while rendering to file. """ - video_path = os.path.join(self.cfg_dir, self.title) + cli.VIDEO_NAME + video_path = os.path.join(self.cfg_dir, self.file_stem) + cli.VIDEO_NAME name, file_type = qw.QFileDialog.getSaveFileName( self, "Render to Video", video_path, "MP4 files (*.mp4);;All files (*)"