def test_lib_agw_ribbonArtProviders(self):
     rib = RB.RibbonBar(self.frame,
                        wx.ID_ANY,
                        agwStyle=RB.RIBBON_BAR_DEFAULT_STYLE
                        | RB.RIBBON_BAR_SHOW_PANEL_EXT_BUTTONS)
     rib.SetArtProvider(RB.RibbonDefaultArtProvider())
     rib.SetArtProvider(RB.RibbonAUIArtProvider())
     rib.SetArtProvider(RB.RibbonMSWArtProvider())
     rib.SetArtProvider(RB.RibbonOSXArtProvider())
示例#2
0
 def Realize(self):
     if MSW_STYLE:
         global ORG_LIKE_PRIMARY
         if not ORG_LIKE_PRIMARY:
             ORG_LIKE_PRIMARY = RB.art_msw.LikePrimary
             RB.art_msw.LikePrimary = like_primary
         provider = RB.RibbonMSWArtProvider()
         (dummy, secondary, tertiary) = provider.GetColourScheme(None, 1, 1)
         colour = wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DFACE)
         colour2 = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNTEXT)
         provider.SetColourScheme(colour, secondary, colour2)
         provider._tab_label_colour = colour2
         provider._button_bar_label_colour = colour2
     else:
         provider = RB.RibbonAUIArtProvider()
     self.SetArtProvider(provider)
     RB.RibbonBar.Realize(self)
示例#3
0
    def OnAUIProvider(self, event):

        self._ribbon.DismissExpandedPanel()
        self.SetArtProvider(RB.RibbonAUIArtProvider())
示例#4
0
    def _init_ctrls(self, prnt):
        RB.RibbonBar.__init__(self, name='ribbon', parent=prnt, id=wxID_PANEL1)
        # self.SetArtProvider(RB.RibbonMSWArtProvider())
        self.SetArtProvider(RB.RibbonAUIArtProvider())
        self.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Tahoma'))

        fileMenu = RB.RibbonPage(self, wxID_FileMenu, "File")

        # ----PlotMenu-------------
        home = RB.RibbonPage(self, wx.ID_ANY, "Plot")

        # ------Plot Type ---------------------------------------------------------------------------

        plot_panel = RB.RibbonPanel(home, wx.ID_ANY, "Plots", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize,
                                    RB.RIBBON_PANEL_NO_AUTO_MINIMISE)
        self.plots_bar = RB.RibbonButtonBar(plot_panel, wx.ID_ANY)
        self.plots_bar.AddSimpleButton(wxID_RIBBONPLOTTIMESERIES, "Time Series", tsa_icon.GetBitmap(), "")
        self.plots_bar.AddSimpleButton(wxID_RIBBONPLOTPROB, "Exceedance Frequency", probability.GetBitmap(), "")
        self.plots_bar.AddSimpleButton(wxID_RIBBONPLOTHIST, "Histogram", histogram.GetBitmap(), "")
        self.plots_bar.AddSimpleButton(wxID_RIBBONPLOTBOX, "Box/Whisker", box_whisker.GetBitmap(), "")
        self.plots_bar.AddSimpleButton(wxID_RIBBONPLOTSUMMARY, "Summary", summary.GetBitmap(), "")

        # -- PLOT OPTIONS-----------------------------------------------------------------------------
        PlotOptions_panel = RB.RibbonPanel(home, wx.ID_ANY, "Plot Options", wx.NullBitmap, wx.DefaultPosition,
                                           wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE)
        self.PlotsOptions_bar = RB.RibbonButtonBar(PlotOptions_panel, wx.ID_ANY)

        self.PlotsOptions_bar.AddDropdownButton(wxID_RIBBONPLOTTSTYPE, "Plot Type", plot_type.GetBitmap(), "")

        self.PlotsOptions_bar.AddSimpleButton(wxID_RIBBONPLOTTSLEGEND, "Show Legend", legend.GetBitmap(),
                                              help_string="show legend on plot", kind=0x4)

        self.PlotsOptions_bar.AddSimpleButton(wxID_RIBBONPLOTBLANKBTN, "#Hist Bins", blank.GetBitmap(), "")

        self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTBLANKBTN, False)

        self.spnBins = wx.SpinCtrl(id=wxID_FRAME1SPINCTRL1, initial=50, max=100, min=1, name='spnBins',
                                   parent=self.PlotsOptions_bar, pos=wx.Point(85, 7),  # without color button
                                   size=wx.Size(44, 25), style=wx.SP_ARROW_KEYS)
        self.spnBins.Enabled = False

        self.PlotsOptions_bar.AddDropdownButton(wxID_RIBBONPLOTBOXTYPE, "Box Whisker Type",
                                                box_whisker_type.GetBitmap(), "")

        self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTTSTYPE, False)
        self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTTSLEGEND, False)
        self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTBOXTYPE, False)

        dateTime_panel = RB.RibbonPanel(home, wx.ID_ANY, "Date Time", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize,
                                        RB.RIBBON_PANEL_NO_AUTO_MINIMISE)

        self.dateTime_buttonbar = RB.RibbonButtonBar(dateTime_panel)

        self.dateTime_buttonbar.AddSimpleButton(wxID_RIBBONPLOTBLANKBTN, "", blank.GetBitmap(), "")
        self.dateTime_buttonbar.AddSimpleButton(wxID_RIBBONPLOTBLANKBTN, "", blank.GetBitmap(), "")
        self.dateTime_buttonbar.AddSimpleButton(wxID_RIBBONPLOTBLANKBTN, "", blank.GetBitmap(), "")
        self.dateTime_buttonbar.EnableButton(wxID_RIBBONPLOTBLANKBTN, False)

        self.dpStartDate = wx.DatePickerCtrl(id=wxID_STARTDPDATE, name=u'dpStartDate', parent=self.dateTime_buttonbar,
                                             pos=wx.Point(5, 8), size=wx.Size(120, 24), style=wx.DP_DROPDOWN)

        self.dpStartDate.SetToolTipString(u'Start Date')

        self.dpEndDate = wx.DatePickerCtrl(id=wxID_ENDDPDATE, name=u'dpEndDate', parent=self.dateTime_buttonbar,
                                           pos=wx.Point(5, 40), size=wx.Size(120, 24), style=wx.DP_DROPDOWN)
        self.dpEndDate.SetToolTipString(u'End Date')

        self.dateTime_buttonbar.AddSimpleButton(wxID_RIBBONPLOTDATEAPPLY, "Apply", date_setting.GetBitmap(), "")

        self.dateTime_buttonbar.AddSimpleButton(wxID_RIBBONPLOTDATEFULL, "Full Date Range", full_date_range.GetBitmap(),
                                                "")

        self.dateTime_buttonbar.EnableButton(wxID_RIBBONPLOTDATEFULL, False)
        self.dateTime_buttonbar.EnableButton(wxID_RIBBONPLOTDATEAPPLY, False)
        self.dpEndDate.Enabled = False
        self.dpStartDate.Enabled = False

        # -------------------------------------------------------------------------------
        editPage = RB.RibbonPage(self, wx.ID_ANY, "Edit")

        main_panel = RB.RibbonPanel(editPage, wx.ID_ANY, "Main", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize,
                                    RB.RIBBON_PANEL_NO_AUTO_MINIMISE)
        self.main_bar = RB.RibbonButtonBar(main_panel)
        self.editbutton = self.main_bar.AddSimpleButton(wxID_RIBBONEDITSERIES, "Edit Series", bitmap=edit.GetBitmap(),
                                                        help_string="",
                                                        kind=0x4)  # kind sets the button to be a True or False

        self.main_bar.AddSimpleButton(wxID_RIBBONEDITRESTORE, "Restore Series", restore.GetBitmap(), "")
        self.main_bar.AddSimpleButton(wxID_RIBBONEDITSAVE, "Save", save_data.GetBitmap(), "")

        self.main_bar.EnableButton(wxID_RIBBONEDITRESTORE, False)
        self.main_bar.EnableButton(wxID_RIBBONEDITSAVE, False)

        # ------------------------------------------------------------------------------
        edit_panel = RB.RibbonPanel(editPage, wx.ID_ANY, "Edit Functions", wx.NullBitmap, wx.DefaultPosition,
                                    wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE)
        self.edit_bar = RB.RibbonButtonBar(edit_panel)
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITFILTER, "Filter Points", filter_list.GetBitmap(), "")
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITRESETFILTER, "Reset Selection", Undo.GetBitmap(), "")
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITCHGVALUE, "Change Value", edit_view.GetBitmap(), "")
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITINTEROPOLATE, "Interpolate", interpolate.GetBitmap(), "")
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITLINFILTER, "Linear Drift", lin_drift.GetBitmap(), "")
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITFLAG, "Flag", flag.GetBitmap(), "")
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITADDPOINT, "Add Point", add.GetBitmap(), "")
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITDELPOINT, "Delete Point", delete.GetBitmap(), "")
        self.edit_bar.AddSimpleButton(wxID_GAPFILL, "Fill Gap", magicwand.GetBitmap(), "")

        self.edit_bar.EnableButton(wxID_RIBBONEDITFILTER, False)
        self.edit_bar.EnableButton(wxID_RIBBONEDITCHGVALUE, False)
        self.edit_bar.EnableButton(wxID_RIBBONEDITRESETFILTER, False)
        self.edit_bar.EnableButton(wxID_RIBBONEDITINTEROPOLATE, False)
        self.edit_bar.EnableButton(wxID_RIBBONEDITLINFILTER, False)
        self.edit_bar.EnableButton(wxID_RIBBONEDITFLAG, False)
        self.edit_bar.EnableButton(wxID_RIBBONEDITADDPOINT, False)
        self.edit_bar.EnableButton(wxID_RIBBONEDITDELPOINT, False)
        self.edit_bar.EnableButton(wxID_GAPFILL, False)

        self.record_panel = RB.RibbonPanel(editPage, wx.ID_ANY, "Recording Options", wx.NullBitmap, wx.DefaultPosition,
                                           wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE)

        self.record_bar = RB.RibbonButtonBar(self.record_panel)
        self.record_bar.AddSimpleButton(wxID_RIBBONRECORDNEW, "New Script", newscript.GetBitmap(), "")
        self.record_bar.AddSimpleButton(wxID_RIBBONRECORDOPEN, "Open Script", openscript.GetBitmap(), "")
        self.record_bar.AddSimpleButton(wxID_RIBBONRECORDSAVE, "Save Script", savescript.GetBitmap(), "")

        self.record_bar.EnableButton(wxID_RIBBONRECORDNEW, False)
        self.record_bar.EnableButton(wxID_RIBBONRECORDOPEN, False)
        self.record_bar.EnableButton(wxID_RIBBONRECORDSAVE, False)

        # -------------------------------------------------------------------------------

        viewPage = RB.RibbonPage(self, wx.ID_ANY, "View")

        view_panel = RB.RibbonPanel(viewPage, wx.ID_ANY, "Tools", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize,
                                    RB.RIBBON_PANEL_NO_AUTO_MINIMISE)
        view_bar = RB.RibbonButtonBar(view_panel)
        view_bar.AddSimpleButton(wxID_RIBBONVIEWPLOT, "Plot", line_chart.GetBitmap(), "")
        view_bar.AddSimpleButton(wxID_RIBBONVIEWTABLE, "Table", table.GetBitmap(), "")
        view_bar.AddSimpleButton(wxID_RIBBONVIEWSERIES, "Series Selector", bitmap_editor.GetBitmap(), "")
        view_bar.AddSimpleButton(wxID_RIBBONVIEWCONSOLE, "Python Console", window_command_line.GetBitmap(), "")
        view_bar.AddSimpleButton(wxID_RIBBONVIEWSCRIPT, "PythonScript", script.GetBitmap(), "")

        self.scriptPanel = RB.RibbonPanel(viewPage, wx.ID_ANY, "Script Options", wx.NullBitmap, wx.DefaultPosition,
                                          wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE)

        self.scriptBar = RB.RibbonButtonBar(self.scriptPanel)
        self.scriptBar.AddSimpleButton(wxID_RIBBONRECORDNEW, "New Script", newscript.GetBitmap(), "")
        self.scriptBar.AddSimpleButton(wxID_RIBBONRECORDOPEN, "Open Script", openscript.GetBitmap(), "")
        self.scriptBar.AddSimpleButton(wxID_RIBBONRECORDSAVE, "Save Script", savescript.GetBitmap(), "")
        self.scriptPanel.Hide()

        self.CurrPage = 1
        self.SetActivePageByIndex(self.CurrPage)

        self.bindEvents()
        self.initPubSub()
示例#5
0
    def _init_ctrls(self, prnt):
        RB.RibbonBar.__init__(
            self, name='ribbon', parent=prnt,
            id=wxID_PANEL1)  #, agwStyle = RB.RIBBON_BAR_ALWAYS_SHOW_TABS)

        #self.GetArtProvider().SetColourScheme("GRAY","LIGHT GRAY","WHITE")
        self.SetArtProvider(RB.RibbonAUIArtProvider())
        self.SetFont(
            wx.Font(9, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Tahoma'))
        fileMenu = RB.RibbonPage(self, wxID_FileMenu, "File",
                                 CreateBitmap("images\\3d graph.png"))

        #----PlotMenu-------------
        #self.ribbon= RB.RibbonBar(parent=self, id=wx.ID_ANY, name ='ribbon')
        home = RB.RibbonPage(self, wx.ID_ANY, "Plot",
                             CreateBitmap("images\\3d graph.png"))

        #------Plot Type ---------------------------------------------------------------------------

        plot_panel = RB.RibbonPanel(home, wx.ID_ANY, "Plots", wx.NullBitmap,
                                    wx.DefaultPosition, wx.DefaultSize,
                                    RB.RIBBON_PANEL_NO_AUTO_MINIMISE)
        plots_bar = RB.RibbonButtonBar(plot_panel, wx.ID_ANY)
        plots_bar.AddSimpleButton(wxID_RIBBONPLOTTIMESERIES, "Time Series",
                                  CreateBitmap("images\\TSA_icon.png"), "")
        plots_bar.AddSimpleButton(wxID_RIBBONPLOTPROB, "Probablity",
                                  CreateBitmap("images\\Probability.png"), "")
        plots_bar.AddSimpleButton(wxID_RIBBONPLOTHIST, "Histogram",
                                  CreateBitmap("images\\Histogram.png"), "")
        plots_bar.AddSimpleButton(wxID_RIBBONPLOTBOX, "Box/Whisker",
                                  CreateBitmap("images\\BoxWisker.png"), "")
        plots_bar.AddSimpleButton(wxID_RIBBONPLOTSUMMARY, "Summary",
                                  CreateBitmap("images\\Summary.png"), "")

        #-- PLOT OPTIONS-----------------------------------------------------------------------------
        PlotOptions_panel = RB.RibbonPanel(home, wx.ID_ANY, "Plot Options",
                                           wx.NullBitmap, wx.DefaultPosition,
                                           wx.DefaultSize,
                                           RB.RIBBON_PANEL_NO_AUTO_MINIMISE)
        self.PlotsOptions_bar = RB.RibbonButtonBar(PlotOptions_panel,
                                                   wx.ID_ANY)

        self.PlotsOptions_bar.AddDropdownButton(
            wxID_RIBBONPLOTTSTYPE, "Plot Type",
            CreateBitmap("images\\PlotType.png"), "")

        # self.PlotsOptions_bar.AddSimpleButton(wxID_RIBBONPLOTTSCOLOR, "Color Setting",
        #                         CreateBitmap("images\\ColorSetting.png"), "")
        self.PlotsOptions_bar.AddSimpleButton(
            wxID_RIBBONPLOTTSLEGEND,
            "Show Legend",
            CreateBitmap("images\\Legend.png"),
            help_string="show legend on plot",
            kind=0x4)

        self.PlotsOptions_bar.AddSimpleButton(
            wxID_RIBBONPLOTDATESTART, "# Hist Bins",
            CreateBitmap("images\\Blank.png"), "")  #,wx.Size(100, 21))
        self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTDATESTART, False)

        self.spnBins = wx.SpinCtrl(
            id=wxID_FRAME1SPINCTRL1,
            initial=50,
            max=100,
            min=1,
            name='spnBins',
            parent=self.PlotsOptions_bar,
            #pos=wx.Point(126, 6), #with color button included
            pos=wx.Point(84, 6),  #without color button
            size=wx.Size(43, 25),
            style=wx.SP_ARROW_KEYS)
        # self.spnBins.SetValue(50)
        self.spnBins.Enabled = False

        self.PlotsOptions_bar.AddDropdownButton(
            wxID_RIBBONPLOTBOXTYPE, "Box Whisker Type",
            CreateBitmap("images\\BoxWhiskerType.png"), "")

        self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTTSTYPE, False)
        # self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTTSCOLOR, False)
        self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTTSLEGEND, False)
        self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTBOXTYPE, False)

        ######################TEMPORARILY COMMENTED OUT

        # self.PlotsOptions_bar.AddDropdownButton(wxID_RIBBONPLOTHISTTYPE, "Histogram Type",
        #                         CreateBitmap("images\\HisType.png"), "")
        # self.PlotsOptions_bar.AddDropdownButton(wxID_RIBBONPLOTHISTBIN, "Binning Algorithms",
        #                         CreateBitmap("images\\Binning.png"), "")

        #-------------------------------------------------------------------------------

        dateTime_panel = RB.RibbonPanel(home, wx.ID_ANY, "Date Time",
                                        wx.NullBitmap, wx.DefaultPosition,
                                        wx.DefaultSize,
                                        RB.RIBBON_PANEL_NO_AUTO_MINIMISE)
        #radio1 = wx.RadioButton( dummy_2, -1, " Radio1 ", style =wx.RB_GROUP )

        # dateTime_toolbar= RB.RibbonToolBar(dateTime_panel)
        dateTime_buttonbar = RB.RibbonButtonBar(dateTime_panel)

        # dateTime_buttonbar.AddHybridButton( wxID_RIBBONPLOTDATESTART, "Start" ,CreateBitmap("images\\Calendar.png"), "") #,wx.Size(100, 21))
        # dateTime_buttonbar.AddHybridButton( wxID_RIBBONPLOTDATEEND, "End" ,CreateBitmap("images\\Calendar.png"), "") #,wx.Size(100, 21))
        # dateTime_buttonbar.AddTool(wxID_RIBBONPLOTDATESTART,  CreateBitmap("images\\Calendar.png"), kind=pnlDatePicker.pnlDatePicker, client_data=[wxID_RIBBONPLOTDATESTART, "startDate", "Start Date", wx.DateTimeFromDMY(30, 10, 2010, 0, 0, 0)])

        ###Filler buttons to allow enough room for start and end date drop down menus

        dateTime_buttonbar.AddSimpleButton(wxID_RIBBONPLOTDATESTART, "",
                                           CreateBitmap("images\\Blank.png"),
                                           "")  #,wx.Size(100, 21))
        dateTime_buttonbar.AddSimpleButton(wxID_RIBBONPLOTDATESTART, "",
                                           CreateBitmap("images\\Blank.png"),
                                           "")  #,wx.Size(100, 21))
        dateTime_buttonbar.AddSimpleButton(wxID_RIBBONPLOTDATESTART, "",
                                           CreateBitmap("images\\Blank.png"),
                                           "")  #,wx.Size(100, 21))
        dateTime_buttonbar.EnableButton(wxID_RIBBONPLOTDATESTART, False)

        # self.staticText2 = wx.StaticText(id=wx.ID_ANY,
        #       label=u'Start Date:', name='staticText2', parent=dateTime_buttonbar,
        #       pos=wx.Point(0, 16), size=wx.Size(55, 13), style=0)
        self.dpStartDate = wx.DatePickerCtrl(id=wxID_STARTDPDATE,
                                             name=u'dpStartDate',
                                             parent=dateTime_buttonbar,
                                             pos=wx.Point(5, 8),
                                             size=wx.Size(120, 24),
                                             style=wx.DP_DROPDOWN)
        self.dpStartDate.SetValue(wx.DateTimeFromDMY(
            16, 1, 2008, 0, 0, 0))  #wx.DateTimeFromDMY(30, 10, 2010, 0, 0, 0)
        self.dpStartDate.SetLabel(
            repr(wx.DateTimeFromDMY(
                16, 1, 2008, 0, 0,
                0)))  #.strftime("%m-%d-%Y"))#"%Y-%m-%d'"")#'11/30/2010'
        self.dpStartDate.SetToolTipString(u'Start Date')

        # self.staticText1 = wx.StaticText(id=wx.ID_ANY,
        #       label=u'End Date:', name='staticText1', parent=dateTime_buttonbar,
        #       pos=wx.Point(0, 48), size=wx.Size(49, 13), style=0)

        self.dpEndDate = wx.DatePickerCtrl(id=wxID_ENDDPDATE,
                                           name=u'dpEndDate',
                                           parent=dateTime_buttonbar,
                                           pos=wx.Point(5, 40),
                                           size=wx.Size(120, 24),
                                           style=wx.DP_DROPDOWN)
        self.dpEndDate.SetValue(wx.DateTimeFromDMY(
            01, 04, 2008, 0, 0, 0))  #wx.DateTimeFromDMY(30, 10, 2010, 0, 0, 0)
        self.dpEndDate.SetLabel(repr(wx.DateTimeFromDMY(
            1, 04, 2008, 0, 0,
            0)))  #.strftime("%m-%d-%Y"))#"%Y-%m-%d'"")#'11/30/2010'
        self.dpEndDate.SetToolTipString(u'End Date')

        dateTime_buttonbar.AddSimpleButton(
            wxID_RIBBONPLOTDATEREFRESH, "Refresh",
            CreateBitmap("images\\DateSetting.png"), "")
        dateTime_buttonbar.AddSimpleButton(
            wxID_RIBBONPLOTDATEFULL, "Full Date Range",
            CreateBitmap("images\\FullDateRange.png"), "")

        #-------------------------------------------------------------------------------
        editPage = RB.RibbonPage(self, wx.ID_ANY, "Edit",
                                 CreateBitmap("images\\Brush.png"))

        main_panel = RB.RibbonPanel(editPage, wx.ID_ANY, "Main", wx.NullBitmap,
                                    wx.DefaultPosition, wx.DefaultSize,
                                    RB.RIBBON_PANEL_NO_AUTO_MINIMISE)
        self.main_bar = RB.RibbonButtonBar(main_panel)
        self.main_bar.AddSimpleButton(
            wxID_RIBBONEDITSERIES,
            "Edit Series",
            bitmap=CreateBitmap("images\\Edit (2).png"),
            help_string="",
            kind=0x4)

        # self.main_bar.AddButton(wxID_RIBBONEDITSERIES, "Edit Series",
        #                                bitmap=CreateBitmap("images\\Edit (2).png"), help_string="", kind = 0x4)

        # self.main_bar.AddSimpleButton(wxID_RIBBONSTOPEDITSERIES, "Stop Editing",
        #                         CreateBitmap("images\\StopEdit.png"), "")
        # main_bar.AddSimpleButton(wxID_RIBBONEDITDERIVE, "Derive New Series",
        #                        CreateBitmap("images\\DeriveNewSeries.png"), "")
        self.main_bar.AddSimpleButton(wxID_RIBBONEDITRESTORE, "Restore",
                                      CreateBitmap("images\\Restore.png"), "")
        self.main_bar.AddHybridButton(wxID_RIBBONEDITSAVE, "Save",
                                      CreateBitmap("images\\Save Data.png"),
                                      "")

        self.main_bar.EnableButton(wxID_RIBBONEDITRESTORE, False)
        self.main_bar.EnableButton(wxID_RIBBONEDITSAVE, False)
        # self.main_bar.EnableButton(wxID_RIBBONSTOPEDITSERIES, False)

        #------------------------------------------------------------------------------
        edit_panel = RB.RibbonPanel(editPage, wx.ID_ANY, "Edit Functions",
                                    wx.NullBitmap, wx.DefaultPosition,
                                    wx.DefaultSize,
                                    RB.RIBBON_PANEL_NO_AUTO_MINIMISE)
        self.edit_bar = RB.RibbonButtonBar(edit_panel)
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITFILTER, "Filter Points",
                                      CreateBitmap("images\\Filter List.png"),
                                      "")
        self.edit_bar.AddSimpleButton(
            wxID_RIBBONEDITCHGVALUE, "Change Value",
            CreateBitmap("images\\EditView_icon.png"), "")
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITINTEROPOLATE,
                                      "Interpolate",
                                      CreateBitmap("images\\Interpolate.png"),
                                      "")
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITLINFILTER, "Linear Drift",
                                      CreateBitmap("images\\LinDrift.png"), "")
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITFLAG, "Flag",
                                      CreateBitmap("images\\Flag.png"), "")
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITADDPOINT, "Add Point",
                                      CreateBitmap("images\\Add (2).png"), "")
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITDELPOINT, "Delete Point",
                                      CreateBitmap("images\\Delete (3).png"),
                                      "")
        self.edit_bar.AddSimpleButton(
            wxID_RIBBONEDITRECORD,
            "Record",
            bitmap=CreateBitmap("images\\Record.png"),
            help_string="",
            kind=0x4)

        self.edit_bar.EnableButton(wxID_RIBBONEDITFILTER, False)
        self.edit_bar.EnableButton(wxID_RIBBONEDITCHGVALUE, False)
        self.edit_bar.EnableButton(wxID_RIBBONEDITINTEROPOLATE, False)
        self.edit_bar.EnableButton(wxID_RIBBONEDITLINFILTER, False)
        self.edit_bar.EnableButton(wxID_RIBBONEDITFLAG, False)
        self.edit_bar.EnableButton(wxID_RIBBONEDITADDPOINT, False)
        self.edit_bar.EnableButton(wxID_RIBBONEDITDELPOINT, False)
        self.edit_bar.EnableButton(wxID_RIBBONEDITRECORD, False)

        #-------------------------------------------------------------------------------
        # script_panel = RB.RibbonPanel(editPage, wx.ID_ANY, "Script", wx.NullBitmap, wx.DefaultPosition,
        #                                 wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE)
        # script_bar = RB.RibbonButtonBar(script_panel)
        # script_bar.AddSimpleButton(wxID_RIBBONEDITSCRIPTEXECUTE, "Execute",
        #                         CreateBitmap("images\\Window Enter.png"), "")
        # script_bar.AddSimpleButton(wxID_RIBBONEDITSCRIPTOPEN, "Open",
        #                         CreateBitmap("images\\Open file.png"), "")
        # script_bar.AddSimpleButton(wxID_RIBBONEDITSCRIPTNEW, "New",
        #                         CreateBitmap("images\\File New.png"), "")
        # script_bar.AddHybridButton(wxID_RIBBONEDITSCRIPTSAVE, "Save",
        #                         CreateBitmap("images\\Save (2).png"), "")

        #-------------------------------------------------------------------------------
        viewPage = RB.RibbonPage(self, wx.ID_ANY, "View",
                                 CreateBitmap("images\\Brush.png"))
        view_panel = RB.RibbonPanel(viewPage, wx.ID_ANY, "Tools",
                                    wx.NullBitmap, wx.DefaultPosition,
                                    wx.DefaultSize,
                                    RB.RIBBON_PANEL_NO_AUTO_MINIMISE)
        view_bar = RB.RibbonButtonBar(view_panel)
        view_bar.AddSimpleButton(wxID_RIBBONVIEWPLOT, "Plot",
                                 CreateBitmap("images\\Line Chart.png"), "")
        view_bar.AddSimpleButton(wxID_RIBBONVIEWTABLE, "Table",
                                 CreateBitmap("images\\Table.png"), "")
        view_bar.AddSimpleButton(wxID_RIBBONVIEWSERIES, "Series Selector",
                                 CreateBitmap("images\\Bitmap editor.png"), "")
        view_bar.AddSimpleButton(
            wxID_RIBBONVIEWCONSOLE, "Python Console",
            CreateBitmap("images\\Window Command Line.png"), "")
        view_bar.AddSimpleButton(wxID_RIBBONVIEWSCRIPT, "PythonScript",
                                 CreateBitmap("images\\Script.png"), "")
        self.CurrPage = 1
        self.SetActivePageByIndex(self.CurrPage)

        self.BindEvents()
        Publisher.subscribe(self.toggleEditButtons, ("edit.EnableButtons"))
示例#6
0
    def _init_ctrls(self, prnt):
        RB.RibbonBar.__init__(self,  name='ribbon', parent=prnt, id=wxID_PANEL1)
        self.SetArtProvider(RB.RibbonAUIArtProvider())
        self.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL, wx.NORMAL,
              False, u'Tahoma'))
        fileMenu = RB.RibbonPage(self, wxID_FileMenu, "File", wx.Bitmap(gui_utils.get_base_dir() + "\\3d_graph.png"))

#----PlotMenu-------------
        home = RB.RibbonPage(self, wx.ID_ANY, "Plot", wx.Bitmap(gui_utils.get_base_dir() + "\\3d_graph.png"))

  #------Plot Type ---------------------------------------------------------------------------

        plot_panel = RB.RibbonPanel(home, wx.ID_ANY, "Plots", wx.NullBitmap, wx.DefaultPosition,
                                        wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE)
        plots_bar = RB.RibbonButtonBar(plot_panel, wx.ID_ANY)
        plots_bar.AddSimpleButton(wxID_RIBBONPLOTTIMESERIES, "Time Series",
                                wx.Bitmap(gui_utils.get_base_dir() + "\\tsa_icon.png"), "")
        plots_bar.AddSimpleButton(wxID_RIBBONPLOTPROB, "Probablity",
                                wx.Bitmap(gui_utils.get_base_dir() + "\\probability.png"), "")
        plots_bar.AddSimpleButton(wxID_RIBBONPLOTHIST, "Histogram",
                                wx.Bitmap(gui_utils.get_base_dir() + "\\histogram.png"), "")
        plots_bar.AddSimpleButton(wxID_RIBBONPLOTBOX, "Box/Whisker",
                                wx.Bitmap(gui_utils.get_base_dir() + "\\box_whisker.png"), "")
        plots_bar.AddSimpleButton(wxID_RIBBONPLOTSUMMARY, "Summary",
                                wx.Bitmap(gui_utils.get_base_dir() + "\\summary.png"), "")

#-- PLOT OPTIONS-----------------------------------------------------------------------------
        PlotOptions_panel = RB.RibbonPanel(home, wx.ID_ANY, "Plot Options", wx.NullBitmap, wx.DefaultPosition,
                                        wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE)
        self.PlotsOptions_bar = RB.RibbonButtonBar(PlotOptions_panel, wx.ID_ANY)

        self.PlotsOptions_bar.AddDropdownButton(wxID_RIBBONPLOTTSTYPE, "Plot Type",
                                wx.Bitmap(gui_utils.get_base_dir() + "\\plot_type.png"), "")

        self.PlotsOptions_bar.AddSimpleButton(wxID_RIBBONPLOTTSLEGEND, "Show Legend",
                                wx.Bitmap(gui_utils.get_base_dir() + "\\legend.png"), help_string="show legend on plot", kind = 0x4)


        self.PlotsOptions_bar.AddSimpleButton( wxID_RIBBONPLOTDATESTART, "# Hist Bins", wx.Bitmap(gui_utils.get_base_dir() + "\\blank.png"), "")
        self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTDATESTART, False)

        self.spnBins = wx.SpinCtrl(id=wxID_FRAME1SPINCTRL1, initial=50,
              max=100, min=1, name='spnBins', parent=self.PlotsOptions_bar,
              pos= wx.Point(84,6), #without color button
              size=wx.Size(43, 25),style=wx.SP_ARROW_KEYS)
        self.spnBins.Enabled = False


        self.PlotsOptions_bar.AddDropdownButton(wxID_RIBBONPLOTBOXTYPE, "Box Whisker Type",
                                wx.Bitmap(gui_utils.get_base_dir() + "\\box_whisker_type.png"), "")

        self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTTSTYPE, False)
        self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTTSLEGEND, False)
        self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTBOXTYPE, False)




        dateTime_panel = RB.RibbonPanel(home, wx.ID_ANY, "Date Time", wx.NullBitmap, wx.DefaultPosition,
                                        wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE)

        dateTime_buttonbar = RB.RibbonButtonBar(dateTime_panel)

        dateTime_buttonbar.AddSimpleButton( wxID_RIBBONPLOTDATESTART, "" ,wx.Bitmap(gui_utils.get_base_dir() + "\\blank.png"), "")
        dateTime_buttonbar.AddSimpleButton( wxID_RIBBONPLOTDATESTART, "" ,wx.Bitmap(gui_utils.get_base_dir() + "\\blank.png"), "")
        dateTime_buttonbar.AddSimpleButton( wxID_RIBBONPLOTDATESTART, "" ,wx.Bitmap(gui_utils.get_base_dir() + "\\blank.png"), "")
        dateTime_buttonbar.EnableButton(wxID_RIBBONPLOTDATESTART, False)

        self.dpStartDate = wx.DatePickerCtrl(id=wxID_STARTDPDATE, name=u'dpStartDate',
              parent=dateTime_buttonbar, pos=wx.Point(5, 8), size=wx.Size(120, 24),
              style=wx.DP_DROPDOWN)
        self.dpStartDate.SetValue(wx.DateTimeFromDMY(16, 1, 2008, 0, 0, 0))
        self.dpStartDate.SetLabel(repr(wx.DateTimeFromDMY(16, 1, 2008, 0, 0, 0)))
        self.dpStartDate.SetToolTipString(u'Start Date')

        self.dpEndDate = wx.DatePickerCtrl(id=wxID_ENDDPDATE, name=u'dpEndDate',
              parent=dateTime_buttonbar, pos=wx.Point(5, 40), size=wx.Size(120, 24),
              style=wx.DP_DROPDOWN)
        self.dpEndDate.SetValue(wx.DateTimeFromDMY(01, 04, 2008, 0, 0, 0))
        self.dpEndDate.SetLabel(repr(wx.DateTimeFromDMY(1, 04, 2008, 0, 0, 0)))
        self.dpEndDate.SetToolTipString(u'End Date')


        dateTime_buttonbar.AddSimpleButton(wxID_RIBBONPLOTDATEREFRESH, "Refresh",
                                wx.Bitmap(gui_utils.get_base_dir() + "\\date_setting.png"), "")
        dateTime_buttonbar.AddSimpleButton(wxID_RIBBONPLOTDATEFULL, "Full Date Range",
                                wx.Bitmap(gui_utils.get_base_dir() + "\\full_date_range.png"), "")






#-------------------------------------------------------------------------------
        editPage = RB.RibbonPage(self, wx.ID_ANY, "Edit", wx.Bitmap(gui_utils.get_base_dir() + "\\blank.png"))

        main_panel = RB.RibbonPanel(editPage, wx.ID_ANY, "Main", wx.NullBitmap, wx.DefaultPosition,
                                        wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE)
        self.main_bar = RB.RibbonButtonBar(main_panel)
        self.main_bar.AddSimpleButton(wxID_RIBBONEDITSERIES, "Edit Series",
                                bitmap=wx.Bitmap(gui_utils.get_base_dir() + "\\edit.png"), help_string="", kind = 0x4)

        self.main_bar.AddSimpleButton(wxID_RIBBONEDITRESTORE, "Restore",
                                wx.Bitmap(gui_utils.get_base_dir() + "\\restore.png"), "")
        self.main_bar.AddSimpleButton(wxID_RIBBONEDITSAVE, "Save",
                                wx.Bitmap(gui_utils.get_base_dir() + "\\save_data.png"), "")


        self.main_bar.EnableButton(wxID_RIBBONEDITRESTORE, False)
        self.main_bar.EnableButton(wxID_RIBBONEDITSAVE, False)

 #------------------------------------------------------------------------------
        edit_panel = RB.RibbonPanel( editPage, wx.ID_ANY, "Edit Functions" , wx.NullBitmap, wx.DefaultPosition,
                                        wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE)
        self.edit_bar= RB.RibbonButtonBar(edit_panel)
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITFILTER, "Filter Points",
                                wx.Bitmap(gui_utils.get_base_dir() + "\\filter_list.png"), "")
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITCHGVALUE, "Change Value",
                                wx.Bitmap(gui_utils.get_base_dir() + "\\edit_view.png"), "")
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITINTEROPOLATE, "Interpolate",
                                wx.Bitmap(gui_utils.get_base_dir() + "\\interpolate.png"), "")
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITLINFILTER, "Linear Drift",
                                wx.Bitmap(gui_utils.get_base_dir() + "\\lin_drift.png"), "")
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITFLAG, "Flag",
                                wx.Bitmap(gui_utils.get_base_dir() + "\\flag.png"), "")
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITADDPOINT, "Add Point",
                                wx.Bitmap(gui_utils.get_base_dir() + "\\add.png"), "")
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITDELPOINT, "Delete Point",
                                wx.Bitmap(gui_utils.get_base_dir() + "\\delete.png"), "")
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITRECORD, "Record",
                                bitmap= wx.Bitmap(gui_utils.get_base_dir() + "\\record.png"), help_string="", kind = 0x4)

        self.edit_bar.EnableButton(wxID_RIBBONEDITFILTER, False)
        self.edit_bar.EnableButton(wxID_RIBBONEDITCHGVALUE, False)
        self.edit_bar.EnableButton(wxID_RIBBONEDITINTEROPOLATE, False)
        self.edit_bar.EnableButton(wxID_RIBBONEDITLINFILTER, False)
        self.edit_bar.EnableButton(wxID_RIBBONEDITFLAG, False)
        self.edit_bar.EnableButton(wxID_RIBBONEDITADDPOINT, False)
        self.edit_bar.EnableButton(wxID_RIBBONEDITDELPOINT, False)
        self.edit_bar.EnableButton(wxID_RIBBONEDITRECORD, False)

#-------------------------------------------------------------------------------
        viewPage = RB.RibbonPage(self, wx.ID_ANY, "View", wx.Bitmap("images\\blank.png"))
        view_panel = RB.RibbonPanel( viewPage, wx.ID_ANY, "Tools" , wx.NullBitmap, wx.DefaultPosition,
                                        wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE)
        view_bar= RB.RibbonButtonBar(view_panel)
        view_bar.AddSimpleButton(wxID_RIBBONVIEWPLOT, "Plot",
                                wx.Bitmap(gui_utils.get_base_dir() + "\\line_chart.png"), "")
        view_bar.AddSimpleButton(wxID_RIBBONVIEWTABLE, "Table",
                                wx.Bitmap(gui_utils.get_base_dir() + "\\table.png"), "")
        view_bar.AddSimpleButton(wxID_RIBBONVIEWSERIES, "Series Selector",
                                wx.Bitmap(gui_utils.get_base_dir() + "\\bitmap_editor.png"), "")
        view_bar.AddSimpleButton(wxID_RIBBONVIEWCONSOLE, "Python Console",
                                wx.Bitmap(gui_utils.get_base_dir() + "\\window_command_line.png"), "")
        view_bar.AddSimpleButton(wxID_RIBBONVIEWSCRIPT, "PythonScript",
                                wx.Bitmap(gui_utils.get_base_dir() + "\\script.png"), "")
        self.CurrPage = 1
        self.SetActivePageByIndex(self.CurrPage)

        self.BindEvents()
        Publisher.subscribe(self.toggleEditButtons, ("edit.EnableButtons"))