def __init__(self, parent=None): """ Constructor """ QtGui.QWidget.__init__(self, parent) # hook up a listener to the parent window so we # can resize the overlay at the same time as the parent window # is being resized. filter = ResizeEventFilter(parent) filter.resized.connect(self._on_parent_resized) parent.installEventFilter(filter) # make it transparent self.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents) # turn off the widget self.setVisible(False) self._mode = self.MODE_OFF # setup spinner timer self._timer = QtCore.QTimer(self) self._timer.timeout.connect(self._on_animation) self._spin_angle = 0 self._message_pixmap = None self._message = None self._sg_icon = QtGui.QPixmap( ":/tk_framework_shotgunutils.shotgun_model/sg_logo.png")
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) # set up the UI self.ui = Ui_Browser() self.ui.setupUi(self) # hide the overlays self.ui.load_overlay.setVisible(False) self.ui.message_overlay.setVisible(False) self._app = None self._worker = None self._current_work_id = None self._selected_item = None self._selected_items = [] self._dynamic_widgets = [] self._multi_select = False self._search = True # spinner self._spin_icons = [] self._spin_icons.append(QtGui.QPixmap(":/res/progress_bar_1.png")) self._spin_icons.append(QtGui.QPixmap(":/res/progress_bar_2.png")) self._spin_icons.append(QtGui.QPixmap(":/res/progress_bar_3.png")) self._spin_icons.append(QtGui.QPixmap(":/res/progress_bar_4.png")) self._timer = QtCore.QTimer(self) self._timer.timeout.connect(self._update_spinner) self._current_spinner_index = 0 # search self.ui.search.textEdited.connect(self._on_search_text_changed)
def __init__(self, app, worker, parent=None): ListBase.__init__(self, app, worker, parent) # set up the UI self.ui = Ui_Item() self.ui.setupUi(self) self._selected = False self._worker = worker self._worker_uid = None # spinner self._spin_icons = [] self._spin_icons.append(QtGui.QPixmap(":/res/thumb_loading_1.png")) self._spin_icons.append(QtGui.QPixmap(":/res/thumb_loading_2.png")) self._spin_icons.append(QtGui.QPixmap(":/res/thumb_loading_3.png")) self._spin_icons.append(QtGui.QPixmap(":/res/thumb_loading_4.png")) self._timer = QtCore.QTimer(self) self._timer.timeout.connect( self._update_spinner ) self._current_spinner_index = 0 # set up styles for selected/unselected states self._unselected_style = { "border-radius":"2px", "border-style":"solid", "border-width":"1px", "border-color":"rgb(0,0,0,48)", "background-color":"rgb(0,0,0,48)" } self._selected_style = self._unselected_style.copy() self._selected_style["background-color"] = "rgb(112, 112, 112)" self._selected_style["border-color"] = "rgb(112, 112, 112)" self.set_selected(False)
def pre_app_init(self): """ Runs after the engine is set up but before any apps have been initialized. """ from tank.platform.qt import QtCore # unicode characters returned by the shotgun api need to be converted # to display correctly in all of the app windows # tell QT to interpret C strings as utf-8 utf8 = QtCore.QTextCodec.codecForName("utf-8") QtCore.QTextCodec.setCodecForCStrings(utf8) self.logger.debug("set utf-8 codec for widget text") # We use a timer instead of the notifier API as the API does not # inform us when the user changes views, only when they are created # cloned, or closed. # Since the restart of the engine every time a view is chosen is an # expensive operation, we will offer this functionality as am option # inside the context menu. self.active_document_filename = "untitled" self.active_doc_timer = QtCore.QTimer() self.active_doc_timer.timeout.connect( partial(self.async_execute_in_main_thread, self._on_active_doc_timer) )
def __init__(self, parent): """ :param parent: Widget to attach the overlay to :type parent: :class:`PySide.QtGui.QWidget` """ QtGui.QWidget.__init__(self, parent) # turn off the widget self.setVisible(False) self._mode = self.MODE_OFF # setup spinner timer self._timer = QtCore.QTimer(self) self._timer.timeout.connect(self._on_animation) # This is the current spin angle self._spin_angle = 0 # This is where we need to scroll to. self._spin_angle_to = 0 # This is where we were told last time where we need to spin to self._previous_spin_angle_to = 0 # This counts how many times we've ticked in the last second to know how big the heartbeat # needs to be. self._heartbeat = 0 self._sg_icon = QtGui.QPixmap( ":/tk_framework_qtwidgets.overlay_widget/sg_logo.png")
def pre_app_init(self): """ Runs after the engine is set up but before any apps have been initialized. """ from tank.platform.qt import QtCore # unicode characters returned by the shotgun api need to be converted # to display correctly in all of the app windows # tell QT to interpret C strings as utf-8 utf8 = QtCore.QTextCodec.codecForName("utf-8") QtCore.QTextCodec.setCodecForCStrings(utf8) self.logger.debug("set utf-8 codec for widget text") # We use a timer to know when the user changes graph/package # selection. # # Since the restart of the engine every time a view is chosen is an # expensive operation, we will offer this functionality as an option # inside the context menu. # self.active_package = None self.active_package_timer = QtCore.QTimer() self.active_package_timer.timeout.connect( self._on_active_package_timer)
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) # set up the UI self.ui = Ui_Browser() self.ui.setupUi(self) # hide the overlays self.ui.main_pages.setCurrentWidget(self.ui.items_page) self._app = None self._worker = None self._current_work_id = None self._dynamic_widgets = [] self._multi_select = False self._search = True # spinner self._spin_icons = [] self._spin_icons.append(QtGui.QPixmap(":/res/progress_bar_1.png")) self._spin_icons.append(QtGui.QPixmap(":/res/progress_bar_2.png")) self._spin_icons.append(QtGui.QPixmap(":/res/progress_bar_3.png")) self._spin_icons.append(QtGui.QPixmap(":/res/progress_bar_4.png")) self._timer = QtCore.QTimer(self) self._timer.timeout.connect(self._update_spinner) self._current_spinner_index = 0 # search self.ui.search.textEdited.connect(self._on_search_box_input) # load all items self.ui.load_all_top.clicked.connect(self._on_load_all_clicked) self.ui.load_all_bottom.clicked.connect(self._on_load_all_clicked) # reset the deferred loading counters and settings self._reset_load_more() # style: self._title_base_style = { "border": "none", "border-color": "rgb(32,32,32)", "border-top-left-radius": "3px", "border-top-right-radius": "3px", "border-bottom-left-radius": "0px", "border-bottom-right-radius": "0px" } self._title_styles = { "gradient": { "background": "qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(97, 97, 97, 255), stop:1 rgba(49, 49, 49, 255));" }, "none": {} } self._title_margins = { "gradient": [12, 3, 12, 3], "none": [3, 3, 3, 3] } self._current_title_style = "none" self.title_style = "gradient"
def __init__(self, app, worker, parent=None): ListBase.__init__(self, app, worker, parent) # set up the UI self.ui = Ui_Item() self.ui.setupUi(self) self._selected = False self._worker = worker self._worker_uid = None # spinner self._spin_icons = [] self._spin_icons.append(QtGui.QPixmap(":/res/thumb_loading_1.png")) self._spin_icons.append(QtGui.QPixmap(":/res/thumb_loading_2.png")) self._spin_icons.append(QtGui.QPixmap(":/res/thumb_loading_3.png")) self._spin_icons.append(QtGui.QPixmap(":/res/thumb_loading_4.png")) self._timer = QtCore.QTimer(self) self._timer.timeout.connect(self._update_spinner) self._current_spinner_index = 0