def on_left_click(self): win = gajim.interface.roster.window if len(gajim.events.get_systray_events()) == 0: # No pending events, so toggle visible/hidden for roster window if win.get_property('visible') and (win.get_property( 'has-toplevel-focus') or os.name == 'nt'): # visible in ANY virtual desktop? # we could be in another VD right now. eg vd2 # and we want to show it in vd2 if not gtkgui_helpers.possibly_move_window_in_current_desktop( win) and gajim.config.get('save-roster-position'): x, y = win.get_position() gajim.config.set('roster_x-position', x) gajim.config.set('roster_y-position', y) win.hide() # else we hide it from VD that was visible in else: if not win.get_property('visible'): win.show_all() if gajim.config.get('save-roster-position'): gtkgui_helpers.move_window(win, gajim.config.get('roster_x-position'), gajim.config.get('roster_y-position')) if not gajim.config.get('roster_window_skip_taskbar'): win.set_property('skip-taskbar-hint', False) win.present_with_time(Gtk.get_current_event_time()) else: self.handle_first_event()
def on_left_click(self): win = gajim.interface.roster.window if len(gajim.events.get_systray_events()) == 0: # No pending events, so toggle visible/hidden for roster window if win.get_property('visible') and (win.get_property( 'has-toplevel-focus') or os.name == 'nt'): # visible in ANY virtual desktop? # we could be in another VD right now. eg vd2 # and we want to show it in vd2 if not gtkgui_helpers.possibly_move_window_in_current_desktop( win) and gajim.config.get('save-roster-position'): x, y = win.get_position() gajim.config.set('roster_x-position', x) gajim.config.set('roster_y-position', y) win.hide() # else we hide it from VD that was visible in else: if not win.get_property('visible'): win.show_all() if gajim.config.get('save-roster-position'): gtkgui_helpers.move_window(win, gajim.config.get('roster_x-position'), gajim.config.get('roster_y-position')) if not gajim.config.get('roster_window_skip_taskbar'): win.set_property('skip-taskbar-hint', False) win.present_with_time(gtk.get_current_event_time()) else: self.handle_first_event()
def handle_first_event(self): account, jid, event = gajim.events.get_first_systray_event() if not event: return win = gajim.interface.roster.window if not win.get_property('visible') and gajim.config.get( 'save-roster-position'): gtkgui_helpers.move_window(win, gajim.config.get('roster_x-position'), gajim.config.get('roster_y-position')) gajim.interface.handle_event(account, jid, event.type_)
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()
def _position_window(self, win, acct, type_): '''Moves window according to config settings''' if (self.mode in [self.ONE_MSG_WINDOW_NEVER, self.ONE_MSG_WINDOW_ALWAYS_WITH_ROSTER]): return if self.mode == self.ONE_MSG_WINDOW_ALWAYS: pos = (gajim.config.get('msgwin-x-position'), gajim.config.get('msgwin-y-position')) elif self.mode == self.ONE_MSG_WINDOW_PERACCT: pos = (gajim.config.get_per('accounts', acct, 'msgwin-x-position'), gajim.config.get_per('accounts', acct, 'msgwin-y-position')) elif self.mode == self.ONE_MSG_WINDOW_PERTYPE: pos = (gajim.config.get(type_ + '-msgwin-x-position'), gajim.config.get(type_ + '-msgwin-y-position')) else: return gtkgui_helpers.move_window(win.window, pos[0], pos[1])
def _position_window(self, win, acct, type_): '''Moves window according to config settings''' if (self.mode in [ self.ONE_MSG_WINDOW_NEVER, self.ONE_MSG_WINDOW_ALWAYS_WITH_ROSTER ]): return if self.mode == self.ONE_MSG_WINDOW_ALWAYS: pos = (gajim.config.get('msgwin-x-position'), gajim.config.get('msgwin-y-position')) elif self.mode == self.ONE_MSG_WINDOW_PERACCT: pos = (gajim.config.get_per('accounts', acct, 'msgwin-x-position'), gajim.config.get_per('accounts', acct, 'msgwin-y-position')) elif self.mode == self.ONE_MSG_WINDOW_PERTYPE: pos = (gajim.config.get(type_ + '-msgwin-x-position'), gajim.config.get(type_ + '-msgwin-y-position')) else: return gtkgui_helpers.move_window(win.window, pos[0], pos[1])
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()
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()