mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
first commit
This commit is contained in:
parent
caaa7cb1a1
commit
b174fce9de
4 changed files with 182 additions and 4 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import sys
|
||||
import os
|
||||
import requests
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
from app.vendor.Qt import QtCore, QtGui, QtWidgets
|
||||
from app import style
|
||||
from . import credentials, login_tools
|
||||
|
||||
|
|
@ -11,7 +11,7 @@ class Login_Dialog_ui(QtWidgets.QWidget):
|
|||
SIZE_W = 300
|
||||
SIZE_H = 230
|
||||
|
||||
loginSignal = QtCore.pyqtSignal(object, object, object)
|
||||
loginSignal = QtCore.Signal(object, object, object)
|
||||
_login_server_thread = None
|
||||
inputs = []
|
||||
buttons = []
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from http.server import BaseHTTPRequestHandler, HTTPServer
|
|||
from urllib import parse
|
||||
import webbrowser
|
||||
import functools
|
||||
from PyQt5 import QtCore
|
||||
from app.vendor.Qt import QtCore
|
||||
|
||||
# class LoginServerHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||
class LoginServerHandler(BaseHTTPRequestHandler):
|
||||
|
|
@ -82,7 +82,7 @@ class LoginServerThread(QtCore.QThread):
|
|||
'''Login server thread.'''
|
||||
|
||||
# Login signal.
|
||||
loginSignal = QtCore.pyqtSignal(object, object, object)
|
||||
loginSignal = QtCore.Signal(object, object, object)
|
||||
|
||||
|
||||
def start(self, url):
|
||||
|
|
|
|||
129
pype/ftrack/tray.py
Normal file
129
pype/ftrack/tray.py
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
import os
|
||||
import sys
|
||||
import textwrap
|
||||
from app.vendor.Qt import QtCore, QtGui, QtWidgets
|
||||
|
||||
menu_layout_dict = {'Ftrack': {
|
||||
'Avalon Core': [
|
||||
'Config core',
|
||||
'Create new project',
|
||||
None,
|
||||
'Save database',
|
||||
],
|
||||
'Avalon Users': [
|
||||
'Config User',
|
||||
'Cre&ate new user',
|
||||
],
|
||||
'Avalon Workfiles': [
|
||||
'Config Workfiles',
|
||||
],
|
||||
'Pyblish': [
|
||||
'Config Pyblish',
|
||||
'Create new micro-plugin',
|
||||
None,
|
||||
'Micro-plugins manager'
|
||||
],
|
||||
'Pipeline': [
|
||||
'Config pipeline',
|
||||
'Create new template',
|
||||
None,
|
||||
'Templates manager'
|
||||
],
|
||||
'CG-wire': [
|
||||
'Config CG-wire',
|
||||
None,
|
||||
'Pull database',
|
||||
'Push database'
|
||||
]
|
||||
},
|
||||
'Minimalize': "action",
|
||||
#'Close': "action"
|
||||
}
|
||||
# print(menu_layout_dict)
|
||||
class SystemTrayIcon(QtWidgets.QSystemTrayIcon):
|
||||
def __init__(self, icon, parent=None):
|
||||
QtWidgets.QSystemTrayIcon.__init__(self, icon, parent)
|
||||
self.tray = QtWidgets.QSystemTrayIcon(icon, parent)
|
||||
# print(tray)
|
||||
self.tray.setToolTip("Avalon Launcher")
|
||||
menu = QtWidgets.QMenu(parent)
|
||||
# self.menuBar()
|
||||
# self.main_layout = QtWidgets.QVBoxLayout(self.menu)
|
||||
# self.menu.setLayout(self.main_layout)
|
||||
# project_name_lbl = QtWidgets.QLabel('<b>Project Name</b>')
|
||||
# self.main_layout.addWidget(project_name_lbl)
|
||||
menu.setProperty('menu', 'on')
|
||||
label = QtWidgets.QLabel('Avalon', menu)
|
||||
menu.setStyleSheet(textwrap.dedent('''
|
||||
QWidget {
|
||||
background-color: #444444;
|
||||
color: #ffffff;
|
||||
}
|
||||
QLineEdit {
|
||||
background-color: white;
|
||||
}
|
||||
QLineEdit:no-text-inside-it {
|
||||
background-color: red;
|
||||
}
|
||||
QWidget[menu=on] {
|
||||
background-color: #333333;
|
||||
color: #ffffff;
|
||||
}
|
||||
'''
|
||||
)
|
||||
)
|
||||
for key, value in menu_layout_dict.items():
|
||||
if value == 'action':
|
||||
# menu = QtWidgets.QMenu(menu)
|
||||
# menu = QtWidgets.QMenu(menu)
|
||||
separator = menu.addSeparator()
|
||||
# spacer = QtWidgets.QWidget()
|
||||
menu.addAction(key)
|
||||
print(key, value)
|
||||
else:
|
||||
# menu = QtWidgets.QMenu(menu)
|
||||
avalon_plugins = menu.addMenu(key)
|
||||
avalon_plugins.setProperty('submenu', 'on')
|
||||
self.eventFilter(avalon_plugins, QtCore.QEvent.HoverMove)
|
||||
for skey, svalue in value.items():
|
||||
avalon_plugin = avalon_plugins.addMenu(skey)
|
||||
avalon_plugin.setProperty('submenu', 'on')
|
||||
# print(skey, svalue)
|
||||
# plugins_Menu = avalon_plugin.addMenu(skey)
|
||||
for action in svalue:
|
||||
if action == None:
|
||||
avalon_plugin.addSeparator()
|
||||
else:
|
||||
plugins_Action = avalon_plugin.addAction(action)
|
||||
menu.addMenu(avalon_plugins)
|
||||
exitAction = menu.addAction("Exit")
|
||||
self.eventFilter(exitAction, QtCore.QEvent.HoverMove)
|
||||
self.setContextMenu(menu)
|
||||
menu.triggered.connect(self.exit)
|
||||
# main_layout.addWidget(menu)
|
||||
def eventFilter(self, object, event):
|
||||
print(self, object, event)
|
||||
# if event.type() == QtCore.QEvent.MouseButtonPress:
|
||||
# print("You pressed the button")
|
||||
# return True
|
||||
# #
|
||||
if event == QtCore.QEvent.HoverMove:
|
||||
print("C'mon! CLick-meeee!!!")
|
||||
return True
|
||||
def exit(self):
|
||||
QtCore.QCoreApplication.exit()
|
||||
|
||||
def _sys_tray(image):
|
||||
# code source: https://stackoverflow.com/questions/893984/pyqt-show-menu-in-a-system-tray-application - add answer PyQt5
|
||||
#PyQt4 to PyQt5 version: https://stackoverflow.com/questions/20749819/pyqt5-failing-import-of-qtgui
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
w = QtWidgets.QWidget()
|
||||
trayIcon = SystemTrayIcon(QtGui.QIcon(image), w)
|
||||
# menu =
|
||||
trayIcon.show()
|
||||
sys.exit(app.exec_())
|
||||
|
||||
if (__name__ == ('__main__')):
|
||||
avalon_core_icon = r'C:\Users\jakub.trllo\CODE\pype-setup\repos\avalon-launcher\launcher\res\icon\main.png'
|
||||
print(avalon_core_icon)
|
||||
_sys_tray(avalon_core_icon)
|
||||
49
pype/ftrack/tray2.py
Normal file
49
pype/ftrack/tray2.py
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
from app.vendor.Qt import QtGui
|
||||
from app.vendor.Qt import QtWidgets
|
||||
import credentials
|
||||
|
||||
app = QApplication([])
|
||||
app.setQuitOnLastWindowClosed(False)
|
||||
|
||||
# Create the icon
|
||||
avalon_core_icon = r'C:\Users\jakub.trllo\CODE\pype-setup\repos\avalon-launcher\launcher\res\icon\main.png'
|
||||
icon = QIcon(avalon_core_icon)
|
||||
|
||||
clipboard = QApplication.clipboard()
|
||||
dialog = QColorDialog()
|
||||
|
||||
def logout():
|
||||
credentials.
|
||||
|
||||
def copy_color_hsv():
|
||||
if dialog.exec_():
|
||||
color = dialog.currentColor()
|
||||
clipboard.setText("hsv(%d, %d, %d)" % (
|
||||
color.hue(), color.saturation(), color.value()
|
||||
))
|
||||
def exit():
|
||||
self.close()
|
||||
# Create the tray
|
||||
tray = QSystemTrayIcon()
|
||||
tray.setIcon(icon)
|
||||
tray.setVisible(True)
|
||||
|
||||
# Create the menu
|
||||
menu = QMenu()
|
||||
exit = QAction("Exit")
|
||||
exit.triggered.connect(exit)
|
||||
|
||||
logout = QAction("Logout")
|
||||
logout.triggered.connect(logout)
|
||||
|
||||
action3 = QAction("HSV")
|
||||
action3.triggered.connect(copy_color_hsv)
|
||||
|
||||
menu.addAction(exit)
|
||||
# menu.addAction(action2)
|
||||
# menu.addAction(action3)
|
||||
|
||||
# Add the menu to the tray
|
||||
tray.setContextMenu(menu)
|
||||
|
||||
app.exec_()
|
||||
Loading…
Add table
Add a link
Reference in a new issue