Add title, separate from file_stem

pull/357/head
nyanpasu64 2018-12-11 18:08:03 -08:00
rodzic 38e8b3ef21
commit 1d8e2ab1f4
1 zmienionych plików z 13 dodań i 2 usunięć

Wyświetl plik

@ -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 (*)"