Exemplo n.º 1
0
    def __init__(self, parent, log):
        self.log = log
        wx.Panel.__init__(self, parent, -1)

        title = wx.StaticText(self, label="structured mesh definition")
        title.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD))
        title.SetForegroundColour("blue")

        self.cp = cp = wx.CollapsiblePane(self,
                                          label=ilabel,
                                          style=wx.CP_DEFAULT_STYLE
                                          | wx.CP_NO_TLW_RESIZE)
        self.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnPaneChanged, cp)
        self.IMeshControl(cp.GetPane())

        self.cp2 = cp2 = wx.CollapsiblePane(self,
                                            label=jlabel,
                                            style=wx.CP_DEFAULT_STYLE
                                            | wx.CP_NO_TLW_RESIZE)
        self.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnPaneChanged, cp2)
        self.IMeshControl(cp2.GetPane())

        sizer = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(sizer)
        sizer.Add(title, 0, wx.ALL, 30)
        sizer.Add(cp, 0, wx.RIGHT | wx.LEFT | wx.EXPAND, 50)
        pSizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(pSizer, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.LEFT | wx.EXPAND,
                  50)
        sizer.Add((30, 40))
        sizer.Add(cp2, 0, wx.RIGHT | wx.LEFT | wx.EXPAND, 50)
Exemplo n.º 2
0
    def InitDynamicControls(self, parent):
        self.cp = wx.CollapsiblePane(parent, label='Case Properties')
        #self.cp.SetConstraints(LayoutAnchors(self.cp,
        #      True, True, True, True))
        self.cp.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnCasePaneChanged)
        
        self.Init_CasePane(self.cp.GetPane())
        
        sizer = wx.BoxSizer(wx.VERTICAL)
        parent.SetSizer(sizer)
        #sizer.Add(title, 0, wx.ALL, 25)
        
        
        self.cpDirList = wx.CollapsiblePane(parent, label='Folders List')
        self.cpDirList.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnDirListPaneChanged)
        self.Init_CasePane(self.cpDirList.GetPane())

        #dirListSizer = wx.BoxSizer(wx.VERTICAL)
        #self.SetSizer(sizer)
        #sizer.Add(title, 0, wx.ALL, 25)
        sizer.Add(self.cp, 0, wx.RIGHT|wx.LEFT|wx.EXPAND, 25)
        sizer.Add(self.cpDirList, 0, wx.RIGHT|wx.LEFT|wx.EXPAND, 25)
        
        self.btn = btn = wx.Button(parent, label="Hello")
        #self.Bind(wx.EVT_BUTTON, self.OnToggle, btn)
        sizer.Add(btn, 0, wx.ALL, 25)
        
        """
Exemplo n.º 3
0
    def test_CollPaneCtors(self):
        c = wx.CollapsiblePane(self.frame, label='label')
        c = wx.CollapsiblePane(self.frame, -1, 'label', (12, 34), (45, 67))

        c.Collapse()
        c.Expand()
        c.IsCollapsed()
        c.IsExpanded()
Exemplo n.º 4
0
    def __init__(self, *args, **kwargs):
        """
        Конструктор.
        """
        wx.Panel.__init__(self, *args, **kwargs)

        # Вид сбоку тягача
        self.side_view = wx.CollapsiblePane(self,
                                            label=u'Общий вид',
                                            style=wx.CP_DEFAULT_STYLE
                                            | wx.CP_NO_TLW_RESIZE)
        panesizer = wx.BoxSizer(wx.VERTICAL)
        pane = self.side_view.GetPane()

        self.side_constructor = rack_constructor.icWMSRackContructorCtrl(pane)
        bmp_filename = os.path.join(wms_shape.DEFAULT_IMG_DIR, 'truck.png')
        self.side_constructor.setBackgound(bmp_filename)

        panesizer.Add(self.side_constructor, 1, wx.GROW | wx.EXPAND)
        pane.SetSizer(panesizer)
        panesizer.SetSizeHints(pane)
        self.side_view.Collapse()

        # Вид ярусов сверху
        self.tiers_view = wx.CollapsiblePane(self,
                                             label=u'Ярусы',
                                             style=wx.CP_DEFAULT_STYLE
                                             | wx.CP_NO_TLW_RESIZE)
        panesizer = wx.BoxSizer(wx.VERTICAL)
        pane = self.tiers_view.GetPane()

        self.tiers_constructor = tier_constructor.icWMSTierContructorCtrl(pane)

        panesizer.Add(self.tiers_constructor, 1, wx.GROW | wx.EXPAND)
        pane.SetSizer(panesizer)
        panesizer.SetSizeHints(pane)
        self.tiers_view.Collapse()

        # Основной сайзер
        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(self.side_view, 0, wx.GROW | wx.EXPAND, 25)
        # ВНИМАНИЕ! proportion----------+
        # устанавливает распахивание    |
        # второй панели на все окно     v
        self.sizer.Add(self.tiers_view, 1, wx.GROW | wx.EXPAND, 25)
        self.SetSizer(self.sizer)
        # self.SetSizerAndFit(self.sizer)
        self.Layout()
        # self.Fit()

        self.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.onSideViewPaneChanged,
                  self.side_view)
        self.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.onTiersViewPaneChanged,
                  self.tiers_view)
Exemplo n.º 5
0
    def _createInterface(self, parent, params):

        sizer = wx.BoxSizer(wx.VERTICAL)
        self.parent = parent
        self.meshinI = params.getParam(parameters.Mesh_list_InI)
        self.meshinJ = params.getParam(parameters.Mesh_list_InJ)

        box1 = wx.StaticBoxSizer(wx.StaticBox(parent, -1, "mesh definition:"),
                                 wx.VERTICAL)
        box1.SetMinSize((600, 200))
        grid1 = wx.FlexGridSizer(0, 4, 0, 0)
        grid1.SetFlexibleDirection(wx.VERTICAL)

        radios1 = []
        choice1 = None
        # I mesh
        self.cpi = cpi = wx.CollapsiblePane(parent,
                                            label=ilabel,
                                            style=wx.CP_DEFAULT_STYLE
                                            | wx.CP_NO_TLW_RESIZE,
                                            size=(600, 125))
        #        toto = self.GetDialogPanel()
        #        toto.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnPaneChanged, cpi)

        self.IMeshControl(cpi.GetPane())

        box1.Add(cpi, 0, wx.ALIGN_CENTRE | wx.ALL, 1)
        pSizer = wx.BoxSizer(wx.VERTICAL)
        box1.Add(pSizer, 0, wx.ALIGN_CENTER | wx.ALL, 1)
        # J mesh
        self.cpj = cpj = wx.CollapsiblePane(parent,
                                            label=jlabel,
                                            style=wx.CP_DEFAULT_STYLE
                                            | wx.CP_NO_TLW_RESIZE,
                                            size=(600, 125))

        toto = self.GetDialogPanel()
        toto.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnPaneChanged, cpj)

        self.JMeshControl(cpj.GetPane())
        box1.Add(cpj, 0, wx.ALIGN_CENTRE | wx.ALL, 1)
        pSizer = wx.BoxSizer(wx.VERTICAL)
        box1.Add(pSizer, 0, wx.ALIGN_CENTRE | wx.ALL, 1)

        self.radios1 = radios1
        self.choice1 = choice1

        sizer.Add(box1, 0, wx.ALIGN_LEFT | wx.ALL, 5)
        parent.SetSizerAndFit(sizer)
Exemplo n.º 6
0
    def __init__(self, parent, name, section, onResize, onChange):
        self.name = name
        self.parent = parent
        self.container = wx.CollapsiblePane(parent, wx.ID_ANY, name,
                                            wx.DefaultPosition, wx.DefaultSize,
                                            wx.CP_DEFAULT_STYLE)
        self.container.Collapse(False)

        self.container.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, onResize)
        self.container.SetSizeHints(wx.DefaultSize, wx.DefaultSize)
        self.container.GetPane().SetSizeHints(wx.DefaultSize, wx.DefaultSize)

        self.itemGrid = wx.FlexGridSizer(0, 2, 2, 2)
        self.itemGrid.AddGrowableCol(1)
        self.itemGrid.SetFlexibleDirection(wx.BOTH)
        self.itemGrid.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_ALL)

        self.items = {
            name: obtainParameterWidget(param)(self.container.GetPane(), name,
                                               param, onChange)
            for name, param in section.items()
        }
        for widget in self.items.values():
            self.itemGrid.Add(
                widget.label, 0,
                wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND | wx.RIGHT, 5)
            self.itemGrid.Add(
                widget.widget, 0,
                wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND | wx.RIGHT, 5)

        self.container.GetPane().SetSizer(self.itemGrid)
Exemplo n.º 7
0
    def _langPanel(self, lang, js):
        """Create panel for each languages"""
        text = self._langString(lang, js['total'])
        panel = wx.CollapsiblePane(self.statswin,
                                   -1,
                                   label=text,
                                   style=wx.CP_DEFAULT_STYLE
                                   | wx.CP_NO_TLW_RESIZE)
        panel.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnPaneChanged)
        win = panel.GetPane()
        # TODO IT DOESN'T WORK
        # TO ADD ONLY WHEN TAB IS OPENED
        # if lang == self.langUsed.split('_')[0]:
        # panel.Collapse(False)
        # else:
        # panel.Collapse(True)
        pageSizer = wx.BoxSizer(wx.VERTICAL)
        for k, v in six.iteritems(js):
            if k != 'total' and k != 'name':
                box = self._langBox(win, k, v)
                pageSizer.Add(box,
                              proportion=1,
                              flag=wx.EXPAND | wx.ALL,
                              border=3)

        win.SetSizer(pageSizer)
        pageSizer.SetSizeHints(win)

        return panel
Exemplo n.º 8
0
    def _get_arguments_panel(self, parent):
        collapsible_pane = wx.CollapsiblePane(
            parent, wx.ID_ANY, 'Arguments',
            style=wx.CP_DEFAULT_STYLE | wx.CP_NO_TLW_RESIZE)
        collapsible_pane.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED,
                              self.OnCollapsiblePaneChanged,
                              collapsible_pane)
        pane = collapsible_pane.GetPane()
        pane.SetBackgroundColour(self._mysettings.color_background)
        pane.SetForegroundColour(self._mysettings.color_foreground)
        self._args_text_ctrl = \
            self._create_text_ctrl(pane, self.arguments,
                                   "removed due unicode_error (delete this)",
                                   self.OnArgumentsChanged)
        self._args_text_ctrl.SetToolTip("Arguments for the test run. "
                                        "Arguments are space separated list.")
        self._args_text_ctrl.SetBackgroundColour(self._mysettings.color_secondary_background)
        self._args_text_ctrl.SetForegroundColour(self._mysettings.color_secondary_foreground)
        horizontal_sizer = wx.BoxSizer(wx.HORIZONTAL)
        horizontal_sizer.Add(self._args_text_ctrl, 1,
                             wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, 10)

        pane.SetSizer(horizontal_sizer)
        self._validate_arguments(self.arguments or u'')
        return collapsible_pane
Exemplo n.º 9
0
    def Forces(self, parent):
        self.figF1 = Figure((4.0, 4.0),
                            dpi=self.dpi,
                            tight_layout=True,
                            facecolor='white')
        self.figF2 = Figure((4.0, 4.0),
                            dpi=self.dpi,
                            tight_layout=True,
                            facecolor='white')

        self.canvasF1 = FigCanvas(self.ForceTab, -1, self.figF1)
        self.canvasF2 = FigCanvas(self.ForceTab, -1, self.figF2)

        self.axesF1 = self.figF1.add_subplot(111,
                                             aspect='equal',
                                             frame_on=False,
                                             title='sdv')
        self.axesF1.set_xlim([self.Lim_X1, self.Lim_X2])
        self.axesF1.set_ylim([self.Lim_Y1, self.Lim_Y2])

        self.axesF2 = self.figF2.add_subplot(111,
                                             aspect='equal',
                                             frame_on=False)
        self.axesF2.set_xlim([self.Lim_X1, self.Lim_X2])
        self.axesF2.set_ylim([self.Lim_Y1, self.Lim_Y2])

        self.cpoF = cpoF = wx.CollapsiblePane(self.ForceTab,
                                              label="Data",
                                              style=wx.CP_DEFAULT_STYLE
                                              | wx.CP_NO_TLW_RESIZE)
        self.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnPaneChangedF, cpoF)
        self.MakePaneContentF(cpoF.GetPane())
        self.cpoF.SetBackgroundColour("white")

        self.hbox1F = wx.BoxSizer(wx.HORIZONTAL)
        self.hbox1F.Add(self.canvasF1, 0, wx.TOP)
        self.hbox1F.Add(self.canvasF2, 0, wx.TOP)

        self.vbox00F = wx.BoxSizer(wx.VERTICAL)
        self.vbox00F.Add(self.hbox1F, 0, wx.TOP)
        self.vbox00F.Add(self.cpoF, 0, wx.LEFT | wx.ALL, 15)

        self.ForceTab.SetSizer(self.vbox00F)

        self.draw_by_scaleF(self.canvasF1, self.axesF1, self.NOD, False)
        self.draw_by_scaleF(self.canvasF2, self.axesF2, self.NOD_opt, True)

        self.axesF1.set_title('Initial Design')
        self.axesF1.set_xlabel('Maximum Stress = ' + str(self.S_max[0][0]))

        self.axesF2.set_title('Optimal Design')
        self.axesF2.set_xlabel('Maximum Stress = ' + str(self.S_max_opt[0][0]))

        self.draw_reactions(self.axesF1, self.NOD, self.P_nodal,
                            self.list_ctrl11F)
        self.draw_reactions(self.axesF2, self.NOD_opt, self.P_nodal_opt,
                            self.list_ctrl12F)

        self.canvasF1.draw()
        self.canvasF2.draw()
Exemplo n.º 10
0
 def _create_content(self, sizer):
     super(FilterDialog, self)._create_content(sizer)
     cp = wx.CollapsiblePane(self._dialog, label=_("Aggregation functions"))
     self._handle_keys(cp)
     pane = cp.GetPane()
     choice, field, button = self._create_choice, self._create_text_ctrl, self._create_button
     self._agg_controls = (
         choice([(c.label(), c) for c in self._columns],
                parent=pane,
                tooltip=_("Select the column for aggregation.")),
         choice([(self._AGG_LABELS[op], op) for op in self._AGG_OPERATORS],
                parent=pane,
                tooltip=_("Select the aggregation function.")),
         field(None,
               length=24,
               readonly=True,
               parent=pane,
               tooltip=_("Displays the aggregation function result.")),
         button(_("Compute"),
                self._on_compute_aggregate,
                parent=pane,
                tooltip=_("Compute the aggregation function result.")))
     boxsizer = wx.BoxSizer(wx.HORIZONTAL)
     for ctrl in self._agg_controls:
         boxsizer.Add(ctrl)
     pane.SetSizer(boxsizer)
     sizer.Add(cp, 0, wx.LEFT | wx.TOP | wx.RIGHT, 8)
Exemplo n.º 11
0
    def __init__(self, parent, simdia):

        wx.Panel.__init__(self, parent)

        self.parent = parent

        ### frame or panel !!!
        self.simdia = simdia

        self.org_w, self.org_h = self.simdia.GetSize()

        self.label1 = _("More settings...")
        self.label2 = _("Extra options")

        self.cp = wx.CollapsiblePane(self,
                                     label=self.label1,
                                     style=wx.CP_DEFAULT_STYLE
                                     | wx.CP_NO_TLW_RESIZE)

        self.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnPaneChanged, self.cp)
        self.MakePaneContent(self.cp.GetPane())

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.cp, 0, wx.EXPAND)
        self.SetSizer(sizer)
    def constructTier1(self, vbox):
        """Tier 1 Group (bottom logical level):
		     App -> Environment -> Software -> Location
		"""
        loc_collapsible_panel = wx.CollapsiblePane(self, label='Location')
        ## Add collapsible pane with zero proportion, to the sizer
        vbox.Add(loc_collapsible_panel, 0, wx.EXPAND)
        ## Create a reference to access the pane, used for adding controls since
        ## we can't add controls directly into the wx.CollapsiblePane itself.
        locRefPanel = loc_collapsible_panel.GetPane()
        loc_collapsible_panel.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED,
                                   self.on_change)

        locPanelBuffer = wx.BoxSizer(wx.HORIZONTAL)
        locPanelBuffer.AddSpacer(40)
        locPanelSizer = wx.FlexGridSizer(cols=2, hgap=20, vgap=20)
        locPanelSizer.AddGrowableCol(1)

        thisText = wx.StaticText(locRefPanel, label='Matching Class:')
        classList = list(self.classDefinitions.keys())
        self.locClassChoice = wx.Choice(locRefPanel,
                                        wx.ID_ANY, (100, -1),
                                        choices=classList)
        self.Bind(wx.EVT_CHOICE, self.EvtChooseLocClass, self.locClassChoice)
        locPanelSizer.Add(thisText, 0,
                          wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
        locPanelSizer.Add(self.locClassChoice, 0, wx.EXPAND)

        thisText = wx.StaticText(locRefPanel, label='Matching Attribute:')
        self.locAttrChoice = wx.Choice(locRefPanel,
                                       wx.ID_ANY, (100, -1),
                                       choices=[])
        self.Bind(wx.EVT_CHOICE, self.EvtChooseLocAttr, self.locAttrChoice)
        locPanelSizer.Add(thisText, 0,
                          wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
        locPanelSizer.Add(self.locAttrChoice, 0, wx.EXPAND)

        ## Insert pattern button
        bvSizer = wx.BoxSizer(wx.VERTICAL)
        btn = wx.Button(locRefPanel, label='Add Pattern')
        self.Bind(wx.EVT_BUTTON, self.onLocPattern, btn)
        btnClear = wx.Button(locRefPanel, label='Clear')
        self.Bind(wx.EVT_BUTTON, self.onLocClear, btnClear)
        bvSizer.Add(btn, 0, wx.ALIGN_RIGHT)
        bvSizer.AddSpacer(5)
        bvSizer.Add(btnClear, 0, wx.ALIGN_RIGHT)
        locPanelSizer.Add(bvSizer, 0, wx.ALIGN_RIGHT)
        ## Patterns panel
        self.locPanel = wx.TextCtrl(locRefPanel,
                                    wx.ID_ANY,
                                    size=(-1, 75),
                                    style=wx.EXPAND | wx.TE_READONLY
                                    | wx.TE_MULTILINE)
        locPanelSizer.Add(self.locPanel, 0, wx.EXPAND)

        locPanelBuffer.Add(locPanelSizer, 1, wx.EXPAND)
        locPanelBuffer.AddSpacer(40)

        locRefPanel.SetSizer(locPanelBuffer)
        vbox.AddSpacer(20)
    def constructTier0(self, vbox):
        """Model object:
		     App -> Environment -> Software -> Location -> ModelObject
		"""
        instance_collapsible_panel = wx.CollapsiblePane(self,
                                                        label='Logical Object')
        ## Add collapsible pane with zero proportion, to the sizer
        vbox.Add(instance_collapsible_panel, 0, wx.EXPAND)
        ## Create a reference to access the pane, used for adding controls since
        ## we can't add controls directly into the wx.CollapsiblePane itself.
        instanceRefPanel = instance_collapsible_panel.GetPane()
        instance_collapsible_panel.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED,
                                        self.on_change)

        instancePanelBuffer = wx.BoxSizer(wx.HORIZONTAL)
        instancePanelBuffer.AddSpacer(40)
        instancePanelSizer = wx.FlexGridSizer(cols=2, hgap=20, vgap=20)
        instancePanelSizer.AddGrowableCol(1)

        thisText = wx.StaticText(instanceRefPanel, label='Name:')
        self.objectCtrlName = wx.TextCtrl(instanceRefPanel, wx.ID_ANY)
        instancePanelSizer.Add(thisText, 0,
                               wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
        instancePanelSizer.Add(self.objectCtrlName, 0, wx.EXPAND)

        instancePanelBuffer.Add(instancePanelSizer, 1, wx.EXPAND)
        instancePanelBuffer.AddSpacer(40)

        instanceRefPanel.SetSizer(instancePanelBuffer)
        vbox.AddSpacer(20)
Exemplo n.º 14
0
    def __init__(self, parent, log):
        self.log = log
        wx.Panel.__init__(self, parent, -1)

        title = wx.StaticText(self, label="wx.CollapsiblePane")
        title.SetFont(
            wx.Font(18, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL,
                    wx.FONTWEIGHT_BOLD))
        title.SetForegroundColour("blue")

        self.cp = cp = wx.CollapsiblePane(self,
                                          label=label1,
                                          style=wx.CP_DEFAULT_STYLE
                                          | wx.CP_NO_TLW_RESIZE)
        self.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnPaneChanged, cp)
        self.MakePaneContent(cp.GetPane())

        sizer = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(sizer)
        sizer.Add(title, 0, wx.ALL, 25)
        sizer.Add(cp, 0, wx.RIGHT | wx.LEFT | wx.EXPAND, 25)

        self.btn = btn = wx.Button(self, label=btnlbl1)
        self.Bind(wx.EVT_BUTTON, self.OnToggle, btn)
        sizer.Add(btn, 0, wx.ALL, 25)
Exemplo n.º 15
0
    def _createAdvancedControls(self, mainSizer):
        advancedPanel = wx.CollapsiblePane(self, label=_(u'Advanced'))
        pane = advancedPanel.GetPane()

        paneSizer = wx.FlexGridSizer(cols=1)
        paneSizer.AddGrowableCol(0)

        borderSizer = wx.FlexGridSizer(cols=2)
        borderSizer.AddGrowableCol(0)
        borderSizer.AddGrowableCol(1)

        self._border = self._createTextAndSpin(pane, _(u'Border width'),
                                               borderSizer)
        self._border.SetRange(0, 100)
        self._border.SetValue(1)

        self._headerCells = wx.CheckBox(pane,
                                        label=_(u'Header cells for first row'))

        paneSizer.Add(borderSizer, 1, flag=wx.ALL | wx.EXPAND, border=2)

        paneSizer.Add(self._headerCells,
                      1,
                      flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                      border=2)

        pane.SetSizer(paneSizer)

        mainSizer.Add(advancedPanel, flag=wx.ALL | wx.EXPAND, border=2)
Exemplo n.º 16
0
def LeftDialogFunc(parent, call_fit=True, set_sizer=True):
    item0 = wx.BoxSizer(wx.VERTICAL)

    item1 = wx.CollapsiblePane(parent, ID_COLLPANE,
                               "Tags Classified by Function",
                               wx.DefaultPosition, [10, 10],
                               wx.CP_NO_TLW_RESIZE)
    oldparent = parent
    parent = item1.GetPane()

    item2 = wx.BoxSizer(wx.VERTICAL)

    item4 = wx.Notebook(parent, ID_NOTEBOOK, wx.DefaultPosition, [200, 160], 0)
    item3 = item4

    item5 = wx.Panel(item4, -1)
    item4.AddPage(item5, "Output Control")

    item6 = wx.Panel(item4, -1)
    item4.AddPage(item6, "Ion Related")

    item2.Add(item3, 0, wx.ALIGN_CENTER | wx.ALL, 5)

    parent.SetSizer(item2)
    parent = oldparent

    item0.Add(item1, 0, wx.ALL, 15)

    if set_sizer == True:
        parent.SetSizer(item0)
        if call_fit == True:
            item0.SetSizeHints(parent)

    return item0
Exemplo n.º 17
0
    def __init__(self, parent, *args, **kwargs):
        """Create the girderPanel."""
        wx.Panel.__init__(self, parent, *args, **kwargs)

        self.parent = parent

        # subscribe the girderPanel to some pubsub messages:
        pub.subscribe(self.onCompleted, 'completed')

        ###############################################################################
        # MORE BRAINSTORM
        # 1. Search box for searching buttons, recently used constructs, containers,...
        # 2. Constructs (collapsible pane)
        # 2.1. Create new construct ... ( and adapters ?? ) -> opens an 'editor' frame
        # 2.2. Open/Load existing construct
        # 2.3. list of recently used constructs, perhaps also favourites, projects, ...
        # 3. Containers
        # 3.1. Create new Container ...
        # 3.2. Open/Load existing Container
        # 3.3. list of recently used containers, perhaps also favourites, projects, ...
        # 4. Open pcap file / real-time sniffing with pcapy module ??
        # ?? where does the encode/decode frame belong?

        # GIRDER - SEARCH BOX
        self.searchbox = ExtendedSearchCtrl(self,
                                            id=ID_SEARCH_BOX,
                                            style=wx.TE_PROCESS_ENTER)
        # GIRDER - COLLAPSIBLEPANE
        # probably need some kind of list here to make it easy to add stuff
        # also needs drag-n-drop for dropping files
        # perhaps needs some virtual folders (like code::blocks)

        self.cp = cp = wx.CollapsiblePane(self,
                                          label="colpane",
                                          style=wx.CP_DEFAULT_STYLE
                                          | wx.CP_NO_TLW_RESIZE)
        self.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnPaneChanged, cp)
        # self.MakePaneContent(cp.GetPane())

        self.newConstructBtn = wx.Button(self,
                                         id=-1,
                                         label="Create new Struct...")
        self.Bind(wx.EVT_BUTTON, self.OnnewConstructBtn, self.newConstructBtn)

        self.newValueBtn = wx.Button(self, id=-1, label="Request new value")
        self.Bind(wx.EVT_BUTTON, self.OnBtn, self.newValueBtn)
        # self.newValueBtn.Bind(wx.EVT_BUTTON, self.OnBtn)

        self.displayLbl = wx.StaticText(self, id=-1, label="Value goes here")

        Sizer = wx.BoxSizer(wx.VERTICAL)
        Sizer.Add(self.searchbox, 0, wx.ALIGN_LEFT | wx.ALL, 5)
        Sizer.Add(self.newConstructBtn, 0, wx.ALIGN_CENTER | wx.ALL, 5)
        Sizer.Add(self.newValueBtn, 0, wx.ALIGN_CENTER | wx.ALL, 5)
        Sizer.Add(self.displayLbl, 0, wx.ALL | wx.CENTER, 5)

        self.SetSizerAndFit(Sizer)
Exemplo n.º 18
0
    def __init__(self, parent, fpaths, options, *args, **kwargs):
        wx.Dialog.__init__(self,
                           parent,
                           title="ND-SAFIR running",
                           *args,
                           **kwargs)

        self.fpaths = fpaths
        self.options = options
        self.skip_flag = threading.Event()
        self.abort_flag = threading.Event()

        sizer = wx.BoxSizer(wx.VERTICAL)

        ## We use the double of the number of files as range for the progress
        ## dialog.  This is because it only accepts integers and we want to
        ## set the progress to the value between the file number, e.g., we
        ## want to set the value to 0.5, when processing the first file.
        self.gauge = wx.Gauge(self, range=len(self.fpaths) * 2)
        sizer.Add(self.gauge,
                  flag=wx.TOP | wx.EXPAND | wx.LEFT | wx.RIGHT,
                  border=16)

        self.msg = wx.StaticText(self)
        sizer.Add(self.msg, flag=wx.ALIGN_TOP | wx.ALIGN_CENTER_HORIZONTAL)

        cpane = wx.CollapsiblePane(self, label="Details")
        sizer.Add(cpane, proportion=1, flag=wx.GROW | wx.ALL)
        pane = cpane.GetPane()
        pane_sizer = wx.BoxSizer(wx.VERTICAL)
        self.output = wx.TextCtrl(pane,
                                  style=wx.TE_MULTILINE | wx.TE_READONLY
                                  | wx.HSCROLL)
        pane_sizer.Add(self.output,
                       proportion=1,
                       flag=wx.GROW | wx.ALL,
                       border=16)
        pane.SetSizer(pane_sizer)

        self.btns = wx.BoxSizer(wx.HORIZONTAL)
        skip_btn = wx.Button(self, label="Skip")
        skip_btn.Bind(wx.EVT_BUTTON, self.on_skip_EVT_BUTTON)
        self.btns.Add(skip_btn)
        abort_btn = wx.Button(self, label="Abort")
        abort_btn.Bind(wx.EVT_BUTTON, self.on_abort_EVT_BUTTON)
        self.btns.Add(abort_btn)
        sizer.Add(self.btns, flag=wx.BOTTOM | wx.ALIGN_CENTER_HORIZONTAL)

        ## Events coming from the ndsafir master thread
        self.Bind(EVT_NDSAFIR_START, self.on_EVT_NDSAFIR_START)
        self.Bind(EVT_NDSAFIR_END, self.on_EVT_NDSAFIR_END)
        self.Bind(EVT_NDSAFIR_ALL_DONE, self.on_EVT_NDSAFIR_ALL_DONE)

        ## Coming from the work threads via pubsub
        Publisher.subscribe(self.on_NDSAFIR_OUTPUT, 'NDSAFIR_OUTPUT')

        self.SetSizerAndFit(sizer)
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, wx.ID_ANY)

        cp = wx.CollapsiblePane(self, label='wx.CollapsiblePane',
                                style=wx.CP_DEFAULT_STYLE | wx.CP_NO_TLW_RESIZE)
        tc  = wx.TextCtrl(cp.GetPane(), wx.ID_ANY, "testing text")

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(cp, 0, wx.ALL | wx.EXPAND, 25)
        self.SetSizer(sizer)
Exemplo n.º 20
0
    def __init__(self, parent):
        super(InfoBar, self).__init__(parent, style=wx.SUNKEN_BORDER)

        self.dbName = ''
        # Pane for the information
        self.variables = wx.CollapsiblePane(self)
        self.graphs = wx.CollapsiblePane(self)

        self.lvVariables = wx.ListView(self)
        self.lvGraphs = wx.ListView(self)

        self.lvVariables.InsertColumn(0, "Name")
        self.lvVariables.InsertColumn(1, "Type/Description")

        self.lvGraphs.InsertColumn(0, " ")
        self.lvGraphs.InsertColumn(1, " ")
        self.lvGraphs.InsertColumn(2, " ")
        self.SetBackgroundColour((255, 255, 255))

        self.groupCtrls()
Exemplo n.º 21
0
    def DoLayout(self):
        if self.imagePanel:
            if not self.cp:
                self.cp = wx.CollapsiblePane(self, label='Show controls', style=wx.CP_DEFAULT_STYLE|wx.CP_NO_TLW_RESIZE)
                self.SetBackgroundColour('white') # color for the background of panel
                self.controls  = ImageControlPanel(self.cp.GetPane(), self.imagePanel, 
                                                   brightness=self.imagePanel.brightness,
                                                   scale=self.imagePanel.scale, 
                                                   contrast=self.imagePanel.contrast)
                self.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnPaneChanged, self.cp)
                # self.cp.Collapse(collapse=False) # default open controls
            else:
                self.controls.SetListener(self.imagePanel)
            self.Sizer.Clear()
            self.Sizer.Add(self.sw, proportion=1, flag=wx.EXPAND)
            self.Sizer.Add(self.cp, 0, wx.RIGHT|wx.LEFT|wx.EXPAND, 25)
            w, h = self.imagePanel.GetSize()
            if self.first_layout:
                self.SetClientSize( (min(self.maxSize[0], w*self.imagePanel.scale),
                                     min(self.maxSize[1], h*self.imagePanel.scale+55)) )
                self.Center()
                self.first_layout = False
            self.sw.SetScrollbars(1, 1, w*self.imagePanel.scale, h*self.imagePanel.scale)
            #self.sw.SetScrollRate(1, 1)
            self.CreateChannelMenus()

            # Annoying: Need to bind 3 windows to KEY_DOWN in case focus changes.
            self.Bind(wx.EVT_KEY_DOWN, self.HoldKey) 
            self.sw.Bind(wx.EVT_KEY_DOWN, self.HoldKey)
            self.cp.Bind(wx.EVT_KEY_DOWN, self.HoldKey)
            self.imagePanel.Bind(wx.EVT_KEY_DOWN, self.HoldKey)

            # Annoying: Need to bind 3 windows to KEY_UP in case focus changes.
            self.Bind(wx.EVT_KEY_UP, self.OnKey)
            self.sw.Bind(wx.EVT_KEY_UP, self.OnKey)
            self.cp.Bind(wx.EVT_KEY_UP, self.OnKey)
            self.imagePanel.Bind(wx.EVT_KEY_UP, self.OnKey)
            self.Bind(wx.EVT_MENU, lambda(e):self.SelectAll(), self.sel_all)
            self.Bind(wx.EVT_MENU, lambda(e):self.DeselectAll(), self.deselect)

        self.fileMenu.Bind(wx.EVT_MENU_OPEN, self.OnOpenFileMenu)
        self.classifyMenu.Bind(wx.EVT_MENU_OPEN, self.OnOpenClassifyMenu)
        self.viewMenu.Bind(wx.EVT_MENU_OPEN, self.OnOpenViewMenu)
        self.Bind(wx.EVT_MENU, self.OnOpenImage, self.openImageMenuItem)
        self.Bind(wx.EVT_MENU, self.OnSaveImage, self.saveImageMenuItem)
        self.Bind(wx.EVT_MENU, self.OnSaveImage, self.saveImageMenuItem)
        self.Bind(wx.EVT_MENU, self.OnOpenImage, self.openImageMenuItem)
        self.Bind(wx.EVT_MENU, self.OnChangeClassRepresentation, self.classViewMenuItem)
        self.Bind(wx.EVT_MENU, self.OnShowObjectNumbers, self.objectNumberMenuItem)
        self.Bind(wx.EVT_MENU, self.OnClassifyImage, self.classifyMenuItem)
        self.Bind(wx.EVT_MENU, lambda evt:self.Close(), self.exitMenuItem)
    def constructSampleRegExPane(self, mainBox):
        samples_collapsible_panel = wx.CollapsiblePane(
            self, label='Sample regular expressions')
        ## Add collapsible pane with zero proportion, to the sizer
        mainBox.Add(samples_collapsible_panel, 0,
                    wx.EXPAND | wx.LEFT | wx.RIGHT, 15)
        ## Create a reference to access the pane, used for adding controls since
        ## we can't add controls directly into the wx.CollapsiblePane itself.
        samplesRefPanel = samples_collapsible_panel.GetPane()
        samples_collapsible_panel.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED,
                                       self.on_change)

        panelBuffer = wx.BoxSizer(wx.HORIZONTAL)
        panelBuffer.AddSpacer(10)
        panelSizer = wx.FlexGridSizer(cols=2, vgap=10, hgap=20)
        panelSizer.AddGrowableCol(1)

        regex5 = wx.StaticText(samplesRefPanel, wx.ID_ANY,
                               '^[Nn][Yy][Cc]\d{1,3}[-]')
        descr5 = wx.StaticText(
            samplesRefPanel, wx.ID_ANY,
            'name starting with NYC + 1-3 integers + a hyphen')
        panelSizer.Add(regex5, 0, wx.EXPAND)
        panelSizer.Add(descr5, 0, wx.EXPAND)
        regex1 = wx.StaticText(samplesRefPanel, wx.ID_ANY,
                               '^(.*(?:dr\.|prod\.).*)$')
        descr1 = wx.StaticText(samplesRefPanel, wx.ID_ANY,
                               'domain containing \'dr.\' or \'prod.\'')
        panelSizer.Add(regex1, 0, wx.EXPAND)
        panelSizer.Add(descr1, 0, wx.EXPAND)
        regex2 = wx.StaticText(samplesRefPanel, wx.ID_ANY,
                               '^((?:(?!dev\.|qa\.).)*)$')
        descr2 = wx.StaticText(samplesRefPanel, wx.ID_ANY,
                               'domain not containing \'dev.\' or \'qa.\'')
        panelSizer.Add(regex2, 0, wx.EXPAND)
        panelSizer.Add(descr2, 0, wx.EXPAND)
        regex4 = wx.StaticText(samplesRefPanel, wx.ID_ANY,
                               '^13\.(?:107|9[0-9])\.')
        descr4 = wx.StaticText(samplesRefPanel, wx.ID_ANY,
                               'IP starting with \'13.107.\' or \'13.9x.\'')
        panelSizer.Add(regex4, 0, wx.EXPAND)
        panelSizer.Add(descr4, 0, wx.EXPAND)
        regex3 = wx.StaticText(samplesRefPanel, wx.ID_ANY, '^(?!192[.]|14[.])')
        descr3 = wx.StaticText(samplesRefPanel, wx.ID_ANY,
                               'IP not starting with \'192.\' or \'14.\'')
        panelSizer.Add(regex3, 0, wx.EXPAND)
        panelSizer.Add(descr3, 0, wx.EXPAND)

        panelBuffer.Add(panelSizer, 1, wx.EXPAND)
        samplesRefPanel.SetSizer(panelBuffer)
Exemplo n.º 23
0
    def __init__(self, parent, **kwargs):
        wx.Frame.__init__(self, parent, **kwargs)
        self.sb = SortBin(self)
        self.cp = wx.CollapsiblePane(self,
                                     label='Show controls',
                                     style=wx.CP_DEFAULT_STYLE
                                     | wx.CP_NO_TLW_RESIZE)
        self.icp = ImageControlPanel(self.cp.GetPane(), self)

        self.Sizer = wx.BoxSizer(wx.VERTICAL)
        self.Sizer.Add(self.sb, 1, wx.EXPAND)
        self.Sizer.Add(self.cp, 0, wx.EXPAND)

        self.cp.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED,
                     self._on_control_pane_change)
Exemplo n.º 24
0
 def __init__(self, raadpleegScherm, titel):
     wx.Panel.__init__(self, raadpleegScherm, -1)
     self.raadpleegScherm = raadpleegScherm
     self.log = raadpleegScherm.log
     self.titel = titel
     self.cp = wx.CollapsiblePane(self,
                                  label=titel,
                                  style=wx.CP_DEFAULT_STYLE
                                  | wx.CP_NO_TLW_RESIZE)
     sizer = wx.BoxSizer(wx.VERTICAL)
     self.SetSizer(sizer)
     sizer.Add(self.cp, 0, wx.RIGHT | wx.LEFT | wx.EXPAND, 5)
     self.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.toonVerberg, self.cp)
     self.raadpleegScherm.panels.append(self)
     self.raadpleegScherm.toonPanels()
    def constructTier4(self, vbox):
        """Tier 4 Group (top level):
		     App
		"""
        app_collapsible_panel = wx.CollapsiblePane(self, label='Application')
        ## Add collapsible pane with zero proportion, to the sizer
        vbox.Add(app_collapsible_panel, 0, wx.EXPAND)
        ## Create a reference to access the pane, used for adding controls since
        ## we can't add controls directly into the wx.CollapsiblePane itself.
        appRefPanel = app_collapsible_panel.GetPane()
        app_collapsible_panel.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED,
                                   self.on_change)

        appPanelBuffer = wx.BoxSizer(wx.HORIZONTAL)
        appPanelBuffer.AddSpacer(40)
        appPanelSizer = wx.FlexGridSizer(cols=2, vgap=20, hgap=20)
        appPanelSizer.AddGrowableCol(1)

        thisText = wx.StaticText(appRefPanel, label='Select the Application:')
        self.appChoice = wx.Choice(appRefPanel,
                                   wx.ID_ANY, (100, -1),
                                   choices=self.appNames)
        self.Bind(wx.EVT_CHOICE, self.EvtChooseApp, self.appChoice)
        appPanelSizer.Add(thisText, 0,
                          wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
        appPanelSizer.Add(self.appChoice, 0, wx.EXPAND)

        thisText = wx.StaticText(appRefPanel, label='Application ID:')
        self.appCtrlId = wx.TextCtrl(appRefPanel,
                                     wx.ID_ANY,
                                     style=wx.TE_READONLY)
        appPanelSizer.Add(thisText, 0,
                          wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
        appPanelSizer.Add(self.appCtrlId, 0, wx.EXPAND)

        thisText = wx.StaticText(appRefPanel, label='Short Name:')
        self.appCtrlName = wx.TextCtrl(appRefPanel,
                                       wx.ID_ANY,
                                       style=wx.TE_READONLY)
        appPanelSizer.Add(thisText, 0,
                          wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
        appPanelSizer.Add(self.appCtrlName, 0, wx.EXPAND)
        appPanelBuffer.Add(appPanelSizer, 1, wx.EXPAND)
        appPanelBuffer.AddSpacer(40)

        appRefPanel.SetSizer(appPanelBuffer)
        vbox.AddSpacer(20)
        app_collapsible_panel.Expand()
Exemplo n.º 26
0
 def cp(self):
     cp = wx.CollapsiblePane(self, wx.ID_ANY, label="Details:")
     frame_sizer = wx.BoxSizer(wx.VERTICAL)
     title = wx.StaticText(self, wx.ID_ANY, 'Legend')
     frame_sizer.Add(title)
     frame_sizer.Add(cp, 0, wx.GROW | wx.ALL, 5)
     cp_pane = cp.GetPane()
     cp_sizer = wx.BoxSizer(wx.VERTICAL)
     cb = wx.CheckBox(cp_pane, -1, "checkbox", (10, 10))
     cb.Bind(wx.EVT_CHECKBOX, self.OnClick)
     cp_sizer.Add(cb)
     cp_pane.SetSizer(cp_sizer)
     cp_sizer.SetSizeHints(cp_pane)
     cp.SetLabel("testlabel")
     self.SetSizer(frame_sizer)
     frame_sizer.Fit(self)
Exemplo n.º 27
0
    def _createAdvancedControls(self, mainSizer):
        advancedPanel = wx.CollapsiblePane(self, label=_(u'Advanced'))
        pane = advancedPanel.GetPane()

        paneSizer = wx.FlexGridSizer(cols=1)
        paneSizer.AddGrowableCol(0)

        self._headerCells = wx.CheckBox(pane,
                                        label=_(u'Header cells for first row'))

        paneSizer.Add(self._headerCells,
                      1,
                      flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                      border=2)

        pane.SetSizer(paneSizer)

        mainSizer.Add(advancedPanel, flag=wx.ALL | wx.EXPAND, border=2)
Exemplo n.º 28
0
    def init_controls(self, message):
        sizer = wx.BoxSizer(wx.VERTICAL)

        text_for_size = (("W" * 40) + "\n") * 3
        self.message_ctrl = wx.StaticText(self,
                                          label=text_for_size,
                                          style=wx.ST_NO_AUTORESIZE)
        sizer.Add(
            self.message_ctrl,
            proportion=1,
            flag=wx.ALL | wx.FIXED_MINSIZE | wx.EXPAND,
            border=DEFAULT_BORDER,
        )

        self.guage_ctrl = wx.Gauge(self,
                                   range=100,
                                   style=wx.GA_HORIZONTAL | wx.GA_PROGRESS)
        sizer.Add(
            self.guage_ctrl,
            proportion=0,
            flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND,
            border=DEFAULT_BORDER,
        )

        self.cp = cp = wx.CollapsiblePane(self,
                                          label=label1,
                                          style=wx.CP_DEFAULT_STYLE
                                          | wx.CP_NO_TLW_RESIZE)
        self.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.on_pane_changed, cp)
        self.create_pane_content(cp.GetPane())
        sizer.Add(cp, 0, wx.ALL | wx.EXPAND, border=DEFAULT_BORDER)

        btnsizer = self.CreateSeparatedButtonSizer(wx.OK | wx.CANCEL)
        sizer.Add(btnsizer, 0, wx.ALL | wx.EXPAND, border=DEFAULT_BORDER)

        self.SetSizer(sizer)
        self.Fit()
        self.Center()

        self.message_ctrl.SetLabelText(message)

        close_btn = self.FindWindowById(wx.ID_OK)
        close_btn.Show(False)
Exemplo n.º 29
0
    def _get_log_options_panel(self, parent):
        collapsible_pane = wx.CollapsiblePane(
            parent, wx.ID_ANY, 'Log options',
            style=wx.CP_DEFAULT_STYLE | wx.CP_NO_TLW_RESIZE)
        collapsible_pane.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED,
                              self.OnCollapsiblePaneChanged,
                              collapsible_pane)
        pane = collapsible_pane.GetPane()
        pane.SetBackgroundColour(self._mysettings.color_background)
        pane.SetForegroundColour(self._mysettings.color_foreground)
        label = Label(pane, label="Output directory: ")
        self._output_directory_text_ctrl = \
            self._create_text_ctrl(pane, self.output_directory,
                                   "removed due unicode_error (delete this)",
                                   self.OnOutputDirectoryChanged)
        self._output_directory_text_ctrl.SetBackgroundColour(self._mysettings.color_secondary_background)
        self._output_directory_text_ctrl.SetForegroundColour(self._mysettings.color_secondary_foreground)
        button = ButtonWithHandler(pane, "...", self._handle_select_directory)
        button.SetBackgroundColour(self._mysettings.color_secondary_background)
        button.SetForegroundColour(self._mysettings.color_secondary_foreground)
        horizontal_sizer = wx.BoxSizer(wx.HORIZONTAL)
        horizontal_sizer.Add(label, 0,
                             wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 10)
        horizontal_sizer.Add(self._output_directory_text_ctrl, 1, wx.EXPAND)
        horizontal_sizer.Add(button, 0, wx.LEFT | wx.RIGHT, 10)

        suite_name_outputs_cb = self._create_checkbox(
            pane, self.are_log_names_with_suite_name,
            "Add suite name to log names", self.OnSuiteNameOutputsCheckBox)
        timestamp_outputs_cb = self._create_checkbox(
            pane, self.are_log_names_with_timestamp,
            "Add timestamp to log names", self.OnTimestampOutputsCheckbox)
        save_logs_cb = self._create_checkbox(
            pane, self.are_saving_logs,
            "Save Console and Message logs", self.OnSaveLogsCheckbox)

        vertical_sizer = wx.BoxSizer(wx.VERTICAL)
        vertical_sizer.Add(horizontal_sizer, 0, wx.EXPAND)
        vertical_sizer.Add(suite_name_outputs_cb, 0, wx.LEFT | wx.TOP, 10)
        vertical_sizer.Add(timestamp_outputs_cb, 0, wx.LEFT | wx.TOP, 10)
        vertical_sizer.Add(save_logs_cb, 0, wx.LEFT | wx.TOP | wx.BOTTOM, 10)
        pane.SetSizer(vertical_sizer)
        return collapsible_pane
Exemplo n.º 30
0
    def _init_widgets(self, parent):
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        self.pbox.Add(hbox, flag=wx.EXPAND | wx.ALL, border=4)

        startdate = wx.StaticText(parent, label=_time.strftime(
                                '%Y.%m.%d %H:%M', _time.localtime(self.start)))
        hbox.Add(startdate, 1, flag=wx.ALIGN_CENTER_VERTICAL)

        button_s = wx.Button(parent, label='Snooze', style=wx.BU_EXACTFIT)
        hbox.Add(button_s)

        button_d = wx.Button(parent, label='Dismiss', style=wx.BU_EXACTFIT)
        hbox.Add(button_d, flag=wx.LEFT, border=4)

        button_e = wx.Button(parent, label='Open', style=wx.BU_EXACTFIT)
        hbox.Add(button_e, flag=wx.LEFT, border=4)

        # wx.CP_NO_TLW_RESIZE in conjunction with
        # self.panel.GetParent().SendSizeEvent() on EVT_COLLAPSIBLEPANE_CHANGED
        # are necessary for the correct functioning
        self.pane = wx.CollapsiblePane(parent, style=wx.CP_NO_TLW_RESIZE)
        # Setting the label directly when instantiating CollapsiblePane through
        # the 'label' parameter would make it parse '&' characters to form
        # mnemonic shortcuts, like in menus
        self._set_pane_label(core_api.get_item_text(self.filename, self.id_))
        self.pbox.Add(self.pane, flag=wx.EXPAND | wx.BOTTOM, border=4)

        self.cpane = self.pane.GetPane()
        self.cbox = wx.BoxSizer(wx.VERTICAL)
        self.cpane.SetSizer(self.cbox)


        line = wx.StaticLine(parent, style=wx.LI_HORIZONTAL)
        self.pbox.Add(line, flag=wx.EXPAND)

        core_api.bind_to_update_item_text(self._update_info)

        self.panel.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED,
                                                self._update_pane_ancestors)
        self.panel.Bind(wx.EVT_BUTTON, self.snooze, button_s)
        self.panel.Bind(wx.EVT_BUTTON, self.dismiss, button_d)
        self.panel.Bind(wx.EVT_BUTTON, self._open, button_e)