Debian Codegraph @

src/devedeng/message.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
18 import os
19 import devedeng.configuration_data
20
21
22 class message_window:
23
24 def __init__(self, text, title, list_data=None):
25
26 self.config = devedeng.configuration_data.configuration.get_config()
27
28 builder = Gtk.Builder()
29 builder.set_translation_domain(self.config.gettext_domain)
30
31 builder.add_from_file(os.path.join(self.config.glade, "wmessage.ui"))
32 builder.connect_signals(self)
33 wmessage_window = builder.get_object("dialog_message")
34 wmessage_window.set_title(title)
35 wmessage_text = builder.get_object("label_message")
36 wmessage_text.set_markup(text)
37 wmessage_list = builder.get_object("list_message")
38 wmessage_liststore = builder.get_object("liststore_elements")
39 wmessage_window.show_all()
40
41 if (list_data is None):
42 wmessage_list.hide()
43 else:
44 for element in list_data:
45 wmessage_liststore.append([element])
46
47 wmessage_window.run()
48 wmessage_window.destroy()