窗口相关


from __future__ import print_function

import ctypes
import json
import os
import platform
import sys

from Qt import QtGui
from importlib import reload
from pyblish_pype import control
from pyblish_pype import settings
from pyblish_pype import util

from pyblish_pype import app as app_model
from motionbuilder_pipe.tools import pyblish_window as window
reload(window)
from motionbuilder_pipe.tools import delegate
reload(delegate)

scale_factors = {"darwin": 0.1, "windows": 0.1}

self = sys.modules[__name__]

self._window = None


os.environ['PYBLISH_GUI'] = 'pyblish_pype'
os.environ['PYBLISH_HOSTS'] = 'motionbuilder'
ftrack_dict = {
"ftrack_dict": {
    "step_name": "ani"
},
"asset_dict": {
}
}
temp_path = os.path.join(os.getenv('temp'), 'ftrack_dict.json')
with open(temp_path, 'w') as f:
    json.dump(ftrack_dict, f)
os.environ['JSON_FROM_PUBLISH'] = temp_path
css_path = r'D:\code\wuzu\motionbuilder_pipe\src\motionbuilder_pipe\tools\app.css'
print(css_path)
with open(css_path) as f:
    css = f.read()

    root = util.get_asset("").replace("\\", "/")
    print(root)
    css = css.replace("url(\"", "url(\"%s" % root)

with app_model.application() as app:
    if platform.system().lower() == "windows":
        ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(
            u"pyblish_pype"
        )

app_model.install_fonts()
app_model.install_translator(app)
ctrl = control.Controller()

if self._window is None:
    self._window = window.Window(ctrl, None)
    self._window.destroyed.connect(app_model.on_destroyed)

self._window.show()
self._window.activateWindow()
self._window.setWindowTitle(settings.WindowTitle)

font = QtGui.QFont("Open Sans", 4, QtGui.QFont.Normal)
font.setPointSize(5)
self._window.setStyleSheet(css)
self._window.setFont(font)
self._window.reset()
self._window.resize(320, 480)

def get_children(top):
    # self._window
    children = top.children()

    for i in children:
        try:
            font = QtGui.QFont()
            font.setPointSize(100)
            i.setFont(font)
            print('\n')
        except:
            print(i)
            pass
        
        get_children(i)

get_children(self._window)
self._window.activateWindow()


        try:
            self.retranslateUi(MainWindow)
        except:
            self.retranslateUi1(MainWindow)
            QtCore.QCoreApplication.UnicodeUTF8

评论
  目录