1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
3
# Copyright (C) 2012 Andre Gregor-Herrmann <am.herrmann@gmx.de>
4
# This program is free software: you can redistribute it and/or modify it
5
# under the terms of the GNU General Public License version 3, as published
6
# by the Free Software Foundation.
8
# This program is distributed in the hope that it will be useful, but
9
# WITHOUT ANY WARRANTY; without even the implied warranties of
10
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11
# PURPOSE. See the GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License along
14
# with this program. If not, see <http://www.gnu.org/licenses/>.
17
from gi.repository import Gtk # pylint: disable=E0611
19
from armorforge_lib.helpers import get_builder
22
from gettext import gettext as _
23
gettext.textdomain('armorforge')
25
class NewprofileDialog(Gtk.Dialog):
26
__gtype_name__ = "NewprofileDialog"
29
"""Special static method that's automatically called by Python when
30
constructing a new instance of this class.
32
Returns a fully instantiated NewprofileDialog object.
34
builder = get_builder('NewprofileDialog')
35
new_object = builder.get_object('newprofile_dialog')
36
new_object.finish_initializing(builder)
39
def finish_initializing(self, builder):
40
"""Called when we're finished initializing.
42
finish_initalizing should be called after parsing the ui definition
43
and creating a NewprofileDialog object with it in order to
44
finish initializing the start of the new NewprofileDialog
47
# Get a reference to the builder and set up the signals.
48
self.builder = builder
49
self.ui = builder.get_ui(self)
51
self.newprofileentry = self.builder.get_object("newprofileentry")
54
def get_newprofilename(self):
55
return self.newprofileentry.get_text()
58
def on_btn_ok_clicked(self, widget, data=None):
59
"""The user has elected to save the changes.
61
Called before the dialog returns Gtk.ResponseType.OK from run().
65
def on_btn_cancel_clicked(self, widget, data=None):
66
"""The user has elected cancel changes.
68
Called before the dialog returns Gtk.ResponseType.CANCEL for run()
73
if __name__ == "__main__":
74
dialog = NewprofileDialog()