def toggle_handles(self, var):
        """
        If the handles are "on", lop off 8 at the head and tail, else, add them back in
        """
        source_nodes = commands.closestNodesOfType("RVFileSource")
        for source_node in source_nodes:
            source_path = commands.getStringProperty("%s.media.movie" % source_node)[0]
            start_frame = 0
            end_frame = -1
            for source in commands.sources():
                if source[0] == source_path:
                    start_frame = int(source[1])
                    end_frame = int(source[2])
                    break
            if self._handles_on:
                commands.setIntProperty("%s.cut.in" % source_node, [start_frame + 9], True)
                commands.setIntProperty("%s.cut.out" % source_node, [end_frame - 8], True)
            else:
                commands.setIntProperty("%s.cut.in" % source_node, [start_frame], True)
                commands.setIntProperty("%s.cut.out" % source_node, [end_frame], True)

        # we only want to set the flag and display feedback once, not for each source
        if self._handles_on:
            extra_commands.displayFeedback("Handles are OFF", 5.0)
            self._handles_on = False
        else:
            extra_commands.displayFeedback("Handles are ON", 5.0)
            self._handles_on = True
 def toggle_media(self, var):
     """
     Swap between Shotgun format media (frames/movie). Also
     handles the case where we're not looking at Shotgun media, by
     bailing out gracefully.
     """
     source_node = commands.closestNodesOfType("RVFileSource")[0]
     try:
         media_type = commands.getStringProperty("%s.tracking.mediaType" % source_node)[0]
     except:
         # if the previous command throws an exception, we aren't
         # looking at Shotgun sources
         pass
     else:
         mu = """
             require shotgun_mode;
             shotgun_mode.theMode().swapMediaFromInfo("%s", "%s");
         """
         if str(media_type.lower()) == "dnxhd":
             runtime.eval(mu % ("Frames", source_node), ["shotgun_mode"])
         else:
             runtime.eval(mu % ("DNXHD", source_node), ["shotgun_mode"])
             
         # recheck our current media_type since it's possible the
         # media type doesn't exist and therefore wouldn't have
         # changed
         media_type = commands.getStringProperty("%s.tracking.mediaType" % source_node)[0]
         if str(media_type).lower() == "frames":
             # make sure our alexa node is active
             commands.setIntProperty("#LinearToAlexaLogC.node.active", [1], True)
         else:
             # make sure our alexa node is not active
             commands.setIntProperty("#LinearToAlexaLogC.node.active", [0], True)
         # and display some feedback so the user knows what's happening
         extra_commands.displayFeedback("View %s" % media_type.upper(), 5.0)
    def toggle_look(self, event):
        """
        If the LookLUT is currently on, turn it off, and vice versa.
        Display feedback so the user knows what's happening.
        """
        # since the CDL should be enabled or disabled for a single
        # source rather than on the session as a whole, reference the
        # currently viewed node to toggle
        look_node = self._get_node_for_source("RVLookLUT")

        look_on = commands.getIntProperty("%s.lut.active" % look_node)[0]
        if look_on:
            commands.setIntProperty("%s.lut.active" % look_node, [0], True)
            extra_commands.displayFeedback("Romeo Shot LUT is OFF", 5.0)
        else:
            commands.setIntProperty("%s.lut.active" % look_node, [1], True)
            extra_commands.displayFeedback("Romeo Shot LUT is ON", 5.0)
    def request_versions_for_statuses_and_steps(self, silent=False):
        if not silent:
            rve.displayFeedback("Reloading ...", 60.0)

        full_filters = self.get_tray_filters()

        if full_filters == None:
            self._filtered_versions_model.clear()
            self._filtered_versions_model.data_refreshed.emit(True)
            return
        version_fields = ["image"] + required_version_fields
        version_filter_presets = [
                {"preset_name": "LATEST", "latest_by": "BY_PIPELINE_STEP_NUMBER_AND_ENTITIES_CREATED_AT" }
            ]

        self._filtered_versions_model.load_data(entity_type='Version', filters=full_filters, 
            fields=version_fields, additional_filter_presets=version_filter_presets)
 def toggle_slate(self, var):
     """
     If the slate is "on", lop off the first frame, otherwise, add it back in
     """
     source_nodes = commands.closestNodesOfType("RVFileSource")
     for source_node in source_nodes:
         source_path = commands.getStringProperty("%s.media.movie" % source_node)[0]
         start_frame = 0
         for source in commands.sources():
             if source[0] == source_path:
                 start_frame = int(source[1])
                 break
         if self._slate_on:
             commands.setIntProperty("%s.cut.in" % source_node, [start_frame + 1], True)
         else:
             commands.setIntProperty("%s.cut.in" % source_node, [start_frame], True)      
     # we only want to set the flag and display feedback once, not for each source
     if self._slate_on:
         extra_commands.displayFeedback("Slate is OFF", 5.0)
         self._slate_on = False
     else:
         extra_commands.displayFeedback("Slate is ON", 5.0)
         self._slate_on = True
 def toggle_wipes(self, var):
     """
     If there is multiple media sources, then toggle both over mode and wipes on/off, otherwise
     default back to standard wipe toggling behavior.
     """
     if len(commands.sources()) > 1:
         wipe_shown = runtime.eval("rvui.wipeShown();", ["rvui"])
         wipe_shown = int(str(wipe_shown))
         # if Wipes are on, turn them off and vice versa
         if wipe_shown == commands.CheckedMenuState:
             # turn wipes off
             runtime.eval("rvui.toggleWipe();", ["rvui"])
             # make sure we're in "Sequence" mode
             commands.setViewNode("defaultSequence")
             extra_commands.displayFeedback("Wipes OFF", 5.0)
         else:
             # make sure we're in "Over" mode
             commands.setViewNode("defaultStack")
             # turn wipes on
             runtime.eval("rvui.toggleWipe();", ["rvui"])
             extra_commands.displayFeedback("Wipes ON", 5.0)
     else:
         extra_commands.displayFeedback("Can't wipe, only one source", 5.0)