self.window.present() def add_simple_action(self, name, callback): action = Gio.SimpleAction.new(name, None) action.connect('activate', callback) self.add_action(action) def on_action_preferences_activated(self, action, user_data): self.main.populate_prefs() def on_action_about_activated(self, action, user_data): self.main.window_about.show() def on_action_quit_activated(self, action, user_data): notify.uninit() self.quit() if __name__ == '__main__': #~ indicator = appindicator.Indicator.new(APPINDICATOR_ID, 'gdcoker.svg', appindicator.IndicatorCategory.CATEGORY_APPLICATION_STATUS) indicator = appindicator.Indicator.new(APPINDICATOR_ID, './images/gdocker.png', appindicator.IndicatorCategory.SYSTEM_SERVICES) indicator.set_status(appindicator.IndicatorStatus.ACTIVE) indicator.set_attention_icon("new-messages-red") #test the user is in the docker group, bail if not or ignore if not linux test_in_group() notify.Notification.new('Dockyard', 'Dockyard applet launched', None).show() application = gtkApplication() application.run(sys.argv)
def test_user_in_group(self): self.assertTrue(utils.test_in_group()) with self.assertRaises(SystemExit) as sys_exit: utils.test_in_group('fake_docker_group') self.assertEqual(sys_exit.exception.code, 1)