예제 #1
0
    def __init__(self, manager, parent):
        self._parent = parent
        builder = Gtk.Builder()
        builder.add_from_file(find_resource('ui', 'ResourceMonitor.glade'))
        builder.connect_signals(self)
        self.window = builder.get_object('ResourceMonitor')
        icon_file = find_resource('images', 'f5-notifier.svg')
        if icon_file:
            self.window.set_icon_from_file(icon_file)
        self.add_button = builder.get_object('add_button')
        self.edit_button = builder.get_object('edit_button')
        self.remove_button = builder.get_object('remove_button')
        self.open_button = builder.get_object('open_button')
        self.start_button = builder.get_object('start_button')
        self.stop_button = builder.get_object('stop_button')
        self.resource_selection = builder.get_object('resource_selection')
        self.resources_list = builder.get_object('resources_list')

        manager.connect('added', self._on_resource__added)
        manager.connect('edited', self._on_resource__edited)
        manager.connect('removed', self._on_resource__removed)
        manager.connect('started', self._on_resource__started)
        manager.connect('stopped', self._on_resource__stopped)
        manager.connect('resource-checked', self._on_resource__checked)
        self._manager = manager

        self._update_widgets()
        self._load_data()
예제 #2
0
 def __init__(self, manager, parent, resource=None):
     self._resource = resource
     builder = Gtk.Builder()
     builder.add_from_file(find_resource('ui', 'Resource.glade'))
     builder.connect_signals(self)
     self.window = builder.get_object('Resource')
     icon_file = find_resource('images', 'f5-notifier.svg')
     if icon_file:
         self.window.set_icon_from_file(icon_file)
     self.uri_entry = builder.get_object('uri_entry')
     self.unit_combo = builder.get_object('unit_combo')
     self.interval = builder.get_object('interval')
     self.add_button = builder.get_object('add_button')
     self.interval_adjustment = builder.get_object('interval_adjustment')
     self.interval.set_value(5)
     self._manager = manager
     self._setup_widgets()
     self._update_widgets()
예제 #3
0
    def _build_menu(self):
        menu = Gtk.Menu()
        add_resource = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_ADD, None)
        add_resource.set_always_show_image(True)
        menu.append(add_resource)
        add_resource.connect('activate', self._on_add_resource__activated)
        add_resource.show()

        image_path = find_resource('images', 'f5notifier.svg')
        if image_path:
            monitor_image = Gtk.Image.new_from_file(image_path)
            monitor = Gtk.ImageMenuItem.new_with_label(_(u'Monitor'))
            monitor.set_image(monitor_image)
            monitor.set_always_show_image(True)
            menu.append(monitor)
            monitor.connect('activate', self._on_monitor__activated)
            monitor.show()

        sep1 = Gtk.SeparatorMenuItem()
        menu.append(sep1)
        sep1.show()

        settings = Gtk.ImageMenuItem.new_from_stock(
                                            Gtk.STOCK_PREFERENCES, None)
        settings.set_always_show_image(True)
        menu.append(settings)
        settings.connect('activate', self._on_settings__activated)
        settings.show()

        sep2 = Gtk.SeparatorMenuItem()
        menu.append(sep2)
        sep2.show()

        about = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_ABOUT, None)
        about.set_always_show_image(True)
        menu.append(about)
        about.connect('activate', self._on_about__activated)
        about.show()

        quit = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_QUIT, None)
        quit.set_always_show_image(True)
        quit.connect('activate', self._on_quit__activated)
        quit.show()

        menu.append(quit)
        return menu
예제 #4
0
    def __init__(self, manager, parent, settings):
        self._settings = settings
        builder = Gtk.Builder()
        builder.add_from_file(find_resource('ui', 'Settings.glade'))
        builder.connect_signals(self)
        self.window = builder.get_object('Settings')
        self.notification = builder.get_object('notification_switch')
        self.extra_filechooser = builder.get_object(
                                            'extra_settings_filechooser')
        self.extra_settings = builder.get_object('extra_settings_switch')

        self.notification.set_active(
                self._settings.get_value('DISABLE_NOTIFICATION'))
        self.extra_settings.set_active(
                self._settings.get_value('EXTRA_SETTINGS'))
        self.extra_filechooser.set_sensitive(self.extra_settings.get_active())
        self.extra_filechooser.select_filename(
                self._settings.get_value('EXTRA_SETTINGS_DIR'))
예제 #5
0
def get_about_dialog(manager, parent):
    logo = Gtk.Image()
    icon_path = find_resource('images', 'f5notifier.svg')
    if icon_path:
        logo.set_from_file(icon_path)
    else:
        logo = None

    dialog = Gtk.AboutDialog(program_name=f5notifier.PROGRAM_NAME,
                             version=f5notifier.VERSION,
                             copyright=f5notifier.COPYRIGHT,
                             website=f5notifier.WEBSITE,
                             website_label=_(u'F5 Notifier Homepage'),
                             license_type=Gtk.License.GPL_3_0,
                             authors=f5notifier.AUTHORS,
                             flags=Gtk.DialogFlags.DESTROY_WITH_PARENT,
                             parent=parent)
    dialog.set_transient_for(parent)
    if icon_path:
        dialog.set_icon_from_file(icon_path)
    if logo:
        dialog.set_logo(logo.get_pixbuf())

    return dialog