开发者

how to create windows 7 jump lists via python/pyqt?

i have a pyqt project which i'm interested in using to play around with the new windows 7 jump list feature. after a bunch of searching, i have not found any specific examples of anyone creating jumplists via python.

has anyone开发者_JAVA技巧 here found an easy way to hook into this? does mark hammond's pywin32 module have an appropriate wrapper?

thanks!


I don't think Qt supports jump lists, you can find a bit more info here

Qt 4.6 added support for windows 7 and it was released today but I don't think they added this specific feature and I don't think PyQt supports this release.


There is a Qt add-on that implements all the Windows 7 taskbar extensions. It is called Q7Goodies. Although, it is a C++ library, I suggest contacting the authors, maybe they provide a PyQt bindings too.


Ah well after 12 years Imma answer this XD. There is an add-on introduced in Qt 5.2 named "QtWinExtras/Windows Extras". As explained by the docs:

Qt Windows Extras provide classes and functions that enable you to use miscellaneous Windows-specific functions. For example, you can convert Qt objects to Windows object handles and manipulate DWM glass frames.

In addition, you can use features introduced with Windows 7, such as Aero Peek, Jump Lists, a progress indicator on a taskbar button, or a thumbnail toolbar.

You can check the code bellow as an example:

import sys

from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel
from PyQt5.QtWinExtras import QWinJumpList, QWinJumpListItem


class Form(QMainWindow):
    def __init__(self):
        super().__init__()
        self.init_ui()

    def init_ui(self):
        self.resize(350, 150)
        self.setWindowTitle("Windows Jump Lists")
        label = QLabel("Right click the taskbar button")
        label.resize(label.sizeHint())
        label.setAlignment(Qt.AlignCenter)
        self.setCentralWidget(label)
        jump_list = QWinJumpList()
        tasks = jump_list.tasks()
        taskmgr = QWinJumpListItem(QWinJumpListItem.Link)
        taskmgr.setTitle("Open Task Manager")
        taskmgr.setFilePath("C:\\Windows\\system32\\taskmgr.exe")
        tasks.addItem(taskmgr)
        tasks.setVisible(True)  # Necessary
        self.show()


app = QApplication(sys.argv)
form = Form()
sys.exit(app.exec_())

You can check some examples here. For more information you can check the official documentation

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜