Ejemplo n.º 1
0
    def test_invalid_icons(self):
        ''' Testing the failing to create a NotificationIcon instance '''

        # Failing to create a NotificationIcon
        self.assertRaises(TypeError, trayify.initialize)

        with self.assertRaises(trayify.InvalidUserInterfaceError) as cm:
            trayify.initialize('FooBarBaz')
        self.assertEqual(cm.exception.value,
                         'FooBarBaz is not a valid UI type')
        self.assertEqual(str(cm.exception),
                'InvalidUserInterfaceError: FooBarBaz is not a valid UI type')
Ejemplo n.º 2
0
    def test_invalid_icons(self):
        ''' Testing the failing to create a NotificationIcon instance '''

        # Failing to create a NotificationIcon
        self.assertRaises(TypeError, trayify.initialize)

        with self.assertRaises(trayify.InvalidUserInterfaceError) as cm:
            trayify.initialize('FooBarBaz')
        self.assertEqual(cm.exception.value,
                         'FooBarBaz is not a valid UI type')
        self.assertEqual(
            str(cm.exception),
            'InvalidUserInterfaceError: FooBarBaz is not a valid UI type')
Ejemplo n.º 3
0
    def test_qt_icons(self):
        ''' Testing the creation of the qt_icon.NotificationIcon instance '''

        # Creating a QT NotificationIcon
        icon = trayify.initialize('qt')
        self.assertIsInstance(icon, trayify.qt_icon.NotificationIcon,
                              'icon is not a qt_icon.NotificationIcon')
Ejemplo n.º 4
0
    def test_qt_icons(self):
        ''' Testing the creation of the qt_icon.NotificationIcon instance '''

        # Creating a QT NotificationIcon
        icon = trayify.initialize('qt')
        self.assertIsInstance(icon, trayify.qt_icon.NotificationIcon,
                              'icon is not a qt_icon.NotificationIcon')
Ejemplo n.º 5
0
 def test_gtk_has_menu(self):
     ''' Testing the menu-related operations of the gtk_icon.NotificationIcon instance '''
     # Creating a GTK NotificationIcon
     icon = trayify.initialize('gtk')
     self.assertIsInstance(icon, trayify.gtk_icon.NotificationIcon,
                           'icon is not a gtk_icon.NotificationIcon')
     icon.create_icon()
     self.assertFalse(icon.has_menu())
     icon.add_menu(["Menu Text"])
     self.assertTrue(icon.has_menu())
Ejemplo n.º 6
0
 def test_gtk_has_menu(self):
     ''' Testing the menu-related operations of the gtk_icon.NotificationIcon instance '''
     # Creating a GTK NotificationIcon
     icon = trayify.initialize('gtk')
     self.assertIsInstance(icon, trayify.gtk_icon.NotificationIcon,
                           'icon is not a gtk_icon.NotificationIcon')
     icon.create_icon()
     self.assertFalse(icon.has_menu())
     icon.add_menu(["Menu Text"])
     self.assertTrue(icon.has_menu())
Ejemplo n.º 7
0
    def __init__(self, uuid):
        self.uuid = uuid
        self.machine = vbox.findMachine(uuid)

        self.ico = trayify.initialize('gtk')
        self.ico.create_icon()

        self.state = "PoweredOff"
        self.update()

        gobject.timeout_add_seconds(30, self.update)
        self.ico.start()
Ejemplo n.º 8
0
    def test_appindicator_creation(self):
        ''' Testing the creation of the gtk_icon.NotificationIcon instance '''

        # Creating an AppIndicator NotificationIcon
        icon = trayify.initialize('appindicator')
        self.assertIsInstance(icon, trayify.gtk_icon.NotificationIcon,
                              'icon is not an appindicator_icon.NotificationIcon')
        icon.create_icon()
        inst_icon = icon.icon
        self.assertIsInstance(inst_icon, trayify.gtk_icon.appindicator.Indicator,
                              'real_icon is not an appindicator.Indicator')
        self.assertEqual(inst_icon.get_status(), appindicator.STATUS_ACTIVE,
                         'inst_icon is not active')
        self.assertEqual(inst_icon.get_id(), 'example-simple-client',
                         'inst_icon does not have the correct id')
Ejemplo n.º 9
0
    def test_gtk_creation(self):
        ''' Testing the creation of the gtk_icon.NotificationIcon instance '''

        # Creating a GTK NotificationIcon
        icon = trayify.initialize('gtk')
        self.assertIsInstance(icon, trayify.gtk_icon.NotificationIcon,
                              'icon is not a gtk_icon.NotificationIcon')
        icon.create_icon()
        inst_icon = icon.icon
        self.assertIsInstance(inst_icon, trayify.gtk_icon.gtk.StatusIcon,
                              'real_icon is not a gtk.StatusIcon')
        self.assertEqual(inst_icon.get_visible(), True,
                         'inst_icon is not visable')
        self.assertEqual(inst_icon.get_stock(),
                         trayify.gtk_icon.gtk.STOCK_ABOUT,
                         'inst_icon does not have the correct icon')
Ejemplo n.º 10
0
    def test_gtk_creation(self):
        ''' Testing the creation of the gtk_icon.NotificationIcon instance '''

        # Creating a GTK NotificationIcon
        icon = trayify.initialize('gtk')
        self.assertIsInstance(icon, trayify.gtk_icon.NotificationIcon,
                              'icon is not a gtk_icon.NotificationIcon')
        icon.create_icon()
        inst_icon = icon.icon
        self.assertIsInstance(inst_icon, trayify.gtk_icon.gtk.StatusIcon,
                              'real_icon is not a gtk.StatusIcon')
        self.assertEqual(inst_icon.get_visible(), True,
                         'inst_icon is not visable')
        self.assertEqual(inst_icon.get_stock(),
                         trayify.gtk_icon.gtk.STOCK_ABOUT,
                         'inst_icon does not have the correct icon')
Ejemplo n.º 11
0
    def test_appindicator_creation(self):
        ''' Testing the creation of the gtk_icon.NotificationIcon instance '''

        # Creating an AppIndicator NotificationIcon
        icon = trayify.initialize('appindicator')
        self.assertIsInstance(
            icon, trayify.gtk_icon.NotificationIcon,
            'icon is not an appindicator_icon.NotificationIcon')
        icon.create_icon()
        inst_icon = icon.icon
        self.assertIsInstance(inst_icon,
                              trayify.gtk_icon.appindicator.Indicator,
                              'real_icon is not an appindicator.Indicator')
        self.assertEqual(inst_icon.get_status(), appindicator.STATUS_ACTIVE,
                         'inst_icon is not active')
        self.assertEqual(inst_icon.get_id(), 'example-simple-client',
                         'inst_icon does not have the correct id')