Пример #1
0
    def reconfig(self):
        for w in self.windows():
            self.save_state(w)
        mode = gajim.config.get('one_message_window')
        if self.mode == common.config.opt_one_window_types.index(mode):
            # No change
            return
        self.mode = common.config.opt_one_window_types.index(mode)

        controls = []
        for w in self.windows():
            # Note, we are taking care not to hide/delete the roster window when the
            # MessageWindow is embedded.
            if not w.parent_paned:
                w.window.hide()
            else:
                # Stash current size so it can be restored if the MessageWindow
                # is not longer embedded
                roster_width = w.parent_paned.get_position()
                gajim.config.set('roster_width', roster_width)

            while w.notebook.get_n_pages():
                page = w.notebook.get_nth_page(0)
                ctrl = w._widget_to_control(page)
                w.notebook.remove_page(0)
                page.unparent()
                controls.append(ctrl)

            # Must clear _controls to prevent MessageControl.shutdown calls
            w._controls = {}
            if not w.parent_paned:
                w.window.destroy()
            else:
                # Don't close parent window, just remove the child
                child = w.parent_paned.get_child2()
                w.parent_paned.remove(child)
                gajim.interface.roster.xml.get_object('show_roster_menuitem').\
                    set_sensitive(False)
                gtkgui_helpers.resize_window(w.window,
                        gajim.config.get('roster_width'),
                        gajim.config.get('roster_height'))

        self._windows = {}

        for ctrl in controls:
            mw = self.get_window(ctrl.contact.jid, ctrl.account)
            if not mw:
                mw = self.create_window(ctrl.contact, ctrl.account,
                                        ctrl.type_id)
            ctrl.parent_win = mw
            mw.new_tab(ctrl)
Пример #2
0
	def __init__(self, contact, account):
		# we check that on opening new windows
		self.always_compact_view = gajim.config.get('always_compact_view_chat')
		chat.Chat.__init__(self, account, 'tabbed_chat_window')
		self.contacts = {}
		# keep check for possible paused timeouts per jid
		self.possible_paused_timeout_id = {}
		# keep check for possible inactive timeouts per jid
		self.possible_inactive_timeout_id = {}
		
		# keep timeout id and window obj for possible big avatar
		# it is on enter-notify and leave-notify so no need to be per jid
		self.show_bigger_avatar_timeout_id = None
		self.bigger_avatar_window = None
		
		# list that holds all the jid we have asked vcard once
		# (so we do not have to ask again)
		self.jids_for_which_we_asked_vcard_already = list()
		
		self.TARGET_TYPE_URI_LIST = 80
		self.dnd_list = [ ( 'text/uri-list', 0, self.TARGET_TYPE_URI_LIST ) ]
		self.new_tab(contact)
		self.show_title()
	
		# NOTE: if it not a window event, do not connect here (new_tab() autoconnects)
		signal_dict = {
'on_tabbed_chat_window_destroy': self.on_tabbed_chat_window_destroy,
'on_tabbed_chat_window_delete_event': self.on_tabbed_chat_window_delete_event,
'on_tabbed_chat_window_focus_in_event': self.on_tabbed_chat_window_focus_in_event,
'on_chat_notebook_key_press_event': self.on_chat_notebook_key_press_event,
'on_chat_notebook_switch_page': self.on_chat_notebook_switch_page, # in chat.py
'on_tabbed_chat_window_motion_notify_event': self.on_tabbed_chat_window_motion_notify_event,
		}

		self.xml.signal_autoconnect(signal_dict)


		if gajim.config.get('saveposition') and \
			not gtkgui_helpers.one_window_opened('chats'):
			# get window position and size from config
			gtkgui_helpers.move_window(self.window, gajim.config.get('chat-x-position'),
				gajim.config.get('chat-y-position'))
			gtkgui_helpers.resize_window(self.window, gajim.config.get('chat-width'),
					gajim.config.get('chat-height'))

		# gtk+ doesn't make use of the motion notify on gtkwindow by default
		# so this line adds that
		self.window.set_events(gtk.gdk.POINTER_MOTION_MASK)
		
		self.window.show_all()
Пример #3
0
    def reconfig(self):
        for w in self.windows():
            self.save_state(w)
        gajim.interface.save_config()
        mode = gajim.config.get('one_message_window')
        if self.mode == common.config.opt_one_window_types.index(mode):
            # No change
            return
        self.mode = common.config.opt_one_window_types.index(mode)

        controls = []
        for w in self.windows():
            # Note, we are taking care not to hide/delete the roster window when the
            # MessageWindow is embedded.
            if not w.parent_paned:
                w.window.hide()
            else:
                # Stash current size so it can be restored if the MessageWindow
                # is not longer embedded
                roster_width = w.parent_paned.get_child1().allocation.width
                gajim.config.set('roster_width', roster_width)

            while w.notebook.get_n_pages():
                page = w.notebook.get_nth_page(0)
                ctrl = w._widget_to_control(page)
                w.notebook.remove_page(0)
                page.unparent()
                controls.append(ctrl)

            # Must clear _controls to prevent MessageControl.shutdown calls
            w._controls = {}
            if not w.parent_paned:
                w.window.destroy()
            else:
                # Don't close parent window, just remove the child
                child = w.parent_paned.get_child2()
                w.parent_paned.remove(child)
                gtkgui_helpers.resize_window(w.window,
                                             gajim.config.get('roster_width'),
                                             gajim.config.get('roster_height'))

        self._windows = {}

        for ctrl in controls:
            mw = self.get_window(ctrl.contact.jid, ctrl.account)
            if not mw:
                mw = self.create_window(ctrl.contact, ctrl.account,
                                        ctrl.type_id)
            ctrl.parent_win = mw
            mw.new_tab(ctrl)
Пример #4
0
    def __init__(self, jid=None, account=None):
        xml = gtkgui_helpers.get_gtk_builder('history_window.ui')
        self.window = xml.get_object('history_window')
        self.calendar = xml.get_object('calendar')
        scrolledwindow = xml.get_object('scrolledwindow')
        self.history_textview = conversation_textview.ConversationTextview(
            account, used_in_history_window=True)
        scrolledwindow.add(self.history_textview.tv)
        self.history_buffer = self.history_textview.tv.get_buffer()
        self.history_buffer.create_tag('highlight', background='yellow')
        self.history_buffer.create_tag('invisible', invisible=True)
        self.checkbutton = xml.get_object('log_history_checkbutton')
        self.checkbutton.connect('toggled',
                                 self.on_log_history_checkbutton_toggled)
        self.show_status_checkbutton = xml.get_object(
            'show_status_checkbutton')
        self.search_entry = xml.get_object('search_entry')
        self.query_liststore = xml.get_object('query_liststore')
        self.jid_entry = xml.get_object('query_entry')
        self.jid_entry.connect('activate', self.on_jid_entry_activate)
        self.results_treeview = xml.get_object('results_treeview')
        self.results_window = xml.get_object('results_scrolledwindow')
        self.search_in_date = xml.get_object('search_in_date')

        # contact_name, date, message, time
        model = Gtk.ListStore(str, str, str, str, str)
        self.results_treeview.set_model(model)
        col = Gtk.TreeViewColumn(_('Name'))
        self.results_treeview.append_column(col)
        renderer = Gtk.CellRendererText()
        col.pack_start(renderer, True)
        col.add_attribute(renderer, 'text', Column.CONTACT_NAME)
        col.set_sort_column_id(
            Column.CONTACT_NAME)  # user can click this header and sort
        col.set_resizable(True)

        col = Gtk.TreeViewColumn(_('Date'))
        self.results_treeview.append_column(col)
        renderer = Gtk.CellRendererText()
        col.pack_start(renderer, True)
        col.add_attribute(renderer, 'text', Column.UNIXTIME)
        col.set_sort_column_id(
            Column.UNIXTIME)  # user can click this header and sort
        col.set_resizable(True)

        col = Gtk.TreeViewColumn(_('Message'))
        self.results_treeview.append_column(col)
        renderer = Gtk.CellRendererText()
        col.pack_start(renderer, True)
        col.add_attribute(renderer, 'text', Column.MESSAGE)
        col.set_resizable(True)

        self.jid = None  # The history we are currently viewing
        self.account = None
        self.completion_dict = {}
        self.accounts_seen_online = []  # Update dict when new accounts connect
        self.jids_to_search = []

        # This will load history too
        task = self._fill_completion_dict()
        GLib.idle_add(next, task)

        if jid:
            self.jid_entry.set_text(jid)
        else:
            self._load_history(None)

        gtkgui_helpers.resize_window(self.window,
                                     gajim.config.get('history_window_width'),
                                     gajim.config.get('history_window_height'))
        gtkgui_helpers.move_window(
            self.window, gajim.config.get('history_window_x-position'),
            gajim.config.get('history_window_y-position'))

        xml.connect_signals(self)
        self.window.show_all()
Пример #5
0
	def resize(self, width, height):
		gtkgui_helpers.resize_window(self.window, width, height)
Пример #6
0
    def __init__(self, jid = None, account = None):
        xml = gtkgui_helpers.get_gtk_builder('history_window.ui')
        self.window = xml.get_object('history_window')
        self.calendar = xml.get_object('calendar')
        scrolledwindow = xml.get_object('scrolledwindow')
        self.history_textview = conversation_textview.ConversationTextview(
            account, used_in_history_window = True)
        scrolledwindow.add(self.history_textview.tv)
        self.history_buffer = self.history_textview.tv.get_buffer()
        self.history_buffer.create_tag('highlight', background = 'yellow')
        self.history_buffer.create_tag('invisible', invisible=True)
        self.checkbutton = xml.get_object('log_history_checkbutton')
        self.checkbutton.connect('toggled',
            self.on_log_history_checkbutton_toggled)
        self.show_status_checkbutton = xml.get_object('show_status_checkbutton')
        self.search_entry = xml.get_object('search_entry')
        self.query_liststore = xml.get_object('query_liststore')
        self.jid_entry = xml.get_object('query_entry')
        self.jid_entry.connect('activate', self.on_jid_entry_activate)
        self.results_treeview = xml.get_object('results_treeview')
        self.results_window = xml.get_object('results_scrolledwindow')
        self.search_in_date = xml.get_object('search_in_date')

        # contact_name, date, message, time
        model = Gtk.ListStore(str, str, str, str, str)
        self.results_treeview.set_model(model)
        col = Gtk.TreeViewColumn(_('Name'))
        self.results_treeview.append_column(col)
        renderer = Gtk.CellRendererText()
        col.pack_start(renderer, True)
        col.add_attribute(renderer, 'text', C_CONTACT_NAME)
        col.set_sort_column_id(C_CONTACT_NAME) # user can click this header and sort
        col.set_resizable(True)

        col = Gtk.TreeViewColumn(_('Date'))
        self.results_treeview.append_column(col)
        renderer = Gtk.CellRendererText()
        col.pack_start(renderer, True)
        col.add_attribute(renderer, 'text', C_UNIXTIME)
        col.set_sort_column_id(C_UNIXTIME) # user can click this header and sort
        col.set_resizable(True)

        col = Gtk.TreeViewColumn(_('Message'))
        self.results_treeview.append_column(col)
        renderer = Gtk.CellRendererText()
        col.pack_start(renderer, True)
        col.add_attribute(renderer, 'text', C_MESSAGE)
        col.set_resizable(True)

        self.jid = None # The history we are currently viewing
        self.account = None
        self.completion_dict = {}
        self.accounts_seen_online = [] # Update dict when new accounts connect
        self.jids_to_search = []

        # This will load history too
        task = self._fill_completion_dict()
        GLib.idle_add(next, task)

        if jid:
            self.jid_entry.set_text(jid)
        else:
            self._load_history(None)

        gtkgui_helpers.resize_window(self.window,
                gajim.config.get('history_window_width'),
                gajim.config.get('history_window_height'))
        gtkgui_helpers.move_window(self.window,
                gajim.config.get('history_window_x-position'),
                gajim.config.get('history_window_y-position'))

        xml.connect_signals(self)
        self.window.show_all()
Пример #7
0
 def resize(self, width, height):
     gtkgui_helpers.resize_window(self.window, width, height)