Example #1
0
    def test_connect_alias(self):
        app = App2()
        Builder.auto_connect_by_name(app, self.builder)

        window = self.builder.get_object('window')
        window.emit('show')
        self.assertEqual(app.messages, ['called by alias'])
Example #2
0
    def test_connect_alias(self):
        app = App2()
        Builder.auto_connect_by_name(app, self.builder)

        window = self.builder.get_object('window')
        window.emit('show')
        self.assertEqual(app.messages, ['called by alias'])
Example #3
0
    def test_connect_auto(self):
        app = App()
        Builder.auto_connect_by_name(app, self.builder)

        # glade does not have on_window_show
        window = self.builder.get_object('window')
        window.emit('show')
        self.assertEqual(app.messages, ['on_window_show'])
Example #4
0
    def test_connect_auto(self):
        app = App()
        Builder.auto_connect_by_name(app, self.builder)

        # glade does not have on_window_show
        window = self.builder.get_object('window')
        window.emit('show')
        self.assertEqual(app.messages, ['on_window_show'])
Example #5
0
 def setUp(self):
     self.builder = Builder.Builder()
     self.builder.add_from_file(
         os.path.join(os.path.dirname(__file__), 'test.ui'))
     self.widget_keys = [
         '1wind-o w/3', 'filefilter', 'label', 'wind?o-w two',
         'wind_o_w_two', 'window'
     ]  # sorted list
Example #6
0
    def test_alias(self):
        app = App()
        dict_callback_obj = Builder.dict_from_callback_obj(app)
        expected = app.on_mnu_foo_activated

        for name in ['on_mnu_foo_activated',
                     'on_tool_foo_activated', 
                     'on_btn_foo_clicked']:
            self.assertEqual(dict_callback_obj[name] , expected)
Example #7
0
 def test_dictionary_access_to_callback_obj(self):
     app = App()
     dict_callback_obj = Builder.dict_from_callback_obj(app)
     actual = dict_callback_obj.keys()
     actual.sort()
     expected = ['__init__', 'asterix', 'cartoon','doraemon',
      'mickey mouse', 'miffy', 'on_btn_foo_clicked', 'on_label_show',
      'on_mnu_foo_activated', 'on_tool_foo_activated', 'on_window_show',
      'window_show_cb']
     self.assertEqual(actual, expected)
Example #8
0
    def test_alias(self):
        app = App()
        dict_callback_obj = Builder.dict_from_callback_obj(app)
        expected = app.on_mnu_foo_activated

        for name in [
                'on_mnu_foo_activated', 'on_tool_foo_activated',
                'on_btn_foo_clicked'
        ]:
            self.assertEqual(dict_callback_obj[name], expected)
Example #9
0
 def test_dictionary_access_to_callback_obj(self):
     app = App()
     dict_callback_obj = Builder.dict_from_callback_obj(app)
     actual = dict_callback_obj.keys()
     actual.sort()
     expected = [
         '__init__', 'asterix', 'cartoon', 'doraemon', 'mickey mouse',
         'miffy', 'on_btn_foo_clicked', 'on_label_show',
         'on_mnu_foo_activated', 'on_tool_foo_activated', 'on_window_show',
         'window_show_cb'
     ]
     self.assertEqual(actual, expected)