def __init__(self, skeletoncontext): skeletonselectable.SelectionBase.__init__(self, skeletoncontext) self.stack = ringbuffer.RingBuffer(stacksize) self.stack.push(PinnedNodeSet(self.skeletoncontext)) self.sbcallbacks.append( switchboard.requestCallback('pinnednode ringbuffer resize', self.setUndoBufferSizeCB))
def __init__(self, setCB, sensitizeCB=None, bufsiz=50, setCBkwargs={}): self.editingHistory = 0 self.setCB = setCB self.setCBkwargs = setCBkwargs self.historyBuffer = ringbuffer.RingBuffer(bufsiz) self.sensitizeCB = sensitizeCB self.inhibit = 0
def __init__(self, path, classname, obj, parent, secretFlag=0): Who.__init__(self, path, classname, obj, parent, secretFlag=0) self.undobuffer = ringbuffer.RingBuffer(self.getClass().historysize + 1) # Make sure to call most-derived-class version of this. self.begin_writing() self.pushModification(obj) self.end_writing()
def __init__(self, skeletoncontext): SelectionBase.__init__(self, skeletoncontext) # Ringbuffer of SelectionSet objects -- these contain # selections for undo/redo. self.stack = ringbuffer.RingBuffer(self.mode().stacksize) self.stack.push(SelectionSet(self.skeletoncontext)) self.sbcallbacks.append(switchboard.requestCallback( ('skelselection ringbuffer resize', self.mode().name), self.setUndoBufferSizeCB))
def __init__(self, gfxwindow): toolbox.Toolbox.__init__(self, 'Mesh_Info', gfxwindow) self.whoset = ('Mesh',) self.querier = None self.peeker = None self.records = ringbuffer.RingBuffer(49) self.meshlayer = None self.last_position = None # Most recent mouse-click position. self.sbcallbacks = [ switchboard.requestCallback((self.gfxwindow(), "layers changed"), self.newLayers)]
def __init__(self, gfxwindow): toolbox.Toolbox.__init__(self, 'Skeleton_Info', gfxwindow) self.whoset = ('Skeleton', ) self.querier = None self.peeker = None self.records = ringbuffer.RingBuffer(49) self.timestamp = timestamp.TimeStamp() self.timestamp.backdate() self.sbcallbacks = [ # Looks for a skeleton on the gfx window. switchboard.requestCallback((self.gfxwindow(), "layers changed"), self.newLayers), # Looks for a skeleton modification. switchboard.requestCallback(('who changed', 'Skeleton'), self.skelChanged) ]
def __init__(self, gfxwindow, name, modes): toolbox.Toolbox.__init__(self, name, gfxwindow) self.modeobjdict = {} for mode in modes: self.modeobjdict[mode.targetName] = mode # Previous queries are stored as (mode, index) pairs. self.queries = ringbuffer.RingBuffer(49) self.queries.push((modes[0], None)) # The current peek state is stored as a dictionary of indices, # keyed by mode. No history is maintained. self.peek = {} self.context = None # MeshContext or SkeletonContext or ... self.sbcallbacks = [ switchboard.requestCallback((self.gfxwindow(), "layers changed"), self.newLayers), switchboard.requestCallback(("who changed", self.whoClassName), self.whoChangedCB)]
def __init__(self, param, scope=None, name=None, ident=None, verbose=False): debug.mainthreadTest() self.param = param self.ident = ident or param.ident self.lastFile = {} # last file selected in each directory self.fileNames = [] # files in the current directory self.dirHier = [] # directories in the current hierarchy self.dirHistory = ringbuffer.RingBuffer(50) parameterwidgets.ParameterWidget.__init__(self, gtk.Frame(), scope, name, expandable=True, verbose=verbose) vbox = gtk.VBox() self.gtk.add(vbox) # Directory selector hbox = gtk.HBox() vbox.pack_start(hbox, expand=False, fill=False) hbox.pack_start(gtk.Label("Directory:"), expand=False, fill=False) self.dirWidget = chooser.ChooserComboWidget([], callback=self.dirChangedCB, name="Directory") hbox.pack_start(self.dirWidget.gtk, expand=True, fill=True) # Directory selection buttons hbox = gtk.HBox(homogeneous=False) vbox.pack_start(hbox, expand=False, fill=False) self.backbutton = gtkutils.StockButton(gtk.STOCK_GO_BACK, "Back", align=0.0) gtklogger.setWidgetName(self.backbutton, "Back") gtklogger.connect(self.backbutton, 'clicked', self.backCB) hbox.pack_start(self.backbutton, expand=True, fill=True) self.addDirButtons(hbox) homebutton = gtkutils.StockButton(gtk.STOCK_HOME) gtklogger.setWidgetName(homebutton, "Home") gtklogger.connect(homebutton, 'clicked', self.homeCB) hbox.pack_start(homebutton, expand=False, fill=True) self.nextbutton = gtkutils.StockButton(gtk.STOCK_GO_FORWARD, "Next", reverse=True, align=1.0) gtklogger.setWidgetName(self.nextbutton, "Next") gtklogger.connect(self.nextbutton, 'clicked', self.nextCB) hbox.pack_start(self.nextbutton, expand=True, fill=True) # File list self.fileList = self.chooserClass(name="FileList", callback=self.fileListCB, dbcallback=self.fileListDoubleCB, markup=True) self.fileList.gtk.set_size_request(-1, 100) vbox.pack_start(self.fileList.gtk, expand=True, fill=True) # Set the comparison function used when typing in the file # list. _filename_cmp matches the beginnings of file names, # ignoring the markup added to directories ane escaped # characters. if use_markup: self.fileList.treeview.set_search_equal_func(_filename_cmp, None) align = gtk.Alignment(xalign=1.0) vbox.pack_start(align, expand=False, fill=False) hbox = gtk.HBox() align.add(hbox) hbox.pack_start(gtk.Label("show hidden files"), expand=False, fill=False) self.hiddenButton = gtk.CheckButton() hbox.pack_start(self.hiddenButton, expand=False, fill=False) gtklogger.setWidgetName(self.hiddenButton, "ShowHidden") gtklogger.connect(self.hiddenButton, 'clicked', self.showHiddenCB) # Include additional widgets required by subclasses. self.addMoreWidgets(vbox)
def __init__(self, param, scope=None, name=None, ident=None): debug.mainthreadTest() self.ident = ident or param.ident self.lastFile = {} # last file selected in each directory self.fileNames = [] # files in the current directory self.dirHier = [] # directories in the current hierarchy self.dirHistory = ringbuffer.RingBuffer(50) parameterwidgets.ParameterWidget.__init__(self, gtk.Frame(), scope, name, expandable=True) vbox = gtk.VBox() self.gtk.add(vbox) # Directory selector hbox = gtk.HBox() vbox.pack_start(hbox, expand=False, fill=False) hbox.pack_start(gtk.Label("Directory:"), expand=False, fill=False) self.dirWidget = chooser.ChooserComboWidget([], callback=self.dirChangedCB, name="Directory") hbox.pack_start(self.dirWidget.gtk, expand=True, fill=True) # Directory selection buttons hbox = gtk.HBox(homogeneous=False) vbox.pack_start(hbox, expand=False, fill=False) self.backbutton = gtkutils.StockButton(gtk.STOCK_GO_BACK, "Back", align=0.0) gtklogger.setWidgetName(self.backbutton, "Back") gtklogger.connect(self.backbutton, 'clicked', self.backCB) hbox.pack_start(self.backbutton, expand=True, fill=True) self.addDirButtons(hbox) homebutton = gtkutils.StockButton(gtk.STOCK_HOME) gtklogger.setWidgetName(homebutton, "Home") gtklogger.connect(homebutton, 'clicked', self.homeCB) hbox.pack_start(homebutton, expand=False, fill=True) self.nextbutton = gtkutils.StockButton(gtk.STOCK_GO_FORWARD, "Next", reverse=True, align=1.0) gtklogger.setWidgetName(self.nextbutton, "Next") gtklogger.connect(self.nextbutton, 'clicked', self.nextCB) hbox.pack_start(self.nextbutton, expand=True, fill=True) # File list self.fileList = chooser.ScrolledChooserListWidget( name="FileList", callback=self.fileListCB, dbcallback=self.fileListDoubleCB, markup=True) self.fileList.gtk.set_size_request(-1, 100) vbox.pack_start(self.fileList.gtk, expand=True, fill=True) # Set the comparison function used when typing in the file # list. _filename_cmp matches the beginnings of file names, # ignoring the markup added to directories and escaped # characters. if use_markup: self.fileList.treeview.set_search_equal_func(_filename_cmp, None) align = gtk.Alignment(xalign=1.0) vbox.pack_start(align, expand=False, fill=False) hbox = gtk.HBox() align.add(hbox) hbox.pack_start(gtk.Label("show hidden files"), expand=False, fill=False) self.hiddenButton = gtk.CheckButton() hbox.pack_start(self.hiddenButton, expand=False, fill=False) gtklogger.setWidgetName(self.hiddenButton, "ShowHidden") gtklogger.connect(self.hiddenButton, 'clicked', self.showHiddenCB) # Include additional widgets required by subclasses. self.addMoreWidgets(vbox) # Set initial state. if param.value is not None: directory, phile = os.path.split(param.value) # param.value might not have a directory component, # especially if the last value was set by a script or # command line argument. if not directory or not os.path.isdir(directory): directory = _last_dir.get(self.ident, os.path.abspath(os.getcwd())) else: directory = _last_dir.get(self.ident, os.path.abspath(os.getcwd())) phile = _last_file.get(self.ident, None) self.hiddenButton.set_active(_last_hid.get(self.ident, False)) directory = endSlash(directory) self.lastFile[directory] = phile self.dirHistory.push(directory) self.dirWidget.suppress_signals() self.dirHier = getDirectoryHierarchy(directory) self.dirWidget.update(self.dirHier) self.dirWidget.set_state(directory) self.dirWidget.allow_signals() self.fileList.suppress_signals() self.updateFiles(directory) if phile: self.fileList.set_selection(phile) self.fileList.allow_signals() self.initializeExtras(directory, phile) self.sensitize() self.widgetChanged(self.checkValidity(), interactive=False)