mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
user module has also tray_init method for all Qt imports
This commit is contained in:
parent
480acb9238
commit
903713c749
1 changed files with 9 additions and 3 deletions
|
|
@ -3,8 +3,6 @@ import json
|
|||
import getpass
|
||||
|
||||
import appdirs
|
||||
from Qt import QtWidgets
|
||||
from .widget_user import UserWidget
|
||||
|
||||
from pype.api import Logger
|
||||
|
||||
|
|
@ -24,6 +22,12 @@ class UserModule:
|
|||
self.cred_path = os.path.normpath(os.path.join(
|
||||
self.cred_folder_path, self.cred_filename
|
||||
))
|
||||
self.widget_login = None
|
||||
|
||||
self.tray_init(main_parent, parent)
|
||||
|
||||
def tray_init(self, main_parent=None, parent=None):
|
||||
from .widget_user import UserWidget
|
||||
self.widget_login = UserWidget(self)
|
||||
|
||||
self.load_credentials()
|
||||
|
|
@ -66,6 +70,7 @@ class UserModule:
|
|||
|
||||
# Definition of Tray menu
|
||||
def tray_menu(self, parent_menu):
|
||||
from Qt import QtWidgets
|
||||
"""Add menu or action to Tray(or parent)'s menu"""
|
||||
action = QtWidgets.QAction("Username", parent_menu)
|
||||
action.triggered.connect(self.show_widget)
|
||||
|
|
@ -121,7 +126,8 @@ class UserModule:
|
|||
|
||||
self.cred = {"username": username}
|
||||
os.environ[self.env_name] = username
|
||||
self.widget_login.set_user(username)
|
||||
if self.widget_login:
|
||||
self.widget_login.set_user(username)
|
||||
try:
|
||||
file = open(self.cred_path, "w")
|
||||
file.write(json.dumps(self.cred))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue