示例#1
0
class MDSplusXdBoxButtonWidget(props, MDSplusWidget, Button):

    __gtype_name__ = 'MDSplusXdBoxButtonWidget'
    __gproperties__ = props.__gproperties__

    def reset(self):
        if not hasattr(self, 'xdbox'):
            self.xdbox = MDSplusXdBox(node=self.node)
            self.xdbox.putOnApply = False
        self.xdbox.reset()

    def apply(self):
        if self.putOnApply:
            try:
                if self.node.compare(self.xdbox.value) != 1:
                    self.node.record = self.xdbox.value
                self.reset()
            except Exception:
                MDSplusErrorMsg(
                    'Error storing value',
                    'Error storing value in to %s\n\n%s' %
                    (self.node.minpath, sys.exc_info()))

    def popupXd(self, button):
        try:
            self.xdbox.node = self.getNode()
        except:
            pass
        self.xdbox.show()

    def __init__(self):
        Button.__init__(self)
        MDSplusWidget.__init__(self)
        if not guibuilder:
            self.connect("clicked", self.popupXd)
示例#2
0
class MDSplusXdBoxButtonWidget(props,MDSplusWidget,Button):

    __gtype_name__ = 'MDSplusXdBoxButtonWidget'
    __gproperties__=props.__gproperties__

    def reset(self):
        if not hasattr(self,'xdbox'):
            self.xdbox=MDSplusXdBox(node=self.node)
            self.xdbox.putOnApply=False
        self.xdbox.reset()

    def apply(self):
        if self.putOnApply:
            try:
                if self.node.compare(self.xdbox.value) != 1:
                    self.node.record=self.xdbox.value
                self.reset()
            except Exception:
                MDSplusErrorMsg('Error storing value','Error storing value in to %s\n\n%s' % (self.node.minpath,sys.exc_info()))

    def popupXd(self,button):
        try:
            self.xdbox.node=self.getNode()
        except:
            pass
        self.xdbox.show()

    def __init__(self):
        Button.__init__(self)
        MDSplusWidget.__init__(self)
        if not guibuilder:
            self.connect("clicked",self.popupXd)
示例#3
0
 def popupXd(self, button):
     if not hasattr(self, 'xdbox'):
         self.xdbox = MDSplusXdBox(self.node)
         self.xdbox.putOnApply = False
         self.xdbox.on.connect('toggled', self.xd_state_changed)
         self.node_state.connect('toggled', self.node_state_changed)
     self.xdbox.node = self.getNode()
     self.xdbox.set_title(self.buttonLabel)
     self.xdbox.on.set_active(self.node_state.get_active())
     self.xdbox.show()
class MDSplusXdBoxButtonWidget(props,MDSplusWidget,Button):

    __gtype_name__ = 'MDSplusXdBoxButtonWidget'
    __gproperties__=props.__gproperties__

    def reset(self):
        if not hasattr(self,'xdbox'):
            self.xdbox=MDSplusXdBox(node=self.node)
            self.xdbox.putOnApply=False
        self.xdbox.reset()

    def apply(self):
        if self.putOnApply:
            try:
                if self.node.compare(self.xdbox.value) != 1:
                    self.node.record=self.xdbox.value
                self.reset()
            except Exception,e:
                MDSplusErrorMsg('Error storing value','Error storing value in to %s\n\n%s' % (self.node.minpath,e))
示例#5
0
 def popupXd(self,button):
     if not hasattr(self,'xdbox'):
         self.xdbox=MDSplusXdBox(self.node)
         self.xdbox.putOnApply=False
         self.xdbox.on.connect('toggled',self.xd_state_changed)
         self.node_state.connect('toggled',self.node_state_changed)
     self.xdbox.node=self.getNode()
     self.xdbox.set_title(self.buttonLabel)
     self.xdbox.on.set_active(self.node_state.get_active())
     self.xdbox.show()
示例#6
0
 def reset(self):
     if not hasattr(self, 'xdbox'):
         self.xdbox = MDSplusXdBox(node=self.node)
         self.xdbox.putOnApply = False
     self.xdbox.reset()
示例#7
0
 def reset(self):
     if not hasattr(self,'xdbox'):
         self.xdbox=MDSplusXdBox(node=self.node)
         self.xdbox.putOnApply=False
     self.xdbox.reset()
示例#8
0
class MDSplusOnOffXdBoxWidget(props, MDSplusWidget, HBox):

    __gtype_name__ = 'MDSplusOnOffXdBoxWidget'
    __gproperties__ = props.__gproperties__

    def reset(self):
        self.node_state.set_active(self.node.on)
        self.node_state.set_label('')
        if hasattr(self, 'xdbox'):
            self.xdbox.reset()

    def apply(self):
        if self.putOnApply:
            if self.node.on != self.node_state.get_active():
                try:
                    self.node.on = self.node_state.get_active()
                except Exception:
                    if self.node_state.get_active():
                        state = 'on'
                    else:
                        state = 'off'
                    MDSplusErrorMsg(
                        'Error setting node on/off state',
                        'Error turning node %s %s\n\n%s' %
                        (self.node.minpath, state, sys.exc_info()))
                    raise
            if hasattr(self, 'xdbox'):
                try:
                    if self.node.compare(self.xdbox.value) != 1:
                        self.node.record = self.xdbox.value
                    self.reset()
                except Exception:
                    MDSplusErrorMsg(
                        'Error storing value',
                        'Error storing value in to %s\n\n%s' %
                        (self.node.minpath, sys.exc_info()))

    def xd_state_changed(self, button):
        self.node_state.set_active(self.xdbox.on.get_active())

    def node_state_changed(self, button):
        self.xdbox.on.set_active(self.node_state.get_active())

    def popupXd(self, button):
        if not hasattr(self, 'xdbox'):
            self.xdbox = MDSplusXdBox(self.node)
            self.xdbox.putOnApply = False
            self.xdbox.on.connect('toggled', self.xd_state_changed)
            self.node_state.connect('toggled', self.node_state_changed)
        self.xdbox.node = self.getNode()
        self.xdbox.set_title(self.buttonLabel)
        self.xdbox.on.set_active(self.node_state.get_active())
        self.xdbox.show()

    def setButtonLabel(self, button):
        self.button.set_label(self.buttonLabel)

    def __init__(self):
        HBox.__init__(self)
        MDSplusWidget.__init__(self)
        HBox.set_homogeneous(self, False)
        self.node_state = CheckButton('')
        self.button = Button()
        HBox.pack_start(self, self.node_state, False, False, 0)
        HBox.pack_start(self, self.button, False, False, 0)
        HBox.pack_start(self, Label(''), True, False, 0)
        if not guibuilder:
            self.button.connect("clicked", self.popupXd)
        self.button.connect("realize", self.setButtonLabel)

    def show(self):
        self.show_all()
示例#9
0
class MDSplusOnOffXdBoxWidget(props,MDSplusWidget,HBox):

    __gtype_name__ = 'MDSplusOnOffXdBoxWidget'
    __gproperties__= props.__gproperties__

    def reset(self):
        self.node_state.set_active(self.node.on)
        self.node_state.set_label('')
        if hasattr(self,'xdbox'):
            self.xdbox.reset()

    def apply(self):
        if self.putOnApply:
            if self.node.on != self.node_state.get_active():
                try:
                    self.node.on=self.node_state.get_active()
                except Exception:
                    if self.node_state.get_active():
                        state='on'
                    else:
                        state='off'
                    MDSplusErrorMsg('Error setting node on/off state','Error turning node %s %s\n\n%s' % (self.node.minpath,state,sys.exc_info()))
                    raise
            if hasattr(self,'xdbox'):
                try:
                    if self.node.compare(self.xdbox.value) != 1:
                        self.node.record=self.xdbox.value
                    self.reset()
                except Exception:
                    MDSplusErrorMsg('Error storing value','Error storing value in to %s\n\n%s' % (self.node.minpath,sys.exc_info()))

    def xd_state_changed(self,button):
        self.node_state.set_active(self.xdbox.on.get_active())

    def node_state_changed(self,button):
        self.xdbox.on.set_active(self.node_state.get_active())
        
    def popupXd(self,button):
        if not hasattr(self,'xdbox'):
            self.xdbox=MDSplusXdBox(self.node)
            self.xdbox.putOnApply=False
            self.xdbox.on.connect('toggled',self.xd_state_changed)
            self.node_state.connect('toggled',self.node_state_changed)
        self.xdbox.node=self.getNode()
        self.xdbox.set_title(self.buttonLabel)
        self.xdbox.on.set_active(self.node_state.get_active())
        self.xdbox.show()

    def setButtonLabel(self,button):
        self.button.set_label(self.buttonLabel)

    def __init__(self):
        HBox.__init__(self)
        MDSplusWidget.__init__(self)
        HBox.set_homogeneous(self,False)
        self.node_state=CheckButton('')
        self.button=Button()
        HBox.pack_start(self,self.node_state,False,False,0)
        HBox.pack_start(self,self.button,False,False,0)
        HBox.pack_start(self,Label(''),True,False,0)
        if not guibuilder:
            self.button.connect("clicked",self.popupXd)
        self.button.connect("realize",self.setButtonLabel)

    def show(self):
        self.show_all()