Now deletes the destination folder before creating the disc
Allows to shutdown the computer at end
This commit is contained in:
parent
64a33e1c74
commit
b881568e79
3 changed files with 68 additions and 1 deletions
|
|
@ -255,7 +255,6 @@ class interface_manager(GObject.GObject):
|
|||
counter = 0
|
||||
dv = 0
|
||||
for item in element[1]:
|
||||
print (item)
|
||||
the_list.append([item])
|
||||
if (item == obj):
|
||||
dv = counter
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
from gi.repository import Gtk
|
||||
import os
|
||||
import time
|
||||
import shutil
|
||||
|
||||
import devede.file_movie
|
||||
import devede.ask
|
||||
|
|
@ -31,6 +32,7 @@ import devede.dvdauthor_converter
|
|||
import devede.mkisofs
|
||||
import devede.end_job
|
||||
import devede.vcdimager_converter
|
||||
import devede.shutdown
|
||||
|
||||
class devede_project:
|
||||
|
||||
|
|
@ -373,6 +375,16 @@ class devede_project:
|
|||
if (not data.run()):
|
||||
return
|
||||
|
||||
if os.path.exists(data.path):
|
||||
ask_w = devede.ask.ask_window()
|
||||
retval = ask_w.run(_("The selected folder already exists. If you continue, it will be deleted. Continue?"),_("Delete folder"))
|
||||
if retval:
|
||||
shutil.rmtree(data.path,True)
|
||||
else:
|
||||
return
|
||||
|
||||
self.shutdown = data.shutdown
|
||||
|
||||
run_window = devede.runner.runner()
|
||||
file_movies = self.get_all_files()
|
||||
|
||||
|
|
@ -432,6 +444,10 @@ class devede_project:
|
|||
|
||||
def disc_done(self,object,value):
|
||||
|
||||
if self.shutdown:
|
||||
Gtk.main_quit()
|
||||
devede.shutdown.shutdown()
|
||||
|
||||
if value == 0:
|
||||
ended = devede.end_job.end_window()
|
||||
if self.disc_image_name == None:
|
||||
|
|
|
|||
52
src/devede/shutdown.py
Normal file
52
src/devede/shutdown.py
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
# Copyright 2014 (C) Raster Software Vigo (Sergio Costas)
|
||||
#
|
||||
# This file is part of DeVeDe-NG
|
||||
#
|
||||
# DeVeDe-NG is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# DeVeDe-NG is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
import dbus
|
||||
|
||||
class shutdown:
|
||||
|
||||
def __init__(self):
|
||||
|
||||
# First, try with logind
|
||||
try:
|
||||
bus = dbus.SystemBus()
|
||||
bus_object = bus.get_object("org.freedesktop.login1", "/org/freedesktop/login1")
|
||||
bus_object.PowerOff(False, dbus_interface="org.freedesktop.login1.Manager")
|
||||
except:
|
||||
failure=True
|
||||
|
||||
if (failure):
|
||||
failure=False
|
||||
|
||||
# If it fails, try with ConsoleKit
|
||||
try:
|
||||
bus = dbus.SystemBus()
|
||||
bus_object = bus.get_object("org.freedesktop.ConsoleKit", "/org/freedesktop/ConsoleKit/Manager")
|
||||
bus_object.Stop(dbus_interface="org.freedesktop.ConsoleKit.Manager")
|
||||
except:
|
||||
failure=True
|
||||
|
||||
if (failure):
|
||||
failure=False
|
||||
|
||||
# If it fails, try with HAL
|
||||
try:
|
||||
bus = dbus.SystemBus()
|
||||
bus_object = bus.get_object("org.freedesktop.Hal", "/org/freedesktop/Hal/devices/computer")
|
||||
bus_object.Shutdown(dbus_interface="org.freedesktop.Hal.Device.SystemPowerManagement")
|
||||
except:
|
||||
failure=True
|
||||
Loading…
Add table
Add a link
Reference in a new issue