コード例 #1
0
    def __init__(self, plotCanvas, multPlots= False, allowselect = False):
        
        NavigationToolbar.__init__(self, plotCanvas)        
        # delete the toolbar button we don't want
        if (not multPlots):
            CONFIGURE_SUBPLOTS_TOOLBAR_BTN_POSITION = 7
            self.DeleteToolByPos(CONFIGURE_SUBPLOTS_TOOLBAR_BTN_POSITION)
            

        self.AddSimpleTool(self.ON_CUSTOM_LEFT, 
                           wx.Bitmap(os.path.join(g_util.resource_path("images"), "scroll_left.png")),
                           'Pan to the left', 'Pan graph to the left')
        wx.EVT_TOOL(self, self.ON_CUSTOM_LEFT, self._on_custom_pan_left)
        self.AddSimpleTool(self.ON_CUSTOM_RIGHT, 
                           wx.Bitmap(g_util.resource_path("images" + g_util.slash() + "scroll_right.png")),
                           'Pan to the right', 'Pan graph to the right')
        wx.EVT_TOOL(self, self.ON_CUSTOM_RIGHT, self._on_custom_pan_right)
        

        self.SetToolBitmapSize(wx.Size(16, 16))        
        self.Realize()
コード例 #2
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(g_util.resource_path("images" + g_util.slash() + "3d_graph.png")))

#----PlotMenu-------------
        home = RB.RibbonPage(self, wx.ID_ANY, "Plot", wx.Bitmap(g_util.resource_path("images" + g_util.slash() + "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(g_util.resource_path("images" + g_util.slash() + "tsa_icon.png")), "")
        plots_bar.AddSimpleButton(wxID_RIBBONPLOTPROB, "Probablity",
                                wx.Bitmap(g_util.resource_path("images" + g_util.slash() + "probability.png")), "")
        plots_bar.AddSimpleButton(wxID_RIBBONPLOTHIST, "Histogram",
                                wx.Bitmap(g_util.resource_path("images" + g_util.slash() + "histogram.png")), "")
        plots_bar.AddSimpleButton(wxID_RIBBONPLOTBOX, "Box/Whisker",
                                wx.Bitmap(g_util.resource_path("images" + g_util.slash() + "box_whisker.png")), "")
        plots_bar.AddSimpleButton(wxID_RIBBONPLOTSUMMARY, "Summary",
                                wx.Bitmap(g_util.resource_path("images" + g_util.slash() + "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(g_util.resource_path("images" + g_util.slash() + "plot_type.png")), "")

        self.PlotsOptions_bar.AddSimpleButton(wxID_RIBBONPLOTTSLEGEND, "Show Legend",
                                wx.Bitmap(g_util.resource_path("images" + g_util.slash() + "legend.png")), help_string="show legend on plot", kind = 0x4)


        self.PlotsOptions_bar.AddSimpleButton( wxID_RIBBONPLOTDATESTART, "# Hist Bins" ,
                                wx.Bitmap(g_util.resource_path("images" + g_util.slash() + "blank.png")), "")


        self.PlotsOptions_bar.AddSimpleButton( wxID_RIBBONPLOTDATESTART, "# Hist Bins", 
                                wx.Bitmap(g_util.resource_path("images" + g_util.slash()  + "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(g_util.resource_path("images" + g_util.slash() + "box_whisker_type.png")), "")

        self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTTSTYPE, False)
        self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTTSLEGEND, 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_RIBBONPLOTDATESTART, "" ,
                                            wx.Bitmap(g_util.resource_path("images" + g_util.slash() + "Blank.png")), "")
        self.dateTime_buttonbar.AddSimpleButton( wxID_RIBBONPLOTDATESTART, "" ,
                                            wx.Bitmap(g_util.resource_path("images" + g_util.slash() + "Blank.png")), "")
        self.dateTime_buttonbar.AddSimpleButton( wxID_RIBBONPLOTDATESTART, "" ,
                                            wx.Bitmap(g_util.resource_path("images" + g_util.slash() + "Blank.png")), "")
        self.dateTime_buttonbar.EnableButton(wxID_RIBBONPLOTDATESTART, 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.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=self.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')

        self.dateTime_buttonbar.AddSimpleButton(wxID_RIBBONPLOTDATEFULL, "Full Date Range",
                                wx.Bitmap(g_util.resource_path("images" + g_util.slash() + "full_date_range.png")), "")

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



#-------------------------------------------------------------------------------
        editPage = RB.RibbonPage(self, wx.ID_ANY, "Edit", 
                                wx.Bitmap(g_util.resource_path("images" + g_util.slash() + "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(g_util.resource_path("images" + g_util.slash() + "edit.png")), help_string="", kind = 0x4)

        self.main_bar.AddSimpleButton(wxID_RIBBONEDITRESTORE, "Restore",
                                wx.Bitmap(g_util.resource_path("images" + g_util.slash() + "restore.png")), "")
        self.main_bar.AddSimpleButton(wxID_RIBBONEDITSAVE, "Save",
                                wx.Bitmap(g_util.resource_path("images" + g_util.slash() + "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(g_util.resource_path("images" + g_util.slash() + "filter_list.png")), "")
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITCHGVALUE, "Change Value",
                                wx.Bitmap(g_util.resource_path("images" + g_util.slash() + "edit_view.png")), "")
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITINTEROPOLATE, "Interpolate",
                                wx.Bitmap(g_util.resource_path("images" + g_util.slash() + "interpolate.png")), "")
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITLINFILTER, "Linear Drift",
                                wx.Bitmap(g_util.resource_path("images" + g_util.slash() + "lin_drift.png")), "")
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITFLAG, "Flag",
                                wx.Bitmap(g_util.resource_path("images" + g_util.slash() + "flag.png")), "")
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITADDPOINT, "Add Point",
                                wx.Bitmap(g_util.resource_path("images" + g_util.slash() + "add.png")), "")
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITDELPOINT, "Delete Point",
                                wx.Bitmap(g_util.resource_path("images" + g_util.slash() + "delete.png")), "")
        self.edit_bar.AddSimpleButton(wxID_RIBBONEDITRECORD, "Record",
                                bitmap= wx.Bitmap(g_util.resource_path("images" + g_util.slash() + "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(g_util.resource_path("images" + g_util.slash() + "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(g_util.resource_path("images" + g_util.slash() + "line_chart.png")), "")
        view_bar.AddSimpleButton(wxID_RIBBONVIEWTABLE, "Table",
                                wx.Bitmap(g_util.resource_path("images" + g_util.slash() + "table.png")), "")
        view_bar.AddSimpleButton(wxID_RIBBONVIEWSERIES, "Series Selector",
                                wx.Bitmap(g_util.resource_path("images" + g_util.slash() + "bitmap_editor.png")), "")
        view_bar.AddSimpleButton(wxID_RIBBONVIEWCONSOLE, "Python Console",
                                wx.Bitmap(g_util.resource_path("images" + g_util.slash() + "window_command_line.png")), "")
        view_bar.AddSimpleButton(wxID_RIBBONVIEWSCRIPT, "PythonScript",
                                wx.Bitmap(g_util.resource_path("images" + g_util.slash() + "script.png")), "")

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

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