Exemple #1
0
 def __init__(self, params, kset, scope=None, name=None):
     debug.mainthreadTest()
     self.params = params
     self.kset = kset
     SymmetricMatrixInput.__init__(self,
                                   'C',
                                   6,
                                   6,
                                   value=None,
                                   scope=scope,
                                   name=name)
     #
     # Make default blocks according to the kset dictionary.
     for (k, f) in self.floats.items():
         if k in self.kset:
             pass
         else:
             f.gtk.set_editable(0)
             f.gtk.set_sensitive(0)
     #
     # Connect the "obvious" callbacks.  Child classes may add
     # additional callbacks.
     for k in self.kset:
         # "activate" needs a dummy argument for the "event" slot.
         gtklogger.connect(self.floats[k].gtk, "activate", self.new_c, None)
         gtklogger.connect(self.floats[k].gtk, "focus_out_event",
                           self.new_c)
Exemple #2
0
 def __init__(self, params, scope=None, name=None, verbose=False):
     debug.mainthreadTest()
     kset = {
         (0, 0): 'c11',
         (0, 1): 'c12',
         (0, 2): 'c13',
         (2, 2): 'c33',
         (3, 3): 'c44',
         (0, 3): 'c14'
     }
     AnisoWidgetBase.__init__(self,
                              params,
                              kset,
                              scope=scope,
                              name=name,
                              verbose=verbose)
     #
     self.widgets[(5, 5)].gtk.set_editable(1)
     self.widgets[(5, 5)].gtk.set_sensitive(1)
     #
     gtklogger.connect(self.widgets[(5, 5)].gtk, "activate", self.new_c66,
                       None)
     gtklogger.connect(self.widgets[(5, 5)].gtk, "focus_out_event",
                       self.new_c66)
     #
     self.set_values()
Exemple #3
0
    def __init__(self, progress):
        debug.mainthreadTest()
        self.lock = lock.Lock()

        progressbar.ProgressBar.__init__(self, progress)
        self.dismissable = False
        progress.setProgressBar(self)

        self.gtk = gtk.Frame()
        self.gtk.set_shadow_type(gtk.SHADOW_IN)
        vbox = gtk.VBox(spacing=2)
        self.gtk.add(vbox)

        hbox = gtk.HBox(spacing=2)
        vbox.pack_start(hbox, expand=0, fill=0, padding=2)

        self.gtkprogressbar = gtk.ProgressBar()
        self.gtkprogressbar.set_orientation(gtk.PROGRESS_LEFT_TO_RIGHT)
        hbox.pack_start(self.gtkprogressbar, expand=1, fill=1)

        self.stopbutton = gtkutils.StockButton(gtk.STOCK_STOP, "Stop")
        gtklogger.setWidgetName(self.stopbutton, "Stop%d" % self.idcounter)
        self.idcounter += 1
        gtklogger.connect(self.stopbutton, "clicked", self.stopButtonCB)
        hbox.pack_start(self.stopbutton, expand=0, fill=0)

        self.timeout_id = None
Exemple #4
0
    def __init__(self, table, row, parent):
        self.deleteButton = gtk.Button('-')
        table.attach(self.deleteButton, 0,1, row+1,row+2,
                     xoptions=gtk.FILL, yoptions=0, xpadding=0, ypadding=0)
        gtklogger.setWidgetName(self.deleteButton, 'Delete%d' % row)
        gtklogger.connect(self.deleteButton, 'clicked', parent.deleteRowCB, row)
        tooltips.set_tooltip_text(self.deleteButton,
                                  "Delete this group definition.")

        self.colEntry = gtk.Entry()
        table.attach(self.colEntry, 1,2, row+1,row+2,
                     xoptions=0, yoptions=0, xpadding=0, ypadding=0)
        self.colSignal = gtklogger.connect(self.colEntry, 'changed',
                                           parent.changedCB)
        gtklogger.setWidgetName(self.colEntry, 'Column%d' % row)
        tooltips.set_tooltip_text(
            self.colEntry,
            'A column number.  Points in the data file with different '
            'values in this column will be assigned to different pixel groups.'
            )

        self.nameEntry = gtk.Entry()
        self.nameEntry.set_text('group_%s')
        table.attach(self.nameEntry, 2,3, row+1,row+2,
                     xoptions=gtk.FILL|gtk.EXPAND, yoptions=0,
                     xpadding=0, ypadding=0)
        self.nameSignal = gtklogger.connect(self.nameEntry, 'changed',
                                            parent.changedCB)
        gtklogger.setWidgetName(self.nameEntry, 'Name%d' % row)
        tooltips.set_tooltip_text(
            self.nameEntry, 
            'The name to assign to the group. A "%s" in the name '
            'will be replaced by the contents of the column.'
            )
Exemple #5
0
    def __init__(self, toolbox):
        # The 'toolbox' argument here is the non-gui toolbox
        # corresponding to one of the inner toolboxes.  It doesn't
        # matter which one.
        toolboxGUI.GfxToolbox.__init__(self, "Skeleton Selection", toolbox)
        vbox = gtk.VBox(spacing=2)
        self.gtk.add(vbox)
        bbox = gtk.HBox(spacing=2)
        gtklogger.setWidgetName(bbox, "Select")
        vbox.pack_start(bbox, expand=0, fill=0)
        bbox.pack_start(gtk.Label("Select: "), expand=0, fill=0)

        self.tbbox = gtk.Frame()       # holds SkeletonSelectionToolboxModes
        vbox.pack_start(self.tbbox, expand=1, fill=1)
        
        group = None
        self.tbdict = {}
        for mode in skeletonselmodebase.SkeletonSelectionMode.modes:
            if group:
                button = gtk.RadioButton(label=mode.name, group=group)
            else:
                button = gtk.RadioButton(label=mode.name)
                group = button
            bbox.pack_start(button, expand=0, fill=0)
            gtklogger.setWidgetName(button, mode.name)
            gtklogger.connect(button, 'clicked', self.switchModeCB, mode.name)

            ## Get the actual toolbox for each mode.
            tb = self.gfxwindow().getToolboxByName(mode.toolboxName())
            tbgui = SkeletonSelectionToolboxModeGUI(mode, tb)
            self.tbdict[mode.name] = tbgui

        self.activecallbacks = []
        self.currentMode = None
Exemple #6
0
    def __init__(self):
        oofGUI.MainPage.__init__(self,
                                 name="Introduction",
                                 ordering=0,
                                 tip="Welcome to %s!" % name)
        vbox = gtk.VBox()
        self.gtk.add(vbox)
        scroll = gtk.ScrolledWindow()
        gtklogger.logScrollBars(scroll, "Scroll")
        scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
        vbox.pack_start(scroll, expand=1, fill=1)
        self.textarea = fixedwidthtext.FixedWidthTextView()
        scroll.set_shadow_type(gtk.SHADOW_IN)
        scroll.add(self.textarea)
        self.textarea.set_editable(0)
        self.textarea.set_cursor_visible(0)
        self.textarea.set_wrap_mode(gtk.WRAP_WORD)

        buttonbox = gtk.HBox(homogeneous=1, spacing=2)
        buttonbox.set_border_width(2)
        vbox.pack_start(buttonbox, expand=0, fill=0)

        self.labels = ['Welcome', 'Credits', 'Copyright', 'Disclaimer']
        self.buttons = [gtk.ToggleButton(x) for x in self.labels]
        for button, label in zip(self.buttons, self.labels):
            buttonbox.pack_start(button, expand=1, fill=1)
            gtklogger.setWidgetName(button, label)
            gtklogger.connect(button, 'clicked', self.buttonCB, label)

        self.buttons[0].set_active(1)
Exemple #7
0
    def __init__(self,
                 namelist,
                 callback=None,
                 callbackargs=(),
                 update_callback=None,
                 update_callback_args=(),
                 button_callback=None,
                 button_callback_args=(),
                 buttontext="New...",
                 separator_func=None):
        ChooserWidget.__init__(self,
                               namelist,
                               callback=callback,
                               callbackargs=callbackargs,
                               update_callback=update_callback,
                               update_callback_args=update_callback_args,
                               helpdict={},
                               separator_func=separator_func)

        self.button_callback = button_callback
        self.button_callback_args = button_callback_args

        # Wrap the ChooserWidget's gtk in a GtkHBox and make it become self.gtk
        hbox = gtk.HBox()
        hbox.pack_start(self.gtk, expand=1, fill=1, padding=2)
        self.gtk = hbox

        self.newbutton = gtk.Button(buttontext)
        hbox.pack_start(self.newbutton, expand=0, fill=0, padding=2)
        gtklogger.connect(self.newbutton, 'clicked', self.newbuttonCB)
Exemple #8
0
    def __init__(self):
        oofGUI.MainPage.__init__(self, name="Introduction", ordering=0,
                                 tip="Welcome to %s!"%name)
        vbox = gtk.VBox()
        self.gtk.add(vbox)
        scroll = gtk.ScrolledWindow()
        gtklogger.logScrollBars(scroll, "Scroll")
        scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
        vbox.pack_start(scroll, expand=1, fill=1)
        self.textarea = fixedwidthtext.FixedWidthTextView()
        scroll.set_shadow_type(gtk.SHADOW_IN)
        scroll.add(self.textarea)
        self.textarea.set_editable(0)
        self.textarea.set_cursor_visible(0)
        self.textarea.set_wrap_mode(gtk.WRAP_WORD)

        buttonbox = gtk.HBox(homogeneous=1, spacing=2)
        buttonbox.set_border_width(2)
        vbox.pack_start(buttonbox, expand=0, fill=0)

        self.labels = ['Welcome', 'Credits', 'Copyright', 'Disclaimer']
        self.buttons = [gtk.ToggleButton(x) for x in self.labels]
        for button, label in zip(self.buttons, self.labels):
            buttonbox.pack_start(button, expand=1, fill=1)
            gtklogger.setWidgetName(button, label)
            gtklogger.connect(button, 'clicked', self.buttonCB, label)

        self.buttons[0].set_active(1)
Exemple #9
0
    def __init__(self, params, scope=None, name=None, verbose=False):
        debug.mainthreadTest()
        kset = {
            (0, 0): 'c11',
            (0, 1): 'c12',
            (0, 2): 'c13',
            (2, 2): 'c33',
            (3, 3): 'c44'
        }
        AnisoWidgetBase.__init__(self,
                                 params,
                                 kset,
                                 scope=scope,
                                 name=name,
                                 verbose=verbose)
        #
        # Base class will have blocked c66, so unblock it.
        self.floats[(5, 5)].gtk.set_editable(1)
        self.floats[(5, 5)].gtk.set_sensitive(1)

        #  ... and connect a special callback.
        gtklogger.connect(self.floats[(5, 5)].gtk, "activate", self.new_c66,
                          None)
        gtklogger.connect(self.floats[(5, 5)].gtk, "focus_out_event",
                          self.new_c66)
        #
        self.set_values()
Exemple #10
0
    def __init__(self, progress):
        debug.mainthreadTest()
        self.lock = lock.Lock()

        progressbar.ProgressBar.__init__(self, progress)
        self.dismissable = False
        progress.setProgressBar(self)

        self.gtk = gtk.Frame()
        self.gtk.set_shadow_type(gtk.SHADOW_IN)
        vbox = gtk.VBox(spacing=2)
        self.gtk.add(vbox)

        hbox = gtk.HBox(spacing=2)
        vbox.pack_start(hbox, expand=0, fill=0, padding=2)

        self.gtkprogressbar = gtk.ProgressBar()
        self.gtkprogressbar.set_orientation(gtk.PROGRESS_LEFT_TO_RIGHT)
        hbox.pack_start(self.gtkprogressbar, expand=1, fill=1)

        self.stopbutton = gtkutils.StockButton(gtk.STOCK_STOP, "Stop")
        gtklogger.setWidgetName(self.stopbutton, "Stop%d" % self.idcounter)
        self.idcounter += 1
        gtklogger.connect(self.stopbutton, 'clicked', self.stopButtonCB)
        hbox.pack_start(self.stopbutton, expand=0, fill=0)

        self.timeout_id = None
Exemple #11
0
    def __init__(self, table, row, parent):
        self.deleteButton = gtk.Button('-')
        table.attach(self.deleteButton, 0,1, row+1,row+2,
                     xoptions=gtk.FILL, yoptions=0, xpadding=0, ypadding=0)
        gtklogger.setWidgetName(self.deleteButton, 'Delete%d' % row)
        gtklogger.connect(self.deleteButton, 'clicked', parent.deleteRowCB, row)
        tooltips.set_tooltip_text(self.deleteButton,
                                  "Delete this group definition.")

        self.colEntry = gtk.Entry()
        table.attach(self.colEntry, 1,2, row+1,row+2,
                     xoptions=0, yoptions=0, xpadding=0, ypadding=0)
        self.colSignal = gtklogger.connect(self.colEntry, 'changed',
                                           parent.changedCB)
        gtklogger.setWidgetName(self.colEntry, 'Column%d' % row)
        tooltips.set_tooltip_text(
            self.colEntry,
            'A column number.  Points in the data file with different '
            'values in this column will be assigned to different pixel groups.'
            )

        self.nameEntry = gtk.Entry()
        self.nameEntry.set_text('group_%s')
        table.attach(self.nameEntry, 2,3, row+1,row+2,
                     xoptions=gtk.FILL|gtk.EXPAND, yoptions=0,
                     xpadding=0, ypadding=0)
        self.nameSignal = gtklogger.connect(self.nameEntry, 'changed',
                                            parent.changedCB)
        gtklogger.setWidgetName(self.nameEntry, 'Name%d' % row)
        tooltips.set_tooltip_text(
            self.nameEntry, 
            'The name to assign to the group. A "%s" in the name '
            'will be replaced by the contents of the column.'
            )
Exemple #12
0
 def __init__(self, param, scope=None, name=None):
     ParameterWidget.__init__(self, gtk.HBox(), scope=scope, name=name)
     self.autocheck = gtk.CheckButton()
     gtklogger.setWidgetName(self.autocheck, 'Auto')
     self.text = gtk.Entry()
     gtklogger.setWidgetName(self.text, 'Text')
     self.gtk.pack_start(self.autocheck, expand=0, fill=0)
     self.gtk.pack_start(self.text, expand=1, fill=1)
     gtklogger.connect(self.autocheck, "clicked", self.checkCB)
     self.textsignal = gtklogger.connect(self.text, 'changed', self.entryCB)
Exemple #13
0
 def __init__(self, param, scope=None, name=None):
     ParameterWidget.__init__(self, gtk.HBox(), scope=scope, name=name)
     self.autocheck = gtk.CheckButton()
     gtklogger.setWidgetName(self.autocheck, 'Auto')
     self.text = gtk.Entry()
     gtklogger.setWidgetName(self.text, 'Text')
     self.gtk.pack_start(self.autocheck, expand=0, fill=0)
     self.gtk.pack_start(self.text, expand=1, fill=1)
     gtklogger.connect(self.autocheck, "clicked", self.checkCB)
     self.textsignal = gtklogger.connect(self.text, 'changed', self.entryCB)
Exemple #14
0
    def __init__(self,
                 tree,
                 expand=1,
                 callback=None,
                 name=None,
                 *callbackargs,
                 **callbackkwargs):
        debug.mainthreadTest()
        self.tree = tree  # associated LabelTree
        self.callback = callback
        self.callbackargs = callbackargs
        self.callbackkwargs = callbackkwargs

        self.rccb = None

        # Create a TreeStore that mirrors the LabelTree.  The first
        # column is the label, and the second is the LabelTree node.
        self.treestore = gtk.TreeStore(gobject.TYPE_STRING,
                                       gobject.TYPE_PYOBJECT)
        self.gtk = gtk.TreeView(model=self.treestore)
        gtklogger.setWidgetName(self.gtk, name)
        self.gtk.set_property("headers-visible", False)
        tvcol = gtk.TreeViewColumn()
        self.gtk.append_column(tvcol)
        cell = gtk.CellRendererText()
        tvcol.pack_start(cell, expand=False)
        tvcol.set_attributes(cell,
                             text=0)  # display column 0 of the tree store

        selection = self.gtk.get_selection()
        gtklogger.adoptGObject(selection,
                               self.gtk,
                               access_method=self.gtk.get_selection)
        self.selection_signal = gtklogger.connect(selection, 'changed',
                                                  self.selectionChangedCB)
        selection.set_select_function(self.selectFn)
        gtklogger.connect(self.gtk, 'row-activated', self.activateRowCB)
        gtklogger.connect_passive(self.gtk, 'row-expanded')
        gtklogger.connect_passive(self.gtk, 'row-collapsed')
        self.lt2treeiter = {}

        self.current_selection = None  # a LabelTreeNode

        for node in tree.nodes:
            self.constructGUI(node, None)

        self.gtk.connect("destroy", self.destroyCB)
        self.autoSelect()
        self.gtk.show_all()

        self.sbcallbacks = [
            switchboard.requestCallbackMain((tree, "insert"), self.insertCB),
            switchboard.requestCallbackMain((tree, "delete"), self.deleteCB),
            switchboard.requestCallbackMain((tree, "rename"), self.renameCB)
        ]
Exemple #15
0
 def __init__(self, param, scope=None, name=None):
     debug.mainthreadTest()
     MatrixInput.__init__(self, 3, 6, value=None, scope=scope, name=name)
     for (k, f) in self.widgets.items():
         if k not in self.excluded:
             f.gtk.set_editable(0)
             f.gtk.set_sensitive(0)
         else:
             gtklogger.connect(f.gtk, "activate", self.new_value, None)
             gtklogger.connect(f.gtk, "focus_out_event", self.new_value)
     self.set_values(param.value)
Exemple #16
0
 def __init__(self, param, scope=None, name=None):
     debug.mainthreadTest()
     MatrixInput.__init__(self, "", 3,6, value=None, scope=scope, name=name)
     for (k,f) in self.floats.items():
         if k not in self.excluded:
             f.gtk.set_editable(0)
             f.gtk.set_sensitive(0)
         else:
             gtklogger.connect(f.gtk, "activate", self.new_value, None)
             gtklogger.connect(f.gtk, "focus_out_event", self.new_value)
     self.set_values(param.value)
Exemple #17
0
 def __init__(self, param, scope=None, name=None, verbose=False):
     debug.mainthreadTest()
     SymmetricMatrixInput.__init__(self,"",3,3,value=None,scope=scope,
                                   name=name, verbose=verbose)
     for (k,f) in self.floats.items():
         if k not in self.settable:
             f.gtk.set_editable(0)
             f.gtk.set_sensitive(0)
         else:
             gtklogger.connect(f.gtk, "activate", self.new_value, None)
             gtklogger.connect(f.gtk, "focus_out_event", self.new_value)
     self.set_values(param.value)
Exemple #18
0
    def __init__(self,
                 objlist=None,
                 displaylist=[],
                 callback=None,
                 dbcallback=None,
                 autoselect=True,
                 helpdict={},
                 comparator=None,
                 markup=False,
                 name=None,
                 separator_func=None,
                 cbargs=None,
                 cbkwargs=None):
        debug.mainthreadTest()
        self.liststore = gtk.ListStore(gobject.TYPE_STRING,
                                       gobject.TYPE_PYOBJECT)
        self.treeview = gtk.TreeView(self.liststore)
        self.gtk = self.treeview
        self.treeview.set_property("headers-visible", 0)
        cell = gtk.CellRendererText()
        if markup:
            # Expect to find pango markup in displaylist, which is
            # stored in column 0 of the ListStore.
            self.tvcol = gtk.TreeViewColumn("", cell, markup=0)
        else:
            self.tvcol = gtk.TreeViewColumn("", cell)
        self.treeview.append_column(self.tvcol)
        self.tvcol.add_attribute(cell, 'text', 0)
        self.autoselect = autoselect
        self.callback = callback or (lambda x, interactive=False: None)
        self.dbcallback = dbcallback or (lambda x: None)
        self.cbargs = cbargs or []
        self.cbkwargs = cbkwargs or {}
        self.comparator = comparator or (lambda x, y: x == y)
        self.activatesignal = gtklogger.connect(self.treeview, 'row-activated',
                                                self.rowactivatedCB)

        # If separator_func is provided, it must be a function that
        # takes a gtk.TreeModel and gtk.TreeIter as arguments, and
        # return True if the row given by model[iter] is to be
        # represented by a separator in the TreeView.
        if separator_func:
            self.treeview.set_row_separator_func(separator_func)

        if name:
            gtklogger.setWidgetName(self.treeview, name)
        selection = self.treeview.get_selection()
        gtklogger.adoptGObject(selection,
                               self.treeview,
                               access_method=self.treeview.get_selection)
        self.selectsignal = gtklogger.connect(selection, 'changed',
                                              self.selectionchangedCB)
        self.update(objlist or [], displaylist, helpdict=helpdict)
Exemple #19
0
 def __init__(self, param, scope=None, name=None):
     debug.mainthreadTest()
     MatrixInput.__init__(self,"",3,6,value=None,scope=scope,name=name)
         
     for i in range(3):
         for j in range(6):
             gtklogger.connect(self.floats[(i, j)].gtk, 
                               "activate", self.new_value, None)
             gtklogger.connect(self.floats[(i, j)].gtk,
                               "focus_out_event", self.new_value)
     
     self.set_values(param.value)
Exemple #20
0
    def __init__(self, param, scope=None, name=None):
        debug.mainthreadTest()
        MatrixInput.__init__(self, 3, 6, value=None, scope=scope, name=name)

        for i in range(3):
            for j in range(6):
                gtklogger.connect(self.widgets[(i, j)].gtk, "activate",
                                  self.new_value, None)
                gtklogger.connect(self.widgets[(i, j)].gtk, "focus_out_event",
                                  self.new_value)

        self.set_values(param.value)
Exemple #21
0
    def __init__(self, mode, title=None, filename=None, params=None,
                 pattern=False):
        debug.mainthreadTest()
        widgetscope.WidgetScope.__init__(self, None)
        self.dialog = gtklogger.Dialog()
        self.set_title(title)
        gtklogger.newTopLevelWidget(self.dialog, self.dialog.get_title())
        self.filechooser = gtk.FileChooserWidget(action=_modes[mode])
        self.dialog.set_default_size(500, 300)
        self.filechooser.show()
        self.dialog.vbox.pack_start(self.filechooser, expand=1, fill=1)
        gtklogger.setWidgetName(self.filechooser, "FileChooser")
        gtklogger.connect(self.filechooser, 'selection-changed',
                          self.selectionchangedCB)
        self.dialog.add_button(gtk.STOCK_OK, self.OK)
        self.dialog.add_button(gtk.STOCK_CANCEL, self.CANCEL)
        self.dialog.set_default_response(self.OK)

        self.pattern = (pattern and (mode=='r'))
        if self.pattern:
            # TODO: Fix aesthetics of the widgets.
            self.filechooser.set_select_multiple(True)
            self.patternrow = gtk.HBox()
            self.patternrow.pack_start(gtk.Label("Pattern: "), expand=0, fill=0, padding=5)
            self.pattern_entry = gtk.Entry()
            self.pattern_entry.set_editable(1)
            self.pattern_entry.set_text("*")
            gtklogger.connect(self.pattern_entry, 'changed', self.patternchangedCB)
            self.patternrow.pack_start(self.pattern_entry, expand=1, fill=1, padding=5)
            self.patternrow.show_all()

        if params is None:
            self.table = None
            if self.pattern:
                self.filechooser.set_extra_widget(self.patternrow)
        else:
            self.table = parameterwidgets.ParameterTable(params, scope=self,
                                                         name="Parameters")
            self.sbcallback = switchboard.requestCallbackMain(
                ('validity', self.table), self.validityCB)
            if not self.pattern:
                self.filechooser.set_extra_widget(self.table.gtk)
            else:
                vbox = gtk.VBox()
                vbox.pack_start(self.patternrow)
                vbox.pack_start(self.table.gtk)
                vbox.show()
                self.filechooser.set_extra_widget(vbox)

        if filename is not None:
            self.filechooser.set_current_name(filename)
Exemple #22
0
 def __init__(self, params, scope=None, name=None):
     debug.mainthreadTest()
     kset = {(0,0): 'c11', (0,1): 'c12', (0,2): 'c13',
             (2,2): 'c33', (3,3): 'c44', (0,3): 'c14' }
     AnisoWidgetBase.__init__(self, params, kset, scope=scope, name=name)
     #
     self.floats[(5,5)].gtk.set_editable(1)
     self.floats[(5,5)].gtk.set_sensitive(1)
     #
     gtklogger.connect(self.floats[(5,5)].gtk, "activate",
                       self.new_c66, None)
     gtklogger.connect(self.floats[(5,5)].gtk, "focus_out_event",
                       self.new_c66)
     #
     self.set_values()
Exemple #23
0
    def __init__(self, tree, expand=1, callback=None, name=None,
                 *callbackargs, **callbackkwargs):
        debug.mainthreadTest()
        self.tree = tree                # associated LabelTree
        self.callback = callback
        self.callbackargs = callbackargs
        self.callbackkwargs = callbackkwargs

        self.rccb = None

        # Create a TreeStore that mirrors the LabelTree.  The first
        # column is the label, and the second is the LabelTree node.
        self.treestore = gtk.TreeStore(gobject.TYPE_STRING,
                                       gobject.TYPE_PYOBJECT)
        self.gtk = gtk.TreeView(model=self.treestore)
        gtklogger.setWidgetName(self.gtk, name)
        self.gtk.set_property("headers-visible", False)
        tvcol = gtk.TreeViewColumn()
        self.gtk.append_column(tvcol)
        cell = gtk.CellRendererText()
        tvcol.pack_start(cell, expand=False)
        tvcol.set_attributes(cell, text=0) # display column 0 of the tree store
        
        selection = self.gtk.get_selection()
        gtklogger.adoptGObject(selection, self.gtk,
                              access_method=self.gtk.get_selection)
        self.selection_signal = gtklogger.connect(selection, 'changed',
                                                 self.selectionChangedCB)
        selection.set_select_function(self.selectFn)
        gtklogger.connect(self.gtk, 'row-activated', self.activateRowCB)
        gtklogger.connect_passive(self.gtk, 'row-expanded')
        gtklogger.connect_passive(self.gtk, 'row-collapsed')
        self.lt2treeiter = {}

        self.current_selection = None   # a LabelTreeNode

        for node in tree.nodes:
            self.constructGUI(node, None)

        self.gtk.connect("destroy", self.destroyCB)
        self.autoSelect()
        self.gtk.show_all()

        self.sbcallbacks = [
            switchboard.requestCallbackMain((tree, "insert"), self.insertCB),
            switchboard.requestCallbackMain((tree, "delete"), self.deleteCB),
            switchboard.requestCallbackMain((tree, "rename"), self.renameCB)
            ]
Exemple #24
0
 def __init__(self, param, scope=None, name=None, compact=False):
     debug.mainthreadTest()
     if param.value:
         labelstr = 'true'
     else:
         labelstr = 'false'
     self.label = gtk.Label(labelstr)
     ParameterWidget.__init__(self,
                              gtk.Frame(),
                              scope=scope,
                              compact=compact)
     if not compact:
         self.button = gtk.CheckButton()
         self.button.add(self.label)
         self.gtk.add(self.button)
     else:
         self.button = gtk.ToggleButton()
         align = gtk.Alignment(xalign=0.5, xscale=0.0)
         align.add(self.button)
         self.gtk.add(align)
     # name is assigned to the button, not the frame, because it's
     # the button that gets connected.
     gtklogger.setWidgetName(self.button, name)
     self.signal = gtklogger.connect(self.button, 'clicked', self.buttonCB)
     self.set_value(param.value)
Exemple #25
0
def _CheckOOFMenuItem_construct_gui(self, base, parent_menu, accelgroup):
    debug.mainthreadTest()
    new_gtkitem = gtk.CheckMenuItem()
    new_gtkitem.add(self.gtklabel(new_gtkitem))
    gtklogger.setWidgetName(new_gtkitem, self.name)

    try:
        self.gtkitem.append(new_gtkitem)
    except AttributeError:
        self.gtkitem = [new_gtkitem]
    new_gtkitem.connect("destroy", self.gtkitem_destroyed)
    # Set the state of the button.  This calls the callback, so we do
    # it here before the callback is connected.
    new_gtkitem.set_active(self.value)
    if self.accel is not None and accelgroup is not None:
        new_gtkitem.add_accelerator('activate', accelgroup, ord(self.accel),
                                    gtk.gdk.MOD1_MASK, gtk.ACCEL_VISIBLE)

    # Handler IDs are added in the same order as items, so there
    # is item-for-item correspondence of the lists.
    new_handler = gtklogger.connect(new_gtkitem, 'activate',
                                    CheckMenuCallBackWrapper(self))
    try:
        self.handlerid.append(new_handler)
    except AttributeError:
        self.handlerid = [new_handler]

    if not self.enabled():
        new_gtkitem.set_sensitive(0)

    parent_menu.insert(new_gtkitem, self.gui_order())
Exemple #26
0
 def build_eqnTable(self):
     debug.mainthreadTest()
     self.eqntable.foreach(gtk.Object.destroy)  # clear the table
     self.eqnbuttons = {}
     eqlist = equation.allEquations
     self.eqntable.resize(len(eqlist), 3)
     row = 0
     for eqn in eqlist:
         label = gtk.Label(utils.underscore2space(eqn.name()))
         label.set_alignment(1.0, 0.5)
         self.eqntable.attach(label,
                              0,
                              1,
                              row,
                              row + 1,
                              xoptions=gtk.FILL,
                              yoptions=0)
         button = gtk.CheckButton('active')
         gtklogger.setWidgetName(button, eqn.name() + " active")
         signal = gtklogger.connect(button, 'clicked', self.eqnButtonCB,
                                    eqn)
         self.eqnbuttons[(eqn.name(),
                          "active")] = ButtonSignal(button, signal)
         tooltips.set_tooltip_text(button,
                                   'Active equations will be solved.')
         self.eqntable.attach(button,
                              2,
                              3,
                              row,
                              row + 1,
                              xoptions=0,
                              yoptions=0)
         ## Moved to time dependence page
         #             if eqn.get_kinetic()>0 and config.devel()>=1:
         #                 button = gtk.CheckButton('kinetic')
         #                 gtklogger.setWidgetName(button, eqn.name() + " kinetic")
         #                 signal = gtklogger.connect(button, 'clicked', self.eqnKineticCB,
         #                                            eqn)
         #                 self.eqnbuttons[(eqn.name(), "kinetic")] = ButtonSignal(button,
         #                                                                         signal)
         #                 self.eqntable.attach(button, 3,4, row, row+1,
         #                                    xoptions=0, yoptions=0)
         #             if eqn.get_dynamics()>0 and config.devel()>=1:
         #                 button = gtk.CheckButton('dynamic')
         #                 gtklogger.setWidgetName(button, eqn.name() + " dynamic")
         #                 signal = gtklogger.connect(button, 'clicked',
         #                                            self.eqnDynamicCB, eqn)
         #                 self.eqnbuttons[(eqn.name(), "dynamic")] = ButtonSignal(button,
         #                                                                         signal)
         #                 self.eqntable.attach(button, 4,5, row, row+1,
         #                                    xoptions=0, yoptions=0)
         row += 1
     self.eqntable.attach(gtk.VSeparator(),
                          1,
                          2,
                          0,
                          len(eqlist),
                          xoptions=0,
                          yoptions=gtk.EXPAND | gtk.FILL)
     self.eqntable.set_col_spacing(0, 3)
Exemple #27
0
def _CheckOOFMenuItem_construct_gui(self, base, parent_menu, accelgroup):
    debug.mainthreadTest()
    new_gtkitem = gtk.CheckMenuItem()
    new_gtkitem.add(self.gtklabel(new_gtkitem))
    gtklogger.setWidgetName(new_gtkitem, self.name)

    try:
        self.gtkitem.append(new_gtkitem)
    except AttributeError:
        self.gtkitem = [new_gtkitem]
    new_gtkitem.connect("destroy", self.gtkitem_destroyed)
    # Set the state of the button.  This calls the callback, so we do
    # it here before the callback is connected.
    new_gtkitem.set_active(self.value)
    if self.accel is not None and accelgroup is not None:
        new_gtkitem.add_accelerator('activate', accelgroup,
                                     ord(self.accel),
                                     gtk.gdk.MOD1_MASK, gtk.ACCEL_VISIBLE)

    # Handler IDs are added in the same order as items, so there
    # is item-for-item correspondence of the lists.
    new_handler = gtklogger.connect(new_gtkitem, 'activate',
                                    CheckMenuCallBackWrapper(self))
    try:
        self.handlerid.append(new_handler)
    except AttributeError:
        self.handlerid = [new_handler]

    if not self.enabled():
        new_gtkitem.set_sensitive(0)

    parent_menu.insert(new_gtkitem, self.gui_order())
Exemple #28
0
    def __init__(self, gfxtoolbox):
        SkeletonInfoModeGUI.__init__(self, gfxtoolbox)

        row = 0
        self.labelmaster((0, 1), (row, row + 1), 'index=')
        self.index = self.entrymaster((1, 2), (row, row + 1), editable=True)
        gtklogger.setWidgetName(self.index, "Index")
        self.indexChangedSignal = gtklogger.connect(self.index, 'changed',
                                                    self.indexChangedCB)
        gtklogger.connect(self.index, 'activate', self.indexChangeDoneCB)
        row += 1

        self.labelmaster((0, 1), (row, row + 1), 'elements=')
        self.elem = self.makeObjList("Element", (1, 2), (row, row + 1))
        row += 1

        if config.dimension() == 3:
            self.labelmaster((0, 1), (row, row + 1), 'faces=')
            self.faces = self.makeObjList("Face", (1, 2), (row, row + 1))
            row += 1

        self.labelmaster((0, 1), (row, row + 1), 'nodes=')
        self.nodes = self.makeObjList("Node", (1, 2), (row, row + 1))
        row += 1

        self.labelmaster((0, 1), (row, row + 1), 'length=')
        self.length = self.entrymaster((1, 2), (row, row + 1))
        gtklogger.setWidgetName(self.length, "Length")
        row += 1

        self.labelmaster((0, 1), (row, row + 1), 'homogeneity=')
        self.homog = self.entrymaster((1, 2), (row, row + 1))
        gtklogger.setWidgetName(self.homog, "Homogeneity")
        row += 1

        self.labelmaster((0, 1), (row, row + 1), 'segment groups=')
        self.group = self.entrymaster((1, 2), (row, row + 1))
        gtklogger.setWidgetName(self.group, "Groups")
        self.group.set_sensitive(
            False)  # TODO: remove this line when implemented
        row += 1

        self.labelmaster((0, 1), (row, row + 1), 'boundary=')
        self.bndy = self.entrymaster((1, 2), (row, row + 1))
        gtklogger.setWidgetName(self.bndy, "Boundary")
        row += 1
Exemple #29
0
 def __init__(self, param, scope=None, name=None):
     debug.mainthreadTest()
     widget = gtk.Entry()
     widget.set_size_request(10 * guitop.top().charsize, -1)
     ParameterWidget.__init__(self, widget, scope=scope, name=name)
     self.signal = gtklogger.connect(widget, 'changed', self.changedCB)
     self.set_value(param.value)
     self.widgetChanged(self.validValue(param.value), interactive=0)
Exemple #30
0
 def __init__(self, param, scope=None, name=None):
     debug.mainthreadTest()
     widget = gtk.Entry()
     widget.set_size_request(10*guitop.top().charsize, -1)
     ParameterWidget.__init__(self, widget, scope=scope, name=name)
     self.signal = gtklogger.connect(widget, 'changed', self.changedCB)
     self.set_value(param.value)
     self.widgetChanged(self.validValue(param.value), interactive=0)
Exemple #31
0
 def __init__(self, params, scope=None, name=None):
     debug.mainthreadTest()
     kset = {(0,0): 'c11', (0,1): 'c12', (0,2): 'c13',
             (2,2): 'c33', (3,3): 'c44' }
     AnisoWidgetBase.__init__(self, params, kset, scope=scope, name=name)
     #
     # Base class will have blocked c66, so unblock it.
     self.floats[(5,5)].gtk.set_editable(1)
     self.floats[(5,5)].gtk.set_sensitive(1)
         
     #  ... and connect a special callback.
     gtklogger.connect(self.floats[(5,5)].gtk, "activate",
                       self.new_c66, None)
     gtklogger.connect(self.floats[(5,5)].gtk, "focus_out_event",
                       self.new_c66)
     #
     self.set_values()
Exemple #32
0
    def __init__(self, param, scope, name=None, verbose=False):
        debug.mainthreadTest()
        # Find the enclosing mesh widget.
        self.meshwidget = scope.findWidget(lambda x: isinstance(
            x, whowidget.WhoWidget) and x.whoclass is mesh.meshes)

        self.gtk = gtk.Frame()
        vbox = gtk.VBox()
        self.gtk.add(vbox)

        meshname = self.meshwidget.get_value()
        try:
            self.meshobj = mesh.meshes[meshname]
        except KeyError:
            # no mesh!
            self.meshobj = None
            vbox.add(gtk.Label('No mesh!'))
        else:
            # In the proxy case, the behavior is to set the line
            # width, etc. for all the cross sections in whatever mesh
            # is referred to.  It doesn't make sense to single out
            # individual cross-sections in this case, since they'll
            # change when the proxy resolution changes.  The set_value
            # and get_value functions must also detect the proxy case
            # and behave a little differently, since the chooser
            # doesn't get built in that case.
            if isinstance(self.meshobj, whoville.WhoProxy):
                vbox.add(gtk.Label('Selected'))
            else:
                self.chooser = chooser.MultiListWidget(
                    self.meshobj.allCrossSectionNames(), name="List")
                self.selected = gtk.CheckButton("Selected")
                gtklogger.setWidgetName(self.selected, "Selected")
                gtklogger.connect(self.selected, "clicked", self.selectedCB)
                vbox.pack_start(self.selected, expand=0, fill=0)
                vbox.pack_start(self.chooser.gtk, expand=0, fill=0)

        parameterwidgets.ParameterWidget.__init__(self,
                                                  self.gtk,
                                                  scope,
                                                  name=name,
                                                  expandable=True,
                                                  verbose=verbose)
        self.set_value(param.value)

        self.gtk.show_all()
Exemple #33
0
    def build_fieldTable(self):
        debug.mainthreadTest()
        self.fieldtable.foreach(gtk.Object.destroy) # clear the table
        self.fieldbuttons = {}
        self.fieldtable.resize(len(allCompoundFields), 6)
        self.fieldtable.attach(gtk.VSeparator(), 1,2, 0,len(allCompoundFields),
                               xoptions=0, yoptions=gtk.EXPAND|gtk.FILL)
        self.fieldtable.set_col_spacing(0, 3)
        row = 0
        for fname, fld in allCompoundFields.items():
            label = gtk.Label(fname)
            label.set_alignment(1.0, 0.5)
            self.fieldtable.attach(label, 0,1, row,row+1,
                                   xoptions=gtk.FILL, yoptions=0)
            button = gtk.CheckButton('defined')
            gtklogger.setWidgetName(button, fname+" defined")
            signal = gtklogger.connect(button, 'clicked',
                                       self.fieldDefineCB, fld)
            self.fieldbuttons[(fname, "defined")] = ButtonSignal(button, signal)
            self.fieldtable.attach(button, 2,3, row, row+1,
                                   xoptions=0, yoptions=0)
            self.setFieldDefineTip(button, fld)

            button = gtk.CheckButton('active')
            gtklogger.setWidgetName(button, fname+" active")
            signal = gtklogger.connect(button, 'clicked',
                                       self.fieldActiveCB, fld)
            self.fieldbuttons[(fname, "active")] = ButtonSignal(button, signal)
            self.fieldtable.attach(button, 3,4, row, row+1,
                                   xoptions=0, yoptions=0)
            self.setFieldActiveTip(button, fld)

            if config.dimension() == 2:
                button = gtk.CheckButton('in-plane')
                gtklogger.setWidgetName(button, fname + " in-plane")
                signal = gtklogger.connect(button, 'clicked',
                                           self.fieldInPlaneCB, fld)
                self.fieldbuttons[(fname, "inplane")] = ButtonSignal(button,
                                                                     signal)
                self.fieldtable.attach(button, 4,5, row, row+1,
                                       xoptions=0, yoptions=0)
                self.setFieldInPlaneTip(button, fld)

            row += 1
Exemple #34
0
    def __init__(self, gfxtoolbox):
        SkeletonInfoModeGUI.__init__(self, gfxtoolbox)

        row = 0
        self.labelmaster((0, 1), (row, row + 1), 'index=')
        self.index = self.entrymaster((1, 2), (row, row + 1), editable=True)
        gtklogger.setWidgetName(self.index, "Index")
        self.indexChangedSignal = gtklogger.connect(self.index, 'changed',
                                                    self.indexChangedCB)
        gtklogger.connect(self.index, 'activate', self.indexChangeDoneCB)
        row += 1

        self.labelmaster((0, 1), (row, row + 1), 'position=')
        self.pos = self.entrymaster((1, 2), (row, row + 1))
        gtklogger.setWidgetName(self.pos, "Position")
        row += 1

        self.labelmaster((0, 1), (row, row + 1), 'mobility=')
        self.mobility = self.entrymaster((1, 2), (row, row + 1))
        gtklogger.setWidgetName(self.mobility, "Mobility")
        row += 1

        self.labelmaster((0, 1), (row, row + 1), 'elements=')
        self.elem = self.makeObjList("Element", (1, 2), (row, row + 1))
        row += 1

        if config.dimension() == 3:
            self.labelmaster((0, 1), (row, row + 1), 'faces=')
            self.faces = self.makeObjList("Face", (1, 2), (row, row + 1))
            row += 1

        self.labelmaster((0, 1), (row, row + 1), 'segments=')
        self.segs = self.makeObjList("Segment", (1, 2), (row, row + 1))
        row += 1

        self.labelmaster((0, 1), (row, row + 1), 'node groups=')
        self.group = self.entrymaster((1, 2), (row, row + 1))
        gtklogger.setWidgetName(self.group, "Group")
        row += 1

        self.labelmaster((0, 1), (row, row + 1), 'boundary=')
        self.bndy = self.entrymaster((1, 2), (row, row + 1))
        gtklogger.setWidgetName(self.bndy, "Boundary")
        row += 1
Exemple #35
0
    def __init__(self, param, scope, name=None):
        debug.mainthreadTest()
        # Find the enclosing mesh widget.
        self.meshwidget = scope.findWidget(
            lambda x: isinstance(x, whowidget.WhoWidget)
            and x.whoclass is mesh.meshes)

        self.gtk = gtk.Frame()
        vbox = gtk.VBox()
        self.gtk.add(vbox)

        meshname = self.meshwidget.get_value()
        try:
            self.meshobj = mesh.meshes[meshname]
        except KeyError:
            # no mesh!
            self.meshobj = None
            vbox.add(gtk.Label('No mesh!'))
        else:
            # In the proxy case, the behavior is to set the line
            # width, etc. for all the cross sections in whatever mesh
            # is referred to.  It doesn't make sense to single out
            # individual cross-sections in this case, since they'll
            # change when the proxy resolution changes.  The set_value
            # and get_value functions must also detect the proxy case
            # and behave a little differently, since the chooser
            # doesn't get built in that case.
            if isinstance(self.meshobj, whoville.WhoProxy):
                vbox.add(gtk.Label('Selected'))
            else:
                self.chooser = chooser.MultiListWidget(
                    self.meshobj.allCrossSectionNames(), name="List")
                self.selected = gtk.CheckButton("Selected")
                gtklogger.setWidgetName(self.selected, "Selected")
                gtklogger.connect(self.selected, "clicked", self.selectedCB)
                vbox.pack_start(self.selected, expand=0, fill=0)
                vbox.pack_start(self.chooser.gtk, expand=0, fill=0)
      
        parameterwidgets.ParameterWidget.__init__(self, self.gtk, scope,
                                                  name=name,
                                                  expandable=True)
        self.set_value(param.value)

        self.gtk.show_all()
Exemple #36
0
def _OOFMenuItem_construct_gui(self, base, parent_menu, accelgroup):
    # "base" is this menu item's OOF menu parent, and "parent_menu" is
    # the to-be-constructed GtkMenuItem's gtk container.
    debug.mainthreadTest()
    if not (self.secret or self.getOption('cli_only')):

        new_gtkitem = gtk.MenuItem()  # Built with no label.
        gtklogger.setWidgetName(new_gtkitem, self.name)
        new_gtkitem.add(self.gtklabel(new_gtkitem))
        try:
            self.gtkitem.append(new_gtkitem)
        except AttributeError:
            self.gtkitem = [new_gtkitem]

        new_gtkitem.connect("destroy", self.gtkitem_destroyed)

        parent_menu.insert(new_gtkitem, self.gui_order())
        if self.help_menu:
            base.gtkhelpmenu = 1
            new_gtkitem.set_right_justified(True)

        if (self.callback is None) and (self.gui_callback is None) \
               and self.children_visible():

            new_gtkmenu = gtk.Menu()
            try:
                self.gtkmenu.append(new_gtkmenu)
            except AttributeError:
                self.gtkmenu = [new_gtkmenu]

            gtklogger.set_submenu(new_gtkitem, new_gtkmenu)
            for item in self.items:
                item.construct_gui(self, new_gtkmenu, accelgroup)  # recursive!
        else:  # no submenu, create command
            gtklogger.connect(new_gtkitem, 'activate',
                              MenuCallBackWrapper(self))
            if self.accel is not None and accelgroup is not None:
                new_gtkitem.add_accelerator('activate', accelgroup,
                                            ord(self.accel),
                                            gtk.gdk.CONTROL_MASK,
                                            gtk.ACCEL_VISIBLE)

        if not self.enabled():
            new_gtkitem.set_sensitive(0)
Exemple #37
0
    def __init__(self, toolbox):
        # The 'toolbox' argument here is the non-gui toolbox
        # corresponding to one of the inner toolboxes.  It doesn't
        # matter which one.
        toolboxGUI.GfxToolbox.__init__(self, toolbox)
        vbox = gtk.VBox(spacing=2)
        self.gtk.add(vbox)

        bbox = gtk.HBox(spacing=2)
        gtklogger.setWidgetName(bbox, "Select")
        vbox.pack_start(bbox, expand=0, fill=0)
        bbox.pack_start(gtk.Label("Select: "), expand=0, fill=0)

        self.tbbox = gtk.Frame() # holds SkelSelToolboxModeGUIs
        vbox.pack_start(self.tbbox, expand=1, fill=1)

        group = None
        self.tbdict = {}
        modebuttons = []
        skeletonselectionmodes.initialize()
        for mode in skeletonselmodebase.SkeletonSelectionMode.modes:
            if group:
                button = gtk.RadioButton(label=mode.name, group=group)
            else:
                button = gtk.RadioButton(label=mode.name)
                group = button
            modebuttons.append(button)
            gtklogger.setWidgetName(button, mode.name)
            gtklogger.connect(button, 'clicked', self.switchModeCB, mode.name)

            # Get the actual toolbox for each mode
            tb = self.gfxwindow().getToolboxByName(mode.toolboxName())
            tbgui = tbclasses[mode.name](tb, tb.method)
            self.tbdict[mode.name] = tbgui

        table = gtk.Table(columns=2, rows=2)
        bbox.pack_start(table, expand=0, fill=0)
        table.attach(modebuttons[0], 0,1, 0,1)
        table.attach(modebuttons[1], 1,2, 0,1)
        table.attach(modebuttons[2], 0,1, 1,2)
        table.attach(modebuttons[3], 1,2, 1,2)

        self.currentMode = None
        self.setMode(skeletonselmodebase.firstMode().name)
Exemple #38
0
def _OOFMenuItem_construct_gui(self, base, parent_menu, accelgroup):
    # "base" is this menu item's OOF menu parent, and "parent_menu" is
    # the to-be-constructed GtkMenuItem's gtk container.
    debug.mainthreadTest()
    if not (self.secret or self.getOption('cli_only')):

        new_gtkitem = gtk.MenuItem() # Built with no label.
        gtklogger.setWidgetName(new_gtkitem, self.name)
        new_gtkitem.add(self.gtklabel(new_gtkitem))
        try:
            self.gtkitem.append(new_gtkitem)
        except AttributeError:
            self.gtkitem = [new_gtkitem]
            
        new_gtkitem.connect("destroy", self.gtkitem_destroyed)
        
        parent_menu.insert(new_gtkitem, self.gui_order())
        if self.help_menu:
            base.gtkhelpmenu = 1
            new_gtkitem.set_right_justified(True)

        if (self.callback is None) and (self.gui_callback is None) \
               and self.children_visible():

            new_gtkmenu = gtk.Menu()
            try:
                self.gtkmenu.append(new_gtkmenu)
            except AttributeError:
                self.gtkmenu=[new_gtkmenu]

            gtklogger.set_submenu(new_gtkitem, new_gtkmenu)
            for item in self.items:
                item.construct_gui(self, new_gtkmenu, accelgroup) # recursive!
        else:                               # no submenu, create command
            gtklogger.connect(new_gtkitem, 'activate', MenuCallBackWrapper(self))
            if self.accel is not None and accelgroup is not None:
                new_gtkitem.add_accelerator('activate', accelgroup,
                                            ord(self.accel),
                                            gtk.gdk.CONTROL_MASK,
                                            gtk.ACCEL_VISIBLE)

        if not self.enabled():
            new_gtkitem.set_sensitive(0)
Exemple #39
0
    def __init__(self, param, scope=None, name=None):
        debug.mainthreadTest()
        frame = gtk.Frame()
        frame.set_shadow_type(gtk.SHADOW_IN)
        self.table = gtk.Table(rows=1, columns=3)
        self.table.set_row_spacings(0)
        self.table.set_col_spacings(0)
        frame.add(self.table)
        gtklogger.setWidgetName(self.table, 'GroupTable')

        addbutton = gtk.Button('+')
        gtklogger.setWidgetName(addbutton, "Add")
        gtklogger.connect(addbutton, 'clicked', self.addCB)
        self.table.attach(addbutton, 0,1, 0,1, xoptions=gtk.FILL, yoptions=0,
                     xpadding=0, ypadding=0)
        tooltips.set_tooltip_text(addbutton, "Add a new group definition.")

        clabel = gtk.Label("Column")
        clabel.set_alignment(0.0, 0.5)
        cframe = gtk.Frame()
        cframe.set_shadow_type(gtk.SHADOW_OUT)
        cframe.add(clabel)
        self.table.attach(cframe, 1,2, 0,1,
                          xoptions=gtk.FILL|gtk.EXPAND, yoptions=gtk.FILL,
                          xpadding=0, ypadding=0)

        nlabel = gtk.Label("Name")
        nlabel.set_alignment(0.0, 0.5)
        nframe = gtk.Frame()
        nframe.set_shadow_type(gtk.SHADOW_OUT)
        nframe.add(nlabel)
        self.table.attach(nframe, 2,3, 0,1,
                          xoptions=gtk.FILL|gtk.EXPAND, yoptions=gtk.FILL,
                          xpadding=0, ypadding=0)

        self.rows = []          #  list of GCWidgetRow objects

        parameterwidgets.ParameterWidget.__init__(self, frame, scope=scope,
                                                  name=name)
        if param.value is not None:
            self.set_value(param.value)
        self.widgetChanged(self.checkValue(), interactive=0)
Exemple #40
0
    def __init__(self, param, scope=None, name=None):
        debug.mainthreadTest()
        frame = gtk.Frame()
        frame.set_shadow_type(gtk.SHADOW_IN)
        self.table = gtk.Table(rows=1, columns=3)
        self.table.set_row_spacings(0)
        self.table.set_col_spacings(0)
        frame.add(self.table)
        gtklogger.setWidgetName(self.table, 'GroupTable')

        addbutton = gtk.Button('+')
        gtklogger.setWidgetName(addbutton, "Add")
        gtklogger.connect(addbutton, 'clicked', self.addCB)
        self.table.attach(addbutton, 0,1, 0,1, xoptions=gtk.FILL, yoptions=0,
                     xpadding=0, ypadding=0)
        tooltips.set_tooltip_text(addbutton, "Add a new group definition.")

        clabel = gtk.Label("Column")
        clabel.set_alignment(0.0, 0.5)
        cframe = gtk.Frame()
        cframe.set_shadow_type(gtk.SHADOW_OUT)
        cframe.add(clabel)
        self.table.attach(cframe, 1,2, 0,1,
                          xoptions=gtk.FILL|gtk.EXPAND, yoptions=gtk.FILL,
                          xpadding=0, ypadding=0)

        nlabel = gtk.Label("Name")
        nlabel.set_alignment(0.0, 0.5)
        nframe = gtk.Frame()
        nframe.set_shadow_type(gtk.SHADOW_OUT)
        nframe.add(nlabel)
        self.table.attach(nframe, 2,3, 0,1,
                          xoptions=gtk.FILL|gtk.EXPAND, yoptions=gtk.FILL,
                          xpadding=0, ypadding=0)

        self.rows = []          #  list of GCWidgetRow objects

        parameterwidgets.ParameterWidget.__init__(self, frame, scope=scope,
                                                  name=name)
        if param.value is not None:
            self.set_value(param.value)
        self.widgetChanged(self.checkValue(), interactive=0)
Exemple #41
0
    def __init__(self, objlist=None, displaylist=[], callback=None,
                 dbcallback=None, autoselect=True, helpdict={},
                 comparator=None, markup=False,
                 name=None, separator_func=None):
        debug.mainthreadTest()
        self.liststore = gtk.ListStore(gobject.TYPE_STRING,
                                       gobject.TYPE_PYOBJECT)
        self.treeview = gtk.TreeView(self.liststore)
        self.gtk = self.treeview
        self.treeview.set_property("headers-visible", 0)
        cell = gtk.CellRendererText()
        if markup:
            # Expect to find pango markup in displaylist, which is
            # stored in column 0 of the ListStore.
            self.tvcol = gtk.TreeViewColumn("", cell, markup=0)
        else:
            self.tvcol = gtk.TreeViewColumn("", cell)
        self.treeview.append_column(self.tvcol)
        self.tvcol.add_attribute(cell, 'text', 0)
        self.autoselect = autoselect
        self.callback = callback or (lambda x, interactive=False: None)
        self.dbcallback = dbcallback or (lambda x: None)
        self.comparator = comparator or (lambda x, y: x == y)
        self.activatesignal = gtklogger.connect(self.treeview, 'row-activated',
                                               self.rowactivatedCB)

        # If separator_func is provided, it must be a function that
        # takes a gtk.TreeModel and gtk.TreeIter as arguments, and
        # return True if the row given by model[iter] is to be
        # represented by a separator in the TreeView.
        if separator_func:
            self.treeview.set_row_separator_func(separator_func)

        if name:
            gtklogger.setWidgetName(self.treeview, name)
        selection = self.treeview.get_selection()
        gtklogger.adoptGObject(selection, self.treeview,
                              access_method=self.treeview.get_selection)
        self.selectsignal = gtklogger.connect(selection, 'changed',
                                             self.selectionchangedCB)
        self.update(objlist or [], displaylist, helpdict=helpdict)
Exemple #42
0
    def __init__(self, param=None, scope=None, name=None, framed=True):
        vbox = gtk.VBox(spacing=2)
        if framed:
            parameterwidgets.ParameterWidget.__init__(self,
                                                      gtk.Frame(),
                                                      scope=scope,
                                                      name=name)
            self.gtk.add(vbox)
        else:
            parameterwidgets.ParameterWidget.__init__(self,
                                                      vbox,
                                                      scope=scope,
                                                      name=name)

        self.chooser = chooser.ChooserWidget(DestinationParamWidget.namelist,
                                             callback=self.chooserCB,
                                             name='Chooser')
        vbox.pack_start(self.chooser.gtk, expand=0, fill=0)

        bbox = gtk.HBox(spacing=2, homogeneous=True)
        vbox.pack_start(bbox, expand=0, fill=0)

        newbutton = gtkutils.StockButton(gtk.STOCK_NEW, "New...")
        gtklogger.setWidgetName(newbutton, "New")
        bbox.pack_start(newbutton, expand=1, fill=1)
        gtklogger.connect(newbutton, 'clicked', self.newCB)

        self.clearbutton = gtkutils.StockButton(gtk.STOCK_CLEAR, "Clear")
        gtklogger.setWidgetName(self.clearbutton, "Clear")
        bbox.pack_start(self.clearbutton, expand=1, fill=1)
        gtklogger.connect(self.clearbutton, 'clicked', self.clearCB)

        self.sbcallbacks = [
            switchboard.requestCallbackMain('destinations changed',
                                            self.rebuild)
        ]
        self.rebuild()
        if param and param.value is not None:
            self.set_value(param.value)
        self.widgetChanged(1, interactive=0)
        _allDestinationWidgets.add(self)
Exemple #43
0
 def __init__(self, params, kset, scope=None, name=None):
     debug.mainthreadTest()
     self.params = params
     self.kset = kset
     SymmetricMatrixInput.__init__(self, 'C', 6,6, value=None, scope=scope,
                                   name=name)
     #
     # Make default blocks according to the kset dictionary.
     for (k,f) in self.floats.items():
         if k in self.kset:
             pass
         else:
             f.gtk.set_editable(0)
             f.gtk.set_sensitive(0)
     #
     # Connect the "obvious" callbacks.  Child classes may add
     # additional callbacks.
     for k in self.kset:
         # "activate" needs a dummy argument for the "event" slot.
         gtklogger.connect(self.floats[k].gtk, "activate",self.new_c,None)
         gtklogger.connect(self.floats[k].gtk, "focus_out_event",self.new_c)
    def __init__(self, set_callback, ok_callback):
        debug.mainthreadTest()
        self.gtk = gtk.HBox()
        self.set_callback = set_callback
        self.historian = historian.Historian(self.setCB,
                                             self.sensitize)

        # Buttons:  Previous, OK, and next.
        self.prevbutton = gtkutils.prevButton()
        gtklogger.connect(self.prevbutton, "clicked", self.historian.prevCB)
        tooltips.set_tooltip_text(self.prevbutton,
            "Recall the previous selection modification operation.")
        self.gtk.pack_start(self.prevbutton, expand=0, fill=0, padding=2)

        self.okbutton = gtk.Button(stock=gtk.STOCK_OK)
        gtklogger.setWidgetName(self.okbutton, 'OK')
        gtklogger.connect(self.okbutton, "clicked", ok_callback)
        self.gtk.pack_start(self.okbutton, expand=1, fill=1, padding=2)
        tooltips.set_tooltip_text(self.okbutton,
            "Perform the selection modification operation.")
        self.okbutton.set_sensitive(0)
        
        self.nextbutton = gtkutils.nextButton()
        gtklogger.connect(self.nextbutton, "clicked", self.historian.nextCB)
        tooltips.set_tooltip_text(self.nextbutton,
            "Recall the next selection modification operation.")
        self.gtk.pack_start(self.nextbutton, expand=0, fill=0, padding=2)
Exemple #45
0
    def makeTimeBox(self):
        # Construct and return, but don't install, a box containing
        # the time slider and other widgets.
        timebox = gtk.HBox(spacing=2)
        gtklogger.setWidgetName(timebox, 'time')
        timebox.pack_start(gtk.Label("time:"),
                           expand=False,
                           fill=False,
                           padding=2)

        self.prevtimeButton = gtkutils.StockButton(gtk.STOCK_GO_BACK)
        gtklogger.setWidgetName(self.prevtimeButton, "prev")
        gtklogger.connect(self.prevtimeButton, 'clicked', self.prevtimeCB)
        timebox.pack_start(self.prevtimeButton, expand=False, fill=False)
        tooltips.set_tooltip_text(self.prevtimeButton,
                                  "Go to the previous stored time.")

        self.nexttimeButton = gtkutils.StockButton(gtk.STOCK_GO_FORWARD)
        gtklogger.setWidgetName(self.nexttimeButton, "next")
        gtklogger.connect(self.nexttimeButton, 'clicked', self.nexttimeCB)
        timebox.pack_start(self.nexttimeButton, expand=False, fill=False)
        tooltips.set_tooltip_text(self.nexttimeButton,
                                  "Go to the next stored time.")

        # The slider/entry combo has immediate==False because we don't
        # want to update until the user is done typing a time.
        self.timeslider = labelledslider.FloatLabelledSlider(
            value=0.0,
            vmin=0,
            vmax=0,
            step=0.01,
            callback=self.timeSliderCB,
            name='timeslider',
            immediate=False)
        self.timeslider.set_policy(gtk.UPDATE_DISCONTINUOUS)
        timebox.pack_start(self.timeslider.gtk, expand=True, fill=True)
        self.timeslider.set_tooltips(slider="Select an interpolation time.",
                                     entry="Enter an interpolation time.")

        return timebox
Exemple #46
0
    def __init__(self, namelist, callback=None, callbackargs=(),
                 update_callback=None, update_callback_args=(),
                 button_callback=None, button_callback_args=(),
                 buttontext="New...",
                 separator_func=None):
        ChooserWidget.__init__(self, namelist,
                               callback=callback, callbackargs=callbackargs,
                               update_callback=update_callback,
                               update_callback_args=update_callback_args,
                               helpdict={}, separator_func=separator_func)

        self.button_callback = button_callback
        self.button_callback_args = button_callback_args
        
        # Wrap the ChooserWidget's gtk in a GtkHBox and make it become self.gtk
        hbox = gtk.HBox()
        hbox.pack_start(self.gtk, expand=1, fill=1, padding=2)
        self.gtk = hbox

        self.newbutton = gtk.Button(buttontext)
        hbox.pack_start(self.newbutton, expand=0, fill=0, padding=2)
        gtklogger.connect(self.newbutton, 'clicked', self.newbuttonCB)
Exemple #47
0
    def __init__(self, gfxtoolbox):
        SkeletonInfoModeGUI.__init__(self, gfxtoolbox)

        self.labelmaster((0, 1), (0, 1), 'index=')
        self.index = self.entrymaster((1, 2), (0, 1), editable=True)
        gtklogger.setWidgetName(self.index, "Index")
        self.indexChangedSignal = gtklogger.connect(self.index, 'changed',
                                                    self.indexChangedCB)
        gtklogger.connect(self.index, 'activate', self.indexChangeDoneCB)

        self.labelmaster((0, 1), (1, 2), 'elements=')
        self.elem = self.makeObjList("Element", (1, 2), (1, 2))

        self.labelmaster((0, 1), (2, 3), 'segments=')
        self.segs = self.makeObjList("Segment", (1, 2), (2, 3))

        self.labelmaster((0, 1), (3, 4), 'nodes=')
        self.nodes = self.makeObjList("Node", (1, 2), (3, 4))

        self.labelmaster((0, 1), (4, 5), 'area=')
        self.area = self.entrymaster((1, 2), (4, 5))
        gtklogger.setWidgetName(self.area, "Area")

        self.labelmaster((0, 1), (5, 6), 'homogeneity=')
        self.homog = self.entrymaster((1, 2), (5, 6))
        gtklogger.setWidgetName(self.homog, "Homogeneity")
        self.homog.set_sensitive(
            False)  # TODO 3.1: remove this when implemented

        self.labelmaster((0, 1), (6, 7), 'face groups=')
        self.group = self.entrymaster((1, 2), (6, 7))
        gtklogger.setWidgetName(self.group, "Groups")
        self.group.set_sensitive(
            False)  # TODO 3.1: remove this when implemented

        self.labelmaster((0, 1), (7, 8), 'boundary=')
        self.bndy = self.entrymaster((1, 2), (7, 8))
        gtklogger.setWidgetName(self.bndy, "Boundary")
Exemple #48
0
    def __init__(self,
                 param=None,
                 scope=None,
                 name=None,
                 framed=True,
                 verbose=False):
        debug.mainthreadTest()
        vbox = gtk.VBox(spacing=2)
        if framed:
            parameterwidgets.ParameterWidget.__init__(self,
                                                      gtk.Frame(),
                                                      scope=scope,
                                                      name=name,
                                                      verbose=verbose)
            self.gtk.add(vbox)
        else:
            parameterwidgets.ParameterWidget.__init__(self,
                                                      vbox,
                                                      scope=scope,
                                                      name=name,
                                                      verbose=verbose)

        self.chooser = chooser.ChooserWidget([],
                                             callback=self.chooserCB,
                                             name='Chooser')
        vbox.pack_start(self.chooser.gtk, expand=False, fill=False)
        bbox = gtk.HBox(spacing=2, homogeneous=True)
        vbox.pack_start(bbox, expand=0, fill=0)

        newbutton = gtkutils.StockButton(gtk.STOCK_NEW, "New...")
        gtklogger.setWidgetName(newbutton, "New")
        bbox.pack_start(newbutton, expand=True, fill=True)
        gtklogger.connect(newbutton, 'clicked', self.newCB)
        tooltips.set_tooltip_text(newbutton, "Open a new file for output.")

        self.rewindbutton = gtkutils.StockButton(gtk.STOCK_MEDIA_REWIND,
                                                 "Rewind")
        gtklogger.setWidgetName(self.rewindbutton, "Rewind")
        bbox.pack_start(self.rewindbutton, expand=True, fill=True)
        gtklogger.connect(self.rewindbutton, 'clicked', self.rewindCB)
        tooltips.set_tooltip_text(
            self.rewindbutton, "Rewind the selected file.  Data will be lost.")

        self.clearbutton = gtkutils.StockButton(gtk.STOCK_CLEAR, "Clear")
        gtklogger.setWidgetName(self.clearbutton, "Clear")
        bbox.pack_start(self.clearbutton, expand=True, fill=True)
        gtklogger.connect(self.clearbutton, 'clicked', self.clearCB)
        tooltips.set_tooltip_text(
            self.clearbutton, "Close all files and remove them from the list.")

        self.sbcallback = switchboard.requestCallbackMain(
            'output destinations changed', self.rebuild)

        self.rebuild()
        if param and param.value is not None:
            self.set_value(param.value)
        self.widgetChanged(True, interactive=False)
Exemple #49
0
    def __init__(self,
                 value=None,
                 vmin=0,
                 vmax=1,
                 step=0.01,
                 callback=None,
                 clipperclass=None,
                 name=None,
                 immediate=True):
        # "callback" is called when the user moves the slider.  If
        # immediate==True, then the callback will be called when any
        # character is typed in the Entry.  If it's false, the
        # callback won't be called until the entry loses focus.
        debug.mainthreadTest()
        self.immediate = immediate

        self.gtk = gtk.HPaned()
        if value is None:
            value = vmin
        self.clipperclass = clipperclass or DefaultClipper
        self.clipper = self.clipperclass(vmin, vmax)
        if name is not None:
            gtklogger.setWidgetName(self.gtk, name)
        self.adjustment = gtk.Adjustment(value=value,
                                         lower=vmin,
                                         upper=vmax,
                                         step_incr=step,
                                         page_incr=step)
        self.slider = gtk.HScale(self.adjustment)
        gtklogger.setWidgetName(self.slider, "slider")
        gtklogger.adoptGObject(self.adjustment,
                               self.slider,
                               access_method=self.slider.get_adjustment)
        self.slider.set_size_request(100, -1)
        self.gtk.pack1(self.slider, resize=True, shrink=True)
        self.slider.set_draw_value(False)  # we'll display the value ourselves
        self.adjustmentsignal = gtklogger.connect(self.adjustment,
                                                  'value-changed',
                                                  self.text_from_slider)

        self.entry = gtk.Entry()
        gtklogger.setWidgetName(self.entry, "entry")
        self.gtk.pack2(self.entry, resize=True, shrink=True)

        # Make sure that the Entry is big enough to hold the min and
        # max values, or at least 8 digits.
        width = max(len( ` vmin `), len( ` vmax `), 8)
        self.entry.set_size_request(width * guitop.top().digitsize, -1)

        self.entrysignal = gtklogger.connect(self.entry, 'changed',
                                             self.entry_changed)
        self.set_value(value)
        self.callback = callback
        self.changed = False

        gtklogger.connect(self.entry, 'activate', self.slider_from_text)
        gtklogger.connect(self.entry, 'focus-out-event', self.entry_lost_focus)
Exemple #50
0
    def __init__(self, pixelinfotoolbox):
        debug.mainthreadTest()
        toolboxGUI.GfxToolbox.__init__(self, "Pixel Info", pixelinfotoolbox)
        mainbox = gtk.VBox()
        self.gtk.add(mainbox)

        self.table = gtk.Table(rows=3, columns=2)
        mainbox.pack_start(self.table, expand=0, fill=0)
        
        label = gtk.Label('x=')
        label.set_alignment(1.0, 0.5)
        self.table.attach(label, 0,1, 0,1, xpadding=5, xoptions=gtk.FILL)
        self.xtext = gtk.Entry()
        gtklogger.setWidgetName(self.xtext, "X")
        self.xtext.set_size_request(10*guitop.top().digitsize, -1)
        self.table.attach(self.xtext, 1,2, 0,1,
                          xpadding=5, xoptions=gtk.EXPAND|gtk.FILL)
        label = gtk.Label('y=')
        label.set_alignment(1.0, 0.5)
        self.table.attach(label, 0,1, 1,2, xpadding=5, xoptions=gtk.FILL)
        self.ytext = gtk.Entry()
        gtklogger.setWidgetName(self.ytext, "Y")
        self.ytext.set_size_request(10*guitop.top().digitsize, -1)
        self.table.attach(self.ytext, 1,2, 1,2,
                          xpadding=5, xoptions=gtk.EXPAND|gtk.FILL)


        self.xtsignal = gtklogger.connect(self.xtext, 'changed',
                                          self.pointChanged)
        self.ytsignal = gtklogger.connect(self.ytext, 'changed',
                                          self.pointChanged)

        box = gtk.HBox(homogeneous=True, spacing=2)
        self.updatebutton = gtkutils.StockButton(gtk.STOCK_REFRESH, 'Update')
        box.pack_start(self.updatebutton, expand=1, fill=1)
        gtklogger.setWidgetName(self.updatebutton, "Update")
        gtklogger.connect(self.updatebutton, 'clicked', self.updateButtonCB)
        self.clearbutton = gtkutils.StockButton(gtk.STOCK_CLEAR, 'Clear')
        box.pack_start(self.clearbutton, expand=1, fill=1)
        gtklogger.setWidgetName(self.clearbutton, "Clear")
        gtklogger.connect(self.clearbutton, 'clicked', self.clearButtonCB)
        self.table.attach(box, 0,2, 2,3,
                          xpadding=5, xoptions=gtk.EXPAND|gtk.FILL, yoptions=0)

        self.updatebutton.set_sensitive(0)
        self.clearbutton.set_sensitive(0)
        self.buildGUI()
        
        self.sbcallbacks = [
            switchboard.requestCallbackMain(pixelinfotoolbox,
                                            self.update),
            switchboard.requestCallbackMain('new pixelinfo plugin',
                                            self.buildGUI),
            switchboard.requestCallbackMain((self.gfxwindow(),
                                             'layers changed'), self.update)
            ]
Exemple #51
0
 def __init__(self, param, scope=None, name=None):
     debug.mainthreadTest()
     if param.value:
         labelstr = 'true'
     else:
         labelstr = 'false'
     self.label = gtk.Label(labelstr)
     ParameterWidget.__init__(self, gtk.Frame(), scope=scope)
     self.button = gtk.CheckButton()
     self.gtk.add(self.button)
     self.button.add(self.label)
     # name is assigned to the button, not the frame, because it's
     # the button that gets connected.
     gtklogger.setWidgetName(self.button, name)
     self.signal = gtklogger.connect(self.button, 'clicked', self.buttonCB)
     self.set_value(param.value)
Exemple #52
0
    def addMoreWidgets(self, vbox): # Widgets below the file list.
        hbox = gtk.HBox()
        vbox.pack_start(hbox, expand=False, fill=False)
        label = gtk.Label('File:')
        hbox.pack_start(gtk.Label('File:'), expand=False, fill=False)
        self.fileEntry = gtk.Entry()
        gtklogger.setWidgetName(self.fileEntry, 'File')
        self.fileEntrySignal = gtklogger.connect(self.fileEntry, 'changed',
                                                 self.entryChangeCB)
        hbox.pack_start(self.fileEntry, expand=True, fill=True)

        # Add file-name completion in the fileEntry widget.  The
        # fileList already has file-name completion in it.
        self.completion = gtk.EntryCompletion()
        self.fileEntry.set_completion(self.completion)
        self.completion.set_model(self.fileList.liststore)
        self.completion.set_text_column(0)
Exemple #53
0
 def __init__(self, namelist, callback=None, name=None):
     # If a callback is provided, it's called a *lot* of times.
     # It's called for every keystroke in the entry part of the
     # widget and every time a selection is made in the list part
     # of the widget.
     debug.mainthreadTest()
     liststore = gtk.ListStore(gobject.TYPE_STRING)
     self.combobox = gtk.ComboBoxEntry(liststore, 0)
     if name:
         gtklogger.setWidgetName(self.combobox, name)
     self.gtk = self.combobox
     self.namelist = []
     self.current_string = None
     self.update(namelist)
     self.signal = gtklogger.connect(self.combobox, 'changed',
                                     self.changedCB)
     self.callback = callback
Exemple #54
0
    def __init__(self, scope, name=None):
        debug.mainthreadTest()

        parameterwidgets.ParameterWidget.__init__(self, gtk.HBox(), scope=scope,
                                                  name=name)
        self.times = []
        self.signals = []
        self.sbcallbacks = []
        
        self.earliestButton = gtkutils.StockButton(gtk.STOCK_MEDIA_REWIND)
        gtklogger.setWidgetName(self.earliestButton, 'earliest')
        self.signals.append(gtklogger.connect(self.earliestButton, 'clicked',
                                              self.extremeCB, 
                                              placeholder.earliest))
        self.gtk.pack_start(self.earliestButton, expand=0, fill=0)
        tooltips.set_tooltip_text(self.earliestButton,
                             "Use the earliest stored time.")

        self.prevButton = gtkutils.StockButton(gtk.STOCK_GO_BACK)
        gtklogger.setWidgetName(self.prevButton, "Prev")
        self.signals.append(gtklogger.connect(self.prevButton, 'clicked', 
                                              self.prevCB))
        self.gtk.pack_start(self.prevButton, expand=0, fill=0)
        tooltips.set_tooltip_text(self.prevButton,
                             "Go to an earlier time saved in the mesh.")

        self.text = gtk.Entry()
        gtklogger.setWidgetName(self.text, 'Text')
        self.signals.append(gtklogger.connect(self.text, 'changed',
                                              self.entryCB))
        self.gtk.pack_start(self.text, expand=1, fill=1)

        self.nextButton = gtkutils.StockButton(gtk.STOCK_GO_FORWARD)
        gtklogger.setWidgetName(self.nextButton, "Next")
        gtklogger.connect(self.nextButton, 'clicked', self.nextCB)
        self.gtk.pack_start(self.nextButton, expand=0, fill=0)
        tooltips.set_tooltip_text(self.nextButton,
                             "Go to a later time saved in the mesh.")

        self.latestButton = gtkutils.StockButton(gtk.STOCK_MEDIA_FORWARD)
        gtklogger.setWidgetName(self.latestButton, 'latest')
        self.signals.append(gtklogger.connect(self.latestButton, 'clicked',
                                              self.extremeCB,
                                              placeholder.latest))
        self.gtk.pack_start(self.latestButton, expand=0, fill=0)
        tooltips.set_tooltip_text(self.latestButton,
                             "Use the latest stored time.")
        
        self.mode = placeholder.latest # 'earliest', 'latest', or None
Exemple #55
0
 def __init__(self, registration, rclfactory):
     debug.mainthreadTest()
     self.registration = registration
     self.rclfactory = rclfactory
     self._button = gtk.CheckButton()
     gtklogger.setWidgetName(self._button, registration.name()+'Toggle')
     # We could use an Expander instead of a CheckButton here, but
     # it might be confusing.  The check button makes it clear that
     # a method is selected.  Just expanding an Expander might not
     # be so obvious, especially if a Registration has no
     # Parameters.  Also, the whole RegisteredClassListFactory
     # would have to be redone.
     self._signal = gtklogger.connect(self._button, 'clicked', self.buttonCB)
     self._box = gtk.VBox()
     self._label = gtk.Label(registration.name())
     self._label.set_alignment(0.0, 0.5)
     if hasattr(registration, 'tip'):
         tooltips.set_tooltip_text(self._label,registration.tip)
     self.sbcallback = None
     self.makeWidget()
    def __init__(self, param=None, scope=None, name=None, framed=True):
        debug.mainthreadTest()
        vbox = gtk.VBox(spacing=2)
        if framed:
            parameterwidgets.ParameterWidget.__init__(self, gtk.Frame(),
                                                  scope=scope, name=name)
            self.gtk.add(vbox)
        else:
            parameterwidgets.ParameterWidget.__init__(self, vbox, scope=scope,
                                                      name=name)

        self.chooser = chooser.ChooserWidget([], callback=self.chooserCB,
                                             name='Chooser')
        vbox.pack_start(self.chooser.gtk, expand=False, fill=False)
        bbox = gtk.HBox(spacing=2, homogeneous=True)
        vbox.pack_start(bbox, expand=0, fill=0)

        newbutton = gtkutils.StockButton(gtk.STOCK_NEW, "New...")
        gtklogger.setWidgetName(newbutton, "New")
        bbox.pack_start(newbutton, expand=True, fill=True)
        gtklogger.connect(newbutton, 'clicked', self.newCB)
        tooltips.set_tooltip_text(newbutton,
                                  "Open a new file for output.")

        self.rewindbutton = gtkutils.StockButton(gtk.STOCK_MEDIA_REWIND,
                                                 "Rewind")
        gtklogger.setWidgetName(self.rewindbutton, "Rewind")
        bbox.pack_start(self.rewindbutton, expand=True, fill=True)
        gtklogger.connect(self.rewindbutton, 'clicked', self.rewindCB)
        tooltips.set_tooltip_text(
            self.rewindbutton,
            "Rewind the selected file.  Data will be lost.")

        self.clearbutton = gtkutils.StockButton(gtk.STOCK_CLEAR, "Clear")
        gtklogger.setWidgetName(self.clearbutton, "Clear")
        bbox.pack_start(self.clearbutton, expand=True, fill=True)
        gtklogger.connect(self.clearbutton, 'clicked', self.clearCB)
        tooltips.set_tooltip_text(
            self.clearbutton,
            "Close all files and remove them from the list.")

        self.sbcallback = switchboard.requestCallbackMain(
            'output destinations changed', self.rebuild)

        self.rebuild()
        if param and param.value is not None:
            self.set_value(param.value)
        self.widgetChanged(True, interactive=False)
Exemple #57
0
def _RadioOOFMenuItem_construct_gui(self, base, parent_menu, accelgroup):
    debug.mainthreadTest()
    try:
        gtkgroup = self.group.gtk
    except AttributeError:
        new_gtkitem = gtk.RadioMenuItem(group=None)
        gtklogger.setWidgetName(new_gtkitem, self.name)
        self.group.gtk = [new_gtkitem]
    else:
        new_gtkitem = gtk.RadioMenuItem(group=gtkgroup[-1])
                                       
    new_gtkitem.add(self.gtklabel(new_gtkitem))
    # Set the state of the button.  This calls the callback, so we do
    # it here before the callback is connected.
    new_gtkitem.set_active(self.value)
    
    try:
        self.gtkitem.append(new_gtkitem)
    except AttributeError:
        self.gtkitem = [new_gtkitem]
    new_gtkitem.connect("destroy", self.gtkitem_destroyed)
        
    if self.accel is not None and accelgroup is not None:
        new_gtkitem.add_accelerator('activate', accelgroup,
                                     ord(self.accel),
                                     gtk.gdk.MOD1_MASK, gtk.ACCEL_VISIBLE)
        
    new_handlerid = gtklogger.connect(new_gtkitem, 'activate',
                                     RadioMenuCallBackWrapper(self))

    try:
        self.handlerid.append(new_handlerid)
    except AttributeError:
        self.handlerid = [new_handlerid]
    
    if self.getOption('disabled'):
        new_gtkitem.set_sensitive(0)
    parent_menu.add(new_gtkitem)
Exemple #58
0
 def __init__(self, namelist, callback=None, callbackargs=(),
              update_callback=None, update_callback_args=(), helpdict={},
              name=None, separator_func=None):
     debug.mainthreadTest()
     assert name is not None
     
     # If this is used as a base class for another widget, self.gtk
     # will be redefined.  So if a ChooserWidget function needs to
     # refer to the ComboBox gtk widget, it must use
     # self.combobox instead of self.gtk.
     liststore = gtk.ListStore(gobject.TYPE_STRING)
     self.combobox = gtk.ComboBox(liststore)
     if name:
         gtklogger.setWidgetName(self.combobox, name)
     cell = gtk.CellRendererText()
     self.combobox.pack_start(cell, True)
     self.combobox.set_cell_data_func(cell, self.cell_layout_data_func)
     # If separator_func is provided, it must be a function that
     # takes a gtk.TreeModel and gtk.TreeIter as arguments, and
     # return True if the row given by model[iter] is to be
     # represented by a separator in the TreeView.
     if separator_func:
         self.combobox.set_row_separator_func(separator_func)
     self.gtk = self.combobox
     self.current_string = None
     self.callback = callback
     self.callbackargs = callbackargs
     self.helpdict = {}
     self.tipmap = {}                # see cell_layout_data_func()
     self.signal = gtklogger.connect(self.combobox, 'changed',
                                    self.changedCB)
     # make sure that the update_callback isn't installed until
     # after the widget is initialized.
     self.update_callback = None
     self.update_callback_args = ()
     self.update(namelist, helpdict)
     self.update_callback = update_callback
     self.update_callback_args = update_callback_args