fixes in dkirovs commit about autoresize of msg textview

This commit is contained in:
Nikos Kouremenos 2005-07-25 14:56:48 +00:00
parent dcfdc006e0
commit 71a7f32032
2 changed files with 24 additions and 24 deletions

View File

@ -345,7 +345,7 @@ class Chat:
del self.tagStatus[jid] del self.tagStatus[jid]
self.show_title() self.show_title()
def size_request(self, a, b, xml_top, message_scrollwindow): def size_request(self, a, b, xml_top, message_scrolledwindow):
''' When message_textview changes its size. If the new height ''' When message_textview changes its size. If the new height
will enlarge the window, enable the scrollbar automatic policy''' will enlarge the window, enable the scrollbar automatic policy'''
message_textview = xml_top.get_widget('message_textview') message_textview = xml_top.get_widget('message_textview')
@ -360,7 +360,7 @@ class Chat:
if not actions_hbox: if not actions_hbox:
actions_hbox = xml_top.get_widget('gc_actions_hbox') actions_hbox = xml_top.get_widget('gc_actions_hbox')
x1 = conversation_scrolledwindow.get_property("height-request") x1 = conversation_scrolledwindow.get_property('height-request')
x2 = b.height x2 = b.height
x3 = vpaned.window.get_size()[1] x3 = vpaned.window.get_size()[1]
x4 = banner_eventbox.size_request()[1] x4 = banner_eventbox.size_request()[1]
@ -369,13 +369,13 @@ class Chat:
if not self.compact_view_current_state: if not self.compact_view_current_state:
add_length += x4 + x5 add_length += x4 + x5
if x2 + x1 + add_length > x3: if x2 + x1 + add_length > x3:
message_scrollwindow.set_property('vscrollbar-policy', gtk.POLICY_AUTOMATIC) message_scrolledwindow.set_property('vscrollbar-policy', gtk.POLICY_AUTOMATIC)
message_scrollwindow.set_property('hscrollbar-policy', gtk.POLICY_AUTOMATIC) message_scrolledwindow.set_property('hscrollbar-policy', gtk.POLICY_AUTOMATIC)
message_scrollwindow.set_property('height-request',x3 - x1 - add_length) message_scrolledwindow.set_property('height-request', x3 - x1 - add_length)
else: else:
message_scrollwindow.set_property('vscrollbar-policy', gtk.POLICY_NEVER) message_scrolledwindow.set_property('vscrollbar-policy', gtk.POLICY_NEVER)
message_scrollwindow.set_property('hscrollbar-policy', gtk.POLICY_NEVER) message_scrolledwindow.set_property('hscrollbar-policy', gtk.POLICY_NEVER)
message_scrollwindow.set_property('height-request',-1) message_scrolledwindow.set_property('height-request', -1)
return True return True
def new_tab(self, jid): def new_tab(self, jid):
@ -463,12 +463,12 @@ class Chat:
tab_hbox = xm.get_widget('chat_tab_hbox') tab_hbox = xm.get_widget('chat_tab_hbox')
user = self.contacts[jid] user = self.contacts[jid]
message_textview = self.xmls[jid].get_widget('message_textview') message_textview = self.xmls[jid].get_widget('message_textview')
message_scrollwindow = self.xmls[jid].get_widget('scrolledwindow31') message_scrolledwindow = self.xmls[jid].get_widget('message_scrolledwindow')
elif self.widget_name == 'groupchat_window': elif self.widget_name == 'groupchat_window':
xm = gtk.glade.XML(GTKGUI_GLADE, 'groupchat_tab_hbox', APP) xm = gtk.glade.XML(GTKGUI_GLADE, 'groupchat_tab_hbox', APP)
tab_hbox = xm.get_widget('groupchat_tab_hbox') tab_hbox = xm.get_widget('groupchat_tab_hbox')
message_textview = self.xmls[jid].get_widget('message_textview') message_textview = self.xmls[jid].get_widget('message_textview')
message_scrollwindow = self.xmls[jid].get_widget('scrolledwindow19') message_scrolledwindow = self.xmls[jid].get_widget('message_scrolledwindow')
xm.signal_connect('on_close_button_clicked', xm.signal_connect('on_close_button_clicked',
self.on_close_button_clicked, jid) self.on_close_button_clicked, jid)
@ -477,11 +477,11 @@ class Chat:
self.notebook.append_page(child, tab_hbox) self.notebook.append_page(child, tab_hbox)
message_textview.connect('size-request', self.size_request, message_textview.connect('size-request', self.size_request,
self.xmls[jid], message_scrollwindow) self.xmls[jid], message_scrolledwindow)
message_scrollwindow.set_property('height-request', -1) message_scrolledwindow.set_property('height-request', -1)
message_scrollwindow.set_property('hscrollbar-policy', gtk.POLICY_NEVER) message_scrolledwindow.set_property('hscrollbar-policy', gtk.POLICY_NEVER)
message_scrollwindow.set_property('vscrollbar-policy', gtk.POLICY_NEVER) message_scrolledwindow.set_property('vscrollbar-policy', gtk.POLICY_NEVER)
#init new sent history for this conversation #init new sent history for this conversation
self.sent_history[jid] = [] self.sent_history[jid] = []
self.sent_history_pos[jid] = 0 self.sent_history_pos[jid] = 0

View File

@ -8607,7 +8607,7 @@ Custom</property>
</child> </child>
<child> <child>
<widget class="GtkScrolledWindow" id="scrolledwindow19"> <widget class="GtkScrolledWindow" id="message_scrolledwindow">
<property name="height_request">45</property> <property name="height_request">45</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
@ -8627,11 +8627,11 @@ Custom</property>
<property name="justification">GTK_JUSTIFY_LEFT</property> <property name="justification">GTK_JUSTIFY_LEFT</property>
<property name="wrap_mode">GTK_WRAP_WORD</property> <property name="wrap_mode">GTK_WRAP_WORD</property>
<property name="cursor_visible">True</property> <property name="cursor_visible">True</property>
<property name="pixels_above_lines">0</property> <property name="pixels_above_lines">2</property>
<property name="pixels_below_lines">0</property> <property name="pixels_below_lines">2</property>
<property name="pixels_inside_wrap">0</property> <property name="pixels_inside_wrap">0</property>
<property name="left_margin">1</property> <property name="left_margin">2</property>
<property name="right_margin">1</property> <property name="right_margin">2</property>
<property name="indent">0</property> <property name="indent">0</property>
<property name="text" translatable="yes"></property> <property name="text" translatable="yes"></property>
<signal name="key_press_event" handler="on_message_textview_key_press_event" last_modification_time="Sat, 05 Mar 2005 00:31:14 GMT"/> <signal name="key_press_event" handler="on_message_textview_key_press_event" last_modification_time="Sat, 05 Mar 2005 00:31:14 GMT"/>
@ -10119,7 +10119,7 @@ Status message</property>
<property name="spacing">0</property> <property name="spacing">0</property>
<child> <child>
<widget class="GtkScrolledWindow" id="scrolledwindow31"> <widget class="GtkScrolledWindow" id="message_scrolledwindow">
<property name="border_width">3</property> <property name="border_width">3</property>
<property name="height_request">53</property> <property name="height_request">53</property>
<property name="visible">True</property> <property name="visible">True</property>
@ -10140,11 +10140,11 @@ Status message</property>
<property name="justification">GTK_JUSTIFY_LEFT</property> <property name="justification">GTK_JUSTIFY_LEFT</property>
<property name="wrap_mode">GTK_WRAP_WORD</property> <property name="wrap_mode">GTK_WRAP_WORD</property>
<property name="cursor_visible">True</property> <property name="cursor_visible">True</property>
<property name="pixels_above_lines">0</property> <property name="pixels_above_lines">2</property>
<property name="pixels_below_lines">0</property> <property name="pixels_below_lines">2</property>
<property name="pixels_inside_wrap">0</property> <property name="pixels_inside_wrap">0</property>
<property name="left_margin">1</property> <property name="left_margin">2</property>
<property name="right_margin">1</property> <property name="right_margin">2</property>
<property name="indent">0</property> <property name="indent">0</property>
<property name="text" translatable="yes"></property> <property name="text" translatable="yes"></property>
<signal name="key_press_event" handler="on_message_textview_key_press_event" last_modification_time="Wed, 02 Mar 2005 21:05:35 GMT"/> <signal name="key_press_event" handler="on_message_textview_key_press_event" last_modification_time="Wed, 02 Mar 2005 21:05:35 GMT"/>