forked from jeanslack/Videomass
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
549 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,10 @@ videomass (5.0.13-1) UNRELEASED; urgency=medium | |
* Update english user guide documentation (pdf docs) and related references. | ||
* Fixed wrong deinterlace command option using w3fdif filter. | ||
* [YouTube Downloader] Fixed audio/video qualities (see #305 #307) | ||
* Added shutdown system and auto-exit the application. These settings are | ||
found on the "Exit and Shutdown" tab of Preferences dialog (see #306). | ||
|
||
-- Gianluca Pernigotto <[email protected]> Fri, 10 May 2024 13:00:00 +0200 | ||
-- Gianluca Pernigotto <[email protected]> Mon, 13 May 2024 14:00:00 +0200 | ||
|
||
videomass (5.0.12-1) UNRELEASED; urgency=medium | ||
|
||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
Author: Gianluca Pernigotto <[email protected]> | ||
Copyleft - 2024 Gianluca Pernigotto <[email protected]> | ||
license: GPL3 | ||
Rev: Apr.09.2024 | ||
Rev: May.11.2024 | ||
Code checker: flake8, pylint | ||
This file is part of Videomass. | ||
|
@@ -46,6 +46,7 @@ | |
from videomass.vdms_dialogs.mediainfo import MediaStreams | ||
from videomass.vdms_dialogs.showlogs import ShowLogs | ||
from videomass.vdms_dialogs.ffmpeg_help import FFmpegHelp | ||
from videomass.vdms_dialogs.widget_utils import CountDownDlg | ||
from videomass.vdms_miniframes import timeline | ||
from videomass.vdms_panels import choose_topic | ||
from videomass.vdms_panels import filedrop | ||
|
@@ -60,6 +61,7 @@ | |
from videomass.vdms_sys.settings_manager import ConfigManager | ||
from videomass.vdms_sys.argparser import info_this_platform | ||
from videomass.vdms_utils.utils import copydir_recursively | ||
from videomass.vdms_threads.shutdown import shutdown_system | ||
|
||
|
||
class MainFrame(wx.Frame): | ||
|
@@ -358,35 +360,11 @@ def destroy_orphaned_window(self): | |
self.audivolnormalize = False | ||
# ------------------------------------------------------------------# | ||
|
||
def on_close(self, event): | ||
def write_option_before_exit(self): | ||
""" | ||
Where possible, it destroys the application and | ||
its children programmatically, saving the size | ||
and position of the window. | ||
Write user settings to the configuration file | ||
before exit the application. | ||
""" | ||
if self.ProcessPanel.IsShown(): | ||
if self.ProcessPanel.thread_type is not None: | ||
wx.MessageBox(_('There are still processes running. if you ' | ||
'want to stop them, use the "Abort" button.'), | ||
_('Videomass - Warning!'), wx.ICON_WARNING, self) | ||
return | ||
|
||
if self.appdata['warnexiting']: | ||
if wx.MessageBox(_('Are you sure you want to exit ' | ||
'the application?'), | ||
_('Exit'), wx.ICON_QUESTION | wx.CANCEL | ||
| wx.YES_NO, self) != wx.YES: | ||
return | ||
|
||
if self.ytdlframe: | ||
if self.ytdlframe.ProcessPanel.thread_type: | ||
wx.MessageBox(_("There are still active windows with running " | ||
"processes, make sure you finish your work " | ||
"before closing them."), | ||
"Videomass - Warning!", wx.ICON_WARNING, self) | ||
return | ||
self.ytdlframe.on_exit(self, warn=False) | ||
|
||
confmanager = ConfigManager(self.appdata['fileconfpath']) | ||
sett = confmanager.read_options() | ||
sett['main_window_size'] = list(self.GetSize()) | ||
|
@@ -406,27 +384,71 @@ def on_close(self, event): | |
] | ||
sett['filedrop_column_width'] = filedropcolwidth | ||
confmanager.write_options(**sett) | ||
self.destroy_orphaned_window() | ||
self.Destroy() | ||
# ------------------------------------------------------------------# | ||
|
||
def on_Kill(self): | ||
def checks_running_processes(self): | ||
""" | ||
This method tries to destroy the application and its | ||
children more directly than the `on_close` method above. | ||
Note that this method may also be called from the `Setup()` | ||
method. | ||
Check currently running processes | ||
""" | ||
if self.ProcessPanel.IsShown(): | ||
if self.ProcessPanel.thread_type is not None: | ||
return True | ||
if self.ytdlframe: | ||
if self.ytdlframe.ProcessPanel.thread_type: | ||
wx.MessageBox(_("There are still active windows with running " | ||
"processes, make sure you finish your work " | ||
"before closing them."), | ||
"Videomass - Warning!", wx.ICON_WARNING, self) | ||
return True | ||
|
||
return False | ||
# ------------------------------------------------------------------# | ||
|
||
def on_close(self, event, ): | ||
""" | ||
Application exit request given by the user. | ||
""" | ||
if self.checks_running_processes(): | ||
wx.MessageBox(_("There are still active windows with running " | ||
"processes, make sure you finish your work " | ||
"before exit."), | ||
_('Videomass - Warning!'), wx.ICON_WARNING, self) | ||
return | ||
|
||
if self.appdata['warnexiting']: | ||
if wx.MessageBox(_('Are you sure you want to exit ' | ||
'the application?'), | ||
_('Exit'), wx.ICON_QUESTION | wx.CANCEL | ||
| wx.YES_NO, self) != wx.YES: | ||
return | ||
self.ytdlframe.destroy_orphaned_window() | ||
|
||
if self.ytdlframe: | ||
self.ytdlframe.on_exit(self, warn=False) | ||
self.write_option_before_exit() | ||
self.destroy_orphaned_window() | ||
self.destroy_application() | ||
# ------------------------------------------------------------------# | ||
|
||
def on_Kill(self): | ||
""" | ||
This method is called after from the `Setup()` method. | ||
""" | ||
if self.checks_running_processes(): | ||
wx.MessageBox(_("There are still active windows with running " | ||
"processes, make sure you finish your work " | ||
"before exit."), | ||
_('Videomass - Warning!'), wx.ICON_WARNING, self) | ||
return | ||
|
||
if self.ytdlframe: | ||
self.ytdlframe.on_exit(self, warn=False) | ||
self.destroy_orphaned_window() | ||
self.destroy_application() | ||
# ------------------------------------------------------------------# | ||
|
||
def destroy_application(self): | ||
""" | ||
Permanent exit from the application. | ||
Do not use this method directly. | ||
""" | ||
self.Destroy() | ||
# ------------------------------------------------------------------# | ||
|
||
# ------------- BUILD THE MENU BAR ----------------### | ||
|
||
|
@@ -1090,11 +1112,6 @@ def Setup(self, event): | |
changes = set_up.getvalue() | ||
self.fileDnDTarget.on_file_save(self.appdata['outputdir']) | ||
if [x for x in changes if x is False]: | ||
if self.ProcessPanel.IsShown(): | ||
if self.ProcessPanel.thread_type is not None: | ||
wx.MessageBox(msg, _('Videomass - Warning!'), | ||
wx.ICON_WARNING, self) | ||
return | ||
if wx.MessageBox(_("{0}\n\nDo you want to restart " | ||
"the application now?").format(msg), | ||
_('Restart Videomass?'), wx.ICON_QUESTION | ||
|
@@ -1757,6 +1774,11 @@ def process_terminated(self, msg): | |
self.rename.Enable(True) | ||
if self.file_src: | ||
self.rename_batch.Enable(True) | ||
|
||
if self.appdata['shutdown']: | ||
self.auto_shutdown() | ||
elif self.appdata['auto_exit']: | ||
self.auto_exit() | ||
# ------------------------------------------------------------------# | ||
|
||
def panelShown(self, panelshown=None): | ||
|
@@ -1799,3 +1821,48 @@ def youtubedl(self, event): | |
self.ytdlframe = MainYtdl(self.appdata, | ||
parent=wx.GetTopLevelParent(self)) | ||
self.ytdlframe.Show() | ||
# ------------------------------------------------------------------# | ||
|
||
def auto_shutdown(self): | ||
""" | ||
Turn off the system when processing is finished | ||
""" | ||
if self.checks_running_processes(): | ||
return | ||
if self.ytdlframe: | ||
self.ytdlframe.on_exit(self, warn=False) | ||
self.write_option_before_exit() | ||
|
||
msgdlg = 'The system will turn off in {0} seconds' | ||
title = _('Videomass - Shutdown!') | ||
dlg = CountDownDlg(self, timeout=59, message=msgdlg, caption=title) | ||
res = dlg.ShowModal() == wx.ID_OK | ||
dlg.Destroy() | ||
if res: | ||
succ = shutdown_system(self.appdata['sudo_password']) | ||
if not succ: | ||
msg = (_("Error while shutting down. Please see\" " | ||
"Shutdown.log\" file for details.")) | ||
self.statusbar_msg(msg, | ||
self.appdata['colorscheme']['ERR1'], | ||
'#fbf4f4') | ||
# ------------------------------------------------------------------# | ||
|
||
def auto_exit(self): | ||
""" | ||
Auto-exit the application when processing is finished | ||
""" | ||
if self.checks_running_processes(): | ||
return | ||
|
||
msgdlg = 'Exiting the application in {0} seconds' | ||
title = _('Videomass - Exiting!') | ||
dlg = CountDownDlg(self, timeout=10, message=msgdlg, caption=title) | ||
res = dlg.ShowModal() == wx.ID_OK | ||
dlg.Destroy() | ||
if res: | ||
if self.ytdlframe: | ||
self.ytdlframe.on_exit(self, warn=False) | ||
self.write_option_before_exit() | ||
self.destroy_orphaned_window() | ||
self.destroy_application() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.