Example #1
0
 def take_thumbnail(self, button):
     output_path = None
     if self.standalone:
         current_file = swidgets.brows_file(
             'find the thumbnail(image) file', resource.getImageFormats())
         if not current_file:
             return
         output_path = os.path.join(
             tempfile.gettempdir(),
             'thumbnail_%s.png' % resource.getCurrentDateKey())
         output_path = swidgets.image_resize(current_file, output_path, 768,
                                             540)
     else:
         from studio_usd_pipe.api import studioMaya
         smaya = studioMaya.Maya()
         output_path, w, h = smaya.vieport_snapshot(
             output_path=None,
             width=768,
             height=540,
         )
     if not os.path.isfile(output_path):
         return
     qsize = button.minimumSize()
     swidgets.image_to_button(button,
                              qsize.width(),
                              qsize.height(),
                              path=output_path)
     self.button_thumbnail.setToolTip(output_path)
Example #2
0
 def load_image_file(self):
     current_file = swidgets.brows_file(
         'find the thumbnail(image) file', resource.getImageFormats())        
     if not current_file:
         return
     os.environ['BROWS_PATH'] = os.path.dirname(current_file)
     output_path = os.path.join(
         tempfile.gettempdir(),
         'thumbnail_%s.png' % resource.getCurrentDateKey())        
     output_path = swidgets.image_resize(current_file, output_path, 768, 540)
     size = self.button_thumbnail.minimumSize()
     swidgets.image_to_button(
         self.button_thumbnail, size.width(), size.height(), path=output_path)
     self.button_thumbnail.setToolTip(output_path)