예제 #1
0
 def _set_inconsistent(self, valuewidget, variable):
     valuewidget.modify_base(gtk.STATE_NORMAL, self.bad_colour)
     self.is_inconsistent = True
     widget_list = valuewidget.get_children()
     while widget_list:
         widget = widget_list.pop()
         widget.modify_text(gtk.STATE_NORMAL, self.bad_colour)
         if hasattr(widget, 'set_inconsistent'):
             widget.set_inconsistent(True)
         if isinstance(widget, gtk.RadioButton):
             widget.set_active(False)
         if (hasattr(widget, 'get_group')
                 and hasattr(widget.get_group(), 'set_inconsistent')):
             widget.get_group().set_inconsistent(True)
         if isinstance(widget, gtk.Entry):
             widget.modify_fg(gtk.STATE_NORMAL, self.bad_colour)
         if isinstance(widget, gtk.SpinButton):
             try:
                 v_value = float(variable.value)
                 w_value = float(widget.get_value())
             except (TypeError, ValueError):
                 widget.modify_text(gtk.STATE_NORMAL, self.hidden_colour)
             else:
                 if w_value != v_value:
                     widget.modify_text(gtk.STATE_NORMAL,
                                        self.hidden_colour)
         if hasattr(widget, 'get_children'):
             widget_list.extend(widget.get_children())
         elif hasattr(widget, 'get_child'):
             widget_list.append(widget.get_child())
예제 #2
0
파일: variable.py 프로젝트: arjclark/rose
 def _set_inconsistent(self, valuewidget, variable):
     valuewidget.modify_base(gtk.STATE_NORMAL, self.bad_colour)
     self.is_inconsistent = True
     widget_list = valuewidget.get_children()
     while widget_list:
         widget = widget_list.pop()
         widget.modify_text(gtk.STATE_NORMAL, self.bad_colour)
         if hasattr(widget, 'set_inconsistent'):
             widget.set_inconsistent(True)
         if isinstance(widget, gtk.RadioButton):
             widget.set_active(False)
         if (hasattr(widget, 'get_group') and
                 hasattr(widget.get_group(), 'set_inconsistent')):
             widget.get_group().set_inconsistent(True)
         if isinstance(widget, gtk.Entry):
             widget.modify_fg(gtk.STATE_NORMAL, self.bad_colour)
         if isinstance(widget, gtk.SpinButton):
             try:
                 v_value = float(variable.value)
                 w_value = float(widget.get_value())
             except (TypeError, ValueError):
                 widget.modify_text(gtk.STATE_NORMAL, self.hidden_colour)
             else:
                 if w_value != v_value:
                     widget.modify_text(gtk.STATE_NORMAL,
                                        self.hidden_colour)
         if hasattr(widget, 'get_children'):
             widget_list.extend(widget.get_children())
         elif hasattr(widget, 'get_child'):
             widget_list.append(widget.get_child())
예제 #3
0
 def _set_consistent(self, valuewidget, variable):
     normal_style = gtk.Style()
     normal_base = normal_style.base[gtk.STATE_NORMAL]
     normal_fg = normal_style.fg[gtk.STATE_NORMAL]
     normal_text = normal_style.text[gtk.STATE_NORMAL]
     valuewidget.modify_base(gtk.STATE_NORMAL, normal_base)
     self.is_inconsistent = True
     for widget in valuewidget.get_children():
         widget.modify_text(gtk.STATE_NORMAL, normal_text)
         if hasattr(widget, 'set_inconsistent'):
             widget.set_inconsistent(False)
         if isinstance(widget, gtk.Entry):
             widget.modify_fg(gtk.STATE_NORMAL, normal_fg)
         if (hasattr(widget, 'get_group')
                 and hasattr(widget.get_group(), 'set_inconsistent')):
             widget.get_group().set_inconsistent(False)
예제 #4
0
파일: variable.py 프로젝트: arjclark/rose
 def _set_consistent(self, valuewidget, variable):
     normal_style = gtk.Style()
     normal_base = normal_style.base[gtk.STATE_NORMAL]
     normal_fg = normal_style.fg[gtk.STATE_NORMAL]
     normal_text = normal_style.text[gtk.STATE_NORMAL]
     valuewidget.modify_base(gtk.STATE_NORMAL, normal_base)
     self.is_inconsistent = True
     for widget in valuewidget.get_children():
         widget.modify_text(gtk.STATE_NORMAL, normal_text)
         if hasattr(widget, 'set_inconsistent'):
             widget.set_inconsistent(False)
         if isinstance(widget, gtk.Entry):
             widget.modify_fg(gtk.STATE_NORMAL, normal_fg)
         if (hasattr(widget, 'get_group') and
                 hasattr(widget.get_group(), 'set_inconsistent')):
             widget.get_group().set_inconsistent(False)