Exemple #1
0
    def init_ui(self):

        self.application = PlayerApplication(destroy_func=self.quit,
                                             max_callback=self.max_callback)
        if self.width + 12 < 642:
            width = 642 + 220
        else:
            width = self.width + 12 + 220
        self.application.set_default_size(width, self.height + 73)
        self.application.set_skin_preview(get_common_image("frame.png"))
        self.application.set_icon(get_common_image("logo48.png"))
        self.application.add_titlebar(["mode", "min", "max", "close"], )
        player_title = _("Deepin Game - %s ") % self.game_name
        self.window = self.application.window
        self.window.set_title(player_title)
        self.application.titlebar.change_name(player_title)
        self.application.titlebar.mode_button.set_active(True)
        self.application.titlebar.mode_button.connect('toggled',
                                                      self.change_view)
        self.application.titlebar.close_button.connect('clicked', self.quit)
        #self.application.window.connect('focus-out-event', self.window_out_focus_hander)
        self.application.window.set_position(gtk.WIN_POS_CENTER)
        self.application.window.connect('focus-in-event',
                                        self.window_in_focus_hander)
        self.application.window.connect('window-state-event',
                                        self.window_state_change_handler)
        self.application.window.connect('key-press-event',
                                        self.window_key_press_handler)

        self.page_box = gtk.HBox()
        self.content_page = ContentPage(self.appid)
        self.content_page.screenshot_box.connect('button-press-event',
                                                 self.external_continue_action)
        self.content_page.play_button.connect('button-press-event',
                                              self.external_continue_action)

        self.guide_box = GuideBox()
        self.guide_box.set_size_request(220, -1)

        self.page_align = gtk.Alignment()
        self.page_align.set(0.5, 0.5, 1, 1)
        self.page_align.set_padding(0, 0, 2, 2)

        self.control_toolbar = self.create_toolbar(["star"])
        self.page_box.pack_start(self.content_page)
        self.page_box.pack_start(self.guide_box, False)

        self.inner_top_titlebar = self.create_top_titlebar()
        self.inner_top_titlebar.change_name(player_title)
        inner_widgets = ControlToolbar.widgets_id[:]
        inner_widgets.remove("star")
        self.inner_control_toolbar = self.create_toolbar(inner_widgets)

        self.paned_box = PanedBox()
        self.paned_box.add_content_widget(self.page_box)
        self.paned_box.add_bottom_widget(self.inner_control_toolbar)
        self.paned_box.add_top_widget(self.inner_top_titlebar)

        self.page_align.add(self.paned_box)
        self.application.main_box.pack_start(self.page_align)
        self.application.window.add_move_event(self.control_toolbar)
        self.show_bottom = False
        self.display_normal()