Exemplo n.º 1
0
def create_node():    
    template_path = resources.get_template_path()    
    latest_version = versions.get_latest_version(template_path, 'lighting')
    if not latest_version:
        message = 'not found any publish versions'
        QtGui.QMessageBox.warning(
            None, 'Warning', message, QtGui.QMessageBox.Ok)
        return            
    xml_scene = os.path.join(
        template_path, 'lighting', latest_version, 'lighting.xml')     
    if not os.path.isfile(xml_scene):
        message = 'not found xml in the latest publish \n<%s>\n<%s>' % (
            latest_version, xml_scene)
        QtGui.QMessageBox.warning(
            None, 'Warning', message, QtGui.QMessageBox.Ok)
        return     
    scene.new_katana_scene()    
    root_node = NodegraphAPI.GetRootNode()
    knodes = scene.xml_file_to_nodes(xml_scene, parent=root_node)
    print '# info: lighting template nodes'
    for knode in knodes:
        print '\t', knode.getName()
    message = [
        'template type: '.rjust(15) + 'lighting',
        'version: '.rjust(15) + latest_version,
        'path: '.rjust(15) + xml_scene
        ]
    QtGui.QMessageBox.information(
            None, 'success', '\n'.join(message), QtGui.QMessageBox.Ok)
    print '\n'.join(message)
Exemplo n.º 2
0
 def __init__(self, parent=None, **kwargs):
     '''
     :example
         from tools.template_publish import main
         window = main.TemplatePublish(parent=None)
         window.show()
     '''        
     super(TemplatePublish, self).__init__(parent, QtCore.Qt.WindowStaysOnTopHint)
     self.template_path = resources.get_template_path()
     self.setup_ui()
     self.set_current_versions()        
Exemplo n.º 3
0
 def __init__(self, parent=None, **kwargs):
     '''
     :example
         from tools.template_publishs import main
         window = main.TemplatePublish(parent=None)
         window.show()
     '''
     super(MayaPublish, self).__init__(parent,
                                       QtCore.Qt.WindowStaysOnTopHint)
     self.template_path = resources.get_template_path()
     self.align_right = QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter
     self.setup_ui()
     self.set_current_pipe(0)
     self.set_current_type(0)
     self.set_default()
Exemplo n.º 4
0
  def render(self, theme, template, **kwargs):
    default_font = self.gc.get_string("/desktop/gnome/interface/document_font_name")
    if default_font:
      font_name, font_size = default_font.rsplit(None, 1)
      self.web_settings.set_property("sans-serif-font-family", font_name)
      self.web_settings.set_property("default-font-size", float(font_size))

    if not resources.theme_exists(theme):
      theme = "default"

    theme_path = resources.get_theme_path(theme)
    template_path = resources.get_template_path(template, theme)
    lookup_paths = list(resources.get_template_dirs()) + [theme_path]

    template = open(template_path).read()
    template = Template(template, lookup=TemplateLookup(directories=lookup_paths))
    content = template.render(theme=util.get_theme_colors(), resources=resources, _=_, **kwargs)

    # Avoid navigation redraw crashes
    if isinstance(self, Navigation) and not self.get_property("visible"):
      return content

    self.load_html_string(content, "file://%s/" % os.path.dirname(template_path))
    return content