diff options
author | Denis Fomin <fominde@gmail.com> | 2010-09-30 11:22:45 +0400 |
---|---|---|
committer | Denis Fomin <fominde@gmail.com> | 2010-09-30 11:22:45 +0400 |
commit | d66fba1aecb398d0fc44c3225058cb9eb4163713 (patch) | |
tree | 1239b4adbe21fb0980dba4ed63ad82ab72fffa38 /set_location | |
parent | a733b9bcaa1e112407c10d1522c15763ce76fac2 (diff) |
set_location.fix #1
Diffstat (limited to 'set_location')
-rw-r--r-- | set_location/config_dialog.ui | 858 | ||||
-rw-r--r-- | set_location/set_location.py | 49 |
2 files changed, 517 insertions, 390 deletions
diff --git a/set_location/config_dialog.ui b/set_location/config_dialog.ui index 6c7b659..3570ebc 100644 --- a/set_location/config_dialog.ui +++ b/set_location/config_dialog.ui @@ -7,397 +7,477 @@ <object class="GtkHBox" id="hbox1"> <property name="visible">True</property> <child> - <object class="GtkTable" id="config_table"> + <object class="GtkVBox" id="vbox2"> <property name="visible">True</property> - <property name="border_width">6</property> - <property name="n_rows">16</property> - <property name="n_columns">2</property> - <property name="column_spacing">7</property> - <property name="row_spacing">5</property> - <child> - <object class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">alt:</property> - </object> - <packing> - <property name="x_options">GTK_FILL</property> - <property name="y_options">GTK_FILL</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label2"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">area:</property> - </object> - <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options">GTK_FILL</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label3"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">building:</property> - </object> - <packing> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options">GTK_FILL</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label4"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">country:</property> - </object> - <packing> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label5"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">countrycode:</property> - </object> - <packing> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label6"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">description:</property> - </object> - <packing> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label7"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">floor:</property> - </object> - <packing> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label8"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">locality:</property> - </object> - <packing> - <property name="top_attach">7</property> - <property name="bottom_attach">8</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label9"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">lat:</property> - </object> - <packing> - <property name="top_attach">8</property> - <property name="bottom_attach">9</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label10"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">lon:</property> - </object> - <packing> - <property name="top_attach">9</property> - <property name="bottom_attach">10</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label11"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">postalcode:</property> - </object> - <packing> - <property name="top_attach">10</property> - <property name="bottom_attach">11</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label12"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">region:</property> - </object> - <packing> - <property name="top_attach">11</property> - <property name="bottom_attach">12</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label13"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">room:</property> - </object> - <packing> - <property name="top_attach">12</property> - <property name="bottom_attach">13</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label14"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">street:</property> - </object> - <packing> - <property name="top_attach">13</property> - <property name="bottom_attach">14</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label15"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">text:</property> - </object> - <packing> - <property name="top_attach">14</property> - <property name="bottom_attach">15</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label16"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">uri:</property> - </object> - <packing> - <property name="top_attach">15</property> - <property name="bottom_attach">16</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="alt"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="area"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="building"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="country"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="countrycode"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="description"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="floor"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="locality"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">7</property> - <property name="bottom_attach">8</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="lat"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">8</property> - <property name="bottom_attach">9</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="lon"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">9</property> - <property name="bottom_attach">10</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="postalcode"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">10</property> - <property name="bottom_attach">11</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="region"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">11</property> - <property name="bottom_attach">12</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="room"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">12</property> - <property name="bottom_attach">13</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="street"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">13</property> - <property name="bottom_attach">14</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="text"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">14</property> - <property name="bottom_attach">15</property> - </packing> - </child> + <property name="orientation">vertical</property> <child> - <object class="GtkEntry" id="uri"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">15</property> - <property name="bottom_attach">16</property> + <object class="GtkHBox" id="hbox2"> + <property name="visible">True</property> + <child> + <object class="GtkLabel" id="preset"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Preset:</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="padding">7</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="preset_combobox"> + <property name="visible">True</property> + <signal name="changed" handler="on_preset_combobox_changed"/> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="preset_button"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="receives_default">True</property> + <property name="xalign">0</property> + <signal name="clicked" handler="on_preset_button_clicked"/> + <child> + <object class="GtkHBox" id="hbox3"> + <property name="visible">True</property> + <child> + <object class="GtkImage" id="image1"> + <property name="visible">True</property> + <property name="stock">gtk-save</property> + </object> + <packing> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label17"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Save preset</property> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="padding">7</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkTable" id="config_table"> + <property name="visible">True</property> + <property name="border_width">6</property> + <property name="n_rows">16</property> + <property name="n_columns">2</property> + <property name="column_spacing">7</property> + <property name="row_spacing">5</property> + <child> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">alt:</property> + </object> + <packing> + <property name="x_options">GTK_FILL</property> + <property name="y_options">GTK_FILL</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">area:</property> + </object> + <packing> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options">GTK_FILL</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">building:</property> + </object> + <packing> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options">GTK_FILL</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label4"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">country:</property> + </object> + <packing> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label5"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">countrycode:</property> + </object> + <packing> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label6"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">description:</property> + </object> + <packing> + <property name="top_attach">5</property> + <property name="bottom_attach">6</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label7"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">floor:</property> + </object> + <packing> + <property name="top_attach">6</property> + <property name="bottom_attach">7</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label8"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">locality:</property> + </object> + <packing> + <property name="top_attach">7</property> + <property name="bottom_attach">8</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label9"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">lat:</property> + </object> + <packing> + <property name="top_attach">8</property> + <property name="bottom_attach">9</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label10"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">lon:</property> + </object> + <packing> + <property name="top_attach">9</property> + <property name="bottom_attach">10</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label11"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">postalcode:</property> + </object> + <packing> + <property name="top_attach">10</property> + <property name="bottom_attach">11</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label12"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">region:</property> + </object> + <packing> + <property name="top_attach">11</property> + <property name="bottom_attach">12</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label13"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">room:</property> + </object> + <packing> + <property name="top_attach">12</property> + <property name="bottom_attach">13</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label14"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">street:</property> + </object> + <packing> + <property name="top_attach">13</property> + <property name="bottom_attach">14</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label15"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">text:</property> + </object> + <packing> + <property name="top_attach">14</property> + <property name="bottom_attach">15</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label16"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">uri:</property> + </object> + <packing> + <property name="top_attach">15</property> + <property name="bottom_attach">16</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="alt"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="area"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="building"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="country"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="countrycode"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="description"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">5</property> + <property name="bottom_attach">6</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="floor"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">6</property> + <property name="bottom_attach">7</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="locality"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">7</property> + <property name="bottom_attach">8</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="lat"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">8</property> + <property name="bottom_attach">9</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="lon"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">9</property> + <property name="bottom_attach">10</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="postalcode"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">10</property> + <property name="bottom_attach">11</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="region"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">11</property> + <property name="bottom_attach">12</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="room"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">12</property> + <property name="bottom_attach">13</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="street"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">13</property> + <property name="bottom_attach">14</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="text"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">14</property> + <property name="bottom_attach">15</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="uri"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">15</property> + <property name="bottom_attach">16</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> </packing> </child> </object> diff --git a/set_location/set_location.py b/set_location/set_location.py index ba0abf8..f8cc974 100644 --- a/set_location/set_location.py +++ b/set_location/set_location.py @@ -13,6 +13,7 @@ from plugins import GajimPlugin from plugins.helpers import log_calls, log from common import gajim import gtkgui_helpers +from dialogs import InputDialog locale_path = os.path.dirname(__file__) + '/locales' locale.bindtextdomain('setlocation', locale_path) @@ -42,7 +43,8 @@ class SetLocationPlugin(GajimPlugin): 'room' : ('Observatory', ''), 'street' : ('34th and Broadway', ''), 'text' : ('Northwest corner of the lobby', ''), - 'uri' : ('http://beta.plazes.com/plazes/1940:jabber_inc', ''),} + 'uri' : ('http://beta.plazes.com/plazes/1940:jabber_inc', ''), + 'presets': ({'default': {}}, ''),} @log_calls('SetLocationPlugin') def activate(self): @@ -81,10 +83,23 @@ class SetLocationPluginConfigDialog(GajimPluginConfigDialog): self.connect('hide', self.on_hide) self.is_active = None + self.preset_combo = self.xml.get_object('preset_combobox') + self.preset_liststore = gtk.ListStore(str) + self.preset_combo.set_model(self.preset_liststore) + cellrenderer = gtk.CellRendererText() + self.preset_combo.pack_start(cellrenderer, True) + self.preset_combo.add_attribute(cellrenderer, 'text', 0) + #self.plugin.config['presets'] = {'default': {}} + pres_keys = sorted(self.plugin.config['presets'].keys()) + for key in pres_keys: + self.preset_liststore.append((key,)) + def on_run(self): no_map = None for name in self.plugin.config_default_values: + if name == 'presets': + continue widget = self.xml.get_object(name) widget.set_text(str(self.plugin.config[name])) @@ -125,6 +140,8 @@ class SetLocationPluginConfigDialog(GajimPluginConfigDialog): def on_hide(self, widget): for name in self.plugin.config_default_values: + if name == 'presets': + continue widget = self.xml.get_object(name) self.plugin.config[name] = widget.get_text() self.plugin.activate() @@ -178,3 +195,33 @@ class SetLocationPluginConfigDialog(GajimPluginConfigDialog): for image in self.images: self.osm.image_remove(image) self.images = [] + + def on_preset_button_clicked(self, widget): + def on_ok(preset_name): + if preset_name == '': + return + preset = {} + for name in self.plugin.config_default_values: + if name == 'presets': + continue + widget = self.xml.get_object(name) + preset[name] = widget.get_text() + preset = {preset_name: preset} + presets = dict(self.plugin.config['presets'].items() + \ + preset.items()) + self.plugin.config['presets'] = presets + iter_ = self.preset_liststore.append((preset_name,)) + self.preset_combo.set_active_iter(iter_) + self.set_modal(False) + InputDialog(_('Save as Preset'), _('Please type a name for this preset'), + is_modal=True, ok_handler=on_ok) + + def on_preset_combobox_changed(self, widget): + model = widget.get_model() + active = widget.get_active() + if active < 0: + return + pres_name = model[active][0].decode('utf-8') + for name in self.plugin.config['presets'][pres_name].keys(): + widget = self.xml.get_object(name) + widget.set_text(str(self.plugin.config['presets'][pres_name][name])) |