Input dialog to accept entry text as optional argument and to display it if given [using that in change subject

This commit is contained in:
Nikos Kouremenos 2005-05-14 16:34:07 +00:00
parent ec5effc66b
commit d8e0b91ee8
2 changed files with 8 additions and 4 deletions

View File

@ -419,13 +419,16 @@ class Information_dialog:
class Input_dialog: class Input_dialog:
'''Class for Input dialog''' '''Class for Input dialog'''
def __init__(self, title, label_str): def __init__(self, title, label_str, input_str = None):
xml = gtk.glade.XML(GTKGUI_GLADE, 'input_dialog', APP) xml = gtk.glade.XML(GTKGUI_GLADE, 'input_dialog', APP)
self.dialog = xml.get_widget('input_dialog') self.dialog = xml.get_widget('input_dialog')
label = xml.get_widget('label') label = xml.get_widget('label')
self.input_entry = xml.get_widget('input_entry') self.input_entry = xml.get_widget('input_entry')
self.dialog.set_title(title) self.dialog.set_title(title)
label.set_text(label_str) label.set_text(label_str)
if input_str:
self.input_entry.set_text(input_str)
class Error_dialog: class Error_dialog:
'''Class for error dialog''' '''Class for error dialog'''

View File

@ -82,7 +82,7 @@ class Groupchat_window(chat.Chat):
self.set_subject(jid, var['subject']) self.set_subject(jid, var['subject'])
def on_close_window_activate(self, widget): def on_close_window_activate(self, widget):
if self.on_groupchat_window_delete_event(widget, None) != True: if not self.on_groupchat_window_delete_event(widget, None):
self.window.destroy() self.window.destroy()
def on_groupchat_window_delete_event(self, widget, event): def on_groupchat_window_delete_event(self, widget, event):
@ -267,8 +267,9 @@ class Groupchat_window(chat.Chat):
def on_change_subject_menuitem_activate(self, widget): def on_change_subject_menuitem_activate(self, widget):
room_jid = self.get_active_jid() room_jid = self.get_active_jid()
subject = self.subject_entry[room_jid].get_text()
instance = dialogs.Input_dialog('Changing the Subject', instance = dialogs.Input_dialog('Changing the Subject',
'Please specify the new subject:') 'Please specify the new subject:', subject)
response = instance.dialog.run() response = instance.dialog.run()
instance.dialog.destroy() instance.dialog.destroy()
if response == gtk.RESPONSE_OK: if response == gtk.RESPONSE_OK:
@ -547,7 +548,7 @@ class Groupchat_window(chat.Chat):
self.redraw_tab(room_jid) self.redraw_tab(room_jid)
self.show_title() self.show_title()
conversation_textview.grab_focus() # remove focus from subject entry conversation_textview.grab_focus()
def on_list_treeview_button_press_event(self, widget, event): def on_list_treeview_button_press_event(self, widget, event):
"""popup user's group's or agent menu""" """popup user's group's or agent menu"""