def __binit__(self, graph, view, parent, **place): gui.Box.__init__(self, parent, 'vertical', **place) self.graph = graph self.view = view self.project = graph.project self.folder = None self.toolbar = gui.Toolbar(self, stretch=0) gui.Label(self, 'Worksheet', stretch=0) self.toolbar.append( gui.Command('Add', 'Add datasets to the graph', self.on_add, 'add.png')) self.toolbar.append( gui.Command('Remove', 'Remove datasets from the graph', self.on_remove, 'remove.png')) self.toolbar._widget.Realize() self.worksheet_list = gui.List(self, editable=False, model=WorksheetListModel( self.project.top)) # self.worksheet_list.connect('item-activated', self.on_wslist_activated) self.worksheet_list.connect('selection-changed', self.on_wslist_select) self.worksheet_list.connect('item-activated', self.on_item_activated) gui.Label(self, 'X column', stretch=0) self.x_list = gui.List(self, model=ColumnListModel()) gui.Label(self, 'Y column', stretch=0) self.y_list = gui.List(self, model=ColumnListModel())
def __init__(self): gui.Window.__init__(self, title='Functions', size=(500, 300)) box = gui.Box(self, 'horizontal') # split = gui.Splitter(box, 'horizontal', stretch=1) # self.categories = gui.List(split) self.category = gui.List(box, model=RegModel(registry), stretch=1) self.category.connect('selection-changed', self.on_select_function) self.category.connect('item-activated', self.on_item_activated) rbox = gui.Box(box, 'vertical', stretch=2) toolbar = gui.Toolbar(rbox, stretch=0) toolbar.append(gui.Command('New', '', self.on_new, 'new.png')) toolbar.append(gui.Command('Delete', '', self.on_remove, 'remove.png')) toolbar.append(gui.Command('Save', '', self.on_save, 'save.png')) toolbar._widget.Realize() book = gui.Notebook(rbox) edit = gui.Box(book, 'vertical', page_label='edit') g = gui.Grid(edit, 2, 2, stretch=0, expand=True) g.layout.AddGrowableCol(1) gui.Label(g, 'Name', pos=(0, 0)) gui.Label(g, 'Parameters', pos=(1, 0)) self.name = gui.Text(g, pos=(0, 1), expand=True) self.params = gui.Text(g, pos=(1, 1), expand=True) # self.text = gui.Text(edit, multiline=True, stretch=1) self.text = gui.PythonEditor(edit, stretch=1) extra = gui.Box(book, 'vertical', page_label='extra') # self.extra = gui.Text(extra, multiline=True, stretch=1) self.extra = gui.PythonEditor(extra, stretch=1) self.functions = functions self.function = None
def __init__(self, graph, view, parent, **place): gui.Box.__init__(self, parent, "vertical", **place) self.graph, self.view = graph, view xframe = gui.Frame(self, 'vertical', title='X axis', stretch=0.) grid = gui.Grid(xframe, 4, 2, expand=False) grid.layout.AddGrowableCol(1) gui.Label(grid, 'Title', pos=(0, 0)) self.x_title = gui.Text(grid, pos=(0, 1)) self.x_title.text = self.graph.xtitle self.x_title.connect(['enter', 'kill-focus'], self.on_x_title) gui.Label(grid, 'From', pos=(1, 0)) x_from = gui.Text(grid, pos=(1, 1)) gui.Label(grid, 'To', pos=(2, 0)) x_to = gui.Text(grid, pos=(2, 1)) gui.Label(grid, 'Type', pos=(3, 0)) x_type = self.x_type = gui.Choice(grid, pos=(3, 1)) x_type.append('Linear') x_type.append('Logarithmic') x_type.value = ['linear', 'log'].index(self.graph.xtype) x_type.connect('select', lambda value: self.on_set_xtype(value), True) yframe = gui.Frame(self, 'vertical', title='Y axis', stretch=0.) grid = gui.Grid(yframe, 4, 2, expand=False) grid.layout.AddGrowableCol(1) gui.Label(grid, 'Title', pos=(0, 0)) self.y_title = gui.Text(grid, pos=(0, 1)) self.y_title.text = self.graph.ytitle self.y_title.connect(['enter', 'kill-focus'], self.on_y_title) gui.Label(grid, 'From', pos=(1, 0)) y_from = gui.Text(grid, pos=(1, 1)) gui.Label(grid, 'To', pos=(2, 0)) y_to = gui.Text(grid, pos=(2, 1)) gui.Label(grid, 'Type', pos=(3, 0)) y_type = self.y_type = gui.Choice(grid, pos=(3, 1)) y_type.append('Linear') y_type.append('Logarithmic') y_type.value = ['linear', 'log'].index(self.graph.ytype) y_type.connect('select', lambda value: self.on_set_ytype(value), True) for w in [ self.x_title, x_from, x_to, x_type, self.y_title, y_from, y_to, y_type ]: w.min_size = (10, w.min_size[1])
def create_parambox(self, term): parambox = gui.Grid(term._box, len(term.parameters), 3, expand=True) parambox.layout.AddGrowableCol(1) term._text = [] term._lock = [] for n, par in enumerate(term.function.parameters): gui.Label(parambox, par, pos=(n, 0)) text = gui.Text(parambox, pos=(n, 1)) text.connect('character', lambda char: self.on_activate(term, n, char), True) text.connect('kill-focus', lambda: self.on_activate(term, n), True) text.text = str(term.parameters[n]) term._text.append(text) lock = gui.Checkbox(parambox, pos=(n, 2)) term._lock.append(lock) term._parambox = parambox self.update_widget()
def __init__(self, typ, value, tback): mingui.Dialog.__init__(self, title=random.choice( reduce(list.__add__, [[t[0]] * t[1] for t in titles]))) box = mingui.Box(self.place(), 'vertical') hbox = mingui.Box(box.place(), 'horizontal') mingui.Image( hbox.place(stretch=0), Image.open( os.path.join(settings.DATADIR, 'data', 'images', 'vogel.png'))) book = mingui.Notebook(hbox.place(stretch=1)) mingui.Label(book.place(label='Main'), "An error has occured!\nThis should not happen.") mingui.Text(book.place(label='Traceback'), multiline=True, text=''.join(traceback.format_exception(typ, value, tback)), enabled=False) details = mingui.Text(book.place(label='Details'), multiline=True, text=VerboseTB('NoColor').text(typ, value, tback, context=7), enabled=False) details.SetFont(wx.Font(8, wx.MODERN, wx.NORMAL, wx.NORMAL)) button = mingui.Button(box.place(stretch=0), "That's OK", connect={'clicked': self.close})
def __qinit__(self, graph, view, parent, **place): gui.Box.__init__(self, parent, 'vertical', **place) self.graph = graph self.view = view # Symbol self.symbol = gui.Frame(self, 'vertical', title='Symbol', stretch=0.) grid = self.symbol_grid = gui.Grid( self.symbol, 3, 3, expand=False) #, expand=True, stretch=1.) grid.layout.AddGrowableCol(2) # symbol type self.symbol = gui.PixmapChoice(grid, pos=(0, 2)) self.symbol.label = gui.Label(grid, 'Symbol', pos=(0, 1)) self.symbol.check = gui.Checkbox(grid, pos=(0, 0)) self.symbol.min_size = (10, self.symbol.min_size[1]) for symbol in Style.symbols: self.symbol.append(symbol + '.png') self.symbol.value = 0 self.symbol.connect( 'select', lambda value: self.on_select_property('symbol', value), True) # symbol color self.color = gui.PixmapChoice(grid, pos=(1, 2)) self.color.label = gui.Label(grid, 'Color', pos=(1, 1)) self.color.check = gui.Checkbox(grid, pos=(1, 0)) self.color.min_size = (10, self.color.min_size[1]) for color in Style.colors: self.color.append(self.color.create_colored_bitmap((20, 10), color)) self.color.value = 0 self.color.connect( 'select', lambda value: self.on_select_property('color', value), True) # symbol size self.symbol_size = gui.Spin(grid, pos=(2, 2)) self.symbol_size.label = gui.Label(grid, 'Size', pos=(2, 1)) self.symbol_size.check = gui.Checkbox(grid, pos=(2, 0)) self.symbol_size.min_size = (10, self.symbol_size.min_size[1]) self.symbol_size.value = 5 self.symbol_size.connect( 'modified', lambda value: self.on_select_property('symbol_size', value), True) # Line self.line = gui.Frame(self, 'vertical', title='Line', stretch=0.) grid = self.line_grid = gui.Grid(self.line, 3, 3) #, expand=True, stretch=1.) grid.layout.AddGrowableCol(2) # Line type self.line_type = gui.Choice(grid, pos=(0, 2)) self.line_type.label = gui.Label(grid, 'Type', pos=(0, 1)) self.line_type.check = gui.Checkbox(grid, pos=(0, 0)) self.line_type.min_size = (10, self.line_type.min_size[1]) for t in Style.line_types: self.line_type.append(t) self.line_type.value = 0 self.line_type.connect( 'select', lambda value: self.on_select_property('line_type', value), True) # Line style self.line_style = gui.Choice(grid, pos=(1, 2)) self.line_style.label = gui.Label(grid, 'Style', pos=(1, 1)) self.line_style.check = gui.Checkbox(grid, pos=(1, 0)) self.line_style.min_size = (10, self.line_style.min_size[1]) for p in Style.line_styles: self.line_style.append(p) self.line_style.value = 0 self.line_style.connect( 'select', lambda value: self.on_select_property('line_style', value), True) # Line width self.line_width = gui.Spin(grid, pos=(2, 2)) self.line_width.label = gui.Label(grid, 'Width', pos=(2, 1)) self.line_width.check = gui.Checkbox(grid, pos=(2, 0)) self.line_width.min_size = (10, self.line_width.min_size[1]) self.line_width.value = 1 self.line_width.connect( 'modified', lambda value: self.on_select_property('line_width', value), True) self.settings_widgets = [ self.symbol, self.color, self.symbol_size, self.line_type, self.line_style, self.line_width ] self.show_checks(False) self.symbol.prop = 'symbol' self.symbol_size.prop = 'symbol_size' self.color.prop = 'color' self.line_width.prop = 'line_width' self.line_type.prop = 'line_type' self.line_style.prop = 'line_style' b = gui.Box(self, 'horizontal', expand=True, stretch=0) gui.Label(b, 'Group', stretch=0) self.multi = gui.Choice(b, stretch=1) self.multi.append('identical') self.multi.append('series') self.multi.value = 0 self.multi.connect('select', self.on_select_multi) maxminw = max( [w.label._widget.GetBestSize()[0] for w in self.settings_widgets]) for widget in self.settings_widgets: widget.check.connect( 'modified', lambda state, widget=widget: self.on_check(widget, state), True) widget.label.min_size = (maxminw, widget.label.min_size[1])