예제 #1
0
    def initialize_user_action_page(self):
        vbox = gtk.VBox()

        add_user_icon = gtk.gdk.pixbuf_new_from_file_at_size(join(get_dir(ICON_DIR), "64px-plus_icon.png"), ACTION_IMAGE_SIZE, ACTION_IMAGE_SIZE)
        remove_user_icon = gtk.gdk.pixbuf_new_from_file_at_size(join(get_dir(ICON_DIR), "64px-no_icon.png"), ACTION_IMAGE_SIZE, ACTION_IMAGE_SIZE)
        exchange_keys_icon = gtk.gdk.pixbuf_new_from_file_at_size(join(get_dir(ICON_DIR), "key.png"), ACTION_IMAGE_SIZE, ACTION_IMAGE_SIZE)
        refetch_icon =  gtk.gdk.pixbuf_new_from_file_at_size(join(get_dir(ICON_DIR), "64px-edit_metadata_icon.png"), ACTION_IMAGE_SIZE, ACTION_IMAGE_SIZE)

        action_buttons = [(add_user_icon, 'Invite to\nCommunity', self.show_invite_dialog_cb),
                          (refetch_icon, 'Refetch\nProfile', self.refetch_profile_cb),
                         ]
        if self.state_plugin.options.personal_communities:
            action_buttons.insert(0, (add_user_icon, 'Add to\n Community',
                self.show_add_dialog_cb))
            action_buttons.insert(1, (remove_user_icon, 'Remove from\nCommunity',
                self.show_remove_dialog_cb))

        if self.state_plugin.options.key_exchange:
            action_buttons.insert(3, (exchange_keys_icon, 'Exchange\nKeys', self.show_exchange_keys_dialog_cb))

        self.actions = Action_List()

        for action in action_buttons:
            (icon, text, cb) = action
            self.actions.add_button(icon, text, cb)

        vbox.pack_start(self.actions.get_widget())

        self.announce_checkbox = gtk.CheckButton('Make an alarm when user appears')
        vbox.pack_start(self.announce_checkbox, False, False)
        self.announce_checkbox.set_active(self.user.get('friend'))
        self.announce_checkbox.connect('toggled', self.set_announce)

        self.notebook.append_page(vbox, gtk.Label('More actions'))
예제 #2
0
    def __init__(self, com, gui, community_gui):
        self.main_gui = gui
        self.community_gui = community_gui
        self.notification = get_plugin_by_type(PLUGIN_TYPE_NOTIFICATION)
        self.community = get_plugin_by_type(PLUGIN_TYPE_COMMUNITY)

        self.create_icon = join(get_dir(ICON_DIR), "128px-create_community_icon.png")
        directory = get_dir(ICON_DIR)
        self.join_icon = join(directory, "128px-ok_icon.png")
        self.leave_icon = join(directory, "128px-no_icon.png")
        self.delete_icon = self.leave_icon
        self.cancel_icon = join(directory, "128px-cancel_icon.png")
                                
        self.CREATE_EVENT = 1
        self.JOIN_EVENT = 2
        self.LEAVE_EVENT = 3
        self.DELETE_EVENT = 4
        self.CANCEL_EVENT = 6
        
        self.com = com
        self.main_window = gui.get_main_window()

        self.dialog = gtk.Dialog('Community Management', self.main_window)
        self.dialog.set_has_separator(False)
        self.dialog.set_default_size(350, -1)

        self.initialize_widgets()
        self.dialog.connect("response", self.response_handler)
        self.dialog.set_modal(True)
        self.dialog.show_all()
예제 #3
0
    def __init__(self, gui):
        global community, msgboard, chat

        GUI_Page.__init__(self, 'Messageboard')
        community = get_plugin_by_type(PLUGIN_TYPE_COMMUNITY)
        chat = get_plugin_by_type(PLUGIN_TYPE_MESSAGING)
        msgboard = get_plugin_by_type(PLUGIN_TYPE_MESSAGE_BOARD)

        self.notify = get_plugin_by_type(PLUGIN_TYPE_NOTIFICATION).notify

        self.main_gui = gui

        # Store Message_Page instances, key = sharemeta of the message
        self.message_pages = {}

        messageboard_icon = gtk.gdk.pixbuf_new_from_file(join(get_dir(ICON_DIR), self.MSGBOARD_ICON))

        community.community_gui.register_user_event(messageboard_icon, 'Msg board', self.start_messageboard_cb)
        community.community_gui.register_com_event(messageboard_icon, 'Msg board', self.start_messageboard_cb)

        self.message_icon = gtk.gdk.pixbuf_new_from_file(join(get_dir(ICON_DIR), self.MESSAGE_ICON))

        self.in_search_mode = False
        self.store = None
        self.search_store = None
        self.target = None

        # create widgets here
        self.create_action_list()
        self.message_list, self.message_view = self.create_message_list()

        self.search_hbox = gtk.HBox()
        self.search_entry = new_entry('Enter search keywords')
        self.search_entry.connect('activate', self.search_activate_cb)
        self.search_close = gtk.Button(stock=gtk.STOCK_CLOSE)
        self.search_close.connect('clicked', self.search_close_cb)
        self.search_now = gtk.Button(stock=gtk.STOCK_FIND)
        self.search_now.connect('clicked', self.search_now_cb)
        self.search_hbox.pack_start(self.search_entry, True, True)
        self.search_hbox.pack_start(self.search_close, False, True)
        self.search_hbox.pack_start(self.search_now, False, True)

        self.vbox = gtk.VBox()
        self.vbox.pack_start(self.message_list, True, True)
        self.vbox.pack_start(self.search_hbox, False, True)

        self.pack_start(self.vbox, True, True)
        self.pack_start(self.actions.get_widget(), False, True)

        self.show_all()
        self.search_hbox.hide()
        gui.add_page(self)

        gui.add_key_binding(gtk.gdk.CONTROL_MASK, gtk.keysyms.m, self.key_pressed_ctrl_m)

        msgboard.register_ui(self)

        self.watch_dialog = Watches_GUI(self.main_gui, msgboard.get_state, msgboard.modify_state)
예제 #4
0
    def initialize_action_list(self):
        search_icon = gtk.gdk.pixbuf_new_from_file(join(get_dir(ICON_DIR), "64px-search_content_icon.png"))
        remove_icon = gtk.gdk.pixbuf_new_from_file(join(get_dir(ICON_DIR), "64px-remove_content_icon.png"))

        action_buttons = [(search_icon, 'Search', self.search_cb),
                          (remove_icon, 'Clear', self.clear_cb)
                         ]

        self.actions = Action_List()

        for action in action_buttons:
            (icon, text, cb) = action
            self.actions.add_button(icon, text, cb)

        self.pack_start(self.actions.get_widget(), False, True)
예제 #5
0
    def initialize_widgets(self):
        self.proximate_main_vbox = gtk.VBox()
        self.root_notebook = gtk.Notebook()
        self.root_notebook.set_show_tabs(False)
        self.root_notebook.set_show_border(False)

        # Status hbox: on the bottom of GUI
        self.status_hbox = gtk.HBox()
        self.back_button_eb = gtk.EventBox()
        self.main_progress_bar = gtk.ProgressBar()
        self.main_progress_bar.modify_font(pango.FontDescription("normal 20"))
        self.main_progress_bar.set_ellipsize(pango.ELLIPSIZE_END)
        self.status_icons_hbox = gtk.HBox()
        self.status_hbox.pack_start(self.back_button_eb, False, False)
        self.status_hbox.pack_start(self.main_progress_bar, True, True)
        self.status_hbox.pack_start(self.status_icons_hbox, False, True)

        # Add menubar at the top..
        self.proximate_main_vbox.pack_start(self.main_menu, False, False)

        # Put elements inside main_vbox
        self.proximate_main_vbox.pack_end(self.status_hbox, False, False)
        self.proximate_main_vbox.pack_end(self.root_notebook, True, True)

        button_img = gtk.Image()
        button_img.set_from_file(join(get_dir(ICON_DIR), self.BACK_BUTTON1_IMG))
        self.back_button_eb.add(button_img)
        self.back_button_eb.connect("button-press-event", self.back_button_cb)

        self.main_window.add(self.proximate_main_vbox)
예제 #6
0
    def __init__(self, gui):
        GUI_Page.__init__(self, 'Key exchange')

        self.keymanagement = get_plugin_by_type(PLUGIN_TYPE_KEY_MANAGEMENT)
        self.community = get_plugin_by_type(PLUGIN_TYPE_COMMUNITY)
        self.notification = get_plugin_by_type(PLUGIN_TYPE_NOTIFICATION)
        self.main_gui = gui
        self.user = None
        self.entered_key = ''
        self.request_dialog = None

        self.main_vbox = gtk.VBox()
        self.notebook = gtk.Notebook()
        self.notebook.set_show_tabs(False)
        self.main_vbox.pack_start(self.notebook)

        # notebook pages for differents stages of key exchange
        lock_image = gtk.image_new_from_file(join(get_dir(ICON_DIR),
            'Padlock.png'))
        # page 1: show messages
        page1 = gtk.VBox()
        self.messagelabel = gtk.Label()
        page1.pack_start(self.messagelabel)
        self.notebook.append_page(page1)
        # page 2: show generated symmetric key
        page2 = gtk.VBox()
        self.show_key_header = gtk.Label()
        page2.pack_start(self.show_key_header, False, True, 10)
        self.keylabel = gtk.Label()
        page2.pack_start(self.keylabel)
        key_show_eventbox = gtk.EventBox()
        key_show_eventbox.modify_bg(gtk.STATE_NORMAL,
            key_show_eventbox.get_colormap().alloc_color('red'))
        key_show_eventbox.add(page2)
        self.notebook.append_page(key_show_eventbox)
        # page 3: ask for symmetric key
        page3 = gtk.VBox()
        self.key_entry_header = gtk.Label()
        page3.pack_start(self.key_entry_header, False, True, 10)
        page3_hbox = gtk.HBox()
        page3.pack_start(page3_hbox)
        self.keyentry = gtk.Label()
        page3_hbox.pack_start(self.keyentry)
        page3_hbox.pack_start(lock_image, False, False)
        self.key_eventbox = gtk.EventBox()
        self.key_eventbox.set_events(gtk.gdk.KEY_PRESS_MASK)
        self.key_eventbox.set_flags(gtk.HAS_FOCUS | gtk.CAN_FOCUS)
        self.key_eventbox.modify_bg(gtk.STATE_NORMAL,
            self.key_eventbox.get_colormap().alloc_color('red'))
        self.key_eventbox.add(page3)
        self.notebook.append_page(self.key_eventbox)

        self.key_eventbox.connect('button-press-event', self.save_temp_key_clicked)
        self.key_eventbox.connect('key-press-event', self.key_entry_modify)

        self.pack_start(self.main_vbox)
        self.show_all()
        self.main_gui.add_page(self)

        self.keymanagement.register_ui(self)
예제 #7
0
    def __init__(self, fs_gui):
        GUI_Page.__init__(self, 'Publish content')
        self.fs_gui = fs_gui

        self.icon = gtk.gdk.pixbuf_new_from_file(join(get_dir(ICON_DIR), \
                                                      "64px-publish_content_icon.png"))
    
        self.vbox = gtk.VBox()
        self.pack_start(self.vbox)

        self.folders = {}

        self.sharelist = gtk.TreeStore(gobject.TYPE_PYOBJECT, str, bool, gtk.gdk.Pixbuf, str, str)

        self.initialize_share_list()
        self.initialize_action_list()

        self.title = gtk.Label("Content Publishing")
        self.vbox.pack_start(self.title, False, False)
        scrollwin = new_scrollarea()
        scrollwin.add_with_viewport(self.sharelist_view)
        self.vbox.pack_start(scrollwin, True, True)

        self.show_all()
        main_gui.add_page(self)
예제 #8
0
    def create_action_list(self):
        new_message_icon = gtk.gdk.pixbuf_new_from_file(join(get_dir(ICON_DIR), self.NEW_MESSAGE_ICON))
        refresh_icon = gtk.gdk.pixbuf_new_from_file(join(get_dir(ICON_DIR), self.REFRESH_ICON))
        search_icon = gtk.gdk.pixbuf_new_from_file(join(get_dir(ICON_DIR), self.SEARCH_ICON))

        action_buttons = [(new_message_icon, 'Compose', self.create_new_cb),
                          (refresh_icon, 'Refresh / All\nMessages', self.refresh_cb),
                          (new_message_icon, 'My\nMessages', self.my_messages_cb),
                          (search_icon, 'Search', self.search_cb),
                          (search_icon, 'Watches', self.watches_cb),
                         ]

        self.actions = Action_List()

        for action in action_buttons:
            (icon, text, cb) = action
            self.actions.add_button(icon, text, cb)
예제 #9
0
    def __init__(self, main_gui, getstatecb, modifycb):
        self.main_gui = main_gui

        self.modifycb = modifycb
        self.getstatecb = getstatecb

        self.guistate = 0

        self.page = GUI_Page('Watches')

        # self.watch_list stores columns: possible picture, keyword, target
        self.watch_list = gtk.ListStore(gtk.gdk.Pixbuf, str, str)
        self.update()

        self.watch_view = gtk.TreeView(self.watch_list)
        self.pic_cell = gtk.CellRendererPixbuf()
        self.name_cell = gtk.CellRendererText()
        self.target_cell = gtk.CellRendererText()
        self.pic_column = self.watch_view.insert_column_with_attributes(
            self.COL_ICON, '', self.pic_cell, pixbuf=self.COL_ICON)
        self.name_column = self.watch_view.insert_column_with_attributes(
            self.COL_NAME, '', self.name_cell, text=self.COL_NAME)
        self.target_column = self.watch_view.insert_column_with_attributes(
            self.COL_TARGET, '', self.target_cell, text=self.COL_TARGET)
        self.page.pack_start(self.watch_view, True, True)

        add_icon = gtk.gdk.pixbuf_new_from_file(join(get_dir(ICON_DIR), "64px-add_content_icon.png"))
        remove_icon = gtk.gdk.pixbuf_new_from_file(join(get_dir(ICON_DIR), "64px-remove_content_icon.png"))

        action_buttons = [(add_icon, 'Add', self.add_clicked),
                          (remove_icon, 'Remove', self.remove_clicked)
                         ]

        self.actions = Action_List()

        for action in action_buttons:
            (icon, text, cb) = action
            self.actions.add_button(icon, text, cb)

        self.page.pack_start(self.actions.get_widget(), False, True)

        self.main_gui.add_page(self.page)
예제 #10
0
    def initialize_action_list(self):
        add_icon = gtk.gdk.pixbuf_new_from_file(join(get_dir(ICON_DIR), "64px-add_content_icon.png"))
        remove_icon = gtk.gdk.pixbuf_new_from_file(join(get_dir(ICON_DIR), "64px-remove_content_icon.png"))
        open_icon = gtk.gdk.pixbuf_new_from_file(join(get_dir(ICON_DIR), "64px-publish_content_icon.png"))
        metadata_icon = gtk.gdk.pixbuf_new_from_file(join(get_dir(ICON_DIR), "64px-edit_metadata_icon.png"))

        action_buttons = [(add_icon, 'Publish\nFile', self.add_file_cb),
                          (add_icon, 'Publish\nDirectory', self.add_dir_cb),
                          (remove_icon, 'Remove', self.remove_cb),
                          (open_icon, 'Open', self.open_cb),
                          (metadata_icon, 'Edit\nMetadata', self.edit_metadata_cb)
                         ]

        self.actions = Action_List()

        for action in action_buttons:
            (icon, text, cb) = action
            self.actions.add_button(icon, text, cb)

        self.pack_start(self.actions.get_widget(), False, True)
예제 #11
0
    def initialize_action_list(self):
        download_icon = gtk.gdk.pixbuf_new_from_file(join(get_dir(ICON_DIR), "64px-browse_content_icon.png"))
        open_icon = gtk.gdk.pixbuf_new_from_file(join(get_dir(ICON_DIR), "64px-publish_content_icon.png"))
        metadata_icon = gtk.gdk.pixbuf_new_from_file(join(get_dir(ICON_DIR), "64px-edit_metadata_icon.png"))
        search_icon = gtk.gdk.pixbuf_new_from_file(join(get_dir(ICON_DIR), "64px-search_content_icon.png"))

        action_buttons = [(download_icon, 'Download', self.download_cb),
                          (open_icon, 'Stream', self.stream_cb),
                          (metadata_icon, 'Show\nMetadata', self.show_metadata_cb),
                          (search_icon, 'Search\nFrom User', self.show_search_cb),
                          (search_icon, 'Refresh', self.refresh_cb)
                         ]

        self.actions = Action_List()

        for action in action_buttons:
            (icon, text, cb) = action
            self.actions.add_button(icon, text, cb)

        self.pack_start(self.actions.get_widget(), False, True)
예제 #12
0
    def __init__(self, gui):
        GUI_Page.__init__(self, 'Home')
        self.main_gui = gui

        self.notification = get_plugin_by_type(PLUGIN_TYPE_NOTIFICATION)
        self.community = get_plugin_by_type(PLUGIN_TYPE_COMMUNITY)

        # store User_Page instances key = user
        self.user_pages = {}

        # store Community_Page instances key = community
        self.com_pages = {}

        self.com_events = []
        self.user_events = []
        self.user_action_lists = []
        self.com_action_lists = []

        self.item_double_clicking = None

        self.initialize_menu()

        icon = gtk.gdk.pixbuf_new_from_file(join(get_dir(ICON_DIR), self.COMMUNITY_ICON))
        self.com_events.append((icon, "Community", self.manage_community_cb))

        self.itemlist = gtk.ListStore(gtk.gdk.Pixbuf, gobject.TYPE_PYOBJECT, str)
        self.update_communities()

        self.initialize_item_list()
        self.action_list = Community_Action_List(self, self.get_selected)
        self.pack_start(self.action_list.get_widget(), False, True)

        self.show_all()
        gui.add_page(self)
        gui.show_page(self)

        myself = self.community.get_myself()

        page = My_User_Page(gui, myself)
        self.user_pages[myself] = page
        page.show_all()
        gui.add_page(page)

        status_icon_pic = get_status_icon(myself.get('status_icon'), STATUSBAR_ICON_SIZE)
        self.status_icon = gui.add_statusbar_icon(status_icon_pic, 'Change status', self.status_icon_clicked)

        settings = get_plugin_by_type(PLUGIN_TYPE_SETTINGS)
        self.list_view_setting = settings.register('community.list_view', bool, 'Display community members as a list', default=False)

        self.community.register_ui(self)
예제 #13
0
def get_filetype_icon(filetype):
    ft_default = '32px-Text-x-generic-template.png'
    ft_icons = {'application': '32px-Applications-system.png',
        'audio': '32px-Audio-x-generic.png',
        'image': '32px-Image-x-generic.png',
        'text': '32px-Text-x-generic.png',
        'video': '32px-Video-x-generic.png',
        'folder': '32px-Folder.png',
        'remotefolder': '32px-Folder-remote.png',
        'remotefolder-low': 'send-low-connection.png',
        'remotefolder-no': 'send-no-connection.png',
        None: ft_default }

    ft_icon_path = join(get_dir(ICON_DIR), ft_icons.get(filetype, ft_default))
    return gtk.gdk.pixbuf_new_from_file(ft_icon_path)
예제 #14
0
    def show(self):
        self.splashwindow = gtk.Window()
        self.splashwindow.set_title("Proximate is starting...")
        self.splashwindow.set_position(gtk.WIN_POS_CENTER)
        self.splashimage = gtk.Image()
        self.splashimage.set_from_file(join(get_dir(ICON_DIR), "people_icon.png"))
        self.splashwindow.add(self.splashimage)
        self.splashwindow.show_all()
        self.initialized = True

        # For some reason this needs to be done twice,
        # for the window and for the image
        while gtk.events_pending():
            gtk.main_iteration()
        while gtk.events_pending():
            gtk.main_iteration()
예제 #15
0
    def __init__(self, main_gui_window, title, abort_cb, ctx):
        headline = "File transfer"

        self.filesharing = get_plugin_by_type(PLUGIN_TYPE_FILE_SHARING)

        self.base = gtk.Dialog(headline, main_gui_window, gtk.DIALOG_DESTROY_WITH_PARENT)

        self.abort_cb = abort_cb
        self.ctx = ctx
        self.title = title
        self.text = gtk.Label(title)
        self.pbar = gtk.ProgressBar()

        # Open download directory -button
        self.open_dldir = gtk.Button("Open download directory")
        self.open_dldir.connect("clicked", self.open_dldir_cb)

        # Hide button
        close_label = gtk.Label("Hide:")
        close_eb = gtk.EventBox()
        close_hbox = gtk.HBox()
        close_img = gtk.Image()
        close_eb.add(close_hbox)
        close_img.set_from_file(join(get_dir(ICON_DIR), self.CLOSE_ICON))

        # Abort button
        self.abort_button = gtk.Button("Cancel")
        self.abort_button.connect("clicked", self.abort_cb)

        close_hbox.pack_start(close_label)
        close_hbox.pack_start(close_img)

        close_eb.connect("button-press-event", self.close_cb)

        self.pbar.set_text("Starting transfer...")

        self.base.vbox.pack_start(self.text)
        self.base.vbox.pack_start(self.pbar)
        self.base.action_area.pack_end(self.open_dldir, expand=False)
        self.base.action_area.pack_end(self.abort_button, expand=False)
        self.base.action_area.pack_end(close_eb, expand=False)

        self.base.show_all()
예제 #16
0
    def __init__(self, gui, sendfilegui):
        global filesharing, community, sendfile, main_gui, notification
        filesharing = get_plugin_by_type(PLUGIN_TYPE_FILE_SHARING)
        community = get_plugin_by_type(PLUGIN_TYPE_COMMUNITY)
        sendfile = get_plugin_by_type(PLUGIN_TYPE_SEND_FILE)
        notification = get_plugin_by_type(PLUGIN_TYPE_NOTIFICATION)
        main_gui = gui
        self.sendfilegui = sendfilegui

        # store File_Sharing_Browse instances key = (target, is_community)
        self.browse_pages = {}

        # Initialize related pages
        self.fs_search = File_Sharing_Search(self)
        self.fs_results = File_Sharing_Browse(self, 'Search results')
        self.fs_publish = File_Sharing_Publish(self)

        icon = gtk.gdk.pixbuf_new_from_file(join(get_dir(ICON_DIR), self.FILESHARING_ICON))
        community.community_gui.register_user_event(icon, 'Filesharing', self.start_filesharing_cb)
        community.community_gui.register_com_event(icon, 'Filesharing', self.start_filesharing_cb)

        main_gui.add_key_binding(gtk.gdk.CONTROL_MASK, gtk.keysyms.b, self.key_pressed_ctrl_b)
예제 #17
0
    def __init__(self, main_gui):
        self.register_plugin(PLUGIN_TYPE_RADAR)
        self.community = get_plugin_by_type(PLUGIN_TYPE_COMMUNITY)
        self.myself = self.community.get_myself()
        self.main_gui = main_gui

        self.page = GUI_Page('Radar')
        self.user_radar = UserRadar(main_gui)
        self.page.pack_start(self.user_radar)
        self.action_list = User_Action_List(self.community.community_gui,
            self.user_radar.get_selected)
        self.page.pack_start(self.action_list.get_widget(), False, True)
        self.page.show_all()
        self.main_gui.add_page(self.page)
    
        # Press 'r' to switch to radar view
        self.main_gui.add_key_binding(gtk.gdk.CONTROL_MASK, gtk.keysyms.r, self.key_pressed_r)

        self.radar_icon = gtk.gdk.pixbuf_new_from_file(join(get_dir(ICON_DIR),
            'radar.png'))
        self.main_gui.add_statusbar_icon(self.radar_icon, 'Open radar',
            self.statusbar_icon_clicked)
예제 #18
0
    def initialize_gtk_program(self):
        self.main_window = gtk.Window()
        self.main_window.set_title(APP_NAME)
        self.main_window.connect("configure-event", self.window_configure)
        self.load_config()  # this must be done here
        self.main_window.set_icon_from_file(join(get_dir(ICON_DIR), "proximate_task_icon.png"))

        # Create the menubar
        self.main_menu = gtk.MenuBar()
        self.app_menu_item = gtk.MenuItem("Application")
        self.app_menu = gtk.Menu()
        self.app_menu_item.set_submenu(self.app_menu)
        self.main_menu.append(self.app_menu_item)
        self.main_menu.append(self.preferences_menu_item)
        self.app_menu.append(self.version_menu_item)
        self.main_menu.append(self.plugins_menu_item)
        self.app_menu.append(self.quit_menu_item)

        self.initialize_widgets()

        self.main_window.connect("delete-event", self.close_proximate)
        self.main_window.connect("key-press-event", self.on_key_press)
        self.main_window.show_all()
예제 #19
0
    def __init__(self, gui):
        GUI_Page.__init__(self, 'Messaging')
        self.main_gui = gui
        self.toggle_dialog = None
        self.statusbar_icon = None
        self.atbottom = True

        self.active_icon = gtk.gdk.pixbuf_new_from_file(join(get_dir(ICON_DIR), self.STATUSBAR_ICON))
        self.inactive_icon = self.active_icon.copy()
        self.active_icon.saturate_and_pixelate(self.inactive_icon, 0.0, False)

        # GUI stores liststores and buttos as (store, button) tuples indexed
        # by Conversation
        self.gui_storebutton = {}

        self.community = get_plugin_by_type(PLUGIN_TYPE_COMMUNITY)
        self.messaging = get_plugin_by_type(PLUGIN_TYPE_MESSAGING)
        self.notification = get_plugin_by_type(PLUGIN_TYPE_NOTIFICATION)

        # the currently active conversation
        self.active_conversation = None

        messaging_icon = gtk.gdk.pixbuf_new_from_file(join(get_dir(ICON_DIR), self.MESSAGING_ICON))

        self.community.community_gui.register_user_event(messaging_icon, 'Chat', self.start_messaging_cb)
        self.community.community_gui.register_com_event(messaging_icon, 'Chat', self.start_messaging_cb)

        self.right_vbox = gtk.VBox()
        self.left_vbox = gtk.VBox()
        vseparator = gtk.VSeparator()
        self.pack_start(self.left_vbox, False, True)
        self.pack_start(vseparator, False, False)
        self.pack_start(self.right_vbox, True, True)
        self.top_hbox = gtk.HBox()
        separator1 = gtk.HSeparator()
        scrollwin = new_scrollarea()
        separator2 = gtk.HSeparator()
        self.bottom_hbox = gtk.HBox()

        # adding top level
        self.right_vbox.pack_start(self.top_hbox, expand = False)
        self.right_vbox.pack_start(separator1, expand = False)
        self.right_vbox.pack_start(scrollwin)
        self.right_vbox.pack_end(self.bottom_hbox, expand = False)
        self.right_vbox.pack_end(separator2, expand = False)

        # creatind the top row
        self.headline = gtk.Label()
        self.end_chat_eb = gtk.EventBox()
        self.end_chat_img = gtk.Image()

        # setting up the button icons in the top row
        self.end_chat_eb.add(self.end_chat_img)
        self.end_chat_img.set_from_file(join(get_dir(ICON_DIR), self.END_CHAT_ICON))

        # forming the top row
        self.top_hbox.pack_start(self.headline)
        self.top_hbox.pack_end(self.end_chat_eb, expand = False)

        # creating the chat area
        cr_icon = gtk.CellRendererPixbuf()
        self.chat_tw = gtk.TreeView()
        self.chat_tw_cr1 = gtk.CellRendererText()
        self.chat_tw_cr2 = gtk.CellRendererText()
        self.chat_tw_cr3 = gtk.CellRendererText()

        column = gtk.TreeViewColumn('Time')
        column.pack_start(cr_icon)
        column.pack_start(self.chat_tw_cr1)
        column.add_attribute(cr_icon, "pixbuf", self.COL_ICON)
        column.add_attribute(self.chat_tw_cr1, "text", self.COL_TIME)
        self.chat_tw.append_column(column)

        self.nick_column = gtk.TreeViewColumn('Nick')
        self.nick_column.pack_start(self.chat_tw_cr2)
        self.nick_column.add_attribute(self.chat_tw_cr2, "text", self.COL_NICK)
        self.chat_tw.append_column(self.nick_column)

        column = gtk.TreeViewColumn('Message')
        column.pack_start(self.chat_tw_cr3)
        column.add_attribute(self.chat_tw_cr3, "text", self.COL_MESSAGE)
        self.chat_tw.append_column(column)

        # to keep the fields aligned to the top of each row
        self.chat_tw_cr1.set_property('yalign', 0.0)
        self.chat_tw_cr2.set_property('yalign', 0.0)
        self.chat_tw_cr3.set_property('yalign', 0.0)

        self.chat_tw_cr3.set_property('wrap-mode', pango.WRAP_WORD_CHAR)
        self.chat_tw.set_property('enable-search', False)
        self.chat_tw.set_property('headers-visible', False)
        self.chat_tw.connect('size-allocate', self.resized)
        self.chat_tw.connect('row-activated', self.chat_row_activated_cb)

        scrollwin.add(self.chat_tw)
        scrollwin.get_vadjustment().connect('value-changed', self.chat_tw_scrolled)

        # creating the left area for chat tabs
        self.left_vbox.set_size_request(200, -1)
        chatlist_label = gtk.Label('Active chats')
        self.left_vbox.pack_start(chatlist_label, False, True)
        self.chatlist_scroll = new_scrollarea()
        self.left_vbox.pack_start(self.chatlist_scroll, True, True)
        self.chatlist = gtk.VBox()
        self.chatlist.set_size_request(200-2, -1)
        self.chatlist_scroll.add_with_viewport(self.chatlist)

        # creating the bottom area
        self.entry = gtk.Entry()
        self.bottom_hbox.pack_start(self.entry)

        self.show_all()
        gui.add_page(self)

        style = self.headline.get_style()
        self.normal_text_color = style.fg[gtk.STATE_NORMAL].copy()

        self.warning_icon = gtk.gdk.pixbuf_new_from_file(join(get_dir(ICON_DIR), self.WARNING_ICON))

        # callbacks:
        # connecting press of enter to sending message
        self.entry.connect('activate', self.entry_activate_cb)
        self.end_chat_eb.connect('button-press-event', self.close_active_conversation_cb)

        # monitor chat page visibility
        self.connect('expose-event', self.exposed)

        self.messaging.register_ui(self)
예제 #20
0
    def initialize_widgets(self):
        self.hbox = gtk.HBox()
        self.hbox.set_spacing(5)
        self.hbox.set_property("border-width", 0)

        send_ebox = gtk.EventBox()
        publish_ebox = gtk.EventBox()
        browse_ebox = gtk.EventBox()
        search_ebox = gtk.EventBox()
        cancel_ebox = gtk.EventBox()

        send_image = gtk.Image()
        publish_image = gtk.Image()
        browse_image = gtk.Image()
        search_image = gtk.Image()
        cancel_image = gtk.Image()

        # warn user of bad connectivity for sending files
        if not self.is_community:
            hops = self.target.get('hops')
            if hops == 2:
                send_icon = self.SEND_ICON_LOW
            elif hops > 2:
                send_icon = self.SEND_ICON_NO
            else:
                send_icon = self.SEND_ICON
        else:
            send_icon = self.SEND_ICON
        send_image.set_from_file(join(get_dir(ICON_DIR), send_icon))
        publish_image.set_from_file(join(get_dir(ICON_DIR), self.PUBLISH_ICON))
        browse_image.set_from_file(join(get_dir(ICON_DIR), self.BROWSE_ICON))
        search_image.set_from_file(join(get_dir(ICON_DIR), self.SEARCH_ICON))
        cancel_image.set_from_file(join(get_dir(ICON_DIR), self.CANCEL_ICON))

        send_ebox.add(send_image)
        publish_ebox.add(publish_image)
        browse_ebox.add(browse_image)
        search_ebox.add(search_image)
        cancel_ebox.add(cancel_image)

        send_ebox.connect("button-press-event", self.response_handler,
                          self.SEND_EVENT)
        publish_ebox.connect("button-press-event", self.response_handler,
                             self.PUBLISH_EVENT)
        browse_ebox.connect("button-press-event", self.response_handler,
                            self.BROWSE_EVENT)
        search_ebox.connect("button-press-event", self.response_handler,
                            self.SEARCH_EVENT)
        cancel_ebox.connect("button-press-event", self.response_handler,
                            self.CANCEL_EVENT)

        vbox1 = gtk.VBox()
        vbox2 = gtk.VBox()
        vbox3 = gtk.VBox()
        vbox4 = gtk.VBox()
        vbox5 = gtk.VBox()
        
        vbox1.pack_start(publish_ebox, True, True)
        vbox2.pack_start(browse_ebox, True, True)
        vbox3.pack_start(search_ebox, True, True)
        vbox4.pack_start(cancel_ebox, True, True)
        vbox5.pack_start(send_ebox, True, True)
        
        vbox1.pack_start(gtk.Label('Publish'), False, False)
        vbox2.pack_start(gtk.Label('Browse'), False, False)
        vbox3.pack_start(gtk.Label('Search'), False, False)
        vbox4.pack_start(gtk.Label('Cancel'), False, False)
        vbox5.pack_start(gtk.Label('Send File'), False, False)

        self.hbox.pack_start(vbox5, True, True)
        if self.is_community:
            self.hbox.pack_start(vbox1, True, True)
        self.hbox.pack_start(vbox2, True, True)
        self.hbox.pack_start(vbox3, True, True)
        self.hbox.pack_start(vbox4, True, True)

        self.dialog.vbox.pack_start(self.hbox, True, True, 0)
        self.dialog.action_area.set_size_request(0, 0)
        self.dialog.vbox.set_spacing(0)
        self.dialog.vbox.show_all()
예제 #21
0
    def __init__(self, gui):
        GUI_Page.__init__(self, 'Notifications')
        self.main_gui = gui
        self.queue = []
        self.queue_highpri = []
        self.atbottom = True
        self.notification_plugin = get_plugin_by_type(PLUGIN_TYPE_NOTIFICATION)
        self.community = get_plugin_by_type(PLUGIN_TYPE_COMMUNITY)

        self.dialog = gtk.Dialog('Proximate', gui.get_main_window(), gtk.DIALOG_DESTROY_WITH_PARENT)
        self.dialog.add_events(gtk.gdk.BUTTON_PRESS_MASK)
        self.dialog.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
        self.dialog.set_default_size(200, 150)
        self.dialog.set_has_separator(False)
        self.text = gtk.Label()
        self.text.set_line_wrap(True)
        self.dialog.vbox.pack_start(self.text)
        self.dialog.connect('button-press-event', self.dialog_clicked)
        self.dialog.connect('delete-event', self.dialog_deleted)
        self.dialog.connect('response', self.response_handler)

        self.notebook = gtk.Notebook()
        self.events_label = gtk.Label('Events')
        self.notifications_label = gtk.Label('Notifications')

        # The other notification log display
        # store = (icon, message, callback, ctx, apply_icon, cancel_icon)
        self.notification_list = gtk.ListStore(gtk.gdk.Pixbuf, str, object, object, gtk.gdk.Pixbuf, gtk.gdk.Pixbuf)

        self.notification_view = gtk.TreeView(self.notification_list)
        self.notification_view.set_headers_visible(False)
        self.notification_view.connect('row-activated', self.notification_row_activated_cb)

        cr_icon = gtk.CellRendererPixbuf()
        cr_msg = gtk.CellRendererText()
        cr_apply_icon = gtk.CellRendererPixbuf()
        cr_cancel_icon = gtk.CellRendererPixbuf()

        column = gtk.TreeViewColumn('')
        column.pack_start(cr_icon, False)
        column.pack_start(cr_msg)
        column.add_attribute(cr_icon, 'pixbuf', self.COL_ICON)
        column.add_attribute(cr_msg, 'text', self.COL_MSG)
        column.set_expand(True)
        self.notification_view.append_column(column)

        self.apply_column = gtk.TreeViewColumn('')
        self.apply_column.pack_start(cr_apply_icon, False)
        self.apply_column.add_attribute(cr_apply_icon, 'pixbuf', self.COL_APPLY)
        self.notification_view.append_column(self.apply_column)

        self.cancel_column = gtk.TreeViewColumn('')
        self.cancel_column.pack_start(cr_cancel_icon, False)
        self.cancel_column.add_attribute(cr_cancel_icon, 'pixbuf', self.COL_CANCEL)
        self.notification_view.append_column(self.cancel_column)

        scrollwin = new_scrollarea()
        scrollwin.add(self.notification_view)
        self.notebook.append_page(scrollwin, self.notifications_label)

        # Event log display
        self.event_list = gtk.ListStore(gtk.gdk.Pixbuf, str, object, object)

        self.event_view = gtk.TreeView(self.event_list)
        self.event_view.set_headers_visible(False)
        self.event_view.connect('row-activated', self.event_row_activated_cb)

        cell_pic = gtk.CellRendererPixbuf()
        cell_msg = gtk.CellRendererText()

        column = gtk.TreeViewColumn('')
        column.pack_start(cell_pic, False)
        column.pack_start(cell_msg)
        column.add_attribute(cell_pic, 'pixbuf', self.COL_ICON)
        self.event_view.append_column(column)

        column.add_attribute(cell_msg, 'text', self.COL_MSG)
        scrollwin = new_scrollarea()
        scrollwin.add(self.event_view)
        scrollwin.get_vadjustment().connect('value-changed', self.event_view_scrolled)
        self.notebook.append_page(scrollwin, self.events_label)

        style = self.notification_view.get_style()
        apply_iconset = style.lookup_icon_set(gtk.STOCK_APPLY)
        self.apply_icon = apply_iconset.render_icon(style, gtk.TEXT_DIR_NONE, gtk.STATE_NORMAL, gtk.ICON_SIZE_BUTTON)
        cancel_iconset = style.lookup_icon_set(gtk.STOCK_CANCEL)
        self.cancel_icon = cancel_iconset.render_icon(style, gtk.TEXT_DIR_NONE, gtk.STATE_NORMAL, gtk.ICON_SIZE_BUTTON)

        self.connect('expose-event', self.exposed)

        self.pack_start(self.notebook)

        gui.add_page(self)
        self.show_all()

        self.active_icon = gtk.gdk.pixbuf_new_from_file(join(get_dir(ICON_DIR), self.ICON))
        self.inactive_icon = self.active_icon.copy()
        self.active_icon.saturate_and_pixelate(self.inactive_icon, 0.0, False)
        self.information_icon = gtk.gdk.pixbuf_new_from_file(join(get_dir(ICON_DIR), self.INFORMATION))
        self.important_icon = gtk.gdk.pixbuf_new_from_file(join(get_dir(ICON_DIR), self.IMPORTANT))

        self.statusbar_icon = gui.add_statusbar_icon(self.inactive_icon, 'Notifications', self.statusbar_icon_clicked)

        self.notification_plugin.register_ui(self)
예제 #22
0
def get_status_icon(status, size):
    if not valid_status(status):
        status = 'normal'
    fname = '%dpx-status_icon_%s.png' % (size, status)
    return gtk.gdk.pixbuf_new_from_file_at_size(join(get_dir(ICON_DIR), fname), size, size)
예제 #23
0
    def __init__(self, gui):
        self.register_plugin(PLUGIN_TYPE_FILE_TRANSFER)
        self.community = get_plugin_by_type(PLUGIN_TYPE_COMMUNITY)
        self.notification = get_plugin_by_type(PLUGIN_TYPE_NOTIFICATION)
        self.filesharing = get_plugin_by_type(PLUGIN_TYPE_FILE_SHARING)

        self.main_gui = gui
        self.ft_statusbar_icon = gtk.gdk.pixbuf_new_from_file_at_size(
            join(get_dir(ICON_DIR), self.STATUSBAR_ICON), STATUSBAR_ICON_SIZE, STATUSBAR_ICON_SIZE
        )
        self.ft_icon = gtk.gdk.pixbuf_new_from_file(join(get_dir(ICON_DIR), self.STATUSBAR_ICON))

        self.statusbar_icon = None

        self.page = GUI_Page("File transfers")
        self.main_vbox = gtk.VBox()

        # Top row
        top_hbox = gtk.HBox()
        headline = gtk.Label("File Transfers")
        close_eb = gtk.EventBox()
        close_img = gtk.Image()
        close_eb.add(close_img)
        close_img.set_from_file(join(get_dir(ICON_DIR), self.CLOSE_ICON))
        top_hbox.pack_start(headline)
        top_hbox.pack_end(close_eb, expand=False)
        self.main_vbox.pack_start(top_hbox, False, False)

        # store = (icon, message, transfer, delete_icon)
        self.transfer_list = gtk.ListStore(gtk.gdk.Pixbuf, str, int, object, gtk.gdk.Pixbuf)

        cr_icon = gtk.CellRendererPixbuf()
        cr_msg = gtk.CellRendererText()
        cr_prog = ProgressCellRenderer()
        cr_delete_icon = gtk.CellRendererPixbuf()

        self.transfer_view = gtk.TreeView(self.transfer_list)
        self.transfer_view.set_headers_visible(False)
        self.transfer_view.connect("row-activated", self.row_activated_cb)

        column = gtk.TreeViewColumn("")
        column.pack_start(cr_icon, False)
        column.pack_start(cr_msg)
        column.add_attribute(cr_icon, "pixbuf", self.COL_ICON)
        column.add_attribute(cr_msg, "text", self.COL_MSG)
        column.set_expand(True)
        self.transfer_view.append_column(column)

        column = gtk.TreeViewColumn("")
        column.pack_start(cr_prog)
        column.add_attribute(cr_prog, "percent", self.COL_PROG)
        self.transfer_view.append_column(column)

        self.delete_column = gtk.TreeViewColumn("")
        self.delete_column.pack_start(cr_delete_icon, False)
        self.delete_column.add_attribute(cr_delete_icon, "pixbuf", self.COL_DELETE)
        self.transfer_view.append_column(self.delete_column)

        scrollwin = new_scrollarea()
        scrollwin.add(self.transfer_view)
        self.main_vbox.pack_start(scrollwin, True, True)

        style = self.transfer_view.get_style()
        abort_iconset = style.lookup_icon_set(gtk.STOCK_CLOSE)
        self.abort_icon = abort_iconset.render_icon(style, gtk.TEXT_DIR_NONE, gtk.STATE_NORMAL, gtk.ICON_SIZE_BUTTON)
        delete_iconset = style.lookup_icon_set(gtk.STOCK_DELETE)
        self.delete_icon = delete_iconset.render_icon(style, gtk.TEXT_DIR_NONE, gtk.STATE_NORMAL, gtk.ICON_SIZE_BUTTON)

        self.statusLabel = gtk.Label("")
        self.statusLabel.set_padding(3, 3)
        self.abort_all = gtk.Button("Abort all")
        self.delete_all = gtk.Button("Delete all")
        self.open_dldir = gtk.Button("Open download directory")

        status_hbox = gtk.HBox()
        status_hbox.set_size_request(-1, 50)
        status_hbox.pack_start(self.statusLabel, True, True)
        status_hbox.pack_start(self.open_dldir, False, False, padding=5)
        status_hbox.pack_start(self.delete_all, False, False, padding=5)
        status_hbox.pack_start(self.abort_all, False, False, padding=5)
        self.main_vbox.pack_start(status_hbox, False, False)

        # callbacks
        self.delete_all.connect("clicked", self.delete_all_cb)
        self.abort_all.connect("clicked", self.abort_all_cb)
        self.open_dldir.connect("clicked", self.open_dldir_cb)
        close_eb.connect("button-press-event", self.close_cb)

        self.page.pack_start(self.main_vbox)
        self.page.show_all()
        self.main_gui.add_page(self.page)