custom libindicator icon is not displayed - python

I want to change the status icon of my own little reminder program. Currently I am using GTK.StatusIcon but I want to use a ApplicationIndicator.
Therefore I created an own Icon and moved it to:
/usr/share/icons/ubuntu-mono-dark/status/22
It is named indicator-notify.svg
Heres the code for the icon.
ind = appindicator.Indicator ("notify",
"indicator-notify",
appindicator.CATEGORY_APPLICATION_STATUS)
ind.set_status (appindicator.STATUS_ACTIVE)
This Icon is not displayed. Although every other icon from this folder is.
What did I miss? Is there maybe the need to "register" the icon in GTK ?

You don't need to register it, but your icon cache needs to be updated after installing new icons. You can do this via gtk-update-icon-cache (see http://developer.gnome.org/gtk/2.24/gtk-update-icon-cache.html)

Related

Open new window - tkinter/tk taskbar/dock

How can I can a function and create a function for the icon context menu? I want to make the iconic Open New Window function pop-up when you right click on the icon menu in the taskbar/dock. See this question for more info on this kind of question.
Places I have looked but found nothing:
https://www.tcl.tk/man/tcl8.5/TkCmd/tk_mac.html#M15
https://pyinstaller.org/en/stable/feature-notes.html#open-event-handling-in-a-tkinter-based-gui-application
While there are a tiny subset of apple events that you can benefit from the DockMenu is not accessible directly via tkinter. Turns out mac is not really open for modifications and even smaller tasks can be hard. You could consider to use a system tray icon instead.

Pyside: Updating icons when changing the themeSearchPaths()

I'm currently trying to enable switching the icon theme of an application during runtime.
The problem is that I just cant figure out how to trigger the objects to "refresh" their icons and pick them from the new QIcon.themeSearchPaths().
def change_icon(self):
style = QApplication.style()
if self.standart_icon_theme_active:
QIcon.setThemeSearchPaths([""]) # resetting to the 'default' folder
QIcon.setThemeName(u"")
else:
QIcon.setThemeSearchPaths(["icons/"]) # the folder with my icons
QIcon.setThemeName(u"icons")
for btn in self.bttns:
btn.setIcon(style.standardIcon(getattr(QStyle, btn.objectName()))) # <= im searching for a signal or something to replace this
self.standart_icon_theme_active = not self.standart_icon_theme_active
What I currently have is a little demo Window with a lot of buttons, (which got created with a list of names of icons, so that their name equals the icon they have) in which each icon of each button gets updated when change_icon() gets triggered, and i'm searching for something like a builtin signal which I can emit to let Pyside update each icon on its own, or something in that way.
Any help would be appreciated.

Run Python script with path as argument from total commander

I've got a script that accepts a path as an external argument and I would like to attach it to Total Commander.
So I need a script/plugin for TC that would pass a path of opened directory as an argument and run a Python script which is located for example at C:/Temp
How can I achieve this?
Best Regards,
Marek
Ok, I managed to do it. You don't quite have to pass a path as an argument.
You just need to add a quick button at the top of the TC.
As a Query just place python and location to Python script.
You can either pass any argument if you want (but in this case you don't need this).
As an initial path you set cm_AddPathToCmdline which returns a path to currently opened directory.
And that's it. :)
import os
os.makedirs("TEST")
You can add a new button to the button bar.
Right-click on an existing Icon and copy the icon by choosing "copy" from drop-down menu.
Paste it into the button bar by right-clicking on it, choosing "paste" from the menu.
Right-click on this copied icon and choose "modify" (or similar). This opens a window that allows you the choose a program and a parameter.
Note: My version is set to a different language so the names of the menu items might be a bit different.

Using PyWinAuto (or anything else) to interact with hidden icons on the taskbar

I am trying to find and click a hidden icon on the taskbar (shown by clicking the white triangle) in windows 7, using python. I've been trying to use pywinauto for this, but it doesn't seem to have the functionality to find and click one of these hidden icons. Even the taskbar module in pywinauto doesn't work (possibly due to being outdated). How can I do this?
The application I am trying to access for automation can only be shown by clicking on its hidden icon in the taskbar. By hidden icon, I mean in the notification area.
I've tried pywinauto.taskbar.SystemTrayIcons, but the DrawOutline method shows that this is the wrong area of the taskbar. And using taskbar.SystemTrayIcons.WrapperObject().Button(0) does not work anyway, but gives a GetButtonInfo failed exception.
I've also tried using SWAPY to create python code for finding and clicking the relevant buttons, and although it can click the button (helpfully named 'Button') to show the hidden icons, it does not show how to then click those icons.
Install latest version of pywinauto on 64-bit Python (2.7 or 3.4, it doesn't matter) and run the following code:
from pywinauto import taskbar
taskbar.TaskBar.Button.click_input()
popup_dlg = taskbar.explorer_app.window(class_name='NotifyIconOverflowWindow')
popup_toolbar = popup_dlg.Overflow_Notification_Area
print(popup_toolbar.texts()[1:])
Further you can press interested button based on retrieved texts:
popup_toolbar.button('your program name').click_input(double=True)
EDIT (2019, January): this code may not work for latest Windows 10 RS1+ because notification icons area was changed significantly, though it should work for Win7 and Win8.1.

How can I set an icon for a quickly application?

How can I set an applications image (icon) in my canonical-quickly project? Even if I set the icon path in Glade, the UI designer, my icon doesn't show up.
In the aplications bar of my desktop I only see a gear.
I used the following relative path in Glade:
../media/projectname.svg
It's been a while but anyway...
You should put it here:
YOUR_QUICKLY_PROJECT_FOLDER/data/media/YOU_PROJECT_NAME.svg
(.png/.jpg might work also, I am not sure)
And you don't need to set it anywhere in the programme.

Categories

Resources