Exemple #1
0
    def __init__(self):
        '''
        Constructor
        '''
        cellRendererText = CellRendererText()

        treeViewColumn = TreeViewColumn()
        treeViewColumn.pack_start(cellRendererText)

        treeView = TreeView()
        treeView.append_column(treeViewColumn)

        scrolledWindow = ScrolledWindow()
        scrolledWindow.add(treeView)

        btnAdd_Alternative = Button()
        btnDel_Alternative = Button()

        hButtonBox = HButtonBox()
        hButtonBox.pack_start(btnAdd_Alternative)
        hButtonBox.pack_start(btnDel_Alternative)

        vBox = VBox()
        vBox.pack_start(scrolledWindow)
        vBox.pack_start(hButtonBox)

        self.add(vBox)
Exemple #2
0
 def __init__(self, name='UDBar'):
     HBox.__init__(self)
     self.set_name(name)
     self.ubutton = Button('update')
     self.dbutton = Button('diff')
     self.pack_start(self.ubutton, 0, 0, 0)
     self.pack_end(self.dbutton, 0, 0, 0)
     self.ubutton.show()
     self.dbutton.show()
     self.show()
 def __init__(self):
     tip = Tooltips()
     ok = Button(stock=STOCK_OK)
     ok.connect("clicked", self.ok_pressed)
     apply = Button(stock=STOCK_APPLY)
     apply.connect("clicked", self.apply_pressed)
     reset = Button(stock=STOCK_REDO)
     reset.connect("clicked", self.reset_pressed)
     cancel = Button(stock=STOCK_CANCEL)
     cancel.connect("clicked", self.cancel_pressed)
     self.add(ok)
     self.add(apply)
     self.add(reset)
     self.add(cancel)
Exemple #4
0
 def __init__(self, name='GenDialog'):
     gtkDialog.__init__(self)
     self.set_name(name)
     self.ok_button = Button('ok', 'gtk-ok')
     self.ok_button.set_name(name)
     self.cancel_button = Button('cancel', 'gtk-cancel')
     self.cancel_button.set_name(name)
     self.action_area.pack_start(self.ok_button, TRUE, TRUE, 0)
     self.action_area.pack_end(self.cancel_button, TRUE, TRUE, 0)
     self.ok_button.show()
     self.cancel_button.show()
     self.cancel_button.connect('clicked', lambda *x: self.destroy())
     self._buttons_ = {}
     self.show()
Exemple #5
0
 def __init__(self, suites, name='SuiteBar'):
     HBox.__init__(self)
     self.set_name(name)
     self.lcombo = MyCombo(suites)
     self.lcombo.set(suites[0])
     self.rcombo = MyCombo(suites)
     self.rcombo.set(suites[0])
     self.ubutton = Button('update')
     self.dbutton = Button('diff')
     self.pack_start(self.lcombo, 0, 0, 0)
     self.pack_end(self.rcombo, 0, 0, 0)
     self.add(self.ubutton)
     self.add(self.dbutton)
     self.ubutton.show()
     self.dbutton.show()
     self.show()
Exemple #6
0
 def __init__(self, item, name='ItemButton'):
     HBox.__init__(self)
     self.set_name(name)
     self._key_, self._val_ = item
     self.label = Label(self._key_)
     self.button = Button(label=self._val_)
     self.pack_start(self.label, 0, 0, 0)
     self.pack_end(self.button, 1, 1, 5)
     map(lambda x: x.show(), [self.label, self.button])
     self.show()
Exemple #7
0
 def __get_button(self):
     from gtk import Button
     button = Button()
     button.set_property("focus-on-click", False)
     button.set_property("can-default", False)
     button.set_property("can-focus", False)
     button.set_property("has-default", False)
     button.set_property("is-focus", False)
     button.set_property("receives-default", False)
     button.set_property("receives-default", False)
     return button
Exemple #8
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)
Exemple #9
0
 def __init__(self, name='TraitBar'):
     HBox.__init__(self)
     self.set_name(name)
     self.lcombo = MyCombo()
     self.rcombo = MyCombo()
     self.lcombo.set('')
     self.rcombo.set('')
     self.cbutton = Button('clear')
     self.cbutton.show()
     self.pack_start(self.lcombo, 0, 0, 0)
     self.pack_end(self.rcombo, 0, 0, 0)
     self.add(self.cbutton)
     self.show()
 def initXdbox(self):
     self.xdbox = Window()
     try:
         self.xdbox.set_title(str(self.node))
     except:
         pass
     vbox = VBox()
     self.xdbox.expr = MDSplusExprWidget()
     vbox.pack_start(self.xdbox.expr, True, True, 20)
     close = Button(stock=STOCK_CLOSE)
     close.connect("clicked", self.xdbox_close)
     redo = Button(stock=STOCK_REDO)
     redo.connect("clicked", self.xdbox_redo)
     cancel = Button(stock=STOCK_CANCEL)
     cancel.connect("clicked", self.xdbox_cancel)
     hbox = HBox()
     hbox.pack_start(close, False, False, 20)
     hbox.pack_start(redo, False, False, 20)
     hbox.pack_start(cancel, False, False, 20)
     vbox.pack_start(hbox, False, False, 20)
     self.xdbox.add(vbox)
     self.xdbox.expr.set_text(self.node_value())
Exemple #11
0
    def __init__(self):
        Window.__init__(self)

        self.model = ListStore(str, str)

        self.aboutWindow = None
        self.helper = Helper(None)

        self.set_title('Gnome Custom Shortcuts')
        self.set_icon_from_file(join(data_path, 'icon.svg'))
        self.set_border_width(5)
        self.set_size_request(400, 400)

        list = TreeView()
        list.append_column(TreeViewColumn(''))
        list.append_column(TreeViewColumn('Command'))
        list.append_column(TreeViewColumn('Shortcut'))

        closeButton = Button(None, STOCK_CLOSE)
        aboutButton = Button(None, STOCK_ABOUT)

        buttonsBox = HButtonBox()
        buttonsBox.pack_start(aboutButton, False, False, 0)
        buttonsBox.pack_start(Label(''), True, True, 0)
        buttonsBox.pack_start(closeButton, False, False, 0)

        box = VBox(False, 5)
        box.pack_start(list, True, True, 0)
        box.pack_start(buttonsBox, False, False, 0)

        self.connect('destroy', main_quit, None)
        closeButton.connect('clicked', main_quit, None)
        aboutButton.connect('clicked', self.show_about, None)

        self.add(box)
        self.show_all()
Exemple #12
0
    def __init__(self, dir=None):
        HBox.__init__(self, False, 2)

        buttonImage = Image()
        buttonImage.set_from_stock(STOCK_REFRESH, ICON_SIZE_MENU)

        self.combo = ComboBox()
        self.refreshButton = Button()
        self.refreshButton.set_image(buttonImage)
        self.refreshButton.connect('clicked', self.refreshButton_clicked, None)
        self.model = ListStore(str)
        self.combo.set_model(self.model)
        self.dir = dir

        self.pack_start(self.combo, False, False, 0)
        self.pack_start(self.refreshButton, False, False, 0)

        if self.dir != None and exists(self.dir):
            self.refresh()
Exemple #13
0
    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, objectives, new):
        Expander.__init__(self)

        self.connect("enter-notify-event", self.onEnterNotifyEvent)
        self.connect("leave-notify-event", self.onLeaveNotifyEvent)

        vBox = VBox()
        self.add(vBox)

        # Data model
        self.model = ListStore(str, float)

        # Title bar
        hBox = HBox()
        self.set_property("label-widget", hBox)

        self.title = Label()
        hBox.pack_start(self.title)

        # Alternatives
        treeView = TreeView(self.model)
        #		treeView.set_headers_visible(False)
        vBox.pack_start(treeView)

        listStore_objectives = ListStore(str)
        for name in objectives:
            listStore_objectives.append((name, ))

        def combo_changed(_, path, text, model):
            model[path][0] = text

        cellRenderer = CellRendererCombo()
        cellRenderer.connect("edited", combo_changed, self.model)
        cellRenderer.set_property("text-column", 0)
        cellRenderer.set_property("editable", True)
        cellRenderer.set_property("has-entry", True)
        cellRenderer.set_property("model", listStore_objectives)

        treeViewColumn = TreeViewColumn("Alternative", cellRenderer, text=0)
        #		treeViewColumn = TreeViewColumn(None,cellRenderer,text=0)
        treeView.append_column(treeViewColumn)

        def spin_changed(_, path, value, model):
            model[path][1] = float(value.replace(",", "."))

        cellRenderer = CellRendererSpin()
        cellRenderer.connect("edited", spin_changed, self.model)
        cellRenderer.set_property("adjustment",
                                  Adjustment(1, 0, 100, 1, 10, 0))
        cellRenderer.set_property("editable", True)
        cellRenderer.set_property("digits", 2)

        treeViewColumn = TreeViewColumn(None, cellRenderer, text=1)
        treeView.append_column(treeViewColumn)

        # Add/remove alternative button box
        #		hButtonBox = HButtonBox()
        #		vBox.pack_start(hButtonBox, False)

        # Add alternative
        button = Button("gtk-add")
        button.connect("clicked", self.on_btnAdd_Alternative_clicked)
        button.set_use_stock(True)
        #		hButtonBox.pack_start(button)
        vBox.pack_start(button, False)

        #		# Remove alternative
        #		button = Button("gtk-remove")
        #		button.connect("clicked",self.on_btnDel_Alternative_clicked)
        #		button.set_use_stock(True)
        #		hButtonBox.pack_start(button)

        # Expand the requeriment and add an alternative if it's new
        if new:
            self.set_expanded(True)
            self.model.append((None, 1.0))

        # Show requeriment
        self.show_all()

        # Delete requeriment button (default is hidden)
        self.imgRemove = Image()
        self.imgRemove.connect("button-press-event", self.onDelRequeriment)
        self.imgRemove.set_from_stock("gtk-cancel", ICON_SIZE_MENU)
        hBox.pack_start(self.imgRemove)
 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
Exemple #16
0
 def add_button(self, name, func, label='foo'):
     if name not in self._buttons_.keys():
         self._buttons_[name] = Button(label)
         self._buttons_[name].show()
         self._buttons_[name].connect('clicked', func)
         self.action_area.add(self._buttons_[name])