Example #1
0
def main():
    gui.images.register('close', Image.open('../data/images/close.png'))
    gui.images.register_dir('../data/images/')

    win = gui.Window(title='Mingui doc/demo', size=(640, 480))
    gui.base.app.mainwin = win
    box = gui.Box(win.place(), 'vertical')

    split = gui.Splitter(box.place(), 'vertical')

    panel = Panel(split.place(width=100), 'top')
    btn = gui.Button(panel.place(image='close'), 'arse')
    tree = gui.Tree(panel.place(image='open'), columns=['Topics'])
    root = gui.TreeNode()
    child = gui.TreeNode()
    root.append(child)
    tree.append(root)
    panel.toolbar.Realize()

    split2 = gui.Splitter(split.place(), 'horizontal')
    panel2 = Panel(split2.place(width=100), 'left')
    btn = gui.Button(panel2.place(image='close'), 'arse')
    panel2.toolbar.Realize()

    book = gui.Notebook(split2.place())
    html = gui.Html(book.place(label='text'))
    html.SetPage('html/index.html')
    code = gui.Text(book.place(label='code'), multiline=True, text='hello!')
    demo = gui.Box(book.place(label='demo'))

    button = gui.Button(demo.place(expand=False, stretch=0), 'button')
    toggle = gui.Button(demo.place(expand=False, stretch=0),
                        'button',
                        toggle=True)
    toggle.connect('toggled', handler)
    toggle.connect('clicked', handler)

    bar = gui.Menubar(win.place())
    menu = gui.Menu(bar, 'Foo')
    menu.append(callable)

    toggle.text = 'aaa'

    def on_changed():
        split.resize_child(tree, 100)

    btn = gui.Button(box.place(stretch=0),
                     'Close',
                     connect={'clicked': win.close})
    btn = gui.Button(box.place(stretch=0),
                     'Change',
                     connect={'clicked': on_changed})

    gui.run(win)
Example #2
0
 def on_legend_right_click(self, item):
     if item == -1:
         return
     item = self.legend.model[item]
     menu = gui.Menu()
     menu.append(gui.Command('Hide', '', object))
     menu.append(gui.Command('Show', '', object))
     menu.append(gui.Command('Show Only', '', object))
     menu.append(None)
     menu.append(gui.Command('Remove', '', object))
     menu.append(None)
     menu.append(gui.Command('Select All', '', object))
     self.legend._widget.PopupMenu(menu._menu)
Example #3
0
 def on_right_clicked(self, row, col):
     menu = gui.Menu()
     menu.append(
         gui.Command('Set value', 'setvalue', self.on_set_value,
                     'stock_edit.png'))
     menu.append(
         gui.Command('Insert row', 'insert', self.on_insert,
                     'table-insert-row.png'))
     menu.append(
         gui.Command('Delete', 'delete', self.on_set_value,
                     'stock_delete.png'))
     self.clickcell = row, col
     self.table._widget.PopupMenu(menu._menu)
Example #4
0
 def on_right_clicked(self, obj):
     print >> sys.stderr, obj
     menu = gui.Menu()
     menu.append(gui.Command('Delete', 'delete', object, 'open.png'))
     self.glwidget.parent.parent._widget.PopupMenu(menu._menu)