[Geobert] new compact view so important info are not hidden (f.e. chatstates) for maximum adjustment, see hide_* in ACE. fixes #1276
This commit is contained in:
parent
0935a91e0e
commit
f0f054af6b
|
@ -389,7 +389,7 @@ class ChatControlBase(MessageControl):
|
||||||
self.clear(self.msg_textview) # clear message textview too
|
self.clear(self.msg_textview) # clear message textview too
|
||||||
return True
|
return True
|
||||||
elif message == '/compact':
|
elif message == '/compact':
|
||||||
self.set_compact_view(not self.compact_view_current)
|
self.chat_buttons_set_visible(not self.hide_chat_buttons_current)
|
||||||
self.clear(self.msg_textview)
|
self.clear(self.msg_textview)
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
@ -519,7 +519,7 @@ class ChatControlBase(MessageControl):
|
||||||
|
|
||||||
def _on_compact_view_menuitem_activate(self, widget):
|
def _on_compact_view_menuitem_activate(self, widget):
|
||||||
isactive = widget.get_active()
|
isactive = widget.get_active()
|
||||||
self.set_compact_view(isactive)
|
self.chat_buttons_set_visible(isactive)
|
||||||
|
|
||||||
def set_control_active(self, state):
|
def set_control_active(self, state):
|
||||||
if state:
|
if state:
|
||||||
|
@ -652,32 +652,22 @@ class ChatControlBase(MessageControl):
|
||||||
color.blue = int((color.blue * p) + (mask * (1 - p)))
|
color.blue = int((color.blue * p) + (mask * (1 - p)))
|
||||||
return color
|
return color
|
||||||
|
|
||||||
def set_compact_view(self, state):
|
def widget_set_visible(self, widget, state):
|
||||||
'''Toggle compact view. state is bool'''
|
'''Show or hide a widget. state is bool'''
|
||||||
MessageControl.set_compact_view(self, state)
|
|
||||||
# make the last message visible, when changing to "full view"
|
# make the last message visible, when changing to "full view"
|
||||||
if not state:
|
if not state:
|
||||||
gobject.idle_add(self.conv_textview.scroll_to_end_iter)
|
gobject.idle_add(self.conv_textview.scroll_to_end_iter)
|
||||||
|
|
||||||
if self.type_id == message_control.TYPE_GC:
|
|
||||||
widgets = [
|
|
||||||
self.xml.get_widget('banner_eventbox'),
|
|
||||||
self.xml.get_widget('actions_hbox'),
|
|
||||||
self.xml.get_widget('list_scrolledwindow'),
|
|
||||||
]
|
|
||||||
else:
|
|
||||||
widgets = [
|
|
||||||
self.xml.get_widget('banner_eventbox'),
|
|
||||||
self.xml.get_widget('actions_hbox'),
|
|
||||||
]
|
|
||||||
|
|
||||||
for widget in widgets:
|
widget.set_no_show_all(state)
|
||||||
if state:
|
if state:
|
||||||
widget.set_no_show_all(True)
|
widget.hide()
|
||||||
widget.hide()
|
else:
|
||||||
else:
|
widget.show_all()
|
||||||
widget.set_no_show_all(False)
|
|
||||||
widget.show_all()
|
def chat_buttons_set_visible(self, state):
|
||||||
|
'''Toggle chat buttons. state is bool'''
|
||||||
|
MessageControl.chat_buttons_set_visible(self, state)
|
||||||
|
self.widget_set_visible(self.xml.get_widget('actions_hbox'), state)
|
||||||
|
|
||||||
def got_connected(self):
|
def got_connected(self):
|
||||||
self.msg_textview.set_sensitive(True)
|
self.msg_textview.set_sensitive(True)
|
||||||
|
@ -697,9 +687,9 @@ class ChatControl(ChatControlBase):
|
||||||
def __init__(self, parent_win, contact, acct, resource = None):
|
def __init__(self, parent_win, contact, acct, resource = None):
|
||||||
ChatControlBase.__init__(self, self.TYPE_ID, parent_win, 'chat_child_vbox',
|
ChatControlBase.__init__(self, self.TYPE_ID, parent_win, 'chat_child_vbox',
|
||||||
(_('Chat'), _('Chats')), contact, acct, resource)
|
(_('Chat'), _('Chats')), contact, acct, resource)
|
||||||
self.compact_view_always = gajim.config.get('always_compact_view_chat')
|
self.hide_chat_buttons_always = gajim.config.get('always_hide_chat_buttons')
|
||||||
self.set_compact_view(self.compact_view_always)
|
self.chat_buttons_set_visible(self.hide_chat_buttons_always)
|
||||||
|
self.widget_set_visible(self.xml.get_widget('banner_eventbox'), gajim.config.get('hide_chat_banner'))
|
||||||
# Initialize drag-n-drop
|
# Initialize drag-n-drop
|
||||||
self.TARGET_TYPE_URI_LIST = 80
|
self.TARGET_TYPE_URI_LIST = 80
|
||||||
self.dnd_list = [ ( 'text/uri-list', 0, self.TARGET_TYPE_URI_LIST ) ]
|
self.dnd_list = [ ( 'text/uri-list', 0, self.TARGET_TYPE_URI_LIST ) ]
|
||||||
|
@ -1153,7 +1143,7 @@ class ChatControl(ChatControlBase):
|
||||||
send_file_menuitem.set_sensitive(False)
|
send_file_menuitem.set_sensitive(False)
|
||||||
|
|
||||||
# compact_view_menuitem
|
# compact_view_menuitem
|
||||||
compact_view_menuitem.set_active(self.compact_view_current)
|
compact_view_menuitem.set_active(self.hide_chat_buttons_current)
|
||||||
|
|
||||||
# add_to_roster_menuitem
|
# add_to_roster_menuitem
|
||||||
if _('Not in Roster') in contact.groups:
|
if _('Not in Roster') in contact.groups:
|
||||||
|
|
|
@ -135,8 +135,6 @@ class Config:
|
||||||
'show_roster_on_startup': [opt_bool, True],
|
'show_roster_on_startup': [opt_bool, True],
|
||||||
'key_up_lines': [opt_int, 25, _('How many lines to store for Ctrl+KeyUP.')],
|
'key_up_lines': [opt_int, 25, _('How many lines to store for Ctrl+KeyUP.')],
|
||||||
'version': [ opt_str, '0.10' ], # which version created the config
|
'version': [ opt_str, '0.10' ], # which version created the config
|
||||||
'always_compact_view_chat': [opt_bool, False, _('Use compact view when you open a chat window')],
|
|
||||||
'always_compact_view_gc': [opt_bool, False, _('Use compact view when you open a group chat window')],
|
|
||||||
'search_engine': [opt_str, 'http://www.google.com/search?&q=%s&sourceid=gajim'],
|
'search_engine': [opt_str, 'http://www.google.com/search?&q=%s&sourceid=gajim'],
|
||||||
'dictionary_url': [opt_str, 'WIKTIONARY', _("Either custom url with %s in it where %s is the word/phrase or 'WIKTIONARY' which means use wiktionary.")],
|
'dictionary_url': [opt_str, 'WIKTIONARY', _("Either custom url with %s in it where %s is the word/phrase or 'WIKTIONARY' which means use wiktionary.")],
|
||||||
'always_english_wikipedia': [opt_bool, False],
|
'always_english_wikipedia': [opt_bool, False],
|
||||||
|
@ -195,6 +193,11 @@ class Config:
|
||||||
_('Controls the window where new messages are placed.\n\'always\' - All messages are sent to a single window.\n\'never\' - All messages get their own window.\n\'peracct\' - Messages for each account are sent to a specific window.\n\'pertype\' - Each message type (e.g., chats vs. groupchats) are sent to a specific window. Note, changing this option requires restarting Gajim before the changes will take effect')],
|
_('Controls the window where new messages are placed.\n\'always\' - All messages are sent to a single window.\n\'never\' - All messages get their own window.\n\'peracct\' - Messages for each account are sent to a specific window.\n\'pertype\' - Each message type (e.g., chats vs. groupchats) are sent to a specific window. Note, changing this option requires restarting Gajim before the changes will take effect')],
|
||||||
'show_avatar_in_chat': [opt_bool, True, _('If False, you will no longer see the avatar in the chat window')],
|
'show_avatar_in_chat': [opt_bool, True, _('If False, you will no longer see the avatar in the chat window')],
|
||||||
'escape_key_closes': [opt_bool, True, _('If True, pressing the escape key closes a tab/window')],
|
'escape_key_closes': [opt_bool, True, _('If True, pressing the escape key closes a tab/window')],
|
||||||
|
'always_hide_groupchat_buttons': [opt_bool, False, _('Hides the buttons when you open a group chat window')],
|
||||||
|
'always_hide_chat_buttons': [opt_bool, False, _('Hides the buttons when you open a chat window')],
|
||||||
|
'hide_groupchat_banner': [opt_bool, False, _('Hides the banner when you open a group chat window')],
|
||||||
|
'hide_chat_banner': [opt_bool, False, _('Hides the banner when you open a chat window')],
|
||||||
|
'hide_groupchat_occupants_list': [opt_bool, False, _('Hides the room occupants list in groupchat window')],
|
||||||
}
|
}
|
||||||
|
|
||||||
__options_per_key = {
|
__options_per_key = {
|
||||||
|
|
|
@ -195,14 +195,21 @@ class OptionsParser:
|
||||||
|
|
||||||
def update_config_09_to_010(self):
|
def update_config_09_to_010(self):
|
||||||
if self.old_values.has_key('usetabbedchat') and not \
|
if self.old_values.has_key('usetabbedchat') and not \
|
||||||
self.old_values['usetabbedchat']:
|
self.old_values['usetabbedchat']:
|
||||||
gajim.config.set('one_message_window', 'never')
|
gajim.config.set('one_message_window', 'never')
|
||||||
if self.old_values.has_key('autodetect_browser_mailer') and \
|
if self.old_values.has_key('autodetect_browser_mailer') and \
|
||||||
self.old_values['autodetect_browser_mailer'] is True:
|
self.old_values['autodetect_browser_mailer'] is True:
|
||||||
gajim.config.set('autodetect_browser_mailer', False)
|
gajim.config.set('autodetect_browser_mailer', False)
|
||||||
if self.old_values.has_key('useemoticons') and \
|
if self.old_values.has_key('useemoticons') and \
|
||||||
not self.old_values['useemoticons']:
|
not self.old_values['useemoticons']:
|
||||||
gajim.config.set('emoticons_theme', '')
|
gajim.config.set('emoticons_theme', '')
|
||||||
|
if self.old_values.has_key('always_compact_view_chat') and \
|
||||||
|
self.old_values['always_compact_view_chat']:
|
||||||
|
gajim.config.set('always_hide_chat_buttons', True)
|
||||||
|
if self.old_values.has_key('always_compact_view_gc') and \
|
||||||
|
self.old_values['always_compact_view_gc']:
|
||||||
|
gajim.config.set('always_hide_groupchat_buttons', True)
|
||||||
|
|
||||||
for account in gajim.config.get_per('accounts'):
|
for account in gajim.config.get_per('accounts'):
|
||||||
proxies_str = gajim.config.get_per('accounts', account,
|
proxies_str = gajim.config.get_per('accounts', account,
|
||||||
'file_transfer_proxies')
|
'file_transfer_proxies')
|
||||||
|
|
|
@ -102,8 +102,10 @@ class GroupchatControl(ChatControlBase):
|
||||||
self.nick = contact.name
|
self.nick = contact.name
|
||||||
self.name = self.room_jid.split('@')[0]
|
self.name = self.room_jid.split('@')[0]
|
||||||
|
|
||||||
self.compact_view_always = gajim.config.get('always_compact_view_gc')
|
self.hide_chat_buttons_always = gajim.config.get('always_hide_groupchat_buttons')
|
||||||
self.set_compact_view(self.compact_view_always)
|
self.chat_buttons_set_visible(self.hide_chat_buttons_always)
|
||||||
|
self.widget_set_visible(self.xml.get_widget('banner_eventbox'), gajim.config.get('hide_groupchat_banner'))
|
||||||
|
self.widget_set_visible(self.xml.get_widget('list_scrolledwindow'), gajim.config.get('hide_groupchat_occupants_list'))
|
||||||
self.gc_refer_to_nick_char = gajim.config.get('gc_refer_to_nick_char')
|
self.gc_refer_to_nick_char = gajim.config.get('gc_refer_to_nick_char')
|
||||||
|
|
||||||
self._last_selected_contact = None # None or holds jid, account tuple
|
self._last_selected_contact = None # None or holds jid, account tuple
|
||||||
|
@ -312,8 +314,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
sets sensitivity state for configure_room'''
|
sets sensitivity state for configure_room'''
|
||||||
menu = self.gc_popup_menu
|
menu = self.gc_popup_menu
|
||||||
childs = menu.get_children()
|
childs = menu.get_children()
|
||||||
# compact_view_menuitem
|
# hide chat buttons
|
||||||
childs[5].set_active(self.compact_view_current)
|
childs[5].set_active(self.hide_chat_buttons_current)
|
||||||
if gajim.gc_connected[self.account][self.room_jid]:
|
if gajim.gc_connected[self.account][self.room_jid]:
|
||||||
c = gajim.contacts.get_gc_contact(self.account, self.room_jid,
|
c = gajim.contacts.get_gc_contact(self.account, self.room_jid,
|
||||||
self.nick)
|
self.nick)
|
||||||
|
@ -1025,8 +1027,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
self.print_conversation(_('Usage: /%s [reason], closes the current '
|
self.print_conversation(_('Usage: /%s [reason], closes the current '
|
||||||
'window or tab, displaying reason if specified.') % command, 'info')
|
'window or tab, displaying reason if specified.') % command, 'info')
|
||||||
elif command == 'compact':
|
elif command == 'compact':
|
||||||
self.print_conversation(_('Usage: /%s, sets the groupchat window to '
|
self.print_conversation(_('Usage: /%s, hide the chat buttons.') % command, 'info')
|
||||||
'compact mode.') % command, 'info')
|
|
||||||
elif command == 'invite':
|
elif command == 'invite':
|
||||||
self.print_conversation(_('Usage: /%s <JID> [reason], invites JID to '
|
self.print_conversation(_('Usage: /%s <JID> [reason], invites JID to '
|
||||||
'the current room, optionally providing a reason.') % command,
|
'the current room, optionally providing a reason.') % command,
|
||||||
|
|
|
@ -42,8 +42,8 @@ class MessageControl:
|
||||||
self.display_names = display_names
|
self.display_names = display_names
|
||||||
self.contact = contact
|
self.contact = contact
|
||||||
self.account = account
|
self.account = account
|
||||||
self.compact_view_always = False
|
self.hide_chat_buttons_always = False
|
||||||
self.compact_view_current = False
|
self.hide_chat_buttons_current = False
|
||||||
self.nb_unread = 0
|
self.nb_unread = 0
|
||||||
self.resource = resource
|
self.resource = resource
|
||||||
|
|
||||||
|
@ -113,9 +113,9 @@ class MessageControl:
|
||||||
# NOTE: Derived classes SHOULD implement this
|
# NOTE: Derived classes SHOULD implement this
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def set_compact_view(self, state):
|
def chat_buttons_set_visible(self, state):
|
||||||
# NOTE: Derived classes MAY implement this
|
# NOTE: Derived classes MAY implement this
|
||||||
self.compact_view_current = state
|
self.hide_chat_buttons_current = state
|
||||||
|
|
||||||
def got_connected(self):
|
def got_connected(self):
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -479,8 +479,8 @@ class MessageWindow:
|
||||||
elif event.string and event.string in st and \
|
elif event.string and event.string in st and \
|
||||||
(event.state & gtk.gdk.MOD1_MASK): # ALT + 1,2,3..
|
(event.state & gtk.gdk.MOD1_MASK): # ALT + 1,2,3..
|
||||||
self.notebook.set_current_page(st.index(event.string))
|
self.notebook.set_current_page(st.index(event.string))
|
||||||
elif event.keyval == gtk.keysyms.c: # ALT + C toggles compact view
|
elif event.keyval == gtk.keysyms.c: # ALT + C toggles chat buttons
|
||||||
ctrl.set_compact_view(not ctrl.compact_view_current)
|
ctrl.chat_buttons_set_visible(not ctrl.hide_chat_buttons_current)
|
||||||
# Close tab bindings
|
# Close tab bindings
|
||||||
elif event.keyval == gtk.keysyms.Escape and \
|
elif event.keyval == gtk.keysyms.Escape and \
|
||||||
gajim.config.get('escape_key_closes'): # Escape
|
gajim.config.get('escape_key_closes'): # Escape
|
||||||
|
|
Loading…
Reference in New Issue