Now shows a dialog at the end of the creation

This commit is contained in:
Sergio Costas 2014-08-01 23:59:25 +02:00
parent 6b2596d432
commit a9c4b266ea
6 changed files with 241 additions and 5 deletions

View file

@ -51,7 +51,7 @@ class dvdauthor_converter(devede.executor.executor):
return
def process_stderr(self,data):
if data != None:
if (data != None) and (data[0] != ""):
self.progress_bar[1].set_text(data[0])
return

68
src/devede/end_job.py Normal file
View file

@ -0,0 +1,68 @@
# 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/>
from gi.repository import Gtk,Gdk
import os
import devede.configuration_data
class end_window:
def __init__(self):
self.config = devede.configuration_data.configuration.get_config()
def run(self,time_used):
builder = Gtk.Builder()
builder.set_translation_domain(self.config.gettext_domain)
builder.add_from_file(os.path.join(self.config.glade,"wdone.ui"))
builder.connect_signals(self)
werror_window = builder.get_object("done")
wdebug_buffer = builder.get_object("debug_buffer")
wdebug_buffer.insert_at_cursor(self.config.get_log())
wtime = builder.get_object("label_time")
hours = int(time_used / 3600)
minutes = int((time_used / 60) % 60)
seconds = int(time_used % 60)
time_used_str = ""
if hours < 10:
time_used_str += "0"
time_used_str += str(hours)+":"
if minutes < 10:
time_used_str += "0"
time_used_str += str(minutes)+":"
if seconds < 10:
time_used_str += "0"
time_used_str += str(seconds)
wtime.set_text(time_used_str)
werror_window.show_all()
retval = werror_window.run()
werror_window.destroy()
if retval == 1:
return True # burn disc image
else:
return False
def on_copy_clicked(self,b):
clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
data =self.config.get_log()
clipboard.set_text(data,len(data))
return

View file

@ -32,7 +32,7 @@ class mkisofs(devede.executor.executor):
filesystem_path = os.path.join(path,name)
final_path = os.path.join(path,name+".iso")
self.command_var=[]
self.command_var.append("mkisofs")
self.command_var.append("-dvd-video")
@ -53,7 +53,7 @@ class mkisofs(devede.executor.executor):
if (data[0].find("% done") == -1):
return
l = data[0].split("%")
p = float(l[0])
self.progress_bar[1].set_fraction(p)

View file

@ -17,6 +17,7 @@
from gi.repository import Gtk
import os
import time
import devede.file_movie
import devede.ask
@ -28,6 +29,7 @@ import devede.runner
import devede.settings
import devede.dvdauthor_converter
import devede.mkisofs
import devede.end_job
class devede_project:
@ -306,11 +308,16 @@ class devede_project:
run_window.connect("done",self.disc_done)
self.wmain_window.hide()
self.time_start = time.time()
run_window.run()
def disc_done(self,object,value):
if value == 0:
ended = devede.end_job.end_window()
ended.run(time.time() - self.time_start)
self.wmain_window.show()
def on_preview_file_clicked(self,b):

View file

@ -114,7 +114,7 @@ class runner(GObject.GObject):
element.cancel()
self.wprogress.destroy()
devede.error.error_window()
self.emit("done",1)
self.emit("done",1) # there was an error
return
# move the progress bar used by this process to the list of available progress bars
@ -140,4 +140,4 @@ class runner(GObject.GObject):
self.run(False)
else:
self.wprogress.destroy()
self.emit("done",0)
self.emit("done",0) # no error