69
70
seahorse = ooldtp.context(self.name)
72
mnu_new_key = seahorse.getchild(self.MNU_NEWKEY)
73
except ldtp.LdtpExecutionError:
74
raise ldtp.LdtpExecutionError, "The new key menu was not found."
77
mnu_new_key.selectmenuitem()
78
except ldtp.LdtpExecutionError:
79
raise ldtp.LdtpExecutionError, "There was a problem when selecting new key menu item."
82
ldtp.waittillguiexist(self.NEWKEY_DLG)
83
dlg_new_key = ooldtp.context(self.NEWKEY_DLG)
84
except ldtp.LdtpExecutionError:
85
raise ldtp.LdtpExecutionError, "The new key dialog was not found."
88
table = dlg_new_key.getchild(role = 'table')
89
types_table = table[0]
91
for i in range(0, types_table.getrowcount(), 1):
92
text = types_table.getcellvalue(i, 1)
93
candidate = text.split('\n')[0]
94
if candidate == key_type:
95
types_table.selectrowindex(i)
98
except ldtp.LdtpExecutionError:
99
raise ldtp.LdtpExecutionError, "Error getting the key types table."
102
btn_continue = dlg_new_key.getchild(self.BTN_CONTINUE)
103
except ldtp.LdtpExecutionError:
104
raise ldtp.LdtpExecutionError, "The continue button at the new key dialog was not found."
108
except ldtp.LdtpExecutionError:
109
raise ldtp.LdtpExecutionError, "There was a problem when clicking the continue button."
72
mnu_new_key = seahorse.getchild(self.MNU_NEWKEY)
73
mnu_new_key.selectmenuitem()
75
ldtp.waittillguiexist(self.NEWKEY_DLG)
76
dlg_new_key = ooldtp.context(self.NEWKEY_DLG)
78
table = dlg_new_key.getchild(role = 'table')
79
types_table = table[0]
81
for i in range(0, types_table.getrowcount(), 1):
82
text = types_table.getcellvalue(i, 1)
83
candidate = text.split('\n')[0]
84
if candidate == key_type:
85
types_table.selectrowindex(i)
89
btn_continue = dlg_new_key.getchild(self.BTN_CONTINUE)
111
93
def new_pgp_key(self, full_name, email, comment, passphrase):
131
113
self.new_key(self.TYPE_PGP)
134
ldtp.waittillguiexist(self.NEWPGP_DLG)
135
dlg_new_pgp = ooldtp.context(self.NEWPGP_DLG)
136
except ldtp.LdtpExecutionError:
137
raise ldtp.LdtpExecutionError, "The new key dialog was not found."
140
txt_field = dlg_new_pgp.getchild(self.DLG_NEWPGP_FULLNAME)
141
except ldtp.LdtpExecutionError:
142
raise ldtp.LdtpExecutionError, "The " + txt_field + " text field was not found."
144
txt_field.settextvalue(full_name)
145
except ldtp.LdtpExecutionError:
146
raise ldtp.LdtpExecutionError, "There was an error when writing the text."
149
txt_field = dlg_new_pgp.getchild(self.DLG_NEWPGP_EMAIL)
150
except ldtp.LdtpExecutionError:
151
raise ldtp.LdtpExecutionError, "The " + txt_field + " text field was not found."
153
txt_field.settextvalue(email)
154
except ldtp.LdtpExecutionError:
155
raise ldtp.LdtpExecutionError, "There was a problem when writing the text."
115
ldtp.waittillguiexist(self.NEWPGP_DLG)
116
dlg_new_pgp = ooldtp.context(self.NEWPGP_DLG)
118
txt_field = dlg_new_pgp.getchild(self.DLG_NEWPGP_FULLNAME)
119
txt_field.settextvalue(full_name)
121
txt_field = dlg_new_pgp.getchild(self.DLG_NEWPGP_EMAIL)
122
txt_field.settextvalue(email)
158
txt_field = dlg_new_pgp.getchild(self.DLG_NEWPGP_COMMENT)
159
except ldtp.LdtpExecutionError:
160
raise ldtp.LdtpExecutionError, "The " + txt_field + " text field was not found."
162
txt_field.settextvalue(comment)
163
except ldtp.LdtpExecutionError:
164
raise ldtp.LdtpExecutionError, "There was a problem when writing the text."
167
btn_create = dlg_new_pgp.getchild(self.BTN_NEWPGP_CREATE)
168
except ldtp.LdtpExecutionError:
169
raise ldtp.LdtpExecutionError, "The create button at the new PGP key dialog was not found."
173
except ldtp.LdtpExecutionError:
174
raise ldtp.LdtpExecutionError, "There was a problem when clicking the create button."
124
txt_field = dlg_new_pgp.getchild(self.DLG_NEWPGP_COMMENT)
125
txt_field.settextvalue(comment)
127
btn_create = dlg_new_pgp.getchild(self.BTN_NEWPGP_CREATE)
177
ldtp.waittillguiexist(self.DLG_NEWKEY_PASS)
178
dlg_new_pgp_pass = ooldtp.context(self.DLG_NEWKEY_PASS)
179
except ldtp.LdtpExecutionError:
180
raise ldtp.LdtpExecutionError, "The new pgp key passphrase dialog was not found."
183
ldtp.enterstring(passphrase)
184
ldtp.enterstring("<tab>")
185
ldtp.enterstring(passphrase)
186
except ldtp.LdtpExecutionError:
187
raise ldtp.LdtpExecutionError, "Error entering passphrase."
190
btn_pass_ok = dlg_new_pgp_pass.getchild(self.BTN_PASS_OK)
191
except ldtp.LdtpExecutionError:
192
raise ldtp.LdtpExecutionError, "The OK button at the new PGP key passphrase dialog was not found."
196
except ldtp.LdtpExecutionError:
197
raise ldtp.LdtpExecutionError, "There was a problem when clicking the OK button."
200
ldtp.waittillguiexist(self.DLG_GENERATING_KEY)
201
while ldtp.guiexist(self.DLG_GENERATING_KEY) == 1:
203
except ldtp.LdtpExecutionError:
204
raise ldtp.LdtpExecutionError, "The new pgp generating key dialog was not found."
130
ldtp.waittillguiexist(self.DLG_NEWKEY_PASS)
131
dlg_new_pgp_pass = ooldtp.context(self.DLG_NEWKEY_PASS)
133
# Entering the passphrase
134
ldtp.enterstring(passphrase)
135
ldtp.enterstring("<tab>")
136
ldtp.enterstring(passphrase)
138
btn_pass_ok = dlg_new_pgp_pass.getchild(self.BTN_PASS_OK)
142
ldtp.waittillguiexist(self.DLG_GENERATING_KEY)
143
while ldtp.guiexist(self.DLG_GENERATING_KEY) == 1:
206
146
# Add key name to generated key list, so we know to delete it later.
207
147
self.generated_keys.append(' '.join([full_name, email, "'"+comment+"'"]))
231
171
self.new_key(self.TYPE_SSH)
234
ldtp.waittillguiexist(self.NEWSSH_DLG)
235
dlg_new_ssh = ooldtp.context(self.NEWSSH_DLG)
236
except ldtp.LdtpExecutionError:
237
raise ldtp.LdtpExecutionError, "The new key dialog was not found."
173
ldtp.waittillguiexist(self.NEWSSH_DLG)
174
dlg_new_ssh = ooldtp.context(self.NEWSSH_DLG)
240
txt_field = dlg_new_ssh.getchild(self.DLG_NEWSSH_DESC)
241
except ldtp.LdtpExecutionError:
242
raise ldtp.LdtpExecutionError, "The " + self.DLG_NEWSSH_DESC + " text field was not found."
244
txt_field.settextvalue(description)
245
except ldtp.LdtpExecutionError:
246
raise ldtp.LdtpExecutionError, "There was an error when writing the text."
176
txt_field = dlg_new_ssh.getchild(self.DLG_NEWSSH_DESC)
177
txt_field.settextvalue(description)
248
179
if set_up == True:
250
btn_create = dlg_new_ssh.getchild(self.BTN_NEWSSH_CREATE_AND_SETUP)
251
except ldtp.LdtpExecutionError:
252
raise ldtp.LdtpExecutionError, "The create button at the new PGP key dialog was not found."
180
btn_create = dlg_new_ssh.getchild(self.BTN_NEWSSH_CREATE_AND_SETUP)
256
btn_create = dlg_new_ssh.getchild(self.BTN_NEWSSH_CREATE)
257
except ldtp.LdtpExecutionError:
258
raise ldtp.LdtpExecutionError, "The create button at the new PGP key dialog was not found."
182
btn_create = dlg_new_ssh.getchild(self.BTN_NEWSSH_CREATE)
262
except ldtp.LdtpExecutionError:
263
raise ldtp.LdtpExecutionError, "There was a problem when clicking the create button."
267
ldtp.waittillguiexist(self.DLG_NEWKEY_PASS)
268
dlg_new_key_pass = ooldtp.context(self.DLG_NEWKEY_PASS)
269
except ldtp.LdtpExecutionError:
270
raise ldtp.LdtpExecutionError, "The new key passphrase dialog was not found."
187
ldtp.waittillguiexist(self.DLG_NEWKEY_PASS)
188
dlg_new_key_pass = ooldtp.context(self.DLG_NEWKEY_PASS)
273
ldtp.enterstring(passphrase)
274
ldtp.enterstring("<tab>")
275
ldtp.enterstring(passphrase)
276
except ldtp.LdtpExecutionError:
277
raise ldtp.LdtpExecutionError, "Error entering passphrase."
190
# Entering the passphrase
191
ldtp.enterstring(passphrase)
192
ldtp.enterstring("<tab>")
193
ldtp.enterstring(passphrase)
280
btn_pass_ok = dlg_new_key_pass.getchild(self.BTN_PASS_OK)
281
except ldtp.LdtpExecutionError:
282
raise ldtp.LdtpExecutionError, "The OK button at the new key passphrase dialog was not found."
286
except ldtp.LdtpExecutionError:
287
raise ldtp.LdtpExecutionError, "There was a problem when clicking the OK button."
195
btn_pass_ok = dlg_new_key_pass.getchild(self.BTN_PASS_OK)
289
198
if set_up == True and login is not None:
292
ldtp.waittillguiexist(self.DLG_SET_UP)
293
dlg_set_up_computer = ooldtp.context(self.DLG_SET_UP)
294
except ldtp.LdtpExecutionError:
295
raise ldtp.LdtpExecutionError, "The set up computer dialog was not found."
200
ldtp.waittillguiexist(self.DLG_SET_UP)
201
dlg_set_up_computer = ooldtp.context(self.DLG_SET_UP)
298
txt_field = dlg_set_up_computer.getchild(self.TXT_SET_UP_LOGIN)
299
except ldtp.LdtpExecutionError:
300
raise ldtp.LdtpExecutionError, "The " + self.TXT_SET_UP_LOGIN + " text field was not found."
302
txt_field.settextvalue(login)
303
except ldtp.LdtpExecutionError:
304
raise ldtp.LdtpExecutionError, "There was an error when writing the text."
203
txt_field = dlg_set_up_computer.getchild(self.TXT_SET_UP_LOGIN)
204
txt_field.settextvalue(login)
306
206
if set_up == True:
308
txt_field = dlg_set_up_computer.getchild(self.TXT_SET_UP_COMPUTER)
309
except ldtp.LdtpExecutionError:
310
raise ldtp.LdtpExecutionError, "The " + self.TXT_SET_UP_COMPUTER + " text field was not found."
312
txt_field.settextvalue(computer)
313
except ldtp.LdtpExecutionError:
314
raise ldtp.LdtpExecutionError, "There was an error when writing the text."
317
btn_set_up = dlg_set_up_computer.getchild(self.BTN_SET_UP)
318
except ldtp.LdtpExecutionError:
319
raise ldtp.LdtpExecutionError, "The set up button was not found."
323
except ldtp.LdtpExecutionError:
324
raise ldtp.LdtpExecutionError, "There was a problem when clicking the set up button."
327
while ldtp.guiexist(self.DLG_CREATING_SSH) == 1:
330
except ldtp.LdtpExecutionError:
331
raise ldtp.LdtpExecutionError, "The creating key dialog was not found."
207
txt_field = dlg_set_up_computer.getchild(self.TXT_SET_UP_COMPUTER)
208
txt_field.settextvalue(computer)
210
btn_set_up = dlg_set_up_computer.getchild(self.BTN_SET_UP)
213
while ldtp.guiexist(self.DLG_CREATING_SSH) == 1:
332
216
# Add key name to generated key list, so we know to delete it later.
333
217
self.generated_keys.append(description)