Esempio n. 1
0
    def __init__(self):
        self.built = False
        oofGUI.MainPage.__init__(self, name="Active %s"%Spacestring,
                                 ordering=71.1,
                                 tip="Modify active %s."%spacestring)

        mainbox = gtk.VBox(spacing=2)
        self.gtk.add(mainbox)

        # Microstructure widget, centered at the top of the page.
        align = gtk.Alignment(xalign=0.5)
        mainbox.pack_start(align, expand=0, fill=0)
        centerbox = gtk.HBox(spacing=3)
        align.add(centerbox)
        label = gtk.Label('Microstructure=')
        label.set_alignment(1.0, 0.5)
        centerbox.pack_start(label, expand=0, fill=0)
        self.mswidget = whowidget.WhoWidget(microstructure.microStructures,
                                            scope=self)
        centerbox.pack_start(self.mswidget.gtk[0], expand=0, fill=0)

        mainpane = gtk.HPaned()
        gtklogger.setWidgetName(mainpane, 'Pane')
        mainbox.pack_start(mainpane, expand=1, fill=1)
        gtklogger.connect_passive(mainpane, 'notify::position')

        # Active area status in the left half of the main pane.
        vbox = gtk.VBox()
        mainpane.pack1(vbox, resize=1, shrink=0)
        aasframe = gtk.Frame("Active %s Status"%Spacestring)
        aasframe.set_shadow_type(gtk.SHADOW_IN)
        vbox.pack_start(aasframe, expand=0, fill=0, padding=2)
        self.aainfo = gtk.Label()
        gtklogger.setWidgetName(self.aainfo, "Status")
##        self.aainfo.set_alignment(0.0, 0.5)
        aasframe.add(self.aainfo)

        naaframe = gtk.Frame("Named Active %ss"%Spacestring)
        naaframe.set_shadow_type(gtk.SHADOW_IN)
        vbox.pack_start(naaframe, expand=1, fill=1)
        naabox = gtk.VBox()
        naaframe.add(naabox)
        self.aalist = chooser.ScrolledChooserListWidget(
            callback=self.aalistCB, dbcallback=self.aalistCB2,
            name="NamedAreas")
        naabox.pack_start(self.aalist.gtk, expand=1, fill=1, padding=2)
        bbox = gtk.HBox()
        naabox.pack_start(bbox, expand=0, fill=0, padding=2)
        self.storebutton = gtk.Button("Store...")
        bbox.pack_start(self.storebutton, expand=1, fill=0)
        gtklogger.setWidgetName(self.storebutton, "Store")
        gtklogger.connect(self.storebutton, 'clicked', self.storeCB)
        tooltips.set_tooltip_text(
            self.storebutton,
            "Save the current active %s for future use."%spacestring)
        self.renamebutton = gtk.Button("Rename...")
        bbox.pack_start(self.renamebutton, expand=1, fill=0)
        gtklogger.setWidgetName(self.renamebutton, "Rename")
        gtklogger.connect(self.renamebutton, 'clicked', self.renameCB)
        tooltips.set_tooltip_text(self.renamebutton,
                             "Rename the selected saved active %s."%spacestring)
        self.deletebutton = gtk.Button("Delete")
        bbox.pack_start(self.deletebutton, expand=1, fill=0)
        gtklogger.setWidgetName(self.deletebutton, "Delete")
        gtklogger.connect(self.deletebutton, 'clicked', self.deleteCB)
        tooltips.set_tooltip_text(self.deletebutton,
                             "Delete the selected saved active %s."%spacestring)
        self.restorebutton = gtk.Button("Restore")
        bbox.pack_start(self.restorebutton, expand=1, fill=0)
        gtklogger.setWidgetName(self.restorebutton, "Restore")
        gtklogger.connect(self.restorebutton, 'clicked', self.restoreCB)
        tooltips.set_tooltip_text(self.restorebutton,
                             "Use the selected saved active %s."%spacestring)
        
        # Active area modification methods in the right half of the main pane
        modframe = gtk.Frame("Active %s Modification"%Spacestring)
        gtklogger.setWidgetName(modframe, "Modify")
        modframe.set_shadow_type(gtk.SHADOW_IN)
        mainpane.pack2(modframe, resize=0, shrink=0)
        modbox = gtk.VBox()
        modframe.add(modbox)
##        scroll = gtk.ScrolledWindow()
##        scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
##        modbox.pack_start(scroll, expand=1, fill=1)
        self.activeareaModFactory = regclassfactory.RegisteredClassFactory(
            activeareamod.ActiveAreaModifier.registry, title="Method:",
            scope=self, name="Method")
##        scroll.add_with_viewport(self.activeareaModFactory.gtk)
        modbox.pack_start(self.activeareaModFactory.gtk, expand=1, fill=1)
        self.historian = historian.Historian(self.activeareaModFactory.set,
                                             self.sensitizeHistory,
                                             setCBkwargs={'interactive':1})
        self.activeareaModFactory.set_callback(self.historian.stateChangeCB)

        # Prev, OK, and Next buttons
        hbox = gtk.HBox()
        modbox.pack_start(hbox, expand=0, fill=0, padding=2)
        self.prevbutton = gtkutils.prevButton()
        hbox.pack_start(self.prevbutton, expand=0, fill=0, padding=2)
        gtklogger.connect(self.prevbutton, 'clicked', self.historian.prevCB)
        tooltips.set_tooltip_text(
            self.prevbutton,
            'Recall the previous active %s modification operation.'%spacestring)
        self.okbutton = gtk.Button(stock=gtk.STOCK_OK)
        hbox.pack_start(self.okbutton, expand=1, fill=1, padding=2)
        gtklogger.setWidgetName(self.okbutton, "OK")
        gtklogger.connect(self.okbutton, 'clicked', self.okbuttonCB)
        tooltips.set_tooltip_text(
            self.okbutton,
            'Perform the active %s modification operation defined above.'
            %spacestring)
        self.nextbutton = gtkutils.nextButton()
        hbox.pack_start(self.nextbutton, expand=0, fill=0, padding=2)
        gtklogger.connect(self.nextbutton, 'clicked', self.historian.nextCB)
        tooltips.set_tooltip_text(
            self.nextbutton,
            "Recall the next active %s modification operation."%spacestring)

        # Undo, Redo, Override
        hbox = gtk.HBox()
        modbox.pack_start(hbox, expand=0, fill=0, padding=2)
        self.undobutton = gtk.Button(stock=gtk.STOCK_UNDO)
        hbox.pack_start(self.undobutton, expand=1, fill=0)
        gtklogger.setWidgetName(self.undobutton, "Undo")
        gtklogger.connect(self.undobutton, 'clicked', self.undoCB)
        tooltips.set_tooltip_text(self.undobutton,
                                  "Undo the previous operation.")

        self.redobutton = gtk.Button(stock=gtk.STOCK_REDO)
        hbox.pack_start(self.redobutton, expand=1, fill=0)
        gtklogger.setWidgetName(self.redobutton, "Redo")
        gtklogger.connect(self.redobutton, 'clicked', self.redoCB)
        tooltips.set_tooltip_text(self.redobutton, "Redo an undone operation.")

        self.overridebutton = gtk.ToggleButton('Override')
        hbox.pack_start(self.overridebutton, expand=1, fill=0)
        gtklogger.setWidgetName(self.overridebutton, "Override")
        self.overridesignal = gtklogger.connect(self.overridebutton,
                                               'clicked', self.overrideCB)
        tooltips.set_tooltip_text(self.overridebutton,
                             "Temporarily activate the entire microstructure.")

        # Switchboard signals
        self.sbcallbacks = [
            switchboard.requestCallback(self.mswidget,
                                        self.mswidgetCB),
            switchboard.requestCallback("active area modified",
                                        self.aamodified),
            switchboard.requestCallbackMain("stored active areas changed",
                                            self.storedAAChanged),
            switchboard.requestCallbackMain(('validity',
                                             self.activeareaModFactory),
                                            self.validityChangeCB)
            ]

        self.built = True
Esempio n. 2
0
    def __init__(self, parent):
        debug.mainthreadTest()
        self.parent = parent
        self.gtk = gtk.Frame()
        gtklogger.setWidgetName(self.gtk, 'Groups')
        self.gtk.set_shadow_type(gtk.SHADOW_IN)
        box = gtk.HBox(spacing=2)
        self.gtk.add(box)
        # Set in chooserCB, the widget callback for the chooser list.
        self.current_group_name = None
        # List of buttons which are sensitive only when a group is selected.
        self.groupbuttons = []
        # List of buttons which are sensitive when there is a group
        # and a selection.
        self.groupandselectionbuttons = []

        # Left-hand button box.  New/Auto/Rename/Copy/Delete/DeleteAll
        lbuttons = gtk.VBox(spacing=2)
        box.pack_start(lbuttons, fill=0, expand=0)

        self.new_button = gtk.Button("New...")
        gtklogger.setWidgetName(self.new_button, 'New')
        lbuttons.pack_start(self.new_button, fill=0, expand=0)
        gtklogger.connect(self.new_button, "clicked", self.newGroupCB)
        tooltips.set_tooltip_text(self.new_button,"Create a new empty group.")

        self.auto_button = gtk.Button("Auto")
        gtklogger.setWidgetName(self.auto_button, 'Auto')
        lbuttons.pack_start(self.auto_button, fill=0, expand=0)
        gtklogger.connect(self.auto_button, 'clicked', self.autoGroupCB)
        tooltips.set_tooltip_text(self.auto_button,
            "Automatically create groups from the current pixel groups.")
        
        self.rename_button = gtk.Button("Rename...")
        gtklogger.setWidgetName(self.rename_button, 'Rename')
        lbuttons.pack_start(self.rename_button, fill=0, expand=0)
        self.groupbuttons.append(self.rename_button)
        gtklogger.connect(self.rename_button, "clicked", self.renameGroupCB)
        tooltips.set_tooltip_text(self.rename_button,"Rename the selected group.")

        self.copy_button = gtk.Button("Copy...")
        gtklogger.setWidgetName(self.copy_button, 'Copy')
        lbuttons.pack_start(self.copy_button, fill=0, expand=0)
        self.groupbuttons.append(self.copy_button)
        gtklogger.connect(self.copy_button, "clicked", self.copyGroupCB)
        tooltips.set_tooltip_text(self.copy_button,"Copy the selected group.")

        self.delete_button = gtk.Button("Delete")
        gtklogger.setWidgetName(self.delete_button, 'Delete')
        lbuttons.pack_start(self.delete_button, fill=0, expand=0)
        self.groupbuttons.append(self.delete_button)
        gtklogger.connect(self.delete_button, "clicked", self.deleteGroupCB)
        tooltips.set_tooltip_text(self.delete_button,"Deleted the selected group.")

        self.deleteAll_button = gtk.Button("Delete All")
        gtklogger.setWidgetName(self.deleteAll_button, 'DeleteAll')
        lbuttons.pack_start(self.deleteAll_button, fill=0, expand=0)
        gtklogger.connect(self.deleteAll_button, 'clicked', self.deleteAllCB)
        tooltips.set_tooltip_text(self.deleteAll_button,"Delete all groups.")
        
        # Groups list.
        self.grouplist = chooser.ScrolledChooserListWidget(
            callback=self.chooserCB, name="GroupList")
        box.pack_start(self.grouplist.gtk, fill=1, expand=1)
        
        # Right-hand button box.  Add/Remove/Clear/ClearAll/Info
        rbuttons = gtk.VBox(spacing=2)
        box.pack_start(rbuttons, fill=0, expand=0)

        self.add_button = gtk.Button("Add")
        gtklogger.setWidgetName(self.add_button, 'Add')
        rbuttons.pack_start(self.add_button, fill=0, expand=0)
        self.groupandselectionbuttons.append(self.add_button)
        gtklogger.connect(self.add_button, "clicked", self.addToGroupCB)
        tooltips.set_tooltip_text(self.add_button,
            "Add the currently selected pixels to the selected group.")

        self.remove_button = gtk.Button("Remove")
        gtklogger.setWidgetName(self.remove_button, 'Remove')
        rbuttons.pack_start(self.remove_button, fill=0, expand=0)
        self.groupandselectionbuttons.append(self.remove_button)
        gtklogger.connect(self.remove_button, "clicked", self.removeFromGroupCB)
        tooltips.set_tooltip_text(self.remove_button,
              "Remove the currently selected pixels from the selected group.")
        
        self.clear_button = gtk.Button("Clear")
        gtklogger.setWidgetName(self.clear_button, 'Clear')
        rbuttons.pack_start(self.clear_button, fill=0, expand=0)
        gtklogger.connect(self.clear_button, "clicked", self.clearGroupCB)
        tooltips.set_tooltip_text(self.clear_button,
            "Remove all pixels from the selected group.")

        self.clearAll_button = gtk.Button("Clear All")
        gtklogger.setWidgetName(self.clearAll_button, 'ClearAll')
        rbuttons.pack_start(self.clearAll_button, fill=0, expand=0)
        gtklogger.connect(self.clearAll_button, "clicked", self.clearAllCB)
        tooltips.set_tooltip_text(self.clearAll_button,
            "Remove all pixels from all groups.")

        self.info_button = gtk.Button("Info")
        gtklogger.setWidgetName(self.info_button, 'Info')
        rbuttons.pack_start(self.info_button, fill=0, expand=0)
        self.groupbuttons.append(self.info_button)
        gtklogger.connect(self.info_button, "clicked", self.queryGroupCB)
        tooltips.set_tooltip_text(self.info_button,
            "Display information about the selected group in the OOF Messages window.")
        
        ## TODO: Hide this frame when mode.materialsallowed is False.
        matframe = gtk.Frame("Material")
#        matframe.set_shadow_type(gtk.SHADOW_IN)
        rbuttons.pack_start(matframe, expand=0, fill=0, padding=3)
        matbox = gtk.VBox(spacing=2)
        matframe.add(matbox)

        self.addmaterial_button = gtk.Button("Assign")
        gtklogger.setWidgetName(self.addmaterial_button, 'AddMaterial')
        matbox.pack_start(self.addmaterial_button, fill=0, expand=0)
        gtklogger.connect(self.addmaterial_button, "clicked",
                          self.addMaterialCB)
        tooltips.set_tooltip_text(self.addmaterial_button,
            "Assign a material to the members of the selected group.")

        self.removematerial_button = gtk.Button("Remove")
        matbox.pack_start(self.removematerial_button, fill=0, expand=0)
        gtklogger.connect(self.removematerial_button, "clicked",
                          self.removeMaterialCB)
        tooltips.set_tooltip_text(self.removematerial_button,
            "Remove an explicitly assigned material from the members of the selected group.")
        
        # Need to be notified when groupset memberships change.
        switchboard.requestCallback("groupset member added", self.group_added),
        switchboard.requestCallback("groupset member renamed",
                                    self.group_added),
        switchboard.requestCallback("groupset changed", self.groupset_changed),
        switchboard.requestCallback("groupset member resized",
                                    self.group_resized)
        switchboard.requestCallback("new pixel group", self.pxlgroup_added)
        switchboard.requestCallback("destroy pixel group", self.pxlgroup_added)
Esempio n. 3
0
    def __init__(self, parent):
        debug.mainthreadTest()
        self.parent = parent

        self.gtk = gtk.Frame('Material')
        gtklogger.setWidgetName(self.gtk, 'Material')
        self.gtk.set_shadow_type(gtk.SHADOW_IN)
        vbox = gtk.VBox()
        self.gtk.add(vbox)

        buttonbox = gtk.HBox()
        vbox.pack_start(buttonbox, expand=0, fill=0)

        self.newmaterial = gtkutils.StockButton(gtk.STOCK_NEW, 'New...')
        gtklogger.setWidgetName(self.newmaterial, 'New')
        buttonbox.pack_start(self.newmaterial, expand=1, fill=0)
        tooltips.set_tooltip_text(self.newmaterial, 'Create a new Material.')
        gtklogger.connect(self.newmaterial, "clicked", self.on_newmaterial)

        self.renamematerial = gtkutils.StockButton(gtk.STOCK_EDIT, 'Rename...')
        gtklogger.setWidgetName(self.renamematerial, 'Rename')
        buttonbox.pack_start(self.renamematerial, expand=1, fill=0)
        tooltips.set_tooltip_text(self.renamematerial, 'Rename this material.')
        gtklogger.connect(self.renamematerial, "clicked", self.on_rename)

        self.copymaterial = gtkutils.StockButton(gtk.STOCK_COPY, 'Copy...')
        gtklogger.setWidgetName(self.copymaterial, 'Copy')
        buttonbox.pack_start(self.copymaterial, expand=1, fill=0)
        tooltips.set_tooltip_text(self.copymaterial,
                                  'Create a copy of this material.')
        gtklogger.connect(self.copymaterial, "clicked", self.on_copy)

        self.deletebutton = gtkutils.StockButton(gtk.STOCK_DELETE, 'Delete')
        gtklogger.setWidgetName(self.deletebutton, 'Delete')
        buttonbox.pack_start(self.deletebutton, expand=1, fill=0)
        tooltips.set_tooltip_text(self.deletebutton, 'Delete this material.')
        gtklogger.connect(self.deletebutton, "clicked", self.on_delete)

        self.savebutton = gtkutils.StockButton(gtk.STOCK_SAVE, 'Save...')
        gtklogger.setWidgetName(self.savebutton, 'Save')
        buttonbox.pack_start(self.savebutton, expand=1, fill=0)
        tooltips.set_tooltip_text(self.savebutton,
                                  'Save this material in a file.')
        gtklogger.connect(self.savebutton, 'clicked', self.on_save)

        self.materialName = chooser.ChooserWidget(
            materialmanager.getMaterialNames(),
            callback=self.newMatSelection,
            update_callback=self.newMatSelection,
            name="MaterialList")
        self.materialName.gtk.set_border_width(3)

        vbox.pack_start(self.materialName.gtk, expand=0, fill=0)
        tooltips.set_tooltip_text(self.materialName.gtk,
                                  'Choose a Material to edit.')

        # The list of Properties belonging to a Material
        self.matproplist = chooser.ScrolledChooserListWidget(
            callback=self.matproplistCB, autoselect=False, name="PropertyList")
        self.matproplist.gtk.set_border_width(3)
        vbox.pack_start(self.matproplist.gtk, expand=1, fill=1)

        self.removebutton = gtk.Button('Remove Property from Material')
        gtklogger.setWidgetName(self.removebutton, "RemoveProperty")
        self.removebutton.set_border_width(3)
        vbox.pack_start(self.removebutton, expand=0, fill=0, padding=3)
        tooltips.set_tooltip_text(
            self.removebutton,
            'Remove the currently selected property from this material.')
        gtklogger.connect(self.removebutton, "clicked", self.on_remove)

        # Assignment of materials to pixels and removal of materials
        # from pixels may belong in a separate GUI page.  For now,
        # it's done via the dialog boxes raised by the buttons defined
        # here.
        assignframe = gtk.Frame()
        assignframe.set_shadow_type(gtk.SHADOW_IN)
        assignframe.set_border_width(3)
        vbox.pack_start(assignframe, expand=0, fill=0)

        # NB surface-mode flag is operative here.

        if runtimeflags.surface_mode:
            inner2vbox_pair = gtk.VBox()
        align = gtk.Alignment(xalign=0.5)
        inner2hbox_both = gtk.HBox()
        inner2vbox = gtk.VBox()
        if runtimeflags.surface_mode:
            assignframe.add(inner2hbox_both)
        else:
            assignframe.add(align)
            align.add(inner2hbox_both)
        inner2hbox_both.pack_start(inner2vbox)
        if runtimeflags.surface_mode:
            inner2hbox_both.pack_start(inner2vbox_pair)

        # Assign materials to pixels
        self.assignbutton = gtk.Button('Assign Material to %ss...' % Pixstring)
        gtklogger.setWidgetName(self.assignbutton, "Assign")
        self.assignbutton.set_border_width(3)
        inner2vbox.pack_start(self.assignbutton, expand=0, fill=0)
        tooltips.set_tooltip_text(
            self.assignbutton,
            'Assign the currently selected Material to %ss in a Microstructure.'
            % pixstring)
        gtklogger.connect(self.assignbutton, 'clicked', self.on_assignment)

        # Remove materials from pixels
        self.removematbutton = gtk.Button('Remove Materials from %ss...' %
                                          Pixstring)
        gtklogger.setWidgetName(self.removematbutton, "RemoveMaterial")
        self.removematbutton.set_border_width(3)
        inner2vbox.pack_start(self.removematbutton, expand=0, fill=0)
        tooltips.set_tooltip_text(
            self.removematbutton,
            'Remove all Materials from %ss in a Microstructure.' % pixstring)
        gtklogger.connect(self.removematbutton, 'clicked',
                          self.on_MS_remove_material)

        if runtimeflags.surface_mode:

            self.assigninterfacebutton = gtk.Button('Assign to interface...')
            gtklogger.setWidgetName(self.assigninterfacebutton,
                                    "AssignInterface")
            self.assigninterfacebutton.set_border_width(3)
            inner2vbox_pair.pack_start(self.assigninterfacebutton,
                                       expand=0,
                                       fill=0)
            tooltips.set_tooltip_text(
                self.assigninterfacebutton,
                'Assign the currently selected Material to an interface in a Microstructure.'
            )
            gtklogger.connect(self.assigninterfacebutton, 'clicked',
                              self.on_interface_assign)

            # Remove material from interface
            self.removeinterfacebutton = gtk.Button('Remove from interface...')
            gtklogger.setWidgetName(self.removeinterfacebutton,
                                    "RemoveInterface")
            self.removeinterfacebutton.set_border_width(3)
            inner2vbox_pair.pack_start(self.removeinterfacebutton,
                                       expand=0,
                                       fill=0)
            tooltips.set_tooltip_text(
                self.removeinterfacebutton,
                'Remove Material from an interface in a Microstructure.')
            gtklogger.connect(self.removeinterfacebutton, 'clicked',
                              self.on_interface_remove)

        # End of surface-mode block.

        self.updatePropList()
        self.gtk.show_all()

        # Switchboard callbacks.
        switchboard.requestCallbackMain("new_material", self.new_mat)
        switchboard.requestCallbackMain("remove_material", self.del_mat)
        switchboard.requestCallbackMain("prop_added_to_material",
                                        self.prop_added)
        switchboard.requestCallbackMain("prop_removed_from_material",
                                        self.prop_removed)
        switchboard.requestCallbackMain(('new who', 'Microstructure'),
                                        self.sensitize)
        switchboard.requestCallbackMain(('remove who', 'Microstructure'),
                                        self.sensitize)
Esempio n. 4
0
    def __init__(self):
        debug.mainthreadTest()
        self.built = False
        layereditor.LayerEditor.__init__(self)
        gtklogger.checkpoint("layereditor layerset changed")

        self.suppressCallbacks = 0

        widgetscope.WidgetScope.__init__(self, None)

        self.setData("gfxwindow", None)  # widgetscope data, that is

        self.sbcallbacks = [
            switchboard.requestCallbackMain('open graphics window',
                                            self.gfxwindowChanged),
            switchboard.requestCallbackMain('close graphics window',
                                            self.gfxwindowChanged)
        ]

        self.menu.File.Quit.gui_callback = quit.queryQuit

        subWindow.SubWindow.__init__(self,
                                     title="%s Graphics Layer Editor" %
                                     subWindow.oofname(),
                                     menu=self.menu)
        ##        self.gtk.set_policy(1, 1, 0)
        self.gtk.set_default_size(600, 250)
        self.gtk.connect('destroy', self.destroyCB)

        mainpane = gtk.HPaned()
        mainpane.set_border_width(3)
        mainpane.set_position(300)
        self.mainbox.pack_start(mainpane, expand=1, fill=1)

        # The left side of the layer editor is for choosing the object
        # being drawn.
        whoframe = gtk.Frame('Displayed Object')
        mainpane.pack1(whoframe, resize=1, shrink=0)
        wscroll = gtk.ScrolledWindow()
        gtklogger.logScrollBars(wscroll, "ObjectScroll")
        wscroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        whoframe.add(wscroll)
        vbox = gtk.VBox()
        wscroll.add_with_viewport(vbox)
        cmd = self.menu.LayerSet.DisplayedObject
        # This creates a table containing a WhoClassWidget and a WhoWidget:
        ptable = parameterwidgets.ParameterTable(
            [cmd.get_arg('category'),
             cmd.get_arg('object')], scope=self)
        vbox.pack_start(ptable.gtk, expand=0, fill=0)

        # The right side of the layer editor lists the display methods
        # for the object on the left side.
        methframe = gtk.Frame('Display Methods')
        gtklogger.setWidgetName(methframe, "DisplayMethods")
        mainpane.pack2(methframe, resize=1, shrink=0)
        mvbox = gtk.VBox()
        methframe.add(mvbox)
        mhbox = gtk.HBox()
        mvbox.pack_start(mhbox, expand=1, fill=1)
        self.methodList = chooser.ScrolledChooserListWidget(
            callback=self.singleClickMethodCB,
            dbcallback=self.doubleClickMethodCB,
            comparator=lambda x, y: (not x.inequivalent(y)),
            name="List")
        mhbox.pack_start(self.methodList.gtk, expand=1, fill=1, padding=3)

        # The who widget is replaced each time the who class widget is
        # activated, so its switchboard callback must be reset often,
        # and is done in findWidget().
        self.whowidgetsignal = None
        self.findWhoWidget()

        buttonbox = gtk.HBox()
        mvbox.pack_start(buttonbox, expand=0, fill=0, padding=3)

        self.newMethodButton = gtkutils.StockButton(gtk.STOCK_NEW, 'New...')
        buttonbox.pack_start(self.newMethodButton, expand=0, fill=0)
        gtklogger.setWidgetName(self.newMethodButton, "New")
        gtklogger.connect(self.newMethodButton, 'clicked',
                          self.newMethodButtonCB)
        self.editMethodButton = gtkutils.StockButton(gtk.STOCK_EDIT, 'Edit...')
        buttonbox.pack_start(self.editMethodButton, expand=0, fill=0)
        gtklogger.setWidgetName(self.editMethodButton, "Edit")
        gtklogger.connect(self.editMethodButton, 'clicked',
                          self.editMethodButtonCB)
        self.copyMethodButton = gtkutils.StockButton(gtk.STOCK_COPY, 'Copy')
        buttonbox.pack_start(self.copyMethodButton, expand=0, fill=0)
        gtklogger.setWidgetName(self.copyMethodButton, "Copy")
        gtklogger.connect(self.copyMethodButton, 'clicked',
                          self.copyMethodButtonCB)
        self.deleteMethodButton = gtkutils.StockButton(gtk.STOCK_DELETE,
                                                       'Delete')
        buttonbox.pack_start(self.deleteMethodButton, expand=0, fill=0)
        gtklogger.setWidgetName(self.deleteMethodButton, "Delete")
        gtklogger.connect(self.deleteMethodButton, 'clicked',
                          self.deleteMethodButtonCB)

        self.mainbox.pack_start(gtk.HSeparator(), expand=0, fill=0)

        # Buttons at the bottom governing LayerSet operations:
        # New LayerSet, Send to Gfx Window, etc.

        mainbuttonbox = gtk.HBox()
        self.mainbox.pack_start(mainbuttonbox, expand=0, fill=0, padding=3)

        newLayerButton = gtkutils.StockButton(gtk.STOCK_NEW, 'New Layer')
        mainbuttonbox.pack_start(newLayerButton, expand=0, fill=0, padding=3)
        gtklogger.setWidgetName(newLayerButton, "NewLayer")
        gtklogger.connect(newLayerButton, 'clicked', self.newLayerButtonCB)

        self.sendButton = gtkutils.StockButton(gtk.STOCK_GO_FORWARD,
                                               'Send',
                                               reverse=1)
        ##        self.sendButton.set_usize(80, -1)
        mainbuttonbox.pack_end(self.sendButton, expand=0, fill=0, padding=3)
        gtklogger.setWidgetName(self.sendButton, "Send")
        gtklogger.connect(self.sendButton, 'clicked', self.sendCB)
        self.destinationMenu = chooser.ChooserWidget([], name="Destination")
        mainbuttonbox.pack_end(self.destinationMenu.gtk, expand=0, fill=0)
        self.updateDestinationMenu()
        label = gtk.Label('Destination=')
        tooltips.set_tooltip_text(
            label, 'The graphics window(s) that will display the layer(s).')
        label.set_alignment(1.0, 0.5)
        mainbuttonbox.pack_end(label, expand=0, fill=0)

        self.mainbox.pack_start(gtk.HSeparator(), expand=0, fill=0, padding=3)

        # When the lhs widgets change state the rhs might have to
        # change too.  The widgets referred to here are inside the
        # ParameterTable constructed above.
        self.whoclasswidget = self.findWidget(
            lambda w: isinstance(w, whowidget.WhoClassParameterWidget))
        self.whoclasswidgetsignal = switchboard.requestCallbackMain(
            self.whoclasswidget, self.whoClassChangedCB)
        self.sbcallbacks.append(self.whoclasswidgetsignal)

        self.built = True
        self.sensitize()
        self.gtk.show_all()
Esempio n. 5
0
    def __init__(self):
        self.built = False
        oofGUI.MainPage.__init__(self,
                                 name="Skeleton Boundaries",
                                 ordering=150,
                                 tip="Create and orient boundaries.")

        mainbox = gtk.VBox(spacing=2)
        self.gtk.add(mainbox)

        align = gtk.Alignment(xalign=0.5)
        mainbox.pack_start(align, expand=0, fill=0)
        centerbox = gtk.HBox(spacing=3)
        align.add(centerbox)

        self.skelwidget = whowidget.WhoWidget(whoville.getClass('Skeleton'),
                                              scope=self)
        switchboard.requestCallbackMain(self.skelwidget, self.widgetChanged)
        label = gtk.Label('Microstructure=')
        label.set_alignment(1.0, 0.5)
        centerbox.pack_start(label, expand=0, fill=0)
        centerbox.pack_start(self.skelwidget.gtk[0], expand=0, fill=0)
        label = gtk.Label('Skeleton=')
        label.set_alignment(1.0, 0.5)
        centerbox.pack_start(label, expand=0, fill=0)
        centerbox.pack_start(self.skelwidget.gtk[1], expand=0, fill=0)

        mainpane = gtk.HPaned()
        gtklogger.setWidgetName(mainpane, 'Pane')
        mainbox.pack_start(mainpane, expand=1, fill=1)
        gtklogger.connect_passive(mainpane, 'notify::position')

        boundarylistframe = gtk.Frame("Boundaries")
        gtklogger.setWidgetName(boundarylistframe, 'Boundaries')
        boundarylistframe.set_shadow_type(gtk.SHADOW_IN)
        mainpane.pack1(boundarylistframe, resize=0, shrink=0)

        boundarylistbox = gtk.VBox()
        boundarylistframe.add(boundarylistbox)

        # List of all the boundaries.
        self.boundarylist = chooser.ScrolledChooserListWidget(
            callback=self.boundarylistCB,
            dbcallback=self.modifyBoundaryCB,
            autoselect=0,
            name="BoundaryList",
            separator_func=self.chooserSepFunc)
        boundarylistbox.pack_start(self.boundarylist.gtk, expand=1, fill=1)

        boundarybuttonbox = gtk.HBox(homogeneous=1, spacing=2)
        boundarylistbox.pack_start(boundarybuttonbox, expand=0, fill=0)

        # Buttons that actually do stuff.
        self.newbutton = gtk.Button("New...")
        gtklogger.setWidgetName(self.newbutton, 'New')
        gtklogger.connect(self.newbutton, "clicked", self.newBoundaryCB)
        tooltips.set_tooltip_text(
            self.newbutton,
            "Construct a new boundary in the skeleton and associated meshes.")
        boundarybuttonbox.pack_start(self.newbutton, expand=1, fill=1)

        self.editbutton = gtk.Button("Modify...")
        gtklogger.setWidgetName(self.editbutton, 'Modify')
        gtklogger.connect(self.editbutton, "clicked", self.modifyBoundaryCB)
        tooltips.set_tooltip_text(
            self.editbutton, "Modify the attributes of the selected boundary.")
        boundarybuttonbox.pack_start(self.editbutton, expand=1, fill=1)

        self.renamebutton = gtk.Button("Rename...")
        gtklogger.setWidgetName(self.renamebutton, 'Rename')
        gtklogger.connect(self.renamebutton, "clicked", self.renameBoundaryCB)
        tooltips.set_tooltip_text(self.renamebutton,
                                  "Rename the selected boundary.")
        boundarybuttonbox.pack_start(self.renamebutton, expand=1, fill=1)

        self.deletebutton = gtk.Button("Delete")
        gtklogger.setWidgetName(self.deletebutton, 'Delete')
        gtklogger.connect(self.deletebutton, "clicked", self.deleteBoundaryCB)
        tooltips.set_tooltip_text(
            self.deletebutton,
            "Delete the selected boundary from the skeleton and associated meshes."
        )
        boundarybuttonbox.pack_start(self.deletebutton, expand=1, fill=1)

        # TODO LATER: Copying could be added here -- the scenario is
        # that a user may want to make a copy of a boundary, and then
        # edit one of the copies.  Currently boundary editing is
        # primitive (one can only add/remove components), but when
        # visual pointy-clicky boundary editing is added, copying will
        # make sense.

        infoframe = gtk.Frame("Boundary data")
        infoframe.set_shadow_type(gtk.SHADOW_IN)
        mainpane.pack2(infoframe, resize=1, shrink=1)

        infowindow = gtk.ScrolledWindow()
        gtklogger.logScrollBars(infowindow, "InfoScroll")
        infowindow.set_shadow_type(gtk.SHADOW_IN)
        infoframe.add(infowindow)
        infowindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)

        self.infotext = fixedwidthtext.FixedWidthTextView()
        self.infotext.set_wrap_mode(gtk.WRAP_WORD)
        gtklogger.setWidgetName(self.infotext, 'status')
        self.infotext.set_editable(False)
        infowindow.add(self.infotext)

        self.built = True

        # Catches push events *after* the boundaries have been
        # propagated, and also undo/redo events.  "who changed" is
        # too early.
        switchboard.requestCallbackMain("new boundary configuration",
                                        self.newBdyConfigCB)
        switchboard.requestCallbackMain("new boundary created", self.newBdyCB)
        switchboard.requestCallbackMain("boundary removed", self.newBdyCB)
        switchboard.requestCallbackMain("boundary renamed", self.newBdyCB),
        switchboard.requestCallbackMain(("new who", "Microstructure"),
                                        self.newMicrostructureCB)
        self.selectsignals = [
            switchboard.requestCallbackMain("boundary selected",
                                            self.bdySelectedCB),
            switchboard.requestCallbackMain("boundary unselected",
                                            self.bdyUnselectedCB)
        ]
Esempio n. 6
0
    def __init__(self):
        debug.mainthreadTest()
        self.built = False

        oofGUI.MainPage.__init__(
            self,
            name="Microstructure",
            ordering=10,
            tip="Define Microstructure and %s Group objects." % Pixstring)

        vbox = gtk.VBox(spacing=2)
        self.gtk.add(vbox)

        align = gtk.Alignment(xalign=0.5)
        vbox.pack_start(align, expand=0, fill=0)
        centerbox = gtk.HBox()
        align.add(centerbox)
        label = gtk.Label('Microstructure=')
        label.set_alignment(1.0, 0.5)
        centerbox.pack_start(label, expand=0, fill=0)
        self.mswidget = whowidget.WhoWidget(microstructure.microStructures,
                                            callback=self.msCB)
        centerbox.pack_start(self.mswidget.gtk[0], expand=0, fill=0)

        align = gtk.Alignment(xalign=0.5)  # first row of ms buttons
        vbox.pack_start(align, expand=0, fill=0)
        self.newbuttonbox = gtk.HBox(homogeneous=0, spacing=3)
        align.add(self.newbuttonbox)

        self.newbutton = gtkutils.StockButton(gtk.STOCK_NEW, 'New...')
        gtklogger.setWidgetName(self.newbutton, "New")
        gtklogger.connect(self.newbutton, 'clicked', self.newEmptyCB)
        tooltips.set_tooltip_text(
            self.newbutton,
            "Create a new microstructure that is NOT associated with images.")
        self.newbuttonbox.pack_start(self.newbutton, expand=1, fill=1)

        # Other buttons can be added to the row of "New" buttons by
        # other modules.  When they're added, by addNewButton(), a
        # function can be specified for sensitizing the button.  This
        # is the list of those functions:
        self.sensitizeFns = []

        # Other modules can contribute strings to be displayed on the
        # info page.  This is the list of
        # MicrostructurePageInfoPlugIns that retrieve those strings.
        self.infoplugins = []

        align = gtk.Alignment(xalign=0.5)  # second row of ms buttons
        vbox.pack_start(align, expand=0, fill=0)
        centerbox = gtk.HBox(homogeneous=1, spacing=3)
        align.add(centerbox)

        self.renamebutton = gtkutils.StockButton(gtk.STOCK_EDIT, 'Rename...')
        gtklogger.setWidgetName(self.renamebutton, "Rename")
        gtklogger.connect(self.renamebutton, 'clicked', self.renameMSCB)
        self.renamebutton.set_sensitive(0)
        tooltips.set_tooltip_text(self.renamebutton,
                                  "Rename the current microstructure.")
        centerbox.pack_start(self.renamebutton, expand=1, fill=1)

        self.copybutton = gtkutils.StockButton(gtk.STOCK_COPY, 'Copy...')
        gtklogger.setWidgetName(self.copybutton, "Copy")
        gtklogger.connect(self.copybutton, 'clicked', self.copyMSCB)
        self.copybutton.set_sensitive(0)
        tooltips.set_tooltip_text(self.copybutton,
                                  "Copy the current microstructure.")
        centerbox.pack_start(self.copybutton, expand=1, fill=1)

        self.deletebutton = gtkutils.StockButton(gtk.STOCK_DELETE, 'Delete')
        gtklogger.setWidgetName(self.deletebutton, "Delete")
        gtklogger.connect(self.deletebutton, 'clicked', self.deleteMSCB)
        self.deletebutton.set_sensitive(0)
        tooltips.set_tooltip_text(self.deletebutton,
                                  "Delete the current microstructure.")
        centerbox.pack_start(self.deletebutton, expand=1, fill=1)

        self.savebutton = gtkutils.StockButton(gtk.STOCK_SAVE, 'Save...')
        gtklogger.setWidgetName(self.savebutton, "Save")
        gtklogger.connect(self.savebutton, 'clicked', self.saveMSCB)
        self.savebutton.set_sensitive(0)
        tooltips.set_tooltip_text(
            self.savebutton, "Save the current microstructure to a file.")
        centerbox.pack_start(self.savebutton, expand=1, fill=1)

        pane = gtk.HPaned()
        gtklogger.setWidgetName(pane, "Pane")
        vbox.pack_start(pane, expand=1, fill=1, padding=2)
        gtklogger.connect_passive(pane, 'notify::position')

        #######

        infoframe = gtk.Frame('Microstructure Info')
        infoframe.set_shadow_type(gtk.SHADOW_IN)
        pane.pack1(infoframe, resize=True, shrink=False)
        scroll = gtk.ScrolledWindow()
        gtklogger.logScrollBars(scroll, "InfoFrameScroll")
        scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        scroll.set_shadow_type(gtk.SHADOW_IN)
        infoframe.add(scroll)
        self.infoarea = fixedwidthtext.FixedWidthTextView()
        self.infoarea.set_editable(0)
        self.infoarea.set_cursor_visible(False)
        self.infoarea.set_wrap_mode(gtk.WRAP_WORD)
        scroll.add(self.infoarea)

        ########

        self.grouplock = lock.Lock()
        groupframe = gtk.Frame('%s Groups' % Pixstring)
        gtklogger.setWidgetName(groupframe, "%sGroups" % Pixstring)
        groupframe.set_shadow_type(gtk.SHADOW_IN)
        pane.pack2(groupframe, resize=True, shrink=False)
        hbox = gtk.HBox()
        groupframe.add(hbox)
        vbox = gtk.VBox(spacing=2)  # buttons on L side of pixel group list
        hbox.pack_start(vbox, expand=0, fill=0, padding=2)
        frame = gtk.Frame()  # frame for the list of groups
        frame.set_shadow_type(gtk.SHADOW_IN)
        hbox.pack_start(frame)
        grparea = gtk.VBox()
        frame.add(grparea)
        # only one of grplist and grpmsg is visible at a time
        self.grplist = chooser.ScrolledChooserListWidget(  # list of pixel groups
            callback=self.listItemChosen,
            name="GroupList")
        grparea.add(self.grplist.gtk)
        self.grpmsg = gtk.Label()  # helpful message when there are no grps
        grparea.add(self.grpmsg)

        self.newgroupbutton = gtk.Button('New...')
        gtklogger.setWidgetName(self.newgroupbutton, "New")
        vbox.pack_start(self.newgroupbutton, expand=0, fill=0)
        gtklogger.connect(self.newgroupbutton, 'clicked',
                          self.newGroupButtonCB)
        self.newgroupbutton.set_sensitive(0)
        tooltips.set_tooltip_text(
            self.newgroupbutton,
            "Create a new empty %s group in the current microstructure." %
            pixstring)

        self.renamegroupbutton = gtk.Button('Rename...')
        gtklogger.setWidgetName(self.renamegroupbutton, "Rename")
        vbox.pack_start(self.renamegroupbutton, expand=0, fill=0)
        gtklogger.connect(self.renamegroupbutton, 'clicked',
                          self.renameGroupButtonCB)
        self.renamegroupbutton.set_sensitive(0)
        tooltips.set_tooltip_text(self.renamegroupbutton,
                                  "Rename the selected %s group." % pixstring)

        self.copygroupbutton = gtk.Button('Copy...')
        gtklogger.setWidgetName(self.copygroupbutton, "Copy")
        vbox.pack_start(self.copygroupbutton, expand=0, fill=0)
        gtklogger.connect(self.copygroupbutton, 'clicked',
                          self.copyGroupButtonCB)
        self.copygroupbutton.set_sensitive(0)
        tooltips.set_tooltip_text(
            self.copygroupbutton,
            "Create a new group containing the same %ss as the selected group."
            % pixstring)

        self.delgroupbutton = gtk.Button('Delete')
        gtklogger.setWidgetName(self.delgroupbutton, "Delete")
        vbox.pack_start(self.delgroupbutton, expand=0, fill=0)
        gtklogger.connect(self.delgroupbutton, 'clicked',
                          self.deleteGroupButtonCB)
        self.delgroupbutton.set_sensitive(0)
        tooltips.set_tooltip_text(
            self.delgroupbutton,
            "Delete the selected %s group from the microstructure." %
            pixstring)

        self.meshablebutton = gtk.CheckButton('Meshable')
        gtklogger.setWidgetName(self.meshablebutton, "Meshable")
        vbox.pack_start(self.meshablebutton, expand=0, fill=0)
        self.meshablesignal = gtklogger.connect(self.meshablebutton, 'clicked',
                                                self.meshableGroupCB)
        self.meshablebutton.set_sensitive(0)
        tooltips.set_tooltip_text(
            self.meshablebutton,
            "Should adaptive meshes follow the boundaries of the selected %s group?"
            % pixstring)

        # buttons on rhs of pixelgroup list
        vbox = gtk.VBox(spacing=2)
        hbox.pack_start(vbox, expand=0, fill=0, padding=2)

        self.addbutton = gtk.Button('Add')
        gtklogger.setWidgetName(self.addbutton, "Add")
        vbox.pack_start(self.addbutton, expand=0, fill=0)
        gtklogger.connect(self.addbutton, 'clicked', self.addPixelsCB)
        self.addbutton.set_sensitive(0)
        tooltips.set_tooltip_text(
            self.addbutton,
            "Add the currently selected %ss to the selected group." %
            pixstring)

        self.removebutton = gtk.Button('Remove')
        gtklogger.setWidgetName(self.removebutton, "Remove")
        vbox.pack_start(self.removebutton, expand=0, fill=0)
        gtklogger.connect(self.removebutton, 'clicked', self.removePixelsCB)
        self.removebutton.set_sensitive(0)
        tooltips.set_tooltip_text(
            self.removebutton,
            "Remove the currently selected %ss from the selected group." %
            pixstring)

        self.clearbutton = gtk.Button('Clear')
        gtklogger.setWidgetName(self.clearbutton, "Clear")
        vbox.pack_start(self.clearbutton, expand=0, fill=0)
        gtklogger.connect(self.clearbutton, 'clicked', self.clearPixelsCB)
        self.clearbutton.set_sensitive(0)
        tooltips.set_tooltip_text(
            self.clearbutton,
            "Reset the selected group by removing all the %ss from the group."
            % pixstring)

        self.infobutton = gtk.Button('Info')
        gtklogger.setWidgetName(self.infobutton, "Info")
        vbox.pack_start(self.infobutton, expand=0, fill=0)
        gtklogger.connect(self.infobutton, 'clicked', self.queryPixelsCB)
        self.infobutton.set_sensitive(0)
        tooltips.set_tooltip_text(
            self.infobutton,
            "Display information about the selected group in the Messages window."
        )

        self.built = True

        self.sbcallbacks = [
            switchboard.requestCallback('new pixel group', self.newpixgrp),
            switchboard.requestCallback('destroy pixel group',
                                        self.destpixgrp),
            #
            switchboard.requestCallback('changed pixel group',
                                        self.destpixgrp),
            switchboard.requestCallback('changed pixel groups',
                                        self.chngdgrps),
            switchboard.requestCallback(('new who', 'Microstructure'),
                                        self.newwhoMS),
            switchboard.requestCallback(('new who', 'Image'),
                                        self.newwhoImage),
            switchboard.requestCallback(('rename who', 'Image'),
                                        self.displayMSInfo),
            switchboard.requestCallback('remove who', self.removewho),
            switchboard.requestCallback('renamed pixel group',
                                        self.renamepixgrp),
            switchboard.requestCallback('pixel selection changed',
                                        self.selectionchanged),
            switchboard.requestCallback('images changed in microstructure',
                                        self.displayMSInfo)
        ]
Esempio n. 7
0
    def __init__(self):
        self.built = False

        oofGUI.MainPage.__init__(
            self,
            name="Interfaces",
            ordering=105,
            tip="Create named one-dimensional interfaces.")

        mainbox = gtk.VBox(spacing=2)
        self.gtk.add(mainbox)

        align = gtk.Alignment(xalign=0.5)
        mainbox.pack_start(align, expand=0, fill=0)
        centerbox = gtk.HBox(spacing=3)
        align.add(centerbox)

        #skelwidget is really an mswidget
        self.skelwidget = whowidget.WhoWidget(
            whoville.getClass('Microstructure'), scope=self)
        switchboard.requestCallbackMain(self.skelwidget, self.widgetChanged)
        label = gtk.Label('Microstructure=')
        label.set_alignment(1.0, 0.5)
        centerbox.pack_start(label, expand=0, fill=0)
        centerbox.pack_start(self.skelwidget.gtk[0], expand=0, fill=0)
        #We might want to include a skeleton in the widget, if an interface
        #is defined in terms of skeleton segments. For now the interface is
        #only associated with a microstructure
        ##        label = gtk.Label('Skeleton=')
        ##        label.set_alignment(1.0, 0.5)
        ##        centerbox.pack_start(label, expand=0, fill=0)
        ##        centerbox.pack_start(self.skelwidget.gtk[1], expand=0, fill=0)

        mainpane = gtk.HPaned()
        gtklogger.setWidgetName(mainpane, 'Pane')
        mainbox.pack_start(mainpane, expand=1, fill=1)

        interfacelistframe = gtk.Frame("Interfaces")
        gtklogger.setWidgetName(interfacelistframe, 'Interfaces')
        gtklogger.connect_passive(interfacelistframe, 'size-allocate')
        interfacelistframe.set_shadow_type(gtk.SHADOW_IN)
        mainpane.pack1(interfacelistframe, resize=0, shrink=0)

        interfacelistbox = gtk.VBox()
        interfacelistframe.add(interfacelistbox)

        # List of all the named interfaces
        self.interfacelist = chooser.ScrolledChooserListWidget(
            callback=self.interfacelistCB,
            ##            dbcallback=self.modifyBoundaryCB,
            autoselect=0,
            name="InterfaceList")
        interfacelistbox.pack_start(self.interfacelist.gtk, expand=1, fill=1)

        interfacebuttonbox = gtk.HBox(homogeneous=1, spacing=2)
        interfacelistbox.pack_start(interfacebuttonbox, expand=0, fill=0)

        # Buttons that actually do stuff.
        self.newbutton = gtk.Button("New...")
        gtklogger.setWidgetName(self.newbutton, 'New')
        gtklogger.connect(self.newbutton, "clicked", self.newInterfaceCB)
        tooltips.set_tooltip_text(
            self.newbutton,
            "Construct a new interface in the microstructure and associated meshes."
        )
        interfacebuttonbox.pack_start(self.newbutton, expand=1, fill=1)

        self.renamebutton = gtk.Button("Rename...")
        gtklogger.setWidgetName(self.renamebutton, 'Rename')
        gtklogger.connect(self.renamebutton, "clicked", self.renameInterfaceCB)
        tooltips.set_tooltip_text(self.renamebutton,
                                  "Rename the selected interface.")
        interfacebuttonbox.pack_start(self.renamebutton, expand=1, fill=1)

        self.deletebutton = gtk.Button("Delete")
        gtklogger.setWidgetName(self.deletebutton, 'Delete')
        gtklogger.connect(self.deletebutton, "clicked", self.deleteInterfaceCB)
        tooltips.set_tooltip_text(
            self.deletebutton,
            "Delete the selected interface from the microstructure and associated meshes."
        )
        interfacebuttonbox.pack_start(self.deletebutton, expand=1, fill=1)

        ########## Adding and removing interface materials
        materialbuttonbox = gtk.HBox(homogeneous=1, spacing=2)
        interfacelistbox.pack_start(materialbuttonbox, expand=0, fill=0)
        self.assignmatbutton = gtk.Button("Assign interface material...")
        gtklogger.setWidgetName(self.assignmatbutton, 'Assign material')
        gtklogger.connect(self.assignmatbutton, "clicked", self.assignmatCB)
        tooltips.set_tooltip_text(self.assignmatbutton,
                                  "Assign material to interface.")
        materialbuttonbox.pack_start(self.assignmatbutton, expand=1, fill=1)

        self.removematbutton = gtk.Button("Remove material")
        gtklogger.setWidgetName(self.removematbutton, 'Remove material')
        gtklogger.connect(self.removematbutton, "clicked", self.removematCB)
        tooltips.set_tooltip_text(self.removematbutton,
                                  "Remove material from interface.")
        materialbuttonbox.pack_start(self.removematbutton, expand=1, fill=1)
        ####################################

        infoframe = gtk.Frame("Interface details")
        infoframe.set_shadow_type(gtk.SHADOW_IN)
        mainpane.pack2(infoframe, resize=1, shrink=1)

        infowindow = gtk.ScrolledWindow()
        gtklogger.logScrollBars(infowindow, "InfoScroll")
        infowindow.set_shadow_type(gtk.SHADOW_IN)
        infoframe.add(infowindow)
        infowindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)

        self.infotext = fixedwidthtext.FixedWidthTextView()
        self.infotext.set_wrap_mode(gtk.WRAP_WORD)
        gtklogger.setWidgetName(self.infotext, 'status')
        self.infotext.set_editable(False)
        infowindow.add(self.infotext)

        self.built = True

        switchboard.requestCallbackMain("new interface created",
                                        self.newInterfaceUpdatePageCB)
        switchboard.requestCallbackMain("interface removed",
                                        self.newInterfaceUpdatePageCB)
        switchboard.requestCallbackMain("interface renamed",
                                        self.newInterfaceUpdatePageCB),
        ##        switchboard.requestCallbackMain("remove_material",self.del_mat)
        #TODO: Enable something like this later?
        ##        switchboard.requestCallbackMain(("new who", "Microstructure"),
        ##                                        self.newMicrostructureCB)

        self.selectsignals = [
            switchboard.requestCallbackMain("interface selected",
                                            self.interfaceSelectedCB),
            switchboard.requestCallbackMain("interface unselected",
                                            self.interfaceUnselectedCB)
        ]
Esempio n. 8
0
    def __init__(self):
        self.built = False
        oofGUI.MainPage.__init__(self,
                                 name="Boundary Analysis",
                                 ordering=271,
                                 tip="Examine the boundaries of the system.")

        self.timeparam = placeholder.TimeParameter('time', value=0.0)

        mainbox = gtk.VBox(spacing=2)
        self.gtk.add(mainbox)

        align = gtk.Alignment(xalign=0.5)
        mainbox.pack_start(align, expand=0, fill=0)
        centerbox = gtk.HBox(spacing=3)
        align.add(centerbox)
        self.meshwidget = whowidget.WhoWidget(ooflib.engine.mesh.meshes,
                                              callback=self.meshCB,
                                              scope=self)
        label = gtk.Label("Microstructure=")
        label.set_alignment(1.0, 0.5)
        centerbox.pack_start(label, expand=0, fill=0)
        centerbox.pack_start(self.meshwidget.gtk[0], expand=0, fill=0)
        label = gtk.Label("Skeleton=")
        label.set_alignment(1.0, 0.5)
        centerbox.pack_start(label, expand=0, fill=0)
        centerbox.pack_start(self.meshwidget.gtk[1], expand=0, fill=0)
        label = gtk.Label("Mesh=")
        label.set_alignment(1.0, 0.5)
        centerbox.pack_start(label, expand=0, fill=0)
        centerbox.pack_start(self.meshwidget.gtk[2], expand=0, fill=0)

        align = gtk.Alignment(xalign=0.5)
        mainbox.pack_start(align, expand=0, fill=0)
        centerbox = gtk.HBox(spacing=3)
        align.add(centerbox)
        self.timeWidget = self.timeparam.makeWidget(scope=self)
        centerbox.pack_start(gtk.Label("Time:"), expand=0, fill=0)
        centerbox.pack_start(self.timeWidget.gtk, expand=0, fill=0)

        mainpane = gtk.HPaned()
        gtklogger.setWidgetName(mainpane, 'Pane')
        mainbox.pack_start(mainpane, expand=1, fill=1)
        gtklogger.connect_passive(mainpane, 'notify::position')

        leftbox = gtk.VBox()
        mainpane.pack1(leftbox, resize=1, shrink=0)  # ??

        boundarylistframe = gtk.Frame("Boundaries")
        gtklogger.setWidgetName(boundarylistframe, 'frame')
        boundarylistframe.set_shadow_type(gtk.SHADOW_IN)
        leftbox.pack_start(boundarylistframe, expand=1, fill=1)

        self.bdylist = chooser.ScrolledChooserListWidget(
            callback=self.boundarylistCB,
            dbcallback=self.doubleclickCB,
            autoselect=1,
            name="BoundaryList")
        boundarylistframe.add(self.bdylist.gtk)

        rightbox = gtk.VBox()
        mainpane.pack2(rightbox, resize=1, shrink=0)  # ??

        analyzerframe = gtk.Frame("Boundary Operation")
        analyzerframe.set_shadow_type(gtk.SHADOW_IN)
        rightbox.pack_start(analyzerframe, expand=1, fill=1)
        self.analysisWidget = regclassfactory.RegisteredClassFactory(
            meshbdyanalysis.MeshBdyAnalyzer.registry,
            scope=self,
            name="BdyAnalyzerRCF")
        analyzerframe.add(self.analysisWidget.gtk)

        self.buildBottomRow(mainbox)
        # hbox2 = gtk.HBox(homogeneous=True)
        # namebox.pack_start(hbox2, expand=0, fill=0)

        # self.create_button = gtkutils.StockButton(gtk.STOCK_NEW, 'Create...')
        # hbox2.pack_start(self.create_button, expand=1, fill=1)
        # gtklogger.setWidgetName(self.create_button, 'Set')
        # gtklogger.connect(self.create_button, 'clicked', self.createCB)
        # tooltips.set_tooltip_text(
        #     self.create_button,
        #     "Assign a name to the current analysis operation,"
        #     " so that it can be retrieved later.")

        # self.retrieve_button = gtkutils.StockButton(gtk.STOCK_REFRESH,
        #                                             'Retrieve...')
        # hbox2.pack_start(self.retrieve_button, expand=1, fill=1)
        # gtklogger.connect(self.retrieve_button, 'clicked', self.retrieveCB)
        # tooltips.set_tooltip_text(self.retrieve_button,
        #                           'Retrieve a name analysis.')

        # hbox3 = gtk.HBox(homogeneous=True)
        # namebox.pack_start(hbox3, expand=0, fill=0)

        # self.savenamed_button = gtkutils.StockButton(gtk.STOCK_SAVE_AS,
        #                                              'Save...')
        # hbox3.pack_start(self.savenamed_button, expand=1, fill=1)
        # gtklogger.setWidgetName(self.savenamed_button, 'Save')
        # gtklogger.connect(self.savenamed_button, 'clicked', self.savenamedCB)
        # tooltips.set_tooltip_text(self.savenamed_button,
        #                      'Save definitions of named analyses to a file.')

        # self.delete_button = gtkutils.StockButton(gtk.STOCK_DELETE, 'Delete...')
        # hbox3.pack_start(self.delete_button, expand=1, fill=1)
        # gtklogger.setWidgetName(self.delete_button, 'Delete')
        # gtklogger.connect(self.delete_button, 'clicked', self.deleteCB)
        # tooltips.set_tooltip_text(self.delete_button,
        #                      "Delete a named analysis operation")

        # # Destination
        # destframe = gtk.Frame("Destination")
        # destframe.set_shadow_type(gtk.SHADOW_IN)
        # hbox.pack_start(destframe, expand=1, fill=1, padding=3)
        # destbox = gtk.HBox()
        # destframe.add(destbox)
        # self.destwidget = outputdestinationwidget.TextDestinationWidget(
        #     name="Destination", framed=False)
        # destbox.pack_start(self.destwidget.gtk, expand=1, fill=1, padding=2)

        # # Go button
        # self.gobutton = gtkutils.StockButton(gtk.STOCK_EXECUTE, "Go!")
        # gtklogger.setWidgetName(self.gobutton, 'Go')
        # gtklogger.connect(self.gobutton, "clicked", self.goCB)
        # tooltips.set_tooltip_text(self.gobutton,
        #                           "Send the output to the destination.")
        # hbox.pack_end(self.gobutton, expand=1, fill=1, padding=2)

        self.built = True

        switchboard.requestCallbackMain(("new who", "Mesh"), self.newmeshCB)
        switchboard.requestCallbackMain(("new who", "Skeleton"),
                                        self.newskelCB)
        switchboard.requestCallbackMain(self.meshwidget, self.meshwidgetCB)
        switchboard.requestCallbackMain("mesh changed", self.meshchangedCB)
        switchboard.requestCallbackMain(self.analysisWidget,
                                        self.analysisWidgetCB)
        switchboard.requestCallbackMain("new boundary created", self.newbdyCB)
        switchboard.requestCallbackMain("boundary removed", self.newbdyCB)
        switchboard.requestCallbackMain("boundary renamed", self.newbdyCB)
        switchboard.requestCallbackMain("named boundary analyses changed",
                                        self.analysesChangedCB)
        switchboard.requestCallbackMain("retrieve boundary analysis",
                                        self.retrieve_analysis)
        switchboard.requestCallbackMain(('validity', self.timeWidget),
                                        self.validityChangeCB)
        switchboard.requestCallbackMain("mesh status changed",
                                        self.meshchangedCB)
Esempio n. 9
0
    def __init__(self):
        self.built = False
        oofGUI.MainPage.__init__(
            self,
            name="FE Mesh",
            ordering=200,
            tip="Create a Finite Element Mesh from a Skeleton.")
        mainbox = gtk.VBox(spacing=2)
        self.gtk.add(mainbox)

        align = gtk.Alignment(xalign=0.5)
        mainbox.pack_start(align, expand=0, fill=0)
        centerbox = gtk.HBox(spacing=3)
        align.add(centerbox)
        self.meshwidget = whowidget.WhoWidget(ooflib.engine.mesh.meshes,
                                              scope=self)
        label = gtk.Label("Microstructure=")
        label.set_alignment(1.0, 0.5)
        centerbox.pack_start(label, expand=0, fill=0)
        centerbox.pack_start(self.meshwidget.gtk[0], expand=0, fill=0)

        label = gtk.Label("Skeleton=")
        label.set_alignment(1.0, 0.5)
        centerbox.pack_start(label, expand=0, fill=0)
        centerbox.pack_start(self.meshwidget.gtk[1], expand=0, fill=0)

        label = gtk.Label("Mesh=")
        label.set_alignment(1.0, 0.5)
        centerbox.pack_start(label, expand=0, fill=0)
        centerbox.pack_start(self.meshwidget.gtk[2], expand=0, fill=0)

        # Centered box of buttons
        align = gtk.Alignment(xalign=0.5)
        mainbox.pack_start(align, expand=0, fill=0)
        bbox = gtk.HBox(homogeneous=1, spacing=3)
        align.add(bbox)
        self.newbutton = gtkutils.StockButton(gtk.STOCK_NEW, "New...")
        gtklogger.setWidgetName(self.newbutton, 'New')
        gtklogger.connect(self.newbutton, 'clicked', self.newCB)
        tooltips.set_tooltip_text(
            self.newbutton, "Create a new mesh from the current skeleton.")
        bbox.pack_start(self.newbutton, expand=0, fill=1)

        self.renamebutton = gtkutils.StockButton(gtk.STOCK_EDIT, "Rename...")
        gtklogger.setWidgetName(self.renamebutton, 'Rename')
        gtklogger.connect(self.renamebutton, 'clicked', self.renameCB)
        tooltips.set_tooltip_text(self.renamebutton,
                                  "Rename the current mesh.")
        bbox.pack_start(self.renamebutton, expand=0, fill=1)

        self.copybutton = gtkutils.StockButton(gtk.STOCK_COPY, "Copy...")
        gtklogger.setWidgetName(self.copybutton, 'Copy')
        gtklogger.connect(self.copybutton, 'clicked', self.copyCB)
        tooltips.set_tooltip_text(self.copybutton, "Copy the current mesh.")
        bbox.pack_start(self.copybutton, expand=0, fill=1)

        self.deletebutton = gtkutils.StockButton(gtk.STOCK_DELETE, "Delete")
        gtklogger.setWidgetName(self.deletebutton, 'Delete')
        gtklogger.connect(self.deletebutton, 'clicked', self.deleteCB)
        tooltips.set_tooltip_text(self.deletebutton,
                                  "Delete the current mesh.")
        bbox.pack_start(self.deletebutton, expand=0, fill=1)

        self.savebutton = gtkutils.StockButton(gtk.STOCK_SAVE, "Save...")
        gtklogger.setWidgetName(self.savebutton, 'Save')
        gtklogger.connect(self.savebutton, 'clicked', self.saveCB)
        tooltips.set_tooltip_text(self.savebutton,
                                  "Save the current mesh to a file.")
        bbox.pack_start(self.savebutton, expand=0, fill=1)

        mainpane = gtk.HPaned()
        gtklogger.setWidgetName(mainpane, 'Pane')
        mainbox.pack_start(mainpane, expand=1, fill=1)
        gtklogger.connect_passive(mainpane, 'notify::position')
        leftbox = gtk.VPaned()
        mainpane.pack1(leftbox, resize=1, shrink=0)

        infoframe = gtk.Frame('Mesh Information')
        infoframe.set_shadow_type(gtk.SHADOW_IN)
        leftbox.pack1(infoframe, resize=1, shrink=1)
        scroll = gtk.ScrolledWindow()
        gtklogger.logScrollBars(scroll, "MeshInfo")
        scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        scroll.set_shadow_type(gtk.SHADOW_IN)
        infoframe.add(scroll)
        self.infoarea = fixedwidthtext.FixedWidthTextView()
        self.infoarea.set_cursor_visible(False)
        self.infoarea.set_editable(False)
        scroll.add(self.infoarea)

        # Subproblem creation, deletion, etc.
        subprobframe = gtk.Frame('Subproblems')
        gtklogger.setWidgetName(subprobframe, 'Subproblems')
        subprobframe.set_shadow_type(gtk.SHADOW_IN)
        leftbox.pack2(subprobframe, resize=1, shrink=1)
        subpbox = gtk.VBox()
        subprobframe.add(subpbox)
        self.subpchooser = chooser.ScrolledChooserListWidget(
            callback=self.subpchooserCB,
            dbcallback=self.subprobEditCB,
            name="subprobChooser")
        subpbox.pack_start(self.subpchooser.gtk, expand=1, fill=1)

        subpbuttons1 = gtk.HBox(homogeneous=True, spacing=2)
        subpbuttons2 = gtk.HBox(homogeneous=True, spacing=2)
        subpbox.pack_start(subpbuttons1, expand=0, fill=0)
        subpbox.pack_start(subpbuttons2, expand=0, fill=0)

        self.subprobNew = gtkutils.StockButton(gtk.STOCK_NEW, "New...")
        gtklogger.setWidgetName(self.subprobNew, "New")
        gtklogger.connect(self.subprobNew, "clicked", self.subprobNewCB)
        tooltips.set_tooltip_text(self.subprobNew, "Create a new subproblem.")
        subpbuttons1.pack_start(self.subprobNew, expand=1, fill=1)

        self.subprobRename = gtk.Button("Rename...")
        gtklogger.setWidgetName(self.subprobRename, "Rename")
        gtklogger.connect(self.subprobRename, "clicked", self.subprobRenameCB)
        tooltips.set_tooltip_text(self.subprobRename,
                                  "Rename the selected subproblem")
        subpbuttons1.pack_start(self.subprobRename, expand=1, fill=1)

        self.subprobEdit = gtkutils.StockButton(gtk.STOCK_EDIT, "Edit...")
        gtklogger.setWidgetName(self.subprobEdit, "Edit")
        gtklogger.connect(self.subprobEdit, 'clicked', self.subprobEditCB)
        tooltips.set_tooltip_text(self.subprobEdit,
                                  "Edit the selected subproblem.")
        subpbuttons1.pack_start(self.subprobEdit, expand=1, fill=1)

        self.subprobCopy = gtkutils.StockButton(gtk.STOCK_COPY, "Copy...")
        gtklogger.setWidgetName(self.subprobCopy, "Copy")
        gtklogger.connect(self.subprobCopy, "clicked", self.subprobCopyCB)
        tooltips.set_tooltip_text(self.subprobCopy,
                                  "Copy the selected subproblem.")
        subpbuttons2.pack_start(self.subprobCopy, expand=1, fill=1)

        ##        subpbuttons2.pack_start(gtk.HBox(), expand=1, fill=1) # filler
        self.subprobInfo = gtk.Button("Info")
        gtklogger.setWidgetName(self.subprobInfo, "Info")
        gtklogger.connect(self.subprobInfo, 'clicked', self.subprobInfoCB)
        tooltips.set_tooltip_text(
            self.subprobInfo,
            "Print information about the selected subproblem")
        subpbuttons2.pack_start(self.subprobInfo, expand=1, fill=1)

        self.subprobDelete = gtkutils.StockButton(gtk.STOCK_DELETE, "Delete")
        gtklogger.setWidgetName(self.subprobDelete, "Delete")
        gtklogger.connect(self.subprobDelete, "clicked", self.subprobDeleteCB)
        tooltips.set_tooltip_text(self.subprobDelete,
                                  "Delete the selected subproblem.")
        subpbuttons2.pack_start(self.subprobDelete, expand=1, fill=1)

        # Right hand side for element operations

        elementopsframe = gtk.Frame(label="Mesh Operations")
        gtklogger.setWidgetName(elementopsframe, 'ElementOps')
        elementopsframe.set_shadow_type(gtk.SHADOW_IN)
        mainpane.pack2(elementopsframe, resize=0, shrink=0)
        elementopsbox = gtk.VBox(spacing=3)
        elementopsframe.add(elementopsbox)
        self.elementops = regclassfactory.RegisteredClassFactory(
            meshmod.MeshModification.registry,
            title="Method:",
            callback=self.elementopsCB,
            expand=0,
            fill=0,
            scope=self,
            name="Method")
        elementopsbox.pack_start(self.elementops.gtk, expand=1, fill=1)

        self.historian = historian.Historian(self.elementops.set,
                                             self.sensitizeHistory,
                                             setCBkwargs={'interactive': 1})
        # Prev, OK, Next
        hbox = gtk.HBox()
        elementopsbox.pack_start(hbox, expand=0, fill=0, padding=2)
        self.prevbutton = gtkutils.prevButton()
        gtklogger.connect(self.prevbutton, 'clicked', self.prevCB)
        tooltips.set_tooltip_text(
            self.prevbutton, "Recall the previous mesh element operation.")
        hbox.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', self.okCB)
        tooltips.set_tooltip_text(self.okbutton,
                                  'Perform the mesh operation defined above.')
        hbox.pack_start(self.okbutton, expand=1, fill=1, padding=5)

        self.nextbutton = gtkutils.nextButton()
        gtklogger.connect(self.nextbutton, 'clicked', self.nextCB)
        tooltips.set_tooltip_text(self.nextbutton,
                                  'Recall the next mesh element operation.')
        hbox.pack_start(self.nextbutton, expand=0, fill=0, padding=2)

        self.built = True

        switchboard.requestCallbackMain("Mesh modified", self.recordModifier)
        switchboard.requestCallbackMain("mesh changed", self.meshchangeCB)
        switchboard.requestCallbackMain(("new who", "Microstructure"),
                                        self.newMSorSkeleton)
        switchboard.requestCallbackMain(("new who", "Skeleton"),
                                        self.newMSorSkeleton)
        switchboard.requestCallbackMain(("new who", "Mesh"), self.newMesh)
        switchboard.requestCallbackMain(("new who", "SubProblem"),
                                        self.newSubProblem)
        switchboard.requestCallbackMain(("rename who", "SubProblem"),
                                        self.renamedSubProblem)
        switchboard.requestCallbackMain(("remove who", "SubProblem"),
                                        self.removeSubProblem)
        switchboard.requestCallbackMain(self.meshwidget, self.meshwidgetCB)
        switchboard.requestCallbackMain("equation activated", self.equationCB)
        switchboard.requestCallbackMain("mesh status changed",
                                        self.statusChanged)
        #         switchboard.requestCallbackMain("mesh boundaries changed",
        #                                         self.newMeshBoundaries)

        switchboard.requestCallbackMain(('validity', self.elementops),
                                        self.validityChangeCB)
Esempio n. 10
0
    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)