标签: appindicator

向AppIndicator添加滑块(Ubuntu 11.04)

我正在尝试向AppIndicator添加一个类似于Sound Menu的滑块.

我查看了声音菜单的代码,发现我应该使用libido-0.1.

这是我到目前为止所拥有的:

indicator_menu = gtk_menu_new();
ido_slider_widget = ido_scale_menu_item_new_with_range("BRIGHTNESS", IDO_RANGE_STYLE_DEFAULT,  0, 0, 100, 1);
ido_scale_menu_item_set_primary_label(IDO_SCALE_MENU_ITEM(ido_slider_widget), "BRIGHTNESS");
ido_scale_menu_item_set_style(IDO_SCALE_MENU_ITEM(ido_slider_widget), IDO_SCALE_MENU_ITEM_STYLE_LABEL);
ido_scale_menu_item_set_primary_label(IDO_SCALE_MENU_ITEM(ido_slider_widget), " - ");
ido_scale_menu_item_set_secondary_label(IDO_SCALE_MENU_ITEM(ido_slider_widget), " + ");

GtkMenuItem *menu_slider_item = GTK_MENU_ITEM(ido_slider_widget);

gtk_menu_append(indicator_menu, GTK_WIDGET(menu_slider_item));
gtk_menu_append(indicator_menu, gtk_menu_item_new_with_label("dfdsfds"));

gtk_widget_show_all(indicator_menu);
gtk_widget_show_all(ido_slider_widget);

app_indicator_set_menu(indicator, GTK_MENU(indicator_menu));
Run Code Online (Sandbox Code Playgroud)

我看到的只是菜单中的' - '符号,我该如何解决这个问题?

gtk appindicator

21
推荐指数
1
解决办法
481
查看次数

Python AppIndicator绑定 - >如何检查菜单是否打开?

以下是AppIndicator的最小示例:

#!/usr/bin/python

import gobject
import gtk
import appindicator

if __name__ == "__main__":
    ind = appindicator.Indicator("example-simple-client", "gtk-execute", appindicator.CATEGORY_APPLICATION_STATUS)
    ind.set_status (appindicator.STATUS_ACTIVE)
    menu = gtk.Menu()
    menu_items = gtk.MenuItem('Quit')
    menu.append(menu_items)
    menu_items.connect("activate", gtk.main_quit)
    menu_items.show()
    ind.set_menu(menu)
    gtk.main()
Run Code Online (Sandbox Code Playgroud)

不幸的是,关于此的文档非常不完整.我正在寻找的是一种检查AppIndicator菜单是否由用户打开的方法(例如,点击了指示器图标).那么当菜单打开时会发出一个信号吗?

python pygtk appindicator ubuntu-unity

16
推荐指数
1
解决办法
2230
查看次数

QT Systray图标出现在Ubuntu上的启动器旁边而不是面板上

我是QT的新手,需要使用app-indicator构建应用程序.由于QT似乎比GTK +更容易,我在QT中制作它.

我会提到我已经安装了sni-qt,并且vlc和skype的app指示符在面板上显示正常.我在Ubuntu 13.04 64位上使用QT5.

我一步一步地遵循了本教程:http://qt-project.org/doc/qt-4.8/desktop-systray.html

但是当我运行它时,它出现的方式(十字架是我正在使用的图标):

http://i.stack.imgur.com/4bT33.png

我该如何解决?

ubuntu qt systray appindicator qt5

10
推荐指数
2
解决办法
3365
查看次数

将其他小部件放在gtk.Menu中

我希望能够在我的gtk.Menu中放置一个gtk.ProgressBar,但由于菜单只需要gtk.MenuItems及其子类,我所做的就是采用一个普通的gtk.MenuItem并尝试添加我的进度条作为一个孩子.由于gtk.MenuItem是gtk.Bin的子类,因此它应该能够容纳任何小部件.

例:

menu = gtk.Menu()

item = gtk.MenuItem()

button = gtk.ProgressBar()
button.pulse()
button.show()

item.add(button)
item.show()

menu.append(item)
Run Code Online (Sandbox Code Playgroud)

没有pygtk抱怨,这运行得很好.但是,我的进度条根本没有显示:

gtk.Menu的屏幕截图

如果我用gtk.Label替换进度条,它就显示得很好.

现在问我的问题:

  1. 我如何知道它将采用哪些小部件?
  2. 我怎么欺骗它让我把其他小部件放在那里?

python pygtk appindicator

8
推荐指数
2
解决办法
3668
查看次数

Ubuntu 13.10:没有模块命名appindicator

Ubuntu 13.10上没有Appindicator?

jason@jz:~$ python
Python 2.7.5+ (default, Sep 19 2013, 13:48:49) 
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import appindicator
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named appindicator
>>> 
Run Code Online (Sandbox Code Playgroud)

有替代品吗?或者我可以自己安装吗?

提前致谢.

python ubuntu appindicator

8
推荐指数
1
解决办法
7368
查看次数

Gtk 3,python,appindicator,禁用标签附近的图标

我在python中写openweathermap网站appindicator,但我只需要指针中没有图标的文字标签.但是当我离开""然后给我看空图标.为什么,我只需要文字.在Ubuntu 12.04中,python-appindicator不需要图标如果离开""然后不加载空图标,但在ubuntu 14.04中留下空图标.如何禁用图标?有任何想法吗?

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import urllib2
import json 
import time
import datetime

from gi.repository import Gtk, Gdk, GLib, GObject
from gi.repository import AppIndicator3 as appindicator

class programa:

    def __init__(self):
    # Create Indicator with icon and label
        # If leave empty "" then load empty icon
        self.ind = appindicator.Indicator.new("Weather","",appindicator.IndicatorCategory.APPLICATION_STATUS)
        self.ind.set_status(appindicator.IndicatorStatus.ACTIVE) # 
        self.menu_structure()

    # Menu structure
    def menu_structure(self):
        refresh      = 720 # Refresh interval in seconds
        url          = urllib2.Request('http://api.openweathermap.org/data/2.5/weather?q=siauliai&units=metric') 
        openup       = urllib2.urlopen(url) …
Run Code Online (Sandbox Code Playgroud)

python gtk gobject glib appindicator

6
推荐指数
1
解决办法
1934
查看次数

Python AppIndicator使tomate符合Unity标准

我刚刚发现了tomate:https://gitorious.org/tomate 一个非常简单的程序,可以帮助您在计算机上完成工作.

但是tomate使用gtk.status_icon而不是appindicator所以我想解决这个问题.

但是,我想与appindicator保持相同的行为.它很容易像这样使用,我不想创建菜单并使其使用复杂化.

简单的行为是当您单击图标时启动时间计数器,再次单击时停止它.

所以你不需要菜单.

是否可以在没有菜单的情况下使用appindicator,或者只接收点击并且没有任何项目的基本菜单?

谢谢你的帮助.

gtk pygtk appindicator

5
推荐指数
1
解决办法
1883
查看次数

如何创建显示快捷方式的gtk菜单项?

我正在尝试将 appindicator 与 gtk 菜单集成。我想要一些菜单项有这样的快捷方式:

在此处输入图片说明

不幸的是,在将加速器添加到第二个菜单项后,我仍然得到没有图标和快捷方式的项目。

在此处输入图片说明

我希望看到的是“item2”右侧的快捷方式。

int main (int argc, char **argv) {
  gtk_init(&argc, &argv);

  // main window
  GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title(GTK_WINDOW(window), "menu-with-shortcuts-window");
  gtk_window_set_icon_name(GTK_WINDOW(window), "menu-with-shortcuts-icon");
  g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL);

  gtk_widget_show_all(window);

  // indicator
  AppIndicator* indicator = app_indicator_new("menu-with-shortcuts-appindicator", "transmission-tray-icon", APP_INDICATOR_CATEGORY_APPLICATION_STATUS);

  // menu
  GtkWidget*  indicator_menu = gtk_menu_new();

  GtkWidget* item1 = gtk_menu_item_new_with_label("item1");
  gtk_menu_shell_append(GTK_MENU_SHELL(indicator_menu), item1);
  g_signal_connect(item1, "activate", G_CALLBACK(Item1Clicked), NULL);
  gtk_widget_show(item1);

  GtkAccelGroup* accel_group = gtk_accel_group_new();
  gtk_window_add_accel_group(GTK_WINDOW(window), accel_group);

  GtkWidget* item2 = gtk_image_menu_item_new_from_stock(GTK_STOCK_QUIT, accel_group);
  gtk_widget_add_accelerator(item2, "activate", accel_group, GDK_q, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); 
  gtk_menu_shell_append(GTK_MENU_SHELL(indicator_menu), item2);
  g_signal_connect(item2, "activate", G_CALLBACK(Item2Clicked), NULL); …
Run Code Online (Sandbox Code Playgroud)

c gtk appindicator ubuntu-unity

5
推荐指数
0
解决办法
649
查看次数

macOS 中的任何应用程序指示器替换

GTK2GtkStatusIcon中的 .GTK3 已弃用,大多数应用程序appindicator使用GtkStatusIcon. 但听起来这appindicator在 MacOS 中不可用,是否有任何库可以像GtkStatusIconMacOS 和 Linux 一样工作?谢谢。

gtk macos appindicator

5
推荐指数
0
解决办法
123
查看次数

有没有办法使用 PyGTK AppIndicator 检测鼠标点击

我有一个简单的 Python 代码,它使用GI的AppIndicator3创建一个 Linux 托盘指示器。效果很好。但我想检测并处理简单的用户单击或双击此托盘图标。

据我所知,例如,Telegram使用Qt 类QSystemTrayIcon,它支持此功能,因为当用户双击托盘图标时,Telegram 窗口会自动显示。

  • 我知道 AppIndicator3 支持scroll_event当用户在托盘图标上滚动鼠标滚轮时触发的信号。

AyatanaAppIndicator3.Indicator接收到滚动事件时发出信号。

设置menuitem为在图标/标签上发出辅助激活事件(即中键单击)时激活 AyatanaAppIndicator3.Indicator

有人了解它是如何工作的吗?前面的两个例子让我想知道为什么没有简单的鼠标单击信号/事件。我在想是否可以更深入,也许继承AyatanaAppIndicator3.Indicator类并重写一些事件处理?或者可能更深入地研究StatusNotifierItemActivate方法(如果这是 AppIndicator 实现的)?

或者有什么棘手的解决方法吗?因为这似乎是一个十多年来没有答案的问题,我不满足于仅仅“不可能”的答案。

我也知道我不是第一个问这个问题的人。我做了一些小研究,发现了多个相关线程:

Python AppIndicator 绑定 -> 如何检查菜单是否打开?
如何在单击应用程序指示器时运行操作
如何对一键指示器进行编程(添加中键单击功能)?
当菜单显示/隐藏时,指示器应用程序不发送信号处理
单击事件和修饰符

python linux gtk pygtk appindicator

5
推荐指数
1
解决办法
596
查看次数

标签 统计

appindicator ×10

gtk ×6

python ×5

pygtk ×4

ubuntu ×2

ubuntu-unity ×2

c ×1

glib ×1

gobject ×1

linux ×1

macos ×1

qt ×1

qt5 ×1

systray ×1