1 #!/usr/bin/env python2.5
2 # -*- coding: utf-8 -*-
5 Copyright (C) 2007 Christoph Würstle
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License version 2 as
9 published by the Free Software Foundation.
24 _moduleLogger = logging.getLogger(__name__)
27 class HistorySelectionDialog(gtk.Dialog):
29 def __init__(self, daten = None):
30 super(HistorySelectionDialog, self).__init__(
33 gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
34 (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT),
36 self.set_position(gtk.WIN_POS_CENTER)
38 self.noteHistory = gtk.ListStore(
46 self._historyView = gtk.TreeView(self.noteHistory)
47 self._historyView.set_rules_hint(True)
49 self._timestampCell = gtk.CellRendererText()
50 self._timestampColumn = gtk.TreeViewColumn(_('Timestamp'))
51 self._timestampColumn.pack_start(self._timestampCell, True)
52 self._timestampColumn.set_attributes(self._timestampCell, text = 1) #Spalten setzten hier!!!!
54 self._noteCell = gtk.CellRendererText()
55 self._noteColumn = gtk.TreeViewColumn(_('Note'))
56 self._noteColumn.pack_start(self._noteCell, True)
57 self._noteColumn.set_attributes(self._noteCell, text = 4)
59 # add columns to treeview
60 self._historyView.append_column(self._timestampColumn)
61 self._historyView.append_column(self._noteColumn)
62 self._historyView.set_reorderable(False)
64 scrolled_window = gtk.ScrolledWindow()
65 scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
66 scrolled_window.add(self._historyView)
67 self.vbox.pack_start(scrolled_window, expand = True, fill = True, padding = 0)
69 self.noteHistory.clear()
73 self.noteHistory.append(data)
75 def get_selected_row(self):
76 path = self._historyView.get_cursor()[0]
77 if path is None or path == "":
80 iter1 = self._historyView.get_model().get_iter(path)
81 return self._historyView.get_model().get(iter1, 0, 1, 2, 3, 4)