commiting GC mockup and supporting code both by Dennis Craven

This commit is contained in:
Nikos Kouremenos 2005-06-10 20:06:01 +00:00
parent 3ca05afaba
commit b23b2eac9a
5 changed files with 431 additions and 201 deletions

View File

@ -791,3 +791,29 @@ class Chat:
self.sent_history_pos[jid] = self.sent_history_pos[jid] + 1
conv_buf.set_text(self.sent_history[jid][self.sent_history_pos[jid]])
def repaint_colored_widgets(self):
"""Repaint widgets (banner) in the window/tab with theme color"""
# get the bg color of the bar from the current theme colors
bgcolor = gajim.config.get('accountbgcolor')
# iterate through tabs/windows and repaint
for jid in self.xmls:
if self.widget_name == 'tabbed_chat_window':
banner_status_eventbox = self.xmls[jid].get_widget(
'banner_status_eventbox')
banner_status_eventbox.modify_bg(gtk.STATE_NORMAL,
gtk.gdk.color_parse(bgcolor))
banner_name_eventbox = self.xmls[jid].get_widget(
'banner_name_eventbox')
banner_name_eventbox.modify_bg(gtk.STATE_NORMAL,
gtk.gdk.color_parse(bgcolor))
banner_avatar_eventbox = self.xmls[jid].get_widget(
'banner_avatar_eventbox')
banner_avatar_eventbox.modify_bg(gtk.STATE_NORMAL,
gtk.gdk.color_parse(bgcolor))
elif self.widget_name == 'groupchat_window':
banner_name_eventbox = self.xmls[jid].get_widget(
'banner_name_eventbox')
banner_name_eventbox.modify_bg(gtk.STATE_NORMAL,
gtk.gdk.color_parse(bgcolor))

View File

@ -44,8 +44,8 @@ class Groupchat_window(chat.Chat):
self.nicks = {}
self.list_treeview = {}
self.subjects = {}
self.subject_entry = {}
self.subject_entry_tooltip = {}
self.name_labels = {}
# self.subject_entry_tooltip = {}
self.room_creation = {}
self.nick_hits = {}
self.last_key_tabs = {}
@ -122,9 +122,9 @@ class Groupchat_window(chat.Chat):
new_jid = jid
break
subject = self.subjects[new_jid]
subject_entry = self.subject_entry[new_jid]
subject_entry.set_text(subject)
self.subject_entry_tooltip[new_jid].set_tip(subject_entry, subject)
name_label = self.name_labels[new_jid]
name_label.set_markup('<span weight="heavy" size="x-large">%s</span>\n%s' % (new_jid, subject))
# self.subject_entry_tooltip[new_jid].set_tip(subject_entry, subject)
chat.Chat.on_chat_notebook_switch_page(self, notebook, page, page_num)
def get_role_iter(self, room_jid, role):
@ -280,13 +280,15 @@ class Groupchat_window(chat.Chat):
def set_subject(self, room_jid, subject):
self.subjects[room_jid] = subject
subject_entry = self.subject_entry[room_jid]
subject_entry.set_text(subject)
self.subject_entry_tooltip[room_jid].set_tip(subject_entry, subject)
name_label = self.name_labels[room_jid]
name_label.set_markup('<span weight="heavy" size="x-large">%s</span>\n%s' % (room_jid, subject))
#self.subject_entry_tooltip[room_jid].set_tip(subject_entry, subject)
def on_change_subject_menuitem_activate(self, widget):
room_jid = self.get_active_jid()
subject = self.subject_entry[room_jid].get_text()
# I don't know how this works with markup... Let's find out!
label_text = self.name_labels[room_jid].get_text() # whole text (including JID)
subject = label_text[label_text.find('\n') + 1:] # just the text after the newline *shrug*
instance = dialogs.Input_dialog('Changing the Subject',
'Please specify the new subject:', subject)
response = instance.dialog.run()
@ -608,6 +610,7 @@ class Groupchat_window(chat.Chat):
del self.nicks[room_jid]
del self.list_treeview[room_jid]
del self.subjects[room_jid]
del self.name_labels[room_jid]
def new_room(self, room_jid, nick):
self.names[room_jid] = room_jid.split('@')[0]
@ -623,9 +626,18 @@ class Groupchat_window(chat.Chat):
'list_treeview')
conversation_textview = self.xmls[room_jid].get_widget(
'conversation_textview')
self.subject_entry[room_jid] = self.xmls[room_jid].get_widget(
'subject_entry')
self.subject_entry_tooltip[room_jid] = gtk.Tooltips()
self.name_labels[room_jid] = self.xmls[room_jid].get_widget(
'banner_name_label')
# set the fg colour of the label to white
self.name_labels[room_jid].modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse('white'))
banner_eventbox = self.xmls[room_jid].get_widget(
'banner_name_eventbox')
# get the background color from the current theme
bgcolor = gajim.config.get('accountbgcolor')
banner_eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor))
# self.subject_entry_tooltip[room_jid] = gtk.Tooltips()
#status_image, nickname, real_jid, show
store = gtk.TreeStore(gtk.Image, str, str, str)

View File

@ -8150,131 +8150,16 @@ Custom</property>
<child>
<widget class="GtkVBox" id="vbox73">
<property name="border_width">1</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<child>
<widget class="GtkMenuBar" id="gc_menubar">
<property name="visible">True</property>
<child>
<widget class="GtkMenuItem" id="actions_menuitem">
<property name="visible">True</property>
<property name="label" translatable="yes">_Actions</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="actions_menuitem_menu">
<child>
<widget class="GtkImageMenuItem" id="change_subject_menuitem">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Click to change the subject of the room</property>
<property name="label" translatable="yes">Change _Subject</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_change_subject_menuitem_activate" last_modification_time="Sat, 14 May 2005 00:15:15 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image607">
<property name="visible">True</property>
<property name="stock">gtk-edit</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="configure_room_menuitem">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Click to configure the room options</property>
<property name="label" translatable="yes">Configure _Room</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_configure_room_menuitem_activate" last_modification_time="Fri, 13 May 2005 22:47:03 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image608">
<property name="visible">True</property>
<property name="stock">gtk-preferences</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="add_bookmark_menuitem">
<property name="visible">True</property>
<property name="label" translatable="yes">Add _Bookmark</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_add_bookmark_menuitem_activate" last_modification_time="Tue, 07 Jun 2005 15:11:32 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image609">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separator6">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="close_window">
<property name="visible">True</property>
<property name="label" translatable="yes">Close _Window</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_close_window_activate" last_modification_time="Sat, 14 May 2005 01:19:18 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image610">
<property name="visible">True</property>
<property name="stock">gtk-close</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkNotebook" id="chat_notebook">
<property name="visible">True</property>
<property name="show_tabs">False</property>
<property name="show_border">False</property>
<property name="show_border">True</property>
<property name="tab_pos">GTK_POS_TOP</property>
<property name="scrollable">True</property>
<property name="enable_popup">True</property>
@ -8287,6 +8172,36 @@ Custom</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkEventBox" id="banner_name_eventbox">
<property name="visible">True</property>
<property name="visible_window">True</property>
<property name="above_child">False</property>
<child>
<widget class="GtkLabel" id="banner_name_label">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;span weight=&quot;heavy&quot; size=&quot;large&quot;&gt;Room: name@jabber.org&lt;/span&gt;
This is the subject.</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.0500000007451</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">6</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">3</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHPaned" id="hpaned">
<property name="visible">True</property>
@ -8300,59 +8215,6 @@ Custom</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<child>
<widget class="GtkHBox" id="hbox36">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<child>
<widget class="GtkLabel" id="label139">
<property name="visible">True</property>
<property name="label" translatable="yes">Subject:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="subject_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkVPaned" id="vpaned">
<property name="visible">True</property>
@ -8370,6 +8232,7 @@ Custom</property>
<child>
<widget class="GtkTextView" id="conversation_textview">
<property name="border_width">3</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
@ -8410,6 +8273,7 @@ Custom</property>
<child>
<widget class="GtkTextView" id="message_textview">
<property name="border_width">3</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
@ -8459,6 +8323,7 @@ Custom</property>
<child>
<widget class="GtkTreeView" id="list_treeview">
<property name="border_width">3</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">False</property>
@ -8485,6 +8350,342 @@ Custom</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox2972">
<property name="border_width">2</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkToolbar" id="input_toolbar">
<property name="visible">True</property>
<property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
<property name="toolbar_style">GTK_TOOLBAR_ICONS</property>
<property name="tooltips">True</property>
<property name="show_arrow">True</property>
<child>
<widget class="GtkSeparatorToolItem" id="separatortoolitem2">
<property name="visible">True</property>
<property name="draw">True</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child>
<child>
<widget class="GtkToggleToolButton" id="bold_toolbutton">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Bold</property>
<property name="stock_id">gtk-bold</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<property name="active">False</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkToggleToolButton" id="italic_toolbutton">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Italics</property>
<property name="stock_id">gtk-italic</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<property name="active">False</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkToggleToolButton" id="underline_toolbutton">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Underline</property>
<property name="stock_id">gtk-underline</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<property name="active">False</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox2973">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkButton" id="actions_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<child>
<widget class="GtkAlignment" id="alignment76">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox2976">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image660">
<property name="visible">True</property>
<property name="stock">gtk-preferences</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label330">
<property name="visible">True</property>
<property name="label" translatable="yes">_Actions</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="history_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<child>
<widget class="GtkAlignment" id="alignment75">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox2975">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image659">
<property name="visible">True</property>
<property name="stock">gtk-justify-fill</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label329">
<property name="visible">True</property>
<property name="label" translatable="yes">_History</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkVSeparator" id="vseparator2">
<property name="visible">True</property>
</widget>
<packing>
<property name="padding">2</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="send_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<child>
<widget class="GtkAlignment" id="alignment74">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox2974">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image658">
<property name="visible">True</property>
<property name="stock">gtk-jump-to</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label328">
<property name="visible">True</property>
<property name="label" translatable="yes">_Send</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="tab_expand">False</property>
@ -9684,6 +9885,7 @@ JID: whatever@jabber.org</property>
<child>
<widget class="GtkToggleToolButton" id="bold_toobutton">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Bold</property>
<property name="stock_id">gtk-bold</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
@ -9699,6 +9901,7 @@ JID: whatever@jabber.org</property>
<child>
<widget class="GtkToggleToolButton" id="italic_toolbutton">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Italics</property>
<property name="stock_id">gtk-italic</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
@ -9714,6 +9917,7 @@ JID: whatever@jabber.org</property>
<child>
<widget class="GtkToggleToolButton" id="underline_toolbutton">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Underine</property>
<property name="stock_id">gtk-underline</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>

View File

@ -1348,6 +1348,8 @@ class Roster_window:
# Update opened chat windows/tabs
for jid in self.plugin.windows[account]['chats']:
self.plugin.windows[account]['chats'][jid].repaint_colored_widgets()
for jid in self.plugin.windows[account]['gc']:
self.plugin.windows[account]['gc'][jid].repaint_colored_widgets()
def on_show_offline_contacts_menuitem_activate(self, widget):
'''when show offline option is changed:

View File

@ -181,20 +181,6 @@ class Tabbed_chat_window(chat.Chat):
banner_status_image.set_from_pixbuf(scaled_pix)
status_image.set_from_pixbuf(pix)
def repaint_colored_widgets(self):
"""Repaint widgets (banner) in the window/tab with theme color"""
# get the bg color of the bar from the current theme colors
bgcolor = gajim.config.get('accountbgcolor')
# iterate through tabs/windows and repaint
for jid in self.xmls:
banner_status_eventbox = self.xmls[jid].get_widget('banner_status_eventbox')
banner_status_eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor))
banner_name_eventbox = self.xmls[jid].get_widget('banner_name_eventbox')
banner_name_eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor))
banner_avatar_eventbox = self.xmls[jid].get_widget('banner_avatar_eventbox')
banner_avatar_eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor))
def on_tabbed_chat_window_delete_event(self, widget, event):
"""close window"""
for jid in self.users: