示例#1
0
    def __init__(self):
        self.client_profile = GLIClientConfiguration.ClientConfiguration()
        self.install_profile = GLIInstallProfile.InstallProfile()
        self._pretend = False
        self._debug = False

        for arg in sys.argv:
            if arg == "-p" or arg == "--pretend":
                self._pretend = True
            elif arg == "-d" or arg == "--debug":
                self._debug = True

        self.cc = GLIClientController.GLIClientController(
            pretend=self._pretend)

        self.window = None
        self.panel = None
        self._cur_panel = 0
        self.__full_path = self.get_current_path()
        self.splash = SplashScreen(self.__full_path)
        self.splash.show()
        while gtk.events_pending():
            gtk.main_iteration()
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.title = _("Gentoo Linux Installer")
        self.window.realize()
        self.window.connect("delete_event", self.delete_event)
        self.window.connect("destroy", self.destroy)
        self.window.set_border_width(0)
        self.window.set_default_size(800, 600)
        self.window.set_geometry_hints(None,
                                       min_width=800,
                                       min_height=600,
                                       max_width=800,
                                       max_height=600)
        self.window.set_title(_("Gentoo Linux Installer"))
        self.globalbox = gtk.VBox(False, 0)
        self.window.add(self.globalbox)

        # Banner image
        self.headerbox = gtk.HBox(False, 0)
        headerimg = gtk.Image()
        headerimg.set_from_file(self.__full_path +
                                '/installer-banner-800x64.png')
        self.headerbox.add(headerimg)
        self.globalbox.pack_start(self.headerbox,
                                  expand=False,
                                  fill=False,
                                  padding=0)

        # Future bar
        self.futurebar = GLIFutureBar(
            [element['text'] for element in self.menuItems])
        self.globalbox.pack_start(self.futurebar,
                                  expand=False,
                                  fill=False,
                                  padding=5)
        self.globalbox.pack_start(gtk.HSeparator(),
                                  expand=False,
                                  fill=False,
                                  padding=0)

        # Top box
        self.topbox = gtk.HBox(False, 0)
        self.globalbox.pack_start(self.topbox,
                                  expand=True,
                                  fill=True,
                                  padding=5)

        # Bottom box
        self.bottombox = gtk.HBox(False, 0)
        self.globalbox.pack_end(self.bottombox,
                                expand=False,
                                fill=False,
                                padding=5)
        self.globalbox.pack_end(gtk.HSeparator(),
                                expand=False,
                                fill=False,
                                padding=0)
        self.rightframe = gtk.VBox(False, 0)
        self.topbox.pack_end(self.rightframe,
                             expand=True,
                             fill=True,
                             padding=5)
        self.globalbox.show_all()

        # Right frame contents
        self.panels = []
        self.right_pane_box = gtk.Notebook()
        #		for item in self.menuItems:
        #			if item['module'] == None: break
        #			if self._debug:
        #				print "Instantiating " + item['text'] + " screen...",
        #			panel = item['module'].Panel(self)
        #			if self._debug:
        #				print "done"
        #			self.panels.append(panel)
        #			self.right_pane_box.append_page(panel)
        self.right_pane_box.set_show_tabs(False)
        self.right_pane_box.set_show_border(False)
        self.rightframe.add(self.right_pane_box)

        buttons_info = [
            ('exit', _(" _Exit "), '/button_images/stock_exit.png',
             self.exit_button, 'start'),
            ('help', _(" _Help "), '/button_images/stock_help.png', self.help,
             'start'),
            ('load', _(" _Load "), '/button_images/stock_open.png',
             self.load_button, 'start'),
            ('save', _(" _Save "), '/button_images/stock_save.png',
             self.save_button, 'start'),
            ('finish', _(" _Install "), '/button_images/stock_exec.png',
             self.finish, 'end'),
            ('forward', _(" _Forward "), '/button_images/stock_right.png',
             self.forward, 'end'),
            ('back', _(" _Back "), '/button_images/stock_left.png', self.back,
             'end')
        ]
        self.buttons = {}

        for button in buttons_info:
            self.buttons[button[0]] = gtk.Button()
            tmpbuttonbox = gtk.HBox(False, 0)
            tmpbuttonimg = gtk.Image()
            tmpbuttonimg.set_from_file(self.__full_path + button[2])
            tmpbuttonbox.pack_start(tmpbuttonimg)
            tmpbuttonlabel = gtk.Label(button[1])
            tmpbuttonlabel.set_use_underline(True)
            tmpbuttonbox.pack_start(tmpbuttonlabel)
            self.buttons[button[0]].add(tmpbuttonbox)
            self.buttons[button[0]].connect("clicked", button[3], None)
            if button[4] == "start":
                self.bottombox.pack_start(self.buttons[button[0]],
                                          expand=False,
                                          fill=False,
                                          padding=5)
            else:
                self.bottombox.pack_end(self.buttons[button[0]],
                                        expand=False,
                                        fill=False,
                                        padding=5)

        gobject.idle_add(self.init_screens)