def test_lib_agw_ribbonPageCtor(self): rib = RB.RibbonBar(self.frame, wx.ID_ANY, agwStyle=RB.RIBBON_BAR_DEFAULT_STYLE | RB.RIBBON_BAR_SHOW_PANEL_EXT_BUTTONS) RB.RibbonPage(rib)
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()
def page_project(self): project_page = RB.RibbonPage(self, wx.ID_ANY, 'Project') self.panel_project_file(project_page) self.panel_project_properties(project_page)
def page_gantt_chart(self): # ---------------- GANTT CHART PAGE ---------------- # gantt_page = RB.RibbonPage(self, label='Gantt Chart') self.panel_gantt_basic(gantt_page) self.panel_gantt_edit(gantt_page)
def test_lib_agw_ribbonGalleryCtor(self): rib = RB.RibbonBar(self.frame, wx.ID_ANY, agwStyle=RB.RIBBON_BAR_DEFAULT_STYLE|RB.RIBBON_BAR_SHOW_PANEL_EXT_BUTTONS) page = RB.RibbonPage(rib, wx.ID_ANY, "Appearance") primary_panel = RB.RibbonPanel(page, wx.ID_ANY, "Primary Colour") RB.RibbonGallery(primary_panel)
def test_lib_agw_ribbonPanelCtor(self): rib = RB.RibbonBar(self.frame, wx.ID_ANY, agwStyle=RB.RIBBON_BAR_DEFAULT_STYLE|RB.RIBBON_BAR_SHOW_PANEL_EXT_BUTTONS) page = RB.RibbonPage(rib, wx.ID_ANY, "Appearance") RB.RibbonPanel(page)
def AddViewPage(self): view = RB.RibbonPage(self._ribbon, wx.ID_ANY, "View", wx.NullBitmap) self.AddPerspectivePanel(view)
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"))
def __init__(self, parent, id=-1, title="", pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE): self.frame = wx.Frame.__init__(self, parent, id, title, pos, size, style) # Initiate parent window self.SetIcon(wx.Icon("Icons/Pie.ico", wx.BITMAP_TYPE_ICO)) # Set window icon self.ribbon = RB.RibbonBar(self, -1) # Initiate Ribbon Bar self.CreateStatusBar() # Initiate Status Bar ### ------------------------------------------- Home Tab: id = 100 -------------------------------------------- ### home = RB.RibbonPage(self.ribbon, -1, "Home") # Home tab on bar filePanel = RB.RibbonPanel(home, -1, "File") # File menu fileBar = RB.RibbonButtonBar(filePanel) fileBar.AddSimpleButton(101, "New", wx.Bitmap("Icons/stock_new.png", wx.BITMAP_TYPE_PNG), "") # New document fileBar.AddSimpleButton(102, "Open", wx.Bitmap("Icons/stock_open.png", wx.BITMAP_TYPE_PNG), "") # Open file tool fileBar.AddHybridButton( 103, "Save", wx.Bitmap("Icons/stock_save.png", wx.BITMAP_TYPE_PNG)) # Save file tool fileBar.AddHybridButton(104, "Print", wx.Bitmap("Icons/stock_print.png", wx.BITMAP_TYPE_PNG), "") # Print alignmentPanel = RB.RibbonPanel(home, -1, "Alignment") # Alignment menu alignBar = RB.RibbonButtonBar(alignmentPanel) alignBar.AddSimpleButton(105, "Left", wx.Bitmap("Icons/align_left.png", wx.BITMAP_TYPE_PNG), "") # Left Align alignBar.AddSimpleButton(106, "Center", wx.Bitmap("Icons/align_center.png", wx.BITMAP_TYPE_PNG), "") # Centre Align alignBar.AddSimpleButton(107, "Right", wx.Bitmap("Icons/align_right.png", wx.BITMAP_TYPE_PNG), "") # Right Align toolsPanel = RB.RibbonPanel(home, -1, "Text") # Text menu toolsBar = RB.RibbonButtonBar(toolsPanel) toolsBar.AddSimpleButton(108, "Standard", wx.Bitmap("Icons/bullet_point.png", wx.BITMAP_TYPE_PNG), "") # Standard Bullets toolsBar.AddSimpleButton(109, "Number", wx.Bitmap("Icons/numb_point.png", wx.BITMAP_TYPE_PNG), "") # Numbered Bullets toolsBar.AddSimpleButton(110, "Bold", wx.Bitmap("Icons/stock_text_bold.png", wx.BITMAP_TYPE_PNG), "") # Bold text toolsBar.AddSimpleButton(111, "Italic", wx.Bitmap("Icons/stock_text_italic.png", wx.BITMAP_TYPE_PNG), "") # Italic text toolsBar.AddSimpleButton(112, "Underline", wx.Bitmap("Icons/stock_text_underline.png", wx.BITMAP_TYPE_PNG), "") # Underline Text toolsBar.AddSimpleButton(119, "Highlight", wx.Bitmap("Icons/highlighter_icon.png", wx.BITMAP_TYPE_PNG), "") # Highlight text lineSpace = RB.RibbonPanel(home, -1, "Spacing") # Spacing menu lineBar = RB.RibbonButtonBar(lineSpace) lineBar.AddSimpleButton(113, "Normal", wx.Bitmap("Icons/spacing_normal.png", wx.BITMAP_TYPE_PNG), "") # Single line spacing lineBar.AddSimpleButton(114, "Half", wx.Bitmap("Icons/spacing_half.png", wx.BITMAP_TYPE_PNG), "") # 1 1/2 line spacing lineBar.AddSimpleButton(115, "Double", wx.Bitmap("Icons/spacing_double.png", wx.BITMAP_TYPE_PNG), "") # Double line spacing tabPanel = RB.RibbonPanel(home, -1, "Indent") # Indent menu tabBar = RB.RibbonButtonBar(tabPanel) tabBar.AddSimpleButton(116, "Right", wx.Bitmap("Icons/arrow_right.png", wx.BITMAP_TYPE_PNG), "") # Right indent tabBar.AddSimpleButton(117, "Left", wx.Bitmap("Icons/arrow_left.png", wx.BITMAP_TYPE_PNG), "") # Left indent picPanel = RB.RibbonPanel(home, -1, "Add Pictures") # Pictures menu picBar = RB.RibbonButtonBar(picPanel) picBar.AddSimpleButton(118, "Import", wx.Bitmap("Icons/insert_image.png", wx.BITMAP_TYPE_PNG), "") # Import pics ### ------------------------------------------- Font Tab: id = 200 -------------------------------------------- ### font_tab = RB.RibbonPage(self.ribbon, -1, "Font") # Font tab created fontPanel = RB.RibbonPanel(font_tab, 400, "Font") # Font gallery self.addColours(fontPanel, 200) fontPanel2 = RB.RibbonPanel(font_tab, -1, "Fonts") # Fonts bar fonts = RB.RibbonButtonBar(fontPanel2) fonts.AddSimpleButton( 201, "Font", wx.Bitmap("Icons/edit_pic.jpg", wx.BITMAP_TYPE_JPEG), "") fonts.AddSimpleButton( 202, "Words", wx.Bitmap("Icons/suggestion_icon.png", wx.BITMAP_TYPE_PNG), "") fonts.AddSimpleButton( 203, "Check", wx.Bitmap("Icons/suggestion_icon.png", wx.BITMAP_TYPE_PNG), "") fontPanel.Realize() fontPanel2.Realize() ### ------------------------------------------- End Ribbon ---------------------------------------------------- ### self.rtc = RichTextCtrl(self, style=wx.HSCROLL | wx.NO_BORDER) # Init rich text box wx.CallAfter(self.rtc.SetFocus) # Display text box self.rtc.BeginFont( wx.Font(15, wx.SWISS, wx.NORMAL, wx.NORMAL, False, "Calibri")) box = wx.BoxSizer( wx.VERTICAL) # Resizes widgets within window when resized box.Add(self.ribbon, 0, wx.EXPAND) # Resizes ribbon appropriately box.Add(self.rtc, 1, wx.EXPAND) # Fills in remaining space with text box self.ribbon.Realize() # Displays ribbon self.SetSizer(box) # Initiate self.Show(True) self.bindEvents()
def __init__(self): wx.Frame.__init__( self, None, -1, 'zoop', size=(600, 530), pos=(200, 200), style=wx.CAPTION | wx.CLOSE_BOX | wx.SYSTEM_MENU ) #wx.DEFAULT_FRAME_STYLE|wx.WANTS_CHARS) #^(wx.MINIMIZE_BOX | wx.MAXIMIZE_BOX)) #, style=wx.STAY_ON_TOP) # tell FrameManager to manage this frame self._mgr = wx.aui.AuiManager() self._mgr.SetManagedWindow(self) self.SetMinSize(wx.Size(500, 400)) # xrc gui layout ------------------ # XML Resources can be loaded from a file like this: res1 = xrc.XmlResource(RESFILE_TB) self.m_tb_main = res1.LoadToolBar(self, "m_tb_main") self.m_tb_main.Realize() #tell the frame to not manage teh toolbar, aui manager will instead self.SetToolBar(None) # XML Resources can be loaded from a file like this: res = xrc.XmlResource(RESFILE_PA) self.m_pa_pages = res.LoadPanel(self, "m_pa_pages") self.pa_ribbon = xrc.XRCCTRL(self, 'm_pa_ribbon') self.lc_playlist = xrc.XRCCTRL(self, 'm_lc_playlist') # ribbon bar self._ribbon = RB.RibbonBar(self.pa_ribbon, wx.ID_ANY) dummy_3 = RB.RibbonPage(self._ribbon, wx.ID_ANY, "Playlist") #, CreateBitmap("empty")) dummy_4 = RB.RibbonPage(self._ribbon, wx.ID_ANY, "Last.fm") #, CreateBitmap("empty")) dummy_5 = RB.RibbonPage(self._ribbon, wx.ID_ANY, "Favorites") #, CreateBitmap("empty")) self._ribbon.Realize() bgcolour = self.pa_ribbon.GetBackgroundColour() self._ribbon.GetArtProvider().SetColourScheme(bgcolour, 0, 1) s = wx.BoxSizer(wx.VERTICAL) s.Add(self._ribbon, 1, wx.EXPAND) self.pa_ribbon.SetSizer(s) self.pa_ribbon.SetMinSize((400, 120)) # add a bunch of panes self._mgr.AddPane(self.m_pa_pages, wx.aui.AuiPaneInfo().Name("MainPanel").CenterPane()) self._mgr.AddPane( self.m_tb_main, wx.aui.AuiPaneInfo().Name("Playback").Caption("Playback Toolbar"). ToolbarPane().Top().LeftDockable(False).RightDockable(False)) #self._mgr.AddPane(self.m_pa_pages, wx.aui.AuiPaneInfo(). # Name("Playlist").Caption("Playlist").Top(). # CloseButton(True).MaximizeButton(True)) #self._mgr.AddPane(self._ribbon, wx.aui.AuiPaneInfo(). # Name("Ribbon").Top(). # CloseButton(True).MaximizeButton(True)) # "commit" all changes made to FrameManager self._mgr.Update() #class MainPanel(wx.Panel): # def __init__(self, parent, resfile=RESFILE): # wx.Panel.__init__(self, parent, -1) # self.parent = parent # xml-rpc client xmlrpc = xmlrpc_client.Client() self.cl = xmlrpc.client xmlrpc.ListMethods() # xrc gui layout ------------------ # XML Resources can be loaded from a file like this: # res = xrc.XmlResource(RESFILE) # self.panel = res.LoadPanel(self, "m_pa_main") # self.lc_playlist = xrc.XRCCTRL(self,'m_lc_playlist') self.Bind(wx.EVT_TOOL, self.OnPlayClick, id=xrc.XRCID("m_tl_play")) self.Bind(wx.EVT_TOOL, self.OnStopClick, id=xrc.XRCID("m_tl_stop")) #self.Bind(wx.EVT_BUTTON, self.OnButtonThree, id=xrc.XRCID("m_button3")) #self.Bind(wx.EVT_BUTTON, self.OnLoadClick, id=xrc.XRCID("m_button4")) # and do the layout # sizer = wx.BoxSizer(wx.VERTICAL) # sizer.Add(self.panel, 1, wx.EXPAND|wx.ALL, 0) # self.SetSizer(sizer) # self.SetAutoLayout(True) # self.Layout() self.cl.AddItem({ 'Artist': 'Beck', 'Title': 'Sad Song', 'Location': 'Y:/1.mp3' }) self.cl.AddItem({ 'Artist': 'U2', 'Title': 'Gloria', 'Location': 'Y:/1.mp3', 'Fun': 'yup' }) print self.cl.PrintPlaylist() self.PopulatePlaylist()
def __set_ribbonbar(self): self.ribbonbar_caption_visible = False if self.is_dark: provider = self._ribbon.GetArtProvider() _update_ribbon_artprovider_for_dark_mode(provider) self.ribbon_position_aspect_ratio = True self.ribbon_position_ignore_update = False home = RB.RibbonPage( self._ribbon, ID_PAGE_MAIN, _("Home"), icons8_opened_folder_50.GetBitmap(resize=16), ) self.ribbon_pages.append(home) # self.Bind( # RB.EVT_RIBBONBAR_HELP_CLICK, # lambda e: self.context("webhelp help\n"), # ) self.project_panel = MyRibbonPanel( parent=home, id=wx.ID_ANY, label="" if self.is_dark else _("Project"), agwStyle=RB.RIBBON_PANEL_MINIMISE_BUTTON, ) self.ribbon_panels.append(self.project_panel) button_bar = RibbonButtonBar(self.project_panel) self.project_button_bar = button_bar self.ribbon_bars.append(button_bar) self.control_panel = MyRibbonPanel( parent=home, id=wx.ID_ANY, label="" if self.is_dark else _("Control"), minimised_icon=icons8_opened_folder_50.GetBitmap(), agwStyle=RB.RIBBON_PANEL_MINIMISE_BUTTON, ) self.ribbon_panels.append(self.control_panel) button_bar = RibbonButtonBar(self.control_panel) self.control_button_bar = button_bar self.ribbon_bars.append(button_bar) self.config_panel = MyRibbonPanel( parent=home, id=wx.ID_ANY, label="" if self.is_dark else _("Configuration"), minimised_icon=icons8_opened_folder_50.GetBitmap(), agwStyle=RB.RIBBON_PANEL_MINIMISE_BUTTON, ) self.ribbon_panels.append(self.config_panel) button_bar = RibbonButtonBar(self.config_panel) self.config_button_bar = button_bar self.ribbon_bars.append(button_bar) tool = RB.RibbonPage( self._ribbon, ID_PAGE_TOOL, _("Tools"), icons8_opened_folder_50.GetBitmap(resize=16), ) self.ribbon_pages.append(tool) self.tool_panel = MyRibbonPanel( parent=tool, id=wx.ID_ANY, label="" if self.is_dark else _("Tools"), minimised_icon=icons8_opened_folder_50.GetBitmap(), agwStyle=RB.RIBBON_PANEL_MINIMISE_BUTTON, ) self.ribbon_panels.append(self.tool_panel) button_bar = RibbonButtonBar(self.tool_panel) self.tool_button_bar = button_bar self.ribbon_bars.append(button_bar) self.modify_panel = MyRibbonPanel( parent=tool, id=wx.ID_ANY, label="" if self.is_dark else _("Modification"), minimised_icon=icons8_opened_folder_50.GetBitmap(), agwStyle=RB.RIBBON_PANEL_MINIMISE_BUTTON, ) self.ribbon_panels.append(self.modify_panel) button_bar = RibbonButtonBar(self.modify_panel) self.modify_button_bar = button_bar self.ribbon_bars.append(button_bar) self.geometry_panel = MyRibbonPanel( parent=tool, id=wx.ID_ANY, label="" if self.is_dark else _("Geometry"), minimised_icon=icons8_opened_folder_50.GetBitmap(), agwStyle=RB.RIBBON_PANEL_MINIMISE_BUTTON, ) self.ribbon_panels.append(self.geometry_panel) button_bar = RibbonButtonBar(self.geometry_panel) self.geometry_button_bar = button_bar self.ribbon_bars.append(button_bar) self.align_panel = MyRibbonPanel( parent=tool, id=wx.ID_ANY, label="" if self.is_dark else _("Alignment"), minimised_icon=icons8_opened_folder_50.GetBitmap(), agwStyle=RB.RIBBON_PANEL_MINIMISE_BUTTON, ) self.ribbon_panels.append(self.align_panel) button_bar = RibbonButtonBar(self.align_panel) self.align_button_bar = button_bar self.ribbon_bars.append(button_bar) # self._ribbon.Bind(RB.EVT_RIBBONBAR_PAGE_CHANGING, self.on_page_changing) # minmaxpage = RB.RibbonPage(self._ribbon, ID_PAGE_TOGGLE, "Click me") # self.ribbon_pages.append(minmaxpage) self._ribbon.Bind(RB.EVT_RIBBONBAR_PAGE_CHANGED, self.on_page_changed) self.ensure_realize()
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"))
def __init__(self, parent, id=wx.ID_ANY, title="", pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE, log=None): wx.Frame.__init__(self, parent, id, title, pos, size, style) panel = wx.Panel(self) self._ribbon = RB.RibbonBar(panel, wx.ID_ANY, agwStyle=RB.RIBBON_BAR_DEFAULT_STYLE|RB.RIBBON_BAR_SHOW_PANEL_EXT_BUTTONS) self._bitmap_creation_dc = wx.MemoryDC() self._colour_data = wx.ColourData() home = RB.RibbonPage(self._ribbon, wx.ID_ANY, "Examples", CreateBitmap("ribbon")) toolbar_panel = RB.RibbonPanel(home, wx.ID_ANY, "Toolbar", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, agwStyle=RB.RIBBON_PANEL_NO_AUTO_MINIMISE|RB.RIBBON_PANEL_EXT_BUTTON) toolbar = RB.RibbonToolBar(toolbar_panel, ID_MAIN_TOOLBAR) toolbar.AddTool(wx.ID_ANY, CreateBitmap("align_left")) toolbar.AddTool(wx.ID_ANY, CreateBitmap("align_center")) toolbar.AddTool(wx.ID_ANY, CreateBitmap("align_right")) toolbar.AddSeparator() toolbar.AddHybridTool(wx.ID_NEW, wx.ArtProvider.GetBitmap(wx.ART_NEW, wx.ART_OTHER, wx.Size(16, 15))) toolbar.AddTool(wx.ID_ANY, wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, wx.Size(16, 15))) toolbar.AddTool(wx.ID_ANY, wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE, wx.ART_OTHER, wx.Size(16, 15))) toolbar.AddTool(wx.ID_ANY, wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE_AS, wx.ART_OTHER, wx.Size(16, 15))) toolbar.AddSeparator() toolbar.AddDropdownTool(wx.ID_UNDO, wx.ArtProvider.GetBitmap(wx.ART_UNDO, wx.ART_OTHER, wx.Size(16, 15))) toolbar.AddDropdownTool(wx.ID_REDO, wx.ArtProvider.GetBitmap(wx.ART_REDO, wx.ART_OTHER, wx.Size(16, 15))) toolbar.AddSeparator() toolbar.AddTool(wx.ID_ANY, wx.ArtProvider.GetBitmap(wx.ART_REPORT_VIEW, wx.ART_OTHER, wx.Size(16, 15))) toolbar.AddTool(wx.ID_ANY, wx.ArtProvider.GetBitmap(wx.ART_LIST_VIEW, wx.ART_OTHER, wx.Size(16, 15))) toolbar.AddSeparator() toolbar.AddHybridTool(ID_POSITION_LEFT, CreateBitmap("position_left"), "Align ribbonbar vertically\non the left\nfor demonstration purposes") toolbar.AddHybridTool(ID_POSITION_TOP, CreateBitmap("position_top"), "Align the ribbonbar horizontally\nat the top\nfor demonstration purposes") toolbar.AddSeparator() toolbar.AddHybridTool(wx.ID_PRINT, wx.ArtProvider.GetBitmap(wx.ART_PRINT, wx.ART_OTHER, wx.Size(16, 15)), "This is the Print button tooltip\ndemonstrating a tooltip") toolbar.SetRows(2, 3) selection_panel = RB.RibbonPanel(home, wx.ID_ANY, "Selection", CreateBitmap("selection_panel")) selection = RB.RibbonButtonBar(selection_panel) selection.AddSimpleButton(ID_SELECTION_EXPAND_V, "Expand Vertically", CreateBitmap("expand_selection_v"), "This is a tooltip for Expand Vertically\ndemonstrating a tooltip") selection.AddSimpleButton(ID_SELECTION_EXPAND_H, "Expand Horizontally", CreateBitmap("expand_selection_h"), "") selection.AddButton(ID_SELECTION_CONTRACT, "Contract", CreateBitmap("auto_crop_selection"), CreateBitmap("auto_crop_selection_small")) shapes_panel = RB.RibbonPanel(home, wx.ID_ANY, "Shapes", CreateBitmap("circle_small")) shapes = RB.RibbonButtonBar(shapes_panel) shapes.AddButton(ID_CIRCLE, "Circle", CreateBitmap("circle"), CreateBitmap("circle_small"), help_string="This is a tooltip for the circle button\ndemonstrating another tooltip", kind=RB.RIBBON_BUTTON_TOGGLE) shapes.AddSimpleButton(ID_CROSS, "Cross", CreateBitmap("cross"), "") shapes.AddHybridButton(ID_TRIANGLE, "Triangle", CreateBitmap("triangle")) shapes.AddSimpleButton(ID_SQUARE, "Square", CreateBitmap("square"), "") shapes.AddDropdownButton(ID_POLYGON, "Other Polygon", CreateBitmap("hexagon"), "") sizer_panel = RB.RibbonPanel(home, wx.ID_ANY, "Panel with Sizer", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, agwStyle=RB.RIBBON_PANEL_DEFAULT_STYLE) strs = ["Item 1 using a box sizer now", "Item 2 using a box sizer now"] sizer_panelcombo = wx.ComboBox(sizer_panel, wx.ID_ANY, "", wx.DefaultPosition, wx.DefaultSize, strs, wx.CB_READONLY) sizer_panelcombo2 = wx.ComboBox(sizer_panel, wx.ID_ANY, "", wx.DefaultPosition, wx.DefaultSize, strs, wx.CB_READONLY) sizer_panelcombo.Select(0) sizer_panelcombo2.Select(1) sizer_panelcombo.SetMinSize(wx.Size(150, -1)) sizer_panelcombo2.SetMinSize(wx.Size(150, -1)) # not using wx.WrapSizer(wx.HORIZONTAL) as it reports an incorrect min height sizer_panelsizer = wx.BoxSizer(wx.VERTICAL) sizer_panelsizer.AddStretchSpacer(1) sizer_panelsizer.Add(sizer_panelcombo, 0, wx.ALL|wx.EXPAND, 2) sizer_panelsizer.Add(sizer_panelcombo2, 0, wx.ALL|wx.EXPAND, 2) sizer_panelsizer.AddStretchSpacer(1) sizer_panel.SetSizer(sizer_panelsizer) label_font = wx.Font(8, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_LIGHT) self._bitmap_creation_dc.SetFont(label_font) scheme = RB.RibbonPage(self._ribbon, wx.ID_ANY, "Appearance", CreateBitmap("eye")) self._default_primary, self._default_secondary, self._default_tertiary = self._ribbon.GetArtProvider().GetColourScheme(1, 1, 1) provider_panel = RB.RibbonPanel(scheme, wx.ID_ANY, "Art", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, agwStyle=RB.RIBBON_PANEL_NO_AUTO_MINIMISE) provider_bar = RB.RibbonButtonBar(provider_panel, wx.ID_ANY) provider_bar.AddSimpleButton(ID_DEFAULT_PROVIDER, "Default Provider", wx.ArtProvider.GetBitmap(wx.ART_QUESTION, wx.ART_OTHER, wx.Size(32, 32)), "") provider_bar.AddSimpleButton(ID_AUI_PROVIDER, "AUI Provider", CreateBitmap("aui_style"), "") provider_bar.AddSimpleButton(ID_MSW_PROVIDER, "MSW Provider", CreateBitmap("msw_style"), "") primary_panel = RB.RibbonPanel(scheme, wx.ID_ANY, "Primary Colour", CreateBitmap("colours")) self._primary_gallery = self.PopulateColoursPanel(primary_panel, self._default_primary, ID_PRIMARY_COLOUR) secondary_panel = RB.RibbonPanel(scheme, wx.ID_ANY, "Secondary Colour", CreateBitmap("colours")) self._secondary_gallery = self.PopulateColoursPanel(secondary_panel, self._default_secondary, ID_SECONDARY_COLOUR) dummy_2 = RB.RibbonPage(self._ribbon, wx.ID_ANY, "Empty Page", CreateBitmap("empty")) dummy_3 = RB.RibbonPage(self._ribbon, wx.ID_ANY, "Another Page", CreateBitmap("empty")) self._ribbon.Realize() self._logwindow = wx.TextCtrl(panel, wx.ID_ANY, "", wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_LEFT | wx.TE_BESTWRAP | wx.BORDER_NONE) self._togglePanels = wx.ToggleButton(panel, ID_TOGGLE_PANELS, "&Toggle panels") self._togglePanels.SetValue(True) s = wx.BoxSizer(wx.VERTICAL) s.Add(self._ribbon, 0, wx.EXPAND) s.Add(self._logwindow, 1, wx.EXPAND) s.Add(self._togglePanels, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 10) panel.SetSizer(s) self.panel = panel self.BindEvents([selection, shapes, provider_bar, toolbar_panel]) self.CenterOnScreen() self.Show()
def setupRibbonBar(self): self._bitmap_creation_dc = wx.MemoryDC() self._colour_data = wx.ColourData() label_font = wx.Font(8, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_LIGHT) ###################################################################### ## Ribbon Tab: Config ###################################################################### config = RB.RibbonPage(self._ribbon, wx.ID_ANY, "Platform") ## Panel: Config.Boundary config_boundary_panel = RB.RibbonPanel( config, wx.ID_ANY, "Boundary", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, agwStyle=RB.RIBBON_PANEL_NO_AUTO_MINIMISE) config_boundary_selection = RB.RibbonButtonBar(config_boundary_panel, wx.ID_ANY) config_boundary_selection.AddSimpleButton(ID_CONFIG_REALM, "Realm", CreateBitmap("Cloud"), "Realm settings") config_boundary_selection.AddSimpleButton(ID_CONFIG_NETWORK_SCOPES, "Networks", CreateBitmap("Wrench"), "Network scopes") ## Panel: Config.PlatformConfiguration config_base_panel = RB.RibbonPanel( config, wx.ID_ANY, "Configuration", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, agwStyle=RB.RIBBON_PANEL_NO_AUTO_MINIMISE) config_base_selection = RB.RibbonButtonBar(config_base_panel, wx.ID_ANY) config_base_selection.AddSimpleButton(ID_CONFIG_OSPARAMETERS, "OS Parameters", CreateBitmap("System"), "Base OS Parameters") config_base_selection.AddSimpleButton(ID_CONFIG_CONFIGGROUPS, "Config Groups", CreateBitmap("Components"), "Config Group settings") config_base_selection.AddSimpleButton(ID_CONFIG_DEFAULTCONFIG, "Default Config", CreateBitmap("BoxWhiteClosed"), "Default Config settings") ## Panel: Config.Accounts config_accounts_panel = RB.RibbonPanel( config, wx.ID_ANY, "Accounts", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, agwStyle=RB.RIBBON_PANEL_NO_AUTO_MINIMISE) config_accounts_selection = RB.RibbonButtonBar(config_accounts_panel, wx.ID_ANY) config_accounts_selection.AddSimpleButton(ID_ACCOUNTS_CREDENTIALS, "Credentials", CreateBitmap("UserBlue"), "Protocol credentials") config_accounts_selection.AddSimpleButton(ID_ACCOUNTS_USERS, "API Users", CreateBitmap("User"), "API user accounts") ###################################################################### ## Ribbon Tab: Data ###################################################################### content = RB.RibbonPage(self._ribbon, wx.ID_ANY, "Data") ## Panel: Data.Content content_objects_panel = RB.RibbonPanel(content, wx.ID_ANY, "Content") content_objects_selection = RB.RibbonButtonBar(content_objects_panel) content_objects_selection.AddSimpleButton(ID_BROWSE_OBJECTS, "Objects", CreateBitmap("DataFind"), "Objects in the database") content_objects_selection.AddSimpleButton( ID_BROWSE_VIEWS_SIMPLE, "Simple Queries", CreateBitmap("EyeGlasses"), "Query results in visual graph form") content_objects_selection.AddSimpleButton( ID_BROWSE_VIEWS_INPUT, "Input Driven", CreateBitmap("ChartDot"), "Input Driven Query results in visual graph form") content_objects_selection.AddSimpleButton(ID_CONFIG_INSERT_OBJECT, "Insert Object ", CreateBitmap("FormBlue"), "Manually insert an object") ## Panel: Data.Models content_models_panel = RB.RibbonPanel(content, wx.ID_ANY, "Models") content_models_selection = RB.RibbonButtonBar(content_models_panel) content_models_selection.AddSimpleButton(ID_MODELS_METADATA_INSERT, "Insert MetaData", CreateBitmap("Blueprint"), "Insert model blueprint") content_models_selection.AddSimpleButton(ID_MODELS_METADATA_UPDATE, "Update MetaData", CreateBitmap("BlueprintEdit"), "Update model blueprint") content_models_selection.AddSimpleButton( ID_MODELS_METADATA_DELETE, "Delete MetaData", CreateBitmap("BlueprintDelete"), "Delete model blueprint") content_models_selection.AddSimpleButton( ID_MODELS_VIEWS, "Views", CreateBitmap("Branch"), "Model presented in visual tree form") content_models_selection.AddSimpleButton( ID_MODELS_HISTORY, "Model History", CreateBitmap("History"), "Snapshots of models over time") content_models_selection.AddSimpleButton( ID_MODELS_META_HISTORY, "MetaData History", CreateBitmap("DataScroll"), "Snapshots of MetaData over time") ###################################################################### ## Ribbon Tab: Jobs ###################################################################### jobs = RB.RibbonPage(self._ribbon, wx.ID_ANY, "Jobs") ## Panel: Jobs.View jobs_view_panel = RB.RibbonPanel( jobs, wx.ID_ANY, "View", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, agwStyle=RB.RIBBON_PANEL_NO_AUTO_MINIMISE) jobs_view_selection = RB.RibbonButtonBar(jobs_view_panel, wx.ID_ANY) jobs_view_selection.AddSimpleButton(ID_JOBS_LIST, "Listing", CreateBitmap("TextList"), "Job listing") jobs_view_selection.AddSimpleButton(ID_JOBS_STATS, "Statistics", CreateBitmap("Info"), "Job statistics") jobs_view_selection.AddSimpleButton(ID_JOBS_SCHEDULE, "Schedules", CreateBitmap("DateTime"), "View job schedules") ## Panel: Jobs.Modify jobs_modify_panel = RB.RibbonPanel( jobs, wx.ID_ANY, "Modify", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, agwStyle=RB.RIBBON_PANEL_NO_AUTO_MINIMISE) jobs_modify_selection = RB.RibbonButtonBar(jobs_modify_panel, wx.ID_ANY) jobs_modify_selection.AddSimpleButton(ID_JOBS_TOGGLE, "Toggle", CreateBitmap("Replace"), "Enable/Disable jobs") jobs_modify_selection.AddSimpleButton(ID_JOBS_EDIT, "Config", CreateBitmap("ControlPanel"), "Edit job configurations") self._bitmap_creation_dc.SetFont(label_font) self._ribbon.Realize() return [ jobs_view_panel, jobs_modify_panel, config_accounts_panel, config_boundary_panel, config_base_panel, content_models_panel, content_objects_panel ]
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"Geochemical QAQC Program", pos=wx.DefaultPosition, size=wx.Size(700, 700), style=wx.DEFAULT_FRAME_STYLE) self.SetSizeHints(wx.DefaultSize, wx.DefaultSize) box = wx.BoxSizer(wx.VERTICAL) open_Proj = wx.Window.NewControlId() save_Proj = wx.Window.NewControlId() exp_Rep = wx.Window.NewControlId() std_db = wx.Window.NewControlId() open_Setting = wx.Window.NewControlId() exit_bot = wx.Window.NewControlId() self.rb = rb.RibbonBar(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.lib.agw.ribbon.RIBBON_BAR_DEFAULT_STYLE) self.Page1 = rb.RibbonPage(self.rb, wx.ID_ANY, u"MyRibbonPage", wx.NullBitmap, 0) self.file_panel = rb.RibbonPanel( self.Page1, wx.ID_ANY, wx.EmptyString, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, wx.lib.agw.ribbon.RIBBON_PANEL_DEFAULT_STYLE) self.rbb1 = rb.RibbonButtonBar(self.file_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0) self.rbb1.AddSimpleButton( open_Proj, u"Open Project", wx.Bitmap(u"img/open_47.png", wx.BITMAP_TYPE_ANY), wx.EmptyString) self.rbb1.AddSimpleButton( save_Proj, u"Save Project", wx.Bitmap(u"img/save_47.png", wx.BITMAP_TYPE_ANY), wx.EmptyString) self.rbb1.AddSimpleButton( exp_Rep, u"Print Report", wx.Bitmap(u"img/report_47.png", wx.BITMAP_TYPE_ANY), wx.EmptyString) self.db_panel = rb.RibbonPanel( self.Page1, wx.ID_ANY, wx.EmptyString, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, wx.lib.agw.ribbon.RIBBON_PANEL_DEFAULT_STYLE) self.rbb2 = rb.RibbonButtonBar(self.db_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0) self.rbb2.AddSimpleButton( std_db, u"Standard Database", wx.Bitmap(u"img/database_47.png", wx.BITMAP_TYPE_ANY), wx.EmptyString) self.exit_panel = rb.RibbonPanel( self.Page1, wx.ID_ANY, wx.EmptyString, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, wx.lib.agw.ribbon.RIBBON_PANEL_DEFAULT_STYLE) self.rbb3 = rb.RibbonButtonBar(self.exit_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0) self.rbb3.AddSimpleButton( open_Setting, u" Settings", wx.Bitmap(u"img/set_47.png", wx.BITMAP_TYPE_ANY), wx.EmptyString) self.rbb3.AddSimpleButton( exit_bot, u" Exit", wx.Bitmap(u"img/exit_47.png", wx.BITMAP_TYPE_ANY), wx.EmptyString) self.rb.Realize() #Set buttom event in the Ribbon buttons self.rbb1.Bind(rb.EVT_RIBBONBUTTONBAR_CLICKED, self.openProject, id=open_Proj) self.rbb1.Bind(rb.EVT_RIBBONBUTTONBAR_CLICKED, self.SaveProject, id=save_Proj) self.rbb1.Bind(rb.EVT_RIBBONBUTTONBAR_CLICKED, self.ExportReport, id=exp_Rep) self.rbb2.Bind(rb.EVT_RIBBONBUTTONBAR_CLICKED, self.StandardDB, id=std_db) self.rbb3.Bind(rb.EVT_RIBBONBUTTONBAR_CLICKED, self.open_Setting, None, id=open_Setting) self.rbb3.Bind(rb.EVT_RIBBONBUTTONBAR_CLICKED, self.Onclose, None, id=exit_bot) box.Add(self.rb, 0, wx.ALL | wx.EXPAND, 5) self.note = wx.Notebook(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0) self.data_panel = wx.Panel(self.note, wx.ID_ANY, wx.DefaultPosition, wx.Size(-1, -1), 0) box1 = wx.BoxSizer(wx.HORIZONTAL) self.Datagrid = wx.grid.Grid(self.data_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0) # Grid self.Datagrid.CreateGrid(100, 4) self.Datagrid.EnableEditing(True) self.Datagrid.EnableGridLines(True) self.Datagrid.EnableDragGridSize(False) self.Datagrid.SetMargins(50, 0) # Columns self.Datagrid.SetColSize(0, 100) self.Datagrid.SetColSize(1, 100) self.Datagrid.SetColSize(2, 100) self.Datagrid.SetColSize(3, 100) self.Datagrid.EnableDragColMove(False) self.Datagrid.EnableDragColSize(True) self.Datagrid.SetColLabelSize(30) self.Datagrid.SetColLabelValue(0, u"Sample ID") self.Datagrid.SetColLabelValue(1, u"Sample Type") self.Datagrid.SetColLabelValue(2, u"Duplicate") self.Datagrid.SetColLabelValue(3, u"Assay 01") #self.Datagrid.SetColLabelValue( 4, u"Assay 02" ) #self.Datagrid.SetColLabelValue( 5, u"Assay 03" ) self.Datagrid.SetColLabelAlignment(wx.ALIGN_CENTER, wx.ALIGN_CENTER) # Rows self.Datagrid.EnableDragRowSize(True) self.Datagrid.SetRowLabelSize(50) self.Datagrid.SetRowLabelAlignment(wx.ALIGN_CENTER, wx.ALIGN_CENTER) # Label Appearance # Cell Defaults self.Datagrid.SetDefaultCellAlignment(wx.ALIGN_CENTER, wx.ALIGN_TOP) box1.Add(self.Datagrid, 0, wx.ALL, 5) box2 = wx.BoxSizer(wx.VERTICAL) box2.Add((0, 0), 1, wx.EXPAND, 5) self.m_staticText2 = wx.StaticText(self.data_panel, wx.ID_ANY, u"Open Data File ", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText2.Wrap(-1) box2.Add(self.m_staticText2, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) self.open_file = wx.BitmapButton(self.data_panel, wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW | 0) self.open_file.SetBitmap( wx.Bitmap(u"img/opendata_47.png", wx.BITMAP_TYPE_ANY)) box2.Add(self.open_file, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) #Set open file data function self.open_file.Bind(wx.EVT_BUTTON, self.LoadData) box2.Add((0, 0), 1, 0, 5) self.m_staticText2 = wx.StaticText(self.data_panel, wx.ID_ANY, u"Clear Data ", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText2.Wrap(-1) box2.Add(self.m_staticText2, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) self.clear_datagrid = wx.BitmapButton(self.data_panel, wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW | 0) self.clear_datagrid.SetBitmap( wx.Bitmap(u"img/trash_47.png", wx.BITMAP_TYPE_ANY)) box2.Add(self.clear_datagrid, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) #Set open file data function self.clear_datagrid.Bind(wx.EVT_BUTTON, self.clear_DataGrid) box2.Add((0, 0), 1, 0, 5) self.m_sline = wx.StaticLine(self.data_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) box2.Add(self.m_sline, 0, wx.EXPAND | wx.ALL, 5) #set the Technical Manager self.m_st_technicalman = wx.StaticText(self.data_panel, wx.ID_ANY, u"Technical Manager:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_st_technicalman.Wrap(-1) box2.Add(self.m_st_technicalman, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) self.m_Tech = wx.TextCtrl(self.data_panel, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) box2.Add(self.m_Tech, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) #set the Batch name self.m_st_batch = wx.StaticText(self.data_panel, wx.ID_ANY, u"Batch Name:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_st_batch.Wrap(-1) box2.Add(self.m_st_batch, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) self.m_Bath = wx.TextCtrl(self.data_panel, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) box2.Add(self.m_Bath, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) self.m_staticText3 = wx.StaticText(self.data_panel, wx.ID_ANY, u"Run", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText3.Wrap(-1) box2.Add(self.m_staticText3, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) self.run_bot = wx.BitmapButton(self.data_panel, wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW | 0) self.run_bot.SetBitmap(wx.Bitmap(u"img/run_47.png", wx.BITMAP_TYPE_ANY)) box2.Add(self.run_bot, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) #Set open file data function self.run_bot.Bind(wx.EVT_BUTTON, self.runProject) box2.Add((0, 0), 1, wx.EXPAND, 5) box1.Add(box2, 1, wx.EXPAND, 5) self.data_panel.SetSizer(box1) self.data_panel.Layout() box1.Fit(self.data_panel) self.note.AddPage(self.data_panel, u"DATA", True) #Set the report panel self.report_panel = wx.Panel(self.note, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) gs_report = wx.BoxSizer(wx.VERTICAL) self.buttonpanel = pdfButtonPanel(self.report_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0) self.pdfViewer = pdfViewer(self.report_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.HSCROLL | wx.VSCROLL | wx.SUNKEN_BORDER) self.pdfViewer.UsePrintDirect = "False" # introduce buttonpanel and viewer to each other self.buttonpanel.viewer = self.pdfViewer self.pdfViewer.buttonpanel = self.buttonpanel #add the buutonpanel and pdfviewer to boxsizer gs_report.Add(self.buttonpanel, 1, wx.ALL, 5) gs_report.Add(self.pdfViewer, 100, wx.EXPAND | wx.ALL, 5) self.report_panel.SetSizer(gs_report) self.report_panel.Layout() gs_report.Fit(self.report_panel) self.note.AddPage(self.report_panel, u"Report", False) box.Add(self.note, 1, wx.EXPAND | wx.ALL, 5) self.SetSizer(box) self.Layout() self.Centre(wx.BOTH) #set the types self.type = ["SMP", "BLANK", "DUP"] #Load std for list self.Load_STD() #set the setting parameters self.Get_setting() #clear temporary files self.Clear_tempFiles() #set Datagrid cell Editor for fill with list self.type_editor = wx.grid.GridCellChoiceEditor(self.type, True) #set the editor cell for i in range(0, 100): self.Datagrid.SetCellEditor(i, 1, self.type_editor)