Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | # |
| 2 | # BitBake Graphical GTK User Interface |
| 3 | # |
| 4 | # Copyright (C) 2013 Intel Corporation |
| 5 | # |
| 6 | # Authored by Cristiana Voicu <cristiana.voicu@intel.com> |
| 7 | # |
| 8 | # This program is free software; you can redistribute it and/or modify |
| 9 | # it under the terms of the GNU General Public License version 2 as |
| 10 | # published by the Free Software Foundation. |
| 11 | # |
| 12 | # This program is distributed in the hope that it will be useful, |
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | # GNU General Public License for more details. |
| 16 | # |
| 17 | # You should have received a copy of the GNU General Public License along |
| 18 | # with this program; if not, write to the Free Software Foundation, Inc., |
| 19 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | |
| 21 | import gtk |
| 22 | |
| 23 | class RetrieveImageDialog (gtk.FileChooserDialog): |
| 24 | """ |
| 25 | This class is used to create a dialog that permits to retrieve |
| 26 | a custom image saved previously from Hob. |
| 27 | """ |
| 28 | def __init__(self, directory,title, parent, flags, buttons=None): |
| 29 | super(RetrieveImageDialog, self).__init__(title, None, gtk.FILE_CHOOSER_ACTION_OPEN, |
| 30 | (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN, gtk.RESPONSE_OK)) |
| 31 | self.directory = directory |
| 32 | |
| 33 | # create visual elements on the dialog |
| 34 | self.create_visual_elements() |
| 35 | |
| 36 | def create_visual_elements(self): |
| 37 | self.set_show_hidden(True) |
| 38 | self.set_default_response(gtk.RESPONSE_OK) |
| 39 | self.set_current_folder(self.directory) |
| 40 | |
| 41 | vbox = self.get_children()[0].get_children()[0].get_children()[0] |
| 42 | for child in vbox.get_children()[0].get_children()[0].get_children()[0].get_children(): |
| 43 | vbox.get_children()[0].get_children()[0].get_children()[0].remove(child) |
| 44 | |
| 45 | label1 = gtk.Label() |
| 46 | label1.set_text("File system" + self.directory) |
| 47 | label1.show() |
| 48 | vbox.get_children()[0].get_children()[0].get_children()[0].pack_start(label1, expand=False, fill=False, padding=0) |
| 49 | vbox.get_children()[0].get_children()[1].get_children()[0].hide() |
| 50 | |
| 51 | self.get_children()[0].get_children()[1].get_children()[0].set_label("Select") |