def objectSizer(self, parentWindow):
     if not hasattr(self, '_sizer'):
         self._sizer = wx.FlexGridSizer(3, 2, 8, 8)
         self._sizer.SetFlexibleDirection(wx.HORIZONTAL | wx.VERTICAL)
         
         regionImage = Region.image()
         if regionImage == None:
             self._regionBitmap = wx.EmptyBitmap(16, 16)
         else:
             self._regionBitmap = wx.BitmapFromImage(regionImage.Rescale(16, 16, wx.IMAGE_QUALITY_HIGH))
         
         self._sizer.Add(wx.StaticText(parentWindow, wx.ID_ANY, gettext('Ontology term:')))
         ontologySizer = wx.BoxSizer(wx.HORIZONTAL)
         self._ontologyField = wx.StaticText(parentWindow, wx.ID_ANY)
         ontologySizer.Add(self._ontologyField, 1, wx.LEFT, 2)
         self._browseOntologyButton = wx.Button(parentWindow, wx.ID_ANY, gettext('Browse'), style = wx.BU_EXACTFIT)
         self._browseOntologyButton.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
         self._browseOntologyButton.SetSize(wx.Size(60, self._browseOntologyButton.GetSize().GetHeight()))
         self._browseOntologyButton.SetMinSize(self._browseOntologyButton.GetSize())
         self._window.Bind(wx.EVT_BUTTON, self.onBrowseOntology, self._browseOntologyButton)
         ontologySizer.Add(self._browseOntologyButton, 0, wx.LEFT, 8)
         self._sizer.Add(ontologySizer)
         
         self._sizer.Add(wx.StaticText(parentWindow, wx.ID_ANY, gettext('Parent region:')))
         parentSizer = wx.BoxSizer(wx.HORIZONTAL)
         parentSizer.Add(wx.StaticBitmap(parentWindow, wx.ID_ANY, self._regionBitmap))
         self._parentNameField = wx.StaticText(parentWindow, wx.ID_ANY)
         parentSizer.Add(self._parentNameField, 1, wx.LEFT, 2)
         self._selectParentButton = wx.Button(parentWindow, wx.ID_ANY, gettext('Select'), style = wx.BU_EXACTFIT)
         self._selectParentButton.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
         self._selectParentButton.SetSize(wx.Size(50, self._selectParentButton.GetSize().GetHeight()))
         self._selectParentButton.SetMinSize(self._selectParentButton.GetSize())
         self._window.Bind(wx.EVT_BUTTON, self.onSelectParentRegion, self._selectParentButton)
         parentSizer.Add(self._selectParentButton, 0, wx.LEFT, 8)
         self._sizer.Add(parentSizer)
         
         self._sizer.Add(wx.StaticText(parentWindow, wx.ID_ANY, gettext('Sub-regions:')))
         self._subRegionsOptions = wx.BoxSizer(wx.VERTICAL)
         self._subRegionsField = wx.StaticText(parentWindow, wx.ID_ANY)
         self._subRegionsOptions.Add(self._subRegionsField, 1, wx.EXPAND)
         self._subRegionsSizer = wx.FlexGridSizer(0, 3, 2, 5)
         self._subRegionsSizer.SetFlexibleDirection(wx.HORIZONTAL)
         self._subRegionsOptions.Add(self._subRegionsSizer, 1, wx.EXPAND)
         self._addSubRegionsButton = wx.Button(parentWindow, wx.ID_ANY, gettext('Add sub-regions from ontology'), style = wx.BU_EXACTFIT)
         self._window.Bind(wx.EVT_BUTTON, self.onAddSubRegions, self._addSubRegionsButton)
         self._subRegionsOptions.Add(self._addSubRegionsButton, 0, wx.EXPAND)
         self._sizer.Add(self._subRegionsOptions)
         
         self._parentWindow = parentWindow
     
     return self._sizer
Пример #2
0
 def objectSizer(self, parentWindow):
     if not hasattr(self, '_sizer'):
         self._sizer = wx.BoxSizer(wx.VERTICAL)
         
         regionImage = Region.image()
         if regionImage != None:
             self._regionBitmap = wx.BitmapFromImage(regionImage.Rescale(16, 16, wx.IMAGE_QUALITY_HIGH))
         else:
             self._regionBitmap = None
         
         region1Sizer = wx.BoxSizer(wx.HORIZONTAL)
         region1Sizer.Add(wx.StaticText(parentWindow, wx.ID_ANY, gettext('Region 1:')))
         if self._regionBitmap:
             region1Sizer.Add(wx.StaticBitmap(parentWindow, wx.ID_ANY, self._regionBitmap), 0, wx.LEFT, 4)
         self._region1NameField = wx.StaticText(parentWindow, wx.ID_ANY)
         region1Sizer.Add(self._region1NameField, 0, wx.LEFT, 4)
         self._selectRegion1Button = wx.Button(parentWindow, wx.ID_ANY, gettext('Select'), style = wx.BU_EXACTFIT)
         self._selectRegion1Button.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
         self._selectRegion1Button.SetSize(wx.Size(50, self._selectRegion1Button.GetSize().GetHeight()))
         self._selectRegion1Button.SetMinSize(self._selectRegion1Button.GetSize())
         self._window.Bind(wx.EVT_BUTTON, self.onSelectRegion, self._selectRegion1Button)
         region1Sizer.Add(self._selectRegion1Button, 0, wx.LEFT, 8)
         self._sizer.Add(region1Sizer, 0, wx.TOP, 10)
         
         region1ProjectsSizer = wx.BoxSizer(wx.HORIZONTAL)
         region1ProjectsSizer.Add(wx.StaticText(parentWindow, wx.ID_ANY, gettext('Projects:')), 0, wx.LEFT, 16)
         self._projectsChoice1 = wx.Choice(parentWindow, wx.ID_ANY)
         self._projectsChoice1.Append(gettext('Yes'), True)
         self._projectsChoice1.Append(gettext('No'), False)
         self._projectsChoice1.Append(gettext('Unknown'), None)
         parentWindow.Bind(wx.EVT_CHOICE, self.onChooseProjects, self._projectsChoice1)
         self._multipleSendsOuputs1Id = wx.NOT_FOUND
         region1ProjectsSizer.Add(self._projectsChoice1, 0, wx.LEFT, 4)
         self._sizer.Add(region1ProjectsSizer, 0, wx.TOP, 8)
         
         region1ActivationSizer = wx.BoxSizer(wx.HORIZONTAL)
         region1ActivationSizer.Add(wx.StaticText(parentWindow, wx.ID_ANY, gettext('Activation:')), 0, wx.LEFT, 16)
         self._activationChoice1 = wx.Choice(parentWindow, wx.ID_ANY)
         self._activationChoice1.Append(gettext('Excitatory'), 'excitatory')
         self._activationChoice1.Append(gettext('Inhibitory'), 'inhibitory')
         self._activationChoice1.Append(gettext('Unknown'), None)
         parentWindow.Bind(wx.EVT_CHOICE, self.onChooseActivation, self._activationChoice1)
         self._multipleActivations1Id = wx.NOT_FOUND
         region1ActivationSizer.Add(self._activationChoice1, 0, wx.LEFT, 4)
         self._sizer.Add(region1ActivationSizer, 0, wx.TOP, 8)
         
         region2Sizer = wx.BoxSizer(wx.HORIZONTAL)
         region2Sizer.Add(wx.StaticText(parentWindow, wx.ID_ANY, gettext('Region 2:')))
         if self._regionBitmap:
             region2Sizer.Add(wx.StaticBitmap(parentWindow, wx.ID_ANY, self._regionBitmap), 0, wx.LEFT, 4)
         self._region2NameField = wx.StaticText(parentWindow, wx.ID_ANY)
         region2Sizer.Add(self._region2NameField, 0, wx.LEFT, 4)
         self._selectRegion2Button = wx.Button(parentWindow, wx.ID_ANY, gettext('Select'), style = wx.BU_EXACTFIT)
         self._selectRegion2Button.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
         self._selectRegion2Button.SetSize(wx.Size(50, self._selectRegion2Button.GetSize().GetHeight()))
         self._selectRegion2Button.SetMinSize(self._selectRegion2Button.GetSize())
         self._window.Bind(wx.EVT_BUTTON, self.onSelectRegion, self._selectRegion2Button)
         region2Sizer.Add(self._selectRegion2Button, 0, wx.LEFT, 8)
         self._sizer.Add(region2Sizer, 0, wx.TOP, 20)
         
         region2ProjectsSizer = wx.BoxSizer(wx.HORIZONTAL)
         region2ProjectsSizer.Add(wx.StaticText(parentWindow, wx.ID_ANY, gettext('Projects:')), 0, wx.LEFT, 16)
         self._projectsChoice2 = wx.Choice(parentWindow, wx.ID_ANY)
         self._projectsChoice2.Append(gettext('Yes'), True)
         self._projectsChoice2.Append(gettext('No'), False)
         self._projectsChoice2.Append(gettext('Unknown'), None)
         parentWindow.Bind(wx.EVT_CHOICE, self.onChooseProjects, self._projectsChoice2)
         self._multipleSendsOuputs2Id = wx.NOT_FOUND
         region2ProjectsSizer.Add(self._projectsChoice2)
         self._sizer.Add(region2ProjectsSizer, 0, wx.TOP, 8)
         
         region2ActivationSizer = wx.BoxSizer(wx.HORIZONTAL)
         region2ActivationSizer.Add(wx.StaticText(parentWindow, wx.ID_ANY, gettext('Activation:')), 0, wx.LEFT, 16)
         self._activationChoice2 = wx.Choice(parentWindow, wx.ID_ANY)
         self._activationChoice2.Append(gettext('Excitatory'), 'excitatory')
         self._activationChoice2.Append(gettext('Inhibitory'), 'inhibitory')
         self._activationChoice2.Append(gettext('Unknown'), None)
         parentWindow.Bind(wx.EVT_CHOICE, self.onChooseActivation, self._activationChoice2)
         self._multipleActivations2Id = wx.NOT_FOUND
         region2ActivationSizer.Add(self._activationChoice2, 0, wx.LEFT, 4)
         self._sizer.Add(region2ActivationSizer, 0, wx.TOP, 8)
         
         self._sizer.AddStretchSpacer()
         
         self._sizer.Layout()
     
     return self._sizer
Пример #3
0
    def objectSizer(self, parentWindow):
        if not hasattr(self, '_sizer'):
            self._sizer = wx.FlexGridSizer(3, 2, 8, 8)
            self._sizer.SetFlexibleDirection(wx.HORIZONTAL | wx.VERTICAL)

            regionImage = Region.image()
            if regionImage == None:
                self._regionBitmap = wx.EmptyBitmap(16, 16)
            else:
                self._regionBitmap = wx.BitmapFromImage(
                    regionImage.Rescale(16, 16, wx.IMAGE_QUALITY_HIGH))

            self._sizer.Add(
                wx.StaticText(parentWindow, wx.ID_ANY,
                              gettext('Ontology term:')))
            ontologySizer = wx.BoxSizer(wx.HORIZONTAL)
            self._ontologyField = wx.StaticText(parentWindow, wx.ID_ANY)
            ontologySizer.Add(self._ontologyField, 1, wx.LEFT, 2)
            self._browseOntologyButton = wx.Button(parentWindow,
                                                   wx.ID_ANY,
                                                   gettext('Browse'),
                                                   style=wx.BU_EXACTFIT)
            self._browseOntologyButton.SetWindowVariant(
                wx.WINDOW_VARIANT_SMALL)
            self._browseOntologyButton.SetSize(
                wx.Size(60,
                        self._browseOntologyButton.GetSize().GetHeight()))
            self._browseOntologyButton.SetMinSize(
                self._browseOntologyButton.GetSize())
            self._window.Bind(wx.EVT_BUTTON, self.onBrowseOntology,
                              self._browseOntologyButton)
            ontologySizer.Add(self._browseOntologyButton, 0, wx.LEFT, 8)
            self._sizer.Add(ontologySizer)

            self._sizer.Add(
                wx.StaticText(parentWindow, wx.ID_ANY,
                              gettext('Parent region:')))
            parentSizer = wx.BoxSizer(wx.HORIZONTAL)
            parentSizer.Add(
                wx.StaticBitmap(parentWindow, wx.ID_ANY, self._regionBitmap))
            self._parentNameField = wx.StaticText(parentWindow, wx.ID_ANY)
            parentSizer.Add(self._parentNameField, 1, wx.LEFT, 2)
            self._selectParentButton = wx.Button(parentWindow,
                                                 wx.ID_ANY,
                                                 gettext('Select'),
                                                 style=wx.BU_EXACTFIT)
            self._selectParentButton.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
            self._selectParentButton.SetSize(
                wx.Size(50,
                        self._selectParentButton.GetSize().GetHeight()))
            self._selectParentButton.SetMinSize(
                self._selectParentButton.GetSize())
            self._window.Bind(wx.EVT_BUTTON, self.onSelectParentRegion,
                              self._selectParentButton)
            parentSizer.Add(self._selectParentButton, 0, wx.LEFT, 8)
            self._sizer.Add(parentSizer)

            self._sizer.Add(
                wx.StaticText(parentWindow, wx.ID_ANY,
                              gettext('Sub-regions:')))
            self._subRegionsOptions = wx.BoxSizer(wx.VERTICAL)
            self._subRegionsField = wx.StaticText(parentWindow, wx.ID_ANY)
            self._subRegionsOptions.Add(self._subRegionsField, 1, wx.EXPAND)
            self._subRegionsSizer = wx.FlexGridSizer(0, 3, 2, 5)
            self._subRegionsSizer.SetFlexibleDirection(wx.HORIZONTAL)
            self._subRegionsOptions.Add(self._subRegionsSizer, 1, wx.EXPAND)
            self._addSubRegionsButton = wx.Button(
                parentWindow,
                wx.ID_ANY,
                gettext('Add sub-regions from ontology'),
                style=wx.BU_EXACTFIT)
            self._window.Bind(wx.EVT_BUTTON, self.onAddSubRegions,
                              self._addSubRegionsButton)
            self._subRegionsOptions.Add(self._addSubRegionsButton, 0,
                                        wx.EXPAND)
            self._sizer.Add(self._subRegionsOptions)

            self._parentWindow = parentWindow

        return self._sizer