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

161
data/interface/wdone.ui Normal file
View file

@ -0,0 +1,161 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.16.1 -->
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkTextBuffer" id="debug_buffer"/>
<object class="GtkDialog" id="done">
<property name="can_focus">False</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="button_burn">
<property name="label" translatable="yes">Burn</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button1">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="message">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Job done!</property>
<property name="ellipsize">start</property>
<property name="angle">0.029999999999999999</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">31</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_time">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">16</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkExpander" id="expander1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="resize_toplevel">True</property>
<child>
<object class="GtkBox" id="box3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="height_request">240</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTextView" id="debug">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="buffer">debug_buffer</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="copy">
<property name="label">gtk-copy</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_copy_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Debugging data</property>
<property name="ellipsize">start</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="1">button_burn</action-widget>
<action-widget response="0">button1</action-widget>
</action-widgets>
</object>
</interface>

View file

@ -51,7 +51,7 @@ class dvdauthor_converter(devede.executor.executor):
return return
def process_stderr(self,data): def process_stderr(self,data):
if data != None: if (data != None) and (data[0] != ""):
self.progress_bar[1].set_text(data[0]) self.progress_bar[1].set_text(data[0])
return 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) filesystem_path = os.path.join(path,name)
final_path = os.path.join(path,name+".iso") final_path = os.path.join(path,name+".iso")
self.command_var=[] self.command_var=[]
self.command_var.append("mkisofs") self.command_var.append("mkisofs")
self.command_var.append("-dvd-video") self.command_var.append("-dvd-video")
@ -53,7 +53,7 @@ class mkisofs(devede.executor.executor):
if (data[0].find("% done") == -1): if (data[0].find("% done") == -1):
return return
l = data[0].split("%") l = data[0].split("%")
p = float(l[0]) p = float(l[0])
self.progress_bar[1].set_fraction(p) self.progress_bar[1].set_fraction(p)

View file

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

View file

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