def __init__(self, value=None): super(MDSplusMethodWidget, self).__init__(rows=4, columns=2, homogeneous=False) self.device = Entry() self.method = Entry() self.args = list() self.argTable = Table(rows=8, columns=2, homogeneous=False) for i in range(8): self.args.append(Entry()) self.argTable.attach(Label("Arg %d: " % (i + 1, )), 0, 1, i, i + 1, 0, 0) self.argTable.attach(self.args[i], 1, 2, i, i + 1, EXPAND | FILL, 0) self.scrolledWindow = ScrolledWindow() self.scrolledWindow.add_with_viewport(self.argTable) self.scrolledWindow.set_policy(POLICY_NEVER, POLICY_ALWAYS) adj = self.scrolledWindow.get_vadjustment() adj.connect("changed", adj_changed) self.timeout = Entry() self.attach(Label("Device:"), 0, 1, 0, 1, 0, 0) self.attach(self.device, 1, 2, 0, 1, EXPAND | FILL, 0) self.attach(Label("Method:"), 0, 1, 1, 2, 0, 0) self.attach(self.method, 1, 2, 1, 2, EXPAND | FILL, 0) self.attach(self.scrolledWindow, 0, 2, 2, 3) self.attach(Label("Timeout:"), 0, 1, 3, 4, 0, 0) self.attach(self.timeout, 1, 2, 3, 4, EXPAND | FILL, 0) self.set_row_spacings(5) self.value = value
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)
def __init__(self,value=None): super(MDSplusRangeWidget,self).__init__(rows=3,columns=2,homogeneous=False) self.begin=Entry() self.ending=Entry() self.delta=Entry() self.attach(Label("Begin: "),0,1,0,1,0,0) self.attach(self.begin,1,2,0,1,EXPAND|FILL,0) self.attach(Label("Ending: "),0,1,1,2,0,0) self.attach(self.ending,1,2,1,2,EXPAND|FILL,0) self.attach(Label("Delta:"),0,1,2,3,0,0) self.attach(self.delta,1,2,2,3,EXPAND|FILL,0) self.set_row_spacings(5) self.value=value
def __init__(self,value=None): super(MDSplusWindowWidget,self).__init__(rows=3,columns=2,homogeneous=False) self.startIdx=Entry() self.endIdx=Entry() self.timeAt0=Entry() self.attach(Label("StartIdx: "),0,1,0,1,0,0) self.attach(self.startIdx,1,2,0,1,EXPAND|FILL,0) self.attach(Label("EndIdx: "),0,1,1,2,0,0) self.attach(self.endIdx,1,2,1,2,EXPAND|FILL,0) self.attach(Label("TimeAt0:"),0,1,2,3,0,0) self.attach(self.timeAt0,1,2,2,3,EXPAND|FILL,0) self.set_row_spacings(5) self.value=value
def __init__(self, value=None): super(MDSplusSequentialWidget, self).__init__( rows=4, columns=2, homogeneous=False) self.ident = Entry() self.phase = Entry() self.sequence = Entry() self.event = Entry() self.attach(Label("Server: "), 0, 1, 0, 1, 0, 0) self.attach(self.ident, 1, 2, 0, 1, EXPAND | FILL, 0) self.attach(Label("Phase: "), 0, 1, 1, 2, 0, 0) self.attach(self.phase, 1, 2, 1, 2, EXPAND | FILL, 0) self.attach(Label("Sequence:"), 0, 1, 2, 3, 0, 0) self.attach(self.sequence, 1, 2, 2, 3, EXPAND | FILL, 0) self.attach(Label("Event: "), 0, 1, 3, 4, 0, 0) self.attach(self.event, 1, 2, 3, 4, EXPAND | FILL, 0) self.set_row_spacings(5) self.value = value
def __init__(self): Table.__init__(self, 1, 5) self.entry1 = Entry() self.entry2 = Entry() self.button = Button("Search") self.attach(self.entry1, 0, 1, 0, 1) self.attach(self.entry2, 1, 2, 0, 1) self.attach(self.button, 2, 3, 0, 1) self.entry1.set_width_chars(12) self.entry2.set_width_chars(12) self.entry1.set_text("59.666042") self.entry2.set_text("16.481794") self.button.connect('clicked', self.clicked)
def __init__(self, item, name='ItemEntry'): HBox.__init__(self) self.set_name(name) self._key_, self._val_ = item self.label = Label(self._key_) self.entry = Entry() self.entry.set_text(self._val_) self.pack_start(self.label, 0, 0, 0) self.pack_end(self.entry, 0, 0, 0) map(lambda x: x.show(), [self.label, self.entry]) self.show()
def __init__(self, name, default=None): HBox.__init__(self) self.set_name(name) self.label = Label(name) self.entry = Entry() self.pack_start(self.label, TRUE, TRUE, 0) self.add(self.entry) self.label.show() self.entry.show() if default: self.set(default) self.show()
def __init__(self, item, name='ItemEntry'): if len(item) != 2: raise Error, 'ItemEntry needs item not %s' % item field, value = item HBox.__init__(self) self.set_name(name) self.label = Label(field) self.pack_start(self.label, FALSE, FALSE, 0) self.entry = Entry() self.set(str(value)) self.pack_end(self.entry, TRUE, TRUE, 0) self.label.show() self.entry.show() self.show()
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