def ready(self): global community, plugin community = get_plugin_by_type(PLUGIN_TYPE_COMMUNITY) self.fetcher = get_plugin_by_type(PLUGIN_TYPE_FETCHER) plugin = self self.create_udp_listener()
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)
def __init__(self, gui, community_gui, user): """User_Page class is for showing user's profile information defined in the Edit Profile dialog and for showing user's communities. update_user_page() have to be called after user's profile is changed or after user's communities are changed so that new values are loaded into GUI""" GUI_Page.__init__(self, user.get('nick')) self.main_gui = gui self.community_gui = community_gui self.user = user self.community = get_plugin_by_type(PLUGIN_TYPE_COMMUNITY) self.state_plugin = get_plugin_by_type(PLUGIN_TYPE_STATE) self.notebook = gtk.Notebook() self.notebook.set_show_tabs(True) self.notebook.set_show_border(False) self.initialize_profile_page() self.initialize_user_action_page() self.initialize_communities_page() self.pack_start(self.notebook) self.show_all()
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()
def ready(self): global community community = self self.fetcher = get_plugin_by_type(PLUGIN_TYPE_FETCHER) self.notify = get_plugin_by_type(PLUGIN_TYPE_NOTIFICATION) self.net = get_plugin_by_type(PLUGIN_TYPE_NETWORK_CONTROL) self.fetcher.register_handler(PLUGIN_TYPE_COMMUNITY, self.handle_request, 'community fetch') settings = get_plugin_by_type(PLUGIN_TYPE_SETTINGS) self.default_rpc_port_setting = settings.register('community.rpc_port', int, 'TCP listening port; 0 means a random port.\nTakes effect after restart', default=0, validator=valid_port) self.listener_port_setting = settings.register('community.listener_port', int, 'Peer discovery (UDP) listening port.\nTakes effect after restart', default=DEFAULT_PROXIMATE_PORT, validator=valid_port) # The command line setting has the highest priority, then comes # the config file port, and random port has the least priority. if self.activeport != None: self.myself.set('port', self.activeport) else: port = self.default_rpc_port_setting.value if port != 0: self.myself.set('port', port) else: self.gen_port() if self.udp_listen: self.create_udp_listener() sch = get_plugin_by_type(PLUGIN_TYPE_SCHEDULER) sch.call_periodic(TP_SCAN_INTERVAL * sch.SECOND, self.periodic_event, callnow=True) # Set periodic active user logging sch.call_periodic(15 * 60 * sch.SECOND, self.log_users)
def __init__(self, community_gui, gui, com): GUI_Page.__init__(self, com.get('name')) self.notification = get_plugin_by_type(PLUGIN_TYPE_NOTIFICATION) self.community = get_plugin_by_type(PLUGIN_TYPE_COMMUNITY) self.item_double_clicking = None self.community_gui = community_gui self.main_gui = gui self.com = com self.list_view = community_gui.list_view_setting.value self.profile_widgets = {} # model (icon, item, text) self.itemlist = gtk.ListStore(gtk.gdk.Pixbuf, gobject.TYPE_PYOBJECT, str, str) self.update_members() self.pic_dialog = Picture_Choose_Dialog(gui, self.got_picture) self.notebook = gtk.Notebook() self.notebook.set_show_tabs(True) self.notebook.set_show_border(False) self.initialize_members_page() self.initialize_profile_page() self.initialize_modify_page() self.pack_start(self.notebook)
def __init__(self): global community, notify self.register_plugin(PLUGIN_TYPE_USER_PRESENCE) community = get_plugin_by_type(PLUGIN_TYPE_COMMUNITY) notify = get_plugin_by_type(PLUGIN_TYPE_NOTIFICATION) self.patterns = []
def __init__(self, gui): self.main_gui = gui self.community = get_plugin_by_type(PLUGIN_TYPE_COMMUNITY) self.sendfile = get_plugin_by_type(PLUGIN_TYPE_SEND_FILE) self.notification = get_plugin_by_type(PLUGIN_TYPE_NOTIFICATION) self.filesharing = get_plugin_by_type(PLUGIN_TYPE_FILE_SHARING) self.sendfile.receive_cb.append(self.display_receive)
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)
def ready(self): global community, fetcher, firstmsg community = get_plugin_by_type(PLUGIN_TYPE_COMMUNITY) fetcher = get_plugin_by_type(PLUGIN_TYPE_FETCHER) # First record is my uid. 't' and 'rt' are just filled in # because they are checked on the slave side. firstmsg = {'t': '', 'uid': community.get_myuid(), 'c': ''}
def ready(self): self.fetcher = get_plugin_by_type(PLUGIN_TYPE_FETCHER) self.community = get_plugin_by_type(PLUGIN_TYPE_COMMUNITY) self.indicator = get_plugin_by_type(PLUGIN_TYPE_NOTIFICATION).get_progress_indicator('Key management') proximatestate = get_plugin_by_type(PLUGIN_TYPE_STATE) if proximatestate.options.key_exchange: self.fetcher.register_handler(PLUGIN_TYPE_KEY_MANAGEMENT, self.handle_requests, 'key fetch') self.myself = self.community.get_myself() self.my_uid = self.myself.get('uid')
def __init__(self): """Constructor for Proximate_GUI.""" self.community = get_plugin_by_type(PLUGIN_TYPE_COMMUNITY) self.notification = get_plugin_by_type(PLUGIN_TYPE_NOTIFICATION) settings = get_plugin_by_type(PLUGIN_TYPE_SETTINGS) self.width_setting = settings.register("gui.width", int, None, 0) self.height_setting = settings.register("gui.height", int, None, 0) self.page_history = [] self.main_window = None self.initialize_menu() try: # This only seem to only exists on Maemo gtk.set_application_name(APP_NAME) except AttributeError: pass button = gtk.Button() button.get_settings().set_property("gtk-button-images", True) if have_hildon: self.initialize_hildon_program() else: self.initialize_gtk_program() self.main_loop = gobject.MainLoop() self.fullscreen_mode = False self.keybindings = [] self.add_key_binding(None, gtk.keysyms.F6, self.key_pressed_F6) self.add_key_binding(gtk.gdk.CONTROL_MASK, gtk.keysyms.q, self.key_pressed_ctrl_q) self.popup_timeout_id = None self.event_clicked_at = None self.statusbar_timeout_id = None self.tbitems = {} # Signal Ids for connecting communities' userlists self.userlist_drag_data_get_signal_ids = {} self.userlists_button_press_signal_ids = {} # Initialize menu self.connect_default_menu_signals() self.notification.register_progress_update(self.handle_progress_update)
def ready(self): global community, fetcher fetcher = self community = get_plugin_by_type(PLUGIN_TYPE_COMMUNITY) for p in [PLUGIN_TYPE_UDP_FETCHER, PLUGIN_TYPE_TCP_FETCHER]: self.backend = get_plugin_by_type(p) if self.backend != None and self.backend.functional(): break sch = get_plugin_by_type(PLUGIN_TYPE_SCHEDULER) sch.call_periodic(RETIREMENT_CYCLE * sch.SECOND, self.fetch_queue_retirement)
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)
def __init__(self, gui, title, actiontext=gtk.STOCK_OK): self.community = get_plugin_by_type(PLUGIN_TYPE_COMMUNITY) self.notification = get_plugin_by_type(PLUGIN_TYPE_NOTIFICATION) self.main_window = gui.get_main_window() self.dialog = gtk.Dialog(title, self.main_window, gtk.DIALOG_DESTROY_WITH_PARENT, (actiontext, gtk.RESPONSE_OK, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)) self.dialog.set_modal(True) self.list = Community_List() self.dialog.vbox.pack_start(self.list.get_widget(), True, True) self.dialog.connect("response", self.response_handler) self.dialog.set_default_size(400, 300) self.dialog.show_all()
def __init__(self, ui): Curses_Page.__init__(self, 'Messaging') self.main_ui = ui self.community = get_plugin_by_type(PLUGIN_TYPE_COMMUNITY) self.messaging = get_plugin_by_type(PLUGIN_TYPE_MESSAGING) self.messaging.register_ui(self) self.community.community_gui.register_com_event('Chat', self.start_messaging_cb) self.display = [] self.buffer = '' self.active_conversation = None
def init(): """ Bind a default and a random port. The random port is used for local network communication. The default port is used to establish remote connections. """ global community community = get_plugin_by_type(PLUGIN_TYPE_COMMUNITY) create_tcp_listener(DEFAULT_PROXIMATE_PORT, tcp_listener_accept, reuse=True) success = False for i in xrange(PORT_RETRIES): port = community.get_rpc_port() if port == DEFAULT_PROXIMATE_PORT: continue (rfd, tag) = create_tcp_listener(port, tcp_listener_accept, reuse=True) if rfd != None: info('Listening to TCP connections on port %d\n' %(port)) success = True break warning('Can not bind to TCP port %d\n' %(port)) # Generate a new port number so that next iteration will not fail if not community.gen_port(): break if not success: warning('Can not listen to TCP connections\n')
def ready(self): if self.use_interface == None: if self.initialize_icd(): info('Using Nokia ICd\n') return devlist = [] if self.use_interface != None: # user specified inteface devlist.append(self.use_interface) else: devlist.append('bat0') for i in xrange(3): devlist.append('wlan%d' %(i)) for i in xrange(9): devlist.append('eth%d' %(i)) for dev in devlist: (ip, bcast) = self.get_ip_address(dev) if ip != None: info('Using interface %s: %s %s\n' % (dev, ip, bcast)) self.interfaces[dev] = (ip, bcast) sch = get_plugin_by_type(PLUGIN_TYPE_SCHEDULER) sch.call_periodic(POLL_INTERVAL * sch.SECOND, self.periodic_poll)
def __init__(self, main_gui_window, title, descr, cb, ctx = None): self.cb = cb self.ctx = ctx self.filesharing = get_plugin_by_type(PLUGIN_TYPE_FILE_SHARING) gtk.Dialog.__init__(self, title, main_gui_window, gtk.DIALOG_DESTROY_WITH_PARENT, ('Download', 1, 'Open', 2, 'Cancel', 3)) self.main_gui_window = main_gui_window down_dir = self.filesharing.get_download_path() descr_text = gtk.Label(descr) self.directory_entry = gtk.Entry() self.vbox.pack_start(descr_text, False, False) help_text = gtk.Label('Save to:') self.directory_entry = gtk.Entry() self.vbox.pack_start(help_text, False, False) hbox = gtk.HBox() self.vbox.pack_start(hbox) self.directory_entry.set_text(down_dir) self.chooser_button = gtk.Button('Select directory') self.chooser_button.connect('clicked', self.open_chooser) hbox.pack_start(self.directory_entry, True, True, 10) hbox.pack_start(self.chooser_button, False, False) self.connect('response', self.handle_response) self.show_all()
def get_user_profile_picture(user, status_icons=True, center=True): """ Returns picture saved in user's profile as a GDK Pixbuf, or the default picture with a background color generated from uid. Status icons are added to the picture, if status_icons == True. """ try: icon = gtk.gdk.pixbuf_new_from_file(proximatestate.seek_face_name(user)) except gobject.GError: icon = create_default_user_picture(user) if center: # center image if it's smaller than MAX_FACE_DIMENSION smaller_dimension = min(icon.get_width(), icon.get_height()) if smaller_dimension < MAX_FACE_DIMENSION: icon = center_image(icon, MAX_FACE_DIMENSION, MAX_FACE_DIMENSION) if status_icons: # add small status icons community = get_plugin_by_type(PLUGIN_TYPE_COMMUNITY) if not user == community.get_myself(): if user.get('key_fname'): status_icon = gtk.gdk.pixbuf_new_from_file(get_path(SMALL_KEYS_ICON)) add_icon_to_image(icon, status_icon, 4) user_status = user.get('status_icon') if user_status: add_icon_to_image(icon, get_status_icon(user_status, 32), 0) return icon
def __init__(self, gui): self.community_gui = gui self.community = get_plugin_by_type(PLUGIN_TYPE_COMMUNITY) self.notification = get_plugin_by_type(PLUGIN_TYPE_NOTIFICATION) self.window = gtk.Dialog('Change Status', buttons = (gtk.STOCK_OK, gtk.RESPONSE_OK, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)) self.window.set_modal(True) self.window.set_border_width(5) self.window.vbox.set_spacing(5) self.window.set_has_separator(False) self.status_buttons = {} myself = self.community.get_myself() status_group = gtk.RadioButton() def button_row(statuslist): icons_hbox = gtk.HBox(True, 10) for status in statuslist: radiobutton = gtk.RadioButton(status_group) self.status_buttons[status] = radiobutton vbox = gtk.VBox() image = gtk.image_new_from_pixbuf(get_status_icon(status, STATUSBAR_ICON_SIZE)) vbox.pack_start(image, False, True) vbox.pack_start(gtk.Label(status.title()), False, True) radiobutton.set_mode(False) if status == myself.get('status_icon'): radiobutton.set_active(True) radiobutton.add(vbox) icons_hbox.pack_start(radiobutton, False, True) return icons_hbox self.window.vbox.pack_start(button_row(USER_STATUS_LIST[0:3]), False, False) self.window.vbox.pack_start(button_row(USER_STATUS_LIST[3:]), False, False) self.window.vbox.pack_start(gtk.Label('What is on your mind?'), False, True) self.status_entry = gtk.Entry() status = myself.get('status') if status != None: self.status_entry.set_text(status) self.window.vbox.pack_start(self.status_entry, True, True) self.window.connect("response", self.response_handler) self.window.show_all()
def __init__(self, gui): self.keymanagement = get_plugin_by_type(PLUGIN_TYPE_KEY_MANAGEMENT) self.notification = get_plugin_by_type(PLUGIN_TYPE_NOTIFICATION) self.main_gui = gui self.dialog = gtk.Dialog('Key Management', gui.main_window, gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_MODAL, (gtk.STOCK_APPLY, gtk.RESPONSE_APPLY, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)) self.key_label = gtk.Label('Key ID: ') self.dialog.vbox.pack_start(self.key_label, False, True) self.gen_button = gtk.Button('Regenerate keys') self.dialog.vbox.pack_start(self.gen_button, False, True) self.close_button = gtk.Button('Close') self.gen_button.connect('clicked', self.generate_keys) self.generator = None self.generating_keys = False
def ready(self): self.community = get_plugin_by_type(PLUGIN_TYPE_COMMUNITY) self.fetcher = get_plugin_by_type(PLUGIN_TYPE_FETCHER) self.notification = get_plugin_by_type(PLUGIN_TYPE_NOTIFICATION) self.vibra = get_plugin_by_type(PLUGIN_TYPE_VIBRA) self.myself = self.community.get_myself() self.my_addr = addr_from_user(self.myself) self.fetcher.register_handler(PLUGIN_TYPE_MESSAGING, self.handle_messaging_command, 'messaging') self.conversations = {} self.new_message_cb = [] self.delete_message_cb = [] self.change_message_cb = [] settings = get_plugin_by_type(PLUGIN_TYPE_SETTINGS) self.vibra_chat_setting = settings.register('vibra.chat', bool, 'Vibrate on community chat messages', default=False) self.vibra_private_setting = settings.register('vibra.private', bool, 'Vibrate on private chat messages', default=False)
def __init__(self, main_gui): global userpresence userpresence = get_plugin_by_type(PLUGIN_TYPE_USER_PRESENCE) self.main_gui = main_gui self.menu = gtk.Menu() menuitem = gtk.MenuItem('Edit user watches') menuitem.connect('activate', self.add_user_watch_cb) self.menu.append(menuitem) self.main_gui.add_menu('Presence', self.menu)
def __init__(self, ui): Curses_Page.__init__(self, "Home") self.main_ui = ui self.community = get_plugin_by_type(PLUGIN_TYPE_COMMUNITY) self.community.register_ui(self) self.com_events = [] self.user_events = [] self.main_ui.show_page(self)
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)
def __init__(self, main_gui): gtk.DrawingArea.__init__(self) self.set_events(gtk.gdk.ALL_EVENTS_MASK) self.connect('button-press-event', self.clicked) self.connect('expose-event', self.expose) self.context = None self.users = {} # user object : [face pixbuf, x, y, selected] self.drawn_users = [] # list of visible users on the radar self.selected_user = None self.community = get_plugin_by_type(PLUGIN_TYPE_COMMUNITY) self.double_clicking = False self.main_gui = main_gui self.com = self.community.get_default_community()
def __init__(self, title, gui): self.main_gui = gui self.personal_community = False self.icon_fname = None self.icon_changed = False self.notification = get_plugin_by_type(PLUGIN_TYPE_NOTIFICATION) self.community = get_plugin_by_type(PLUGIN_TYPE_COMMUNITY) self.main_window = gui.get_main_window() new_title = title + ' Community' self.dialog = gtk.Dialog(new_title, self.main_window, \ gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_MODAL, \ (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, \ title, gtk.RESPONSE_OK)) # this should be better for toplevel windows than set_size_request() self.dialog.set_default_size(400, 300) self.initialize_widgets() self.dialog.connect("response", self.response_handler) self.dialog.show_all() self.pic_dialog = Picture_Choose_Dialog(self.main_gui, self.got_picture)
def __init__(self, gui): GUI_Page.__init__(self, 'Settings') self.settings = get_plugin_by_type(PLUGIN_TYPE_SETTINGS) self.main_gui = gui self.vbox = gtk.VBox(False, 5) for s in self.settings.settings: self.add_setting(s) self.settings.new_setting_cb.append(self.add_setting) self.initialize_menu() self.pack_start(self.vbox) self.show_all() self.main_gui.add_page(self)
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()