change callback, widget and variable names for passphrase dialog in glade and in the code

This commit is contained in:
Yann Leboulanger 2005-03-02 10:46:12 +00:00
parent 8e0efb5061
commit 5bf6d6c0ef
2 changed files with 36 additions and 38 deletions

View File

@ -214,54 +214,52 @@ class passphrase_Window:
"""Class for Passphrase Window"""
def run(self):
"""Wait for Ok button to be pressed and return passphrase"""
rep = self.win.run()
rep = self.window.run()
if rep == gtk.RESPONSE_OK:
msg = self.entry.get_text()
passphrase = self.passphrase_entry.get_text()
else:
msg = -1
chk = self.xml.get_widget("save_checkbutton")
self.win.destroy()
return msg, chk.get_active()
passphrase = -1
save_passphrase_checkbutton = self.xml.\
get_widget('save_passphrase_checkbutton')
self.window.destroy()
return passphrase, save_passphrase_checkbutton.get_active()
def on_key_pressed(self, widget, event):
def on_passphrase_dialog_key_press_event(self, widget, event):
if event.keyval == gtk.keysyms.Return:
if self.autoconnect:
self.on_ok_clicked(widget)
self.on_ok_button_clicked(widget)
else:
self.win.response(gtk.RESPONSE_OK)
self.window.response(gtk.RESPONSE_OK)
def on_ok_clicked(self, widget):
def on_ok__button_clicked(self, widget):
if self.autoconnect:
self.msg = self.entry.get_text()
self.passphrase = self.passphrase_entry.get_text()
gtk.main_quit()
def on_cancel_clicked(self, widget):
def on_cancel__button_clicked(self, widget):
if self.autoconnect:
gtk.main_quit()
def get_pass(self):
self.autoconnect = 0
chk = self.xml.get_widget("save_checkbutton")
self.win.destroy()
return self.msg, chk.get_active()
save_passphrase_checkbutton = self.xml.\
get_widget('save_passphrase_checkbutton')
self.window.destroy()
return self.passphrase, save_passphrase_checkbutton.get_active()
def delete_event(self, widget=None):
def on_passphrase_dialog_destroy(self, widget=None):
"""close window"""
if self.autoconnect:
gtk.main_quit()
def __init__(self, txt, autoconnect=0):
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Passphrase', APP)
self.win = self.xml.get_widget("Passphrase")
self.entry = self.xml.get_widget("entry")
self.msg = -1
def __init__(self, text, autoconnect=0):
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'passphrase_dialog', APP)
self.window = self.xml.get_widget('passphrase_dialog')
self.passphrase_entry = self.xml.get_widget('passphrase_entry')
self.passphrase = -1
self.autoconnect = autoconnect
self.xml.get_widget("label").set_text(txt)
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
self.xml.signal_connect('on_ok_clicked', self.on_ok_clicked)
self.xml.signal_connect('on_cancel_clicked', self.on_cancel_clicked)
self.xml.signal_connect('on_Passphrase_key_press_event', \
self.on_key_pressed)
self.xml.get_widget('message_label').set_text(text)
self.xml.signal_autoconnect(self)
class choose_gpg_Window:
"""Class for Away Message Window"""

View File

@ -7694,7 +7694,7 @@ Custom</property>
</child>
</widget>
<widget class="GtkDialog" id="Passphrase">
<widget class="GtkDialog" id="passphrase_dialog">
<property name="visible">True</property>
<property name="title" translatable="yes">Passphrase</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
@ -7708,8 +7708,8 @@ Custom</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="has_separator">True</property>
<signal name="key_press_event" handler="on_Passphrase_key_press_event" last_modification_time="Thu, 07 Oct 2004 14:25:48 GMT"/>
<signal name="destroy" handler="gtk_widget_destroy" last_modification_time="Wed, 01 Dec 2004 23:47:26 GMT"/>
<signal name="key_press_event" handler="on_passphrase_dialog_key_press_event" last_modification_time="Wed, 02 Mar 2005 10:37:49 GMT"/>
<signal name="destroy" handler="on_passphrase_dialog_destroy" last_modification_time="Wed, 02 Mar 2005 10:36:32 GMT"/>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox4">
@ -7723,7 +7723,7 @@ Custom</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="cancelbutton1">
<widget class="GtkButton" id="cancel_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
@ -7732,12 +7732,12 @@ Custom</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-6</property>
<signal name="clicked" handler="on_cancel_clicked" last_modification_time="Wed, 01 Dec 2004 23:03:26 GMT"/>
<signal name="clicked" handler="on_cancel_button_clicked" last_modification_time="Wed, 02 Mar 2005 10:33:28 GMT"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="okbutton2">
<widget class="GtkButton" id="ok_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
@ -7747,7 +7747,7 @@ Custom</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-5</property>
<signal name="clicked" handler="on_ok_clicked" last_modification_time="Wed, 01 Dec 2004 22:45:10 GMT"/>
<signal name="clicked" handler="on_ok_button_clicked" last_modification_time="Wed, 02 Mar 2005 10:33:19 GMT"/>
</widget>
</child>
</widget>
@ -7766,9 +7766,9 @@ Custom</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="label">
<widget class="GtkLabel" id="message_label">
<property name="visible">True</property>
<property name="label" translatable="yes">Enter your passphrase</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@ -7787,7 +7787,7 @@ Custom</property>
</child>
<child>
<widget class="GtkEntry" id="entry">
<widget class="GtkEntry" id="passphrase_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
@ -7807,7 +7807,7 @@ Custom</property>
</child>
<child>
<widget class="GtkCheckButton" id="save_checkbutton">
<widget class="GtkCheckButton" id="save_passphrase_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Save password ?</property>