コード例 #1
0
def createTrayIcon():
    g.trayIconMenu = QtWidgets.QMenu()

    def new_note():
        c = g.app.commanders()[0]
        c.k.simulateCommand('stickynote-new')

    g.trayIconMenu.addAction("New note", new_note)
    g.trayIcon = QtWidgets.QSystemTrayIcon()
    g.trayIcon.setContextMenu(g.trayIconMenu)
    g.trayIcon.setIcon(QtGui.QIcon(g.app.leoDir + "/Icons/leoapp32.png"))
    g.trayIcon.setVisible(True)
コード例 #2
0
def showColorNames(event=None):
    """Put up a dialog showing color names."""
    c = event.get('c')
    template = '''
        QComboBox {
            background-color: %s;
            selection-background-color: %s;
            selection-color: black;
        }'''
    ivar = 'leo_settings_color_picker'
    if getattr(c, ivar, None):
        g.es('The color picker already exists in the icon bar.')
    else:
        color_list: List[str] = []
        box = QtWidgets.QComboBox()

        def onActivated(n, *args, **keys):
            color = color_list[n]
            sheet = template % (color, color)
            box.setStyleSheet(sheet)
            g.es("copied to clipboard:", color)
            QtWidgets.QApplication.clipboard().setText(color)

        box.activated.connect(onActivated)
        color_db = leoColor.leo_color_database
        for key in sorted(color_db):
            if not key.startswith('grey'):  # Use gray, not grey.
                val = color_db.get(key)
                color = QtGui.QColor(val)
                color_list.append(val)
                pixmap = QtGui.QPixmap(40, 40)
                pixmap.fill(color)
                icon = QtGui.QIcon(pixmap)
                box.addItem(icon, key)

        c.frame.iconBar.addWidget(box)
        setattr(c, ivar, True)
        # Do this last, so errors don't prevent re-execution.
        g.es('created color picker in icon area')
コード例 #3
0
ファイル: xdb_pane.py プロジェクト: XCaminhante/leo-editor
 def get_icon(self, fn):
     """return the icon from Icons/debug_icons"""
     path = g.os_path_finalize_join(
         g.app.loadDir, '..', 'Icons', 'debug_icons', fn)
     return QtGui.QIcon(g.app.gui.getImageImage(path))
コード例 #4
0
def decorate_window(w):
    w.setStyleSheet(stickynote_stylesheet)
    w.setWindowIcon(QtGui.QIcon(g.app.leoDir + "/Icons/leoapp32.png"))
    w.resize(600, 300)