예제 #1
0
 def __on_kill_focus(self, event):
     if self.get_value() != self.old_value:
         self.GetEventHandler().ProcessEvent(
             events.ChangedEvent(self.GetId(), self.get_value(),
                                 self.old_value, self))
         self.old_value = self.get_value()
     event.Skip()
예제 #2
0
 def __on_changed_slider(self, event):
     value = self._slider_to_value(event.get_value())
     if self.value != value or self.value != self.old_value:
         self.value = value
         self.text_ctrl.set_value(self._value_to_text(value))
         self.GetEventHandler().ProcessEvent(
             events.ChangedEvent(self.GetId(), value, self.old_value, self))
         self.old_value = value
예제 #3
0
 def __on_generic_event(self, event):
     if not self.slider_held and self.GetValue() != self.old_value:
         self.GetEventHandler().ProcessEvent(
             events.ChangedEvent( self.GetId(), self.GetValue(),
                 self.old_value, self )
             )
         self.old_value = self.GetValue()
     event.Skip()
예제 #4
0
 def __on_accept_changes(self, event):
     if self.__is_new_value():
         new_value = self.text.GetValue()
         old_value = self.old_value
         if self.validator != None:
             if not self.validator(new_value):
                 self.text.SetValue(self.old_value)
                 self.__update_ok_button()
                 return
         self.old_value = new_value
         self.__update_ok_button()
         self.GetEventHandler().ProcessEvent(
             events.ChangedEvent(self.GetId(), new_value, old_value, self))
예제 #5
0
 def __on_changed(self, event):
     """
     Generates a 'changed' event for the property that has changed
     
     The property may not be necessarily be the one that originated the event,
     but the one that represents an 'append' operation by the user.
     For instance, a change in the component of a vector will cause a
     'changed' event to be thrown for the vector property, not for the
     component.
     """   
     if self.selected_pid != None:
         p = self.properties[ str(self.selected_pid) ]
         if p.format[Format_Editor] == Editor_Slider_Int or p.format[Format_Editor] == Editor_Slider_Float:
             p.property.SetValueFromString(
                 str( self.last_control.get_value() ), 
                 0
                 )
         p.old_value = p.value
         if p.format[Format_Type] == Type_Subgroup:
             # If is a group warn to all children
             child = p.first_child
             while child is not None:
                 self.set_property_value(
                     child.pid, 
                     self.get_property_value(child.pid)
                     )
                 self.GetEventHandler().ProcessEvent( events.ChangedEvent(
                         self.GetId(),
                         PropertyInfo( child.value, child.pid ),
                         PropertyInfo( child.old_value, child.pid ),
                         self
                         ) )
                 # If have more than one param not send signals for all children
                 # Yes...I know that the data structure must not be used here...
                 # If you find a better way to know if the property is a group of
                 # commands or a group of parameters you are free to change it :P
                 if p.data['multiparam']:
                     child = None                    
                 else:                    
                     child = child.next
         else:       
             # Update property copy values
             self.set_property_value( p.pid, self.get_property_value(p.pid) )
         
         # Update parent copy values
         parent = p.parent
         while parent is not None:
             parent.old_value = parent.value
             parent.value = []
             child = parent.first_child
             while child is not None:
                 parent.value.append( self.get_property_value(child.pid) )
                 child = child.next
             parent = parent.parent
         
         # If parent is a vector, make the vector property throw the event
         # instead of its child property
         if p.parent is not None:
             if self.__is_vector_property(p.parent):
                 p = p.parent
 
         if p.format[Format_Type] != Type_Subgroup:
             self.GetEventHandler().ProcessEvent( events.ChangedEvent(
                 self.GetId(),
                 PropertyInfo( p.value, p.pid ),
                 PropertyInfo( p.old_value, p.pid ),
                 self
                 ) )
         self.Refresh()
     else:
         # maybe is a flag property
         for flag in self.flags_properties:
             p = self.properties[ flag ]
             value = self.get_property_value ( flag )
             self.GetEventHandler().ProcessEvent(
                 events.ChangedEvent(
                     self.GetId(),
                     PropertyInfo( value, p.pid ),
                     PropertyInfo( p.value, p.pid),
                     self
                     )
                 )
     event.Skip()
예제 #6
0
 def __changed_color(self, color):
     self.color = color
     self.GetEventHandler().ProcessEvent(
         events.ChangedEvent(self.GetId(), color, self.old_color, self))
     self.old_color = color
예제 #7
0
 def __on_choice(self, event):
     self.GetEventHandler().ProcessEvent(
         events.ChangedEvent(self.GetId(), self.GetSelection(),
                             self.old_selection, self))
     self.old_selection = self.GetSelection()
     event.Skip()
예제 #8
0
def signal_fsm_change(emitter, value=None, oldvalue=None):
    """Throw an events.EVT_CHANGED event coming from the given object"""
    emitter.GetEventHandler().ProcessEvent(
        events.ChangedEvent(emitter.GetId(), value, oldvalue, emitter))