forked from shotgunsoftware/tk-rv-shotgunreview
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
98 lines (78 loc) · 3.23 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Copyright (c) 2016 Shotgun Software Inc.
#
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
# not expressly granted therein are reserved by Shotgun Software Inc.
import os
import tank
from sgtk.platform import Application
from tank.platform.qt import QtGui, QtCore
import rv.qtutils
import rv.commands
class RVShotgunReviewApp(Application):
"""
The app entry point. This class is responsible for intializing and tearing down
the application, handle menu registration etc.
"""
def init_app(self):
"""
Called as the application is being initialized.
"""
tk_rv_shotgunreview = self.import_module("tk_rv_shotgunreview")
parent_widget = self.engine.get_dialog_parent()
notes_dock = QtGui.QDockWidget("", parent_widget)
tray_dock = QtGui.QDockWidget("", parent_widget)
notes_dock.setFocusPolicy(QtCore.Qt.NoFocus)
tray_dock.setFocusPolicy(QtCore.Qt.NoFocus)
notes_dock.setAllowedAreas(QtCore.Qt.LeftDockWidgetArea | QtCore.Qt.RightDockWidgetArea)
notes_dock.setTitleBarWidget(QtGui.QWidget(parent_widget))
tray_dock.setAllowedAreas(QtCore.Qt.BottomDockWidgetArea)
tray_dock.setTitleBarWidget(QtGui.QWidget(parent_widget))
self._rv_activity_stream = tk_rv_shotgunreview.RvActivityMode(app=self)
self._rv_activity_stream.init_ui(notes_dock, tray_dock)
self._rv_activity_stream.toggle()
parent_widget.addDockWidget(QtCore.Qt.RightDockWidgetArea, notes_dock)
parent_widget.addDockWidget(QtCore.Qt.BottomDockWidgetArea, tray_dock)
try:
fn = os.path.join(self.disk_location, "notes_dock.qss")
f = open(fn, 'r')
s = f.read()
notes_dock.setStyleSheet(s)
except Exception as e:
self.engine.log_error(e)
finally:
f.close()
try:
fn = os.path.join(self.disk_location, "tray_dock.qss")
f = open(fn, 'r')
s = f.read()
tray_dock.setStyleSheet(s)
except Exception as e:
self.engine.log_error(e)
finally:
f.close()
def destroy_app(self):
"""
Deactivates the RV mode before proceeding with tear-down of the
app.
"""
self._rv_activity_stream.deactivate()
#####################################################################################
# Properties
@property
def context_change_allowed(self):
"""
Specifies that on-the-fly context changes are supported.
"""
return True
#####################################################################################
# utility methods
def _env_info(self):
self.engine.log_info("TANK_CONTEXT: %s" % os.environ.get("TANK_CONTEXT"))
self.engine.log_info('QtGui: %r' % QtGui)
self.engine.log_info('QtCore: %r' % QtCore)
self._rv_activity_stream.load_data( { "type": "Version", "id": 41})