Esempio n. 1
0
 def setUp(self):
     self.a1 = BlahModel()
     self.a2 = BlahModel()
     self.s1 = '/tmp/_banana1'
     self.s2 = '/tmp/_banana2'
     load_model_from_ini(self.s1, self.a1)
     load_model_from_ini(self.s2, self.a2)
     self.o = IniFileObserver()
     self.o.add_model(self.a1)
     self.o.add_model(self.a2)
Esempio n. 2
0
 def setUp(self):
     self.a1 = BlahModel()
     self.a2 = BlahModel()
     self.s1 = '/tmp/_banana1'
     self.s2 = '/tmp/_banana2'
     load_model_from_ini(self.s1, self.a1)
     load_model_from_ini(self.s2, self.a2)
     self.o = IniFileObserver()
     self.o.add_model(self.a1)
     self.o.add_model(self.a2)
Esempio n. 3
0
 def __init__(self, *a, **kw):
     super(PropertyPage, self).__init__(*a, **kw)
     mg = ModelGroup()
     self.mo = mg.create_multi_observer(TreeObserver)
     self.mo.set_parent_page(self)
     rootp = '/tmp/address_a-%s'
     self.a1 = Address()
     self.a2 = Address()
     self.a3 = Address()
     for i, a in enumerate([self.a1, self.a2, self.a3]):
         load_model_from_ini(rootp % i, a)
         mg.add_model(a)
     self.p = mg.create_multi_observer(IniFileObserver)
     self.o = mg.create_single_observer(ElementObserver)
     self.o.set_parent_page(self)
     self.o.setup_with_model(Address())
Esempio n. 4
0
                    % (mu, escape(self.source__vc_name),
                           escape(self.source__directory)))
        return mu

Project = Model.__model_from_definition__(ProjectDefinition)

if __name__ == '__main__':

    mg = ModelGroup()
    tv = mg.create_multi_observer(TreeObserver)
    pp = mg.create_single_observer(PropertyPage)
    ini = mg.create_multi_observer(IniFileObserver)

    for n in ['Tom', 'Dick', 'Harry']:
        m = Project()
        m = load_model_from_ini('/tmp/foo_model%s2' % n, m)
        m.general__name = n
        mg.add_model(m)

    m = Project()
    load_model_from_ini('/home/ali/tmp/food', m)
    mg.add_model(m)

    # pack the tree and the property page
    b = gtk.HPaned()
    b.pack1(tv)
    b.pack2(pp)
    b.set_position(200)

    # put them in a window for good measure
    w = gtk.Window()
Esempio n. 5
0
 def test_b_no_save_fget(self):
     a1 = BlahModel()
     load_model_from_ini(self.s1, a1)
     self.assertEqual(self.a1.meh__blah, a1.meh__blah)
     self.assertNotEqual(100, a1.meh__blah)
Esempio n. 6
0
 def test_a_save(self):
     self.a1.meh__foo = '100'
     a1 = BlahModel()
     load_model_from_ini(self.s1, a1)
     self.assertEqual(self.a1.meh__foo, a1.meh__foo)
Esempio n. 7
0
 def test_b_no_save_fget(self):
     self.a1.meh__blah = '100'
     a1 = BlahModel()
     load_model_from_ini(self.s1, a1)
     self.assertEqual(self.a1.meh__blah, a1.meh__blah)
     self.assertNotEqual(100, a1.meh__blah)
Esempio n. 8
0
 def test_a_save(self):
     self.a1.meh__foo = '100'
     a1 = BlahModel()
     load_model_from_ini(self.s1, a1)
     self.assertEqual(self.a1.meh__foo, a1.meh__foo)
Esempio n. 9
0
                      self.source__vc_name), escape(self.source__directory)))
        return mu


Project = Model.__model_from_definition__(ProjectDefinition)

if __name__ == '__main__':

    mg = ModelGroup()
    tv = mg.create_multi_observer(TreeObserver)
    pp = mg.create_single_observer(PropertyPage)
    ini = mg.create_multi_observer(IniFileObserver)

    for n in ['Tom', 'Dick', 'Harry']:
        m = Project()
        m = load_model_from_ini('/tmp/foo_model%s2' % n, m)
        m.general__name = n
        mg.add_model(m)

    m = Project()
    load_model_from_ini('/home/ali/tmp/food', m)
    mg.add_model(m)

    # pack the tree and the property page
    b = gtk.HPaned()
    b.pack1(tv)
    b.pack2(pp)
    b.set_position(200)

    # put them in a window for good measure
    w = gtk.Window()