~nimit-svnit/gtg/cleanup-new

« back to all changes in this revision

Viewing changes to GTG/plugins/export/export.py

  • Committer: nimit-svnit
  • Date: 2012-08-14 07:29:06 UTC
  • mfrom: (1220.1.6 trunk)
  • Revision ID: nimit.svnit@gmail.com-20120814072906-rz5ulshb6gh5c095
Added the latest code from the trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
87
87
    DEFAULT_PREFERENCES = {
88
88
        "menu_entry": True,
89
89
        "toolbar_entry": True,
 
90
        "last_template": None,
90
91
    }
91
92
 
92
93
    def __init__(self):
263
264
        model.clear()
264
265
 
265
266
        templates = get_templates_paths()
266
 
        for path in templates:
 
267
        active_entry = None
 
268
        for i, path in enumerate(templates):
267
269
            template = Template(path)
 
270
            if path == self.preferences["last_template"]:
 
271
                active_entry = i
 
272
 
268
273
            model.append((path,
269
274
                template.get_title(),
270
275
                template.get_description(),
273
278
        # wrap the combo-box if it's too long
274
279
        if len(templates) > 15:
275
280
            self.combo.set_wrap_width(5)
276
 
        self.combo.set_active(0)
 
281
 
 
282
        if active_entry is None:
 
283
            active_entry = 0
 
284
        self.combo.set_active(active_entry)
277
285
 
278
286
    def on_combo_changed(self, combo):
279
287
        """ Display details about the selected template """
293
301
            self.export_image.clear()
294
302
        self.description_label.set_markup("<i>%s</i>" % description)
295
303
 
 
304
        # Remember the last selected path
 
305
        self.preferences["last_template"] = model[active][0]
 
306
        self._preferences_store()
 
307
 
296
308
    def show_error_dialog(self, message):
297
309
        """ Display an error """
298
310
        dialog = gtk.MessageDialog(