当前位置: 首页>>代码示例>>Python>>正文


Python QQuickView.show方法代码示例

本文整理汇总了Python中PyQt5.QtQuick.QQuickView.show方法的典型用法代码示例。如果您正苦于以下问题:Python QQuickView.show方法的具体用法?Python QQuickView.show怎么用?Python QQuickView.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtQuick.QQuickView的用法示例。


在下文中一共展示了QQuickView.show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: LoginWin

# 需要导入模块: from PyQt5.QtQuick import QQuickView [as 别名]
# 或者: from PyQt5.QtQuick.QQuickView import show [as 别名]
class LoginWin(QtCore.QObject):
    def __init__(self, state, app):
        QtCore.QObject.__init__(self)
        self.state = state
        self.app = app

        # Create the QML user interface.
        self.login_win = QQuickView()
        self.login_win.setTitle(self.tr("Xiami Login"))
        self.login_win.setSource(QUrl('login.qml'))
        self.login_win.setResizeMode(QQuickView.SizeRootObjectToView)
        self.login_win.show()

        # Connect signals
        self.root_obj = self.login_win.rootObject()
        self.root_obj.loginClicked.connect(self.login_clicked)
        self.root_obj.exitClicked.connect(self.exit_clicked)

    def set_state(self, msg):
        self.root_obj.setStatus(msg)

    def exit_clicked(self):
        sys.exit(0)

    def login_clicked(self, username, password):
        code = self.root_obj.getVerificationCode()
        if code != "":
            try:
                login.login_with_code(self.state, self.key, code)
            except Exception as e:
                self.set_state(e.message)
                self.root_obj.hideCode()
                return
            self.ok()
        else:
            try:
                ret = login.login(self.state, username, password)
            except Exception as e:
                self.set_state(e.message)
                return
            if not ret[0]:
                with open(login.img_path, 'wb') as imgf:
                    imgf.write(ret[2])
                self.set_state(self.tr("Please enter verification code"))
                self.root_obj.setVerificationImage("file://%s"
                                                   % login.img_path)
                self.key = ret[1]
            else:
                self.ok()

    def ok(self):
        self.login_win.close()
        self.app.auth_ok()
开发者ID:HenryHu,项目名称:xmradio,代码行数:55,代码来源:gui.py

示例2: TabletShortcuts

# 需要导入模块: from PyQt5.QtQuick import QQuickView [as 别名]
# 或者: from PyQt5.QtQuick.QQuickView import show [as 别名]
class TabletShortcuts(QGuiApplication):
    def __init__(self, argv):
        QGuiApplication.__init__(self, argv)

        self.view = QQuickView()

        self.bus = QDBusConnection.sessionBus()
        self.server = MyDBUSServer(self)
        self.bus.registerObject("/app", self.server)
        self.bus.registerService("sevanteri.TabletShortcuts")

        self.view.setTitle("TabletShortcuts")
        self.view.setResizeMode(QQuickView.SizeRootObjectToView)
        self.view.setSource(QUrl('main.qml'))

        self.root = self.view.rootObject()
        self.showView()

        self.root.runCommand.connect(self.run)
        self.root.hideView.connect(self.view.hide)

        self.view.engine().quit.connect(self.quit)

    def run(self, cmd):
        return Popen(shlex.split(cmd))

    def quit(self):
        self.exit()

    def showView(self):
        if self.view.isVisible():
            self.view.hide()
        else:
            # width, height = TabletShortcuts.getScreenGeometry()

            # self.view.setGeometry(1, 1, width, height)
            self.view.show()

    def getScreenGeometry():
        output = Popen("xrandr | grep 'current'", shell=True, stdout=PIPE)\
            .communicate()[0].decode('UTF-8')

        m = re.search('current.([0-9]+).x.([0-9]+)', output)
        width = int(m.group(1))
        height = int(m.group(2))

        return (width, height)
开发者ID:sevanteri,项目名称:tabletShortcuts,代码行数:49,代码来源:tabletShortcuts.py

示例3: run_app

# 需要导入模块: from PyQt5.QtQuick import QQuickView [as 别名]
# 或者: from PyQt5.QtQuick.QQuickView import show [as 别名]
def run_app():
    app = QGuiApplication(sys.argv)
    app.setApplicationName("Worship Prototype")

    view = QQuickView()
    view.setResizeMode(QQuickView.SizeRootObjectToView)
    view.setSource(QUrl.fromLocalFile(os.path.join(os.path.dirname(__file__), 'main.qml')))
    view.show()

    root = view.rootObject()
    preview = DefaultScreen()
    preview.wire_to_gui(root, 'previewScreen')
    preview.show_background(VideoBackground(os.path.join(os.path.dirname(__file__), '../echo.mp4')))
    # preview_live = DefaultScreen()
    # live = DefaultScreen()
    modules = [
        LyricsModule(SongsList(), root, preview),
    ]

    sys.exit(app.exec_())
开发者ID:fadawar,项目名称:worship-prototype,代码行数:22,代码来源:__init__.py

示例4: MainWindow

# 需要导入模块: from PyQt5.QtQuick import QQuickView [as 别名]
# 或者: from PyQt5.QtQuick.QQuickView import show [as 别名]
class MainWindow(QtCore.QObject):
    def __init__(self):
        QtCore.QObject.__init__(self)

        self._controller = Controller()

        self.view = QQuickView()

        full_path = os.path.realpath(__file__)
        folder = os.path.dirname(full_path)
        qml_file = os.path.join(folder, 'qml', 'App.qml')
        qml_qurl = QtCore.QUrl.fromLocalFile(qml_file)

        self.view.setSource(qml_qurl)

        # Add context properties to use this objects from qml
        rc = self.view.rootContext()
        rc.setContextProperty('controller', self._controller)

    def show(self):
        self.view.show()
开发者ID:ivanalejandro0,项目名称:bitmask_gui2,代码行数:23,代码来源:app.py

示例5: main

# 需要导入模块: from PyQt5.QtQuick import QQuickView [as 别名]
# 或者: from PyQt5.QtQuick.QQuickView import show [as 别名]
def main():
    app = QGuiApplication(sys.argv)
    app.setApplicationName('InfiniteCopy')

    openDataBase()

    view = QQuickView()

    clipboardItemModel = ClipboardItemModel()
    clipboardItemModel.create()

    filterProxyModel = QSortFilterProxyModel()
    filterProxyModel.setSourceModel(clipboardItemModel)

    clipboard = Clipboard()
    clipboard.setFormats([
        mimeText,
        mimeHtml,
        mimePng,
        mimeSvg
        ])
    clipboard.changed.connect(clipboardItemModel.addItem)

    engine = view.engine()

    imageProvider = ClipboardItemModelImageProvider(clipboardItemModel)
    engine.addImageProvider("items", imageProvider)

    context = view.rootContext()
    context.setContextProperty('clipboardItemModel', clipboardItemModel)
    context.setContextProperty('clipboardItemModelFilterProxy', filterProxyModel)
    context.setContextProperty('clipboard', clipboard)

    view.setSource(QUrl.fromLocalFile('qml/MainWindow.qml'))
    view.setGeometry(100, 100, 400, 240)
    view.show()

    engine.quit.connect(QGuiApplication.quit)

    return app.exec_()
开发者ID:hluk,项目名称:infinitecopy,代码行数:42,代码来源:infinitecopy.py

示例6: run

# 需要导入模块: from PyQt5.QtQuick import QQuickView [as 别名]
# 或者: from PyQt5.QtQuick.QQuickView import show [as 别名]
def run():
    signal.signal(signal.SIGINT, signal.SIG_DFL)

    app = QGuiApplication(sys.argv)

    view = QQuickView()
    view.setTitle('Hot reloading demo')

    qml_engine = view.rootContext().engine()
    qml_engine.addImportPath(lib_dir_path)

    notifier = HotReloadNotifier(demo_dir_path, qml_engine, parent=app)
    view.rootContext().setContextProperty('hotReloadNotifier', notifier)

    qml_url = QUrl.fromLocalFile(os.path.join(demo_dir_path, 'Demo.qml'))
    view.setSource(qml_url)

    view.show()
    exit_code = app.exec_()

    # notifier.stop()  # seems like this is not needed
    sys.exit(exit_code)
开发者ID:bgr,项目名称:qml_hot_reload,代码行数:24,代码来源:main.py

示例7: DAMAGES

# 需要导入模块: from PyQt5.QtQuick import QQuickView [as 别名]
# 或者: from PyQt5.QtQuick.QQuickView import show [as 别名]
## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
## $QT_END_LICENSE$
##
#############################################################################

import sys
import os.path

from PyQt5.QtCore import QUrl
from PyQt5.QtGui import QGuiApplication
from PyQt5.QtQuick import QQuickView
#animation 폴더의 animation_rc 와 shared 폴더의 shared_rc를 import해온다.
from shared_rc import *
from animation_rc import *

if len(sys.argv) is 2:# 실행 옵션으로 파이썬도움말 절대경로 제공시
    os.chdir(sys.argv[1])


app = QGuiApplication(sys.argv)
view = QQuickView()
view.engine().quit.connect(app.quit)
view.setSource(QUrl('animation.qml'))
view.show()
sys.exit(app.exec_())
开发者ID:louisraccoon,项目名称:PyStudy,代码行数:33,代码来源:animation.py

示例8: QApplication

# 需要导入模块: from PyQt5.QtQuick import QQuickView [as 别名]
# 或者: from PyQt5.QtQuick.QQuickView import show [as 别名]
#!/usr/bin/env python3

import sys
from PyQt5.QtCore import QUrl
from PyQt5.QtWidgets import QApplication
from PyQt5.QtQuick import QQuickView

# Main Function
if __name__ == '__main__':
    # Create main app
    myApp = QApplication(sys.argv)
    # Create a label and set its properties
    appLabel = QQuickView()
    appLabel.setSource(QUrl('2.qml'))

    # Show the Label
    appLabel.show()

    # Execute the Application and Exit
    myApp.exec_()
    sys.exit()
开发者ID:Jamesits,项目名称:recharify,代码行数:23,代码来源:test.py

示例9: sync

# 需要导入模块: from PyQt5.QtQuick import QQuickView [as 别名]
# 或者: from PyQt5.QtQuick.QQuickView import show [as 别名]
    @pyqtSlot()
    def sync(self):
        if not self.m_renderer:
            print("sync<----------------")
            self.m_renderer = SquircleRenderer()  # self.window())
            self.window().beforeRendering.connect(self.m_renderer.paint, Qt.DirectConnection)

        self.m_renderer.setViewportSize(self.window().size() * self.window().devicePixelRatio())
        self.m_renderer.setT(self._t)
        self.m_renderer.setWin(self.window())

    # @pyqtSlot(QQuickWindow)
    def handleWindowChanged(self, win):
        if win:
            win.beforeSynchronizing.connect(self.sync, Qt.DirectConnection)
            win.sceneGraphInvalidated.connect(self.cleanup, Qt.DirectConnection)

            win.setClearBeforeRendering(False)


if __name__ == "__main__":
    app = QApplication(sys.argv)

    qmlRegisterType(Squircle, "OpenGLUnderQML", 1, 0, "Squircle")
    viewer = QQuickView(QUrl.fromLocalFile("main.qml"))

    viewer.show()

    sys.exit(app.exec_())
开发者ID:harry159821,项目名称:PyQt_3D,代码行数:31,代码来源:main.py

示例10: main

# 需要导入模块: from PyQt5.QtQuick import QQuickView [as 别名]
# 或者: from PyQt5.QtQuick.QQuickView import show [as 别名]
def main():
    print("start")
    app = QApplication(sys.argv)
    v = QQuickView(QUrl("main.qml"))
    v.show()
    sys.exit(app.exec_())
开发者ID:zchen24,项目名称:tutorial,代码行数:8,代码来源:qml-soundeffect.py

示例11: import

# 需要导入模块: from PyQt5.QtQuick import QQuickView [as 别名]
# 或者: from PyQt5.QtQuick.QQuickView import show [as 别名]
# -*- coding: utf-8 -*-
import os, sys, re

from PyQt5.QtNetwork import *

from fboinsgrenderer import *
from textureinsgnode_rc import *

from PyQt5.QtGui import QSurfaceFormat
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import (QVariant, QUrl, QDir, QSortFilterProxyModel, pyqtProperty, QSize,
    Q_ENUMS, QObject, QRegExp, QAbstractItemModel, pyqtSignal, Qt, QModelIndex, QByteArray)
from PyQt5.QtQml import (QQmlApplicationEngine, QQmlEngine, QQmlFileSelector, qmlRegisterType,
    QQmlParserStatus, QJSValue)
from PyQt5.QtQuick import QQuickView, QQuickItem, QQuickWindow

if __name__ == '__main__':
    app = QApplication(sys.argv)

    qmlRegisterType(FboInSGRenderer, "SceneGraphRendering", 1, 0, "Renderer")
    widgetWindow = QQuickView()
    widgetWindow.setResizeMode(QQuickView.SizeRootObjectToView)
    widgetWindow.setSource(QUrl("qrc:///main.qml"))
    widgetWindow.show()

    sys.exit(app.exec_())
开发者ID:harry159821,项目名称:PyQt_3D,代码行数:28,代码来源:main.py

示例12: USBPrinterManager

# 需要导入模块: from PyQt5.QtQuick import QQuickView [as 别名]
# 或者: from PyQt5.QtQuick.QQuickView import show [as 别名]
class USBPrinterManager(QObject, SignalEmitter, Extension):
    def __init__(self, parent = None):
        super().__init__(parent)
        self._serial_port_list = []
        self._printer_connections = []
        self._check_ports_thread = threading.Thread(target = self._updateConnectionList)
        self._check_ports_thread.daemon = True
        self._check_ports_thread.start()
        
        self._progress = 0

        self._control_view = None
        self._firmware_view = None
        self._extruder_temp = 0
        self._bed_temp = 0
        self._error_message = "" 
        
        ## Add menu item to top menu of the application.
        self.setMenuName("Firmware")
        self.addMenuItem(i18n_catalog.i18n("Update Firmware"), self.updateAllFirmware)
    
    pyqtError = pyqtSignal(str, arguments = ["amount"])
    processingProgress = pyqtSignal(float, arguments = ["amount"])
    pyqtExtruderTemperature = pyqtSignal(float, arguments = ["amount"])
    pyqtBedTemperature = pyqtSignal(float, arguments = ["amount"])
    
    ##  Show firmware interface.
    #   This will create the view if its not already created.
    def spawnFirmwareInterface(self, serial_port):
        if self._firmware_view is None:
            self._firmware_view = QQuickView()
            self._firmware_view.engine().rootContext().setContextProperty("manager",self)
            self._firmware_view.setSource(QUrl("plugins/USBPrinting/FirmwareUpdateWindow.qml"))
        self._firmware_view.show()
    
    ##  Show control interface.
    #   This will create the view if its not already created.
    def spawnControlInterface(self,serial_port):
        if self._control_view is None:
            self._control_view = QQuickView()
            self._control_view.engine().rootContext().setContextProperty("manager",self)
            self._control_view.setSource(QUrl("plugins/USBPrinting/ControlWindow.qml"))
        self._control_view.show()

    @pyqtProperty(float,notify = processingProgress)
    def progress(self):
        return self._progress

    @pyqtProperty(float,notify = pyqtExtruderTemperature)
    def extruderTemperature(self):
        return self._extruder_temp

    @pyqtProperty(float,notify = pyqtBedTemperature)
    def bedTemperature(self):
        return self._bed_temp

    @pyqtProperty(str,notify = pyqtError)
    def error(self):
        return self._error_message
    
    ##  Check all serial ports and create a PrinterConnection object for them.
    #   Note that this does not validate if the serial ports are actually usable!
    #   This (the validation) is only done when the connect function is called.
    def _updateConnectionList(self):  
        while True: 
            temp_serial_port_list = self.getSerialPortList(only_list_usb = True)
            if temp_serial_port_list != self._serial_port_list: # Something changed about the list since we last changed something.
                disconnected_ports = [port for port in self._serial_port_list if port not in temp_serial_port_list ]
                self._serial_port_list = temp_serial_port_list
                for serial_port in self._serial_port_list:
                    if self.getConnectionByPort(serial_port) is None: # If it doesn't already exist, add it
                        if not os.path.islink(serial_port): # Only add the connection if it's a non symbolic link
                            connection = PrinterConnection.PrinterConnection(serial_port)
                            connection.connect()
                            connection.connectionStateChanged.connect(self.serialConectionStateCallback)
                            connection.progressChanged.connect(self.onProgress)
                            connection.onExtruderTemperatureChange.connect(self.onExtruderTemperature)
                            connection.onBedTemperatureChange.connect(self.onBedTemperature)
                            connection.onError.connect(self.onError)
                            self._printer_connections.append(connection)
                
                for serial_port in disconnected_ports: # Close connections and remove them from list.
                    connection = self.getConnectionByPort(serial_port)
                    if connection != None:
                        self._printer_connections.remove(connection)
                        connection.close()
            time.sleep(5) # Throttle, as we don"t need this information to be updated every single second.
    
    def updateAllFirmware(self):
        self.spawnFirmwareInterface("")
        for printer_connection in self._printer_connections:
            printer_connection.updateFirmware(Resources.getPath(Resources.FirmwareLocation, self._getDefaultFirmwareName()))
            
    def updateFirmwareBySerial(self, serial_port):
        printer_connection = self.getConnectionByPort(serial_port)
        if printer_connection is not None:
            self.spawnFirmwareInterface(printer_connection.getSerialPort())
            printer_connection.updateFirmware(Resources.getPath(Resources.FirmwareLocation, self._getDefaultFirmwareName()))
        
    def _getDefaultFirmwareName(self):
#.........这里部分代码省略.........
开发者ID:BjoernT,项目名称:Cura,代码行数:103,代码来源:USBPrinterManager.py

示例13: View

# 需要导入模块: from PyQt5.QtQuick import QQuickView [as 别名]
# 或者: from PyQt5.QtQuick.QQuickView import show [as 别名]
class View(object):

    shapes = ["rectangle", "ellipse", "image"]
    edgetypes = ["line", "curve"]

    def __init__(self):
        self._controller = Controller(self)
        self._gui = QGuiApplication(sys.argv)

        self._qml_dir = os.path.dirname(os.path.realpath(__file__))
        self._main = QQuickView()
        self._main.setResizeMode(QQuickView.SizeRootObjectToView)
        self._main.setSource(QUrl(self._qml_dir + '/main.qml'))

        self._main.rootObject().create_node.connect(
            self._controller.create_node)
        self._main.rootObject().mouse_position.connect(
            self._controller.mouse_position)
        self._main.rootObject().save.connect(
            self._controller.save)
        self._main.rootObject().load.connect(
            self._controller.load)
        self._main.rootObject().lose_focus.connect(
            self._controller.lose_focus)
        self._main.rootObject().node_color_sel.connect(
            self._controller.node_color_sel)
        self._main.rootObject().edge_color_sel.connect(
            self._controller.edge_color_sel)
        self._main.rootObject().workspace_height_changed.connect(
            self._controller.workspace_height_changed)
        self._main.rootObject().workspace_width_changed.connect(
            self._controller.workspace_width_changed)
        self._main.rootObject().edge_type_sel.connect(
            self._controller.edge_type_sel)
        self._main.rootObject().node_shape_sel.connect(
            self._controller.node_shape_sel)
        self._main.rootObject().clear_workspace.connect(
            self._controller.clear_workspace)
        self._main.rootObject().node_width_changed.connect(
            self._controller.node_width_changed)
        self._main.rootObject().node_height_changed.connect(
            self._controller.node_height_changed)
        self._main.rootObject().node_text_color_sel.connect(
            self._controller.node_text_color_sel)
        self._main.rootObject().node_text_size_changed.connect(
            self._controller.node_text_size_changed)
        self._main.rootObject().edge_thickness_changed.connect(
            self._controller.edge_thickness_changed)
        self._main.rootObject().show_edge_controls.connect(
            self._controller.show_edge_controls)
        self._main.rootObject().hide_edge_controls.connect(
            self._controller.hide_edge_controls)
        self._main.rootObject().exporting.connect(
            self._controller.exporting)
        self._main.setProperty(
            "width", self._controller.project.workspace_width)
        self._main.setProperty(
            "height", self._controller.project.workspace_height)
        self._main.show()

    def run(self):
        return self._gui.exec_()

    def create_node(self, node):
        # Creates new node from source QML and puts it inside of main window
        qml_node = QQuickView(QUrl(self._qml_dir + '/shapes/' +
                                   self.shapes[node.shape] + '.qml'),
                              self._main)

        workspace = self._main.rootObject().findChild(QQuickItem, "workspace")

        # Sets all properties
        qml_node.rootObject().setProperty("parent", workspace)
        qml_node.rootObject().setProperty("objectId", str(node.id))
        qml_node.rootObject().setProperty("background",
                                          str(node.background))
        qml_node.rootObject().setProperty("width", str(node.width))
        qml_node.rootObject().setProperty("height", str(node.height))
        qml_node.rootObject().setProperty("text", str(node.text.text))
        qml_node.rootObject().setProperty("textFont", str(node.text.font))
        qml_node.rootObject().setProperty("textSize", str(node.text.size))
        qml_node.rootObject().setProperty("textColor", str(node.text.color))

        # Sets drag boundaries
        qml_node.rootObject().setProperty("workspaceWidth",
                                          str(workspace.property("width")))
        qml_node.rootObject().setProperty("workspaceHeight",
                                          str(workspace.property("height")))

        # Signal connection
        qml_node.rootObject().node_delete.connect(
            self._controller.node_delete)
        qml_node.rootObject().node_text_changed.connect(
            self._controller.node_text_changed)
        qml_node.rootObject().node_position_changed.connect(
            self._controller.node_position_changed)
        qml_node.rootObject().node_connect.connect(
            self._controller.node_connect)
        qml_node.rootObject().node_focus.connect(
            self._controller.node_focus)
#.........这里部分代码省略.........
开发者ID:LukasSlouka,项目名称:MindMapper,代码行数:103,代码来源:__init__.py

示例14: Copyright

# 需要导入模块: from PyQt5.QtQuick import QQuickView [as 别名]
# 或者: from PyQt5.QtQuick.QQuickView import show [as 别名]
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright (C) 2014 Daniele Simonetti

import sys

from OpenGL import GL
from PyQt5.QtCore import pyqtProperty, QCoreApplication, QObject, QUrl
from PyQt5.QtGui import QGuiApplication
from PyQt5.QtQuick import QQuickView
from PyQt5.QtQml  import qmlRegisterType, QQmlComponent, QQmlEngine

if __name__ == '__main__':
	# Create the application instance.
	app = QGuiApplication(sys.argv)

	view = QQuickView()
	view.setSource(QUrl.fromLocalFile("main.qml"));
	view.show();

	try:
		app.exec_()
	except KeyboardInterrupt:
		app.exit(0)



开发者ID:OpenNingia,项目名称:l5r-character-manager,代码行数:26,代码来源:characterview.py

示例15: Application

# 需要导入模块: from PyQt5.QtQuick import QQuickView [as 别名]
# 或者: from PyQt5.QtQuick.QQuickView import show [as 别名]
class Application(QApplication):
    """Main Nuxeo Drive application controlled by a system tray icon + menu"""

    icon = QIcon(str(find_icon("app_icon.svg")))
    icons: Dict[str, QIcon] = {}
    icon_state = None
    use_light_icons = None
    filters_dlg: Optional[FiltersDialog] = None
    _delegator: Optional["NotificationDelegator"] = None
    tray_icon: DriveSystrayIcon

    def __init__(self, manager: "Manager", *args: Any) -> None:
        super().__init__(list(*args))
        self.manager = manager

        self.osi = self.manager.osi
        self.setWindowIcon(self.icon)
        self.setApplicationName(APP_NAME)
        self._init_translator()
        self.setQuitOnLastWindowClosed(False)

        self.ask_for_metrics_approval()

        self._conflicts_modals: Dict[str, bool] = dict()
        self.current_notification: Optional[Notification] = None
        self.default_tooltip = APP_NAME

        font = QFont("Helvetica, Arial, sans-serif", 12)
        self.setFont(font)
        self.ratio = sqrt(QFontMetricsF(font).height() / 12)

        self.init_gui()

        self.manager.dropEngine.connect(self.dropped_engine)

        self.setup_systray()
        self.manager.reloadIconsSet.connect(self.load_icons_set)

        # Direct Edit
        self.manager.direct_edit.directEditConflict.connect(self._direct_edit_conflict)
        self.manager.direct_edit.directEditError.connect(self._direct_edit_error)

        # Check if actions is required, separate method so it can be overridden
        self.init_checks()

        # Setup notification center for macOS
        if MAC:
            self._setup_notification_center()

        # Application update
        self.manager.updater.appUpdated.connect(self.quit)
        self.manager.updater.serverIncompatible.connect(self._server_incompatible)
        self.manager.updater.wrongChannel.connect(self._wrong_channel)

        # Display release notes on new version
        if self.manager.old_version != self.manager.version:
            self.show_release_notes(self.manager.version)

        # Listen for nxdrive:// sent by a new instance
        self.init_nxdrive_listener()

        # Connect this slot last so the other slots connected
        # to self.aboutToQuit can run beforehand.
        self.aboutToQuit.connect(self.manager.stop)

    @if_frozen
    def add_qml_import_path(self, view: QQuickView) -> None:
        """
        Manually set the path to the QML folder to fix errors with unicode paths.
        This is needed only on Windows when packaged with Nuitka.
        """
        if Options.freezer != "nuitka":
            return

        qml_dir = Options.res_dir.parent / "PyQt5" / "Qt" / "qml"
        log.debug(f"Setting QML import path for {view} to {qml_dir!r}")
        view.engine().addImportPath(str(qml_dir))

    def init_gui(self) -> None:

        self.api = QMLDriveApi(self)
        self.conflicts_model = FileModel()
        self.errors_model = FileModel()
        self.engine_model = EngineModel(self)
        self.action_model = ActionModel()
        self.file_model = FileModel()
        self.ignoreds_model = FileModel()
        self.language_model = LanguageModel()

        self.add_engines(list(self.manager._engines.values()))
        self.engine_model.statusChanged.connect(self.update_status)
        self.language_model.addLanguages(Translator.languages())

        flags = Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint

        if WINDOWS:
            self.conflicts_window = QQuickView()
            self.add_qml_import_path(self.conflicts_window)
            self.conflicts_window.setMinimumWidth(550)
            self.conflicts_window.setMinimumHeight(600)
#.........这里部分代码省略.........
开发者ID:nuxeo,项目名称:nuxeo-drive,代码行数:103,代码来源:application.py


注:本文中的PyQt5.QtQuick.QQuickView.show方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。