コード例 #1
0
 def generate_gui_components(self,
                             phil_scope,
                             in_submenu=False,
                             current_menu=None):
     use_submenu = in_submenu
     if not current_menu:
         current_menu = self._menu_tree
     if phil_scope.is_template < 0:
         return
     for object in phil_scope.objects:
         next_menu = None
         full_object_path = object.full_path()
         if object.style is not None and phil_scope.is_template != -1:
             style = self.create_style(object.style)
             if (style.selection) and (object.type.phil_type == "str"):
                 print "WARNING: deprecated 'str' type with 'selection' style"
                 print "   name: %s" % full_object_path
             self.style[full_object_path] = style
             if style.hidden:
                 self._hidden.append(full_object_path)
             if (style.output_dir):
                 self._output_dir_path = full_object_path
             if style.OnUpdate is not None:
                 print "OnUpdate is deprecated (%s)" % full_object_path
                 self._update_handlers[full_object_path] = style.OnUpdate
             elif style.process_hkl:
                 self._event_handlers[
                     full_object_path] = "auto_extract_hkl_params"
             if style.OnChange is not None:
                 self._event_handlers[full_object_path] = style.OnChange
             if style.renderer is not None:
                 self._renderers[full_object_path] = style.renderer
             if style.menu_item:
                 if phil_scope.multiple and phil_scope.is_template == 0:
                     pass
                 elif style.parent_submenu:
                     current_menu.add_submenu(style.parent_submenu)
                     current_menu.get_submenu(
                         style.parent_submenu).add_menu_item(
                             full_object_path)
                 else:
                     current_menu.add_menu_item(full_object_path)
             elif style.submenu:
                 if phil_scope.multiple and phil_scope.is_template == 0:
                     pass
                 elif style.parent_submenu:
                     current_menu.add_submenu(style.parent_submenu)
                     parent_submenu = current_menu.get_submenu(
                         style.parent_submenu)
                     parent_submenu.add_submenu(full_object_path)
                     next_menu = parent_submenu.get_submenu(
                         full_object_path)
                 else:
                     current_menu.add_submenu(full_object_path)
                     next_menu = current_menu.get_submenu(full_object_path)
         else:
             self.style[full_object_path] = gui_objects.style()
         if not object.is_definition:
             self.generate_gui_components(object, use_submenu, next_menu)
         use_submenu = False
コード例 #2
0
ファイル: interface.py プロジェクト: ctessum/fable-go
 def generate_gui_components (self, phil_scope, in_submenu=False,
     current_menu=None) :
   use_submenu = in_submenu
   if not current_menu :
     current_menu = self._menu_tree
   if phil_scope.is_template < 0 :
     return
   for object in phil_scope.objects :
     next_menu = None
     full_object_path = object.full_path()
     if object.style is not None and phil_scope.is_template != -1 :
       style = self.create_style(object.style)
       if (style.selection) and (object.type.phil_type == "str") :
         print "WARNING: deprecated 'str' type with 'selection' style"
         print "   name: %s" % full_object_path
       self.style[full_object_path] = style
       if style.hidden :
         self._hidden.append(full_object_path)
       if (style.output_dir) :
         self._output_dir_path = full_object_path
       if style.OnUpdate is not None :
         print "OnUpdate is deprecated (%s)" % full_object_path
         self._update_handlers[full_object_path] = style.OnUpdate
       elif style.process_hkl :
         self._event_handlers[full_object_path] = "auto_extract_hkl_params"
       if style.OnChange is not None :
         self._event_handlers[full_object_path] = style.OnChange
       if style.renderer is not None :
         self._renderers[full_object_path] = style.renderer
       if style.menu_item :
         if phil_scope.multiple and phil_scope.is_template == 0 :
           pass
         elif style.parent_submenu :
           current_menu.add_submenu(style.parent_submenu)
           current_menu.get_submenu(style.parent_submenu).add_menu_item(
             full_object_path)
         else :
           current_menu.add_menu_item(full_object_path)
       elif style.submenu :
         if phil_scope.multiple and phil_scope.is_template == 0 :
           pass
         elif style.parent_submenu :
           current_menu.add_submenu(style.parent_submenu)
           parent_submenu = current_menu.get_submenu(style.parent_submenu)
           parent_submenu.add_submenu(full_object_path)
           next_menu = parent_submenu.get_submenu(full_object_path)
         else :
           current_menu.add_submenu(full_object_path)
           next_menu = current_menu.get_submenu(full_object_path)
     else :
       self.style[full_object_path] = gui_objects.style()
     if not object.is_definition :
       self.generate_gui_components(object, use_submenu, next_menu)
     use_submenu = False
コード例 #3
0
 def get_scope_style(self, scope_name=None):
     if scope_name in self.style:
         return self.style[scope_name]
     else:
         return gui_objects.style()
コード例 #4
0
 def create_style(self, style_string):
     return gui_objects.style(style_string)
コード例 #5
0
ファイル: interface.py プロジェクト: ctessum/fable-go
 def get_scope_style (self, scope_name=None) :
   if scope_name in self.style :
     return self.style[scope_name]
   else :
     return gui_objects.style()
コード例 #6
0
ファイル: interface.py プロジェクト: ctessum/fable-go
 def create_style (self, style_string) :
   return gui_objects.style(style_string)