Exemplo n.º 1
0
 def setupChannels(self):
     for child in self.table.get_children():
         child.destroy()
     if self.incNidOffset > -1:
         columns = 6
     else:
         columns = 5
     self.table.resize(self.numChannels + 1, columns)
     self.table.attach(Label(""), 0, 1, 0, 1, 0, 0, 10, 0)
     self.table.attach(Label("On"), 1, 2, 0, 1, 0, 0, 10, 0)
     self.table.attach(Label("StartIdx"), 2, 3, 0, 1, EXPAND | FILL, 0, 10,
                       0)
     self.table.attach(Label("EndIdx"), 3, 4, 0, 1, EXPAND | FILL, 0, 10, 0)
     if self.incNidOffset > -1:
         self.table.attach(Label("Increment"), 4, 5, 0, 1, EXPAND | FILL, 0,
                           10, 0)
     self.table.attach(Label("Path"), columns - 1, columns, 0, 1, 0, 0, 10,
                       0)
     self.channels = list()
     for chan in range(self.numChannels):
         channel = dict()
         self.channels.append(channel)
         channel['number'] = Label("%d" % (chan + 1, ))
         self.table.attach(channel['number'], 0, 1, chan + 1, chan + 2, 0,
                           0, 10, 0)
         channel['on'] = CheckButton('')
         self.table.attach(channel['on'], 1, 2, chan + 1, chan + 2, 0, 0,
                           10, 0)
         channel['startIdx'] = Entry()
         self.table.attach(channel['startIdx'], 2, 3, chan + 1, chan + 2,
                           EXPAND | FILL, 0, 10, 0)
         channel['endIdx'] = Entry()
         self.table.attach(channel['endIdx'], 3, 4, chan + 1, chan + 2,
                           EXPAND | FILL, 0, 10, 0)
         if self.incNidOffset > -1:
             channel['inc'] = Entry()
             self.table.attach(channel['inc'], 4, 5, chan + 1, chan + 2,
                               EXPAND | FILL, 0, 10, 0)
         channel['path'] = Label('                   ')
         self.table.attach(channel['path'], columns - 1, columns, chan + 1,
                           chan + 2, 0, 0, 10, 0)
     self.show_all()
     if not guibuilder:
         for chan in range(self.numChannels):
             chanNidOffset = self.node.nid + chan * self.nodesPerChannel
             channel = self.channels[chan]
             channel['dataNode'] = TreeNode(
                 chanNidOffset + self.dataNidOffset, self.node.tree)
             channel['startIdxNode'] = TreeNode(
                 chanNidOffset + self.startIdxNidOffset, self.node.tree)
             channel['endIdxNode'] = TreeNode(
                 chanNidOffset + self.endIdxNidOffset, self.node.tree)
             if self.incNidOffset > -1:
                 channel['incNode'] = TreeNode(
                     chanNidOffset + self.incNidOffset, self.node.tree)
Exemplo n.º 2
0
 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)
Exemplo n.º 3
0
 def __init__(self, node=None, value=None):
     Window.__init__(self)
     MDSplusWidget.__init__(self)
     if node is not None:
         self.node = node
     else:
         self.value = value
     hbtop = HBox(homogeneous=False)
     self.on = CheckButton(label="On")
     self.parent_on = CheckButton(label="Parent")
     self.parent_on.set_sensitive(False)
     self.path = MDSplusPathWidget()
     if node is not None:
         self.path._node = self._node
     hbtags = HBox(homogeneous=False)
     self.tags = Entry()
     self.tags.set_width_chars(60)
     expression_menu = self.dtype_menu(tuple(), varname="dtype_expression", no_show=True)
     axis_menu = self.dtype_menu(("Range",), varname="dtype_axis", no_show=True)
     window_menu = self.dtype_menu(("Window",), varname="dtype_window", no_show=True)
     dispatch_menu = self.dtype_menu(("Dispatch",), varname="dtype_dispatch", no_show=True)
     action_menu = self.dtype_menu(("Action",), varname="dtype_action", no_show=True)
     task_menu = self.dtype_menu(("Method", "Routine"), varname="dtype_task", no_show=True)
     any_menu = self.dtype_menu(
         ("Range", "Window", "Dispatch", "Action", "Method", "Routine"), varname="dtype_any", no_show=True
     )
     menus = (
         self.dtype_expression,
         self.dtype_axis,
         self.dtype_dispatch,
         self.dtype_action,
         self.dtype_task,
         self.dtype_window,
         self.dtype_any,
     )
     hbtop.pack_start(self.on, False, False, 10)
     hbtop.pack_start(self.parent_on, False, False, 10)
     hbtop.pack_start(self.path, False, False, 0)
     hbtags.pack_start(Label("Tags:"), False, False, 10)
     hbtags.pack_start(self.tags, False, False, 0)
     self.action = MDSplusActionWidget()
     self.windoww = MDSplusWindowWidget()
     self.sequential = MDSplusSequentialWidget()
     self.expression = MDSplusExpressionWidget()
     self.method = MDSplusMethodWidget()
     self.routine = MDSplusRoutineWidget()
     self.dispatch = MDSplusDispatchWidget()
     self.range = MDSplusRangeWidget()
     self.widgets = (
         self.action,
         self.sequential,
         self.expression,
         self.method,
         self.routine,
         self.dispatch,
         self.range,
         self.windoww,
     )
     self.ok = Button(stock=STOCK_OK)
     self.cancel = Button(stock=STOCK_CANCEL)
     self.redo = Button(stock=STOCK_REDO)
     self.ok.connect("clicked", self.do_ok)
     self.cancel.connect("clicked", self.do_cancel)
     self.redo.connect("clicked", self.do_redo)
     hb2 = HBox()
     hb2.add(self.ok)
     hb2.add(self.redo)
     hb2.add(self.cancel)
     vb = VBox(homogeneous=False)
     vb.set_border_width(10)
     vb.pack_start(hbtop, False, False, 0)
     vb.pack_start(hbtags, False, False, 0)
     vb.pack_start(expression_menu, False, False, 0)
     vb.pack_start(axis_menu, False, False, 0)
     vb.pack_start(window_menu, False, False, 0)
     vb.pack_start(dispatch_menu, False, False, 0)
     vb.pack_start(action_menu, False, False, 0)
     vb.pack_start(task_menu, False, False, 0)
     vb.pack_start(any_menu, False, False, 0)
     for w in self.widgets:
         w.set_no_show_all(True)
         vb.pack_start(w, False, False, 0)
     vb.pack_start(hb2, False, False, 20)
     self.add(vb)
     self.do_redo(self.redo)
     self.putOnApply = True
     self.nidOffset = -1
Exemplo n.º 4
0
class MDSplusXdBox(props, MDSplusDtypeSelWidget, MDSplusWidget, Window):

    __gtype_name__ = "MDSplusXdBox"

    def inHBox(self, w):
        hb = HBox()
        hb.pack_start(w, False, False, 0)
        return hb

    def __init__(self, node=None, value=None):
        Window.__init__(self)
        MDSplusWidget.__init__(self)
        if node is not None:
            self.node = node
        else:
            self.value = value
        hbtop = HBox(homogeneous=False)
        self.on = CheckButton(label="On")
        self.parent_on = CheckButton(label="Parent")
        self.parent_on.set_sensitive(False)
        self.path = MDSplusPathWidget()
        if node is not None:
            self.path._node = self._node
        hbtags = HBox(homogeneous=False)
        self.tags = Entry()
        self.tags.set_width_chars(60)
        expression_menu = self.dtype_menu(tuple(), varname="dtype_expression", no_show=True)
        axis_menu = self.dtype_menu(("Range",), varname="dtype_axis", no_show=True)
        window_menu = self.dtype_menu(("Window",), varname="dtype_window", no_show=True)
        dispatch_menu = self.dtype_menu(("Dispatch",), varname="dtype_dispatch", no_show=True)
        action_menu = self.dtype_menu(("Action",), varname="dtype_action", no_show=True)
        task_menu = self.dtype_menu(("Method", "Routine"), varname="dtype_task", no_show=True)
        any_menu = self.dtype_menu(
            ("Range", "Window", "Dispatch", "Action", "Method", "Routine"), varname="dtype_any", no_show=True
        )
        menus = (
            self.dtype_expression,
            self.dtype_axis,
            self.dtype_dispatch,
            self.dtype_action,
            self.dtype_task,
            self.dtype_window,
            self.dtype_any,
        )
        hbtop.pack_start(self.on, False, False, 10)
        hbtop.pack_start(self.parent_on, False, False, 10)
        hbtop.pack_start(self.path, False, False, 0)
        hbtags.pack_start(Label("Tags:"), False, False, 10)
        hbtags.pack_start(self.tags, False, False, 0)
        self.action = MDSplusActionWidget()
        self.windoww = MDSplusWindowWidget()
        self.sequential = MDSplusSequentialWidget()
        self.expression = MDSplusExpressionWidget()
        self.method = MDSplusMethodWidget()
        self.routine = MDSplusRoutineWidget()
        self.dispatch = MDSplusDispatchWidget()
        self.range = MDSplusRangeWidget()
        self.widgets = (
            self.action,
            self.sequential,
            self.expression,
            self.method,
            self.routine,
            self.dispatch,
            self.range,
            self.windoww,
        )
        self.ok = Button(stock=STOCK_OK)
        self.cancel = Button(stock=STOCK_CANCEL)
        self.redo = Button(stock=STOCK_REDO)
        self.ok.connect("clicked", self.do_ok)
        self.cancel.connect("clicked", self.do_cancel)
        self.redo.connect("clicked", self.do_redo)
        hb2 = HBox()
        hb2.add(self.ok)
        hb2.add(self.redo)
        hb2.add(self.cancel)
        vb = VBox(homogeneous=False)
        vb.set_border_width(10)
        vb.pack_start(hbtop, False, False, 0)
        vb.pack_start(hbtags, False, False, 0)
        vb.pack_start(expression_menu, False, False, 0)
        vb.pack_start(axis_menu, False, False, 0)
        vb.pack_start(window_menu, False, False, 0)
        vb.pack_start(dispatch_menu, False, False, 0)
        vb.pack_start(action_menu, False, False, 0)
        vb.pack_start(task_menu, False, False, 0)
        vb.pack_start(any_menu, False, False, 0)
        for w in self.widgets:
            w.set_no_show_all(True)
            vb.pack_start(w, False, False, 0)
        vb.pack_start(hb2, False, False, 20)
        self.add(vb)
        self.do_redo(self.redo)
        self.putOnApply = True
        self.nidOffset = -1

    def set_dtype(self):
        if hasattr(self, "_node"):
            try:
                exec("self.dtype=self.dtype_%s" % (self.node.usage.lower(),))
            except Exception:
                self.dtype = self.dtype_expression
        else:
            self.dtype = self.dtype_any
        self.dtype.set_no_show_all(False)

    def do_ok(self, button):
        try:
            value = self.value
            if not self.putOnApply:
                self.hide()
            elif hasattr(self, "_node"):
                try:
                    self.node.record = value
                    self.hide()
                except Exception:
                    self.popupError(sys.exc_info())
            else:
                self.value = value
                self.hide()
        except:
            pass

    def do_redo(self, button):
        if not hasattr(self, "_node"):
            self.value = _value
            self.set_dtype()
        else:
            self.path.reset()
            self.on.set_active(self.node.disabled == False)
            self.parent_on.set_active(self.node.parent_disabled == False)
            tags = self.node.tags
            if tags is None:
                self.tags.set_text("")
            else:
                taglist = ""
                for tag in tags:
                    if taglist == "":
                        taglist = tag
                    else:
                        taglist = taglist + "," + tag
                self.tags.set_text(taglist)
            self.set_dtype()
            try:
                self.value = self.record
            except:
                self.value = None
        self.reset()

    def do_cancel(self, button):
        self.hide()
Exemplo n.º 5
0
class MDSplusXdBox(props,MDSplusDtypeSelWidget,MDSplusWidget,Window):

    __gtype_name__ = 'MDSplusXdBox'

    def inHBox(self,w):
        hb=HBox()
        hb.pack_start(w,False,False,0)
        return hb
        
    def __init__(self,node=None,value=None):
        Window.__init__(self)
        MDSplusWidget.__init__(self)
        if node is not None:
            self.node=node
        else:
            self.value=value
        hbtop=HBox(homogeneous=False)
        self.on=CheckButton(label="On")
        self.parent_on=CheckButton(label="Parent")
        self.parent_on.set_sensitive(False)
        self.path=MDSplusPathWidget()
        if node is not None:
            self.path._node=self._node
        hbtags=HBox(homogeneous=False)
        self.tags=Entry()
        self.tags.set_width_chars(60)
        expression_menu=self.dtype_menu(tuple(),varname='dtype_expression',no_show=True)
        axis_menu=self.dtype_menu(('Range',),varname='dtype_axis',no_show=True)
        window_menu=self.dtype_menu(('Window',),varname='dtype_window',no_show=True)
        dispatch_menu=self.dtype_menu(('Dispatch',),varname='dtype_dispatch',no_show=True)
        action_menu=self.dtype_menu(('Action',),varname='dtype_action',no_show=True)
        task_menu=self.dtype_menu(('Method','Routine'),varname='dtype_task',no_show=True)
        any_menu=self.dtype_menu(('Range','Window','Dispatch','Action','Method','Routine'),varname='dtype_any',no_show=True)
        menus=(self.dtype_expression,self.dtype_axis,self.dtype_dispatch,self.dtype_action,self.dtype_task,self.dtype_window,self.dtype_any)
        hbtop.pack_start(self.on,False,False,10)
        hbtop.pack_start(self.parent_on,False,False,10)
        hbtop.pack_start(self.path,False,False,0)
        hbtags.pack_start(Label("Tags:"),False,False,10)
        hbtags.pack_start(self.tags,False,False,0)
        self.action=MDSplusActionWidget()
        self.windoww=MDSplusWindowWidget()
        self.sequential=MDSplusSequentialWidget()
        self.expression=MDSplusExpressionWidget()
        self.method=MDSplusMethodWidget()
        self.routine=MDSplusRoutineWidget()
        self.dispatch=MDSplusDispatchWidget()
        self.range=MDSplusRangeWidget()
        self.widgets=(self.action,self.sequential,self.expression,self.method,self.routine,self.dispatch,self.range,self.windoww)
        self.ok=Button(stock=STOCK_OK)
        self.cancel=Button(stock=STOCK_CANCEL)
        self.redo=Button(stock=STOCK_REDO)
        self.ok.connect("clicked",self.do_ok)
        self.cancel.connect("clicked",self.do_cancel)
        self.redo.connect("clicked",self.do_redo)
        hb2=HBox()
        hb2.add(self.ok)
        hb2.add(self.redo)
        hb2.add(self.cancel)
        vb=VBox(homogeneous=False)
        vb.set_border_width(10)
        vb.pack_start(hbtop,False,False,0)
        vb.pack_start(hbtags,False,False,0)
        vb.pack_start(expression_menu,False,False,0)
        vb.pack_start(axis_menu,False,False,0)
        vb.pack_start(window_menu,False,False,0)
        vb.pack_start(dispatch_menu,False,False,0)
        vb.pack_start(action_menu,False,False,0)
        vb.pack_start(task_menu,False,False,0)
        vb.pack_start(any_menu,False,False,0)
        for w in self.widgets:
            w.set_no_show_all(True)
            vb.pack_start(w,False,False,0)
        vb.pack_start(hb2,False,False,20)
        self.add(vb)
        self.do_redo(self.redo)
        self.putOnApply = True
        self.nidOffset = -1

    def set_dtype(self):
        if hasattr(self,'_node'):
            try:
                exec 'self.dtype=self.dtype_%s' % (self.node.usage.lower(),)
            except Exception,e:
                self.dtype=self.dtype_expression
        else:
Exemplo n.º 6
0
 def __init__(self,node=None,value=None):
     Window.__init__(self)
     MDSplusWidget.__init__(self)
     if node is not None:
         self.node=node
     else:
         self.value=value
     hbtop=HBox(homogeneous=False)
     self.on=CheckButton(label="On")
     self.parent_on=CheckButton(label="Parent")
     self.parent_on.set_sensitive(False)
     self.path=MDSplusPathWidget()
     if node is not None:
         self.path._node=self._node
     hbtags=HBox(homogeneous=False)
     self.tags=Entry()
     self.tags.set_width_chars(60)
     expression_menu=self.dtype_menu(tuple(),varname='dtype_expression',no_show=True)
     axis_menu=self.dtype_menu(('Range',),varname='dtype_axis',no_show=True)
     window_menu=self.dtype_menu(('Window',),varname='dtype_window',no_show=True)
     dispatch_menu=self.dtype_menu(('Dispatch',),varname='dtype_dispatch',no_show=True)
     action_menu=self.dtype_menu(('Action',),varname='dtype_action',no_show=True)
     task_menu=self.dtype_menu(('Method','Routine'),varname='dtype_task',no_show=True)
     any_menu=self.dtype_menu(('Range','Window','Dispatch','Action','Method','Routine'),varname='dtype_any',no_show=True)
     menus=(self.dtype_expression,self.dtype_axis,self.dtype_dispatch,self.dtype_action,self.dtype_task,self.dtype_window,self.dtype_any)
     hbtop.pack_start(self.on,False,False,10)
     hbtop.pack_start(self.parent_on,False,False,10)
     hbtop.pack_start(self.path,False,False,0)
     hbtags.pack_start(Label("Tags:"),False,False,10)
     hbtags.pack_start(self.tags,False,False,0)
     self.action=MDSplusActionWidget()
     self.windoww=MDSplusWindowWidget()
     self.sequential=MDSplusSequentialWidget()
     self.expression=MDSplusExpressionWidget()
     self.method=MDSplusMethodWidget()
     self.routine=MDSplusRoutineWidget()
     self.dispatch=MDSplusDispatchWidget()
     self.range=MDSplusRangeWidget()
     self.widgets=(self.action,self.sequential,self.expression,self.method,self.routine,self.dispatch,self.range,self.windoww)
     self.ok=Button(stock=STOCK_OK)
     self.cancel=Button(stock=STOCK_CANCEL)
     self.redo=Button(stock=STOCK_REDO)
     self.ok.connect("clicked",self.do_ok)
     self.cancel.connect("clicked",self.do_cancel)
     self.redo.connect("clicked",self.do_redo)
     hb2=HBox()
     hb2.add(self.ok)
     hb2.add(self.redo)
     hb2.add(self.cancel)
     vb=VBox(homogeneous=False)
     vb.set_border_width(10)
     vb.pack_start(hbtop,False,False,0)
     vb.pack_start(hbtags,False,False,0)
     vb.pack_start(expression_menu,False,False,0)
     vb.pack_start(axis_menu,False,False,0)
     vb.pack_start(window_menu,False,False,0)
     vb.pack_start(dispatch_menu,False,False,0)
     vb.pack_start(action_menu,False,False,0)
     vb.pack_start(task_menu,False,False,0)
     vb.pack_start(any_menu,False,False,0)
     for w in self.widgets:
         w.set_no_show_all(True)
         vb.pack_start(w,False,False,0)
     vb.pack_start(hb2,False,False,20)
     self.add(vb)
     self.do_redo(self.redo)
     self.putOnApply = True
     self.nidOffset = -1
Exemplo n.º 7
0
class MDSplusXdBox(props,MDSplusDtypeSelWidget,MDSplusWidget,Window):

    __gtype_name__ = 'MDSplusXdBox'

    def inHBox(self,w):
        hb=HBox()
        hb.pack_start(w,False,False,0)
        return hb
        
    def __init__(self,node=None,value=None):
        Window.__init__(self)
        MDSplusWidget.__init__(self)
        if node is not None:
            self.node=node
        else:
            self.value=value
        hbtop=HBox(homogeneous=False)
        self.on=CheckButton(label="On")
        self.parent_on=CheckButton(label="Parent")
        self.parent_on.set_sensitive(False)
        self.path=MDSplusPathWidget()
        if node is not None:
            self.path._node=self._node
        hbtags=HBox(homogeneous=False)
        self.tags=Entry()
        self.tags.set_width_chars(60)
        expression_menu=self.dtype_menu(tuple(),varname='dtype_expression',no_show=True)
        axis_menu=self.dtype_menu(('Range',),varname='dtype_axis',no_show=True)
        window_menu=self.dtype_menu(('Window',),varname='dtype_window',no_show=True)
        dispatch_menu=self.dtype_menu(('Dispatch',),varname='dtype_dispatch',no_show=True)
        action_menu=self.dtype_menu(('Action',),varname='dtype_action',no_show=True)
        task_menu=self.dtype_menu(('Method','Routine'),varname='dtype_task',no_show=True)
        any_menu=self.dtype_menu(('Range','Window','Dispatch','Action','Method','Routine'),varname='dtype_any',no_show=True)
        menus=(self.dtype_expression,self.dtype_axis,self.dtype_dispatch,self.dtype_action,self.dtype_task,self.dtype_window,self.dtype_any)
        hbtop.pack_start(self.on,False,False,10)
        hbtop.pack_start(self.parent_on,False,False,10)
        hbtop.pack_start(self.path,False,False,0)
        hbtags.pack_start(Label("Tags:"),False,False,10)
        hbtags.pack_start(self.tags,False,False,0)
        self.action=MDSplusActionWidget()
        self.windoww=MDSplusWindowWidget()
        self.sequential=MDSplusSequentialWidget()
        self.expression=MDSplusExpressionWidget()
        self.method=MDSplusMethodWidget()
        self.routine=MDSplusRoutineWidget()
        self.dispatch=MDSplusDispatchWidget()
        self.range=MDSplusRangeWidget()
        self.widgets=(self.action,self.sequential,self.expression,self.method,self.routine,self.dispatch,self.range,self.windoww)
        self.ok=Button(stock=STOCK_OK)
        self.cancel=Button(stock=STOCK_CANCEL)
        self.redo=Button(stock=STOCK_REDO)
        self.ok.connect("clicked",self.do_ok)
        self.cancel.connect("clicked",self.do_cancel)
        self.redo.connect("clicked",self.do_redo)
        hb2=HBox()
        hb2.add(self.ok)
        hb2.add(self.redo)
        hb2.add(self.cancel)
        vb=VBox(homogeneous=False)
        vb.set_border_width(10)
        vb.pack_start(hbtop,False,False,0)
        vb.pack_start(hbtags,False,False,0)
        vb.pack_start(expression_menu,False,False,0)
        vb.pack_start(axis_menu,False,False,0)
        vb.pack_start(window_menu,False,False,0)
        vb.pack_start(dispatch_menu,False,False,0)
        vb.pack_start(action_menu,False,False,0)
        vb.pack_start(task_menu,False,False,0)
        vb.pack_start(any_menu,False,False,0)
        for w in self.widgets:
            w.set_no_show_all(True)
            vb.pack_start(w,False,False,0)
        vb.pack_start(hb2,False,False,20)
        self.add(vb)
        self.do_redo(self.redo)
        self.putOnApply = True
        self.nidOffset = -1

    def set_dtype(self):
        if hasattr(self,'_node'):
            try:
                exec('self.dtype=self.dtype_%s' % (self.node.usage.lower(),))
            except Exception:
                self.dtype=self.dtype_expression
        else:
            self.dtype=self.dtype_any
        self.dtype.set_no_show_all(False)
            
    def do_ok(self,button):
        try:
            value=self.value
            if not self.putOnApply:
                self.hide()
            elif hasattr(self,'_node'):
                try:
                    self.node.record=value
                    self.hide()
                except Exception:
                    self.popupError(sys.exc_info()[1])
            else:
                self.value=value
                self.hide()
        except:
            pass

    def do_redo(self,button):
        if not hasattr(self,'_node'):
            self.value=_value
            self.set_dtype()
        else:
            self.path.reset()
            self.on.set_active(self.node.disabled==False)
            self.parent_on.set_active(self.node.parent_disabled==False)
            tags = self.node.tags
            if tags is None:
                self.tags.set_text('')
            else:
                taglist=''
                for tag in tags:
                    if taglist == '':
                        taglist=tag
                    else:
                        taglist=taglist+','+tag
                self.tags.set_text(taglist)
            self.set_dtype()
            try:
                self.value=self.record
            except:
                self.value=None
        self.reset()

    def do_cancel(self,button):
        self.hide()