[Users] Help with Python compose_any script
berndth at gmx.de
Thu Jul 10 21:27:28 CEST 2014
On Do, 10.07.2014 13:39, Barry Warsaw wrote:
>Does it involve
>calling clawsmail.compose_window.get_account_selection() and then Doing
>Something with that via Gtk?
yes, you're on the right track.
The plugin doesn't provide account selection. It does however provide
access to the GTK+ combo box selection widget, so what you can do is
access the widget, iterate over the entries, search the one you want,
and when you found the correct entry, select it:
account_combo = clawsmail.compose_window.get_account_selection()
for row in account_combo.get_model():
if "MyAccountName" in row:
This obviously relies on Claws Mail internals (that the widget is a
GtkComboBox, that the underlying model has a string of the display in
the first column of that model, ...), and thus you are not guaranteed
that it will work forever.
Also, I just saw that due to some Claws Mail internal widget
reorganization, the get_account_selection() function couldn't find the
combo widget anymore, and always returned None. So, for the above to
work, you will need to build from current git.
More information about the Users