Exemplo n.º 1
0
    def _build_file(self, logged_in):
        '''build and return the file menu'''
        self.file_menu = Menu.Menu('_File')

        # file menu
        self.quit_item = Menu.Item(_('_Quit'), Menu.Item.TYPE_STOCK,
                                   stock.QUIT, Menu.Accel('Q'))
        self.quit_item.signal_connect('selected', self._on_quit_selected)

        if logged_in:
            self.status_item = Menu.Menu(_('_Status'))
            for stat in status.ORDERED:
                if stat != status.OFFLINE:
                    temp_item = Menu.Item(status.STATUS[stat])
                    temp_item.signal_connect('selected',
                                             self._on_status_selected, stat)
                    self.status_item.append(temp_item)

            self.disconnect_item = Menu.Item(_('_Disconnect'),
                                             Menu.Item.TYPE_STOCK,
                                             stock.DISCONNECT)
            self.disconnect_item.signal_connect('selected',
                                                self._on_disconnect_selected)

            self.file_menu.append(self.status_item)
            self.file_menu.append(Menu.Item('-'))
            self.file_menu.append(self.disconnect_item)

        self.file_menu.append(self.quit_item)

        return self.file_menu
Exemplo n.º 2
0
    def _build_options(self, logged_in):
        '''build and return the option menu'''
        self.option_menu = Menu.Menu(_('_Options'))
        self.prefs_item = Menu.Item(_('_Preferences'), Menu.Item.TYPE_STOCK,
                                    stock.PREFERENCES, Menu.Accel('P'))
        self.prefs_item.signal_connect('selected',
                                       self._on_preferences_selected)

        if logged_in:
            self.plugins_item = Menu.Item(_('Plug_ins'), Menu.Item.TYPE_STOCK,
                                          stock.DISCONNECT)
            self.plugins_item.signal_connect('selected',
                                             self._on_plugins_selected)
            self.option_menu.append(self.plugins_item)

        self.option_menu.append(self.prefs_item)

        return self.option_menu