Debian Codegraph @

src/devedeng/end_job.py

raw
1 # Copyright 2014 (C) Raster Software Vigo (Sergio Costas)
2 #
3 # This file is part of DeVeDe-NG
4 #
5 # DeVeDe-NG is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License version 3
7 # as published by the Free Software Foundation.
8 #
9 # DeVeDe-NG is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>
16
17 from gi.repository import Gtk, Gdk
18 import os
19 import devedeng.configuration_data
20
21
22 class end_window:
23
24 def __init__(self):
25
26 self.config = devedeng.configuration_data.configuration.get_config()
27
28 def run(self, time_used, do_burn):
29
30 builder = Gtk.Builder()
31 builder.set_translation_domain(self.config.gettext_domain)
32
33 builder.add_from_file(os.path.join(self.config.glade, "wdone.ui"))
34 builder.connect_signals(self)
35 werror_window = builder.get_object("done")
36 wburn = builder.get_object("button_burn")
37 wdebug_buffer = builder.get_object("debug_buffer")
38 wdebug_buffer.set_text(self.config.get_log())
39 wtime = builder.get_object("label_time")
40 hours = int(time_used / 3600)
41 minutes = int((time_used / 60) % 60)
42 seconds = int(time_used % 60)
43 time_used_str = ""
44 if hours < 10:
45 time_used_str += "0"
46 time_used_str += str(hours) + ":"
47 if minutes < 10:
48 time_used_str += "0"
49 time_used_str += str(minutes) + ":"
50 if seconds < 10:
51 time_used_str += "0"
52 time_used_str += str(seconds)
53 wtime.set_text(time_used_str)
54
55 werror_window.show_all()
56
57 if do_burn:
58 wburn.show()
59 else:
60 wburn.hide()
61
62 retval = werror_window.run()
63 werror_window.destroy()
64 if retval == 1:
65 return True # burn disc image
66 else:
67 return False
68
69 def on_copy_clicked(self, b):
70
71 clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
72 data = self.config.get_log()
73 clipboard.set_text(data, len(data))
74 return