예제 #1
0
class TestStore(Gtk.ListStore):
    def __init__(self):
        Gtk.ListStore.__init__(self, str, int, bool)
        self.test_group = TestGroup()

    def reload(self):
        self.clear()
        for url, p, e in self.test_group.items():
            self.append([url, p, e])

    def modify(self, path, text):
        old_url, p, e = self[int(path)]
        self[int(path)][0] = text
        self.test_group.modify(int(path), text, e)

    def save_state(self, fn):
        with open(fn, "wb") as f:
            pickle.dump(self.test_group, f)

    def load_state(self, fn):
        with open(fn, "rb") as f:
            self.test_group = pickle.load(fn)
        self.reload()
예제 #2
0
 def __init__(self):
     Gtk.ListStore.__init__(self, str, int, bool)
     self.test_group = TestGroup()